genosdb 0.33.4 → 0.33.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -144,7 +144,7 @@ PERFORMANCE OF THIS SOFTWARE.
144
144
  this.index += bytes;
145
145
  return value;
146
146
  }
147
- `),Qq.prototype[W]=X.toFunction({assertSize:Rj})});HE.exports=Qq;function Rj(W,X){if(W>X)throw new sc(W,X)}});var O8=V1((Qq0,CE)=>{var Lj=wV(),tc=lB(),ec=iB(),Wl=aB(),Xl=tB(),Gl=XE(),zE=YE(),Yl=ZE(),Jl=QE(),{encode:jE}=KV(),{decode:KE}=wY(),{encodingLength:Zl}=DV(),Vl=AE(),DE=zY(),OE={array:tc,bool:Wl,buffer:ec,reserved:Xl,string:Gl,when:Yl,select:Jl};for(let W of Object.keys(zE))OE[W]=zE[W];var Nq=Symbol("schema");function IE(W){let X=new Lj({readableObjectMode:!1,writableObjectMode:!0,transform:Ul});return X[Nq]=W,X}function wE(W){let X=null,G=Buffer.isBuffer(W);if(!G)X=W;let Y=new Lj({transform:Ql,readableObjectMode:!0,writableObjectMode:!1});if(Y[Nq]=X,G)Y.append(W);return Y}function Ul(W,X,G){try{jE(W,this[Nq],this);let Y=this.slice();this.consume(Y.length),G(null,Y)}catch(Y){G(Y)}}function Ql(W,X,G){this.append(W);try{while(this.length>0){let Y=new Vl(this),J=KE(Y,this[Nq]);Y.commit(),this.push(J)}G()}catch(Y){if(Y instanceof DE)G();else G(Y)}}CE.exports={createEncodeStream:IE,createDecodeStream:wE,encode:jE,decode:KE,encodingLength:Zl,createEncode:IE,createDecode:wE,types:OE,BinaryStream:Lj,NotEnoughDataError:DE}});var O$=V1((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});K$.LEB128=K$.SignedLEB128=K$.UnsignedLEB128=void 0;var MY;(function(W){W[W.LOWER_7=127]="LOWER_7",W[W.UPPER_1=128]="UPPER_1"})(MY||(MY={}));var j$=(W)=>Number.isSafeInteger(W);class PY{static decode(W,X=0){let G=this.$scanForNullBytes(W,X),Y=0,J=0;for(let Z=0;Z<=G-X;Z++){let V=W[X+Z]&MY.LOWER_7;Y|=V<<J,J+=7}return Y}static encode(W){if(this.check(W),W<0)throw Error(`An unsigned number must NOT be negative, ${W} is!`);let X=[],G=W;do{let Y=G&MY.LOWER_7;if(G>>=7,G)Y=Y|MY.UPPER_1;X.push(Y)}while(G);return Uint8Array.from(X)}static check(W){if(!j$(W))throw Error(`${W} is not a safe integer!`)}static $scanForNullBytes(W,X=0){let G=X,Y=0;do{if(G>=W.byteLength)throw Error("This is not a LEB128-encoded Uint8Array, no ending found!");Y=W.slice(G,G+1)[0],G++}while(Y&MY.UPPER_1);return G-1}static getLength(W,X=0){return this.$scanForNullBytes(W,X)-X}}K$.UnsignedLEB128=PY;class Pq{static $ceil7mul(W){let X=W;while(X%7)X++;return X}static check(W){if(!j$(W))throw Error(`${W} is not a safe integer!`)}static encode(W){if(this.check(W),W>=0)throw Error(`A signed number must be negative, ${W} isn't!`);let X=Math.ceil(Math.log2(-W));return PY.encode((1<<this.$ceil7mul(X))+W)}static decode(W,X=0){let G=PY.decode(W,X);return-((1<<Math.ceil(Math.log2(G)))-G)}}K$.SignedLEB128=Pq;class Rq{}K$.LEB128=Rq;Rq.encode=(W)=>(W>=0?PY:Pq).encode(W);Rq.decode=(W,X=0,G=!1)=>(G?Pq:PY).decode(W,X)});var T$=V1((oj,C$)=>{/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */(function(W){function X(B){return parseInt(B)===B}function G(B){if(!X(B.length))return!1;for(var S=0;S<B.length;S++)if(!X(B[S])||B[S]<0||B[S]>255)return!1;return!0}function Y(B,S){if(B.buffer&&B.name==="Uint8Array"){if(S)if(B.slice)B=B.slice();else B=Array.prototype.slice.call(B);return B}if(Array.isArray(B)){if(!G(B))throw Error("Array contains invalid value: "+B);return new Uint8Array(B)}if(X(B.length)&&G(B))return new Uint8Array(B);throw Error("unsupported array-like object")}function J(B){return new Uint8Array(B)}function Z(B,S,_,v,R){if(v!=null||R!=null)if(B.slice)B=B.slice(v,R);else B=Array.prototype.slice.call(B,v,R);S.set(B,_)}var V=function(){function B(_){var v=[],R=0;_=encodeURI(_);while(R<_.length){var m=_.charCodeAt(R++);if(m===37)v.push(parseInt(_.substr(R,2),16)),R+=2;else v.push(m)}return Y(v)}function S(_){var v=[],R=0;while(R<_.length){var m=_[R];if(m<128)v.push(String.fromCharCode(m)),R++;else if(m>191&&m<224)v.push(String.fromCharCode((m&31)<<6|_[R+1]&63)),R+=2;else v.push(String.fromCharCode((m&15)<<12|(_[R+1]&63)<<6|_[R+2]&63)),R+=3}return v.join("")}return{toBytes:B,fromBytes:S}}(),U=function(){function B(v){var R=[];for(var m=0;m<v.length;m+=2)R.push(parseInt(v.substr(m,2),16));return R}var S="0123456789abcdef";function _(v){var R=[];for(var m=0;m<v.length;m++){var J0=v[m];R.push(S[(J0&240)>>4]+S[J0&15])}return R.join("")}return{toBytes:B,fromBytes:_}}(),Q={16:10,24:12,32:14},N=[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],q=[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],A=[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],H=[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],I=[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],w=[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],D=[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],T=[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],x=[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],h=[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,1047239000,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],$=[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,679998000,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],F=[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],u=[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],c=[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,1047239000,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],p=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998000,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 s(B){var S=[];for(var _=0;_<B.length;_+=4)S.push(B[_]<<24|B[_+1]<<16|B[_+2]<<8|B[_+3]);return S}var y=function(B){if(!(this instanceof y))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:Y(B,!0)}),this._prepare()};y.prototype._prepare=function(){var B=Q[this.key.length];if(B==null)throw Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var S=0;S<=B;S++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var _=(B+1)*4,v=this.key.length/4,R=s(this.key),m;for(var S=0;S<v;S++)m=S>>2,this._Ke[m][S%4]=R[S],this._Kd[B-m][S%4]=R[S];var J0=0,U0=v,N0;while(U0<_){if(N0=R[v-1],R[0]^=q[N0>>16&255]<<24^q[N0>>8&255]<<16^q[N0&255]<<8^q[N0>>24&255]^N[J0]<<24,J0+=1,v!=8)for(var S=1;S<v;S++)R[S]^=R[S-1];else{for(var S=1;S<v/2;S++)R[S]^=R[S-1];N0=R[v/2-1],R[v/2]^=q[N0&255]^q[N0>>8&255]<<8^q[N0>>16&255]<<16^q[N0>>24&255]<<24;for(var S=v/2+1;S<v;S++)R[S]^=R[S-1]}var S=0,$0,u0;while(S<v&&U0<_)$0=U0>>2,u0=U0%4,this._Ke[$0][u0]=R[S],this._Kd[B-$0][u0]=R[S++],U0++}for(var $0=1;$0<B;$0++)for(var u0=0;u0<4;u0++)N0=this._Kd[$0][u0],this._Kd[$0][u0]=F[N0>>24&255]^u[N0>>16&255]^c[N0>>8&255]^p[N0&255]},y.prototype.encrypt=function(B){if(B.length!=16)throw Error("invalid plaintext size (must be 16 bytes)");var S=this._Ke.length-1,_=[0,0,0,0],v=s(B);for(var R=0;R<4;R++)v[R]^=this._Ke[0][R];for(var m=1;m<S;m++){for(var R=0;R<4;R++)_[R]=H[v[R]>>24&255]^I[v[(R+1)%4]>>16&255]^w[v[(R+2)%4]>>8&255]^D[v[(R+3)%4]&255]^this._Ke[m][R];v=_.slice()}var J0=J(16),U0;for(var R=0;R<4;R++)U0=this._Ke[S][R],J0[4*R]=(q[v[R]>>24&255]^U0>>24)&255,J0[4*R+1]=(q[v[(R+1)%4]>>16&255]^U0>>16)&255,J0[4*R+2]=(q[v[(R+2)%4]>>8&255]^U0>>8)&255,J0[4*R+3]=(q[v[(R+3)%4]&255]^U0)&255;return J0},y.prototype.decrypt=function(B){if(B.length!=16)throw Error("invalid ciphertext size (must be 16 bytes)");var S=this._Kd.length-1,_=[0,0,0,0],v=s(B);for(var R=0;R<4;R++)v[R]^=this._Kd[0][R];for(var m=1;m<S;m++){for(var R=0;R<4;R++)_[R]=T[v[R]>>24&255]^x[v[(R+3)%4]>>16&255]^h[v[(R+2)%4]>>8&255]^$[v[(R+1)%4]&255]^this._Kd[m][R];v=_.slice()}var J0=J(16),U0;for(var R=0;R<4;R++)U0=this._Kd[S][R],J0[4*R]=(A[v[R]>>24&255]^U0>>24)&255,J0[4*R+1]=(A[v[(R+3)%4]>>16&255]^U0>>16)&255,J0[4*R+2]=(A[v[(R+2)%4]>>8&255]^U0>>8)&255,J0[4*R+3]=(A[v[(R+1)%4]&255]^U0)&255;return J0};var t=function(B){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new y(B)};t.prototype.encrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16)Z(B,_,0,v,v+16),_=this._aes.encrypt(_),Z(_,S,v);return S},t.prototype.decrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16)Z(B,_,0,v,v+16),_=this._aes.decrypt(_),Z(_,S,v);return S};var H0=function(B,S){if(!(this instanceof H0))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!S)S=J(16);else if(S.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=Y(S,!0),this._aes=new y(B)};H0.prototype.encrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16){Z(B,_,0,v,v+16);for(var R=0;R<16;R++)_[R]^=this._lastCipherblock[R];this._lastCipherblock=this._aes.encrypt(_),Z(this._lastCipherblock,S,v)}return S},H0.prototype.decrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16){Z(B,_,0,v,v+16),_=this._aes.decrypt(_);for(var R=0;R<16;R++)S[v+R]=_[R]^this._lastCipherblock[R];Z(B,this._lastCipherblock,0,v,v+16)}return S};var g=function(B,S,_){if(!(this instanceof g))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!S)S=J(16);else if(S.length!=16)throw Error("invalid initialation vector size (must be 16 size)");if(!_)_=1;this.segmentSize=_,this._shiftRegister=Y(S,!0),this._aes=new y(B)};g.prototype.encrypt=function(B){if(B.length%this.segmentSize!=0)throw Error("invalid plaintext size (must be segmentSize bytes)");var S=Y(B,!0),_;for(var v=0;v<S.length;v+=this.segmentSize){_=this._aes.encrypt(this._shiftRegister);for(var R=0;R<this.segmentSize;R++)S[v+R]^=_[R];Z(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Z(S,this._shiftRegister,16-this.segmentSize,v,v+this.segmentSize)}return S},g.prototype.decrypt=function(B){if(B.length%this.segmentSize!=0)throw Error("invalid ciphertext size (must be segmentSize bytes)");var S=Y(B,!0),_;for(var v=0;v<S.length;v+=this.segmentSize){_=this._aes.encrypt(this._shiftRegister);for(var R=0;R<this.segmentSize;R++)S[v+R]^=_[R];Z(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Z(B,this._shiftRegister,16-this.segmentSize,v,v+this.segmentSize)}return S};var d=function(B,S){if(!(this instanceof d))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!S)S=J(16);else if(S.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=Y(S,!0),this._lastPrecipherIndex=16,this._aes=new y(B)};d.prototype.encrypt=function(B){var S=Y(B,!0);for(var _=0;_<S.length;_++){if(this._lastPrecipherIndex===16)this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0;S[_]^=this._lastPrecipher[this._lastPrecipherIndex++]}return S},d.prototype.decrypt=d.prototype.encrypt;var P=function(B){if(!(this instanceof P))throw Error("Counter must be instanitated with `new`");if(B!==0&&!B)B=1;if(typeof B==="number")this._counter=J(16),this.setValue(B);else this.setBytes(B)};P.prototype.setValue=function(B){if(typeof B!=="number"||parseInt(B)!=B)throw Error("invalid counter value (must be an integer)");if(B>Number.MAX_SAFE_INTEGER)throw Error("integer value out of safe range");for(var S=15;S>=0;--S)this._counter[S]=B%256,B=parseInt(B/256)},P.prototype.setBytes=function(B){if(B=Y(B,!0),B.length!=16)throw Error("invalid counter bytes size (must be 16 bytes)");this._counter=B},P.prototype.increment=function(){for(var B=15;B>=0;B--)if(this._counter[B]===255)this._counter[B]=0;else{this._counter[B]++;break}};var E=function(B,S){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");if(this.description="Counter",this.name="ctr",!(S instanceof P))S=new P(S);this._counter=S,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new y(B)};E.prototype.encrypt=function(B){var S=Y(B,!0);for(var _=0;_<S.length;_++){if(this._remainingCounterIndex===16)this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment();S[_]^=this._remainingCounter[this._remainingCounterIndex++]}return S},E.prototype.decrypt=E.prototype.encrypt;function f(B){B=Y(B,!0);var S=16-B.length%16,_=J(B.length+S);Z(B,_);for(var v=B.length;v<_.length;v++)_[v]=S;return _}function r(B){if(B=Y(B,!0),B.length<16)throw Error("PKCS#7 invalid length");var S=B[B.length-1];if(S>16)throw Error("PKCS#7 padding byte out of range");var _=B.length-S;for(var v=0;v<S;v++)if(B[_+v]!==S)throw Error("PKCS#7 invalid padding byte");var R=J(_);return Z(B,R,0,0,_),R}var o={AES:y,Counter:P,ModeOfOperation:{ecb:t,cbc:H0,cfb:g,ofb:d,ctr:E},utils:{hex:U,utf8:V},padding:{pkcs7:{pad:f,strip:r}},_arrayTest:{coerceArray:Y,createArray:J,copyArray:Z}};if(typeof oj<"u")C$.exports=o;else if(typeof define==="function"&&define.amd)define([],function(){return o});else{if(W.aesjs)o._aesjs=W.aesjs;W.aesjs=o}})(oj)});var aj=V1((E$)=>{var G1=E$,{Buffer:$q}=_8("buffer"),nl=_8("os");G1.toBuffer=function(W,X,G){G=~~G;let Y;if(this.isV4Format(W))Y=X||$q.alloc(G+4),W.split(/\./g).map((J)=>{Y[G++]=parseInt(J,10)&255});else if(this.isV6Format(W)){let J=W.split(":",8),Z;for(Z=0;Z<J.length;Z++){let V=this.isV4Format(J[Z]),U;if(V)U=this.toBuffer(J[Z]),J[Z]=U.slice(0,2).toString("hex");if(U&&++Z<8)J.splice(Z,0,U.slice(2,4).toString("hex"))}if(J[0]==="")while(J.length<8)J.unshift("0");else if(J[J.length-1]==="")while(J.length<8)J.push("0");else if(J.length<8){for(Z=0;Z<J.length&&J[Z]!=="";Z++);let V=[Z,1];for(Z=9-J.length;Z>0;Z--)V.push("0");J.splice(...V)}Y=X||$q.alloc(G+16);for(Z=0;Z<J.length;Z++){let V=parseInt(J[Z],16);Y[G++]=V>>8&255,Y[G++]=V&255}}if(!Y)throw Error(`Invalid ip address: ${W}`);return Y};G1.toString=function(W,X,G){X=~~X,G=G||W.length-X;let Y=[];if(G===4){for(let J=0;J<G;J++)Y.push(W[X+J]);Y=Y.join(".")}else if(G===16){for(let J=0;J<G;J+=2)Y.push(W.readUInt16BE(X+J).toString(16));Y=Y.join(":"),Y=Y.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),Y=Y.replace(/:{3,4}/,"::")}return Y};var il=/^(\d{1,3}\.){3,3}\d{1,3}$/,rl=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;G1.isV4Format=function(W){return il.test(W)};G1.isV6Format=function(W){return rl.test(W)};function FV(W){if(W===4)return"ipv4";if(W===6)return"ipv6";return W?W.toLowerCase():"ipv4"}G1.fromPrefixLen=function(W,X){if(W>32)X="ipv6";else X=FV(X);let G=4;if(X==="ipv6")G=16;let Y=$q.alloc(G);for(let J=0,Z=Y.length;J<Z;++J){let V=8;if(W<8)V=W;W-=V,Y[J]=~(255>>V)&255}return G1.toString(Y)};G1.mask=function(W,X){W=G1.toBuffer(W),X=G1.toBuffer(X);let G=$q.alloc(Math.max(W.length,X.length)),Y;if(W.length===X.length)for(Y=0;Y<W.length;Y++)G[Y]=W[Y]&X[Y];else if(X.length===4)for(Y=0;Y<X.length;Y++)G[Y]=W[W.length-4+Y]&X[Y];else{for(Y=0;Y<G.length-6;Y++)G[Y]=0;G[10]=255,G[11]=255;for(Y=0;Y<W.length;Y++)G[Y+12]=W[Y]&X[Y+12];Y+=12}for(;Y<G.length;Y++)G[Y]=0;return G1.toString(G)};G1.cidr=function(W){let X=W.split("/"),G=X[0];if(X.length!==2)throw Error(`invalid CIDR subnet: ${G}`);let Y=G1.fromPrefixLen(parseInt(X[1],10));return G1.mask(G,Y)};G1.subnet=function(W,X){let G=G1.toLong(G1.mask(W,X)),Y=G1.toBuffer(X),J=0;for(let V=0;V<Y.length;V++)if(Y[V]===255)J+=8;else{let U=Y[V]&255;while(U)U=U<<1&255,J++}let Z=2**(32-J);return{networkAddress:G1.fromLong(G),firstAddress:Z<=2?G1.fromLong(G):G1.fromLong(G+1),lastAddress:Z<=2?G1.fromLong(G+Z-1):G1.fromLong(G+Z-2),broadcastAddress:G1.fromLong(G+Z-1),subnetMask:X,subnetMaskLength:J,numHosts:Z<=2?Z:Z-2,length:Z,contains(V){return G===G1.toLong(G1.mask(V,X))}}};G1.cidrSubnet=function(W){let X=W.split("/"),G=X[0];if(X.length!==2)throw Error(`invalid CIDR subnet: ${G}`);let Y=G1.fromPrefixLen(parseInt(X[1],10));return G1.subnet(G,Y)};G1.not=function(W){let X=G1.toBuffer(W);for(let G=0;G<X.length;G++)X[G]=255^X[G];return G1.toString(X)};G1.or=function(W,X){if(W=G1.toBuffer(W),X=G1.toBuffer(X),W.length===X.length){for(let Z=0;Z<W.length;++Z)W[Z]|=X[Z];return G1.toString(W)}let G=W,Y=X;if(X.length>W.length)G=X,Y=W;let J=G.length-Y.length;for(let Z=J;Z<G.length;++Z)G[Z]|=Y[Z-J];return G1.toString(G)};G1.isEqual=function(W,X){if(W=G1.toBuffer(W),X=G1.toBuffer(X),W.length===X.length){for(let Y=0;Y<W.length;Y++)if(W[Y]!==X[Y])return!1;return!0}if(X.length===4){let Y=X;X=W,W=Y}for(let Y=0;Y<10;Y++)if(X[Y]!==0)return!1;let G=X.readUInt16BE(10);if(G!==0&&G!==65535)return!1;for(let Y=0;Y<4;Y++)if(W[Y]!==X[Y+12])return!1;return!0};G1.isPrivate=function(W){if(G1.isLoopback(W))return!0;if(!G1.isV6Format(W)){let X=G1.normalizeToLong(W);if(X<0)throw Error("invalid ipv4 address");W=G1.fromLong(X)}return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^f[cd][0-9a-f]{2}:/i.test(W)||/^fe80:/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};G1.isPublic=function(W){return!G1.isPrivate(W)};G1.isLoopback=function(W){if(!/\./.test(W)&&!/:/.test(W))W=G1.fromLong(Number(W));return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(W)||/^0177\./.test(W)||/^0x7f\./i.test(W)||/^fe80::1$/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};G1.loopback=function(W){if(W=FV(W),W!=="ipv4"&&W!=="ipv6")throw Error("family must be ipv4 or ipv6");return W==="ipv4"?"127.0.0.1":"fe80::1"};G1.address=function(W,X){let G=nl.networkInterfaces();if(X=FV(X),W&&W!=="private"&&W!=="public"){let J=G[W].filter((Z)=>{return FV(Z.family)===X});if(J.length===0)return;return J[0].address}let Y=Object.keys(G).map((J)=>{let Z=G[J].filter((V)=>{if(V.family=FV(V.family),V.family!==X||G1.isLoopback(V.address))return!1;if(!W)return!0;return W==="public"?G1.isPrivate(V.address):G1.isPublic(V.address)});return Z.length?Z[0].address:void 0}).filter(Boolean);return!Y.length?G1.loopback(X):Y[0]};G1.toLong=function(W){let X=0;return W.split(".").forEach((G)=>{X<<=8,X+=parseInt(G)}),X>>>0};G1.fromLong=function(W){return`${W>>>24}.${W>>16&255}.${W>>8&255}.${W&255}`};G1.normalizeToLong=function(W){let X=W.split(".").map((J)=>{if(J.startsWith("0x")||J.startsWith("0X"))return parseInt(J,16);else if(J.startsWith("0")&&J!=="0"&&/^[0-7]+$/.test(J))return parseInt(J,8);else if(/^[1-9]\d*$/.test(J)||J==="0")return parseInt(J,10);else return NaN});if(X.some(isNaN))return-1;let G=0;switch(X.length){case 1:G=X[0];break;case 2:if(X[0]>255||X[1]>16777215)return-1;G=X[0]<<24|X[1]&16777215;break;case 3:if(X[0]>255||X[1]>255||X[2]>65535)return-1;G=X[0]<<24|X[1]<<16|X[2]&65535;break;case 4:if(X.some((J)=>J>255))return-1;G=X[0]<<24|X[1]<<16|X[2]<<8|X[3];break;default:return-1}return G>>>0}});var F$=V1((rq0,$$)=>{$$.exports=function W(X,G){if(X===G)return!0;if(X&&G&&typeof X=="object"&&typeof G=="object"){if(X.constructor!==G.constructor)return!1;var Y,J,Z;if(Array.isArray(X)){if(Y=X.length,Y!=G.length)return!1;for(J=Y;J--!==0;)if(!W(X[J],G[J]))return!1;return!0}if(X.constructor===RegExp)return X.source===G.source&&X.flags===G.flags;if(X.valueOf!==Object.prototype.valueOf)return X.valueOf()===G.valueOf();if(X.toString!==Object.prototype.toString)return X.toString()===G.toString();if(Z=Object.keys(X),Y=Z.length,Y!==Object.keys(G).length)return!1;for(J=Y;J--!==0;)if(!Object.prototype.hasOwnProperty.call(G,Z[J]))return!1;for(J=Y;J--!==0;){var V=Z[J];if(!W(X[V],G[V]))return!1}return!0}return X!==X&&G!==G}});var S$=V1((al)=>{al.toString=function(W){switch(W){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+W};al.toType=function(W){switch(W.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}if(W.toUpperCase().startsWith("UNKNOWN_"))return parseInt(W.slice(8));return 0}});var x$=V1((el)=>{el.toString=function(W){switch(W){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+W};el.toRcode=function(W){switch(W.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var k$=V1((Gd)=>{Gd.toString=function(W){switch(W){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+W};Gd.toOpcode=function(W){switch(W.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var _$=V1((Zd)=>{Zd.toString=function(W){switch(W){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+W};Zd.toClass=function(W){switch(W.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var y$=V1((Qd)=>{Qd.toString=function(W){switch(W){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}if(W<0)return null;return`OPTION_${W}`};Qd.toCode=function(W){if(typeof W==="number")return W;if(!W)return-1;switch(W.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let X=W.match(/_(\d+)$/);if(X)return parseInt(X[1],10);return-1}});var u$=V1((g$,sj)=>{var v$=function(W){Object.defineProperty(W,"__esModule",{value:!0}),W.decode=A,W.encode=q,W.familyOf=N,W.name=void 0,W.sizeOf=Q,W.v6=W.v4=void 0;let X=/^(\d{1,3}\.){3,3}\d{1,3}$/,G=4,Y=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,J=16,Z={name:"v4",size:G,isFormat:(H)=>X.test(H),encode(H,I,w){w=~~w,I=I||new Uint8Array(w+G);let D=H.length,T=0;for(let x=0;x<D;){let h=H.charCodeAt(x++);if(h===46)I[w++]=T,T=0;else T=T*10+(h-48)}return I[w]=T,I},decode(H,I){return I=~~I,`${H[I++]}.${H[I++]}.${H[I++]}.${H[I]}`}};W.v4=Z;let V={name:"v6",size:J,isFormat:(H)=>H.length>0&&Y.test(H),encode(H,I,w){w=~~w;let D=w+J,T=-1,x=0,h=0,$=!0,F=!1;I=I||new Uint8Array(w+J);for(let u=0;u<H.length;u++){let c=H.charCodeAt(u);if(c===58){if($){if(T!==-1){if(w<D)I[w]=0;if(w<D-1)I[w+1]=0;w+=2}else if(w<D)T=w}else{if(F===!0){if(w<D)I[w]=h;w++}else{if(w<D)I[w]=x>>8;if(w<D-1)I[w+1]=x&255;w+=2}x=0,h=0}$=!0,F=!1}else if(c===46){if(w<D)I[w]=h;w++,h=0,x=0,$=!1,F=!0}else{if($=!1,c>=97)c-=87;else if(c>=65)c-=55;else c-=48,h=h*10+c;x=(x<<4)+c}}if($===!1)if(F===!0){if(w<D)I[w]=h;w++}else{if(w<D)I[w]=x>>8;if(w<D-1)I[w+1]=x&255;w+=2}else if(T===0){if(w<D)I[w]=0;if(w<D-1)I[w+1]=0;w+=2}else if(T!==-1){w+=2;for(let u=Math.min(w-1,D-1);u>=T+2;u--)I[u]=I[u-2];I[T]=0,I[T+1]=0,T=w}if(T!==w&&T!==-1){if(w>D-2)w=D-2;while(D>T)I[--D]=w<D&&w>T?I[--w]:0}else while(w<D)I[w++]=0;return I},decode(H,I){I=~~I;let w="";for(let D=0;D<J;D+=2){if(D!==0)w+=":";w+=(H[I+D]<<8|H[I+D+1]).toString(16)}return w.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};W.v6=V;let U="ip";W.name=U;function Q(H){if(Z.isFormat(H))return Z.size;if(V.isFormat(H))return V.size;throw Error(`Invalid ip address: ${H}`)}function N(H){return Q(H)===Z.size?1:2}function q(H,I,w){w=~~w;let D=Q(H);if(typeof I==="function")I=I(w+D);if(D===Z.size)return Z.encode(H,I,w);return V.encode(H,I,w)}function A(H,I,w){if(I=~~I,w=w||H.length-I,w===Z.size)return Z.decode(H,I,w);if(w===V.size)return V.decode(H,I,w);throw Error(`Invalid buffer size needs to be ${Z.size} for v4 or ${V.size} for v6.`)}return"default"in W?W.default:W}({});if(typeof define==="function"&&define.amd)define([],function(){return v$});else if(typeof sj==="object"&&typeof g$==="object")sj.exports=v$});var h$=V1((wd)=>{var Z1=_8("buffer").Buffer,m4=S$(),Hd=x$(),Ad=k$(),Sq=_$(),WK=y$(),wX=u$(),g0=wd.name={};g0.encode=function(W,X,G,{mail:Y=!1}={}){if(!X)X=Z1.alloc(g0.encodingLength(W));if(!G)G=0;let J=G,Z=W.replace(/^\.|\.$/gm,"");if(Z.length){let V=[];if(Y){let U="";Z.split(".").forEach((Q)=>{if(Q.endsWith("\\"))U+=(U.length?".":"")+Q.slice(0,-1);else if(V.length===0&&U.length)V.push(U+"."+Q);else V.push(Q)})}else V=Z.split(".");for(let U=0;U<V.length;U++){let Q=X.write(V[U],G+1);X[G]=Q,G+=Q+1}}return X[G++]=0,g0.encode.bytes=G-J,X};g0.encode.bytes=0;g0.decode=function(W,X,{mail:G=!1}={}){if(!X)X=0;let Y=[],J=X,Z=0,V=0,U=!1;while(!0){if(X>=W.length)throw Error("Cannot decode name (buffer overflow)");let Q=W[X++];if(V+=U?0:1,Q===0)break;else if((Q&192)===0){if(X+Q>W.length)throw Error("Cannot decode name (buffer overflow)");if(Z+=Q+1,Z>254)throw Error("Cannot decode name (name too long)");let N=W.toString("utf-8",X,X+Q);if(G)N=N.replace(/\./g,"\\.");Y.push(N),X+=Q,V+=U?0:Q}else if((Q&192)===192){if(X+1>W.length)throw Error("Cannot decode name (buffer overflow)");let N=W.readUInt16BE(X-1)-49152;if(N>=J)throw Error("Cannot decode name (bad pointer)");X=N,J=N,V+=U?0:1,U=!0}else throw Error("Cannot decode name (bad label)")}return g0.decode.bytes=V,Y.length===0?".":Y.join(".")};g0.decode.bytes=0;g0.encodingLength=function(W){if(W==="."||W==="..")return 1;return Z1.byteLength(W.replace(/^\.|\.$/gm,""))+2};var v1={};v1.encode=function(W,X,G){if(!X)X=Z1.alloc(v1.encodingLength(W));if(!G)G=0;let Y=X.write(W,G+1);return X[G]=Y,v1.encode.bytes=Y+1,X};v1.encode.bytes=0;v1.decode=function(W,X){if(!X)X=0;let G=W[X],Y=W.toString("utf-8",X+1,X+1+G);return v1.decode.bytes=G+1,Y};v1.decode.bytes=0;v1.encodingLength=function(W){return Z1.byteLength(W)+1};var e5={};e5.encode=function(W,X,G){if(!X)X=e5.encodingLength(W);if(!G)G=0;let Y=(W.flags||0)&32767,J=W.type==="response"?32768:0;return X.writeUInt16BE(W.id||0,G),X.writeUInt16BE(Y|J,G+2),X.writeUInt16BE(W.questions.length,G+4),X.writeUInt16BE(W.answers.length,G+6),X.writeUInt16BE(W.authorities.length,G+8),X.writeUInt16BE(W.additionals.length,G+10),X};e5.encode.bytes=12;e5.decode=function(W,X){if(!X)X=0;if(W.length<12)throw Error("Header must be 12 bytes");let G=W.readUInt16BE(X+2);return{id:W.readUInt16BE(X),type:G&32768?"response":"query",flags:G&32767,flag_qr:(G>>15&1)===1,opcode:Ad.toString(G>>11&15),flag_aa:(G>>10&1)===1,flag_tc:(G>>9&1)===1,flag_rd:(G>>8&1)===1,flag_ra:(G>>7&1)===1,flag_z:(G>>6&1)===1,flag_ad:(G>>5&1)===1,flag_cd:(G>>4&1)===1,rcode:Hd.toString(G&15),questions:Array(W.readUInt16BE(X+4)),answers:Array(W.readUInt16BE(X+6)),authorities:Array(W.readUInt16BE(X+8)),additionals:Array(W.readUInt16BE(X+10))}};e5.decode.bytes=12;e5.encodingLength=function(){return 12};var x4=wd.unknown={};x4.encode=function(W,X,G){if(!X)X=Z1.alloc(x4.encodingLength(W));if(!G)G=0;return X.writeUInt16BE(W.length,G),W.copy(X,G+2),x4.encode.bytes=W.length+2,X};x4.encode.bytes=0;x4.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X),Y=W.slice(X+2,X+2+G);return x4.decode.bytes=G+2,Y};x4.decode.bytes=0;x4.encodingLength=function(W){return W.length+2};var k4=wd.ns={};k4.encode=function(W,X,G){if(!X)X=Z1.alloc(k4.encodingLength(W));if(!G)G=0;return g0.encode(W,X,G+2),X.writeUInt16BE(g0.encode.bytes,G),k4.encode.bytes=g0.encode.bytes+2,X};k4.encode.bytes=0;k4.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X),Y=g0.decode(W,X+2);return k4.decode.bytes=G+2,Y};k4.decode.bytes=0;k4.encodingLength=function(W){return g0.encodingLength(W)+2};var _4=wd.soa={};_4.encode=function(W,X,G){if(!X)X=Z1.alloc(_4.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,g0.encode(W.mname,X,G),G+=g0.encode.bytes,g0.encode(W.rname,X,G,{mail:!0}),G+=g0.encode.bytes,X.writeUInt32BE(W.serial||0,G),G+=4,X.writeUInt32BE(W.refresh||0,G),G+=4,X.writeUInt32BE(W.retry||0,G),G+=4,X.writeUInt32BE(W.expire||0,G),G+=4,X.writeUInt32BE(W.minimum||0,G),G+=4,X.writeUInt16BE(G-Y-2,Y),_4.encode.bytes=G-Y,X};_4.encode.bytes=0;_4.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.mname=g0.decode(W,X),X+=g0.decode.bytes,Y.rname=g0.decode(W,X,{mail:!0}),X+=g0.decode.bytes,Y.serial=W.readUInt32BE(X),X+=4,Y.refresh=W.readUInt32BE(X),X+=4,Y.retry=W.readUInt32BE(X),X+=4,Y.expire=W.readUInt32BE(X),X+=4,Y.minimum=W.readUInt32BE(X),X+=4,_4.decode.bytes=X-G,Y};_4.decode.bytes=0;_4.encodingLength=function(W){return 22+g0.encodingLength(W.mname)+g0.encodingLength(W.rname)};var y4=wd.txt={};y4.encode=function(W,X,G){if(!Array.isArray(W))W=[W];for(let J=0;J<W.length;J++){if(typeof W[J]==="string")W[J]=Z1.from(W[J]);if(!Z1.isBuffer(W[J]))throw Error("Must be a Buffer")}if(!X)X=Z1.alloc(y4.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,W.forEach(function(J){X[G++]=J.length,J.copy(X,G,0,J.length),G+=J.length}),X.writeUInt16BE(G-Y-2,Y),y4.encode.bytes=G-Y,X};y4.encode.bytes=0;y4.decode=function(W,X){if(!X)X=0;let G=X,Y=W.readUInt16BE(X);X+=2;let J=[];while(Y>0){let Z=W[X++];if(--Y,Y<Z)throw Error("Buffer overflow");J.push(W.slice(X,X+Z)),X+=Z,Y-=Z}return y4.decode.bytes=X-G,J};y4.decode.bytes=0;y4.encodingLength=function(W){if(!Array.isArray(W))W=[W];let X=2;return W.forEach(function(G){if(typeof G==="string")X+=Z1.byteLength(G)+1;else X+=G.length+1}),X};var v4=wd.null={};v4.encode=function(W,X,G){if(!X)X=Z1.alloc(v4.encodingLength(W));if(!G)G=0;if(typeof W==="string")W=Z1.from(W);if(!W)W=Z1.alloc(0);let Y=G;G+=2;let J=W.length;return W.copy(X,G,0,J),G+=J,X.writeUInt16BE(G-Y-2,Y),v4.encode.bytes=G-Y,X};v4.encode.bytes=0;v4.decode=function(W,X){if(!X)X=0;let G=X,Y=W.readUInt16BE(X);X+=2;let J=W.slice(X,X+Y);return X+=Y,v4.decode.bytes=X-G,J};v4.decode.bytes=0;v4.encodingLength=function(W){if(!W)return 2;return(Z1.isBuffer(W)?W.length:Z1.byteLength(W))+2};var g4=wd.hinfo={};g4.encode=function(W,X,G){if(!X)X=Z1.alloc(g4.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,v1.encode(W.cpu,X,G),G+=v1.encode.bytes,v1.encode(W.os,X,G),G+=v1.encode.bytes,X.writeUInt16BE(G-Y-2,Y),g4.encode.bytes=G-Y,X};g4.encode.bytes=0;g4.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.cpu=v1.decode(W,X),X+=v1.decode.bytes,Y.os=v1.decode(W,X),X+=v1.decode.bytes,g4.decode.bytes=X-G,Y};g4.decode.bytes=0;g4.encodingLength=function(W){return v1.encodingLength(W.cpu)+v1.encodingLength(W.os)+2};var s5=wd.ptr={},zd=wd.cname=s5,Id=wd.dname=s5;s5.encode=function(W,X,G){if(!X)X=Z1.alloc(s5.encodingLength(W));if(!G)G=0;return g0.encode(W,X,G+2),X.writeUInt16BE(g0.encode.bytes,G),s5.encode.bytes=g0.encode.bytes+2,X};s5.encode.bytes=0;s5.decode=function(W,X){if(!X)X=0;let G=g0.decode(W,X+2);return s5.decode.bytes=g0.decode.bytes+2,G};s5.decode.bytes=0;s5.encodingLength=function(W){return g0.encodingLength(W)+2};var u4=wd.srv={};u4.encode=function(W,X,G){if(!X)X=Z1.alloc(u4.encodingLength(W));if(!G)G=0;X.writeUInt16BE(W.priority||0,G+2),X.writeUInt16BE(W.weight||0,G+4),X.writeUInt16BE(W.port||0,G+6),g0.encode(W.target,X,G+8);let Y=g0.encode.bytes+6;return X.writeUInt16BE(Y,G),u4.encode.bytes=Y+2,X};u4.encode.bytes=0;u4.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X),Y={};return Y.priority=W.readUInt16BE(X+2),Y.weight=W.readUInt16BE(X+4),Y.port=W.readUInt16BE(X+6),Y.target=g0.decode(W,X+8),u4.decode.bytes=G+2,Y};u4.decode.bytes=0;u4.encodingLength=function(W){return 8+g0.encodingLength(W.target)};var q5=wd.caa={};q5.ISSUER_CRITICAL=128;q5.encode=function(W,X,G){let Y=q5.encodingLength(W);if(!X)X=Z1.alloc(q5.encodingLength(W));if(!G)G=0;if(W.issuerCritical)W.flags=q5.ISSUER_CRITICAL;return X.writeUInt16BE(Y-2,G),G+=2,X.writeUInt8(W.flags||0,G),G+=1,v1.encode(W.tag,X,G),G+=v1.encode.bytes,X.write(W.value,G),G+=Z1.byteLength(W.value),q5.encode.bytes=Y,X};q5.encode.bytes=0;q5.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X);X+=2;let Y=X,J={};return J.flags=W.readUInt8(X),X+=1,J.tag=v1.decode(W,X),X+=v1.decode.bytes,J.value=W.toString("utf-8",X,Y+G),J.issuerCritical=!!(J.flags&q5.ISSUER_CRITICAL),q5.decode.bytes=G+2,J};q5.decode.bytes=0;q5.encodingLength=function(W){return v1.encodingLength(W.tag)+v1.encodingLength(W.value)+2};var n6=wd.mx={};n6.encode=function(W,X,G){if(!X)X=Z1.alloc(n6.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,X.writeUInt16BE(W.preference||0,G),G+=2,g0.encode(W.exchange,X,G),G+=g0.encode.bytes,X.writeUInt16BE(G-Y-2,Y),n6.encode.bytes=G-Y,X};n6.encode.bytes=0;n6.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.preference=W.readUInt16BE(X),X+=2,Y.exchange=g0.decode(W,X),X+=g0.decode.bytes,n6.decode.bytes=X-G,Y};n6.encodingLength=function(W){return 4+g0.encodingLength(W.exchange)};var h4=wd.a={};h4.encode=function(W,X,G){if(!X)X=Z1.alloc(h4.encodingLength(W));if(!G)G=0;return X.writeUInt16BE(4,G),G+=2,wX.v4.encode(W,X,G),h4.encode.bytes=6,X};h4.encode.bytes=0;h4.decode=function(W,X){if(!X)X=0;X+=2;let G=wX.v4.decode(W,X);return h4.decode.bytes=6,G};h4.decode.bytes=0;h4.encodingLength=function(){return 6};var b4=wd.aaaa={};b4.encode=function(W,X,G){if(!X)X=Z1.alloc(b4.encodingLength(W));if(!G)G=0;return X.writeUInt16BE(16,G),G+=2,wX.v6.encode(W,X,G),b4.encode.bytes=18,X};b4.encode.bytes=0;b4.decode=function(W,X){if(!X)X=0;X+=2;let G=wX.v6.decode(W,X);return b4.decode.bytes=18,G};b4.decode.bytes=0;b4.encodingLength=function(){return 18};var a9=wd.option={};a9.encode=function(W,X,G){if(!X)X=Z1.alloc(a9.encodingLength(W));if(!G)G=0;let Y=G,J=WK.toCode(W.code);if(X.writeUInt16BE(J,G),G+=2,W.data)X.writeUInt16BE(W.data.length,G),G+=2,W.data.copy(X,G),G+=W.data.length;else switch(J){case 8:let Z=W.sourcePrefixLength||0,V=W.family||wX.familyOf(W.ip),U=wX.encode(W.ip,Z1.alloc),Q=Math.ceil(Z/8);X.writeUInt16BE(Q+4,G),G+=2,X.writeUInt16BE(V,G),G+=2,X.writeUInt8(Z,G++),X.writeUInt8(W.scopePrefixLength||0,G++),U.copy(X,G,0,Q),G+=Q;break;case 11:if(W.timeout)X.writeUInt16BE(2,G),G+=2,X.writeUInt16BE(W.timeout,G),G+=2;else X.writeUInt16BE(0,G),G+=2;break;case 12:let N=W.length||0;X.writeUInt16BE(N,G),G+=2,X.fill(0,G,G+N),G+=N;break;case 14:let q=W.tags.length*2;X.writeUInt16BE(q,G),G+=2;for(let A of W.tags)X.writeUInt16BE(A,G),G+=2;break;default:throw Error(`Unknown roption code: ${W.code}`)}return a9.encode.bytes=G-Y,X};a9.encode.bytes=0;a9.decode=function(W,X){if(!X)X=0;let G={};G.code=W.readUInt16BE(X),G.type=WK.toString(G.code),X+=2;let Y=W.readUInt16BE(X);switch(X+=2,G.data=W.slice(X,X+Y),G.code){case 8:G.family=W.readUInt16BE(X),X+=2,G.sourcePrefixLength=W.readUInt8(X++),G.scopePrefixLength=W.readUInt8(X++);let J=Z1.alloc(G.family===1?4:16);W.copy(J,0,X,X+Y-4),G.ip=wX.decode(J);break;case 11:if(Y>0)G.timeout=W.readUInt16BE(X),X+=2;break;case 14:G.tags=[];for(let Z=0;Z<Y;Z+=2)G.tags.push(W.readUInt16BE(X)),X+=2}return a9.decode.bytes=Y+4,G};a9.decode.bytes=0;a9.encodingLength=function(W){if(W.data)return W.data.length+4;switch(WK.toCode(W.code)){case 8:let G=W.sourcePrefixLength||0;return Math.ceil(G/8)+8;case 11:return typeof W.timeout==="number"?6:4;case 12:return W.length+4;case 14:return 4+W.tags.length*2}throw Error(`Unknown roption code: ${W.code}`)};var A5=wd.opt={};A5.encode=function(W,X,G){if(!X)X=Z1.alloc(A5.encodingLength(W));if(!G)G=0;let Y=G,J=$Y(W,a9);return X.writeUInt16BE(J,G),G=SV(W,a9,X,G+2),A5.encode.bytes=G-Y,X};A5.encode.bytes=0;A5.decode=function(W,X){if(!X)X=0;let G=X,Y=[],J=W.readUInt16BE(X);X+=2;let Z=0;while(J>0)Y[Z++]=a9.decode(W,X),X+=a9.decode.bytes,J-=a9.decode.bytes;return A5.decode.bytes=X-G,Y};A5.decode.bytes=0;A5.encodingLength=function(W){return 2+$Y(W||[],a9)};var u9=wd.dnskey={};u9.PROTOCOL_DNSSEC=3;u9.ZONE_KEY=128;u9.SECURE_ENTRYPOINT=32768;u9.encode=function(W,X,G){if(!X)X=Z1.alloc(u9.encodingLength(W));if(!G)G=0;let Y=G,J=W.key;if(!Z1.isBuffer(J))throw Error("Key must be a Buffer");return G+=2,X.writeUInt16BE(W.flags,G),G+=2,X.writeUInt8(u9.PROTOCOL_DNSSEC,G),G+=1,X.writeUInt8(W.algorithm,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,u9.encode.bytes=G-Y,X.writeUInt16BE(u9.encode.bytes-2,Y),X};u9.encode.bytes=0;u9.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);if(X+=2,Y.flags=W.readUInt16BE(X),X+=2,W.readUInt8(X)!==u9.PROTOCOL_DNSSEC)throw Error("Protocol must be 3");return X+=1,Y.algorithm=W.readUInt8(X),X+=1,Y.key=W.slice(X,G+J+2),X+=Y.key.length,u9.decode.bytes=X-G,Y};u9.decode.bytes=0;u9.encodingLength=function(W){return 6+Z1.byteLength(W.key)};var y7=wd.rrsig={};y7.encode=function(W,X,G){if(!X)X=Z1.alloc(y7.encodingLength(W));if(!G)G=0;let Y=G,J=W.signature;if(!Z1.isBuffer(J))throw Error("Signature must be a Buffer");return G+=2,X.writeUInt16BE(m4.toType(W.typeCovered),G),G+=2,X.writeUInt8(W.algorithm,G),G+=1,X.writeUInt8(W.labels,G),G+=1,X.writeUInt32BE(W.originalTTL,G),G+=4,X.writeUInt32BE(W.expiration,G),G+=4,X.writeUInt32BE(W.inception,G),G+=4,X.writeUInt16BE(W.keyTag,G),G+=2,g0.encode(W.signersName,X,G),G+=g0.encode.bytes,J.copy(X,G,0,J.length),G+=J.length,y7.encode.bytes=G-Y,X.writeUInt16BE(y7.encode.bytes-2,Y),X};y7.encode.bytes=0;y7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);return X+=2,Y.typeCovered=m4.toString(W.readUInt16BE(X)),X+=2,Y.algorithm=W.readUInt8(X),X+=1,Y.labels=W.readUInt8(X),X+=1,Y.originalTTL=W.readUInt32BE(X),X+=4,Y.expiration=W.readUInt32BE(X),X+=4,Y.inception=W.readUInt32BE(X),X+=4,Y.keyTag=W.readUInt16BE(X),X+=2,Y.signersName=g0.decode(W,X),X+=g0.decode.bytes,Y.signature=W.slice(X,G+J+2),X+=Y.signature.length,y7.decode.bytes=X-G,Y};y7.decode.bytes=0;y7.encodingLength=function(W){return 20+g0.encodingLength(W.signersName)+Z1.byteLength(W.signature)};var v7=wd.rp={};v7.encode=function(W,X,G){if(!X)X=Z1.alloc(v7.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,g0.encode(W.mbox||".",X,G,{mail:!0}),G+=g0.encode.bytes,g0.encode(W.txt||".",X,G),G+=g0.encode.bytes,v7.encode.bytes=G-Y,X.writeUInt16BE(v7.encode.bytes-2,Y),X};v7.encode.bytes=0;v7.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.mbox=g0.decode(W,X,{mail:!0})||".",X+=g0.decode.bytes,Y.txt=g0.decode(W,X)||".",X+=g0.decode.bytes,v7.decode.bytes=X-G,Y};v7.decode.bytes=0;v7.encodingLength=function(W){return 2+g0.encodingLength(W.mbox||".")+g0.encodingLength(W.txt||".")};var a8={};a8.encode=function(W,X,G){if(!X)X=Z1.alloc(a8.encodingLength(W));if(!G)G=0;let Y=G;var J=[];for(var Z=0;Z<W.length;Z++){var V=m4.toType(W[Z]);if(J[V>>8]===void 0)J[V>>8]=[];J[V>>8][V>>3&31]|=1<<7-(V&7)}for(Z=0;Z<J.length;Z++)if(J[Z]!==void 0){var U=Z1.from(J[Z]);X.writeUInt8(Z,G),G+=1,X.writeUInt8(U.length,G),G+=1,U.copy(X,G),G+=U.length}return a8.encode.bytes=G-Y,X};a8.encode.bytes=0;a8.decode=function(W,X,G){if(!X)X=0;let Y=X;var J=[];while(X-Y<G){var Z=W.readUInt8(X);X+=1;var V=W.readUInt8(X);X+=1;for(var U=0;U<V;U++){var Q=W.readUInt8(X+U);for(var N=0;N<8;N++)if(Q&1<<7-N){var q=m4.toString(Z<<8|U<<3|N);J.push(q)}}X+=V}return a8.decode.bytes=X-Y,J};a8.decode.bytes=0;a8.encodingLength=function(W){var X=[];for(var G=0;G<W.length;G++){var Y=m4.toType(W[G]);X[Y>>8]=Math.max(X[Y>>8]||0,Y&255)}var J=0;for(G=0;G<X.length;G++)if(X[G]!==void 0)J+=2+Math.ceil((X[G]+1)/8);return J};var g7=wd.nsec={};g7.encode=function(W,X,G){if(!X)X=Z1.alloc(g7.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,g0.encode(W.nextDomain,X,G),G+=g0.encode.bytes,a8.encode(W.rrtypes,X,G),G+=a8.encode.bytes,g7.encode.bytes=G-Y,X.writeUInt16BE(g7.encode.bytes-2,Y),X};g7.encode.bytes=0;g7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);return X+=2,Y.nextDomain=g0.decode(W,X),X+=g0.decode.bytes,Y.rrtypes=a8.decode(W,X,J-(X-G)),X+=a8.decode.bytes,g7.decode.bytes=X-G,Y};g7.decode.bytes=0;g7.encodingLength=function(W){return 2+g0.encodingLength(W.nextDomain)+a8.encodingLength(W.rrtypes)};var u7=wd.nsec3={};u7.encode=function(W,X,G){if(!X)X=Z1.alloc(u7.encodingLength(W));if(!G)G=0;let Y=G,J=W.salt;if(!Z1.isBuffer(J))throw Error("salt must be a Buffer");let Z=W.nextDomain;if(!Z1.isBuffer(Z))throw Error("nextDomain must be a Buffer");return G+=2,X.writeUInt8(W.algorithm,G),G+=1,X.writeUInt8(W.flags,G),G+=1,X.writeUInt16BE(W.iterations,G),G+=2,X.writeUInt8(J.length,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,X.writeUInt8(Z.length,G),G+=1,Z.copy(X,G,0,Z.length),G+=Z.length,a8.encode(W.rrtypes,X,G),G+=a8.encode.bytes,u7.encode.bytes=G-Y,X.writeUInt16BE(u7.encode.bytes-2,Y),X};u7.encode.bytes=0;u7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);X+=2,Y.algorithm=W.readUInt8(X),X+=1,Y.flags=W.readUInt8(X),X+=1,Y.iterations=W.readUInt16BE(X),X+=2;let Z=W.readUInt8(X);X+=1,Y.salt=W.slice(X,X+Z),X+=Z;let V=W.readUInt8(X);return X+=1,Y.nextDomain=W.slice(X,X+V),X+=V,Y.rrtypes=a8.decode(W,X,J-(X-G)),X+=a8.decode.bytes,u7.decode.bytes=X-G,Y};u7.decode.bytes=0;u7.encodingLength=function(W){return 8+W.salt.length+W.nextDomain.length+a8.encodingLength(W.rrtypes)};var h7=wd.ds={};h7.encode=function(W,X,G){if(!X)X=Z1.alloc(h7.encodingLength(W));if(!G)G=0;let Y=G,J=W.digest;if(!Z1.isBuffer(J))throw Error("Digest must be a Buffer");return G+=2,X.writeUInt16BE(W.keyTag,G),G+=2,X.writeUInt8(W.algorithm,G),G+=1,X.writeUInt8(W.digestType,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,h7.encode.bytes=G-Y,X.writeUInt16BE(h7.encode.bytes-2,Y),X};h7.encode.bytes=0;h7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);return X+=2,Y.keyTag=W.readUInt16BE(X),X+=2,Y.algorithm=W.readUInt8(X),X+=1,Y.digestType=W.readUInt8(X),X+=1,Y.digest=W.slice(X,G+J+2),X+=Y.digest.length,h7.decode.bytes=X-G,Y};h7.decode.bytes=0;h7.encodingLength=function(W){return 6+Z1.byteLength(W.digest)};var H5=wd.sshfp={};H5.getFingerprintLengthForHashType=function(X){switch(X){case 1:return 20;case 2:return 32}};H5.encode=function(X,G,Y){if(!G)G=Z1.alloc(H5.encodingLength(X));if(!Y)Y=0;let J=Y;Y+=2,G[Y]=X.algorithm,Y+=1,G[Y]=X.hash,Y+=1;let Z=Z1.from(X.fingerprint.toUpperCase(),"hex");if(Z.length!==H5.getFingerprintLengthForHashType(X.hash))throw Error("Invalid fingerprint length");return Z.copy(G,Y),Y+=Z.byteLength,H5.encode.bytes=Y-J,G.writeUInt16BE(H5.encode.bytes-2,J),G};H5.encode.bytes=0;H5.decode=function(X,G){if(!G)G=0;let Y=G,J={};G+=2,J.algorithm=X[G],G+=1,J.hash=X[G],G+=1;let Z=H5.getFingerprintLengthForHashType(J.hash);return J.fingerprint=X.slice(G,G+Z).toString("hex").toUpperCase(),G+=Z,H5.decode.bytes=G-Y,J};H5.decode.bytes=0;H5.encodingLength=function(W){return 4+Z1.from(W.fingerprint,"hex").byteLength};var b7=wd.naptr={};b7.encode=function(W,X,G){if(!X)X=Z1.alloc(b7.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,X.writeUInt16BE(W.order||0,G),G+=2,X.writeUInt16BE(W.preference||0,G),G+=2,v1.encode(W.flags,X,G),G+=v1.encode.bytes,v1.encode(W.services,X,G),G+=v1.encode.bytes,v1.encode(W.regexp,X,G),G+=v1.encode.bytes,g0.encode(W.replacement,X,G),G+=g0.encode.bytes,b7.encode.bytes=G-Y,X.writeUInt16BE(b7.encode.bytes-2,Y),X};b7.encode.bytes=0;b7.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.order=W.readUInt16BE(X),X+=2,Y.preference=W.readUInt16BE(X),X+=2,Y.flags=v1.decode(W,X),X+=v1.decode.bytes,Y.services=v1.decode(W,X),X+=v1.decode.bytes,Y.regexp=v1.decode(W,X),X+=v1.decode.bytes,Y.replacement=g0.decode(W,X),X+=g0.decode.bytes,b7.decode.bytes=X-G,Y};b7.decode.bytes=0;b7.encodingLength=function(W){return v1.encodingLength(W.flags)+v1.encodingLength(W.services)+v1.encodingLength(W.regexp)+g0.encodingLength(W.replacement)+6};var m7=wd.tlsa={};m7.encode=function(W,X,G){if(!X)X=Z1.alloc(m7.encodingLength(W));if(!G)G=0;let Y=G,J=W.certificate;if(!Z1.isBuffer(J))throw Error("Certificate must be a Buffer");return G+=2,X.writeUInt8(W.usage,G),G+=1,X.writeUInt8(W.selector,G),G+=1,X.writeUInt8(W.matchingType,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,m7.encode.bytes=G-Y,X.writeUInt16BE(m7.encode.bytes-2,Y),X};m7.encode.bytes=0;m7.decode=function(W,X){if(!X)X=0;let G=X,Y={},J=W.readUInt16BE(X);return X+=2,Y.usage=W.readUInt8(X),X+=1,Y.selector=W.readUInt8(X),X+=1,Y.matchingType=W.readUInt8(X),X+=1,Y.certificate=W.slice(X,G+J+2),X+=Y.certificate.length,m7.decode.bytes=X-G,Y};m7.decode.bytes=0;m7.encodingLength=function(W){return 5+Z1.byteLength(W.certificate)};var XK=wd.record=function(W){switch(W.toUpperCase()){case"A":return h4;case"PTR":return s5;case"CNAME":return zd;case"DNAME":return Id;case"TXT":return y4;case"NULL":return v4;case"AAAA":return b4;case"SRV":return u4;case"HINFO":return g4;case"CAA":return q5;case"NS":return k4;case"SOA":return _4;case"MX":return n6;case"OPT":return A5;case"DNSKEY":return u9;case"RRSIG":return y7;case"RP":return v7;case"NSEC":return g7;case"NSEC3":return u7;case"SSHFP":return H5;case"DS":return h7;case"NAPTR":return b7;case"TLSA":return m7}return x4},V9=wd.answer={};V9.encode=function(W,X,G){if(!X)X=Z1.alloc(V9.encodingLength(W));if(!G)G=0;let Y=G;if(g0.encode(W.name,X,G),G+=g0.encode.bytes,X.writeUInt16BE(m4.toType(W.type),G),W.type.toUpperCase()==="OPT"){if(W.name!==".")throw Error("OPT name must be root.");X.writeUInt16BE(W.udpPayloadSize||4096,G+2),X.writeUInt8(W.extendedRcode||0,G+4),X.writeUInt8(W.ednsVersion||0,G+5),X.writeUInt16BE(W.flags||0,G+6),G+=8,A5.encode(W.options||[],X,G),G+=A5.encode.bytes}else{let J=Sq.toClass(W.class===void 0?"IN":W.class);if(W.flush)J|=32768;X.writeUInt16BE(J,G+2),X.writeUInt32BE(W.ttl||0,G+4),G+=8;let Z=XK(W.type);Z.encode(W.data,X,G),G+=Z.encode.bytes}return V9.encode.bytes=G-Y,X};V9.encode.bytes=0;V9.decode=function(W,X){if(!X)X=0;let G={},Y=X;if(G.name=g0.decode(W,X),X+=g0.decode.bytes,G.type=m4.toString(W.readUInt16BE(X)),G.type==="OPT")G.udpPayloadSize=W.readUInt16BE(X+2),G.extendedRcode=W.readUInt8(X+4),G.ednsVersion=W.readUInt8(X+5),G.flags=W.readUInt16BE(X+6),G.flag_do=(G.flags>>15&1)===1,G.options=A5.decode(W,X+8),X+=8+A5.decode.bytes;else{let J=W.readUInt16BE(X+2);G.ttl=W.readUInt32BE(X+4),G.class=Sq.toString(J&-32769),G.flush=!!(J&32768);let Z=XK(G.type);G.data=Z.decode(W,X+8),X+=8+Z.decode.bytes}return V9.decode.bytes=X-Y,G};V9.decode.bytes=0;V9.encodingLength=function(W){let X=W.data!==null&&W.data!==void 0?W.data:W.options;return g0.encodingLength(W.name)+8+XK(W.type).encodingLength(X)};var t5=wd.question={};t5.encode=function(W,X,G){if(!X)X=Z1.alloc(t5.encodingLength(W));if(!G)G=0;let Y=G;return g0.encode(W.name,X,G),G+=g0.encode.bytes,X.writeUInt16BE(m4.toType(W.type),G),G+=2,X.writeUInt16BE(Sq.toClass(W.class===void 0?"IN":W.class),G),G+=2,t5.encode.bytes=G-Y,W};t5.encode.bytes=0;t5.decode=function(W,X){if(!X)X=0;let G=X,Y={};if(Y.name=g0.decode(W,X),X+=g0.decode.bytes,Y.type=m4.toString(W.readUInt16BE(X)),X+=2,Y.class=Sq.toString(W.readUInt16BE(X)),X+=2,!!(Y.class&32768))Y.class&=-32769;return t5.decode.bytes=X-G,Y};t5.decode.bytes=0;t5.encodingLength=function(W){return g0.encodingLength(W.name)+4};wd.AUTHORITATIVE_ANSWER=1024;wd.TRUNCATED_RESPONSE=512;wd.RECURSION_DESIRED=256;wd.RECURSION_AVAILABLE=128;wd.AUTHENTIC_DATA=32;wd.CHECKING_DISABLED=16;wd.DNSSEC_OK=32768;wd.encode=function(W,X,G){let Y=!X;if(Y)X=Z1.alloc(wd.encodingLength(W));if(!G)G=0;let J=G;if(!W.questions)W.questions=[];if(!W.answers)W.answers=[];if(!W.authorities)W.authorities=[];if(!W.additionals)W.additionals=[];if(e5.encode(W,X,G),G+=e5.encode.bytes,G=SV(W.questions,t5,X,G),G=SV(W.answers,V9,X,G),G=SV(W.authorities,V9,X,G),G=SV(W.additionals,V9,X,G),wd.encode.bytes=G-J,Y&&wd.encode.bytes!==X.length)return X.slice(0,wd.encode.bytes);return X};wd.encode.bytes=0;wd.decode=function(W,X){if(!X)X=0;let G=X,Y=e5.decode(W,X);return X+=e5.decode.bytes,X=Fq(Y.questions,t5,W,X),X=Fq(Y.answers,V9,W,X),X=Fq(Y.authorities,V9,W,X),X=Fq(Y.additionals,V9,W,X),wd.decode.bytes=X-G,Y};wd.decode.bytes=0;wd.encodingLength=function(W){return e5.encodingLength(W)+$Y(W.questions||[],t5)+$Y(W.answers||[],V9)+$Y(W.authorities||[],V9)+$Y(W.additionals||[],V9)};wd.streamEncode=function(W){let X=wd.encode(W),G=Z1.alloc(2);G.writeUInt16BE(X.byteLength);let Y=Z1.concat([G,X]);return wd.streamEncode.bytes=Y.byteLength,Y};wd.streamEncode.bytes=0;wd.streamDecode=function(W){let X=W.readUInt16BE(0);if(W.byteLength<X+2)return null;let G=wd.decode(W.slice(2));return wd.streamDecode.bytes=wd.decode.bytes,G};wd.streamDecode.bytes=0;function $Y(W,X){let G=0;for(let Y=0;Y<W.length;Y++)G+=X.encodingLength(W[Y]);return G}function SV(W,X,G,Y){for(let J=0;J<W.length;J++)X.encode(W[J],G,Y),Y+=X.encode.bytes;return Y}function Fq(W,X,G,Y){for(let J=0;J<W.length;J++)W[J]=X.decode(G,Y),Y+=X.decode.bytes;return Y}});var f$=V1((xH0,m$)=>{var b$=Fd;process.nextTick($d,42);m$.exports=Rd;function Rd(W){var X=Y;return G;function G(J){X(J||Bd)}function Y(J){var Z=[J];X=V,W(U);function V(Q){Z.push(Q)}function U(Q){var N=arguments;X=Ld(Q)?Y:q;while(Z.length)q(Z.shift());function q(A){b$(Ed,A,N)}}}}function Ld(W){return Object.prototype.toString.call(W)==="[object Error]"}function Bd(){}function Ed(W,X){W.apply(null,X)}function $d(W){if(W===42)b$=process.nextTick}function Fd(W,X,G){process.nextTick(function(){W(X,G)})}});var l$=V1((kH0,c$)=>{var GK=h$(),Sd=_8("dgram"),xd=f$(),kd=_8("events"),JK=_8("os"),YK=function(){};c$.exports=function(W){if(!W)W={};var X=new kd.EventEmitter,G=typeof W.port==="number"?W.port:5353,Y=W.type||"udp4",J=W.ip||W.host||(Y==="udp4"?"224.0.0.251":null),Z={address:J,port:G},V={},U=!1,Q=null;if(Y==="udp6"&&(!J||!W.interface))throw Error("For IPv6 multicast you must specify `ip` and `interface`");var N=W.socket||Sd.createSocket({type:Y,reuseAddr:W.reuseAddr!==!1,toString:function(){return Y}});N.on("error",function(A){if(A.code==="EACCES"||A.code==="EADDRINUSE")X.emit("error",A);else X.emit("warning",A)}),N.on("message",function(A,H){try{A=GK.decode(A)}catch(I){X.emit("warning",I);return}if(X.emit("packet",A,H),A.type==="query")X.emit("query",A,H);if(A.type==="response")X.emit("response",A,H)}),N.on("listening",function(){if(!G)G=Z.port=N.address().port;if(W.multicast!==!1)X.update(),Q=setInterval(X.update,5000),N.setMulticastTTL(W.ttl||255),N.setMulticastLoopback(W.loopback!==!1)});var q=xd(function(A){if(!G||W.bind===!1)return A(null);N.once("error",A),N.bind(G,W.bind||W.interface,function(){N.removeListener("error",A),A(null)})});return q(function(A){if(A)return X.emit("error",A);X.emit("ready")}),X.send=function(A,H,I){if(typeof H==="function")return X.send(A,null,H);if(!I)I=YK;if(!H)H=Z;else if(!H.host&&!H.address)H.address=Z.address;q(w);function w(D){if(U)return I();if(D)return I(D);var T=GK.encode(A);N.send(T,0,T.length,H.port,H.address||H.host,I)}},X.response=X.respond=function(A,H,I){if(Array.isArray(A))A={answers:A};A.type="response",A.flags=(A.flags||0)|GK.AUTHORITATIVE_ANSWER,X.send(A,H,I)},X.query=function(A,H,I,w){if(typeof H==="function")return X.query(A,null,null,H);if(typeof H==="object"&&H&&H.port)return X.query(A,null,H,I);if(typeof I==="function")return X.query(A,H,null,I);if(!w)w=YK;if(typeof A==="string")A=[{name:A,type:H||"ANY"}];if(Array.isArray(A))A={type:"query",questions:A};A.type="query",X.send(A,I,w)},X.destroy=function(A){if(!A)A=YK;if(U)return process.nextTick(A);U=!0,clearInterval(Q);for(var H in V)try{N.dropMembership(J,H)}catch(I){}V={},N.close(A)},X.update=function(){var A=W.interface?[].concat(W.interface):yd(),H=!1;for(var I=0;I<A.length;I++){var w=A[I];if(V[w])continue;try{N.addMembership(J,w),V[w]=!0,H=!0}catch(D){X.emit("warning",D)}}if(H){if(N.setMulticastInterface)try{N.setMulticastInterface(W.interface||_d())}catch(D){X.emit("warning",D)}X.emit("networkInterface")}},X};function _d(){var W=JK.networkInterfaces(),X=Object.keys(W);for(var G=0;G<X.length;G++){var Y=W[X[G]];for(var J=0;J<Y.length;J++){var Z=Y[J];if(p$(Z.family)&&!Z.internal){if(JK.platform()==="darwin"&&X[G]==="en0")return Z.address;return"0.0.0.0"}}}return"127.0.0.1"}function yd(){var W=JK.networkInterfaces(),X=Object.keys(W),G=[];for(var Y=0;Y<X.length;Y++){var J=W[X[Y]];for(var Z=0;Z<J.length;Z++){var V=J[Z];if(p$(V.family)){G.push(V.address);break}}}return G}function p$(W){return W===4||W==="IPv4"}});import{Database as $t}from"bun:sqlite";import{mkdirSync as Ft}from"fs";import{dirname as St}from"path";function zO(W){let X=W.length,G=0,Y=0;while(Y<X){let J=W.charCodeAt(Y++);if((J&4294967168)===0){G++;continue}else if((J&4294965248)===0)G+=2;else{if(J>=55296&&J<=56319){if(Y<X){let Z=W.charCodeAt(Y);if((Z&64512)===56320)++Y,J=((J&1023)<<10)+(Z&1023)+65536}}if((J&4294901760)===0)G+=3;else G+=4}}return G}function o_(W,X,G){let Y=W.length,J=G,Z=0;while(Z<Y){let V=W.charCodeAt(Z++);if((V&4294967168)===0){X[J++]=V;continue}else if((V&4294965248)===0)X[J++]=V>>6&31|192;else{if(V>=55296&&V<=56319){if(Z<Y){let U=W.charCodeAt(Z);if((U&64512)===56320)++Z,V=((V&1023)<<10)+(U&1023)+65536}}if((V&4294901760)===0)X[J++]=V>>12&15|224,X[J++]=V>>6&63|128;else X[J++]=V>>18&7|240,X[J++]=V>>12&63|128,X[J++]=V>>6&63|128}X[J++]=V&63|128}}var n_=new TextEncoder,i_=50;function r_(W,X,G){n_.encodeInto(W,X.subarray(G))}function IO(W,X,G){if(W.length>i_)r_(W,X,G);else o_(W,X,G)}var a_=4096;function IA(W,X,G){let Y=X,J=Y+G,Z=[],V="";while(Y<J){let U=W[Y++];if((U&128)===0)Z.push(U);else if((U&224)===192){let Q=W[Y++]&63;Z.push((U&31)<<6|Q)}else if((U&240)===224){let Q=W[Y++]&63,N=W[Y++]&63;Z.push((U&31)<<12|Q<<6|N)}else if((U&248)===240){let Q=W[Y++]&63,N=W[Y++]&63,q=W[Y++]&63,A=(U&7)<<18|Q<<12|N<<6|q;if(A>65535)A-=65536,Z.push(A>>>10&1023|55296),A=56320|A&1023;Z.push(A)}else Z.push(U);if(Z.length>=a_)V+=String.fromCharCode(...Z),Z.length=0}if(Z.length>0)V+=String.fromCharCode(...Z);return V}var s_=new TextDecoder,t_=200;function e_(W,X,G){let Y=W.subarray(X,X+G);return s_.decode(Y)}function wO(W,X,G){if(G>t_)return e_(W,X,G);else return IA(W,X,G)}class cX{type;data;constructor(W,X){this.type=W,this.data=X}}class x9 extends Error{constructor(W){super(W);let X=Object.create(x9.prototype);Object.setPrototypeOf(this,X),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:x9.name})}}var lX=4294967295;function jO(W,X,G){let Y=G/4294967296,J=G;W.setUint32(X,Y),W.setUint32(X+4,J)}function vU(W,X,G){let Y=Math.floor(G/4294967296),J=G;W.setUint32(X,Y),W.setUint32(X+4,J)}function gU(W,X){let G=W.getInt32(X),Y=W.getUint32(X+4);return G*4294967296+Y}function KO(W,X){let G=W.getUint32(X),Y=W.getUint32(X+4);return G*4294967296+Y}var Wy=-1,Xy=4294967295,Gy=17179869183;function Yy({sec:W,nsec:X}){if(W>=0&&X>=0&&W<=Gy)if(X===0&&W<=Xy){let G=new Uint8Array(4);return new DataView(G.buffer).setUint32(0,W),G}else{let G=W/4294967296,Y=W&4294967295,J=new Uint8Array(8),Z=new DataView(J.buffer);return Z.setUint32(0,X<<2|G&3),Z.setUint32(4,Y),J}else{let G=new Uint8Array(12),Y=new DataView(G.buffer);return Y.setUint32(0,X),vU(Y,4,W),G}}function Jy(W){let X=W.getTime(),G=Math.floor(X/1000),Y=(X-G*1000)*1e6,J=Math.floor(Y/1e9);return{sec:G+J,nsec:Y-J*1e9}}function Zy(W){if(W instanceof Date){let X=Jy(W);return Yy(X)}else return null}function Vy(W){let X=new DataView(W.buffer,W.byteOffset,W.byteLength);switch(W.byteLength){case 4:{let G=X.getUint32(0),Y=0;return{sec:G,nsec:0}}case 8:{let G=X.getUint32(0),Y=X.getUint32(4),J=(G&3)*4294967296+Y,Z=G>>>2;return{sec:J,nsec:Z}}case 12:{let G=gU(X,4),Y=X.getUint32(0);return{sec:G,nsec:Y}}default:throw new x9(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${W.length}`)}}function Uy(W){let X=Vy(W);return new Date(X.sec*1000+X.nsec/1e6)}var DO={type:Wy,encode:Zy,decode:Uy};class dX{static defaultCodec=new dX;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(DO)}register({type:W,encode:X,decode:G}){if(W>=0)this.encoders[W]=X,this.decoders[W]=G;else{let Y=-1-W;this.builtInEncoders[Y]=X,this.builtInDecoders[Y]=G}}tryToEncode(W,X){for(let G=0;G<this.builtInEncoders.length;G++){let Y=this.builtInEncoders[G];if(Y!=null){let J=Y(W,X);if(J!=null){let Z=-1-G;return new cX(Z,J)}}}for(let G=0;G<this.encoders.length;G++){let Y=this.encoders[G];if(Y!=null){let J=Y(W,X);if(J!=null)return new cX(G,J)}}if(W instanceof cX)return W;return null}decode(W,X,G){let Y=X<0?this.builtInDecoders[-1-X]:this.decoders[X];if(Y)return Y(W,X,G);else return new cX(X,W)}}function Qy(W){return W instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&W instanceof SharedArrayBuffer}function QJ(W){if(W instanceof Uint8Array)return W;else if(ArrayBuffer.isView(W))return new Uint8Array(W.buffer,W.byteOffset,W.byteLength);else if(Qy(W))return new Uint8Array(W);else return Uint8Array.from(W)}var Ny=100,qy=2048;class uU{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dX.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.maxDepth=W?.maxDepth??Ny,this.initialBufferSize=W?.initialBufferSize??qy,this.sortKeys=W?.sortKeys??!1,this.forceFloat32=W?.forceFloat32??!1,this.ignoreUndefined=W?.ignoreUndefined??!1,this.forceIntegerToFloat=W?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new uU({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(W){if(this.entered)return this.clone().encodeSharedRef(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(W){if(this.entered)return this.clone().encode(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(W,X){if(X>this.maxDepth)throw Error(`Too deep objects in depth ${X}`);if(W==null)this.encodeNil();else if(typeof W==="boolean")this.encodeBoolean(W);else if(typeof W==="number")if(!this.forceIntegerToFloat)this.encodeNumber(W);else this.encodeNumberAsFloat(W);else if(typeof W==="string")this.encodeString(W);else if(this.useBigInt64&&typeof W==="bigint")this.encodeBigInt64(W);else this.encodeObject(W,X)}ensureBufferSizeToWrite(W){let X=this.pos+W;if(this.view.byteLength<X)this.resizeBuffer(X*2)}resizeBuffer(W){let X=new ArrayBuffer(W),G=new Uint8Array(X),Y=new DataView(X);G.set(this.bytes),this.view=Y,this.bytes=G}encodeNil(){this.writeU8(192)}encodeBoolean(W){if(W===!1)this.writeU8(194);else this.writeU8(195)}encodeNumber(W){if(!this.forceIntegerToFloat&&Number.isSafeInteger(W))if(W>=0)if(W<128)this.writeU8(W);else if(W<256)this.writeU8(204),this.writeU8(W);else if(W<65536)this.writeU8(205),this.writeU16(W);else if(W<4294967296)this.writeU8(206),this.writeU32(W);else if(!this.useBigInt64)this.writeU8(207),this.writeU64(W);else this.encodeNumberAsFloat(W);else if(W>=-32)this.writeU8(224|W+32);else if(W>=-128)this.writeU8(208),this.writeI8(W);else if(W>=-32768)this.writeU8(209),this.writeI16(W);else if(W>=-2147483648)this.writeU8(210),this.writeI32(W);else if(!this.useBigInt64)this.writeU8(211),this.writeI64(W);else this.encodeNumberAsFloat(W);else this.encodeNumberAsFloat(W)}encodeNumberAsFloat(W){if(this.forceFloat32)this.writeU8(202),this.writeF32(W);else this.writeU8(203),this.writeF64(W)}encodeBigInt64(W){if(W>=BigInt(0))this.writeU8(207),this.writeBigUint64(W);else this.writeU8(211),this.writeBigInt64(W)}writeStringHeader(W){if(W<32)this.writeU8(160+W);else if(W<256)this.writeU8(217),this.writeU8(W);else if(W<65536)this.writeU8(218),this.writeU16(W);else if(W<4294967296)this.writeU8(219),this.writeU32(W);else throw Error(`Too long string: ${W} bytes in UTF-8`)}encodeString(W){let G=zO(W);this.ensureBufferSizeToWrite(5+G),this.writeStringHeader(G),IO(W,this.bytes,this.pos),this.pos+=G}encodeObject(W,X){let G=this.extensionCodec.tryToEncode(W,this.context);if(G!=null)this.encodeExtension(G);else if(Array.isArray(W))this.encodeArray(W,X);else if(ArrayBuffer.isView(W))this.encodeBinary(W);else if(typeof W==="object")this.encodeMap(W,X);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(W)}`)}encodeBinary(W){let X=W.byteLength;if(X<256)this.writeU8(196),this.writeU8(X);else if(X<65536)this.writeU8(197),this.writeU16(X);else if(X<4294967296)this.writeU8(198),this.writeU32(X);else throw Error(`Too large binary: ${X}`);let G=QJ(W);this.writeU8a(G)}encodeArray(W,X){let G=W.length;if(G<16)this.writeU8(144+G);else if(G<65536)this.writeU8(220),this.writeU16(G);else if(G<4294967296)this.writeU8(221),this.writeU32(G);else throw Error(`Too large array: ${G}`);for(let Y of W)this.doEncode(Y,X+1)}countWithoutUndefined(W,X){let G=0;for(let Y of X)if(W[Y]!==void 0)G++;return G}encodeMap(W,X){let G=Object.keys(W);if(this.sortKeys)G.sort();let Y=this.ignoreUndefined?this.countWithoutUndefined(W,G):G.length;if(Y<16)this.writeU8(128+Y);else if(Y<65536)this.writeU8(222),this.writeU16(Y);else if(Y<4294967296)this.writeU8(223),this.writeU32(Y);else throw Error(`Too large map object: ${Y}`);for(let J of G){let Z=W[J];if(!(this.ignoreUndefined&&Z===void 0))this.encodeString(J),this.doEncode(Z,X+1)}}encodeExtension(W){if(typeof W.data==="function"){let G=W.data(this.pos+6),Y=G.length;if(Y>=4294967296)throw Error(`Too large extension object: ${Y}`);this.writeU8(201),this.writeU32(Y),this.writeI8(W.type),this.writeU8a(G);return}let X=W.data.length;if(X===1)this.writeU8(212);else if(X===2)this.writeU8(213);else if(X===4)this.writeU8(214);else if(X===8)this.writeU8(215);else if(X===16)this.writeU8(216);else if(X<256)this.writeU8(199),this.writeU8(X);else if(X<65536)this.writeU8(200),this.writeU16(X);else if(X<4294967296)this.writeU8(201),this.writeU32(X);else throw Error(`Too large extension object: ${X}`);this.writeI8(W.type),this.writeU8a(W.data)}writeU8(W){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,W),this.pos++}writeU8a(W){let X=W.length;this.ensureBufferSizeToWrite(X),this.bytes.set(W,this.pos),this.pos+=X}writeI8(W){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,W),this.pos++}writeU16(W){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,W),this.pos+=2}writeI16(W){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,W),this.pos+=2}writeU32(W){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,W),this.pos+=4}writeI32(W){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,W),this.pos+=4}writeF32(W){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,W),this.pos+=4}writeF64(W){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,W),this.pos+=8}writeU64(W){this.ensureBufferSizeToWrite(8),jO(this.view,this.pos,W),this.pos+=8}writeI64(W){this.ensureBufferSizeToWrite(8),vU(this.view,this.pos,W),this.pos+=8}writeBigUint64(W){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,W),this.pos+=8}writeBigInt64(W){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,W),this.pos+=8}}function hU(W,X){return new uU(X).encodeSharedRef(W)}function bU(W){return`${W<0?"-":""}0x${Math.abs(W).toString(16).padStart(2,"0")}`}var Hy=16,Ay=16;class wA{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(W=Hy,X=Ay){this.maxKeyLength=W,this.maxLengthPerKey=X,this.caches=[];for(let G=0;G<this.maxKeyLength;G++)this.caches.push([])}canBeCached(W){return W>0&&W<=this.maxKeyLength}find(W,X,G){let Y=this.caches[G-1];W:for(let J of Y){let Z=J.bytes;for(let V=0;V<G;V++)if(Z[V]!==W[X+V])continue W;return J.str}return null}store(W,X){let G=this.caches[W.length-1],Y={bytes:W,str:X};if(G.length>=this.maxLengthPerKey)G[Math.random()*G.length|0]=Y;else G.push(Y)}decode(W,X,G){let Y=this.find(W,X,G);if(Y!=null)return this.hit++,Y;this.miss++;let J=IA(W,X,G),Z=Uint8Array.prototype.slice.call(W,X,X+G);return this.store(Z,J),J}}var jA="array",qJ="map_key",CO="map_value",zy=(W)=>{if(typeof W==="string"||typeof W==="number")return W;throw new x9("The type of key must be string or number but "+typeof W)};class TO{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(W){let X=this.getUninitializedStateFromPool();X.type=jA,X.position=0,X.size=W,X.array=Array(W)}pushMapState(W){let X=this.getUninitializedStateFromPool();X.type=qJ,X.readCount=0,X.size=W,X.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let W={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(W)}return this.stack[this.stackHeadPosition]}release(W){if(this.stack[this.stackHeadPosition]!==W)throw Error("Invalid stack state. Released state is not on top of the stack.");if(W.type===jA){let G=W;G.size=0,G.array=void 0,G.position=0,G.type=void 0}if(W.type===qJ||W.type===CO){let G=W;G.size=0,G.map=void 0,G.readCount=0,G.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}var NJ=-1,KA=new DataView(new ArrayBuffer(0)),Iy=new Uint8Array(KA.buffer);try{KA.getInt8(0)}catch(W){if(!(W instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var OO=RangeError("Insufficient data"),wy=new wA;class mU{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=KA;bytes=Iy;headByte=NJ;stack=new TO;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dX.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.rawStrings=W?.rawStrings??!1,this.maxStrLength=W?.maxStrLength??lX,this.maxBinLength=W?.maxBinLength??lX,this.maxArrayLength=W?.maxArrayLength??lX,this.maxMapLength=W?.maxMapLength??lX,this.maxExtLength=W?.maxExtLength??lX,this.keyDecoder=W?.keyDecoder!==void 0?W.keyDecoder:wy,this.mapKeyConverter=W?.mapKeyConverter??zy}clone(){return new mU({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=NJ,this.stack.reset()}setBuffer(W){let X=QJ(W);this.bytes=X,this.view=new DataView(X.buffer,X.byteOffset,X.byteLength),this.pos=0}appendBuffer(W){if(this.headByte===NJ&&!this.hasRemaining(1))this.setBuffer(W);else{let X=this.bytes.subarray(this.pos),G=QJ(W),Y=new Uint8Array(X.length+G.length);Y.set(X),Y.set(G,X.length),this.setBuffer(Y)}}hasRemaining(W){return this.view.byteLength-this.pos>=W}createExtraByteError(W){let{view:X,pos:G}=this;return RangeError(`Extra ${X.byteLength-G} of ${X.byteLength} byte(s) found at buffer[${W}]`)}decode(W){if(this.entered)return this.clone().decode(W);try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);let X=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return X}finally{this.entered=!1}}*decodeMulti(W){if(this.entered){yield*this.clone().decodeMulti(W);return}try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);while(this.hasRemaining(1))yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(W){if(this.entered)return this.clone().decodeAsync(W);try{this.entered=!0;let X=!1,G;for await(let V of W){if(X)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(V);try{G=this.doDecodeSync(),X=!0}catch(U){if(!(U instanceof RangeError))throw U}this.totalPos+=this.pos}if(X){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return G}let{headByte:Y,pos:J,totalPos:Z}=this;throw RangeError(`Insufficient data in parsing ${bU(Y)} at ${Z} (${J} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(W){return this.decodeMultiAsync(W,!0)}decodeStream(W){return this.decodeMultiAsync(W,!1)}async*decodeMultiAsync(W,X){if(this.entered){yield*this.clone().decodeMultiAsync(W,X);return}try{this.entered=!0;let G=X,Y=-1;for await(let J of W){if(X&&Y===0)throw this.createExtraByteError(this.totalPos);if(this.appendBuffer(J),G)Y=this.readArraySize(),G=!1,this.complete();try{while(!0)if(yield this.doDecodeSync(),--Y===0)break}catch(Z){if(!(Z instanceof RangeError))throw Z}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){W:while(!0){let W=this.readHeadByte(),X;if(W>=224)X=W-256;else if(W<192)if(W<128)X=W;else if(W<144){let Y=W-128;if(Y!==0){this.pushMapState(Y),this.complete();continue W}else X={}}else if(W<160){let Y=W-144;if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else X=[]}else{let Y=W-160;X=this.decodeString(Y,0)}else if(W===192)X=null;else if(W===194)X=!1;else if(W===195)X=!0;else if(W===202)X=this.readF32();else if(W===203)X=this.readF64();else if(W===204)X=this.readU8();else if(W===205)X=this.readU16();else if(W===206)X=this.readU32();else if(W===207)if(this.useBigInt64)X=this.readU64AsBigInt();else X=this.readU64();else if(W===208)X=this.readI8();else if(W===209)X=this.readI16();else if(W===210)X=this.readI32();else if(W===211)if(this.useBigInt64)X=this.readI64AsBigInt();else X=this.readI64();else if(W===217){let Y=this.lookU8();X=this.decodeString(Y,1)}else if(W===218){let Y=this.lookU16();X=this.decodeString(Y,2)}else if(W===219){let Y=this.lookU32();X=this.decodeString(Y,4)}else if(W===220){let Y=this.readU16();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else X=[]}else if(W===221){let Y=this.readU32();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else X=[]}else if(W===222){let Y=this.readU16();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else X={}}else if(W===223){let Y=this.readU32();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else X={}}else if(W===196){let Y=this.lookU8();X=this.decodeBinary(Y,1)}else if(W===197){let Y=this.lookU16();X=this.decodeBinary(Y,2)}else if(W===198){let Y=this.lookU32();X=this.decodeBinary(Y,4)}else if(W===212)X=this.decodeExtension(1,0);else if(W===213)X=this.decodeExtension(2,0);else if(W===214)X=this.decodeExtension(4,0);else if(W===215)X=this.decodeExtension(8,0);else if(W===216)X=this.decodeExtension(16,0);else if(W===199){let Y=this.lookU8();X=this.decodeExtension(Y,1)}else if(W===200){let Y=this.lookU16();X=this.decodeExtension(Y,2)}else if(W===201){let Y=this.lookU32();X=this.decodeExtension(Y,4)}else throw new x9(`Unrecognized type byte: ${bU(W)}`);this.complete();let G=this.stack;while(G.length>0){let Y=G.top();if(Y.type===jA)if(Y.array[Y.position]=X,Y.position++,Y.position===Y.size)X=Y.array,G.release(Y);else continue W;else if(Y.type===qJ){if(X==="__proto__")throw new x9("The key __proto__ is not allowed");Y.key=this.mapKeyConverter(X),Y.type=CO;continue W}else if(Y.map[Y.key]=X,Y.readCount++,Y.readCount===Y.size)X=Y.map,G.release(Y);else{Y.key=null,Y.type=qJ;continue W}}return X}}readHeadByte(){if(this.headByte===NJ)this.headByte=this.readU8();return this.headByte}complete(){this.headByte=NJ}readArraySize(){let W=this.readHeadByte();switch(W){case 220:return this.readU16();case 221:return this.readU32();default:if(W<160)return W-144;else throw new x9(`Unrecognized array type byte: ${bU(W)}`)}}pushMapState(W){if(W>this.maxMapLength)throw new x9(`Max length exceeded: map length (${W}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(W)}pushArrayState(W){if(W>this.maxArrayLength)throw new x9(`Max length exceeded: array length (${W}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(W)}decodeString(W,X){if(!this.rawStrings||this.stateIsMapKey())return this.decodeUtf8String(W,X);return this.decodeBinary(W,X)}decodeUtf8String(W,X){if(W>this.maxStrLength)throw new x9(`Max length exceeded: UTF-8 byte length (${W}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+X+W)throw OO;let G=this.pos+X,Y;if(this.stateIsMapKey()&&this.keyDecoder?.canBeCached(W))Y=this.keyDecoder.decode(this.bytes,G,W);else Y=wO(this.bytes,G,W);return this.pos+=X+W,Y}stateIsMapKey(){if(this.stack.length>0)return this.stack.top().type===qJ;return!1}decodeBinary(W,X){if(W>this.maxBinLength)throw new x9(`Max length exceeded: bin length (${W}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(W+X))throw OO;let G=this.pos+X,Y=this.bytes.subarray(G,G+W);return this.pos+=X+W,Y}decodeExtension(W,X){if(W>this.maxExtLength)throw new x9(`Max length exceeded: ext length (${W}) > maxExtLength (${this.maxExtLength})`);let G=this.view.getInt8(this.pos+X),Y=this.decodeBinary(W,X+1);return this.extensionCodec.decode(Y,G,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let W=this.view.getUint8(this.pos);return this.pos++,W}readI8(){let W=this.view.getInt8(this.pos);return this.pos++,W}readU16(){let W=this.view.getUint16(this.pos);return this.pos+=2,W}readI16(){let W=this.view.getInt16(this.pos);return this.pos+=2,W}readU32(){let W=this.view.getUint32(this.pos);return this.pos+=4,W}readI32(){let W=this.view.getInt32(this.pos);return this.pos+=4,W}readU64(){let W=KO(this.view,this.pos);return this.pos+=8,W}readI64(){let W=gU(this.view,this.pos);return this.pos+=8,W}readU64AsBigInt(){let W=this.view.getBigUint64(this.pos);return this.pos+=8,W}readI64AsBigInt(){let W=this.view.getBigInt64(this.pos);return this.pos+=8,W}readF32(){let W=this.view.getFloat32(this.pos);return this.pos+=4,W}readF64(){let W=this.view.getFloat64(this.pos);return this.pos+=8,W}}function AW(W,X){return new mU(X).decode(W)}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function sX(W){let X=W.length;while(--X>=0)W[X]=0}var jy=0,VC=1,Ky=2,Dy=3,Oy=258,fA=29,LJ=256,KJ=LJ+1+fA,iX=30,pA=19,UC=2*KJ+1,zW=15,DA=16,Cy=7,cA=256,QC=16,NC=17,qC=18,kA=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),oU=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ty=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),HC=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),My=512,e7=Array((KJ+2)*2);sX(e7);var IJ=Array(iX*2);sX(IJ);var DJ=Array(My);sX(DJ);var OJ=Array(Oy-Dy+1);sX(OJ);var lA=Array(fA);sX(lA);var nU=Array(iX);sX(nU);function OA(W,X,G,Y,J){this.static_tree=W,this.extra_bits=X,this.extra_base=G,this.elems=Y,this.max_length=J,this.has_stree=W&&W.length}var AC,zC,IC;function CA(W,X){this.dyn_tree=W,this.max_code=0,this.stat_desc=X}var wC=(W)=>{return W<256?DJ[W]:DJ[256+(W>>>7)]},CJ=(W,X)=>{W.pending_buf[W.pending++]=X&255,W.pending_buf[W.pending++]=X>>>8&255},b9=(W,X,G)=>{if(W.bi_valid>DA-G)W.bi_buf|=X<<W.bi_valid&65535,CJ(W,W.bi_buf),W.bi_buf=X>>DA-W.bi_valid,W.bi_valid+=G-DA;else W.bi_buf|=X<<W.bi_valid&65535,W.bi_valid+=G},H7=(W,X,G)=>{b9(W,G[X*2],G[X*2+1])},jC=(W,X)=>{let G=0;do G|=W&1,W>>>=1,G<<=1;while(--X>0);return G>>>1},Py=(W)=>{if(W.bi_valid===16)CJ(W,W.bi_buf),W.bi_buf=0,W.bi_valid=0;else if(W.bi_valid>=8)W.pending_buf[W.pending++]=W.bi_buf&255,W.bi_buf>>=8,W.bi_valid-=8},Ry=(W,X)=>{let{dyn_tree:G,max_code:Y}=X,J=X.stat_desc.static_tree,Z=X.stat_desc.has_stree,V=X.stat_desc.extra_bits,U=X.stat_desc.extra_base,Q=X.stat_desc.max_length,N,q,A,H,I,w,D=0;for(H=0;H<=zW;H++)W.bl_count[H]=0;G[W.heap[W.heap_max]*2+1]=0;for(N=W.heap_max+1;N<UC;N++){if(q=W.heap[N],H=G[G[q*2+1]*2+1]+1,H>Q)H=Q,D++;if(G[q*2+1]=H,q>Y)continue;if(W.bl_count[H]++,I=0,q>=U)I=V[q-U];if(w=G[q*2],W.opt_len+=w*(H+I),Z)W.static_len+=w*(J[q*2+1]+I)}if(D===0)return;do{H=Q-1;while(W.bl_count[H]===0)H--;W.bl_count[H]--,W.bl_count[H+1]+=2,W.bl_count[Q]--,D-=2}while(D>0);for(H=Q;H!==0;H--){q=W.bl_count[H];while(q!==0){if(A=W.heap[--N],A>Y)continue;if(G[A*2+1]!==H)W.opt_len+=(H-G[A*2+1])*G[A*2],G[A*2+1]=H;q--}}},KC=(W,X,G)=>{let Y=Array(zW+1),J=0,Z,V;for(Z=1;Z<=zW;Z++)J=J+G[Z-1]<<1,Y[Z]=J;for(V=0;V<=X;V++){let U=W[V*2+1];if(U===0)continue;W[V*2]=jC(Y[U]++,U)}},Ly=()=>{let W,X,G,Y,J,Z=Array(zW+1);G=0;for(Y=0;Y<fA-1;Y++){lA[Y]=G;for(W=0;W<1<<kA[Y];W++)OJ[G++]=Y}OJ[G-1]=Y,J=0;for(Y=0;Y<16;Y++){nU[Y]=J;for(W=0;W<1<<oU[Y];W++)DJ[J++]=Y}J>>=7;for(;Y<iX;Y++){nU[Y]=J<<7;for(W=0;W<1<<oU[Y]-7;W++)DJ[256+J++]=Y}for(X=0;X<=zW;X++)Z[X]=0;W=0;while(W<=143)e7[W*2+1]=8,W++,Z[8]++;while(W<=255)e7[W*2+1]=9,W++,Z[9]++;while(W<=279)e7[W*2+1]=7,W++,Z[7]++;while(W<=287)e7[W*2+1]=8,W++,Z[8]++;KC(e7,KJ+1,Z);for(W=0;W<iX;W++)IJ[W*2+1]=5,IJ[W*2]=jC(W,5);AC=new OA(e7,kA,LJ+1,KJ,zW),zC=new OA(IJ,oU,0,iX,zW),IC=new OA([],Ty,0,pA,Cy)},DC=(W)=>{let X;for(X=0;X<KJ;X++)W.dyn_ltree[X*2]=0;for(X=0;X<iX;X++)W.dyn_dtree[X*2]=0;for(X=0;X<pA;X++)W.bl_tree[X*2]=0;W.dyn_ltree[cA*2]=1,W.opt_len=W.static_len=0,W.sym_next=W.matches=0},OC=(W)=>{if(W.bi_valid>8)CJ(W,W.bi_buf);else if(W.bi_valid>0)W.pending_buf[W.pending++]=W.bi_buf;W.bi_buf=0,W.bi_valid=0},MO=(W,X,G,Y)=>{let J=X*2,Z=G*2;return W[J]<W[Z]||W[J]===W[Z]&&Y[X]<=Y[G]},TA=(W,X,G)=>{let Y=W.heap[G],J=G<<1;while(J<=W.heap_len){if(J<W.heap_len&&MO(X,W.heap[J+1],W.heap[J],W.depth))J++;if(MO(X,Y,W.heap[J],W.depth))break;W.heap[G]=W.heap[J],G=J,J<<=1}W.heap[G]=Y},PO=(W,X,G)=>{let Y,J,Z=0,V,U;if(W.sym_next!==0)do if(Y=W.pending_buf[W.sym_buf+Z++]&255,Y+=(W.pending_buf[W.sym_buf+Z++]&255)<<8,J=W.pending_buf[W.sym_buf+Z++],Y===0)H7(W,J,X);else{if(V=OJ[J],H7(W,V+LJ+1,X),U=kA[V],U!==0)J-=lA[V],b9(W,J,U);if(Y--,V=wC(Y),H7(W,V,G),U=oU[V],U!==0)Y-=nU[V],b9(W,Y,U)}while(Z<W.sym_next);H7(W,cA,X)},_A=(W,X)=>{let G=X.dyn_tree,Y=X.stat_desc.static_tree,J=X.stat_desc.has_stree,Z=X.stat_desc.elems,V,U,Q=-1,N;W.heap_len=0,W.heap_max=UC;for(V=0;V<Z;V++)if(G[V*2]!==0)W.heap[++W.heap_len]=Q=V,W.depth[V]=0;else G[V*2+1]=0;while(W.heap_len<2)if(N=W.heap[++W.heap_len]=Q<2?++Q:0,G[N*2]=1,W.depth[N]=0,W.opt_len--,J)W.static_len-=Y[N*2+1];X.max_code=Q;for(V=W.heap_len>>1;V>=1;V--)TA(W,G,V);N=Z;do V=W.heap[1],W.heap[1]=W.heap[W.heap_len--],TA(W,G,1),U=W.heap[1],W.heap[--W.heap_max]=V,W.heap[--W.heap_max]=U,G[N*2]=G[V*2]+G[U*2],W.depth[N]=(W.depth[V]>=W.depth[U]?W.depth[V]:W.depth[U])+1,G[V*2+1]=G[U*2+1]=N,W.heap[1]=N++,TA(W,G,1);while(W.heap_len>=2);W.heap[--W.heap_max]=W.heap[1],Ry(W,X),KC(G,Q,W.bl_count)},RO=(W,X,G)=>{let Y,J=-1,Z,V=X[1],U=0,Q=7,N=4;if(V===0)Q=138,N=3;X[(G+1)*2+1]=65535;for(Y=0;Y<=G;Y++){if(Z=V,V=X[(Y+1)*2+1],++U<Q&&Z===V)continue;else if(U<N)W.bl_tree[Z*2]+=U;else if(Z!==0){if(Z!==J)W.bl_tree[Z*2]++;W.bl_tree[QC*2]++}else if(U<=10)W.bl_tree[NC*2]++;else W.bl_tree[qC*2]++;if(U=0,J=Z,V===0)Q=138,N=3;else if(Z===V)Q=6,N=3;else Q=7,N=4}},LO=(W,X,G)=>{let Y,J=-1,Z,V=X[1],U=0,Q=7,N=4;if(V===0)Q=138,N=3;for(Y=0;Y<=G;Y++){if(Z=V,V=X[(Y+1)*2+1],++U<Q&&Z===V)continue;else if(U<N)do H7(W,Z,W.bl_tree);while(--U!==0);else if(Z!==0){if(Z!==J)H7(W,Z,W.bl_tree),U--;H7(W,QC,W.bl_tree),b9(W,U-3,2)}else if(U<=10)H7(W,NC,W.bl_tree),b9(W,U-3,3);else H7(W,qC,W.bl_tree),b9(W,U-11,7);if(U=0,J=Z,V===0)Q=138,N=3;else if(Z===V)Q=6,N=3;else Q=7,N=4}},By=(W)=>{let X;RO(W,W.dyn_ltree,W.l_desc.max_code),RO(W,W.dyn_dtree,W.d_desc.max_code),_A(W,W.bl_desc);for(X=pA-1;X>=3;X--)if(W.bl_tree[HC[X]*2+1]!==0)break;return W.opt_len+=3*(X+1)+5+5+4,X},Ey=(W,X,G,Y)=>{let J;b9(W,X-257,5),b9(W,G-1,5),b9(W,Y-4,4);for(J=0;J<Y;J++)b9(W,W.bl_tree[HC[J]*2+1],3);LO(W,W.dyn_ltree,X-1),LO(W,W.dyn_dtree,G-1)},$y=(W)=>{let X=4093624447,G;for(G=0;G<=31;G++,X>>>=1)if(X&1&&W.dyn_ltree[G*2]!==0)return 0;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return 1;for(G=32;G<LJ;G++)if(W.dyn_ltree[G*2]!==0)return 1;return 0},BO=!1,Fy=(W)=>{if(!BO)Ly(),BO=!0;W.l_desc=new CA(W.dyn_ltree,AC),W.d_desc=new CA(W.dyn_dtree,zC),W.bl_desc=new CA(W.bl_tree,IC),W.bi_buf=0,W.bi_valid=0,DC(W)},CC=(W,X,G,Y)=>{if(b9(W,(jy<<1)+(Y?1:0),3),OC(W),CJ(W,G),CJ(W,~G),G)W.pending_buf.set(W.window.subarray(X,X+G),W.pending);W.pending+=G},Sy=(W)=>{b9(W,VC<<1,3),H7(W,cA,e7),Py(W)},xy=(W,X,G,Y)=>{let J,Z,V=0;if(W.level>0){if(W.strm.data_type===2)W.strm.data_type=$y(W);if(_A(W,W.l_desc),_A(W,W.d_desc),V=By(W),J=W.opt_len+3+7>>>3,Z=W.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=G+5;if(G+4<=J&&X!==-1)CC(W,X,G,Y);else if(W.strategy===4||Z===J)b9(W,(VC<<1)+(Y?1:0),3),PO(W,e7,IJ);else b9(W,(Ky<<1)+(Y?1:0),3),Ey(W,W.l_desc.max_code+1,W.d_desc.max_code+1,V+1),PO(W,W.dyn_ltree,W.dyn_dtree);if(DC(W),Y)OC(W)},ky=(W,X,G)=>{if(W.pending_buf[W.sym_buf+W.sym_next++]=X,W.pending_buf[W.sym_buf+W.sym_next++]=X>>8,W.pending_buf[W.sym_buf+W.sym_next++]=G,X===0)W.dyn_ltree[G*2]++;else W.matches++,X--,W.dyn_ltree[(OJ[G]+LJ+1)*2]++,W.dyn_dtree[wC(X)*2]++;return W.sym_next===W.sym_end},_y=Fy,yy=CC,vy=xy,gy=ky,uy=Sy,hy={_tr_init:_y,_tr_stored_block:yy,_tr_flush_block:vy,_tr_tally:gy,_tr_align:uy},by=(W,X,G,Y)=>{let J=W&65535|0,Z=W>>>16&65535|0,V=0;while(G!==0){V=G>2000?2000:G,G-=V;do J=J+X[Y++]|0,Z=Z+J|0;while(--V);J%=65521,Z%=65521}return J|Z<<16|0},TJ=by,my=()=>{let W,X=[];for(var G=0;G<256;G++){W=G;for(var Y=0;Y<8;Y++)W=W&1?3988292384^W>>>1:W>>>1;X[G]=W}return X},fy=new Uint32Array(my()),py=(W,X,G,Y)=>{let J=fy,Z=Y+G;W^=-1;for(let V=Y;V<Z;V++)W=W>>>8^J[(W^X[V])&255];return W^-1},r8=py,jW={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},OW={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:cy,_tr_stored_block:yA,_tr_flush_block:ly,_tr_tally:U6,_tr_align:dy}=hy,{Z_NO_FLUSH:Q6,Z_PARTIAL_FLUSH:oy,Z_FULL_FLUSH:ny,Z_FINISH:j5,Z_BLOCK:EO,Z_OK:W9,Z_STREAM_END:$O,Z_STREAM_ERROR:A7,Z_DATA_ERROR:iy,Z_BUF_ERROR:MA,Z_DEFAULT_COMPRESSION:ry,Z_FILTERED:ay,Z_HUFFMAN_ONLY:fU,Z_RLE:sy,Z_FIXED:ty,Z_DEFAULT_STRATEGY:ey,Z_UNKNOWN:Wv,Z_DEFLATED:aU}=OW,Xv=9,Gv=15,Yv=8,Jv=29,Zv=256,vA=Zv+1+Jv,Vv=30,Uv=19,Qv=2*vA+1,Nv=15,f1=3,V6=258,z7=V6+f1+1,qv=32,rX=42,dA=57,gA=69,uA=73,hA=91,bA=103,IW=113,AJ=666,k9=1,tX=2,KW=3,eX=4,Hv=3,wW=(W,X)=>{return W.msg=jW[X],X},FO=(W)=>{return W*2-(W>4?9:0)},Z6=(W)=>{let X=W.length;while(--X>=0)W[X]=0},Av=(W)=>{let X,G,Y,J=W.w_size;X=W.hash_size,Y=X;do G=W.head[--Y],W.head[Y]=G>=J?G-J:0;while(--X);X=J,Y=X;do G=W.prev[--Y],W.prev[Y]=G>=J?G-J:0;while(--X)},zv=(W,X,G)=>(X<<W.hash_shift^G)&W.hash_mask,N6=zv,X5=(W)=>{let X=W.state,G=X.pending;if(G>W.avail_out)G=W.avail_out;if(G===0)return;if(W.output.set(X.pending_buf.subarray(X.pending_out,X.pending_out+G),W.next_out),W.next_out+=G,X.pending_out+=G,W.total_out+=G,W.avail_out-=G,X.pending-=G,X.pending===0)X.pending_out=0},G5=(W,X)=>{ly(W,W.block_start>=0?W.block_start:-1,W.strstart-W.block_start,X),W.block_start=W.strstart,X5(W.strm)},t1=(W,X)=>{W.pending_buf[W.pending++]=X},HJ=(W,X)=>{W.pending_buf[W.pending++]=X>>>8&255,W.pending_buf[W.pending++]=X&255},mA=(W,X,G,Y)=>{let J=W.avail_in;if(J>Y)J=Y;if(J===0)return 0;if(W.avail_in-=J,X.set(W.input.subarray(W.next_in,W.next_in+J),G),W.state.wrap===1)W.adler=TJ(W.adler,X,J,G);else if(W.state.wrap===2)W.adler=r8(W.adler,X,J,G);return W.next_in+=J,W.total_in+=J,J},TC=(W,X)=>{let{max_chain_length:G,strstart:Y}=W,J,Z,V=W.prev_length,U=W.nice_match,Q=W.strstart>W.w_size-z7?W.strstart-(W.w_size-z7):0,N=W.window,q=W.w_mask,A=W.prev,H=W.strstart+V6,I=N[Y+V-1],w=N[Y+V];if(W.prev_length>=W.good_match)G>>=2;if(U>W.lookahead)U=W.lookahead;do{if(J=X,N[J+V]!==w||N[J+V-1]!==I||N[J]!==N[Y]||N[++J]!==N[Y+1])continue;Y+=2,J++;do;while(N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&Y<H);if(Z=V6-(H-Y),Y=H-V6,Z>V){if(W.match_start=X,V=Z,Z>=U)break;I=N[Y+V-1],w=N[Y+V]}}while((X=A[X&q])>Q&&--G!==0);if(V<=W.lookahead)return V;return W.lookahead},aX=(W)=>{let X=W.w_size,G,Y,J;do{if(Y=W.window_size-W.lookahead-W.strstart,W.strstart>=X+(X-z7)){if(W.window.set(W.window.subarray(X,X+X-Y),0),W.match_start-=X,W.strstart-=X,W.block_start-=X,W.insert>W.strstart)W.insert=W.strstart;Av(W),Y+=X}if(W.strm.avail_in===0)break;if(G=mA(W.strm,W.window,W.strstart+W.lookahead,Y),W.lookahead+=G,W.lookahead+W.insert>=f1){J=W.strstart-W.insert,W.ins_h=W.window[J],W.ins_h=N6(W,W.ins_h,W.window[J+1]);while(W.insert)if(W.ins_h=N6(W,W.ins_h,W.window[J+f1-1]),W.prev[J&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=J,J++,W.insert--,W.lookahead+W.insert<f1)break}}while(W.lookahead<z7&&W.strm.avail_in!==0)},MC=(W,X)=>{let G=W.pending_buf_size-5>W.w_size?W.w_size:W.pending_buf_size-5,Y,J,Z,V=0,U=W.strm.avail_in;do{if(Y=65535,Z=W.bi_valid+42>>3,W.strm.avail_out<Z)break;if(Z=W.strm.avail_out-Z,J=W.strstart-W.block_start,Y>J+W.strm.avail_in)Y=J+W.strm.avail_in;if(Y>Z)Y=Z;if(Y<G&&(Y===0&&X!==j5||X===Q6||Y!==J+W.strm.avail_in))break;if(V=X===j5&&Y===J+W.strm.avail_in?1:0,yA(W,0,0,V),W.pending_buf[W.pending-4]=Y,W.pending_buf[W.pending-3]=Y>>8,W.pending_buf[W.pending-2]=~Y,W.pending_buf[W.pending-1]=~Y>>8,X5(W.strm),J){if(J>Y)J=Y;W.strm.output.set(W.window.subarray(W.block_start,W.block_start+J),W.strm.next_out),W.strm.next_out+=J,W.strm.avail_out-=J,W.strm.total_out+=J,W.block_start+=J,Y-=J}if(Y)mA(W.strm,W.strm.output,W.strm.next_out,Y),W.strm.next_out+=Y,W.strm.avail_out-=Y,W.strm.total_out+=Y}while(V===0);if(U-=W.strm.avail_in,U){if(U>=W.w_size)W.matches=2,W.window.set(W.strm.input.subarray(W.strm.next_in-W.w_size,W.strm.next_in),0),W.strstart=W.w_size,W.insert=W.strstart;else{if(W.window_size-W.strstart<=U){if(W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(W.insert>W.strstart)W.insert=W.strstart}W.window.set(W.strm.input.subarray(W.strm.next_in-U,W.strm.next_in),W.strstart),W.strstart+=U,W.insert+=U>W.w_size-W.insert?W.w_size-W.insert:U}W.block_start=W.strstart}if(W.high_water<W.strstart)W.high_water=W.strstart;if(V)return eX;if(X!==Q6&&X!==j5&&W.strm.avail_in===0&&W.strstart===W.block_start)return tX;if(Z=W.window_size-W.strstart,W.strm.avail_in>Z&&W.block_start>=W.w_size){if(W.block_start-=W.w_size,W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(Z+=W.w_size,W.insert>W.strstart)W.insert=W.strstart}if(Z>W.strm.avail_in)Z=W.strm.avail_in;if(Z)mA(W.strm,W.window,W.strstart,Z),W.strstart+=Z,W.insert+=Z>W.w_size-W.insert?W.w_size-W.insert:Z;if(W.high_water<W.strstart)W.high_water=W.strstart;if(Z=W.bi_valid+42>>3,Z=W.pending_buf_size-Z>65535?65535:W.pending_buf_size-Z,G=Z>W.w_size?W.w_size:Z,J=W.strstart-W.block_start,J>=G||(J||X===j5)&&X!==Q6&&W.strm.avail_in===0&&J<=Z)Y=J>Z?Z:J,V=X===j5&&W.strm.avail_in===0&&Y===J?1:0,yA(W,W.block_start,Y,V),W.block_start+=Y,X5(W.strm);return V?KW:k9},PA=(W,X)=>{let G,Y;for(;;){if(W.lookahead<z7){if(aX(W),W.lookahead<z7&&X===Q6)return k9;if(W.lookahead===0)break}if(G=0,W.lookahead>=f1)W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(G!==0&&W.strstart-G<=W.w_size-z7)W.match_length=TC(W,G);if(W.match_length>=f1)if(Y=U6(W,W.strstart-W.match_start,W.match_length-f1),W.lookahead-=W.match_length,W.match_length<=W.max_lazy_match&&W.lookahead>=f1){W.match_length--;do W.strstart++,W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.match_length!==0);W.strstart++}else W.strstart+=W.match_length,W.match_length=0,W.ins_h=W.window[W.strstart],W.ins_h=N6(W,W.ins_h,W.window[W.strstart+1]);else Y=U6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(Y){if(G5(W,!1),W.strm.avail_out===0)return k9}}if(W.insert=W.strstart<f1-1?W.strstart:f1-1,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX},oX=(W,X)=>{let G,Y,J;for(;;){if(W.lookahead<z7){if(aX(W),W.lookahead<z7&&X===Q6)return k9;if(W.lookahead===0)break}if(G=0,W.lookahead>=f1)W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(W.prev_length=W.match_length,W.prev_match=W.match_start,W.match_length=f1-1,G!==0&&W.prev_length<W.max_lazy_match&&W.strstart-G<=W.w_size-z7){if(W.match_length=TC(W,G),W.match_length<=5&&(W.strategy===ay||W.match_length===f1&&W.strstart-W.match_start>4096))W.match_length=f1-1}if(W.prev_length>=f1&&W.match_length<=W.prev_length){J=W.strstart+W.lookahead-f1,Y=U6(W,W.strstart-1-W.prev_match,W.prev_length-f1),W.lookahead-=W.prev_length-1,W.prev_length-=2;do if(++W.strstart<=J)W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.prev_length!==0);if(W.match_available=0,W.match_length=f1-1,W.strstart++,Y){if(G5(W,!1),W.strm.avail_out===0)return k9}}else if(W.match_available){if(Y=U6(W,0,W.window[W.strstart-1]),Y)G5(W,!1);if(W.strstart++,W.lookahead--,W.strm.avail_out===0)return k9}else W.match_available=1,W.strstart++,W.lookahead--}if(W.match_available)Y=U6(W,0,W.window[W.strstart-1]),W.match_available=0;if(W.insert=W.strstart<f1-1?W.strstart:f1-1,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX},Iv=(W,X)=>{let G,Y,J,Z,V=W.window;for(;;){if(W.lookahead<=V6){if(aX(W),W.lookahead<=V6&&X===Q6)return k9;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=f1&&W.strstart>0){if(J=W.strstart-1,Y=V[J],Y===V[++J]&&Y===V[++J]&&Y===V[++J]){Z=W.strstart+V6;do;while(Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&J<Z);if(W.match_length=V6-(Z-J),W.match_length>W.lookahead)W.match_length=W.lookahead}}if(W.match_length>=f1)G=U6(W,1,W.match_length-f1),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0;else G=U6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(G){if(G5(W,!1),W.strm.avail_out===0)return k9}}if(W.insert=0,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX},wv=(W,X)=>{let G;for(;;){if(W.lookahead===0){if(aX(W),W.lookahead===0){if(X===Q6)return k9;break}}if(W.match_length=0,G=U6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,G){if(G5(W,!1),W.strm.avail_out===0)return k9}}if(W.insert=0,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX};function q7(W,X,G,Y,J){this.good_length=W,this.max_lazy=X,this.nice_length=G,this.max_chain=Y,this.func=J}var zJ=[new q7(0,0,0,0,MC),new q7(4,4,8,4,PA),new q7(4,5,16,8,PA),new q7(4,6,32,32,PA),new q7(4,4,16,16,oX),new q7(8,16,32,32,oX),new q7(8,16,128,128,oX),new q7(8,32,128,256,oX),new q7(32,128,258,1024,oX),new q7(32,258,258,4096,oX)],jv=(W)=>{W.window_size=2*W.w_size,Z6(W.head),W.max_lazy_match=zJ[W.level].max_lazy,W.good_match=zJ[W.level].good_length,W.nice_match=zJ[W.level].nice_length,W.max_chain_length=zJ[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=f1-1,W.match_available=0,W.ins_h=0};function Kv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=aU,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Qv*2),this.dyn_dtree=new Uint16Array((2*Vv+1)*2),this.bl_tree=new Uint16Array((2*Uv+1)*2),Z6(this.dyn_ltree),Z6(this.dyn_dtree),Z6(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Nv+1),this.heap=new Uint16Array(2*vA+1),Z6(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*vA+1),Z6(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var BJ=(W)=>{if(!W)return 1;let X=W.state;if(!X||X.strm!==W||X.status!==rX&&X.status!==dA&&X.status!==gA&&X.status!==uA&&X.status!==hA&&X.status!==bA&&X.status!==IW&&X.status!==AJ)return 1;return 0},PC=(W)=>{if(BJ(W))return wW(W,A7);W.total_in=W.total_out=0,W.data_type=Wv;let X=W.state;if(X.pending=0,X.pending_out=0,X.wrap<0)X.wrap=-X.wrap;return X.status=X.wrap===2?dA:X.wrap?rX:IW,W.adler=X.wrap===2?0:1,X.last_flush=-2,cy(X),W9},RC=(W)=>{let X=PC(W);if(X===W9)jv(W.state);return X},Dv=(W,X)=>{if(BJ(W)||W.state.wrap!==2)return A7;return W.state.gzhead=X,W9},LC=(W,X,G,Y,J,Z)=>{if(!W)return A7;let V=1;if(X===ry)X=6;if(Y<0)V=0,Y=-Y;else if(Y>15)V=2,Y-=16;if(J<1||J>Xv||G!==aU||Y<8||Y>15||X<0||X>9||Z<0||Z>ty||Y===8&&V!==1)return wW(W,A7);if(Y===8)Y=9;let U=new Kv;return W.state=U,U.strm=W,U.status=rX,U.wrap=V,U.gzhead=null,U.w_bits=Y,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=J+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+f1-1)/f1),U.window=new Uint8Array(U.w_size*2),U.head=new Uint16Array(U.hash_size),U.prev=new Uint16Array(U.w_size),U.lit_bufsize=1<<J+6,U.pending_buf_size=U.lit_bufsize*4,U.pending_buf=new Uint8Array(U.pending_buf_size),U.sym_buf=U.lit_bufsize,U.sym_end=(U.lit_bufsize-1)*3,U.level=X,U.strategy=Z,U.method=G,RC(W)},Ov=(W,X)=>{return LC(W,X,aU,Gv,Yv,ey)},Cv=(W,X)=>{if(BJ(W)||X>EO||X<0)return W?wW(W,A7):A7;let G=W.state;if(!W.output||W.avail_in!==0&&!W.input||G.status===AJ&&X!==j5)return wW(W,W.avail_out===0?MA:A7);let Y=G.last_flush;if(G.last_flush=X,G.pending!==0){if(X5(W),W.avail_out===0)return G.last_flush=-1,W9}else if(W.avail_in===0&&FO(X)<=FO(Y)&&X!==j5)return wW(W,MA);if(G.status===AJ&&W.avail_in!==0)return wW(W,MA);if(G.status===rX&&G.wrap===0)G.status=IW;if(G.status===rX){let J=aU+(G.w_bits-8<<4)<<8,Z=-1;if(G.strategy>=fU||G.level<2)Z=0;else if(G.level<6)Z=1;else if(G.level===6)Z=2;else Z=3;if(J|=Z<<6,G.strstart!==0)J|=qv;if(J+=31-J%31,HJ(G,J),G.strstart!==0)HJ(G,W.adler>>>16),HJ(G,W.adler&65535);if(W.adler=1,G.status=IW,X5(W),G.pending!==0)return G.last_flush=-1,W9}if(G.status===dA)if(W.adler=0,t1(G,31),t1(G,139),t1(G,8),!G.gzhead){if(t1(G,0),t1(G,0),t1(G,0),t1(G,0),t1(G,0),t1(G,G.level===9?2:G.strategy>=fU||G.level<2?4:0),t1(G,Hv),G.status=IW,X5(W),G.pending!==0)return G.last_flush=-1,W9}else{if(t1(G,(G.gzhead.text?1:0)+(G.gzhead.hcrc?2:0)+(!G.gzhead.extra?0:4)+(!G.gzhead.name?0:8)+(!G.gzhead.comment?0:16)),t1(G,G.gzhead.time&255),t1(G,G.gzhead.time>>8&255),t1(G,G.gzhead.time>>16&255),t1(G,G.gzhead.time>>24&255),t1(G,G.level===9?2:G.strategy>=fU||G.level<2?4:0),t1(G,G.gzhead.os&255),G.gzhead.extra&&G.gzhead.extra.length)t1(G,G.gzhead.extra.length&255),t1(G,G.gzhead.extra.length>>8&255);if(G.gzhead.hcrc)W.adler=r8(W.adler,G.pending_buf,G.pending,0);G.gzindex=0,G.status=gA}if(G.status===gA){if(G.gzhead.extra){let J=G.pending,Z=(G.gzhead.extra.length&65535)-G.gzindex;while(G.pending+Z>G.pending_buf_size){let U=G.pending_buf_size-G.pending;if(G.pending_buf.set(G.gzhead.extra.subarray(G.gzindex,G.gzindex+U),G.pending),G.pending=G.pending_buf_size,G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);if(G.gzindex+=U,X5(W),G.pending!==0)return G.last_flush=-1,W9;J=0,Z-=U}let V=new Uint8Array(G.gzhead.extra);if(G.pending_buf.set(V.subarray(G.gzindex,G.gzindex+Z),G.pending),G.pending+=Z,G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);G.gzindex=0}G.status=uA}if(G.status===uA){if(G.gzhead.name){let J=G.pending,Z;do{if(G.pending===G.pending_buf_size){if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);if(X5(W),G.pending!==0)return G.last_flush=-1,W9;J=0}if(G.gzindex<G.gzhead.name.length)Z=G.gzhead.name.charCodeAt(G.gzindex++)&255;else Z=0;t1(G,Z)}while(Z!==0);if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);G.gzindex=0}G.status=hA}if(G.status===hA){if(G.gzhead.comment){let J=G.pending,Z;do{if(G.pending===G.pending_buf_size){if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);if(X5(W),G.pending!==0)return G.last_flush=-1,W9;J=0}if(G.gzindex<G.gzhead.comment.length)Z=G.gzhead.comment.charCodeAt(G.gzindex++)&255;else Z=0;t1(G,Z)}while(Z!==0);if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J)}G.status=bA}if(G.status===bA){if(G.gzhead.hcrc){if(G.pending+2>G.pending_buf_size){if(X5(W),G.pending!==0)return G.last_flush=-1,W9}t1(G,W.adler&255),t1(G,W.adler>>8&255),W.adler=0}if(G.status=IW,X5(W),G.pending!==0)return G.last_flush=-1,W9}if(W.avail_in!==0||G.lookahead!==0||X!==Q6&&G.status!==AJ){let J=G.level===0?MC(G,X):G.strategy===fU?wv(G,X):G.strategy===sy?Iv(G,X):zJ[G.level].func(G,X);if(J===KW||J===eX)G.status=AJ;if(J===k9||J===KW){if(W.avail_out===0)G.last_flush=-1;return W9}if(J===tX){if(X===oy)dy(G);else if(X!==EO){if(yA(G,0,0,!1),X===ny){if(Z6(G.head),G.lookahead===0)G.strstart=0,G.block_start=0,G.insert=0}}if(X5(W),W.avail_out===0)return G.last_flush=-1,W9}}if(X!==j5)return W9;if(G.wrap<=0)return $O;if(G.wrap===2)t1(G,W.adler&255),t1(G,W.adler>>8&255),t1(G,W.adler>>16&255),t1(G,W.adler>>24&255),t1(G,W.total_in&255),t1(G,W.total_in>>8&255),t1(G,W.total_in>>16&255),t1(G,W.total_in>>24&255);else HJ(G,W.adler>>>16),HJ(G,W.adler&65535);if(X5(W),G.wrap>0)G.wrap=-G.wrap;return G.pending!==0?W9:$O},Tv=(W)=>{if(BJ(W))return A7;let X=W.state.status;return W.state=null,X===IW?wW(W,iy):W9},Mv=(W,X)=>{let G=X.length;if(BJ(W))return A7;let Y=W.state,J=Y.wrap;if(J===2||J===1&&Y.status!==rX||Y.lookahead)return A7;if(J===1)W.adler=TJ(W.adler,X,G,0);if(Y.wrap=0,G>=Y.w_size){if(J===0)Z6(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0;let Q=new Uint8Array(Y.w_size);Q.set(X.subarray(G-Y.w_size,G),0),X=Q,G=Y.w_size}let{avail_in:Z,next_in:V,input:U}=W;W.avail_in=G,W.next_in=0,W.input=X,aX(Y);while(Y.lookahead>=f1){let Q=Y.strstart,N=Y.lookahead-(f1-1);do Y.ins_h=N6(Y,Y.ins_h,Y.window[Q+f1-1]),Y.prev[Q&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=Q,Q++;while(--N);Y.strstart=Q,Y.lookahead=f1-1,aX(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=f1-1,Y.match_available=0,W.next_in=V,W.input=U,W.avail_in=Z,Y.wrap=J,W9},Pv=Ov,Rv=LC,Lv=RC,Bv=PC,Ev=Dv,$v=Cv,Fv=Tv,Sv=Mv,xv="pako deflate (from Nodeca project)",wJ={deflateInit:Pv,deflateInit2:Rv,deflateReset:Lv,deflateResetKeep:Bv,deflateSetHeader:Ev,deflate:$v,deflateEnd:Fv,deflateSetDictionary:Sv,deflateInfo:xv},kv=(W,X)=>{return Object.prototype.hasOwnProperty.call(W,X)},_v=function(W){let X=Array.prototype.slice.call(arguments,1);while(X.length){let G=X.shift();if(!G)continue;if(typeof G!=="object")throw TypeError(G+"must be non-object");for(let Y in G)if(kv(G,Y))W[Y]=G[Y]}return W},yv=(W)=>{let X=0;for(let Y=0,J=W.length;Y<J;Y++)X+=W[Y].length;let G=new Uint8Array(X);for(let Y=0,J=0,Z=W.length;Y<Z;Y++){let V=W[Y];G.set(V,J),J+=V.length}return G},sU={assign:_v,flattenChunks:yv},BC=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(W){BC=!1}var MJ=new Uint8Array(256);for(let W=0;W<256;W++)MJ[W]=W>=252?6:W>=248?5:W>=240?4:W>=224?3:W>=192?2:1;MJ[254]=MJ[254]=1;var vv=(W)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(W);let X,G,Y,J,Z,V=W.length,U=0;for(J=0;J<V;J++){if(G=W.charCodeAt(J),(G&64512)===55296&&J+1<V){if(Y=W.charCodeAt(J+1),(Y&64512)===56320)G=65536+(G-55296<<10)+(Y-56320),J++}U+=G<128?1:G<2048?2:G<65536?3:4}X=new Uint8Array(U);for(Z=0,J=0;Z<U;J++){if(G=W.charCodeAt(J),(G&64512)===55296&&J+1<V){if(Y=W.charCodeAt(J+1),(Y&64512)===56320)G=65536+(G-55296<<10)+(Y-56320),J++}if(G<128)X[Z++]=G;else if(G<2048)X[Z++]=192|G>>>6,X[Z++]=128|G&63;else if(G<65536)X[Z++]=224|G>>>12,X[Z++]=128|G>>>6&63,X[Z++]=128|G&63;else X[Z++]=240|G>>>18,X[Z++]=128|G>>>12&63,X[Z++]=128|G>>>6&63,X[Z++]=128|G&63}return X},gv=(W,X)=>{if(X<65534){if(W.subarray&&BC)return String.fromCharCode.apply(null,W.length===X?W:W.subarray(0,X))}let G="";for(let Y=0;Y<X;Y++)G+=String.fromCharCode(W[Y]);return G},uv=(W,X)=>{let G=X||W.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(W.subarray(0,X));let Y,J,Z=Array(G*2);for(J=0,Y=0;Y<G;){let V=W[Y++];if(V<128){Z[J++]=V;continue}let U=MJ[V];if(U>4){Z[J++]=65533,Y+=U-1;continue}V&=U===2?31:U===3?15:7;while(U>1&&Y<G)V=V<<6|W[Y++]&63,U--;if(U>1){Z[J++]=65533;continue}if(V<65536)Z[J++]=V;else V-=65536,Z[J++]=55296|V>>10&1023,Z[J++]=56320|V&1023}return gv(Z,J)},hv=(W,X)=>{if(X=X||W.length,X>W.length)X=W.length;let G=X-1;while(G>=0&&(W[G]&192)===128)G--;if(G<0)return X;if(G===0)return X;return G+MJ[W[G]]>X?G:X},PJ={string2buf:vv,buf2string:uv,utf8border:hv};function bv(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var EC=bv,$C=Object.prototype.toString,{Z_NO_FLUSH:mv,Z_SYNC_FLUSH:fv,Z_FULL_FLUSH:pv,Z_FINISH:cv,Z_OK:iU,Z_STREAM_END:lv,Z_DEFAULT_COMPRESSION:dv,Z_DEFAULT_STRATEGY:ov,Z_DEFLATED:nv}=OW;function EJ(W){this.options=sU.assign({level:dv,method:nv,chunkSize:16384,windowBits:15,memLevel:8,strategy:ov},W||{});let X=this.options;if(X.raw&&X.windowBits>0)X.windowBits=-X.windowBits;else if(X.gzip&&X.windowBits>0&&X.windowBits<16)X.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new EC,this.strm.avail_out=0;let G=wJ.deflateInit2(this.strm,X.level,X.method,X.windowBits,X.memLevel,X.strategy);if(G!==iU)throw Error(jW[G]);if(X.header)wJ.deflateSetHeader(this.strm,X.header);if(X.dictionary){let Y;if(typeof X.dictionary==="string")Y=PJ.string2buf(X.dictionary);else if($C.call(X.dictionary)==="[object ArrayBuffer]")Y=new Uint8Array(X.dictionary);else Y=X.dictionary;if(G=wJ.deflateSetDictionary(this.strm,Y),G!==iU)throw Error(jW[G]);this._dict_set=!0}}EJ.prototype.push=function(W,X){let G=this.strm,Y=this.options.chunkSize,J,Z;if(this.ended)return!1;if(X===~~X)Z=X;else Z=X===!0?cv:mv;if(typeof W==="string")G.input=PJ.string2buf(W);else if($C.call(W)==="[object ArrayBuffer]")G.input=new Uint8Array(W);else G.input=W;G.next_in=0,G.avail_in=G.input.length;for(;;){if(G.avail_out===0)G.output=new Uint8Array(Y),G.next_out=0,G.avail_out=Y;if((Z===fv||Z===pv)&&G.avail_out<=6){this.onData(G.output.subarray(0,G.next_out)),G.avail_out=0;continue}if(J=wJ.deflate(G,Z),J===lv){if(G.next_out>0)this.onData(G.output.subarray(0,G.next_out));return J=wJ.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===iU}if(G.avail_out===0){this.onData(G.output);continue}if(Z>0&&G.next_out>0){this.onData(G.output.subarray(0,G.next_out)),G.avail_out=0;continue}if(G.avail_in===0)break}return!0};EJ.prototype.onData=function(W){this.chunks.push(W)};EJ.prototype.onEnd=function(W){if(W===iU)this.result=sU.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function oA(W,X){let G=new EJ(X);if(G.push(W,!0),G.err)throw G.msg||jW[G.err];return G.result}function iv(W,X){return X=X||{},X.raw=!0,oA(W,X)}function rv(W,X){return X=X||{},X.gzip=!0,oA(W,X)}var av=EJ,sv=oA,tv=iv,ev=rv,Wg=OW,Xg={Deflate:av,deflate:sv,deflateRaw:tv,gzip:ev,constants:Wg},pU=16209,Gg=16191,Yg=function(X,G){let Y,J,Z,V,U,Q,N,q,A,H,I,w,D,T,x,h,$,F,u,c,p,s,y,t,H0=X.state;Y=X.next_in,y=X.input,J=Y+(X.avail_in-5),Z=X.next_out,t=X.output,V=Z-(G-X.avail_out),U=Z+(X.avail_out-257),Q=H0.dmax,N=H0.wsize,q=H0.whave,A=H0.wnext,H=H0.window,I=H0.hold,w=H0.bits,D=H0.lencode,T=H0.distcode,x=(1<<H0.lenbits)-1,h=(1<<H0.distbits)-1;W:do{if(w<15)I+=y[Y++]<<w,w+=8,I+=y[Y++]<<w,w+=8;$=D[I&x];X:for(;;){if(F=$>>>24,I>>>=F,w-=F,F=$>>>16&255,F===0)t[Z++]=$&65535;else if(F&16){if(u=$&65535,F&=15,F){if(w<F)I+=y[Y++]<<w,w+=8;u+=I&(1<<F)-1,I>>>=F,w-=F}if(w<15)I+=y[Y++]<<w,w+=8,I+=y[Y++]<<w,w+=8;$=T[I&h];G:for(;;){if(F=$>>>24,I>>>=F,w-=F,F=$>>>16&255,F&16){if(c=$&65535,F&=15,w<F){if(I+=y[Y++]<<w,w+=8,w<F)I+=y[Y++]<<w,w+=8}if(c+=I&(1<<F)-1,c>Q){X.msg="invalid distance too far back",H0.mode=pU;break W}if(I>>>=F,w-=F,F=Z-V,c>F){if(F=c-F,F>q){if(H0.sane){X.msg="invalid distance too far back",H0.mode=pU;break W}}if(p=0,s=H,A===0){if(p+=N-F,F<u){u-=F;do t[Z++]=H[p++];while(--F);p=Z-c,s=t}}else if(A<F){if(p+=N+A-F,F-=A,F<u){u-=F;do t[Z++]=H[p++];while(--F);if(p=0,A<u){F=A,u-=F;do t[Z++]=H[p++];while(--F);p=Z-c,s=t}}}else if(p+=A-F,F<u){u-=F;do t[Z++]=H[p++];while(--F);p=Z-c,s=t}while(u>2)t[Z++]=s[p++],t[Z++]=s[p++],t[Z++]=s[p++],u-=3;if(u){if(t[Z++]=s[p++],u>1)t[Z++]=s[p++]}}else{p=Z-c;do t[Z++]=t[p++],t[Z++]=t[p++],t[Z++]=t[p++],u-=3;while(u>2);if(u){if(t[Z++]=t[p++],u>1)t[Z++]=t[p++]}}}else if((F&64)===0){$=T[($&65535)+(I&(1<<F)-1)];continue G}else{X.msg="invalid distance code",H0.mode=pU;break W}break}}else if((F&64)===0){$=D[($&65535)+(I&(1<<F)-1)];continue X}else if(F&32){H0.mode=Gg;break W}else{X.msg="invalid literal/length code",H0.mode=pU;break W}break}}while(Y<J&&Z<U);u=w>>3,Y-=u,w-=u<<3,I&=(1<<w)-1,X.next_in=Y,X.next_out=Z,X.avail_in=Y<J?5+(J-Y):5-(Y-J),X.avail_out=Z<U?257+(U-Z):257-(Z-U),H0.hold=I,H0.bits=w;return},nX=15,SO=852,xO=592,kO=0,RA=1,_O=2,Jg=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Zg=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Vg=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ug=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Qg=(W,X,G,Y,J,Z,V,U)=>{let Q=U.bits,N=0,q=0,A=0,H=0,I=0,w=0,D=0,T=0,x=0,h=0,$,F,u,c,p,s=null,y,t=new Uint16Array(nX+1),H0=new Uint16Array(nX+1),g=null,d,P,E;for(N=0;N<=nX;N++)t[N]=0;for(q=0;q<Y;q++)t[X[G+q]]++;I=Q;for(H=nX;H>=1;H--)if(t[H]!==0)break;if(I>H)I=H;if(H===0)return J[Z++]=20971520,J[Z++]=20971520,U.bits=1,0;for(A=1;A<H;A++)if(t[A]!==0)break;if(I<A)I=A;T=1;for(N=1;N<=nX;N++)if(T<<=1,T-=t[N],T<0)return-1;if(T>0&&(W===kO||H!==1))return-1;H0[1]=0;for(N=1;N<nX;N++)H0[N+1]=H0[N]+t[N];for(q=0;q<Y;q++)if(X[G+q]!==0)V[H0[X[G+q]]++]=q;if(W===kO)s=g=V,y=20;else if(W===RA)s=Jg,g=Zg,y=257;else s=Vg,g=Ug,y=0;if(h=0,q=0,N=A,p=Z,w=I,D=0,u=-1,x=1<<I,c=x-1,W===RA&&x>SO||W===_O&&x>xO)return 1;for(;;){if(d=N-D,V[q]+1<y)P=0,E=V[q];else if(V[q]>=y)P=g[V[q]-y],E=s[V[q]-y];else P=96,E=0;$=1<<N-D,F=1<<w,A=F;do F-=$,J[p+(h>>D)+F]=d<<24|P<<16|E|0;while(F!==0);$=1<<N-1;while(h&$)$>>=1;if($!==0)h&=$-1,h+=$;else h=0;if(q++,--t[N]===0){if(N===H)break;N=X[G+V[q]]}if(N>I&&(h&c)!==u){if(D===0)D=I;p+=A,w=N-D,T=1<<w;while(w+D<H){if(T-=t[w+D],T<=0)break;w++,T<<=1}if(x+=1<<w,W===RA&&x>SO||W===_O&&x>xO)return 1;u=h&c,J[u]=I<<24|w<<16|p-Z|0}}if(h!==0)J[p+h]=N-D<<24|4194304|0;return U.bits=I,0},jJ=Qg,Ng=0,FC=1,SC=2,{Z_FINISH:yO,Z_BLOCK:qg,Z_TREES:cU,Z_OK:DW,Z_STREAM_END:Hg,Z_NEED_DICT:Ag,Z_STREAM_ERROR:K5,Z_DATA_ERROR:xC,Z_MEM_ERROR:kC,Z_BUF_ERROR:zg,Z_DEFLATED:vO}=OW,tU=16180,gO=16181,uO=16182,hO=16183,bO=16184,mO=16185,fO=16186,pO=16187,cO=16188,lO=16189,rU=16190,t7=16191,LA=16192,dO=16193,BA=16194,oO=16195,nO=16196,iO=16197,rO=16198,lU=16199,dU=16200,aO=16201,sO=16202,tO=16203,eO=16204,WC=16205,EA=16206,XC=16207,GC=16208,D8=16209,_C=16210,yC=16211,Ig=852,wg=592,jg=15,Kg=jg,YC=(W)=>{return(W>>>24&255)+(W>>>8&65280)+((W&65280)<<8)+((W&255)<<24)};function Dg(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var CW=(W)=>{if(!W)return 1;let X=W.state;if(!X||X.strm!==W||X.mode<tU||X.mode>yC)return 1;return 0},vC=(W)=>{if(CW(W))return K5;let X=W.state;if(W.total_in=W.total_out=X.total=0,W.msg="",X.wrap)W.adler=X.wrap&1;return X.mode=tU,X.last=0,X.havedict=0,X.flags=-1,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new Int32Array(Ig),X.distcode=X.distdyn=new Int32Array(wg),X.sane=1,X.back=-1,DW},gC=(W)=>{if(CW(W))return K5;let X=W.state;return X.wsize=0,X.whave=0,X.wnext=0,vC(W)},uC=(W,X)=>{let G;if(CW(W))return K5;let Y=W.state;if(X<0)G=0,X=-X;else if(G=(X>>4)+5,X<48)X&=15;if(X&&(X<8||X>15))return K5;if(Y.window!==null&&Y.wbits!==X)Y.window=null;return Y.wrap=G,Y.wbits=X,gC(W)},hC=(W,X)=>{if(!W)return K5;let G=new Dg;W.state=G,G.strm=W,G.window=null,G.mode=tU;let Y=uC(W,X);if(Y!==DW)W.state=null;return Y},Og=(W)=>{return hC(W,Kg)},JC=!0,$A,FA,Cg=(W)=>{if(JC){$A=new Int32Array(512),FA=new Int32Array(32);let X=0;while(X<144)W.lens[X++]=8;while(X<256)W.lens[X++]=9;while(X<280)W.lens[X++]=7;while(X<288)W.lens[X++]=8;jJ(FC,W.lens,0,288,$A,0,W.work,{bits:9}),X=0;while(X<32)W.lens[X++]=5;jJ(SC,W.lens,0,32,FA,0,W.work,{bits:5}),JC=!1}W.lencode=$A,W.lenbits=9,W.distcode=FA,W.distbits=5},bC=(W,X,G,Y)=>{let J,Z=W.state;if(Z.window===null)Z.wsize=1<<Z.wbits,Z.wnext=0,Z.whave=0,Z.window=new Uint8Array(Z.wsize);if(Y>=Z.wsize)Z.window.set(X.subarray(G-Z.wsize,G),0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>Y)J=Y;if(Z.window.set(X.subarray(G-Y,G-Y+J),Z.wnext),Y-=J,Y)Z.window.set(X.subarray(G-Y,G),0),Z.wnext=Y,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave<Z.wsize)Z.whave+=J}}return 0},Tg=(W,X)=>{let G,Y,J,Z,V,U,Q,N,q,A,H,I,w,D,T=0,x,h,$,F,u,c,p,s,y=new Uint8Array(4),t,H0,g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(CW(W)||!W.output||!W.input&&W.avail_in!==0)return K5;if(G=W.state,G.mode===t7)G.mode=LA;V=W.next_out,J=W.output,Q=W.avail_out,Z=W.next_in,Y=W.input,U=W.avail_in,N=G.hold,q=G.bits,A=U,H=Q,s=DW;W:for(;;)switch(G.mode){case tU:if(G.wrap===0){G.mode=LA;break}while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.wrap&2&&N===35615){if(G.wbits===0)G.wbits=15;G.check=0,y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0),N=0,q=0,G.mode=gO;break}if(G.head)G.head.done=!1;if(!(G.wrap&1)||(((N&255)<<8)+(N>>8))%31){W.msg="incorrect header check",G.mode=D8;break}if((N&15)!==vO){W.msg="unknown compression method",G.mode=D8;break}if(N>>>=4,q-=4,p=(N&15)+8,G.wbits===0)G.wbits=p;if(p>15||p>G.wbits){W.msg="invalid window size",G.mode=D8;break}G.dmax=1<<G.wbits,G.flags=0,W.adler=G.check=1,G.mode=N&512?lO:t7,N=0,q=0;break;case gO:while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.flags=N,(G.flags&255)!==vO){W.msg="unknown compression method",G.mode=D8;break}if(G.flags&57344){W.msg="unknown header flags set",G.mode=D8;break}if(G.head)G.head.text=N>>8&1;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0);N=0,q=0,G.mode=uO;case uO:while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.head)G.head.time=N;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,y[2]=N>>>16&255,y[3]=N>>>24&255,G.check=r8(G.check,y,4,0);N=0,q=0,G.mode=hO;case hO:while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.head)G.head.xflags=N&255,G.head.os=N>>8;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0);N=0,q=0,G.mode=bO;case bO:if(G.flags&1024){while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.length=N,G.head)G.head.extra_len=N;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0);N=0,q=0}else if(G.head)G.head.extra=null;G.mode=mO;case mO:if(G.flags&1024){if(I=G.length,I>U)I=U;if(I){if(G.head){if(p=G.head.extra_len-G.length,!G.head.extra)G.head.extra=new Uint8Array(G.head.extra_len);G.head.extra.set(Y.subarray(Z,Z+I),p)}if(G.flags&512&&G.wrap&4)G.check=r8(G.check,Y,I,Z);U-=I,Z+=I,G.length-=I}if(G.length)break W}G.length=0,G.mode=fO;case fO:if(G.flags&2048){if(U===0)break W;I=0;do if(p=Y[Z+I++],G.head&&p&&G.length<65536)G.head.name+=String.fromCharCode(p);while(p&&I<U);if(G.flags&512&&G.wrap&4)G.check=r8(G.check,Y,I,Z);if(U-=I,Z+=I,p)break W}else if(G.head)G.head.name=null;G.length=0,G.mode=pO;case pO:if(G.flags&4096){if(U===0)break W;I=0;do if(p=Y[Z+I++],G.head&&p&&G.length<65536)G.head.comment+=String.fromCharCode(p);while(p&&I<U);if(G.flags&512&&G.wrap&4)G.check=r8(G.check,Y,I,Z);if(U-=I,Z+=I,p)break W}else if(G.head)G.head.comment=null;G.mode=cO;case cO:if(G.flags&512){while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.wrap&4&&N!==(G.check&65535)){W.msg="header crc mismatch",G.mode=D8;break}N=0,q=0}if(G.head)G.head.hcrc=G.flags>>9&1,G.head.done=!0;W.adler=G.check=0,G.mode=t7;break;case lO:while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}W.adler=G.check=YC(N),N=0,q=0,G.mode=rU;case rU:if(G.havedict===0)return W.next_out=V,W.avail_out=Q,W.next_in=Z,W.avail_in=U,G.hold=N,G.bits=q,Ag;W.adler=G.check=1,G.mode=t7;case t7:if(X===qg||X===cU)break W;case LA:if(G.last){N>>>=q&7,q-=q&7,G.mode=EA;break}while(q<3){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}switch(G.last=N&1,N>>>=1,q-=1,N&3){case 0:G.mode=dO;break;case 1:if(Cg(G),G.mode=lU,X===cU){N>>>=2,q-=2;break W}break;case 2:G.mode=nO;break;case 3:W.msg="invalid block type",G.mode=D8}N>>>=2,q-=2;break;case dO:N>>>=q&7,q-=q&7;while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if((N&65535)!==(N>>>16^65535)){W.msg="invalid stored block lengths",G.mode=D8;break}if(G.length=N&65535,N=0,q=0,G.mode=BA,X===cU)break W;case BA:G.mode=oO;case oO:if(I=G.length,I){if(I>U)I=U;if(I>Q)I=Q;if(I===0)break W;J.set(Y.subarray(Z,Z+I),V),U-=I,Z+=I,Q-=I,V+=I,G.length-=I;break}G.mode=t7;break;case nO:while(q<14){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.nlen=(N&31)+257,N>>>=5,q-=5,G.ndist=(N&31)+1,N>>>=5,q-=5,G.ncode=(N&15)+4,N>>>=4,q-=4,G.nlen>286||G.ndist>30){W.msg="too many length or distance symbols",G.mode=D8;break}G.have=0,G.mode=iO;case iO:while(G.have<G.ncode){while(q<3){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}G.lens[g[G.have++]]=N&7,N>>>=3,q-=3}while(G.have<19)G.lens[g[G.have++]]=0;if(G.lencode=G.lendyn,G.lenbits=7,t={bits:G.lenbits},s=jJ(Ng,G.lens,0,19,G.lencode,0,G.work,t),G.lenbits=t.bits,s){W.msg="invalid code lengths set",G.mode=D8;break}G.have=0,G.mode=rO;case rO:while(G.have<G.nlen+G.ndist){for(;;){if(T=G.lencode[N&(1<<G.lenbits)-1],x=T>>>24,h=T>>>16&255,$=T&65535,x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if($<16)N>>>=x,q-=x,G.lens[G.have++]=$;else{if($===16){H0=x+2;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(N>>>=x,q-=x,G.have===0){W.msg="invalid bit length repeat",G.mode=D8;break}p=G.lens[G.have-1],I=3+(N&3),N>>>=2,q-=2}else if($===17){H0=x+3;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=x,q-=x,p=0,I=3+(N&7),N>>>=3,q-=3}else{H0=x+7;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=x,q-=x,p=0,I=11+(N&127),N>>>=7,q-=7}if(G.have+I>G.nlen+G.ndist){W.msg="invalid bit length repeat",G.mode=D8;break}while(I--)G.lens[G.have++]=p}}if(G.mode===D8)break;if(G.lens[256]===0){W.msg="invalid code -- missing end-of-block",G.mode=D8;break}if(G.lenbits=9,t={bits:G.lenbits},s=jJ(FC,G.lens,0,G.nlen,G.lencode,0,G.work,t),G.lenbits=t.bits,s){W.msg="invalid literal/lengths set",G.mode=D8;break}if(G.distbits=6,G.distcode=G.distdyn,t={bits:G.distbits},s=jJ(SC,G.lens,G.nlen,G.ndist,G.distcode,0,G.work,t),G.distbits=t.bits,s){W.msg="invalid distances set",G.mode=D8;break}if(G.mode=lU,X===cU)break W;case lU:G.mode=dU;case dU:if(U>=6&&Q>=258){if(W.next_out=V,W.avail_out=Q,W.next_in=Z,W.avail_in=U,G.hold=N,G.bits=q,Yg(W,H),V=W.next_out,J=W.output,Q=W.avail_out,Z=W.next_in,Y=W.input,U=W.avail_in,N=G.hold,q=G.bits,G.mode===t7)G.back=-1;break}G.back=0;for(;;){if(T=G.lencode[N&(1<<G.lenbits)-1],x=T>>>24,h=T>>>16&255,$=T&65535,x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(h&&(h&240)===0){F=x,u=h,c=$;for(;;){if(T=G.lencode[c+((N&(1<<F+u)-1)>>F)],x=T>>>24,h=T>>>16&255,$=T&65535,F+x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=F,q-=F,G.back+=F}if(N>>>=x,q-=x,G.back+=x,G.length=$,h===0){G.mode=WC;break}if(h&32){G.back=-1,G.mode=t7;break}if(h&64){W.msg="invalid literal/length code",G.mode=D8;break}G.extra=h&15,G.mode=aO;case aO:if(G.extra){H0=G.extra;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}G.length+=N&(1<<G.extra)-1,N>>>=G.extra,q-=G.extra,G.back+=G.extra}G.was=G.length,G.mode=sO;case sO:for(;;){if(T=G.distcode[N&(1<<G.distbits)-1],x=T>>>24,h=T>>>16&255,$=T&65535,x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if((h&240)===0){F=x,u=h,c=$;for(;;){if(T=G.distcode[c+((N&(1<<F+u)-1)>>F)],x=T>>>24,h=T>>>16&255,$=T&65535,F+x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=F,q-=F,G.back+=F}if(N>>>=x,q-=x,G.back+=x,h&64){W.msg="invalid distance code",G.mode=D8;break}G.offset=$,G.extra=h&15,G.mode=tO;case tO:if(G.extra){H0=G.extra;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}G.offset+=N&(1<<G.extra)-1,N>>>=G.extra,q-=G.extra,G.back+=G.extra}if(G.offset>G.dmax){W.msg="invalid distance too far back",G.mode=D8;break}G.mode=eO;case eO:if(Q===0)break W;if(I=H-Q,G.offset>I){if(I=G.offset-I,I>G.whave){if(G.sane){W.msg="invalid distance too far back",G.mode=D8;break}}if(I>G.wnext)I-=G.wnext,w=G.wsize-I;else w=G.wnext-I;if(I>G.length)I=G.length;D=G.window}else D=J,w=V-G.offset,I=G.length;if(I>Q)I=Q;Q-=I,G.length-=I;do J[V++]=D[w++];while(--I);if(G.length===0)G.mode=dU;break;case WC:if(Q===0)break W;J[V++]=G.length,Q--,G.mode=dU;break;case EA:if(G.wrap){while(q<32){if(U===0)break W;U--,N|=Y[Z++]<<q,q+=8}if(H-=Q,W.total_out+=H,G.total+=H,G.wrap&4&&H)W.adler=G.check=G.flags?r8(G.check,J,H,V-H):TJ(G.check,J,H,V-H);if(H=Q,G.wrap&4&&(G.flags?N:YC(N))!==G.check){W.msg="incorrect data check",G.mode=D8;break}N=0,q=0}G.mode=XC;case XC:if(G.wrap&&G.flags){while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.wrap&4&&N!==(G.total&4294967295)){W.msg="incorrect length check",G.mode=D8;break}N=0,q=0}G.mode=GC;case GC:s=Hg;break W;case D8:s=xC;break W;case _C:return kC;case yC:default:return K5}if(W.next_out=V,W.avail_out=Q,W.next_in=Z,W.avail_in=U,G.hold=N,G.bits=q,G.wsize||H!==W.avail_out&&G.mode<D8&&(G.mode<EA||X!==yO)){if(bC(W,W.output,W.next_out,H-W.avail_out));}if(A-=W.avail_in,H-=W.avail_out,W.total_in+=A,W.total_out+=H,G.total+=H,G.wrap&4&&H)W.adler=G.check=G.flags?r8(G.check,J,H,W.next_out-H):TJ(G.check,J,H,W.next_out-H);if(W.data_type=G.bits+(G.last?64:0)+(G.mode===t7?128:0)+(G.mode===lU||G.mode===BA?256:0),(A===0&&H===0||X===yO)&&s===DW)s=zg;return s},Mg=(W)=>{if(CW(W))return K5;let X=W.state;if(X.window)X.window=null;return W.state=null,DW},Pg=(W,X)=>{if(CW(W))return K5;let G=W.state;if((G.wrap&2)===0)return K5;return G.head=X,X.done=!1,DW},Rg=(W,X)=>{let G=X.length,Y,J,Z;if(CW(W))return K5;if(Y=W.state,Y.wrap!==0&&Y.mode!==rU)return K5;if(Y.mode===rU){if(J=1,J=TJ(J,X,G,0),J!==Y.check)return xC}if(Z=bC(W,X,G,G),Z)return Y.mode=_C,kC;return Y.havedict=1,DW},Lg=gC,Bg=uC,Eg=vC,$g=Og,Fg=hC,Sg=Tg,xg=Mg,kg=Pg,_g=Rg,yg="pako inflate (from Nodeca project)",W4={inflateReset:Lg,inflateReset2:Bg,inflateResetKeep:Eg,inflateInit:$g,inflateInit2:Fg,inflate:Sg,inflateEnd:xg,inflateGetHeader:kg,inflateSetDictionary:_g,inflateInfo:yg};function vg(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gg=vg,mC=Object.prototype.toString,{Z_NO_FLUSH:ug,Z_FINISH:hg,Z_OK:RJ,Z_STREAM_END:SA,Z_NEED_DICT:xA,Z_STREAM_ERROR:bg,Z_DATA_ERROR:ZC,Z_MEM_ERROR:mg}=OW;function $J(W){this.options=sU.assign({chunkSize:65536,windowBits:15,to:""},W||{});let X=this.options;if(X.raw&&X.windowBits>=0&&X.windowBits<16){if(X.windowBits=-X.windowBits,X.windowBits===0)X.windowBits=-15}if(X.windowBits>=0&&X.windowBits<16&&!(W&&W.windowBits))X.windowBits+=32;if(X.windowBits>15&&X.windowBits<48){if((X.windowBits&15)===0)X.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new EC,this.strm.avail_out=0;let G=W4.inflateInit2(this.strm,X.windowBits);if(G!==RJ)throw Error(jW[G]);if(this.header=new gg,W4.inflateGetHeader(this.strm,this.header),X.dictionary){if(typeof X.dictionary==="string")X.dictionary=PJ.string2buf(X.dictionary);else if(mC.call(X.dictionary)==="[object ArrayBuffer]")X.dictionary=new Uint8Array(X.dictionary);if(X.raw){if(G=W4.inflateSetDictionary(this.strm,X.dictionary),G!==RJ)throw Error(jW[G])}}}$J.prototype.push=function(W,X){let G=this.strm,Y=this.options.chunkSize,J=this.options.dictionary,Z,V,U;if(this.ended)return!1;if(X===~~X)V=X;else V=X===!0?hg:ug;if(mC.call(W)==="[object ArrayBuffer]")G.input=new Uint8Array(W);else G.input=W;G.next_in=0,G.avail_in=G.input.length;for(;;){if(G.avail_out===0)G.output=new Uint8Array(Y),G.next_out=0,G.avail_out=Y;if(Z=W4.inflate(G,V),Z===xA&&J){if(Z=W4.inflateSetDictionary(G,J),Z===RJ)Z=W4.inflate(G,V);else if(Z===ZC)Z=xA}while(G.avail_in>0&&Z===SA&&G.state.wrap>0&&W[G.next_in]!==0)W4.inflateReset(G),Z=W4.inflate(G,V);switch(Z){case bg:case ZC:case xA:case mg:return this.onEnd(Z),this.ended=!0,!1}if(U=G.avail_out,G.next_out){if(G.avail_out===0||Z===SA)if(this.options.to==="string"){let Q=PJ.utf8border(G.output,G.next_out),N=G.next_out-Q,q=PJ.buf2string(G.output,Q);if(G.next_out=N,G.avail_out=Y-N,N)G.output.set(G.output.subarray(Q,Q+N),0);this.onData(q)}else this.onData(G.output.length===G.next_out?G.output:G.output.subarray(0,G.next_out))}if(Z===RJ&&U===0)continue;if(Z===SA)return Z=W4.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,!0;if(G.avail_in===0)break}return!0};$J.prototype.onData=function(W){this.chunks.push(W)};$J.prototype.onEnd=function(W){if(W===RJ)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=sU.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function nA(W,X){let G=new $J(X);if(G.push(W),G.err)throw G.msg||jW[G.err];return G.result}function fg(W,X){return X=X||{},X.raw=!0,nA(W,X)}var pg=$J,cg=nA,lg=fg,dg=nA,og=OW,ng={Inflate:pg,inflate:cg,inflateRaw:lg,ungzip:dg,constants:og},{Deflate:ig,deflate:rg,deflateRaw:ag,gzip:sg}=Xg,{Inflate:tg,inflate:eg,inflateRaw:Wu,ungzip:Xu}=ng,Gu=ig,Yu=rg,Ju=ag,Zu=sg,Vu=tg,Uu=eg,Qu=Wu,Nu=Xu,qu=OW,WG={Deflate:Gu,deflate:Yu,deflateRaw:Ju,gzip:Zu,Inflate:Vu,inflate:Uu,inflateRaw:Qu,ungzip:Nu,constants:qu};function fC(){let W=Date.now(),X=0;return{now(){return W=Math.max(W,Date.now()),X++,{physical:W,logical:X}},update(G){if(!G||typeof G.physical!=="number"||typeof G.logical!=="number")return;W=Math.max(W,G.physical),X=Math.max(X,G.logical)+1},compare(G,Y){if(!G&&!Y)return 0;if(!G)return-1;if(!Y)return 1;if(G.physical!==Y.physical)return G.physical>Y.physical?1:-1;if(G.logical!==Y.logical)return G.logical>Y.logical?1:-1;return 0}}}function pC(W,X,G){let Y=X.timestamp;if(Y?.physical>Date.now()+7200000)Y={physical:Date.now()+7200000,logical:Y.logical};if(X?.value?.priority===!0&&typeof X.id==="string"&&X.id.startsWith("user:")&&"role"in X.value){let{priority:Z,...V}=X.value;return{resolved:!0,value:V,timestamp:Y}}if(X?.value?.priority!==void 0){let{priority:Z,...V}=X.value;X={...X,value:V}}if(!W?.timestamp)return{resolved:!0,value:X.value,timestamp:Y};let J=G.compare(Y,W.timestamp);if(J<0)return{resolved:!1};if(J===0&&JSON.stringify(X.value)<=JSON.stringify(W.value))return{resolved:!1};return{resolved:!0,value:X.value,timestamp:Y}}var FJ={$eq:(W,X)=>W===X,$ne:(W,X)=>W!==X,$gt:(W,X)=>W>X,$gte:(W,X)=>W>=X,$lt:(W,X)=>W<X,$lte:(W,X)=>W<=X,$in:(W,X)=>Array.isArray(X)&&(Array.isArray(W)?W.some((G)=>X.includes(G)):X.includes(W)),$between:(W,[X,G])=>W>=X&&W<=G,$exists:(W,X)=>X?W!==void 0:W===void 0,$startsWith:(W,X)=>typeof W==="string"&&W.startsWith(X),$endsWith:(W,X)=>typeof W==="string"&&W.endsWith(X),$contains:(W,X)=>typeof W==="string"&&W.includes(X),$text:{global:(W,X)=>{let G=(J)=>String(J).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=G(X);return Object.values(W).some((J)=>typeof J==="object"?null.fieldSearch(J,Y):G(J).includes(Y))},field:(W,X)=>{let G=(J)=>String(J).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=G(X);return Array.isArray(W)?W.some((J)=>G(J).includes(Y)):G(W).includes(Y)}},$like:(W,X)=>typeof W==="string"&&typeof X==="string"&&new RegExp(`^${X.replace(/%/g,".*").replace(/_/g,".")}$`,"i").test(W),$regex:(W,X)=>typeof W==="string"&&new RegExp(X.$regex||X,"i").test(W),$and:(W,X,G)=>X.every((Y)=>G.createFilter(Y,G.allNodes)(W)),$or:(W,X,G)=>X.some((Y)=>G.createFilter(Y,G.allNodes)(W)),$not:(W,X,G)=>!G.createFilter(X,G.allNodes)(W),$edge:(W,X,G)=>{if(!W.edges?.length||typeof X!=="object"||X===null)return!1;let Y=G.createFilter(X,G.allNodes),J=[...W.edges],Z=new Set(J).add(W.id),V=[];while(J.length){let U=J.shift(),Q=G.allNodes[U];if(!Q)continue;if(Y(Q))V.push(Q);Q.edges?.forEach((N)=>!Z.has(N)&&Z.add(N)&&J.push(N))}if(V.length)W._edgeResult=V;return V.length>0}},eU=(W,X)=>X.split(".").reduce((G,Y)=>G&&typeof G==="object"&&(Y in G)?G[Y]:void 0,W),WQ=(W,X)=>{if(Object.keys(W).length===0)return()=>!0;return(G)=>Object.entries(W).every(([Y,J])=>{if(Y.startsWith("$"))return FJ[Y](G,J,{createFilter:WQ,allNodes:X});let Z=eU(G.value,Y);if(Z===void 0)Z=eU(G,Y);if(J instanceof RegExp)return J.test(String(Z));if(typeof J!=="object"||J===null)return FJ.$eq(Z,J);return Object.entries(J).every(([V,U])=>{if(V==="$text")return FJ.$text.field(Z,U);if(V==="$between"&&U.every((Q)=>Q instanceof Date))return FJ.$between(new Date(Z),U);return FJ[V]?.(Z,U,{createFilter:WQ,allNodes:X})??!1})})},iA=(W,X)=>{let{$edge:G,...Y}=X.query||{},J=WQ(Y,W),Z=Object.values(W).filter(J),U=[...G?(()=>{let Q=WQ({$edge:G},W);Z.forEach((q)=>Q(q));let N=new Map;return Z.forEach((q)=>{if(q._edgeResult)q._edgeResult.forEach((A)=>N.set(A.id,A)),delete q._edgeResult}),Array.from(N.values())})():Z];if(X.field){let Q=X.order==="asc"?1:-1;U.sort((N,q)=>{let A=eU(N.value,X.field),H=eU(q.value,X.field);if(typeof A==="string"&&typeof H==="string")return A.localeCompare(H)*Q;return((A??0)-(H??0))*Q})}if(X.$after){let Q=U.findIndex((N)=>N.id===X.$after);U=Q>=0?U.slice(Q+1):[]}if(X.$before){let Q=U.findIndex((N)=>N.id===X.$before);U=Q>=0?U.slice(0,Q):[]}if(X.$limit)U=U.slice(0,X.$limit);return U.map((Q)=>({...Q,edges:(Q.edges??[]).filter((N)=>Object.hasOwn(W,N))}))};var JG=(()=>{let W=()=>{};return new Proxy(console,{get:(X,G)=>globalThis.__gdbDebug?X[G].bind(X):W})})(),XG=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function PQ(W){return W instanceof Uint8Array||ArrayBuffer.isView(W)&&W.constructor.name==="Uint8Array"}function Vz(W){if(!Number.isSafeInteger(W)||W<0)throw Error("positive integer expected, got "+W)}function LW(W,...X){if(!PQ(W))throw Error("Uint8Array expected");if(X.length>0&&!X.includes(W.length))throw Error("Uint8Array expected of length "+X+", got length="+W.length)}function NT(W){if(typeof W!=="function"||typeof W.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");Vz(W.outputLen),Vz(W.blockLen)}function AQ(W,X=!0){if(W.destroyed)throw Error("Hash instance has been destroyed");if(X&&W.finished)throw Error("Hash#digest() has already been called")}function Hu(W,X){LW(W);let G=X.outputLen;if(W.length<G)throw Error("digestInto() expects output buffer of length at least "+G)}function zQ(...W){for(let X=0;X<W.length;X++)W[X].fill(0)}function rA(W){return new DataView(W.buffer,W.byteOffset,W.byteLength)}function I7(W,X){return W<<32-X|W>>>X}var qT=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),Au=Array.from({length:256},(W,X)=>X.toString(16).padStart(2,"0"));function ZG(W){if(LW(W),qT)return W.toHex();let X="";for(let G=0;G<W.length;G++)X+=Au[W[G]];return X}var X4={_0:48,_9:57,A:65,F:70,a:97,f:102};function cC(W){if(W>=X4._0&&W<=X4._9)return W-X4._0;if(W>=X4.A&&W<=X4.F)return W-(X4.A-10);if(W>=X4.a&&W<=X4.f)return W-(X4.a-10);return}function IQ(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);if(qT)return Uint8Array.fromHex(W);let X=W.length,G=X/2;if(X%2)throw Error("hex string expected, got unpadded hex of length "+X);let Y=new Uint8Array(G);for(let J=0,Z=0;J<G;J++,Z+=2){let V=cC(W.charCodeAt(Z)),U=cC(W.charCodeAt(Z+1));if(V===void 0||U===void 0){let Q=W[Z]+W[Z+1];throw Error('hex string expected, got non-hex character "'+Q+'" at index '+Z)}Y[J]=V*16+U}return Y}function HT(W){if(typeof W!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(W))}function Iz(W){if(typeof W==="string")W=HT(W);return LW(W),W}function w7(...W){let X=0;for(let Y=0;Y<W.length;Y++){let J=W[Y];LW(J),X+=J.length}let G=new Uint8Array(X);for(let Y=0,J=0;Y<W.length;Y++){let Z=W[Y];G.set(Z,J),J+=Z.length}return G}class wz{}function zu(W){let X=(Y)=>W().update(Iz(Y)).digest(),G=W();return X.outputLen=G.outputLen,X.blockLen=G.blockLen,X.create=()=>W(),X}function RQ(W=32){if(XG&&typeof XG.getRandomValues==="function")return XG.getRandomValues(new Uint8Array(W));if(XG&&typeof XG.randomBytes==="function")return Uint8Array.from(XG.randomBytes(W));throw Error("crypto.getRandomValues must be defined")}function Iu(W,X,G,Y){if(typeof W.setBigUint64==="function")return W.setBigUint64(X,G,Y);let J=BigInt(32),Z=BigInt(4294967295),V=Number(G>>J&Z),U=Number(G&Z),Q=Y?4:0,N=Y?0:4;W.setUint32(X+Q,V,Y),W.setUint32(X+N,U,Y)}function wu(W,X,G){return W&X^~W&G}function ju(W,X,G){return W&X^W&G^X&G}class AT extends wz{constructor(W,X,G,Y){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=W,this.outputLen=X,this.padOffset=G,this.isLE=Y,this.buffer=new Uint8Array(W),this.view=rA(this.buffer)}update(W){AQ(this),W=Iz(W),LW(W);let{view:X,buffer:G,blockLen:Y}=this,J=W.length;for(let Z=0;Z<J;){let V=Math.min(Y-this.pos,J-Z);if(V===Y){let U=rA(W);for(;Y<=J-Z;Z+=Y)this.process(U,Z);continue}if(G.set(W.subarray(Z,Z+V),this.pos),this.pos+=V,Z+=V,this.pos===Y)this.process(X,0),this.pos=0}return this.length+=W.length,this.roundClean(),this}digestInto(W){AQ(this),Hu(W,this),this.finished=!0;let{buffer:X,view:G,blockLen:Y,isLE:J}=this,{pos:Z}=this;if(X[Z++]=128,zQ(this.buffer.subarray(Z)),this.padOffset>Y-Z)this.process(G,0),Z=0;for(let q=Z;q<Y;q++)X[q]=0;Iu(G,Y-8,BigInt(this.length*8),J),this.process(G,0);let V=rA(W),U=this.outputLen;if(U%4)throw Error("_sha2: outputLen should be aligned to 32bit");let Q=U/4,N=this.get();if(Q>N.length)throw Error("_sha2: outputLen bigger than state");for(let q=0;q<Q;q++)V.setUint32(4*q,N[q],J)}digest(){let{buffer:W,outputLen:X}=this;this.digestInto(W);let G=W.slice(0,X);return this.destroy(),G}_cloneInto(W){W||(W=new this.constructor),W.set(...this.get());let{blockLen:X,buffer:G,length:Y,finished:J,destroyed:Z,pos:V}=this;if(W.destroyed=Z,W.finished=J,W.length=Y,W.pos=V,Y%X)W.buffer.set(G);return W}clone(){return this._cloneInto()}}var q6=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ku=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]),H6=new Uint32Array(64);class zT extends AT{constructor(W=32){super(64,W,8,!1);this.A=q6[0]|0,this.B=q6[1]|0,this.C=q6[2]|0,this.D=q6[3]|0,this.E=q6[4]|0,this.F=q6[5]|0,this.G=q6[6]|0,this.H=q6[7]|0}get(){let{A:W,B:X,C:G,D:Y,E:J,F:Z,G:V,H:U}=this;return[W,X,G,Y,J,Z,V,U]}set(W,X,G,Y,J,Z,V,U){this.A=W|0,this.B=X|0,this.C=G|0,this.D=Y|0,this.E=J|0,this.F=Z|0,this.G=V|0,this.H=U|0}process(W,X){for(let q=0;q<16;q++,X+=4)H6[q]=W.getUint32(X,!1);for(let q=16;q<64;q++){let A=H6[q-15],H=H6[q-2],I=I7(A,7)^I7(A,18)^A>>>3,w=I7(H,17)^I7(H,19)^H>>>10;H6[q]=w+H6[q-7]+I+H6[q-16]|0}let{A:G,B:Y,C:J,D:Z,E:V,F:U,G:Q,H:N}=this;for(let q=0;q<64;q++){let A=I7(V,6)^I7(V,11)^I7(V,25),H=N+A+wu(V,U,Q)+Ku[q]+H6[q]|0,I=(I7(G,2)^I7(G,13)^I7(G,22))+ju(G,Y,J)|0;N=Q,Q=U,U=V,V=Z+H|0,Z=J,J=Y,Y=G,G=H+I|0}G=G+this.A|0,Y=Y+this.B|0,J=J+this.C|0,Z=Z+this.D|0,V=V+this.E|0,U=U+this.F|0,Q=Q+this.G|0,N=N+this.H|0,this.set(G,Y,J,Z,V,U,Q,N)}roundClean(){zQ(H6)}destroy(){this.set(0,0,0,0,0,0,0,0),zQ(this.buffer)}}var Uz=zu(()=>new zT);class jz extends wz{constructor(W,X){super();this.finished=!1,this.destroyed=!1,NT(W);let G=Iz(X);if(this.iHash=W.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let Y=this.blockLen,J=new Uint8Array(Y);J.set(G.length>Y?W.create().update(G).digest():G);for(let Z=0;Z<J.length;Z++)J[Z]^=54;this.iHash.update(J),this.oHash=W.create();for(let Z=0;Z<J.length;Z++)J[Z]^=106;this.oHash.update(J),zQ(J)}update(W){return AQ(this),this.iHash.update(W),this}digestInto(W){AQ(this),LW(W,this.outputLen),this.finished=!0,this.iHash.digestInto(W),this.oHash.update(W),this.oHash.digestInto(W),this.destroy()}digest(){let W=new Uint8Array(this.oHash.outputLen);return this.digestInto(W),W}_cloneInto(W){W||(W=Object.create(Object.getPrototypeOf(this),{}));let{oHash:X,iHash:G,finished:Y,destroyed:J,blockLen:Z,outputLen:V}=this;return W=W,W.finished=Y,W.destroyed=J,W.blockLen=Z,W.outputLen=V,W.oHash=X._cloneInto(W.oHash),W.iHash=G._cloneInto(W.iHash),W}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var IT=(W,X,G)=>new jz(W,X).update(G).digest();IT.create=(W,X)=>new jz(W,X);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Kz=BigInt(0),Qz=BigInt(1);function wQ(W,X=""){if(typeof W!=="boolean"){let G=X&&`"${X}"`;throw Error(G+"expected boolean, got type="+typeof W)}return W}function TW(W,X,G=""){let Y=PQ(W),J=W?.length,Z=X!==void 0;if(!Y||Z&&J!==X){let V=G&&`"${G}" `,U=Z?` of length ${X}`:"",Q=Y?`length=${J}`:`type=${typeof W}`;throw Error(V+"expected Uint8Array"+U+", got "+Q)}return W}function XQ(W){let X=W.toString(16);return X.length&1?"0"+X:X}function wT(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);return W===""?Kz:BigInt("0x"+W)}function qG(W){return wT(ZG(W))}function jT(W){return LW(W),wT(ZG(Uint8Array.from(W).reverse()))}function LQ(W,X){return IQ(W.toString(16).padStart(X*2,"0"))}function KT(W,X){return LQ(W,X).reverse()}function f8(W,X,G){let Y;if(typeof X==="string")try{Y=IQ(X)}catch(Z){throw Error(W+" must be hex string or Uint8Array, cause: "+Z)}else if(PQ(X))Y=Uint8Array.from(X);else throw Error(W+" must be hex string or Uint8Array");let J=Y.length;if(typeof G==="number"&&J!==G)throw Error(W+" of length "+G+" expected, got "+J);return Y}var aA=(W)=>typeof W==="bigint"&&Kz<=W;function Nz(W,X,G){return aA(W)&&aA(X)&&aA(G)&&X<=W&&W<G}function Du(W,X,G,Y){if(!Nz(X,G,Y))throw Error("expected valid "+W+": "+G+" <= n < "+Y+", got "+X)}function DT(W){let X;for(X=0;W>Kz;W>>=Qz,X+=1);return X}var hJ=(W)=>(Qz<<BigInt(W))-Qz;function Ou(W,X,G){if(typeof W!=="number"||W<2)throw Error("hashLen must be a number");if(typeof X!=="number"||X<2)throw Error("qByteLen must be a number");if(typeof G!=="function")throw Error("hmacFn must be a function");let Y=(H)=>new Uint8Array(H),J=(H)=>Uint8Array.of(H),Z=Y(W),V=Y(W),U=0,Q=()=>{Z.fill(1),V.fill(0),U=0},N=(...H)=>G(V,Z,...H),q=(H=Y(0))=>{if(V=N(J(0),H),Z=N(),H.length===0)return;V=N(J(1),H),Z=N()},A=()=>{if(U++>=1000)throw Error("drbg: tried 1000 values");let H=0,I=[];while(H<X){Z=N();let w=Z.slice();I.push(w),H+=Z.length}return w7(...I)};return(H,I)=>{Q(),q(H);let w=void 0;while(!(w=I(A())))q();return Q(),w}}function Dz(W,X,G={}){if(!W||typeof W!=="object")throw Error("expected valid options object");function Y(J,Z,V){let U=W[J];if(V&&U===void 0)return;let Q=typeof U;if(Q!==Z||U===null)throw Error(`param "${J}" is invalid: expected ${Z}, got ${Q}`)}Object.entries(X).forEach(([J,Z])=>Y(J,Z,!1)),Object.entries(G).forEach(([J,Z])=>Y(J,Z,!0))}function lC(W){let X=new WeakMap;return(G,...Y)=>{let J=X.get(G);if(J!==void 0)return J;let Z=W(G,...Y);return X.set(G,Z),Z}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var _9=BigInt(0),I9=BigInt(1),MW=BigInt(2),OT=BigInt(3),CT=BigInt(4),TT=BigInt(5),Cu=BigInt(7),MT=BigInt(8),Tu=BigInt(9),PT=BigInt(16);function C5(W,X){let G=W%X;return G>=_9?G:X+G}function D5(W,X,G){let Y=W;while(X-- >_9)Y*=Y,Y%=G;return Y}function dC(W,X){if(W===_9)throw Error("invert: expected non-zero number");if(X<=_9)throw Error("invert: expected positive modulus, got "+X);let G=C5(W,X),Y=X,J=_9,Z=I9,V=I9,U=_9;while(G!==_9){let Q=Y/G,N=Y%G,q=J-V*Q,A=Z-U*Q;Y=G,G=N,J=V,Z=U,V=q,U=A}if(Y!==I9)throw Error("invert: does not exist");return C5(J,X)}function Oz(W,X,G){if(!W.eql(W.sqr(X),G))throw Error("Cannot find square root")}function RT(W,X){let G=(W.ORDER+I9)/CT,Y=W.pow(X,G);return Oz(W,Y,X),Y}function Mu(W,X){let G=(W.ORDER-TT)/MT,Y=W.mul(X,MW),J=W.pow(Y,G),Z=W.mul(X,J),V=W.mul(W.mul(Z,MW),J),U=W.mul(Z,W.sub(V,W.ONE));return Oz(W,U,X),U}function Pu(W){let X=bJ(W),G=LT(W),Y=G(X,X.neg(X.ONE)),J=G(X,Y),Z=G(X,X.neg(Y)),V=(W+Cu)/PT;return(U,Q)=>{let N=U.pow(Q,V),q=U.mul(N,Y),A=U.mul(N,J),H=U.mul(N,Z),I=U.eql(U.sqr(q),Q),w=U.eql(U.sqr(A),Q);N=U.cmov(N,q,I),q=U.cmov(H,A,w);let D=U.eql(U.sqr(q),Q),T=U.cmov(N,q,D);return Oz(U,T,Q),T}}function LT(W){if(W<OT)throw Error("sqrt is not defined for small field");let X=W-I9,G=0;while(X%MW===_9)X/=MW,G++;let Y=MW,J=bJ(W);while(oC(J,Y)===1)if(Y++>1000)throw Error("Cannot find square root: probably non-prime P");if(G===1)return RT;let Z=J.pow(Y,X),V=(X+I9)/MW;return function(U,Q){if(U.is0(Q))return Q;if(oC(U,Q)!==1)throw Error("Cannot find square root");let N=G,q=U.mul(U.ONE,Z),A=U.pow(Q,X),H=U.pow(Q,V);while(!U.eql(A,U.ONE)){if(U.is0(A))return U.ZERO;let I=1,w=U.sqr(A);while(!U.eql(w,U.ONE))if(I++,w=U.sqr(w),I===N)throw Error("Cannot find square root");let D=I9<<BigInt(N-I-1),T=U.pow(q,D);N=I,q=U.sqr(T),A=U.mul(A,q),H=U.mul(H,T)}return H}}function Ru(W){if(W%CT===OT)return RT;if(W%MT===TT)return Mu;if(W%PT===Tu)return Pu(W);return LT(W)}var Lu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Bu(W){let X={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},G=Lu.reduce((Y,J)=>{return Y[J]="function",Y},X);return Dz(W,G),W}function Eu(W,X,G){if(G<_9)throw Error("invalid exponent, negatives unsupported");if(G===_9)return W.ONE;if(G===I9)return X;let Y=W.ONE,J=X;while(G>_9){if(G&I9)Y=W.mul(Y,J);J=W.sqr(J),G>>=I9}return Y}function BT(W,X,G=!1){let Y=Array(X.length).fill(G?W.ZERO:void 0),J=X.reduce((V,U,Q)=>{if(W.is0(U))return V;return Y[Q]=V,W.mul(V,U)},W.ONE),Z=W.inv(J);return X.reduceRight((V,U,Q)=>{if(W.is0(U))return V;return Y[Q]=W.mul(V,Y[Q]),W.mul(V,U)},Z),Y}function oC(W,X){let G=(W.ORDER-I9)/MW,Y=W.pow(X,G),J=W.eql(Y,W.ONE),Z=W.eql(Y,W.ZERO),V=W.eql(Y,W.neg(W.ONE));if(!J&&!Z&&!V)throw Error("invalid Legendre symbol result");return J?1:Z?0:-1}function ET(W,X){if(X!==void 0)Vz(X);let G=X!==void 0?X:W.toString(2).length,Y=Math.ceil(G/8);return{nBitLength:G,nByteLength:Y}}function bJ(W,X,G=!1,Y={}){if(W<=_9)throw Error("invalid field: expected ORDER > 0, got "+W);let J=void 0,Z=void 0,V=!1,U=void 0;if(typeof X==="object"&&X!=null){if(Y.sqrt||G)throw Error("cannot specify opts in two arguments");let H=X;if(H.BITS)J=H.BITS;if(H.sqrt)Z=H.sqrt;if(typeof H.isLE==="boolean")G=H.isLE;if(typeof H.modFromBytes==="boolean")V=H.modFromBytes;U=H.allowedLengths}else{if(typeof X==="number")J=X;if(Y.sqrt)Z=Y.sqrt}let{nBitLength:Q,nByteLength:N}=ET(W,J);if(N>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let q,A=Object.freeze({ORDER:W,isLE:G,BITS:Q,BYTES:N,MASK:hJ(Q),ZERO:_9,ONE:I9,allowedLengths:U,create:(H)=>C5(H,W),isValid:(H)=>{if(typeof H!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof H);return _9<=H&&H<W},is0:(H)=>H===_9,isValidNot0:(H)=>!A.is0(H)&&A.isValid(H),isOdd:(H)=>(H&I9)===I9,neg:(H)=>C5(-H,W),eql:(H,I)=>H===I,sqr:(H)=>C5(H*H,W),add:(H,I)=>C5(H+I,W),sub:(H,I)=>C5(H-I,W),mul:(H,I)=>C5(H*I,W),pow:(H,I)=>Eu(A,H,I),div:(H,I)=>C5(H*dC(I,W),W),sqrN:(H)=>H*H,addN:(H,I)=>H+I,subN:(H,I)=>H-I,mulN:(H,I)=>H*I,inv:(H)=>dC(H,W),sqrt:Z||((H)=>{if(!q)q=Ru(W);return q(A,H)}),toBytes:(H)=>G?KT(H,N):LQ(H,N),fromBytes:(H,I=!0)=>{if(U){if(!U.includes(H.length)||H.length>N)throw Error("Field.fromBytes: expected "+U+" bytes, got "+H.length);let D=new Uint8Array(N);D.set(H,G?0:D.length-H.length),H=D}if(H.length!==N)throw Error("Field.fromBytes: expected "+N+" bytes, got "+H.length);let w=G?jT(H):qG(H);if(V)w=C5(w,W);if(!I){if(!A.isValid(w))throw Error("invalid field element: outside of range 0..ORDER")}return w},invertBatch:(H)=>BT(A,H),cmov:(H,I,w)=>w?I:H});return Object.freeze(A)}function $T(W){if(typeof W!=="bigint")throw Error("field order must be bigint");let X=W.toString(2).length;return Math.ceil(X/8)}function FT(W){let X=$T(W);return X+Math.ceil(X/2)}function ST(W,X,G=!1){let Y=W.length,J=$T(X),Z=FT(X);if(Y<16||Y<Z||Y>1024)throw Error("expected "+Z+"-1024 bytes of input, got "+Y);let V=G?jT(W):qG(W),U=C5(V,X-I9)+I9;return G?KT(U,J):LQ(U,J)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var QG=BigInt(0),PW=BigInt(1);function jQ(W,X){let G=X.negate();return W?G:X}function sA(W,X){let G=BT(W.Fp,X.map((Y)=>Y.Z));return X.map((Y,J)=>W.fromAffine(Y.toAffine(G[J])))}function xT(W,X){if(!Number.isSafeInteger(W)||W<=0||W>X)throw Error("invalid window size, expected [1.."+X+"], got W="+W)}function tA(W,X){xT(W,X);let G=Math.ceil(X/W)+1,Y=2**(W-1),J=2**W,Z=hJ(W),V=BigInt(W);return{windows:G,windowSize:Y,mask:Z,maxNumber:J,shiftBy:V}}function nC(W,X,G){let{windowSize:Y,mask:J,maxNumber:Z,shiftBy:V}=G,U=Number(W&J),Q=W>>V;if(U>Y)U-=Z,Q+=PW;let N=X*Y,q=N+Math.abs(U)-1,A=U===0,H=U<0,I=X%2!==0;return{nextN:Q,offset:q,isZero:A,isNeg:H,isNegF:I,offsetF:N}}function $u(W,X){if(!Array.isArray(W))throw Error("array expected");W.forEach((G,Y)=>{if(!(G instanceof X))throw Error("invalid point at index "+Y)})}function Fu(W,X){if(!Array.isArray(W))throw Error("array of scalars expected");W.forEach((G,Y)=>{if(!X.isValid(G))throw Error("invalid scalar at index "+Y)})}var eA=new WeakMap,kT=new WeakMap;function Wz(W){return kT.get(W)||1}function iC(W){if(W!==QG)throw Error("invalid wNAF")}class _T{constructor(W,X){this.BASE=W.BASE,this.ZERO=W.ZERO,this.Fn=W.Fn,this.bits=X}_unsafeLadder(W,X,G=this.ZERO){let Y=W;while(X>QG){if(X&PW)G=G.add(Y);Y=Y.double(),X>>=PW}return G}precomputeWindow(W,X){let{windows:G,windowSize:Y}=tA(X,this.bits),J=[],Z=W,V=Z;for(let U=0;U<G;U++){V=Z,J.push(V);for(let Q=1;Q<Y;Q++)V=V.add(Z),J.push(V);Z=V.double()}return J}wNAF(W,X,G){if(!this.Fn.isValid(G))throw Error("invalid scalar");let Y=this.ZERO,J=this.BASE,Z=tA(W,this.bits);for(let V=0;V<Z.windows;V++){let{nextN:U,offset:Q,isZero:N,isNeg:q,isNegF:A,offsetF:H}=nC(G,V,Z);if(G=U,N)J=J.add(jQ(A,X[H]));else Y=Y.add(jQ(q,X[Q]))}return iC(G),{p:Y,f:J}}wNAFUnsafe(W,X,G,Y=this.ZERO){let J=tA(W,this.bits);for(let Z=0;Z<J.windows;Z++){if(G===QG)break;let{nextN:V,offset:U,isZero:Q,isNeg:N}=nC(G,Z,J);if(G=V,Q)continue;else{let q=X[U];Y=Y.add(N?q.negate():q)}}return iC(G),Y}getPrecomputes(W,X,G){let Y=eA.get(X);if(!Y){if(Y=this.precomputeWindow(X,W),W!==1){if(typeof G==="function")Y=G(Y);eA.set(X,Y)}}return Y}cached(W,X,G){let Y=Wz(W);return this.wNAF(Y,this.getPrecomputes(Y,W,G),X)}unsafe(W,X,G,Y){let J=Wz(W);if(J===1)return this._unsafeLadder(W,X,Y);return this.wNAFUnsafe(J,this.getPrecomputes(J,W,G),X,Y)}createCache(W,X){xT(X,this.bits),kT.set(W,X),eA.delete(W)}hasCache(W){return Wz(W)!==1}}function Su(W,X,G,Y){let J=X,Z=W.ZERO,V=W.ZERO;while(G>QG||Y>QG){if(G&PW)Z=Z.add(J);if(Y&PW)V=V.add(J);J=J.double(),G>>=PW,Y>>=PW}return{p1:Z,p2:V}}function xu(W,X,G,Y){$u(G,W),Fu(Y,X);let J=G.length,Z=Y.length;if(J!==Z)throw Error("arrays of points and scalars must have equal length");let V=W.ZERO,U=DT(BigInt(J)),Q=1;if(U>12)Q=U-3;else if(U>4)Q=U-2;else if(U>0)Q=2;let N=hJ(Q),q=Array(Number(N)+1).fill(V),A=Math.floor((X.BITS-1)/Q)*Q,H=V;for(let I=A;I>=0;I-=Q){q.fill(V);for(let D=0;D<Z;D++){let T=Y[D],x=Number(T>>BigInt(I)&N);q[x]=q[x].add(G[D])}let w=V;for(let D=q.length-1,T=V;D>0;D--)T=T.add(q[D]),w=w.add(T);if(H=H.add(w),I!==0)for(let D=0;D<Q;D++)H=H.double()}return H}function rC(W,X,G){if(X){if(X.ORDER!==W)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return Bu(X),X}else return bJ(W,{isLE:G})}function ku(W,X,G={},Y){if(Y===void 0)Y=W==="edwards";if(!X||typeof X!=="object")throw Error(`expected valid ${W} CURVE object`);for(let U of["p","n","h"]){let Q=X[U];if(!(typeof Q==="bigint"&&Q>QG))throw Error(`CURVE.${U} must be positive bigint`)}let J=rC(X.p,G.Fp,Y),Z=rC(X.n,G.Fn,Y),V=["Gx","Gy","a",W==="weierstrass"?"b":"d"];for(let U of V)if(!J.isValid(X[U]))throw Error(`CURVE.${U} must be valid field element of CURVE.Fp`);return X=Object.freeze(Object.assign({},X)),{CURVE:X,Fp:J,Fn:Z}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var aC=(W,X)=>(W+(W>=0?X:-X)/vT)/X;function _u(W,X,G){let[[Y,J],[Z,V]]=X,U=aC(V*W,G),Q=aC(-J*W,G),N=W-U*Y-Q*Z,q=-U*J-Q*V,A=N<Y4,H=q<Y4;if(A)N=-N;if(H)q=-q;let I=hJ(Math.ceil(DT(G)/2))+VG;if(N<Y4||N>=I||q<Y4||q>=I)throw Error("splitScalar (endomorphism): failed, k="+W);return{k1neg:A,k1:N,k2neg:H,k2:q}}function qz(W){if(!["compact","recovered","der"].includes(W))throw Error('Signature format must be "compact", "recovered", or "der"');return W}function Xz(W,X){let G={};for(let Y of Object.keys(X))G[Y]=W[Y]===void 0?X[Y]:W[Y];if(wQ(G.lowS,"lowS"),wQ(G.prehash,"prehash"),G.format!==void 0)qz(G.format);return G}class yT extends Error{constructor(W=""){super(W)}}var G4={Err:yT,_tlv:{encode:(W,X)=>{let{Err:G}=G4;if(W<0||W>256)throw new G("tlv.encode: wrong tag");if(X.length&1)throw new G("tlv.encode: unpadded data");let Y=X.length/2,J=XQ(Y);if(J.length/2&128)throw new G("tlv.encode: long form length too big");let Z=Y>127?XQ(J.length/2|128):"";return XQ(W)+Z+J+X},decode(W,X){let{Err:G}=G4,Y=0;if(W<0||W>256)throw new G("tlv.encode: wrong tag");if(X.length<2||X[Y++]!==W)throw new G("tlv.decode: wrong tlv");let J=X[Y++],Z=!!(J&128),V=0;if(!Z)V=J;else{let Q=J&127;if(!Q)throw new G("tlv.decode(long): indefinite length not supported");if(Q>4)throw new G("tlv.decode(long): byte length is too big");let N=X.subarray(Y,Y+Q);if(N.length!==Q)throw new G("tlv.decode: length bytes not complete");if(N[0]===0)throw new G("tlv.decode(long): zero leftmost byte");for(let q of N)V=V<<8|q;if(Y+=Q,V<128)throw new G("tlv.decode(long): not minimal encoding")}let U=X.subarray(Y,Y+V);if(U.length!==V)throw new G("tlv.decode: wrong value length");return{v:U,l:X.subarray(Y+V)}}},_int:{encode(W){let{Err:X}=G4;if(W<Y4)throw new X("integer: negative integers are not allowed");let G=XQ(W);if(Number.parseInt(G[0],16)&8)G="00"+G;if(G.length&1)throw new X("unexpected DER parsing assertion: unpadded hex");return G},decode(W){let{Err:X}=G4;if(W[0]&128)throw new X("invalid signature integer: negative");if(W[0]===0&&!(W[1]&128))throw new X("invalid signature integer: unnecessary leading zero");return qG(W)}},toSig(W){let{Err:X,_int:G,_tlv:Y}=G4,J=f8("signature",W),{v:Z,l:V}=Y.decode(48,J);if(V.length)throw new X("invalid signature: left bytes after parsing");let{v:U,l:Q}=Y.decode(2,Z),{v:N,l:q}=Y.decode(2,Q);if(q.length)throw new X("invalid signature: left bytes after parsing");return{r:G.decode(U),s:G.decode(N)}},hexFromSig(W){let{_tlv:X,_int:G}=G4,Y=X.encode(2,G.encode(W.r)),J=X.encode(2,G.encode(W.s)),Z=Y+J;return X.encode(48,Z)}},Y4=BigInt(0),VG=BigInt(1),vT=BigInt(2),GQ=BigInt(3),yu=BigInt(4);function RW(W,X){let{BYTES:G}=W,Y;if(typeof X==="bigint")Y=X;else{let J=f8("private key",X);try{Y=W.fromBytes(J)}catch(Z){throw Error(`invalid private key: expected ui8a of size ${G}, got ${typeof X}`)}}if(!W.isValidNot0(Y))throw Error("invalid private key: out of range [1..N-1]");return Y}function vu(W,X={}){let G=ku("weierstrass",W,X),{Fp:Y,Fn:J}=G,Z=G.CURVE,{h:V,n:U}=Z;Dz(X,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:Q}=X;if(Q){if(!Y.is0(Z.a)||typeof Q.beta!=="bigint"||!Array.isArray(Q.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let N=uT(Y,J);function q(){if(!Y.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function A(g,d,P){let{x:E,y:f}=d.toAffine(),r=Y.toBytes(E);if(wQ(P,"isCompressed"),P){q();let o=!Y.isOdd(f);return w7(gT(o),r)}else return w7(Uint8Array.of(4),r,Y.toBytes(f))}function H(g){TW(g,void 0,"Point");let{publicKey:d,publicKeyUncompressed:P}=N,E=g.length,f=g[0],r=g.subarray(1);if(E===d&&(f===2||f===3)){let o=Y.fromBytes(r);if(!Y.isValid(o))throw Error("bad point: is not on curve, wrong x");let B=D(o),S;try{S=Y.sqrt(B)}catch(v){let R=v instanceof Error?": "+v.message:"";throw Error("bad point: is not on curve, sqrt error"+R)}q();let _=Y.isOdd(S);if((f&1)===1!==_)S=Y.neg(S);return{x:o,y:S}}else if(E===P&&f===4){let o=Y.BYTES,B=Y.fromBytes(r.subarray(0,o)),S=Y.fromBytes(r.subarray(o,o*2));if(!T(B,S))throw Error("bad point: is not on curve");return{x:B,y:S}}else throw Error(`bad point: got length ${E}, expected compressed=${d} or uncompressed=${P}`)}let I=X.toBytes||A,w=X.fromBytes||H;function D(g){let d=Y.sqr(g),P=Y.mul(d,g);return Y.add(Y.add(P,Y.mul(g,Z.a)),Z.b)}function T(g,d){let P=Y.sqr(d),E=D(g);return Y.eql(P,E)}if(!T(Z.Gx,Z.Gy))throw Error("bad curve params: generator point");let x=Y.mul(Y.pow(Z.a,GQ),yu),h=Y.mul(Y.sqr(Z.b),BigInt(27));if(Y.is0(Y.add(x,h)))throw Error("bad curve params: a or b");function $(g,d,P=!1){if(!Y.isValid(d)||P&&Y.is0(d))throw Error(`bad point coordinate ${g}`);return d}function F(g){if(!(g instanceof y))throw Error("ProjectivePoint expected")}function u(g){if(!Q||!Q.basises)throw Error("no endo");return _u(g,Q.basises,J.ORDER)}let c=lC((g,d)=>{let{X:P,Y:E,Z:f}=g;if(Y.eql(f,Y.ONE))return{x:P,y:E};let r=g.is0();if(d==null)d=r?Y.ONE:Y.inv(f);let o=Y.mul(P,d),B=Y.mul(E,d),S=Y.mul(f,d);if(r)return{x:Y.ZERO,y:Y.ZERO};if(!Y.eql(S,Y.ONE))throw Error("invZ was invalid");return{x:o,y:B}}),p=lC((g)=>{if(g.is0()){if(X.allowInfinityPoint&&!Y.is0(g.Y))return;throw Error("bad point: ZERO")}let{x:d,y:P}=g.toAffine();if(!Y.isValid(d)||!Y.isValid(P))throw Error("bad point: x or y not field elements");if(!T(d,P))throw Error("bad point: equation left != right");if(!g.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function s(g,d,P,E,f){return P=new y(Y.mul(P.X,g),P.Y,P.Z),d=jQ(E,d),P=jQ(f,P),d.add(P)}class y{constructor(g,d,P){this.X=$("x",g),this.Y=$("y",d,!0),this.Z=$("z",P),Object.freeze(this)}static CURVE(){return Z}static fromAffine(g){let{x:d,y:P}=g||{};if(!g||!Y.isValid(d)||!Y.isValid(P))throw Error("invalid affine point");if(g instanceof y)throw Error("projective point not allowed");if(Y.is0(d)&&Y.is0(P))return y.ZERO;return new y(d,P,Y.ONE)}static fromBytes(g){let d=y.fromAffine(w(TW(g,void 0,"point")));return d.assertValidity(),d}static fromHex(g){return y.fromBytes(f8("pointHex",g))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(g=8,d=!0){if(H0.createCache(this,g),!d)this.multiply(GQ);return this}assertValidity(){p(this)}hasEvenY(){let{y:g}=this.toAffine();if(!Y.isOdd)throw Error("Field doesn't support isOdd");return!Y.isOdd(g)}equals(g){F(g);let{X:d,Y:P,Z:E}=this,{X:f,Y:r,Z:o}=g,B=Y.eql(Y.mul(d,o),Y.mul(f,E)),S=Y.eql(Y.mul(P,o),Y.mul(r,E));return B&&S}negate(){return new y(this.X,Y.neg(this.Y),this.Z)}double(){let{a:g,b:d}=Z,P=Y.mul(d,GQ),{X:E,Y:f,Z:r}=this,o=Y.ZERO,B=Y.ZERO,S=Y.ZERO,_=Y.mul(E,E),v=Y.mul(f,f),R=Y.mul(r,r),m=Y.mul(E,f);return m=Y.add(m,m),S=Y.mul(E,r),S=Y.add(S,S),o=Y.mul(g,S),B=Y.mul(P,R),B=Y.add(o,B),o=Y.sub(v,B),B=Y.add(v,B),B=Y.mul(o,B),o=Y.mul(m,o),S=Y.mul(P,S),R=Y.mul(g,R),m=Y.sub(_,R),m=Y.mul(g,m),m=Y.add(m,S),S=Y.add(_,_),_=Y.add(S,_),_=Y.add(_,R),_=Y.mul(_,m),B=Y.add(B,_),R=Y.mul(f,r),R=Y.add(R,R),_=Y.mul(R,m),o=Y.sub(o,_),S=Y.mul(R,v),S=Y.add(S,S),S=Y.add(S,S),new y(o,B,S)}add(g){F(g);let{X:d,Y:P,Z:E}=this,{X:f,Y:r,Z:o}=g,B=Y.ZERO,S=Y.ZERO,_=Y.ZERO,v=Z.a,R=Y.mul(Z.b,GQ),m=Y.mul(d,f),J0=Y.mul(P,r),U0=Y.mul(E,o),N0=Y.add(d,P),$0=Y.add(f,r);N0=Y.mul(N0,$0),$0=Y.add(m,J0),N0=Y.sub(N0,$0),$0=Y.add(d,E);let u0=Y.add(f,o);return $0=Y.mul($0,u0),u0=Y.add(m,U0),$0=Y.sub($0,u0),u0=Y.add(P,E),B=Y.add(r,o),u0=Y.mul(u0,B),B=Y.add(J0,U0),u0=Y.sub(u0,B),_=Y.mul(v,$0),B=Y.mul(R,U0),_=Y.add(B,_),B=Y.sub(J0,_),_=Y.add(J0,_),S=Y.mul(B,_),J0=Y.add(m,m),J0=Y.add(J0,m),U0=Y.mul(v,U0),$0=Y.mul(R,$0),J0=Y.add(J0,U0),U0=Y.sub(m,U0),U0=Y.mul(v,U0),$0=Y.add($0,U0),m=Y.mul(J0,$0),S=Y.add(S,m),m=Y.mul(u0,$0),B=Y.mul(N0,B),B=Y.sub(B,m),m=Y.mul(N0,J0),_=Y.mul(u0,_),_=Y.add(_,m),new y(B,S,_)}subtract(g){return this.add(g.negate())}is0(){return this.equals(y.ZERO)}multiply(g){let{endo:d}=X;if(!J.isValidNot0(g))throw Error("invalid scalar: out of range");let P,E,f=(r)=>H0.cached(this,r,(o)=>sA(y,o));if(d){let{k1neg:r,k1:o,k2neg:B,k2:S}=u(g),{p:_,f:v}=f(o),{p:R,f:m}=f(S);E=v.add(m),P=s(d.beta,_,R,r,B)}else{let{p:r,f:o}=f(g);P=r,E=o}return sA(y,[P,E])[0]}multiplyUnsafe(g){let{endo:d}=X,P=this;if(!J.isValid(g))throw Error("invalid scalar: out of range");if(g===Y4||P.is0())return y.ZERO;if(g===VG)return P;if(H0.hasCache(this))return this.multiply(g);if(d){let{k1neg:E,k1:f,k2neg:r,k2:o}=u(g),{p1:B,p2:S}=Su(y,P,f,o);return s(d.beta,B,S,E,r)}else return H0.unsafe(P,g)}multiplyAndAddUnsafe(g,d,P){let E=this.multiplyUnsafe(d).add(g.multiplyUnsafe(P));return E.is0()?void 0:E}toAffine(g){return c(this,g)}isTorsionFree(){let{isTorsionFree:g}=X;if(V===VG)return!0;if(g)return g(y,this);return H0.unsafe(this,U).is0()}clearCofactor(){let{clearCofactor:g}=X;if(V===VG)return this;if(g)return g(y,this);return this.multiplyUnsafe(V)}isSmallOrder(){return this.multiplyUnsafe(V).is0()}toBytes(g=!0){return wQ(g,"isCompressed"),this.assertValidity(),I(y,this,g)}toHex(g=!0){return ZG(this.toBytes(g))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(g=!0){return this.toBytes(g)}_setWindowSize(g){this.precompute(g)}static normalizeZ(g){return sA(y,g)}static msm(g,d){return xu(y,J,g,d)}static fromPrivateKey(g){return y.BASE.multiply(RW(J,g))}}y.BASE=new y(Z.Gx,Z.Gy,Y.ONE),y.ZERO=new y(Y.ZERO,Y.ONE,Y.ZERO),y.Fp=Y,y.Fn=J;let t=J.BITS,H0=new _T(y,X.endo?Math.ceil(t/2):t);return y.BASE.precompute(8),y}function gT(W){return Uint8Array.of(W?2:3)}function uT(W,X){return{secretKey:X.BYTES,publicKey:1+W.BYTES,publicKeyUncompressed:1+2*W.BYTES,publicKeyHasPrefix:!0,signature:2*X.BYTES}}function gu(W,X={}){let{Fn:G}=W,Y=X.randomBytes||RQ,J=Object.assign(uT(W.Fp,G),{seed:FT(G.ORDER)});function Z(H){try{return!!RW(G,H)}catch(I){return!1}}function V(H,I){let{publicKey:w,publicKeyUncompressed:D}=J;try{let T=H.length;if(I===!0&&T!==w)return!1;if(I===!1&&T!==D)return!1;return!!W.fromBytes(H)}catch(T){return!1}}function U(H=Y(J.seed)){return ST(TW(H,J.seed,"seed"),G.ORDER)}function Q(H,I=!0){return W.BASE.multiply(RW(G,H)).toBytes(I)}function N(H){let I=U(H);return{secretKey:I,publicKey:Q(I)}}function q(H){if(typeof H==="bigint")return!1;if(H instanceof W)return!0;let{secretKey:I,publicKey:w,publicKeyUncompressed:D}=J;if(G.allowedLengths||I===w)return;let T=f8("key",H).length;return T===w||T===D}function A(H,I,w=!0){if(q(H)===!0)throw Error("first arg must be private key");if(q(I)===!1)throw Error("second arg must be public key");let D=RW(G,H);return W.fromHex(I).multiply(D).toBytes(w)}return Object.freeze({getPublicKey:Q,getSharedSecret:A,keygen:N,Point:W,utils:{isValidSecretKey:Z,isValidPublicKey:V,randomSecretKey:U,isValidPrivateKey:Z,randomPrivateKey:U,normPrivateKeyToScalar:(H)=>RW(G,H),precompute(H=8,I=W.BASE){return I.precompute(H,!1)}},lengths:J})}function uu(W,X,G={}){NT(X),Dz(G,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let Y=G.randomBytes||RQ,J=G.hmac||((P,...E)=>IT(X,P,w7(...E))),{Fp:Z,Fn:V}=W,{ORDER:U,BITS:Q}=V,{keygen:N,getPublicKey:q,getSharedSecret:A,utils:H,lengths:I}=gu(W,G),w={prehash:!1,lowS:typeof G.lowS==="boolean"?G.lowS:!1,format:void 0,extraEntropy:!1},D="compact";function T(P){let E=U>>VG;return P>E}function x(P,E){if(!V.isValidNot0(E))throw Error(`invalid signature ${P}: out of range 1..Point.Fn.ORDER`);return E}function h(P,E){qz(E);let f=I.signature,r=E==="compact"?f:E==="recovered"?f+1:void 0;return TW(P,r,`${E} signature`)}class ${constructor(P,E,f){if(this.r=x("r",P),this.s=x("s",E),f!=null)this.recovery=f;Object.freeze(this)}static fromBytes(P,E=D){h(P,E);let f;if(E==="der"){let{r:S,s:_}=G4.toSig(TW(P));return new $(S,_)}if(E==="recovered")f=P[0],E="compact",P=P.subarray(1);let r=V.BYTES,o=P.subarray(0,r),B=P.subarray(r,r*2);return new $(V.fromBytes(o),V.fromBytes(B),f)}static fromHex(P,E){return this.fromBytes(IQ(P),E)}addRecoveryBit(P){return new $(this.r,this.s,P)}recoverPublicKey(P){let E=Z.ORDER,{r:f,s:r,recovery:o}=this;if(o==null||![0,1,2,3].includes(o))throw Error("recovery id invalid");if(U*vT<E&&o>1)throw Error("recovery id is ambiguous for h>1 curve");let B=o===2||o===3?f+U:f;if(!Z.isValid(B))throw Error("recovery id 2 or 3 invalid");let S=Z.toBytes(B),_=W.fromBytes(w7(gT((o&1)===0),S)),v=V.inv(B),R=u(f8("msgHash",P)),m=V.create(-R*v),J0=V.create(r*v),U0=W.BASE.multiplyUnsafe(m).add(_.multiplyUnsafe(J0));if(U0.is0())throw Error("point at infinify");return U0.assertValidity(),U0}hasHighS(){return T(this.s)}toBytes(P=D){if(qz(P),P==="der")return IQ(G4.hexFromSig(this));let E=V.toBytes(this.r),f=V.toBytes(this.s);if(P==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return w7(Uint8Array.of(this.recovery),E,f)}return w7(E,f)}toHex(P){return ZG(this.toBytes(P))}assertValidity(){}static fromCompact(P){return $.fromBytes(f8("sig",P),"compact")}static fromDER(P){return $.fromBytes(f8("sig",P),"der")}normalizeS(){return this.hasHighS()?new $(this.r,V.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ZG(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ZG(this.toBytes("compact"))}}let F=G.bits2int||function(P){if(P.length>8192)throw Error("input is too large");let E=qG(P),f=P.length*8-Q;return f>0?E>>BigInt(f):E},u=G.bits2int_modN||function(P){return V.create(F(P))},c=hJ(Q);function p(P){return Du("num < 2^"+Q,P,Y4,c),V.toBytes(P)}function s(P,E){return TW(P,void 0,"message"),E?TW(X(P),void 0,"prehashed message"):P}function y(P,E,f){if(["recovered","canonical"].some((U0)=>(U0 in f)))throw Error("sign() legacy options not supported");let{lowS:r,prehash:o,extraEntropy:B}=Xz(f,w);P=s(P,o);let S=u(P),_=RW(V,E),v=[p(_),p(S)];if(B!=null&&B!==!1){let U0=B===!0?Y(I.secretKey):B;v.push(f8("extraEntropy",U0))}let R=w7(...v),m=S;function J0(U0){let N0=F(U0);if(!V.isValidNot0(N0))return;let $0=V.inv(N0),u0=W.BASE.multiply(N0).toAffine(),q1=V.create(u0.x);if(q1===Y4)return;let g1=V.create($0*V.create(m+q1*_));if(g1===Y4)return;let h0=(u0.x===q1?0:2)|Number(u0.y&VG),S1=g1;if(r&&T(g1))S1=V.neg(g1),h0^=1;return new $(q1,S1,h0)}return{seed:R,k2sig:J0}}function t(P,E,f={}){P=f8("message",P);let{seed:r,k2sig:o}=y(P,E,f);return Ou(X.outputLen,V.BYTES,J)(r,o)}function H0(P){let E=void 0,f=typeof P==="string"||PQ(P),r=!f&&P!==null&&typeof P==="object"&&typeof P.r==="bigint"&&typeof P.s==="bigint";if(!f&&!r)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(r)E=new $(P.r,P.s);else if(f){try{E=$.fromBytes(f8("sig",P),"der")}catch(o){if(!(o instanceof G4.Err))throw o}if(!E)try{E=$.fromBytes(f8("sig",P),"compact")}catch(o){return!1}}if(!E)return!1;return E}function g(P,E,f,r={}){let{lowS:o,prehash:B,format:S}=Xz(r,w);if(f=f8("publicKey",f),E=s(f8("message",E),B),"strict"in r)throw Error("options.strict was renamed to lowS");let _=S===void 0?H0(P):$.fromBytes(f8("sig",P),S);if(_===!1)return!1;try{let v=W.fromBytes(f);if(o&&_.hasHighS())return!1;let{r:R,s:m}=_,J0=u(E),U0=V.inv(m),N0=V.create(J0*U0),$0=V.create(R*U0),u0=W.BASE.multiplyUnsafe(N0).add(v.multiplyUnsafe($0));if(u0.is0())return!1;return V.create(u0.x)===R}catch(v){return!1}}function d(P,E,f={}){let{prehash:r}=Xz(f,w);return E=s(E,r),$.fromBytes(P,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:N,getPublicKey:q,getSharedSecret:A,utils:H,lengths:I,Point:W,sign:t,verify:g,recoverPublicKey:d,Signature:$,hash:X})}function hu(W){let X={a:W.a,b:W.b,p:W.Fp.ORDER,n:W.n,h:W.h,Gx:W.Gx,Gy:W.Gy},G=W.Fp,Y=W.allowedPrivateKeyLengths?Array.from(new Set(W.allowedPrivateKeyLengths.map((V)=>Math.ceil(V/2)))):void 0,J=bJ(X.n,{BITS:W.nBitLength,allowedLengths:Y,modFromBytes:W.wrapPrivateKey}),Z={Fp:G,Fn:J,allowInfinityPoint:W.allowInfinityPoint,endo:W.endo,isTorsionFree:W.isTorsionFree,clearCofactor:W.clearCofactor,fromBytes:W.fromBytes,toBytes:W.toBytes};return{CURVE:X,curveOpts:Z}}function bu(W){let{CURVE:X,curveOpts:G}=hu(W),Y={hmac:W.hmac,randomBytes:W.randomBytes,lowS:W.lowS,bits2int:W.bits2int,bits2int_modN:W.bits2int_modN};return{CURVE:X,curveOpts:G,hash:W.hash,ecdsaOpts:Y}}function mu(W,X){let G=X.Point;return Object.assign({},X,{ProjectivePoint:G,CURVE:Object.assign({},W,ET(G.Fn.ORDER,G.Fn.BITS))})}function fu(W){let{CURVE:X,curveOpts:G,hash:Y,ecdsaOpts:J}=bu(W),Z=vu(X,G),V=uu(Z,Y,J);return mu(W,V)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pu(W,X){let G=(Y)=>fu({...W,hash:Y});return{...G(X),create:G}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var NG={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},cu={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},lu=BigInt(0),sC=BigInt(1),Hz=BigInt(2);function du(W){let X=NG.p,G=BigInt(3),Y=BigInt(6),J=BigInt(11),Z=BigInt(22),V=BigInt(23),U=BigInt(44),Q=BigInt(88),N=W*W*W%X,q=N*N*W%X,A=D5(q,G,X)*q%X,H=D5(A,G,X)*q%X,I=D5(H,Hz,X)*N%X,w=D5(I,J,X)*I%X,D=D5(w,Z,X)*w%X,T=D5(D,U,X)*D%X,x=D5(T,Q,X)*T%X,h=D5(x,U,X)*D%X,$=D5(h,G,X)*q%X,F=D5($,V,X)*w%X,u=D5(F,Y,X)*N%X,c=D5(u,Hz,X);if(!KQ.eql(KQ.sqr(c),W))throw Error("Cannot find square root");return c}var KQ=bJ(NG.p,{sqrt:du}),hT=pu({...NG,Fp:KQ,lowS:!0,endo:cu},Uz),tC={};function DQ(W,...X){let G=tC[W];if(G===void 0){let Y=Uz(HT(W));G=w7(Y,Y),tC[W]=G}return Uz(w7(G,...X))}var Cz=(W)=>W.toBytes(!0).slice(1),HG=(()=>hT.Point)(),Tz=(W)=>W%Hz===lu;function Az(W){let{Fn:X,BASE:G}=HG,Y=RW(X,W),J=G.multiply(Y);return{scalar:Tz(J.y)?Y:X.neg(Y),bytes:Cz(J)}}function bT(W){let X=KQ;if(!X.isValidNot0(W))throw Error("invalid x: Fail if x \u2265 p");let G=X.create(W*W),Y=X.create(G*W+BigInt(7)),J=X.sqrt(Y);if(!Tz(J))J=X.neg(J);let Z=HG.fromAffine({x:W,y:J});return Z.assertValidity(),Z}var gJ=qG;function mT(...W){return HG.Fn.create(gJ(DQ("BIP0340/challenge",...W)))}function eC(W){return Az(W).bytes}function ou(W,X,G=RQ(32)){let{Fn:Y}=HG,J=f8("message",W),{bytes:Z,scalar:V}=Az(X),U=f8("auxRand",G,32),Q=Y.toBytes(V^gJ(DQ("BIP0340/aux",U))),N=DQ("BIP0340/nonce",Q,Z,J),{bytes:q,scalar:A}=Az(N),H=mT(q,Z,J),I=new Uint8Array(64);if(I.set(q,0),I.set(Y.toBytes(Y.create(A+H*V)),32),!fT(I,J,Z))throw Error("sign: Invalid signature produced");return I}function fT(W,X,G){let{Fn:Y,BASE:J}=HG,Z=f8("signature",W,64),V=f8("message",X),U=f8("publicKey",G,32);try{let Q=bT(gJ(U)),N=gJ(Z.subarray(0,32));if(!Nz(N,sC,NG.p))return!1;let q=gJ(Z.subarray(32,64));if(!Nz(q,sC,NG.n))return!1;let A=mT(Y.toBytes(N),Cz(Q),V),H=J.multiplyUnsafe(q).add(Q.multiplyUnsafe(Y.neg(A))),{x:I,y:w}=H.toAffine();if(H.is0()||!Tz(w)||I!==N)return!1;return!0}catch(Q){return!1}}var Mz=(()=>{let W=(G=RQ(48))=>{return ST(G,NG.n)};hT.utils.randomSecretKey;function X(G){let Y=W(G);return{secretKey:Y,publicKey:eC(Y)}}return{keygen:X,getPublicKey:eC,sign:ou,verify:fT,Point:HG,utils:{randomSecretKey:W,randomPrivateKey:W,taggedHash:DQ,lift_x:bT,pointToBytes:Cz,numberToBytesBE:LQ,bytesToNumberBE:qG,mod:C5},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})(),nu=new TextEncoder,iu=new TextDecoder,J4=(W)=>nu.encode(W),kJ=(W)=>iu.decode(W),zz=(W)=>Array.from(W,(X)=>X.toString(16).padStart(2,"0")).join(""),j7=JSON.stringify,OQ=JSON.parse,ru=(W,X=Number.MAX_SAFE_INTEGER)=>W.split("").reduce((G,Y)=>G+Y.charCodeAt(0),0)%X,CQ="AES-GCM",au={},pT="$",cT=",",su=(W)=>{let X=new Uint8Array(W),G=32768,Y="";for(let J=0;J<X.length;J+=32768)Y+=String.fromCharCode(...X.subarray(J,J+32768));return btoa(Y)},tu=(W)=>Uint8Array.from(atob(W),(X)=>X.charCodeAt(0)).buffer,YQ=(W)=>au[W]??=crypto.subtle.digest("SHA-1",J4(W)).then((X)=>{let G=new Uint8Array(X),Y="";for(let J of G)Y+=J.toString(36);return Y}),eu=async(W,X,G)=>{if(!W){let J=await crypto.subtle.digest("SHA-256",J4(`:${X}:${G}`));return crypto.subtle.importKey("raw",J,{name:CQ},!1,["encrypt","decrypt"])}let Y=await crypto.subtle.importKey("raw",J4(W),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:J4(`${X}:${G}`),iterations:1e5,hash:"SHA-256"},Y,{name:CQ,length:256},!1,["encrypt","decrypt"])},Wh=async(W,X)=>{let G=crypto.getRandomValues(new Uint8Array(12)),Y=await W,J=await crypto.subtle.encrypt({name:CQ,iv:G},Y,J4(X));return`${G.join(cT)}${pT}${su(J)}`},Xh=async(W,X)=>{let[G,Y]=X.split(pT);if(!G||!Y)throw Error("Invalid encrypted payload format");let J=Uint8Array.from(G.split(cT),Number),Z=await W,V=await crypto.subtle.decrypt({name:CQ,iv:J},Z,tu(Y));return kJ(V)},O5="GenosRTC",BQ=(W,X)=>Array.from({length:W},X),TQ=(W)=>Array.from(crypto.getRandomValues(new Uint8Array(W)),(X)=>"0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"[X%62]).join(""),w8=typeof sessionStorage<"u"?sessionStorage.__genosrtcId??=TQ(20):TQ(20),YG=Promise.all.bind(Promise),Gh=typeof window<"u",{entries:Yh,fromEntries:lT,keys:ce}=Object,WT=()=>{},u5=(W)=>Error(`GenosRTC: ${W}`),JQ=(...W)=>W.join("@"),Jh=5000,XT="icegatheringstatechange",GT="offer",Zh="answer",Vh=[...BQ(3,(W,X)=>`stun:stun${X||""}.l.google.com:19302`),"stun:stun.cloudflare.com:3478"].map((W)=>({urls:W})),YT=(W,{rtcConfig:X,rtcPolyfill:G,turnConfig:Y})=>{let J=new(G||RTCPeerConnection)({iceServers:[...Vh,...Y||[]],...X}),Z={},V=!1,U=!1,Q,N=(H)=>Object.assign(H,{binaryType:"arraybuffer",bufferedAmountLowThreshold:65535,onmessage:(I)=>Z.data?.(I.data),onopen:()=>Z.connect?.(),onclose:()=>Z.close?.(),onerror:(I)=>!I?.error?.message?.includes("User-Initiated Abort")&&Z.error?.(I)}),q=()=>Promise.race([new Promise((H)=>{let I=()=>{if(J.iceGatheringState==="complete")J.removeEventListener(XT,I),H()};J.addEventListener(XT,I),I()}),new Promise((H)=>setTimeout(H,Jh))]).then(()=>({type:J.localDescription.type,sdp:J.localDescription.sdp.replace(/a=ice-options:trickle\s\n/g,"")}));if(W?N(Q=J.createDataChannel("data")):J.ondatachannel=({channel:H})=>N(Q=H),J.onnegotiationneeded=async()=>{try{V=!0,await J.setLocalDescription(),Z.signal?.(await q())}catch(H){Z.error?.(H)}finally{V=!1}},J.onconnectionstatechange=()=>{if(["disconnected","failed","closed"].includes(J.connectionState))Z.close?.()},J.ontrack=(H)=>{Z.track?.(H.track,H.streams[0]),Z.stream?.(H.streams[0])},J.onremovestream=(H)=>Z.stream?.(H.stream),W&&!J.canTrickleIceCandidates)J.onnegotiationneeded();let A=()=>J.getSenders();return{created:Date.now(),connection:J,get channel(){return Q},get isDead(){return J.connectionState==="closed"},async signal(H){if(Q?.readyState==="open"&&!H.sdp?.includes("a=rtpmap"))return;try{if(H.type===GT){if(V||J.signalingState!=="stable"&&!U){if(W)return;await YG([J.setLocalDescription({type:"rollback"}),J.setRemoteDescription(H)])}else await J.setRemoteDescription(H);await J.setLocalDescription();let I=await q();return Z.signal?.(I),I}if(H.type===Zh){U=!0;try{await J.setRemoteDescription(H)}finally{U=!1}}}catch(I){Z.error?.(I)}},sendData:(H)=>{if(Q?.readyState!=="open")return!1;return Q.send(H),!0},destroy:()=>{Q?.close(),J.close(),V=U=!1},setHandlers:(H)=>Object.assign(Z,H),offerPromise:W?new Promise((H)=>Z.signal=(I)=>I.type===GT&&H(I)):Promise.resolve(),addStream:(H)=>H.getTracks().forEach((I)=>J.addTrack(I,H)),removeStream:(H)=>A().filter((I)=>H.getTracks().includes(I.track)).forEach((I)=>J.removeTrack(I)),addTrack:(H,I)=>J.addTrack(H,I),removeTrack:(H)=>{let I=A().find((w)=>w.track===H);if(I)J.removeTrack(I)},replaceTrack:(H,I)=>A().find((w)=>w.track===H)?.replaceTrack(I)}},Uh=Object.getPrototypeOf(Uint8Array),QQ=12,dT=0,NQ=dT+QQ,qQ=NQ+1,_J=qQ+1,yJ=_J+1,SJ=16384-yJ,ZQ=255,Gz="bufferedamountlow",GG=(W)=>`@_${W}`,JT=GG("ping"),Yz=100,Qh=3,Nh=200,qh=512,Hh=33554432,ZT=async(W,X,G=1/0)=>{let Y=new Blob([W]).stream().pipeThrough(new X("deflate")).getReader(),J=[],Z=0;for(let Q=await Y.read();!Q.done;Q=await Y.read()){if((Z+=Q.value.byteLength)>G)throw Y.cancel(),u5(`inflated payload exceeds ${G} bytes`);J.push(Q.value)}let V=new Uint8Array(Z),U=0;for(let Q of J)V.set(Q,U),U+=Q.byteLength;return V},Ah=(W,X,G,Y,J)=>{let Z=new Map,V=new Map,U=new Map,Q={},N={},q={},A={},H=new Map,I=new Map,w=Promise.resolve(),D=(R,m)=>{if(!H.has(R))H.set(R,new Set);H.get(R).add(m)},T=(R,m)=>H.get(R)?.delete(m),x=(R,...m)=>H.get(R)?.forEach((J0)=>J0(...m)),h=(R,m)=>{let J0=R?Array.isArray(R)?R:[R]:Z.keys();return Array.from(J0,(U0)=>{let N0=Z.get(U0);if(!N0)return console.warn(`${O5}: no peer with id ${U0}`),null;return m(U0,N0)}).filter(Boolean)},$=(R)=>{if(!Z.has(R))return;Z.delete(R),I.delete(R),_.delete(R),delete Q[R],delete N[R],delete q[R],delete A[R],x("peer:leave",R),X(R)},F=(R)=>new Promise((m,J0)=>{let U0=setTimeout(()=>{R.removeEventListener(Gz,N0),J0(Error(`${O5}: bufferLow timeout`))},5000);function N0(){clearTimeout(U0),R.removeEventListener(Gz,N0),m()}R.addEventListener(Gz,N0)}),u=(R)=>{if(U.has(R))return U.get(R);if(!R)throw u5("action type is required");let m=J4(R);if(m.byteLength>QQ)throw u5(`\u274C "${R}" exceeds ${QQ} bytes. Use a shorter name.`);let J0=new Uint8Array(QQ).map((h0,S1)=>m[S1]||0),U0=0,N0=new Map([["message",new Set],["progress",new Set]]),$0=(h0,S1)=>N0.get(h0)?.add(S1),u0=(h0,S1)=>N0.get(h0)?.delete(S1),q1=async(h0,S1,x1,Q0)=>{if(x1&&typeof x1!=="object")throw u5("meta must be object");if(h0===void 0)throw u5("data cannot be undefined");let F0=h0 instanceof Blob,m0=F0||h0 instanceof ArrayBuffer||h0 instanceof Uh,Y0=typeof h0!=="string";if(x1&&!m0)throw u5("meta only allowed with binary");let K0=m0?new Uint8Array(F0?await h0.arrayBuffer():h0):J4(Y0?j7(h0):h0),M0=0;if(!m0&&K0.byteLength>=qh){let X0=await ZT(K0,CompressionStream);if(X0.byteLength<K0.byteLength)K0=X0,M0=1}let k0=x1?J4(j7(x1)):null,L1=Math.ceil(K0.byteLength/SJ)+(x1?1:0)||1;if(L1>Yz)throw u5(`Message too large, exceeds max chunks ${Yz}`);let Q1=BQ(L1,(X0,C0)=>{let x0=C0===L1-1,_1=x1&&C0===0,W8=_1?k0:K0.subarray(x1?(C0-1)*SJ:C0*SJ,x1?C0*SJ:(C0+1)*SJ),C1=new Uint8Array(yJ+W8.byteLength);return C1.set(J0),C1.set([U0],NQ),C1.set([x0|_1<<1|m0<<2|Y0<<3|M0<<4],qQ),C1.set([Math.round((C0+1)/L1*ZQ)],_J),C1.set(W8,yJ),C1});return U0=U0+1&ZQ,YG(h(S1,async(X0,C0)=>{let{channel:x0}=C0;for(let _1=0;_1<L1;_1++){let W8=0;while(x0.bufferedAmount>x0.bufferedAmountLowThreshold){if(W8++>Qh)throw u5(`${O5}: send buffer full, max retries reached for peer ${X0}`);try{await F(x0)}catch(C1){console.warn(C1.message),await new Promise((H1)=>setTimeout(H1,Nh))}}if(!Z.has(X0))break;if(!C0.sendData(Q1[_1]))throw u5(`channel not open for peer ${X0}`);Q0?.(Q1[_1][_J]/ZQ,X0,x1)}}))};V.set(R,{listeners:N0,send:q1});let g1={send:q1,on:$0,off:u0};return U.set(R,g1),g1},c=(R,m)=>{try{I.set(R,Date.now()),_.delete(R);let J0=new Uint8Array(m),U0=kJ(J0.subarray(dT,NQ)).replace(/\x00/g,"");if(!V.has(U0))return console.warn(`${O5}: unregistered type (${U0})`);if(U0===JT){y("",R).catch(()=>{});return}let[N0]=J0.subarray(NQ,qQ),[$0]=J0.subarray(qQ,_J),[u0]=J0.subarray(_J,yJ),q1=J0.subarray(yJ),g1=Boolean($0&1),h0=Boolean($0&2),S1=Boolean($0&4),x1=Boolean($0&8),Q0=Boolean($0&16),F0=V.get(U0),m0=(Q[R]||={})[U0]||={};if(m0[N0]?.chunks?.length>Yz){console.warn(`${O5}: peer ${R} sent too many chunks for nonce ${N0}, ignoring.`);return}let Y0=m0[N0]||={chunks:[]};if(h0)try{Y0.meta=OQ(kJ(q1))}catch{console.warn(`${O5}: failed to parse meta from peer ${R} for type ${U0}`);return}else Y0.chunks.push(q1);if(F0.listeners.get("progress").forEach((M0)=>{try{M0(u0/ZQ,R,Y0.meta)}catch(k0){console.error(k0)}}),!g1)return;let K0=new Uint8Array(Y0.chunks.reduce((M0,k0)=>M0+k0.byteLength,0));Y0.chunks.reduce((M0,k0)=>(K0.set(k0,M0),M0+k0.byteLength),0),delete m0[N0],w=w.then(async()=>{let M0=Q0?await ZT(K0,DecompressionStream,Hh):K0,k0;if(S1)k0=M0;else if(x1)try{k0=OQ(kJ(M0))}catch{console.warn(`${O5}: failed to parse JSON message data from peer ${R} for type ${U0}`);return}else k0=kJ(M0);F0.listeners.get("message").forEach((L1)=>{try{L1(k0,R,Y0.meta)}catch(Q1){console.error(Q1)}})}).catch((M0)=>console.error(`${O5}: dispatch error from peer ${R}:`,M0))}catch(J0){console.error(`${O5}: error handling data from peer ${R}:`,J0)}},p=async()=>{try{await r(""),await new Promise((R)=>setTimeout(R,99))}catch(R){console.warn(`${O5}: error sending leave`,R)}for(let[R,m]of Z){try{m.destroy()}catch{}Z.delete(R)}clearInterval(v),G()},{send:s}=u(JT),{send:y,on:t}=u(GG("pong")),{send:H0,on:g}=u(GG("signal")),{send:d,on:P}=u(GG("stream")),{send:E,on:f}=u(GG("track")),{send:r,on:o}=u(GG("leave"));W((R,m)=>{let J0=Z.get(m);if(J0===R)return;if(J0){let U0=()=>{};J0.setHandlers({data:U0,stream:U0,track:U0,signal:U0,close:U0,error:U0})}Z.set(m,R),I.set(m,Date.now()),_.delete(m),R.setHandlers({data:(U0)=>c(m,U0),stream:(U0)=>{x("stream:add",U0,m,q[m]),delete q[m]},track:(U0,N0)=>{x("track:add",U0,N0,m,A[m]),delete A[m]},signal:(U0)=>H0(U0,m),close:()=>$(m),error:(U0)=>{console.error(`${O5}: peer error for ${m}`,U0),$(m)}}),x("peer:join",m,Y?.(m))}),J?.((R,m,J0)=>x(J0?"peer:seen":"peer:lost",R,m)),t("message",(R,m)=>{N[m]?.(),delete N[m]}),g("message",(R,m)=>Z.get(m)?.signal(R)),P("message",(R,m)=>q[m]=R),f("message",(R,m)=>A[m]=R),o("message",(R,m)=>$(m));let B=1e4,S=20000,_=new Map,v=setInterval(()=>{let R=Date.now();for(let[m,J0]of Z){if(R-(I.get(m)??R)<=B)continue;let U0=_.get(m);if(U0===void 0)_.set(m,R),s("",m).catch(()=>{});else if(R-U0>S){_.delete(m);try{J0.destroy()}catch{}$(m)}}},5000);if(Gh)addEventListener("beforeunload",p);return{on:D,off:T,channel:u,leave:p,ping:async(R)=>{if(!R)throw u5("ping() requires target peer ID");let m=Date.now();return s("",R),await new Promise((J0)=>N[R]=J0),Date.now()-m},getPeers:()=>lT(Array.from(Z,([R,m])=>[R,m.connection])),addStream:(R,m,J0)=>h(m,async(U0,N0)=>{if(J0)await d(J0,U0);N0.addStream(R)}),removeStream:(R,m)=>h(m,(J0,U0)=>U0.removeStream(R)),addTrack:(R,m,J0,U0)=>h(J0,async(N0,$0)=>{if(U0)await E(U0,N0);$0.addTrack(R,m)}),removeTrack:(R,m)=>h(m,(J0,U0)=>U0.removeTrack(R)),replaceTrack:(R,m,J0,U0)=>h(J0,async(N0,$0)=>{if(U0)await E(U0,N0);$0.replaceTrack(R,m)})}},zh=5,Ih=10,wh=2500,VQ=57333,jh=({init:W,subscribe:X,announce:G,bye:Y})=>{let J={},Z=!1,V,U;return(Q,N,q)=>{let{appId:A}=Q;if(J[A]?.[N])return J[A][N];if(!Q||!N||!A&&!Q.firebaseApp)throw u5(!Q?"config required":!N?"roomId required":"appId missing");let H=WT,I=WT;if(!Z){let _=W(Q);U=BQ(zh,()=>{try{return YT(!0,Q)}catch{return null}}).filter(Boolean),V=Array.isArray(_)?_:[_];let v=setInterval(()=>{U=U.filter((R)=>{let m=Date.now()-R.created<VQ;if(!m)R.destroy();return m})},VQ);J.offerCleanupTimer||=v,Z=!0}let w={},D={},T=new Map,x=new Map,h=new Map,$={},F=JQ(O5,A,N),u=YQ(F),c=YQ(JQ(F,w8)),p=eu(Q.password||"",A,N),s=(_)=>async(v)=>({type:v.type,sdp:await _(p,v.sdp)}),y=s(Xh),t=s(Wh),H0=(_)=>{return setTimeout(()=>{if(!_.isDead&&!Object.values(D).includes(_))_.destroy()},VQ),_},g=(_)=>{try{return H0(YT(_,Q))}catch{return null}},d=(_,v)=>{if(D[v]===_)return;_.connectedAt=Date.now(),D[v]?.destroy(),D[v]=_,H(_,v),w[v]?.forEach((R)=>R!==_&&R.destroy()),delete w[v]},P=(_,v)=>{if(D[v]===_)delete D[v]},E=(_)=>async(v,R,m)=>{let[J0,U0]=await YG([u,c]);if(v!==J0&&v!==U0)return;let{peerId:N0,offer:$0,answer:u0,type:q1,bye:g1}=typeof R==="string"?OQ(R):R;if(g1){if(N0&&N0!==w8)x.delete(N0),I(N0,null,!1),h.set(N0,Date.now()),delete $[N0];return}if(N0&&N0!==w8)I(N0,q1,!0),x.set(N0,Date.now()),h.delete(N0);if(q1&&N0)$[N0]=q1;if(N0===w8)return;if(D[N0]){let h0=D[N0].channel?.readyState==="open";if(!$0||h0||Date.now()-D[N0].connectedAt<2000)return;D[N0].destroy(),delete D[N0]}if(Q.admit&&!Q.admit(N0))return;if($0){if(w[N0]?.[_]&&w8>N0)return;let h0=g(!1);if(!h0)return;h0.setHandlers({connect:()=>d(h0,N0),close:()=>P(h0,N0)});try{let S1=await y($0);if(h0.isDead)return;let[x1,Q0]=await YG([YQ(JQ(F,N0)),h0.signal(S1).then(t)]);m(x1,j7({peerId:w8,answer:Q0,...Q.type&&{type:Q.type}}))}catch{q?.({error:"decryption failed (offer)",appId:A,peerId:N0,roomId:N})}}else if(u0){let h0=w[N0]?.[_];if(!h0||h0.isDead)return;h0.setHandlers({connect:()=>d(h0,N0),close:()=>P(h0,N0)});try{h0.signal(await y(u0))}catch{q?.({error:"decryption failed (answer)",appId:A,peerId:N0,roomId:N})}}else{let h0=w[N0]||=[];if(h0.forEach((Q0,F0)=>{if(Q0&&(Q0.isDead||Date.now()-(Q0.dialedAt??Q0.created)>VQ)){if(Q0.isDead)T.set(N0,Date.now()+30000);Q0.destroy(),delete h0[F0]}}),h0[_]||h0.filter(Boolean).length>=2||T.get(N0)>Date.now())return;if(Object.values(w).reduce((Q0,F0)=>Q0+F0.filter((m0)=>m0&&!m0.isDead).length,0)>=Ih)return;let S1=U.pop(),x1=S1?H0(S1):g(!0);if(!x1){T.set(N0,Date.now()+30000);return}x1.dialedAt=Date.now(),h0[_]=x1;try{let[Q0,{offer:F0}]=await YG([YQ(JQ(F,N0)),x1.offerPromise.then(t).then((m0)=>({offer:m0}))]);x1.setHandlers({connect:()=>d(x1,N0),close:()=>P(x1,N0)}),m(Q0,j7({peerId:w8,offer:F0,...Q.type&&{type:Q.type}}))}catch{if(h0[_]===x1)delete h0[_];x1.destroy()}}},f=[],r=[],o=[],B=()=>o.forEach(({relay:_,rootTopic:v})=>Y?.(_,v));V.forEach(async(_,v)=>{let R=await _;if(!R)return;let[m,J0]=await YG([u,c]);r[v]=X(R,m,J0,E(v)),o.push({relay:R,rootTopic:m});let U0=async()=>{let N0=await G(R,m,J0);f[v]=setTimeout(U0,typeof N0==="number"?N0:wh)};U0()}),J[A]||={};let S=Ah((_)=>H=_,(_)=>delete D[_],()=>S.onCleanup?.(),(_)=>$[_],(_)=>I=_);if(typeof window<"u")window.addEventListener("pagehide",B);return S.onCleanup=()=>{if(B(),typeof window<"u")window.removeEventListener("pagehide",B);if(delete J[A][N],f.forEach(clearTimeout),r.forEach((_)=>_?.()),Object.keys(J).length===0)clearInterval(J.offerCleanupTimer),delete J.offerCleanupTimer},S._census=()=>{for(let v of Object.keys(D))x.set(v,Date.now());let _=Date.now()-120000;for(let[v,R]of x)if(R<_)x.delete(v);return[...x.keys()]},S._gone=()=>{let _=Date.now()-60000;for(let[v,R]of h)if(R<_)h.delete(v);return[...h.keys()]},J[A][N]=S}},VT=3333,Kh=30000,xJ={},oT={},Dh=(W,X)=>{let G={},Y=null;G.reopenHandlers=new Set;let J=()=>{if(Y)clearTimeout(Y),Y=null;if(G.socket)G.socket.onclose=null,G.socket.close();let Z=new WebSocket(W);Z.onclose=()=>{xJ[W]??=VT,Y=setTimeout(J,xJ[W]),xJ[W]=Math.min(xJ[W]*2,Kh)},Z.onmessage=(V)=>X(V.data),G.socket=Z,G.url=Z.url,G.ready=new Promise((V)=>{Z.onopen=()=>{xJ[W]=VT,V(G),G.reopenHandlers.forEach((U)=>U())}}),G.send=(V)=>{if(Z.readyState===1)Z.send(V)}};return G.forceReconnect=J,J(),oT[W]=G,G};if(typeof window<"u"){let W=(X)=>{JG.info("\u26A1 [GenosRTC] Network event detected. Forcing reconnection\u2026"),Object.values(oT).forEach((G)=>{if(G.socket&&G.socket.readyState!==WebSocket.OPEN&&(X||G.socket.readyState!==WebSocket.CONNECTING))G.forceReconnect()})};window.addEventListener("online",()=>{JG.info("\u2705 Reconnected to the network."),W(!0)}),window.addEventListener("offline",async()=>{JG.info("\u274C Disconnected from the network.")}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible")W()})}var Oh=(W)=>()=>lT(Yh(W).map(([X,G])=>[X,G.socket])),UG={},Ch=10,nT="x",iT="EVENT",Th=/pow:\s*(\d+)\s*bits needed\.?/i,HQ=new Set,rT=Mz.utils.randomSecretKey(),Mh=zz(Mz.getPublicKey(rT)),Pz={},vJ={},Ph={},aT=()=>Math.floor(Date.now()/1000),sT=(W)=>Ph[W]??=ru(W,1e4)+20000,uJ=(W)=>W.replace(/\/$/,""),Rh="https://cdn.jsdelivr.net/gh/estebanrfp/gdb@main/relays.json",tT=(W)=>Array.isArray(W)?[...new Set(W.filter((X)=>X?.startsWith?.("wss://")))]:[],eT="genosrtc_relays",Lh=()=>{try{return tT(JSON.parse(globalThis.localStorage?.getItem(eT)))}catch{return[]}},Bh=()=>fetch(`${Rh}?r=${Math.random().toString(36).slice(2)}`,{signal:AbortSignal.timeout(5000)}).then((W)=>W.json()).then(tT).then((W)=>(W.length&&globalThis.localStorage?.setItem(eT,JSON.stringify(W)),W)).catch(()=>[]).then((W)=>(W=W.length?W:Lh(),W.length||JG.warn("\u26A0\uFE0F [GenosRTC] Relay list unreachable - Pass rtc.relayUrls to override."),W)),Eh=(W,X)=>{let[G,Y,J,Z]=OQ(X);if(G===iT)return vJ[Y]?.(Pz[Y],J.content);if(G==="NOTICE"||G==="OK"&&!J){if(+((G==="NOTICE"?Y:Z).match(Th)?.[1]??0)>0){let V=uJ(W);HQ.add(V),UG[V]?.close?.(),delete UG[V]}}},$h=(W)=>{let X=uJ(W);if(UG[X])return UG[X];let G=Dh(X,(Y)=>Eh(X,Y));return UG[X]=G},Jz=async(W,X)=>{let G={kind:sT(W),content:X,pubkey:Mh,created_at:aT(),tags:[[nT,W]]},Y=J4(j7([0,G.pubkey,G.created_at,G.kind,G.tags,G.content])),J=new Uint8Array(await crypto.subtle.digest("SHA-256",Y)),Z=Mz.sign(J,rT);return j7([iT,{...G,id:zz(J),sig:zz(Z)}])},UT=(W,X)=>{return Pz[W]=X,j7(["REQ",W,{kinds:[sT(X)],since:aT(),["#"+nT]:[X]}])},QT=(W)=>{return delete Pz[W],j7(["CLOSE",W])},WM=jh({init:(W)=>{let X=W?.relayUrls?.length?W.relayUrls:null,G=X?Promise.resolve(X):Bh(),Y=X?.length??W.relayRedundancy??Ch;return BQ(Y,(J,Z)=>G.then((V)=>{let U=V[Z]&&$h(V[Z]);return U?U.ready.then(()=>U).catch(()=>null):null}))},subscribe:(W,X,G,Y)=>{let J=TQ(64),Z=TQ(64);vJ[J]=vJ[Z]=(U,Q)=>Y(U,Q,async(N,q)=>{if(HQ.has(uJ(W.url)))return;W.send(await Jz(N,q))});let V=()=>{W.send(UT(J,X)),W.send(UT(Z,G))};return V(),W.reopenHandlers.add(V),()=>{W.reopenHandlers.delete(V),W.send(QT(J)),W.send(QT(Z)),delete vJ[J],delete vJ[Z]}},announce:async(W,X)=>{if(HQ.has(uJ(W.url)))return;W.send(await Jz(X,j7({peerId:w8})))},bye:async(W,X)=>{if(HQ.has(uJ(W.url)))return;W.send(await Jz(X,j7({peerId:w8,bye:1})))}}),le=Oh(UG),Fh={cellSize:10},Sh=5000,xh=3000,kh=2000,_h=2000,yh=1e4,vh=30000,gh=5000,uh=30000,MQ=(W)=>{let X=String(W||"").match(/cell-(\d+)/);return X?Number(X[1]):null},Zz=(W,X)=>{let G=MQ(W);if(G==null)return[];let Y=[];for(let J=1;J<X;J*=2){if(G-J>=0)Y.push(`cell-${G-J}`);if(G+J<X)Y.push(`cell-${G+J}`)}return Y},UQ=(W)=>`c${(MQ(W)||0).toString(36)}`,hh=10,bh=(W,X)=>{let G=+X.cellSize>=2?X.cellSize|0:hh;return Math.max(1,Math.ceil(W/G))},XM=(W)=>{let X=0;for(let G=0;G<W.length;G++)X=Math.imul(X^W.charCodeAt(G),2654435761);return X>>>0},A6=(W,X)=>{let G=0,Y=-1;for(let J=0;J<X;J++){let Z=XM(`${W}:${J}`);if(Z>Y)Y=Z,G=J}return G};function mh(W,X={},G={}){let Y={...Fh,...X},J=1,Z={epoch:0,roster:[w8],set:new Set([w8]),key:w8,C:1,cellId:null,isBridge:!1,bridges:[],edgeBridges:[]},V={cellId:null},U=0,Q=0,N="",q=0,A=0,H=0,I=null,w=null,D=null,T=new Map,x=new Set,h=new Map,$=new Set,F=0,u=new Set,c=new Map,p=()=>Math.min(150,Math.ceil(Math.log2(Z.C+1))*2+3),s=(Q0)=>Zz(Q0,Z.C),y=W.on?.bind(W),t=W.off?.bind(W);if(y)W.on=(Q0,F0)=>String(Q0).startsWith("mesh:")?d(Q0,F0):y(Q0,F0);if(t)W.off=(Q0,F0)=>String(Q0).startsWith("mesh:")?h.get(Q0)?.delete(F0):t(Q0,F0);let H0=(Q0)=>(x.add(Q0),()=>x.delete(Q0)),g=(Q0,F0)=>{for(let m0 of x)try{m0(Q0,F0)}catch(Y0){JG.error("\uD83D\uDD78\uFE0F [Cells] Error in deliver handler:",Y0)}},d=(Q0,F0)=>{if(!h.has(Q0))h.set(Q0,new Set);return h.get(Q0).add(F0),()=>h.get(Q0)?.delete(F0)},P=(Q0,...F0)=>{let m0=h.get(Q0);if(m0)for(let Y0 of m0)try{Y0(...F0)}catch{}},E=(Q0)=>{try{return typeof Q0==="string"?JSON.parse(Q0):Q0}catch{return null}},f=()=>`${w8}:${Date.now().toString(36)}:${(F++&65535).toString(36)}`,r=()=>{if($.size>Sh)$.delete($.values().next().value)},o=()=>[...new Set([...W._census(),w8])].sort(),B=(Q0,F0,m0)=>F0.filter((Y0)=>A6(Y0,m0)===Q0),S=(Q0,F0,m0)=>{if(Q0==null)return null;let Y0=(k0)=>XM(`${k0}@${Q0}`),K0=null,M0=-1;for(let k0 of B(Q0,F0,m0)){let L1=Y0(k0);if(L1>M0)M0=L1,K0=k0}return K0},_=(Q0)=>{let F0=Z.audience?.get(Q0);if(!F0)return[];return Object.keys(W.getPeers?.()||{}).filter((m0)=>F0.has(m0))},v=(Q0,F0)=>{if(Q0!==w&&!(Z.isBridge&&Z.bridges.some((x0)=>UQ(x0)===Q0)))return;let m0=E(F0);if(!m0?.id||!m0?.t)return;if($.has(m0.id))return;$.add(m0.id),r();let{t:Y0,id:K0,ttl:M0,data:k0,origin:L1,originCell:Q1}=m0,X0=Z.cellId;if(Y0==="ping"&&k0?.pingId&&k0.target===w8&&L1!==w8){let x0={t:"pong",id:f(),ttl:p(),data:{pingId:k0.pingId,receivedAt:Date.now()},origin:w8,originCell:X0},_1=W.getPeers?.()?.[L1]?[L1]:_(X0);I?.send(JSON.stringify(x0),_1)}if(Y0==="pong"&&k0?.pingId){let x0=c.get(k0.pingId);if(x0)clearTimeout(x0.timeout),x0.resolve(Date.now()-x0.start),c.delete(k0.pingId)}if(Y0==="msg"&&L1!==w8)g(k0,L1);if(!Z.isBridge)return;if((M0??0)<=0)return;let C0=(x0,_1,W8=null)=>{if(!x0||!_1.length)return;let C1={t:Y0,id:K0,ttl:W8??(M0??p())-1,data:k0,origin:L1||w8,originCell:Q1||X0};x0.send(JSON.stringify(C1),_1)};if(Q0===w){for(let x0 of s(X0))C0(R(x0),_(x0));return}C0(I,_(X0));for(let x0 of s(X0))if(UQ(x0)!==Q0)C0(R(x0),_(x0))},R=(Q0)=>{let F0=UQ(Q0),m0=W.channel(F0);if(!u.has(F0))u.add(F0),m0.on("message",(Y0)=>v(F0,Y0));return m0},m=()=>{if(!Z.cellId)return;if(w=UQ(Z.cellId),I=W.channel(w),!u.has(w))u.add(w),I.on("message",(Q0)=>v(w,Q0));if(Z.isBridge)for(let Q0 of s(Z.cellId))R(Q0)},J0=(Q0,F0)=>{if(!Q0.cellId||!Q0.set.has(F0))return!1;let m0=`cell-${A6(F0,Q0.C)}`;return m0===Q0.cellId||Q0.bridges.includes(m0)||Zz(m0,Q0.C).includes(Q0.cellId)&&S(A6(F0,Q0.C),Q0.roster,Q0.C)===F0},U0=(Q0)=>Z.set.size<2&&(V.set?.size??0)<2||J0(Z,Q0)||Date.now()<U&&J0(V,Q0),N0=()=>{let Q0=W.getPeers?.()||{};for(let F0 of Object.keys(Q0))if(!U0(F0))Q0[F0].close?.()};G.admit=U0;let $0=()=>({epoch:Z.epoch,cellId:Z.cellId,isBridge:Z.isBridge,bridges:Z.bridges,roster:[...Z.roster],cellSize:J,dynamicTTL:p(),totalCells:Z.C}),u0=()=>{A=Date.now();for(let[Q0,F0]of T){if(Q0===w8)continue;P("mesh:peer-state",{id:Q0,cell:F0.cell,bridges:F0.bridges,timestamp:A})}},q1=(Q0)=>{let F0=bh(Q0.length,Y);J=Math.ceil(Q0.length/F0);let m0=`cell-${A6(w8,F0)}`,Y0=new Map,K0=new Set,M0=new Map,k0=(x0)=>M0.get(x0)??M0.set(x0,new Set).get(x0);for(let x0 of Q0)k0(`cell-${A6(x0,F0)}`).add(x0);let L1=new Map,Q1=(x0)=>L1.has(x0)?L1.get(x0):L1.set(x0,S(x0,Q0,F0)).get(x0);for(let x0 of new Set(Q0.map((_1)=>A6(_1,F0)))){let _1=`cell-${x0}`;for(let W8 of Zz(_1,F0)){if(MQ(W8)<x0)continue;for(let C1 of[Q1(x0),Q1(MQ(W8))]){if(!C1)continue;let H1=`cell-${A6(C1,F0)}`===_1?W8:_1,l=Y0.get(C1)??[];if(!l.includes(H1))l.push(H1);if(Y0.set(C1,l),k0(_1).add(C1),k0(W8).add(C1),_1===m0||W8===m0)K0.add(C1)}}}let X0=Y0.get(w8)??[],C0=Z.cellId!==m0||String(Z.bridges)!==String(X0);V=Z,Z={epoch:Z.epoch+1,roster:Q0,set:new Set(Q0),key:Q0.join("|"),C:F0,cellId:m0,isBridge:X0.length>0,bridges:X0,edgeBridges:[...K0],audience:M0},H=Date.now(),T.clear();for(let x0 of Q0){let _1=Y0.get(x0)??[];T.set(x0,{cell:`cell-${A6(x0,F0)}`,isBridge:_1.length>0,bridges:_1})}if(U=Date.now()+gh,C0)m();JG.info("\uD83D\uDD78\uFE0F [Cells] seal",{epoch:Z.epoch,myCell:m0,bridges:X0,C:F0,roster:Q0.length}),u0(),P("mesh:state",$0())},g1=()=>{let Q0=o(),F0=Q0.join("|");if(F0===Z.key)Q=0;else{let m0=Date.now();if(Q||=m0,F0!==N)N=F0,q=m0;if(Q0.some((Y0)=>!Z.set.has(Y0))||Z.edgeBridges.some((Y0)=>!Q0.includes(Y0))||(W._gone?.()??[]).some((Y0)=>Z.set.has(Y0))?m0-q>=_h||m0-Q>=yh:m0-Q>=vh)Q=0,q1(Q0)}if(U&&Date.now()>=U)U=0,N0()},h0=()=>{if(D)return;D=setInterval(()=>{if(g1(),Date.now()-A>=uh)u0()},kh)},S1=()=>{if(D)clearInterval(D),D=null},x1=(Q0)=>{return new Promise((F0,m0)=>{let Y0=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,K0=Date.now(),M0=setTimeout(()=>{c.delete(Y0),m0(Error("Ping timeout"))},xh);c.set(Y0,{start:K0,resolve:F0,reject:m0,timeout:M0,peerId:Q0});let k0={t:"ping",id:f(),ttl:p(),data:{pingId:Y0,target:Q0},origin:w8,originCell:Z.cellId};I?.send(JSON.stringify(k0),_(Z.cellId))})};return W.on?.("peer:join",()=>g1()),W.on?.("peer:leave",()=>g1()),q1(o()),h0(),{send:(Q0)=>{let F0={t:"msg",id:f(),ttl:p(),data:Q0,origin:w8,originCell:Z.cellId},m0=JSON.stringify(F0);I.send(m0,_(Z.cellId)),v(w,m0)},on:(Q0,F0)=>Q0==="message"?H0(F0):void 0,ping:x1,getState:()=>({...$0(),knownCells:new Set([...T.values()].map((Q0)=>Q0.cell)).size}),getPeerInfo:()=>new Map(T),getStableRoster:()=>[...Z.roster],getKnownCells:()=>{let Q0=new Map;for(let[F0,{cell:m0}]of T)if(!Q0.has(m0))Q0.set(m0,{lastSeen:H,peerId:F0});return Q0},getCellSize:()=>J,destroy:()=>{S1(),c.forEach((Q0)=>clearTimeout(Q0.timeout)),c.clear()}}}function fh(W,X,G){let Y={},J=WM({...W,admit:(Q)=>Y.admit?.(Q)??!0},X,G),Z=W.overlay||{},V=mh(J,Z,Y),U=new Map;return{on:(Q,N)=>J.on(Q,N),off:(Q,N)=>J.off?.(Q,N),channel:(Q)=>{if(U.has(Q))return U.get(Q);let N=J.channel(Q),q={send:(A,H)=>{if(H){let I=[].concat(H),w=J.getPeers?.()||{};if(I.every((D)=>w[D]))return N.send(A,H)}V.send({_ch:Q,_d:A,_t:H})},on:(A,H)=>{if(A==="message")V.on("message",(I,w)=>{if(I?._ch!==Q)return;if(I._t&&![].concat(I._t).includes(w8))return;H(I._d,w)}),N.on(A,H);else N.on(A,H)},off:(A,H)=>N.off?.(A,H),_original:N};return U.set(Q,q),q},get id(){return J.id},get peers(){return J.peers},getPeers:()=>J.getPeers?.()||{},mesh:V,_room:J,getState:()=>V.getState(),getPeerInfo:()=>V.getPeerInfo(),ping:(Q)=>V.ping(Q),leave:()=>{V.destroy(),U.clear(),J.leave()},destroy:()=>{V.destroy(),U.clear()}}}var Rz=(W,X,G)=>W?.cells||W?.overlay?fh(W,X,G):WM(W,X,G);import{randomBytes as C2}from"crypto";function ph(){var W,X=!1,G=this;G._DeArray=function(Y,J,Z){return[Y.slice(J,J+Z)]},G._EnArray=function(Y,J,Z,V){for(var U=0;U<Z;Y[J+U]=V[U]?V[U]:0,U++);},G._DeChar=function(Y,J){return String.fromCharCode(Y[J])},G._EnChar=function(Y,J,Z){Y[J]=Z.charCodeAt(0)},G._DeInt=function(Y,J){var Z=X?W.len-1:0,V=X?-1:1,U=Z+V*W.len,Q,N,q;for(Q=0,N=Z,q=1;N!=U;Q+=Y[J+N]*q,N+=V,q*=256);if(W.bSigned&&Q&Math.pow(2,W.len*8-1))Q-=Math.pow(2,W.len*8);return Q},G._EnInt=function(Y,J,Z){var V=X?W.len-1:0,U=X?-1:1,Q=V+U*W.len,N;Z=Z<W.min?W.min:Z>W.max?W.max:Z;for(N=V;N!=Q;Y[J+N]=Z&255,N+=U,Z>>=8);},G._DeString=function(Y,J,Z){for(var V=Array(Z),U=0;U<Z;V[U]=String.fromCharCode(Y[J+U]),U++);return V.join("")},G._EnString=function(Y,J,Z,V){for(var U,Q=0;Q<Z;Y[J+Q]=(U=V.charCodeAt(Q))?U:0,Q++);},G._De754=function(Y,J){var Z,V,U,Q,N,q,A,H,I,w;A=W.mLen,H=W.len*8-W.mLen-1,w=(1<<H)-1,I=w>>1,Q=X?0:W.len-1,N=X?1:-1,Z=Y[J+Q],Q+=N,q=-7;for(V=Z&(1<<-q)-1,Z>>=-q,q+=H;q>0;V=V*256+Y[J+Q],Q+=N,q-=8);for(U=V&(1<<-q)-1,V>>=-q,q+=A;q>0;U=U*256+Y[J+Q],Q+=N,q-=8);switch(V){case 0:V=1-I;break;case w:return U?NaN:(Z?-1:1)*(1/0);default:U=U+Math.pow(2,A),V=V-I;break}return(Z?-1:1)*U*Math.pow(2,V-A)},G._En754=function(Y,J,Z){var V,U,Q,N,q,A,H,I,w,D;if(H=W.mLen,I=W.len*8-W.mLen-1,D=(1<<I)-1,w=D>>1,V=Z<0?1:0,Z=Math.abs(Z),isNaN(Z)||Z==1/0)Q=isNaN(Z)?1:0,U=D;else{if(U=Math.floor(Math.log(Z)/Math.LN2),Z*(A=Math.pow(2,-U))<1)U--,A*=2;if(U+w>=1)Z+=W.rt/A;else Z+=W.rt*Math.pow(2,1-w);if(Z*A>=2)U++,A/=2;if(U+w>=D)Q=0,U=D;else if(U+w>=1)Q=(Z*A-1)*Math.pow(2,H),U=U+w;else Q=Z*Math.pow(2,w-1)*Math.pow(2,H),U=0}for(N=X?W.len-1:0,q=X?-1:1;H>=8;Y[J+N]=Q&255,N+=q,Q/=256,H-=8);for(U=U<<H|Q,I+=H;I>0;Y[J+N]=U&255,N+=q,U/=256,I-=8);Y[J+N-q]|=V*128},G._DeInt64=function(Y,J){var Z=X?0:7,V=X?1:-1,U=Z+V*8,Q=[0,0,!W.bSigned],N,q,A;for(N=Z,A=1,q=0;N!=U;Q[A]=(Q[A]<<8>>>0)+Y[J+N],N+=V,q++,A=q<4?1:0);return Q},G._EnInt64=function(Y,J,Z){var V=X?0:7,U=X?1:-1,Q=V+U*8,N,q,A,H;for(N=V,A=1,q=0,H=24;N!=Q;Y[J+N]=Z[A]>>H&255,N+=U,q++,A=q<4?1:0,H=24-8*(q%4));},G._sPattern="(\\d + )?([AxcbBhHsfdiIlLqQ])",G._lenLut={A:1,x:1,c:1,b:1,B:1,h:2,H:2,s:1,f:4,d:8,i:4,I:4,l:4,L:4,q:8,Q:8},G._elLut={A:{en:G._EnArray,de:G._DeArray},s:{en:G._EnString,de:G._DeString},c:{en:G._EnChar,de:G._DeChar},b:{en:G._EnInt,de:G._DeInt,len:1,bSigned:!0,min:-Math.pow(2,7),max:Math.pow(2,7)-1},B:{en:G._EnInt,de:G._DeInt,len:1,bSigned:!1,min:0,max:Math.pow(2,8)-1},h:{en:G._EnInt,de:G._DeInt,len:2,bSigned:!0,min:-Math.pow(2,15),max:Math.pow(2,15)-1},H:{en:G._EnInt,de:G._DeInt,len:2,bSigned:!1,min:0,max:Math.pow(2,16)-1},i:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},I:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},l:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},L:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},f:{en:G._En754,de:G._De754,len:4,mLen:23,rt:Math.pow(2,-24)-Math.pow(2,-77)},d:{en:G._En754,de:G._De754,len:8,mLen:52,rt:0},q:{en:G._EnInt64,de:G._DeInt64,bSigned:!0},Q:{en:G._EnInt64,de:G._DeInt64,bSigned:!1}},G._UnpackSeries=function(Y,J,Z,V){for(var U=W.de,Q=[],N=0;N<Y;Q.push(U(Z,V+N*J)),N++);return Q},G._PackSeries=function(Y,J,Z,V,U,Q){for(var N=W.en,q=0;q<Y;N(Z,V+q*J,U[Q+q]),q++);},G.Unpack=function(Y,J,Z){X=Y.charAt(0)!="<",Z=Z?Z:0;var V=new RegExp(this._sPattern,"g"),U,Q,N,q=[];while(U=V.exec(Y)){if(Q=U[1]==null||U[1]==""?1:parseInt(U[1]),N=this._lenLut[U[2]],Z+Q*N>J.length)return;switch(U[2]){case"A":case"s":q.push(this._elLut[U[2]].de(J,Z,Q));break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":W=this._elLut[U[2]],q.push(this._UnpackSeries(Q,N,J,Z));break}Z+=Q*N}return Array.prototype.concat.apply([],q)},G.PackTo=function(Y,J,Z,V){X=Y.charAt(0)!="<";var U=new RegExp(this._sPattern,"g"),Q,N,q,A,H=0;while(Q=U.exec(Y)){if(N=Q[1]==null||Q[1]==""?1:parseInt(Q[1]),q=this._lenLut[Q[2]],Z+N*q>J.length)return!1;switch(Q[2]){case"A":case"s":if(H+1>V.length)return!1;this._elLut[Q[2]].en(J,Z,N,V[H]),H+=1;break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":if(W=this._elLut[Q[2]],H+N>V.length)return!1;this._PackSeries(N,q,J,Z,V,H),H+=N;break;case"x":for(A=0;A<N;A++)J[Z+A]=0;break}Z+=N*q}return J},G.Pack=function(Y,J){return this.PackTo(Y,Array(this.CalcLength(Y)),0,J)},G.CalcLength=function(Y){var J=new RegExp(this._sPattern,"g"),Z=0,V;while(V=J.exec(Y))Z+=(V[1]==null||V[1]==""?1:parseInt(V[1]))*this._lenLut[V[2]];return Z}}var X8=new ph;var x2=m1(HM(),1),AH=m1(uz(),1);import{createSocket as pd}from"dgram";import{createSocket as dd}from"dgram";import*as k2 from"net";import{connect as od}from"net";import{createSign as id,randomBytes as rd,webcrypto as ad}from"crypto";var FN0=m1(bM(),1);var R7={};zA(R7,{verifySchema:()=>Wf,fromBER:()=>N4,compareSchema:()=>Z4,VisibleString:()=>FW,ViewWriter:()=>dJ,VideotexString:()=>RG,ValueBlock:()=>X9,Utf8String:()=>b5,UniversalString:()=>CG,UTCTime:()=>SW,TimeOfDay:()=>eQ,TeletexString:()=>PG,TIME:()=>GN,Set:()=>p9,Sequence:()=>y9,Repeated:()=>wG,RelativeObjectIdentifier:()=>sQ,RawData:()=>SP,PrintableString:()=>MG,Primitive:()=>D6,OctetString:()=>M7,ObjectIdentifier:()=>DG,NumericString:()=>TG,Null:()=>T7,Integer:()=>O6,IA5String:()=>LG,HexBlock:()=>C7,GraphicString:()=>BG,GeneralizedTime:()=>FG,GeneralString:()=>EG,Enumerated:()=>KG,EndOfContent:()=>rQ,Duration:()=>XN,DateTime:()=>WN,DEFAULT_MAX_NODES:()=>tM,DEFAULT_MAX_DEPTH:()=>sM,DEFAULT_MAX_CONTENT_LENGTH:()=>eM,DATE:()=>tQ,Constructed:()=>l8,Choice:()=>nJ,CharacterString:()=>$G,Boolean:()=>jG,BmpString:()=>OG,BitString:()=>P7,BaseStringBlock:()=>nQ,BaseBlock:()=>y8,Any:()=>U4});/*!
147
+ `),Qq.prototype[W]=X.toFunction({assertSize:Rj})});HE.exports=Qq;function Rj(W,X){if(W>X)throw new sc(W,X)}});var O8=V1((Qq0,CE)=>{var Lj=wV(),tc=lB(),ec=iB(),Wl=aB(),Xl=tB(),Gl=XE(),zE=YE(),Yl=ZE(),Jl=QE(),{encode:jE}=KV(),{decode:KE}=wY(),{encodingLength:Zl}=DV(),Vl=AE(),DE=zY(),OE={array:tc,bool:Wl,buffer:ec,reserved:Xl,string:Gl,when:Yl,select:Jl};for(let W of Object.keys(zE))OE[W]=zE[W];var Nq=Symbol("schema");function IE(W){let X=new Lj({readableObjectMode:!1,writableObjectMode:!0,transform:Ul});return X[Nq]=W,X}function wE(W){let X=null,G=Buffer.isBuffer(W);if(!G)X=W;let Y=new Lj({transform:Ql,readableObjectMode:!0,writableObjectMode:!1});if(Y[Nq]=X,G)Y.append(W);return Y}function Ul(W,X,G){try{jE(W,this[Nq],this);let Y=this.slice();this.consume(Y.length),G(null,Y)}catch(Y){G(Y)}}function Ql(W,X,G){this.append(W);try{while(this.length>0){let Y=new Vl(this),J=KE(Y,this[Nq]);Y.commit(),this.push(J)}G()}catch(Y){if(Y instanceof DE)G();else G(Y)}}CE.exports={createEncodeStream:IE,createDecodeStream:wE,encode:jE,decode:KE,encodingLength:Zl,createEncode:IE,createDecode:wE,types:OE,BinaryStream:Lj,NotEnoughDataError:DE}});var O$=V1((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});K$.LEB128=K$.SignedLEB128=K$.UnsignedLEB128=void 0;var MY;(function(W){W[W.LOWER_7=127]="LOWER_7",W[W.UPPER_1=128]="UPPER_1"})(MY||(MY={}));var j$=(W)=>Number.isSafeInteger(W);class PY{static decode(W,X=0){let G=this.$scanForNullBytes(W,X),Y=0,J=0;for(let Z=0;Z<=G-X;Z++){let V=W[X+Z]&MY.LOWER_7;Y|=V<<J,J+=7}return Y}static encode(W){if(this.check(W),W<0)throw Error(`An unsigned number must NOT be negative, ${W} is!`);let X=[],G=W;do{let Y=G&MY.LOWER_7;if(G>>=7,G)Y=Y|MY.UPPER_1;X.push(Y)}while(G);return Uint8Array.from(X)}static check(W){if(!j$(W))throw Error(`${W} is not a safe integer!`)}static $scanForNullBytes(W,X=0){let G=X,Y=0;do{if(G>=W.byteLength)throw Error("This is not a LEB128-encoded Uint8Array, no ending found!");Y=W.slice(G,G+1)[0],G++}while(Y&MY.UPPER_1);return G-1}static getLength(W,X=0){return this.$scanForNullBytes(W,X)-X}}K$.UnsignedLEB128=PY;class Pq{static $ceil7mul(W){let X=W;while(X%7)X++;return X}static check(W){if(!j$(W))throw Error(`${W} is not a safe integer!`)}static encode(W){if(this.check(W),W>=0)throw Error(`A signed number must be negative, ${W} isn't!`);let X=Math.ceil(Math.log2(-W));return PY.encode((1<<this.$ceil7mul(X))+W)}static decode(W,X=0){let G=PY.decode(W,X);return-((1<<Math.ceil(Math.log2(G)))-G)}}K$.SignedLEB128=Pq;class Rq{}K$.LEB128=Rq;Rq.encode=(W)=>(W>=0?PY:Pq).encode(W);Rq.decode=(W,X=0,G=!1)=>(G?Pq:PY).decode(W,X)});var T$=V1((oj,C$)=>{/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */(function(W){function X(B){return parseInt(B)===B}function G(B){if(!X(B.length))return!1;for(var S=0;S<B.length;S++)if(!X(B[S])||B[S]<0||B[S]>255)return!1;return!0}function Y(B,S){if(B.buffer&&B.name==="Uint8Array"){if(S)if(B.slice)B=B.slice();else B=Array.prototype.slice.call(B);return B}if(Array.isArray(B)){if(!G(B))throw Error("Array contains invalid value: "+B);return new Uint8Array(B)}if(X(B.length)&&G(B))return new Uint8Array(B);throw Error("unsupported array-like object")}function J(B){return new Uint8Array(B)}function Z(B,S,_,v,R){if(v!=null||R!=null)if(B.slice)B=B.slice(v,R);else B=Array.prototype.slice.call(B,v,R);S.set(B,_)}var V=function(){function B(_){var v=[],R=0;_=encodeURI(_);while(R<_.length){var m=_.charCodeAt(R++);if(m===37)v.push(parseInt(_.substr(R,2),16)),R+=2;else v.push(m)}return Y(v)}function S(_){var v=[],R=0;while(R<_.length){var m=_[R];if(m<128)v.push(String.fromCharCode(m)),R++;else if(m>191&&m<224)v.push(String.fromCharCode((m&31)<<6|_[R+1]&63)),R+=2;else v.push(String.fromCharCode((m&15)<<12|(_[R+1]&63)<<6|_[R+2]&63)),R+=3}return v.join("")}return{toBytes:B,fromBytes:S}}(),U=function(){function B(v){var R=[];for(var m=0;m<v.length;m+=2)R.push(parseInt(v.substr(m,2),16));return R}var S="0123456789abcdef";function _(v){var R=[];for(var m=0;m<v.length;m++){var J0=v[m];R.push(S[(J0&240)>>4]+S[J0&15])}return R.join("")}return{toBytes:B,fromBytes:_}}(),Q={16:10,24:12,32:14},N=[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],q=[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],A=[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],H=[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],I=[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],w=[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],D=[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],T=[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],x=[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],h=[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,1047239000,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],$=[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,679998000,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],F=[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],u=[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],c=[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,1047239000,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],p=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998000,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 s(B){var S=[];for(var _=0;_<B.length;_+=4)S.push(B[_]<<24|B[_+1]<<16|B[_+2]<<8|B[_+3]);return S}var y=function(B){if(!(this instanceof y))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:Y(B,!0)}),this._prepare()};y.prototype._prepare=function(){var B=Q[this.key.length];if(B==null)throw Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var S=0;S<=B;S++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var _=(B+1)*4,v=this.key.length/4,R=s(this.key),m;for(var S=0;S<v;S++)m=S>>2,this._Ke[m][S%4]=R[S],this._Kd[B-m][S%4]=R[S];var J0=0,U0=v,N0;while(U0<_){if(N0=R[v-1],R[0]^=q[N0>>16&255]<<24^q[N0>>8&255]<<16^q[N0&255]<<8^q[N0>>24&255]^N[J0]<<24,J0+=1,v!=8)for(var S=1;S<v;S++)R[S]^=R[S-1];else{for(var S=1;S<v/2;S++)R[S]^=R[S-1];N0=R[v/2-1],R[v/2]^=q[N0&255]^q[N0>>8&255]<<8^q[N0>>16&255]<<16^q[N0>>24&255]<<24;for(var S=v/2+1;S<v;S++)R[S]^=R[S-1]}var S=0,$0,u0;while(S<v&&U0<_)$0=U0>>2,u0=U0%4,this._Ke[$0][u0]=R[S],this._Kd[B-$0][u0]=R[S++],U0++}for(var $0=1;$0<B;$0++)for(var u0=0;u0<4;u0++)N0=this._Kd[$0][u0],this._Kd[$0][u0]=F[N0>>24&255]^u[N0>>16&255]^c[N0>>8&255]^p[N0&255]},y.prototype.encrypt=function(B){if(B.length!=16)throw Error("invalid plaintext size (must be 16 bytes)");var S=this._Ke.length-1,_=[0,0,0,0],v=s(B);for(var R=0;R<4;R++)v[R]^=this._Ke[0][R];for(var m=1;m<S;m++){for(var R=0;R<4;R++)_[R]=H[v[R]>>24&255]^I[v[(R+1)%4]>>16&255]^w[v[(R+2)%4]>>8&255]^D[v[(R+3)%4]&255]^this._Ke[m][R];v=_.slice()}var J0=J(16),U0;for(var R=0;R<4;R++)U0=this._Ke[S][R],J0[4*R]=(q[v[R]>>24&255]^U0>>24)&255,J0[4*R+1]=(q[v[(R+1)%4]>>16&255]^U0>>16)&255,J0[4*R+2]=(q[v[(R+2)%4]>>8&255]^U0>>8)&255,J0[4*R+3]=(q[v[(R+3)%4]&255]^U0)&255;return J0},y.prototype.decrypt=function(B){if(B.length!=16)throw Error("invalid ciphertext size (must be 16 bytes)");var S=this._Kd.length-1,_=[0,0,0,0],v=s(B);for(var R=0;R<4;R++)v[R]^=this._Kd[0][R];for(var m=1;m<S;m++){for(var R=0;R<4;R++)_[R]=T[v[R]>>24&255]^x[v[(R+3)%4]>>16&255]^h[v[(R+2)%4]>>8&255]^$[v[(R+1)%4]&255]^this._Kd[m][R];v=_.slice()}var J0=J(16),U0;for(var R=0;R<4;R++)U0=this._Kd[S][R],J0[4*R]=(A[v[R]>>24&255]^U0>>24)&255,J0[4*R+1]=(A[v[(R+3)%4]>>16&255]^U0>>16)&255,J0[4*R+2]=(A[v[(R+2)%4]>>8&255]^U0>>8)&255,J0[4*R+3]=(A[v[(R+1)%4]&255]^U0)&255;return J0};var t=function(B){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new y(B)};t.prototype.encrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16)Z(B,_,0,v,v+16),_=this._aes.encrypt(_),Z(_,S,v);return S},t.prototype.decrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16)Z(B,_,0,v,v+16),_=this._aes.decrypt(_),Z(_,S,v);return S};var H0=function(B,S){if(!(this instanceof H0))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!S)S=J(16);else if(S.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=Y(S,!0),this._aes=new y(B)};H0.prototype.encrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16){Z(B,_,0,v,v+16);for(var R=0;R<16;R++)_[R]^=this._lastCipherblock[R];this._lastCipherblock=this._aes.encrypt(_),Z(this._lastCipherblock,S,v)}return S},H0.prototype.decrypt=function(B){if(B=Y(B),B.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var S=J(B.length),_=J(16);for(var v=0;v<B.length;v+=16){Z(B,_,0,v,v+16),_=this._aes.decrypt(_);for(var R=0;R<16;R++)S[v+R]=_[R]^this._lastCipherblock[R];Z(B,this._lastCipherblock,0,v,v+16)}return S};var g=function(B,S,_){if(!(this instanceof g))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!S)S=J(16);else if(S.length!=16)throw Error("invalid initialation vector size (must be 16 size)");if(!_)_=1;this.segmentSize=_,this._shiftRegister=Y(S,!0),this._aes=new y(B)};g.prototype.encrypt=function(B){if(B.length%this.segmentSize!=0)throw Error("invalid plaintext size (must be segmentSize bytes)");var S=Y(B,!0),_;for(var v=0;v<S.length;v+=this.segmentSize){_=this._aes.encrypt(this._shiftRegister);for(var R=0;R<this.segmentSize;R++)S[v+R]^=_[R];Z(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Z(S,this._shiftRegister,16-this.segmentSize,v,v+this.segmentSize)}return S},g.prototype.decrypt=function(B){if(B.length%this.segmentSize!=0)throw Error("invalid ciphertext size (must be segmentSize bytes)");var S=Y(B,!0),_;for(var v=0;v<S.length;v+=this.segmentSize){_=this._aes.encrypt(this._shiftRegister);for(var R=0;R<this.segmentSize;R++)S[v+R]^=_[R];Z(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Z(B,this._shiftRegister,16-this.segmentSize,v,v+this.segmentSize)}return S};var d=function(B,S){if(!(this instanceof d))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!S)S=J(16);else if(S.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=Y(S,!0),this._lastPrecipherIndex=16,this._aes=new y(B)};d.prototype.encrypt=function(B){var S=Y(B,!0);for(var _=0;_<S.length;_++){if(this._lastPrecipherIndex===16)this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0;S[_]^=this._lastPrecipher[this._lastPrecipherIndex++]}return S},d.prototype.decrypt=d.prototype.encrypt;var P=function(B){if(!(this instanceof P))throw Error("Counter must be instanitated with `new`");if(B!==0&&!B)B=1;if(typeof B==="number")this._counter=J(16),this.setValue(B);else this.setBytes(B)};P.prototype.setValue=function(B){if(typeof B!=="number"||parseInt(B)!=B)throw Error("invalid counter value (must be an integer)");if(B>Number.MAX_SAFE_INTEGER)throw Error("integer value out of safe range");for(var S=15;S>=0;--S)this._counter[S]=B%256,B=parseInt(B/256)},P.prototype.setBytes=function(B){if(B=Y(B,!0),B.length!=16)throw Error("invalid counter bytes size (must be 16 bytes)");this._counter=B},P.prototype.increment=function(){for(var B=15;B>=0;B--)if(this._counter[B]===255)this._counter[B]=0;else{this._counter[B]++;break}};var E=function(B,S){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");if(this.description="Counter",this.name="ctr",!(S instanceof P))S=new P(S);this._counter=S,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new y(B)};E.prototype.encrypt=function(B){var S=Y(B,!0);for(var _=0;_<S.length;_++){if(this._remainingCounterIndex===16)this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment();S[_]^=this._remainingCounter[this._remainingCounterIndex++]}return S},E.prototype.decrypt=E.prototype.encrypt;function f(B){B=Y(B,!0);var S=16-B.length%16,_=J(B.length+S);Z(B,_);for(var v=B.length;v<_.length;v++)_[v]=S;return _}function r(B){if(B=Y(B,!0),B.length<16)throw Error("PKCS#7 invalid length");var S=B[B.length-1];if(S>16)throw Error("PKCS#7 padding byte out of range");var _=B.length-S;for(var v=0;v<S;v++)if(B[_+v]!==S)throw Error("PKCS#7 invalid padding byte");var R=J(_);return Z(B,R,0,0,_),R}var o={AES:y,Counter:P,ModeOfOperation:{ecb:t,cbc:H0,cfb:g,ofb:d,ctr:E},utils:{hex:U,utf8:V},padding:{pkcs7:{pad:f,strip:r}},_arrayTest:{coerceArray:Y,createArray:J,copyArray:Z}};if(typeof oj<"u")C$.exports=o;else if(typeof define==="function"&&define.amd)define([],function(){return o});else{if(W.aesjs)o._aesjs=W.aesjs;W.aesjs=o}})(oj)});var aj=V1((E$)=>{var G1=E$,{Buffer:$q}=_8("buffer"),nl=_8("os");G1.toBuffer=function(W,X,G){G=~~G;let Y;if(this.isV4Format(W))Y=X||$q.alloc(G+4),W.split(/\./g).map((J)=>{Y[G++]=parseInt(J,10)&255});else if(this.isV6Format(W)){let J=W.split(":",8),Z;for(Z=0;Z<J.length;Z++){let V=this.isV4Format(J[Z]),U;if(V)U=this.toBuffer(J[Z]),J[Z]=U.slice(0,2).toString("hex");if(U&&++Z<8)J.splice(Z,0,U.slice(2,4).toString("hex"))}if(J[0]==="")while(J.length<8)J.unshift("0");else if(J[J.length-1]==="")while(J.length<8)J.push("0");else if(J.length<8){for(Z=0;Z<J.length&&J[Z]!=="";Z++);let V=[Z,1];for(Z=9-J.length;Z>0;Z--)V.push("0");J.splice(...V)}Y=X||$q.alloc(G+16);for(Z=0;Z<J.length;Z++){let V=parseInt(J[Z],16);Y[G++]=V>>8&255,Y[G++]=V&255}}if(!Y)throw Error(`Invalid ip address: ${W}`);return Y};G1.toString=function(W,X,G){X=~~X,G=G||W.length-X;let Y=[];if(G===4){for(let J=0;J<G;J++)Y.push(W[X+J]);Y=Y.join(".")}else if(G===16){for(let J=0;J<G;J+=2)Y.push(W.readUInt16BE(X+J).toString(16));Y=Y.join(":"),Y=Y.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),Y=Y.replace(/:{3,4}/,"::")}return Y};var il=/^(\d{1,3}\.){3,3}\d{1,3}$/,rl=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;G1.isV4Format=function(W){return il.test(W)};G1.isV6Format=function(W){return rl.test(W)};function FV(W){if(W===4)return"ipv4";if(W===6)return"ipv6";return W?W.toLowerCase():"ipv4"}G1.fromPrefixLen=function(W,X){if(W>32)X="ipv6";else X=FV(X);let G=4;if(X==="ipv6")G=16;let Y=$q.alloc(G);for(let J=0,Z=Y.length;J<Z;++J){let V=8;if(W<8)V=W;W-=V,Y[J]=~(255>>V)&255}return G1.toString(Y)};G1.mask=function(W,X){W=G1.toBuffer(W),X=G1.toBuffer(X);let G=$q.alloc(Math.max(W.length,X.length)),Y;if(W.length===X.length)for(Y=0;Y<W.length;Y++)G[Y]=W[Y]&X[Y];else if(X.length===4)for(Y=0;Y<X.length;Y++)G[Y]=W[W.length-4+Y]&X[Y];else{for(Y=0;Y<G.length-6;Y++)G[Y]=0;G[10]=255,G[11]=255;for(Y=0;Y<W.length;Y++)G[Y+12]=W[Y]&X[Y+12];Y+=12}for(;Y<G.length;Y++)G[Y]=0;return G1.toString(G)};G1.cidr=function(W){let X=W.split("/"),G=X[0];if(X.length!==2)throw Error(`invalid CIDR subnet: ${G}`);let Y=G1.fromPrefixLen(parseInt(X[1],10));return G1.mask(G,Y)};G1.subnet=function(W,X){let G=G1.toLong(G1.mask(W,X)),Y=G1.toBuffer(X),J=0;for(let V=0;V<Y.length;V++)if(Y[V]===255)J+=8;else{let U=Y[V]&255;while(U)U=U<<1&255,J++}let Z=2**(32-J);return{networkAddress:G1.fromLong(G),firstAddress:Z<=2?G1.fromLong(G):G1.fromLong(G+1),lastAddress:Z<=2?G1.fromLong(G+Z-1):G1.fromLong(G+Z-2),broadcastAddress:G1.fromLong(G+Z-1),subnetMask:X,subnetMaskLength:J,numHosts:Z<=2?Z:Z-2,length:Z,contains(V){return G===G1.toLong(G1.mask(V,X))}}};G1.cidrSubnet=function(W){let X=W.split("/"),G=X[0];if(X.length!==2)throw Error(`invalid CIDR subnet: ${G}`);let Y=G1.fromPrefixLen(parseInt(X[1],10));return G1.subnet(G,Y)};G1.not=function(W){let X=G1.toBuffer(W);for(let G=0;G<X.length;G++)X[G]=255^X[G];return G1.toString(X)};G1.or=function(W,X){if(W=G1.toBuffer(W),X=G1.toBuffer(X),W.length===X.length){for(let Z=0;Z<W.length;++Z)W[Z]|=X[Z];return G1.toString(W)}let G=W,Y=X;if(X.length>W.length)G=X,Y=W;let J=G.length-Y.length;for(let Z=J;Z<G.length;++Z)G[Z]|=Y[Z-J];return G1.toString(G)};G1.isEqual=function(W,X){if(W=G1.toBuffer(W),X=G1.toBuffer(X),W.length===X.length){for(let Y=0;Y<W.length;Y++)if(W[Y]!==X[Y])return!1;return!0}if(X.length===4){let Y=X;X=W,W=Y}for(let Y=0;Y<10;Y++)if(X[Y]!==0)return!1;let G=X.readUInt16BE(10);if(G!==0&&G!==65535)return!1;for(let Y=0;Y<4;Y++)if(W[Y]!==X[Y+12])return!1;return!0};G1.isPrivate=function(W){if(G1.isLoopback(W))return!0;if(!G1.isV6Format(W)){let X=G1.normalizeToLong(W);if(X<0)throw Error("invalid ipv4 address");W=G1.fromLong(X)}return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^f[cd][0-9a-f]{2}:/i.test(W)||/^fe80:/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};G1.isPublic=function(W){return!G1.isPrivate(W)};G1.isLoopback=function(W){if(!/\./.test(W)&&!/:/.test(W))W=G1.fromLong(Number(W));return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(W)||/^0177\./.test(W)||/^0x7f\./i.test(W)||/^fe80::1$/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};G1.loopback=function(W){if(W=FV(W),W!=="ipv4"&&W!=="ipv6")throw Error("family must be ipv4 or ipv6");return W==="ipv4"?"127.0.0.1":"fe80::1"};G1.address=function(W,X){let G=nl.networkInterfaces();if(X=FV(X),W&&W!=="private"&&W!=="public"){let J=G[W].filter((Z)=>{return FV(Z.family)===X});if(J.length===0)return;return J[0].address}let Y=Object.keys(G).map((J)=>{let Z=G[J].filter((V)=>{if(V.family=FV(V.family),V.family!==X||G1.isLoopback(V.address))return!1;if(!W)return!0;return W==="public"?G1.isPrivate(V.address):G1.isPublic(V.address)});return Z.length?Z[0].address:void 0}).filter(Boolean);return!Y.length?G1.loopback(X):Y[0]};G1.toLong=function(W){let X=0;return W.split(".").forEach((G)=>{X<<=8,X+=parseInt(G)}),X>>>0};G1.fromLong=function(W){return`${W>>>24}.${W>>16&255}.${W>>8&255}.${W&255}`};G1.normalizeToLong=function(W){let X=W.split(".").map((J)=>{if(J.startsWith("0x")||J.startsWith("0X"))return parseInt(J,16);else if(J.startsWith("0")&&J!=="0"&&/^[0-7]+$/.test(J))return parseInt(J,8);else if(/^[1-9]\d*$/.test(J)||J==="0")return parseInt(J,10);else return NaN});if(X.some(isNaN))return-1;let G=0;switch(X.length){case 1:G=X[0];break;case 2:if(X[0]>255||X[1]>16777215)return-1;G=X[0]<<24|X[1]&16777215;break;case 3:if(X[0]>255||X[1]>255||X[2]>65535)return-1;G=X[0]<<24|X[1]<<16|X[2]&65535;break;case 4:if(X.some((J)=>J>255))return-1;G=X[0]<<24|X[1]<<16|X[2]<<8|X[3];break;default:return-1}return G>>>0}});var F$=V1((rq0,$$)=>{$$.exports=function W(X,G){if(X===G)return!0;if(X&&G&&typeof X=="object"&&typeof G=="object"){if(X.constructor!==G.constructor)return!1;var Y,J,Z;if(Array.isArray(X)){if(Y=X.length,Y!=G.length)return!1;for(J=Y;J--!==0;)if(!W(X[J],G[J]))return!1;return!0}if(X.constructor===RegExp)return X.source===G.source&&X.flags===G.flags;if(X.valueOf!==Object.prototype.valueOf)return X.valueOf()===G.valueOf();if(X.toString!==Object.prototype.toString)return X.toString()===G.toString();if(Z=Object.keys(X),Y=Z.length,Y!==Object.keys(G).length)return!1;for(J=Y;J--!==0;)if(!Object.prototype.hasOwnProperty.call(G,Z[J]))return!1;for(J=Y;J--!==0;){var V=Z[J];if(!W(X[V],G[V]))return!1}return!0}return X!==X&&G!==G}});var S$=V1((al)=>{al.toString=function(W){switch(W){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+W};al.toType=function(W){switch(W.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}if(W.toUpperCase().startsWith("UNKNOWN_"))return parseInt(W.slice(8));return 0}});var x$=V1((el)=>{el.toString=function(W){switch(W){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+W};el.toRcode=function(W){switch(W.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var k$=V1((Gd)=>{Gd.toString=function(W){switch(W){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+W};Gd.toOpcode=function(W){switch(W.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var _$=V1((Zd)=>{Zd.toString=function(W){switch(W){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+W};Zd.toClass=function(W){switch(W.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var y$=V1((Qd)=>{Qd.toString=function(W){switch(W){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}if(W<0)return null;return`OPTION_${W}`};Qd.toCode=function(W){if(typeof W==="number")return W;if(!W)return-1;switch(W.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let X=W.match(/_(\d+)$/);if(X)return parseInt(X[1],10);return-1}});var u$=V1((g$,sj)=>{var v$=function(W){Object.defineProperty(W,"__esModule",{value:!0}),W.decode=A,W.encode=q,W.familyOf=N,W.name=void 0,W.sizeOf=Q,W.v6=W.v4=void 0;let X=/^(\d{1,3}\.){3,3}\d{1,3}$/,G=4,Y=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,J=16,Z={name:"v4",size:G,isFormat:(H)=>X.test(H),encode(H,I,w){w=~~w,I=I||new Uint8Array(w+G);let D=H.length,T=0;for(let x=0;x<D;){let h=H.charCodeAt(x++);if(h===46)I[w++]=T,T=0;else T=T*10+(h-48)}return I[w]=T,I},decode(H,I){return I=~~I,`${H[I++]}.${H[I++]}.${H[I++]}.${H[I]}`}};W.v4=Z;let V={name:"v6",size:J,isFormat:(H)=>H.length>0&&Y.test(H),encode(H,I,w){w=~~w;let D=w+J,T=-1,x=0,h=0,$=!0,F=!1;I=I||new Uint8Array(w+J);for(let u=0;u<H.length;u++){let c=H.charCodeAt(u);if(c===58){if($){if(T!==-1){if(w<D)I[w]=0;if(w<D-1)I[w+1]=0;w+=2}else if(w<D)T=w}else{if(F===!0){if(w<D)I[w]=h;w++}else{if(w<D)I[w]=x>>8;if(w<D-1)I[w+1]=x&255;w+=2}x=0,h=0}$=!0,F=!1}else if(c===46){if(w<D)I[w]=h;w++,h=0,x=0,$=!1,F=!0}else{if($=!1,c>=97)c-=87;else if(c>=65)c-=55;else c-=48,h=h*10+c;x=(x<<4)+c}}if($===!1)if(F===!0){if(w<D)I[w]=h;w++}else{if(w<D)I[w]=x>>8;if(w<D-1)I[w+1]=x&255;w+=2}else if(T===0){if(w<D)I[w]=0;if(w<D-1)I[w+1]=0;w+=2}else if(T!==-1){w+=2;for(let u=Math.min(w-1,D-1);u>=T+2;u--)I[u]=I[u-2];I[T]=0,I[T+1]=0,T=w}if(T!==w&&T!==-1){if(w>D-2)w=D-2;while(D>T)I[--D]=w<D&&w>T?I[--w]:0}else while(w<D)I[w++]=0;return I},decode(H,I){I=~~I;let w="";for(let D=0;D<J;D+=2){if(D!==0)w+=":";w+=(H[I+D]<<8|H[I+D+1]).toString(16)}return w.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};W.v6=V;let U="ip";W.name=U;function Q(H){if(Z.isFormat(H))return Z.size;if(V.isFormat(H))return V.size;throw Error(`Invalid ip address: ${H}`)}function N(H){return Q(H)===Z.size?1:2}function q(H,I,w){w=~~w;let D=Q(H);if(typeof I==="function")I=I(w+D);if(D===Z.size)return Z.encode(H,I,w);return V.encode(H,I,w)}function A(H,I,w){if(I=~~I,w=w||H.length-I,w===Z.size)return Z.decode(H,I,w);if(w===V.size)return V.decode(H,I,w);throw Error(`Invalid buffer size needs to be ${Z.size} for v4 or ${V.size} for v6.`)}return"default"in W?W.default:W}({});if(typeof define==="function"&&define.amd)define([],function(){return v$});else if(typeof sj==="object"&&typeof g$==="object")sj.exports=v$});var h$=V1((wd)=>{var Z1=_8("buffer").Buffer,m4=S$(),Hd=x$(),Ad=k$(),Sq=_$(),WK=y$(),wX=u$(),g0=wd.name={};g0.encode=function(W,X,G,{mail:Y=!1}={}){if(!X)X=Z1.alloc(g0.encodingLength(W));if(!G)G=0;let J=G,Z=W.replace(/^\.|\.$/gm,"");if(Z.length){let V=[];if(Y){let U="";Z.split(".").forEach((Q)=>{if(Q.endsWith("\\"))U+=(U.length?".":"")+Q.slice(0,-1);else if(V.length===0&&U.length)V.push(U+"."+Q);else V.push(Q)})}else V=Z.split(".");for(let U=0;U<V.length;U++){let Q=X.write(V[U],G+1);X[G]=Q,G+=Q+1}}return X[G++]=0,g0.encode.bytes=G-J,X};g0.encode.bytes=0;g0.decode=function(W,X,{mail:G=!1}={}){if(!X)X=0;let Y=[],J=X,Z=0,V=0,U=!1;while(!0){if(X>=W.length)throw Error("Cannot decode name (buffer overflow)");let Q=W[X++];if(V+=U?0:1,Q===0)break;else if((Q&192)===0){if(X+Q>W.length)throw Error("Cannot decode name (buffer overflow)");if(Z+=Q+1,Z>254)throw Error("Cannot decode name (name too long)");let N=W.toString("utf-8",X,X+Q);if(G)N=N.replace(/\./g,"\\.");Y.push(N),X+=Q,V+=U?0:Q}else if((Q&192)===192){if(X+1>W.length)throw Error("Cannot decode name (buffer overflow)");let N=W.readUInt16BE(X-1)-49152;if(N>=J)throw Error("Cannot decode name (bad pointer)");X=N,J=N,V+=U?0:1,U=!0}else throw Error("Cannot decode name (bad label)")}return g0.decode.bytes=V,Y.length===0?".":Y.join(".")};g0.decode.bytes=0;g0.encodingLength=function(W){if(W==="."||W==="..")return 1;return Z1.byteLength(W.replace(/^\.|\.$/gm,""))+2};var v1={};v1.encode=function(W,X,G){if(!X)X=Z1.alloc(v1.encodingLength(W));if(!G)G=0;let Y=X.write(W,G+1);return X[G]=Y,v1.encode.bytes=Y+1,X};v1.encode.bytes=0;v1.decode=function(W,X){if(!X)X=0;let G=W[X],Y=W.toString("utf-8",X+1,X+1+G);return v1.decode.bytes=G+1,Y};v1.decode.bytes=0;v1.encodingLength=function(W){return Z1.byteLength(W)+1};var e5={};e5.encode=function(W,X,G){if(!X)X=e5.encodingLength(W);if(!G)G=0;let Y=(W.flags||0)&32767,J=W.type==="response"?32768:0;return X.writeUInt16BE(W.id||0,G),X.writeUInt16BE(Y|J,G+2),X.writeUInt16BE(W.questions.length,G+4),X.writeUInt16BE(W.answers.length,G+6),X.writeUInt16BE(W.authorities.length,G+8),X.writeUInt16BE(W.additionals.length,G+10),X};e5.encode.bytes=12;e5.decode=function(W,X){if(!X)X=0;if(W.length<12)throw Error("Header must be 12 bytes");let G=W.readUInt16BE(X+2);return{id:W.readUInt16BE(X),type:G&32768?"response":"query",flags:G&32767,flag_qr:(G>>15&1)===1,opcode:Ad.toString(G>>11&15),flag_aa:(G>>10&1)===1,flag_tc:(G>>9&1)===1,flag_rd:(G>>8&1)===1,flag_ra:(G>>7&1)===1,flag_z:(G>>6&1)===1,flag_ad:(G>>5&1)===1,flag_cd:(G>>4&1)===1,rcode:Hd.toString(G&15),questions:Array(W.readUInt16BE(X+4)),answers:Array(W.readUInt16BE(X+6)),authorities:Array(W.readUInt16BE(X+8)),additionals:Array(W.readUInt16BE(X+10))}};e5.decode.bytes=12;e5.encodingLength=function(){return 12};var x4=wd.unknown={};x4.encode=function(W,X,G){if(!X)X=Z1.alloc(x4.encodingLength(W));if(!G)G=0;return X.writeUInt16BE(W.length,G),W.copy(X,G+2),x4.encode.bytes=W.length+2,X};x4.encode.bytes=0;x4.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X),Y=W.slice(X+2,X+2+G);return x4.decode.bytes=G+2,Y};x4.decode.bytes=0;x4.encodingLength=function(W){return W.length+2};var k4=wd.ns={};k4.encode=function(W,X,G){if(!X)X=Z1.alloc(k4.encodingLength(W));if(!G)G=0;return g0.encode(W,X,G+2),X.writeUInt16BE(g0.encode.bytes,G),k4.encode.bytes=g0.encode.bytes+2,X};k4.encode.bytes=0;k4.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X),Y=g0.decode(W,X+2);return k4.decode.bytes=G+2,Y};k4.decode.bytes=0;k4.encodingLength=function(W){return g0.encodingLength(W)+2};var _4=wd.soa={};_4.encode=function(W,X,G){if(!X)X=Z1.alloc(_4.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,g0.encode(W.mname,X,G),G+=g0.encode.bytes,g0.encode(W.rname,X,G,{mail:!0}),G+=g0.encode.bytes,X.writeUInt32BE(W.serial||0,G),G+=4,X.writeUInt32BE(W.refresh||0,G),G+=4,X.writeUInt32BE(W.retry||0,G),G+=4,X.writeUInt32BE(W.expire||0,G),G+=4,X.writeUInt32BE(W.minimum||0,G),G+=4,X.writeUInt16BE(G-Y-2,Y),_4.encode.bytes=G-Y,X};_4.encode.bytes=0;_4.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.mname=g0.decode(W,X),X+=g0.decode.bytes,Y.rname=g0.decode(W,X,{mail:!0}),X+=g0.decode.bytes,Y.serial=W.readUInt32BE(X),X+=4,Y.refresh=W.readUInt32BE(X),X+=4,Y.retry=W.readUInt32BE(X),X+=4,Y.expire=W.readUInt32BE(X),X+=4,Y.minimum=W.readUInt32BE(X),X+=4,_4.decode.bytes=X-G,Y};_4.decode.bytes=0;_4.encodingLength=function(W){return 22+g0.encodingLength(W.mname)+g0.encodingLength(W.rname)};var y4=wd.txt={};y4.encode=function(W,X,G){if(!Array.isArray(W))W=[W];for(let J=0;J<W.length;J++){if(typeof W[J]==="string")W[J]=Z1.from(W[J]);if(!Z1.isBuffer(W[J]))throw Error("Must be a Buffer")}if(!X)X=Z1.alloc(y4.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,W.forEach(function(J){X[G++]=J.length,J.copy(X,G,0,J.length),G+=J.length}),X.writeUInt16BE(G-Y-2,Y),y4.encode.bytes=G-Y,X};y4.encode.bytes=0;y4.decode=function(W,X){if(!X)X=0;let G=X,Y=W.readUInt16BE(X);X+=2;let J=[];while(Y>0){let Z=W[X++];if(--Y,Y<Z)throw Error("Buffer overflow");J.push(W.slice(X,X+Z)),X+=Z,Y-=Z}return y4.decode.bytes=X-G,J};y4.decode.bytes=0;y4.encodingLength=function(W){if(!Array.isArray(W))W=[W];let X=2;return W.forEach(function(G){if(typeof G==="string")X+=Z1.byteLength(G)+1;else X+=G.length+1}),X};var v4=wd.null={};v4.encode=function(W,X,G){if(!X)X=Z1.alloc(v4.encodingLength(W));if(!G)G=0;if(typeof W==="string")W=Z1.from(W);if(!W)W=Z1.alloc(0);let Y=G;G+=2;let J=W.length;return W.copy(X,G,0,J),G+=J,X.writeUInt16BE(G-Y-2,Y),v4.encode.bytes=G-Y,X};v4.encode.bytes=0;v4.decode=function(W,X){if(!X)X=0;let G=X,Y=W.readUInt16BE(X);X+=2;let J=W.slice(X,X+Y);return X+=Y,v4.decode.bytes=X-G,J};v4.decode.bytes=0;v4.encodingLength=function(W){if(!W)return 2;return(Z1.isBuffer(W)?W.length:Z1.byteLength(W))+2};var g4=wd.hinfo={};g4.encode=function(W,X,G){if(!X)X=Z1.alloc(g4.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,v1.encode(W.cpu,X,G),G+=v1.encode.bytes,v1.encode(W.os,X,G),G+=v1.encode.bytes,X.writeUInt16BE(G-Y-2,Y),g4.encode.bytes=G-Y,X};g4.encode.bytes=0;g4.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.cpu=v1.decode(W,X),X+=v1.decode.bytes,Y.os=v1.decode(W,X),X+=v1.decode.bytes,g4.decode.bytes=X-G,Y};g4.decode.bytes=0;g4.encodingLength=function(W){return v1.encodingLength(W.cpu)+v1.encodingLength(W.os)+2};var s5=wd.ptr={},zd=wd.cname=s5,Id=wd.dname=s5;s5.encode=function(W,X,G){if(!X)X=Z1.alloc(s5.encodingLength(W));if(!G)G=0;return g0.encode(W,X,G+2),X.writeUInt16BE(g0.encode.bytes,G),s5.encode.bytes=g0.encode.bytes+2,X};s5.encode.bytes=0;s5.decode=function(W,X){if(!X)X=0;let G=g0.decode(W,X+2);return s5.decode.bytes=g0.decode.bytes+2,G};s5.decode.bytes=0;s5.encodingLength=function(W){return g0.encodingLength(W)+2};var u4=wd.srv={};u4.encode=function(W,X,G){if(!X)X=Z1.alloc(u4.encodingLength(W));if(!G)G=0;X.writeUInt16BE(W.priority||0,G+2),X.writeUInt16BE(W.weight||0,G+4),X.writeUInt16BE(W.port||0,G+6),g0.encode(W.target,X,G+8);let Y=g0.encode.bytes+6;return X.writeUInt16BE(Y,G),u4.encode.bytes=Y+2,X};u4.encode.bytes=0;u4.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X),Y={};return Y.priority=W.readUInt16BE(X+2),Y.weight=W.readUInt16BE(X+4),Y.port=W.readUInt16BE(X+6),Y.target=g0.decode(W,X+8),u4.decode.bytes=G+2,Y};u4.decode.bytes=0;u4.encodingLength=function(W){return 8+g0.encodingLength(W.target)};var q5=wd.caa={};q5.ISSUER_CRITICAL=128;q5.encode=function(W,X,G){let Y=q5.encodingLength(W);if(!X)X=Z1.alloc(q5.encodingLength(W));if(!G)G=0;if(W.issuerCritical)W.flags=q5.ISSUER_CRITICAL;return X.writeUInt16BE(Y-2,G),G+=2,X.writeUInt8(W.flags||0,G),G+=1,v1.encode(W.tag,X,G),G+=v1.encode.bytes,X.write(W.value,G),G+=Z1.byteLength(W.value),q5.encode.bytes=Y,X};q5.encode.bytes=0;q5.decode=function(W,X){if(!X)X=0;let G=W.readUInt16BE(X);X+=2;let Y=X,J={};return J.flags=W.readUInt8(X),X+=1,J.tag=v1.decode(W,X),X+=v1.decode.bytes,J.value=W.toString("utf-8",X,Y+G),J.issuerCritical=!!(J.flags&q5.ISSUER_CRITICAL),q5.decode.bytes=G+2,J};q5.decode.bytes=0;q5.encodingLength=function(W){return v1.encodingLength(W.tag)+v1.encodingLength(W.value)+2};var n6=wd.mx={};n6.encode=function(W,X,G){if(!X)X=Z1.alloc(n6.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,X.writeUInt16BE(W.preference||0,G),G+=2,g0.encode(W.exchange,X,G),G+=g0.encode.bytes,X.writeUInt16BE(G-Y-2,Y),n6.encode.bytes=G-Y,X};n6.encode.bytes=0;n6.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.preference=W.readUInt16BE(X),X+=2,Y.exchange=g0.decode(W,X),X+=g0.decode.bytes,n6.decode.bytes=X-G,Y};n6.encodingLength=function(W){return 4+g0.encodingLength(W.exchange)};var h4=wd.a={};h4.encode=function(W,X,G){if(!X)X=Z1.alloc(h4.encodingLength(W));if(!G)G=0;return X.writeUInt16BE(4,G),G+=2,wX.v4.encode(W,X,G),h4.encode.bytes=6,X};h4.encode.bytes=0;h4.decode=function(W,X){if(!X)X=0;X+=2;let G=wX.v4.decode(W,X);return h4.decode.bytes=6,G};h4.decode.bytes=0;h4.encodingLength=function(){return 6};var b4=wd.aaaa={};b4.encode=function(W,X,G){if(!X)X=Z1.alloc(b4.encodingLength(W));if(!G)G=0;return X.writeUInt16BE(16,G),G+=2,wX.v6.encode(W,X,G),b4.encode.bytes=18,X};b4.encode.bytes=0;b4.decode=function(W,X){if(!X)X=0;X+=2;let G=wX.v6.decode(W,X);return b4.decode.bytes=18,G};b4.decode.bytes=0;b4.encodingLength=function(){return 18};var a9=wd.option={};a9.encode=function(W,X,G){if(!X)X=Z1.alloc(a9.encodingLength(W));if(!G)G=0;let Y=G,J=WK.toCode(W.code);if(X.writeUInt16BE(J,G),G+=2,W.data)X.writeUInt16BE(W.data.length,G),G+=2,W.data.copy(X,G),G+=W.data.length;else switch(J){case 8:let Z=W.sourcePrefixLength||0,V=W.family||wX.familyOf(W.ip),U=wX.encode(W.ip,Z1.alloc),Q=Math.ceil(Z/8);X.writeUInt16BE(Q+4,G),G+=2,X.writeUInt16BE(V,G),G+=2,X.writeUInt8(Z,G++),X.writeUInt8(W.scopePrefixLength||0,G++),U.copy(X,G,0,Q),G+=Q;break;case 11:if(W.timeout)X.writeUInt16BE(2,G),G+=2,X.writeUInt16BE(W.timeout,G),G+=2;else X.writeUInt16BE(0,G),G+=2;break;case 12:let N=W.length||0;X.writeUInt16BE(N,G),G+=2,X.fill(0,G,G+N),G+=N;break;case 14:let q=W.tags.length*2;X.writeUInt16BE(q,G),G+=2;for(let A of W.tags)X.writeUInt16BE(A,G),G+=2;break;default:throw Error(`Unknown roption code: ${W.code}`)}return a9.encode.bytes=G-Y,X};a9.encode.bytes=0;a9.decode=function(W,X){if(!X)X=0;let G={};G.code=W.readUInt16BE(X),G.type=WK.toString(G.code),X+=2;let Y=W.readUInt16BE(X);switch(X+=2,G.data=W.slice(X,X+Y),G.code){case 8:G.family=W.readUInt16BE(X),X+=2,G.sourcePrefixLength=W.readUInt8(X++),G.scopePrefixLength=W.readUInt8(X++);let J=Z1.alloc(G.family===1?4:16);W.copy(J,0,X,X+Y-4),G.ip=wX.decode(J);break;case 11:if(Y>0)G.timeout=W.readUInt16BE(X),X+=2;break;case 14:G.tags=[];for(let Z=0;Z<Y;Z+=2)G.tags.push(W.readUInt16BE(X)),X+=2}return a9.decode.bytes=Y+4,G};a9.decode.bytes=0;a9.encodingLength=function(W){if(W.data)return W.data.length+4;switch(WK.toCode(W.code)){case 8:let G=W.sourcePrefixLength||0;return Math.ceil(G/8)+8;case 11:return typeof W.timeout==="number"?6:4;case 12:return W.length+4;case 14:return 4+W.tags.length*2}throw Error(`Unknown roption code: ${W.code}`)};var A5=wd.opt={};A5.encode=function(W,X,G){if(!X)X=Z1.alloc(A5.encodingLength(W));if(!G)G=0;let Y=G,J=$Y(W,a9);return X.writeUInt16BE(J,G),G=SV(W,a9,X,G+2),A5.encode.bytes=G-Y,X};A5.encode.bytes=0;A5.decode=function(W,X){if(!X)X=0;let G=X,Y=[],J=W.readUInt16BE(X);X+=2;let Z=0;while(J>0)Y[Z++]=a9.decode(W,X),X+=a9.decode.bytes,J-=a9.decode.bytes;return A5.decode.bytes=X-G,Y};A5.decode.bytes=0;A5.encodingLength=function(W){return 2+$Y(W||[],a9)};var u9=wd.dnskey={};u9.PROTOCOL_DNSSEC=3;u9.ZONE_KEY=128;u9.SECURE_ENTRYPOINT=32768;u9.encode=function(W,X,G){if(!X)X=Z1.alloc(u9.encodingLength(W));if(!G)G=0;let Y=G,J=W.key;if(!Z1.isBuffer(J))throw Error("Key must be a Buffer");return G+=2,X.writeUInt16BE(W.flags,G),G+=2,X.writeUInt8(u9.PROTOCOL_DNSSEC,G),G+=1,X.writeUInt8(W.algorithm,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,u9.encode.bytes=G-Y,X.writeUInt16BE(u9.encode.bytes-2,Y),X};u9.encode.bytes=0;u9.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);if(X+=2,Y.flags=W.readUInt16BE(X),X+=2,W.readUInt8(X)!==u9.PROTOCOL_DNSSEC)throw Error("Protocol must be 3");return X+=1,Y.algorithm=W.readUInt8(X),X+=1,Y.key=W.slice(X,G+J+2),X+=Y.key.length,u9.decode.bytes=X-G,Y};u9.decode.bytes=0;u9.encodingLength=function(W){return 6+Z1.byteLength(W.key)};var y7=wd.rrsig={};y7.encode=function(W,X,G){if(!X)X=Z1.alloc(y7.encodingLength(W));if(!G)G=0;let Y=G,J=W.signature;if(!Z1.isBuffer(J))throw Error("Signature must be a Buffer");return G+=2,X.writeUInt16BE(m4.toType(W.typeCovered),G),G+=2,X.writeUInt8(W.algorithm,G),G+=1,X.writeUInt8(W.labels,G),G+=1,X.writeUInt32BE(W.originalTTL,G),G+=4,X.writeUInt32BE(W.expiration,G),G+=4,X.writeUInt32BE(W.inception,G),G+=4,X.writeUInt16BE(W.keyTag,G),G+=2,g0.encode(W.signersName,X,G),G+=g0.encode.bytes,J.copy(X,G,0,J.length),G+=J.length,y7.encode.bytes=G-Y,X.writeUInt16BE(y7.encode.bytes-2,Y),X};y7.encode.bytes=0;y7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);return X+=2,Y.typeCovered=m4.toString(W.readUInt16BE(X)),X+=2,Y.algorithm=W.readUInt8(X),X+=1,Y.labels=W.readUInt8(X),X+=1,Y.originalTTL=W.readUInt32BE(X),X+=4,Y.expiration=W.readUInt32BE(X),X+=4,Y.inception=W.readUInt32BE(X),X+=4,Y.keyTag=W.readUInt16BE(X),X+=2,Y.signersName=g0.decode(W,X),X+=g0.decode.bytes,Y.signature=W.slice(X,G+J+2),X+=Y.signature.length,y7.decode.bytes=X-G,Y};y7.decode.bytes=0;y7.encodingLength=function(W){return 20+g0.encodingLength(W.signersName)+Z1.byteLength(W.signature)};var v7=wd.rp={};v7.encode=function(W,X,G){if(!X)X=Z1.alloc(v7.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,g0.encode(W.mbox||".",X,G,{mail:!0}),G+=g0.encode.bytes,g0.encode(W.txt||".",X,G),G+=g0.encode.bytes,v7.encode.bytes=G-Y,X.writeUInt16BE(v7.encode.bytes-2,Y),X};v7.encode.bytes=0;v7.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.mbox=g0.decode(W,X,{mail:!0})||".",X+=g0.decode.bytes,Y.txt=g0.decode(W,X)||".",X+=g0.decode.bytes,v7.decode.bytes=X-G,Y};v7.decode.bytes=0;v7.encodingLength=function(W){return 2+g0.encodingLength(W.mbox||".")+g0.encodingLength(W.txt||".")};var a8={};a8.encode=function(W,X,G){if(!X)X=Z1.alloc(a8.encodingLength(W));if(!G)G=0;let Y=G;var J=[];for(var Z=0;Z<W.length;Z++){var V=m4.toType(W[Z]);if(J[V>>8]===void 0)J[V>>8]=[];J[V>>8][V>>3&31]|=1<<7-(V&7)}for(Z=0;Z<J.length;Z++)if(J[Z]!==void 0){var U=Z1.from(J[Z]);X.writeUInt8(Z,G),G+=1,X.writeUInt8(U.length,G),G+=1,U.copy(X,G),G+=U.length}return a8.encode.bytes=G-Y,X};a8.encode.bytes=0;a8.decode=function(W,X,G){if(!X)X=0;let Y=X;var J=[];while(X-Y<G){var Z=W.readUInt8(X);X+=1;var V=W.readUInt8(X);X+=1;for(var U=0;U<V;U++){var Q=W.readUInt8(X+U);for(var N=0;N<8;N++)if(Q&1<<7-N){var q=m4.toString(Z<<8|U<<3|N);J.push(q)}}X+=V}return a8.decode.bytes=X-Y,J};a8.decode.bytes=0;a8.encodingLength=function(W){var X=[];for(var G=0;G<W.length;G++){var Y=m4.toType(W[G]);X[Y>>8]=Math.max(X[Y>>8]||0,Y&255)}var J=0;for(G=0;G<X.length;G++)if(X[G]!==void 0)J+=2+Math.ceil((X[G]+1)/8);return J};var g7=wd.nsec={};g7.encode=function(W,X,G){if(!X)X=Z1.alloc(g7.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,g0.encode(W.nextDomain,X,G),G+=g0.encode.bytes,a8.encode(W.rrtypes,X,G),G+=a8.encode.bytes,g7.encode.bytes=G-Y,X.writeUInt16BE(g7.encode.bytes-2,Y),X};g7.encode.bytes=0;g7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);return X+=2,Y.nextDomain=g0.decode(W,X),X+=g0.decode.bytes,Y.rrtypes=a8.decode(W,X,J-(X-G)),X+=a8.decode.bytes,g7.decode.bytes=X-G,Y};g7.decode.bytes=0;g7.encodingLength=function(W){return 2+g0.encodingLength(W.nextDomain)+a8.encodingLength(W.rrtypes)};var u7=wd.nsec3={};u7.encode=function(W,X,G){if(!X)X=Z1.alloc(u7.encodingLength(W));if(!G)G=0;let Y=G,J=W.salt;if(!Z1.isBuffer(J))throw Error("salt must be a Buffer");let Z=W.nextDomain;if(!Z1.isBuffer(Z))throw Error("nextDomain must be a Buffer");return G+=2,X.writeUInt8(W.algorithm,G),G+=1,X.writeUInt8(W.flags,G),G+=1,X.writeUInt16BE(W.iterations,G),G+=2,X.writeUInt8(J.length,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,X.writeUInt8(Z.length,G),G+=1,Z.copy(X,G,0,Z.length),G+=Z.length,a8.encode(W.rrtypes,X,G),G+=a8.encode.bytes,u7.encode.bytes=G-Y,X.writeUInt16BE(u7.encode.bytes-2,Y),X};u7.encode.bytes=0;u7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);X+=2,Y.algorithm=W.readUInt8(X),X+=1,Y.flags=W.readUInt8(X),X+=1,Y.iterations=W.readUInt16BE(X),X+=2;let Z=W.readUInt8(X);X+=1,Y.salt=W.slice(X,X+Z),X+=Z;let V=W.readUInt8(X);return X+=1,Y.nextDomain=W.slice(X,X+V),X+=V,Y.rrtypes=a8.decode(W,X,J-(X-G)),X+=a8.decode.bytes,u7.decode.bytes=X-G,Y};u7.decode.bytes=0;u7.encodingLength=function(W){return 8+W.salt.length+W.nextDomain.length+a8.encodingLength(W.rrtypes)};var h7=wd.ds={};h7.encode=function(W,X,G){if(!X)X=Z1.alloc(h7.encodingLength(W));if(!G)G=0;let Y=G,J=W.digest;if(!Z1.isBuffer(J))throw Error("Digest must be a Buffer");return G+=2,X.writeUInt16BE(W.keyTag,G),G+=2,X.writeUInt8(W.algorithm,G),G+=1,X.writeUInt8(W.digestType,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,h7.encode.bytes=G-Y,X.writeUInt16BE(h7.encode.bytes-2,Y),X};h7.encode.bytes=0;h7.decode=function(W,X){if(!X)X=0;let G=X;var Y={},J=W.readUInt16BE(X);return X+=2,Y.keyTag=W.readUInt16BE(X),X+=2,Y.algorithm=W.readUInt8(X),X+=1,Y.digestType=W.readUInt8(X),X+=1,Y.digest=W.slice(X,G+J+2),X+=Y.digest.length,h7.decode.bytes=X-G,Y};h7.decode.bytes=0;h7.encodingLength=function(W){return 6+Z1.byteLength(W.digest)};var H5=wd.sshfp={};H5.getFingerprintLengthForHashType=function(X){switch(X){case 1:return 20;case 2:return 32}};H5.encode=function(X,G,Y){if(!G)G=Z1.alloc(H5.encodingLength(X));if(!Y)Y=0;let J=Y;Y+=2,G[Y]=X.algorithm,Y+=1,G[Y]=X.hash,Y+=1;let Z=Z1.from(X.fingerprint.toUpperCase(),"hex");if(Z.length!==H5.getFingerprintLengthForHashType(X.hash))throw Error("Invalid fingerprint length");return Z.copy(G,Y),Y+=Z.byteLength,H5.encode.bytes=Y-J,G.writeUInt16BE(H5.encode.bytes-2,J),G};H5.encode.bytes=0;H5.decode=function(X,G){if(!G)G=0;let Y=G,J={};G+=2,J.algorithm=X[G],G+=1,J.hash=X[G],G+=1;let Z=H5.getFingerprintLengthForHashType(J.hash);return J.fingerprint=X.slice(G,G+Z).toString("hex").toUpperCase(),G+=Z,H5.decode.bytes=G-Y,J};H5.decode.bytes=0;H5.encodingLength=function(W){return 4+Z1.from(W.fingerprint,"hex").byteLength};var b7=wd.naptr={};b7.encode=function(W,X,G){if(!X)X=Z1.alloc(b7.encodingLength(W));if(!G)G=0;let Y=G;return G+=2,X.writeUInt16BE(W.order||0,G),G+=2,X.writeUInt16BE(W.preference||0,G),G+=2,v1.encode(W.flags,X,G),G+=v1.encode.bytes,v1.encode(W.services,X,G),G+=v1.encode.bytes,v1.encode(W.regexp,X,G),G+=v1.encode.bytes,g0.encode(W.replacement,X,G),G+=g0.encode.bytes,b7.encode.bytes=G-Y,X.writeUInt16BE(b7.encode.bytes-2,Y),X};b7.encode.bytes=0;b7.decode=function(W,X){if(!X)X=0;let G=X,Y={};return X+=2,Y.order=W.readUInt16BE(X),X+=2,Y.preference=W.readUInt16BE(X),X+=2,Y.flags=v1.decode(W,X),X+=v1.decode.bytes,Y.services=v1.decode(W,X),X+=v1.decode.bytes,Y.regexp=v1.decode(W,X),X+=v1.decode.bytes,Y.replacement=g0.decode(W,X),X+=g0.decode.bytes,b7.decode.bytes=X-G,Y};b7.decode.bytes=0;b7.encodingLength=function(W){return v1.encodingLength(W.flags)+v1.encodingLength(W.services)+v1.encodingLength(W.regexp)+g0.encodingLength(W.replacement)+6};var m7=wd.tlsa={};m7.encode=function(W,X,G){if(!X)X=Z1.alloc(m7.encodingLength(W));if(!G)G=0;let Y=G,J=W.certificate;if(!Z1.isBuffer(J))throw Error("Certificate must be a Buffer");return G+=2,X.writeUInt8(W.usage,G),G+=1,X.writeUInt8(W.selector,G),G+=1,X.writeUInt8(W.matchingType,G),G+=1,J.copy(X,G,0,J.length),G+=J.length,m7.encode.bytes=G-Y,X.writeUInt16BE(m7.encode.bytes-2,Y),X};m7.encode.bytes=0;m7.decode=function(W,X){if(!X)X=0;let G=X,Y={},J=W.readUInt16BE(X);return X+=2,Y.usage=W.readUInt8(X),X+=1,Y.selector=W.readUInt8(X),X+=1,Y.matchingType=W.readUInt8(X),X+=1,Y.certificate=W.slice(X,G+J+2),X+=Y.certificate.length,m7.decode.bytes=X-G,Y};m7.decode.bytes=0;m7.encodingLength=function(W){return 5+Z1.byteLength(W.certificate)};var XK=wd.record=function(W){switch(W.toUpperCase()){case"A":return h4;case"PTR":return s5;case"CNAME":return zd;case"DNAME":return Id;case"TXT":return y4;case"NULL":return v4;case"AAAA":return b4;case"SRV":return u4;case"HINFO":return g4;case"CAA":return q5;case"NS":return k4;case"SOA":return _4;case"MX":return n6;case"OPT":return A5;case"DNSKEY":return u9;case"RRSIG":return y7;case"RP":return v7;case"NSEC":return g7;case"NSEC3":return u7;case"SSHFP":return H5;case"DS":return h7;case"NAPTR":return b7;case"TLSA":return m7}return x4},V9=wd.answer={};V9.encode=function(W,X,G){if(!X)X=Z1.alloc(V9.encodingLength(W));if(!G)G=0;let Y=G;if(g0.encode(W.name,X,G),G+=g0.encode.bytes,X.writeUInt16BE(m4.toType(W.type),G),W.type.toUpperCase()==="OPT"){if(W.name!==".")throw Error("OPT name must be root.");X.writeUInt16BE(W.udpPayloadSize||4096,G+2),X.writeUInt8(W.extendedRcode||0,G+4),X.writeUInt8(W.ednsVersion||0,G+5),X.writeUInt16BE(W.flags||0,G+6),G+=8,A5.encode(W.options||[],X,G),G+=A5.encode.bytes}else{let J=Sq.toClass(W.class===void 0?"IN":W.class);if(W.flush)J|=32768;X.writeUInt16BE(J,G+2),X.writeUInt32BE(W.ttl||0,G+4),G+=8;let Z=XK(W.type);Z.encode(W.data,X,G),G+=Z.encode.bytes}return V9.encode.bytes=G-Y,X};V9.encode.bytes=0;V9.decode=function(W,X){if(!X)X=0;let G={},Y=X;if(G.name=g0.decode(W,X),X+=g0.decode.bytes,G.type=m4.toString(W.readUInt16BE(X)),G.type==="OPT")G.udpPayloadSize=W.readUInt16BE(X+2),G.extendedRcode=W.readUInt8(X+4),G.ednsVersion=W.readUInt8(X+5),G.flags=W.readUInt16BE(X+6),G.flag_do=(G.flags>>15&1)===1,G.options=A5.decode(W,X+8),X+=8+A5.decode.bytes;else{let J=W.readUInt16BE(X+2);G.ttl=W.readUInt32BE(X+4),G.class=Sq.toString(J&-32769),G.flush=!!(J&32768);let Z=XK(G.type);G.data=Z.decode(W,X+8),X+=8+Z.decode.bytes}return V9.decode.bytes=X-Y,G};V9.decode.bytes=0;V9.encodingLength=function(W){let X=W.data!==null&&W.data!==void 0?W.data:W.options;return g0.encodingLength(W.name)+8+XK(W.type).encodingLength(X)};var t5=wd.question={};t5.encode=function(W,X,G){if(!X)X=Z1.alloc(t5.encodingLength(W));if(!G)G=0;let Y=G;return g0.encode(W.name,X,G),G+=g0.encode.bytes,X.writeUInt16BE(m4.toType(W.type),G),G+=2,X.writeUInt16BE(Sq.toClass(W.class===void 0?"IN":W.class),G),G+=2,t5.encode.bytes=G-Y,W};t5.encode.bytes=0;t5.decode=function(W,X){if(!X)X=0;let G=X,Y={};if(Y.name=g0.decode(W,X),X+=g0.decode.bytes,Y.type=m4.toString(W.readUInt16BE(X)),X+=2,Y.class=Sq.toString(W.readUInt16BE(X)),X+=2,!!(Y.class&32768))Y.class&=-32769;return t5.decode.bytes=X-G,Y};t5.decode.bytes=0;t5.encodingLength=function(W){return g0.encodingLength(W.name)+4};wd.AUTHORITATIVE_ANSWER=1024;wd.TRUNCATED_RESPONSE=512;wd.RECURSION_DESIRED=256;wd.RECURSION_AVAILABLE=128;wd.AUTHENTIC_DATA=32;wd.CHECKING_DISABLED=16;wd.DNSSEC_OK=32768;wd.encode=function(W,X,G){let Y=!X;if(Y)X=Z1.alloc(wd.encodingLength(W));if(!G)G=0;let J=G;if(!W.questions)W.questions=[];if(!W.answers)W.answers=[];if(!W.authorities)W.authorities=[];if(!W.additionals)W.additionals=[];if(e5.encode(W,X,G),G+=e5.encode.bytes,G=SV(W.questions,t5,X,G),G=SV(W.answers,V9,X,G),G=SV(W.authorities,V9,X,G),G=SV(W.additionals,V9,X,G),wd.encode.bytes=G-J,Y&&wd.encode.bytes!==X.length)return X.slice(0,wd.encode.bytes);return X};wd.encode.bytes=0;wd.decode=function(W,X){if(!X)X=0;let G=X,Y=e5.decode(W,X);return X+=e5.decode.bytes,X=Fq(Y.questions,t5,W,X),X=Fq(Y.answers,V9,W,X),X=Fq(Y.authorities,V9,W,X),X=Fq(Y.additionals,V9,W,X),wd.decode.bytes=X-G,Y};wd.decode.bytes=0;wd.encodingLength=function(W){return e5.encodingLength(W)+$Y(W.questions||[],t5)+$Y(W.answers||[],V9)+$Y(W.authorities||[],V9)+$Y(W.additionals||[],V9)};wd.streamEncode=function(W){let X=wd.encode(W),G=Z1.alloc(2);G.writeUInt16BE(X.byteLength);let Y=Z1.concat([G,X]);return wd.streamEncode.bytes=Y.byteLength,Y};wd.streamEncode.bytes=0;wd.streamDecode=function(W){let X=W.readUInt16BE(0);if(W.byteLength<X+2)return null;let G=wd.decode(W.slice(2));return wd.streamDecode.bytes=wd.decode.bytes,G};wd.streamDecode.bytes=0;function $Y(W,X){let G=0;for(let Y=0;Y<W.length;Y++)G+=X.encodingLength(W[Y]);return G}function SV(W,X,G,Y){for(let J=0;J<W.length;J++)X.encode(W[J],G,Y),Y+=X.encode.bytes;return Y}function Fq(W,X,G,Y){for(let J=0;J<W.length;J++)W[J]=X.decode(G,Y),Y+=X.decode.bytes;return Y}});var f$=V1((xH0,m$)=>{var b$=Fd;process.nextTick($d,42);m$.exports=Rd;function Rd(W){var X=Y;return G;function G(J){X(J||Bd)}function Y(J){var Z=[J];X=V,W(U);function V(Q){Z.push(Q)}function U(Q){var N=arguments;X=Ld(Q)?Y:q;while(Z.length)q(Z.shift());function q(A){b$(Ed,A,N)}}}}function Ld(W){return Object.prototype.toString.call(W)==="[object Error]"}function Bd(){}function Ed(W,X){W.apply(null,X)}function $d(W){if(W===42)b$=process.nextTick}function Fd(W,X,G){process.nextTick(function(){W(X,G)})}});var l$=V1((kH0,c$)=>{var GK=h$(),Sd=_8("dgram"),xd=f$(),kd=_8("events"),JK=_8("os"),YK=function(){};c$.exports=function(W){if(!W)W={};var X=new kd.EventEmitter,G=typeof W.port==="number"?W.port:5353,Y=W.type||"udp4",J=W.ip||W.host||(Y==="udp4"?"224.0.0.251":null),Z={address:J,port:G},V={},U=!1,Q=null;if(Y==="udp6"&&(!J||!W.interface))throw Error("For IPv6 multicast you must specify `ip` and `interface`");var N=W.socket||Sd.createSocket({type:Y,reuseAddr:W.reuseAddr!==!1,toString:function(){return Y}});N.on("error",function(A){if(A.code==="EACCES"||A.code==="EADDRINUSE")X.emit("error",A);else X.emit("warning",A)}),N.on("message",function(A,H){try{A=GK.decode(A)}catch(I){X.emit("warning",I);return}if(X.emit("packet",A,H),A.type==="query")X.emit("query",A,H);if(A.type==="response")X.emit("response",A,H)}),N.on("listening",function(){if(!G)G=Z.port=N.address().port;if(W.multicast!==!1)X.update(),Q=setInterval(X.update,5000),N.setMulticastTTL(W.ttl||255),N.setMulticastLoopback(W.loopback!==!1)});var q=xd(function(A){if(!G||W.bind===!1)return A(null);N.once("error",A),N.bind(G,W.bind||W.interface,function(){N.removeListener("error",A),A(null)})});return q(function(A){if(A)return X.emit("error",A);X.emit("ready")}),X.send=function(A,H,I){if(typeof H==="function")return X.send(A,null,H);if(!I)I=YK;if(!H)H=Z;else if(!H.host&&!H.address)H.address=Z.address;q(w);function w(D){if(U)return I();if(D)return I(D);var T=GK.encode(A);N.send(T,0,T.length,H.port,H.address||H.host,I)}},X.response=X.respond=function(A,H,I){if(Array.isArray(A))A={answers:A};A.type="response",A.flags=(A.flags||0)|GK.AUTHORITATIVE_ANSWER,X.send(A,H,I)},X.query=function(A,H,I,w){if(typeof H==="function")return X.query(A,null,null,H);if(typeof H==="object"&&H&&H.port)return X.query(A,null,H,I);if(typeof I==="function")return X.query(A,H,null,I);if(!w)w=YK;if(typeof A==="string")A=[{name:A,type:H||"ANY"}];if(Array.isArray(A))A={type:"query",questions:A};A.type="query",X.send(A,I,w)},X.destroy=function(A){if(!A)A=YK;if(U)return process.nextTick(A);U=!0,clearInterval(Q);for(var H in V)try{N.dropMembership(J,H)}catch(I){}V={},N.close(A)},X.update=function(){var A=W.interface?[].concat(W.interface):yd(),H=!1;for(var I=0;I<A.length;I++){var w=A[I];if(V[w])continue;try{N.addMembership(J,w),V[w]=!0,H=!0}catch(D){X.emit("warning",D)}}if(H){if(N.setMulticastInterface)try{N.setMulticastInterface(W.interface||_d())}catch(D){X.emit("warning",D)}X.emit("networkInterface")}},X};function _d(){var W=JK.networkInterfaces(),X=Object.keys(W);for(var G=0;G<X.length;G++){var Y=W[X[G]];for(var J=0;J<Y.length;J++){var Z=Y[J];if(p$(Z.family)&&!Z.internal){if(JK.platform()==="darwin"&&X[G]==="en0")return Z.address;return"0.0.0.0"}}}return"127.0.0.1"}function yd(){var W=JK.networkInterfaces(),X=Object.keys(W),G=[];for(var Y=0;Y<X.length;Y++){var J=W[X[Y]];for(var Z=0;Z<J.length;Z++){var V=J[Z];if(p$(V.family)){G.push(V.address);break}}}return G}function p$(W){return W===4||W==="IPv4"}});import{Database as $t}from"bun:sqlite";import{mkdirSync as Ft}from"fs";import{dirname as St}from"path";function zO(W){let X=W.length,G=0,Y=0;while(Y<X){let J=W.charCodeAt(Y++);if((J&4294967168)===0){G++;continue}else if((J&4294965248)===0)G+=2;else{if(J>=55296&&J<=56319){if(Y<X){let Z=W.charCodeAt(Y);if((Z&64512)===56320)++Y,J=((J&1023)<<10)+(Z&1023)+65536}}if((J&4294901760)===0)G+=3;else G+=4}}return G}function o_(W,X,G){let Y=W.length,J=G,Z=0;while(Z<Y){let V=W.charCodeAt(Z++);if((V&4294967168)===0){X[J++]=V;continue}else if((V&4294965248)===0)X[J++]=V>>6&31|192;else{if(V>=55296&&V<=56319){if(Z<Y){let U=W.charCodeAt(Z);if((U&64512)===56320)++Z,V=((V&1023)<<10)+(U&1023)+65536}}if((V&4294901760)===0)X[J++]=V>>12&15|224,X[J++]=V>>6&63|128;else X[J++]=V>>18&7|240,X[J++]=V>>12&63|128,X[J++]=V>>6&63|128}X[J++]=V&63|128}}var n_=new TextEncoder,i_=50;function r_(W,X,G){n_.encodeInto(W,X.subarray(G))}function IO(W,X,G){if(W.length>i_)r_(W,X,G);else o_(W,X,G)}var a_=4096;function IA(W,X,G){let Y=X,J=Y+G,Z=[],V="";while(Y<J){let U=W[Y++];if((U&128)===0)Z.push(U);else if((U&224)===192){let Q=W[Y++]&63;Z.push((U&31)<<6|Q)}else if((U&240)===224){let Q=W[Y++]&63,N=W[Y++]&63;Z.push((U&31)<<12|Q<<6|N)}else if((U&248)===240){let Q=W[Y++]&63,N=W[Y++]&63,q=W[Y++]&63,A=(U&7)<<18|Q<<12|N<<6|q;if(A>65535)A-=65536,Z.push(A>>>10&1023|55296),A=56320|A&1023;Z.push(A)}else Z.push(U);if(Z.length>=a_)V+=String.fromCharCode(...Z),Z.length=0}if(Z.length>0)V+=String.fromCharCode(...Z);return V}var s_=new TextDecoder,t_=200;function e_(W,X,G){let Y=W.subarray(X,X+G);return s_.decode(Y)}function wO(W,X,G){if(G>t_)return e_(W,X,G);else return IA(W,X,G)}class cX{type;data;constructor(W,X){this.type=W,this.data=X}}class x9 extends Error{constructor(W){super(W);let X=Object.create(x9.prototype);Object.setPrototypeOf(this,X),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:x9.name})}}var lX=4294967295;function jO(W,X,G){let Y=G/4294967296,J=G;W.setUint32(X,Y),W.setUint32(X+4,J)}function vU(W,X,G){let Y=Math.floor(G/4294967296),J=G;W.setUint32(X,Y),W.setUint32(X+4,J)}function gU(W,X){let G=W.getInt32(X),Y=W.getUint32(X+4);return G*4294967296+Y}function KO(W,X){let G=W.getUint32(X),Y=W.getUint32(X+4);return G*4294967296+Y}var Wy=-1,Xy=4294967295,Gy=17179869183;function Yy({sec:W,nsec:X}){if(W>=0&&X>=0&&W<=Gy)if(X===0&&W<=Xy){let G=new Uint8Array(4);return new DataView(G.buffer).setUint32(0,W),G}else{let G=W/4294967296,Y=W&4294967295,J=new Uint8Array(8),Z=new DataView(J.buffer);return Z.setUint32(0,X<<2|G&3),Z.setUint32(4,Y),J}else{let G=new Uint8Array(12),Y=new DataView(G.buffer);return Y.setUint32(0,X),vU(Y,4,W),G}}function Jy(W){let X=W.getTime(),G=Math.floor(X/1000),Y=(X-G*1000)*1e6,J=Math.floor(Y/1e9);return{sec:G+J,nsec:Y-J*1e9}}function Zy(W){if(W instanceof Date){let X=Jy(W);return Yy(X)}else return null}function Vy(W){let X=new DataView(W.buffer,W.byteOffset,W.byteLength);switch(W.byteLength){case 4:{let G=X.getUint32(0),Y=0;return{sec:G,nsec:0}}case 8:{let G=X.getUint32(0),Y=X.getUint32(4),J=(G&3)*4294967296+Y,Z=G>>>2;return{sec:J,nsec:Z}}case 12:{let G=gU(X,4),Y=X.getUint32(0);return{sec:G,nsec:Y}}default:throw new x9(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${W.length}`)}}function Uy(W){let X=Vy(W);return new Date(X.sec*1000+X.nsec/1e6)}var DO={type:Wy,encode:Zy,decode:Uy};class dX{static defaultCodec=new dX;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(DO)}register({type:W,encode:X,decode:G}){if(W>=0)this.encoders[W]=X,this.decoders[W]=G;else{let Y=-1-W;this.builtInEncoders[Y]=X,this.builtInDecoders[Y]=G}}tryToEncode(W,X){for(let G=0;G<this.builtInEncoders.length;G++){let Y=this.builtInEncoders[G];if(Y!=null){let J=Y(W,X);if(J!=null){let Z=-1-G;return new cX(Z,J)}}}for(let G=0;G<this.encoders.length;G++){let Y=this.encoders[G];if(Y!=null){let J=Y(W,X);if(J!=null)return new cX(G,J)}}if(W instanceof cX)return W;return null}decode(W,X,G){let Y=X<0?this.builtInDecoders[-1-X]:this.decoders[X];if(Y)return Y(W,X,G);else return new cX(X,W)}}function Qy(W){return W instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&W instanceof SharedArrayBuffer}function QJ(W){if(W instanceof Uint8Array)return W;else if(ArrayBuffer.isView(W))return new Uint8Array(W.buffer,W.byteOffset,W.byteLength);else if(Qy(W))return new Uint8Array(W);else return Uint8Array.from(W)}var Ny=100,qy=2048;class uU{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dX.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.maxDepth=W?.maxDepth??Ny,this.initialBufferSize=W?.initialBufferSize??qy,this.sortKeys=W?.sortKeys??!1,this.forceFloat32=W?.forceFloat32??!1,this.ignoreUndefined=W?.ignoreUndefined??!1,this.forceIntegerToFloat=W?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new uU({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(W){if(this.entered)return this.clone().encodeSharedRef(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(W){if(this.entered)return this.clone().encode(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(W,X){if(X>this.maxDepth)throw Error(`Too deep objects in depth ${X}`);if(W==null)this.encodeNil();else if(typeof W==="boolean")this.encodeBoolean(W);else if(typeof W==="number")if(!this.forceIntegerToFloat)this.encodeNumber(W);else this.encodeNumberAsFloat(W);else if(typeof W==="string")this.encodeString(W);else if(this.useBigInt64&&typeof W==="bigint")this.encodeBigInt64(W);else this.encodeObject(W,X)}ensureBufferSizeToWrite(W){let X=this.pos+W;if(this.view.byteLength<X)this.resizeBuffer(X*2)}resizeBuffer(W){let X=new ArrayBuffer(W),G=new Uint8Array(X),Y=new DataView(X);G.set(this.bytes),this.view=Y,this.bytes=G}encodeNil(){this.writeU8(192)}encodeBoolean(W){if(W===!1)this.writeU8(194);else this.writeU8(195)}encodeNumber(W){if(!this.forceIntegerToFloat&&Number.isSafeInteger(W))if(W>=0)if(W<128)this.writeU8(W);else if(W<256)this.writeU8(204),this.writeU8(W);else if(W<65536)this.writeU8(205),this.writeU16(W);else if(W<4294967296)this.writeU8(206),this.writeU32(W);else if(!this.useBigInt64)this.writeU8(207),this.writeU64(W);else this.encodeNumberAsFloat(W);else if(W>=-32)this.writeU8(224|W+32);else if(W>=-128)this.writeU8(208),this.writeI8(W);else if(W>=-32768)this.writeU8(209),this.writeI16(W);else if(W>=-2147483648)this.writeU8(210),this.writeI32(W);else if(!this.useBigInt64)this.writeU8(211),this.writeI64(W);else this.encodeNumberAsFloat(W);else this.encodeNumberAsFloat(W)}encodeNumberAsFloat(W){if(this.forceFloat32)this.writeU8(202),this.writeF32(W);else this.writeU8(203),this.writeF64(W)}encodeBigInt64(W){if(W>=BigInt(0))this.writeU8(207),this.writeBigUint64(W);else this.writeU8(211),this.writeBigInt64(W)}writeStringHeader(W){if(W<32)this.writeU8(160+W);else if(W<256)this.writeU8(217),this.writeU8(W);else if(W<65536)this.writeU8(218),this.writeU16(W);else if(W<4294967296)this.writeU8(219),this.writeU32(W);else throw Error(`Too long string: ${W} bytes in UTF-8`)}encodeString(W){let G=zO(W);this.ensureBufferSizeToWrite(5+G),this.writeStringHeader(G),IO(W,this.bytes,this.pos),this.pos+=G}encodeObject(W,X){let G=this.extensionCodec.tryToEncode(W,this.context);if(G!=null)this.encodeExtension(G);else if(Array.isArray(W))this.encodeArray(W,X);else if(ArrayBuffer.isView(W))this.encodeBinary(W);else if(typeof W==="object")this.encodeMap(W,X);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(W)}`)}encodeBinary(W){let X=W.byteLength;if(X<256)this.writeU8(196),this.writeU8(X);else if(X<65536)this.writeU8(197),this.writeU16(X);else if(X<4294967296)this.writeU8(198),this.writeU32(X);else throw Error(`Too large binary: ${X}`);let G=QJ(W);this.writeU8a(G)}encodeArray(W,X){let G=W.length;if(G<16)this.writeU8(144+G);else if(G<65536)this.writeU8(220),this.writeU16(G);else if(G<4294967296)this.writeU8(221),this.writeU32(G);else throw Error(`Too large array: ${G}`);for(let Y of W)this.doEncode(Y,X+1)}countWithoutUndefined(W,X){let G=0;for(let Y of X)if(W[Y]!==void 0)G++;return G}encodeMap(W,X){let G=Object.keys(W);if(this.sortKeys)G.sort();let Y=this.ignoreUndefined?this.countWithoutUndefined(W,G):G.length;if(Y<16)this.writeU8(128+Y);else if(Y<65536)this.writeU8(222),this.writeU16(Y);else if(Y<4294967296)this.writeU8(223),this.writeU32(Y);else throw Error(`Too large map object: ${Y}`);for(let J of G){let Z=W[J];if(!(this.ignoreUndefined&&Z===void 0))this.encodeString(J),this.doEncode(Z,X+1)}}encodeExtension(W){if(typeof W.data==="function"){let G=W.data(this.pos+6),Y=G.length;if(Y>=4294967296)throw Error(`Too large extension object: ${Y}`);this.writeU8(201),this.writeU32(Y),this.writeI8(W.type),this.writeU8a(G);return}let X=W.data.length;if(X===1)this.writeU8(212);else if(X===2)this.writeU8(213);else if(X===4)this.writeU8(214);else if(X===8)this.writeU8(215);else if(X===16)this.writeU8(216);else if(X<256)this.writeU8(199),this.writeU8(X);else if(X<65536)this.writeU8(200),this.writeU16(X);else if(X<4294967296)this.writeU8(201),this.writeU32(X);else throw Error(`Too large extension object: ${X}`);this.writeI8(W.type),this.writeU8a(W.data)}writeU8(W){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,W),this.pos++}writeU8a(W){let X=W.length;this.ensureBufferSizeToWrite(X),this.bytes.set(W,this.pos),this.pos+=X}writeI8(W){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,W),this.pos++}writeU16(W){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,W),this.pos+=2}writeI16(W){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,W),this.pos+=2}writeU32(W){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,W),this.pos+=4}writeI32(W){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,W),this.pos+=4}writeF32(W){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,W),this.pos+=4}writeF64(W){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,W),this.pos+=8}writeU64(W){this.ensureBufferSizeToWrite(8),jO(this.view,this.pos,W),this.pos+=8}writeI64(W){this.ensureBufferSizeToWrite(8),vU(this.view,this.pos,W),this.pos+=8}writeBigUint64(W){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,W),this.pos+=8}writeBigInt64(W){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,W),this.pos+=8}}function hU(W,X){return new uU(X).encodeSharedRef(W)}function bU(W){return`${W<0?"-":""}0x${Math.abs(W).toString(16).padStart(2,"0")}`}var Hy=16,Ay=16;class wA{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(W=Hy,X=Ay){this.maxKeyLength=W,this.maxLengthPerKey=X,this.caches=[];for(let G=0;G<this.maxKeyLength;G++)this.caches.push([])}canBeCached(W){return W>0&&W<=this.maxKeyLength}find(W,X,G){let Y=this.caches[G-1];W:for(let J of Y){let Z=J.bytes;for(let V=0;V<G;V++)if(Z[V]!==W[X+V])continue W;return J.str}return null}store(W,X){let G=this.caches[W.length-1],Y={bytes:W,str:X};if(G.length>=this.maxLengthPerKey)G[Math.random()*G.length|0]=Y;else G.push(Y)}decode(W,X,G){let Y=this.find(W,X,G);if(Y!=null)return this.hit++,Y;this.miss++;let J=IA(W,X,G),Z=Uint8Array.prototype.slice.call(W,X,X+G);return this.store(Z,J),J}}var jA="array",qJ="map_key",CO="map_value",zy=(W)=>{if(typeof W==="string"||typeof W==="number")return W;throw new x9("The type of key must be string or number but "+typeof W)};class TO{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(W){let X=this.getUninitializedStateFromPool();X.type=jA,X.position=0,X.size=W,X.array=Array(W)}pushMapState(W){let X=this.getUninitializedStateFromPool();X.type=qJ,X.readCount=0,X.size=W,X.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let W={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(W)}return this.stack[this.stackHeadPosition]}release(W){if(this.stack[this.stackHeadPosition]!==W)throw Error("Invalid stack state. Released state is not on top of the stack.");if(W.type===jA){let G=W;G.size=0,G.array=void 0,G.position=0,G.type=void 0}if(W.type===qJ||W.type===CO){let G=W;G.size=0,G.map=void 0,G.readCount=0,G.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}var NJ=-1,KA=new DataView(new ArrayBuffer(0)),Iy=new Uint8Array(KA.buffer);try{KA.getInt8(0)}catch(W){if(!(W instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var OO=RangeError("Insufficient data"),wy=new wA;class mU{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=KA;bytes=Iy;headByte=NJ;stack=new TO;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dX.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.rawStrings=W?.rawStrings??!1,this.maxStrLength=W?.maxStrLength??lX,this.maxBinLength=W?.maxBinLength??lX,this.maxArrayLength=W?.maxArrayLength??lX,this.maxMapLength=W?.maxMapLength??lX,this.maxExtLength=W?.maxExtLength??lX,this.keyDecoder=W?.keyDecoder!==void 0?W.keyDecoder:wy,this.mapKeyConverter=W?.mapKeyConverter??zy}clone(){return new mU({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=NJ,this.stack.reset()}setBuffer(W){let X=QJ(W);this.bytes=X,this.view=new DataView(X.buffer,X.byteOffset,X.byteLength),this.pos=0}appendBuffer(W){if(this.headByte===NJ&&!this.hasRemaining(1))this.setBuffer(W);else{let X=this.bytes.subarray(this.pos),G=QJ(W),Y=new Uint8Array(X.length+G.length);Y.set(X),Y.set(G,X.length),this.setBuffer(Y)}}hasRemaining(W){return this.view.byteLength-this.pos>=W}createExtraByteError(W){let{view:X,pos:G}=this;return RangeError(`Extra ${X.byteLength-G} of ${X.byteLength} byte(s) found at buffer[${W}]`)}decode(W){if(this.entered)return this.clone().decode(W);try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);let X=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return X}finally{this.entered=!1}}*decodeMulti(W){if(this.entered){yield*this.clone().decodeMulti(W);return}try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);while(this.hasRemaining(1))yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(W){if(this.entered)return this.clone().decodeAsync(W);try{this.entered=!0;let X=!1,G;for await(let V of W){if(X)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(V);try{G=this.doDecodeSync(),X=!0}catch(U){if(!(U instanceof RangeError))throw U}this.totalPos+=this.pos}if(X){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return G}let{headByte:Y,pos:J,totalPos:Z}=this;throw RangeError(`Insufficient data in parsing ${bU(Y)} at ${Z} (${J} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(W){return this.decodeMultiAsync(W,!0)}decodeStream(W){return this.decodeMultiAsync(W,!1)}async*decodeMultiAsync(W,X){if(this.entered){yield*this.clone().decodeMultiAsync(W,X);return}try{this.entered=!0;let G=X,Y=-1;for await(let J of W){if(X&&Y===0)throw this.createExtraByteError(this.totalPos);if(this.appendBuffer(J),G)Y=this.readArraySize(),G=!1,this.complete();try{while(!0)if(yield this.doDecodeSync(),--Y===0)break}catch(Z){if(!(Z instanceof RangeError))throw Z}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){W:while(!0){let W=this.readHeadByte(),X;if(W>=224)X=W-256;else if(W<192)if(W<128)X=W;else if(W<144){let Y=W-128;if(Y!==0){this.pushMapState(Y),this.complete();continue W}else X={}}else if(W<160){let Y=W-144;if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else X=[]}else{let Y=W-160;X=this.decodeString(Y,0)}else if(W===192)X=null;else if(W===194)X=!1;else if(W===195)X=!0;else if(W===202)X=this.readF32();else if(W===203)X=this.readF64();else if(W===204)X=this.readU8();else if(W===205)X=this.readU16();else if(W===206)X=this.readU32();else if(W===207)if(this.useBigInt64)X=this.readU64AsBigInt();else X=this.readU64();else if(W===208)X=this.readI8();else if(W===209)X=this.readI16();else if(W===210)X=this.readI32();else if(W===211)if(this.useBigInt64)X=this.readI64AsBigInt();else X=this.readI64();else if(W===217){let Y=this.lookU8();X=this.decodeString(Y,1)}else if(W===218){let Y=this.lookU16();X=this.decodeString(Y,2)}else if(W===219){let Y=this.lookU32();X=this.decodeString(Y,4)}else if(W===220){let Y=this.readU16();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else X=[]}else if(W===221){let Y=this.readU32();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else X=[]}else if(W===222){let Y=this.readU16();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else X={}}else if(W===223){let Y=this.readU32();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else X={}}else if(W===196){let Y=this.lookU8();X=this.decodeBinary(Y,1)}else if(W===197){let Y=this.lookU16();X=this.decodeBinary(Y,2)}else if(W===198){let Y=this.lookU32();X=this.decodeBinary(Y,4)}else if(W===212)X=this.decodeExtension(1,0);else if(W===213)X=this.decodeExtension(2,0);else if(W===214)X=this.decodeExtension(4,0);else if(W===215)X=this.decodeExtension(8,0);else if(W===216)X=this.decodeExtension(16,0);else if(W===199){let Y=this.lookU8();X=this.decodeExtension(Y,1)}else if(W===200){let Y=this.lookU16();X=this.decodeExtension(Y,2)}else if(W===201){let Y=this.lookU32();X=this.decodeExtension(Y,4)}else throw new x9(`Unrecognized type byte: ${bU(W)}`);this.complete();let G=this.stack;while(G.length>0){let Y=G.top();if(Y.type===jA)if(Y.array[Y.position]=X,Y.position++,Y.position===Y.size)X=Y.array,G.release(Y);else continue W;else if(Y.type===qJ){if(X==="__proto__")throw new x9("The key __proto__ is not allowed");Y.key=this.mapKeyConverter(X),Y.type=CO;continue W}else if(Y.map[Y.key]=X,Y.readCount++,Y.readCount===Y.size)X=Y.map,G.release(Y);else{Y.key=null,Y.type=qJ;continue W}}return X}}readHeadByte(){if(this.headByte===NJ)this.headByte=this.readU8();return this.headByte}complete(){this.headByte=NJ}readArraySize(){let W=this.readHeadByte();switch(W){case 220:return this.readU16();case 221:return this.readU32();default:if(W<160)return W-144;else throw new x9(`Unrecognized array type byte: ${bU(W)}`)}}pushMapState(W){if(W>this.maxMapLength)throw new x9(`Max length exceeded: map length (${W}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(W)}pushArrayState(W){if(W>this.maxArrayLength)throw new x9(`Max length exceeded: array length (${W}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(W)}decodeString(W,X){if(!this.rawStrings||this.stateIsMapKey())return this.decodeUtf8String(W,X);return this.decodeBinary(W,X)}decodeUtf8String(W,X){if(W>this.maxStrLength)throw new x9(`Max length exceeded: UTF-8 byte length (${W}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+X+W)throw OO;let G=this.pos+X,Y;if(this.stateIsMapKey()&&this.keyDecoder?.canBeCached(W))Y=this.keyDecoder.decode(this.bytes,G,W);else Y=wO(this.bytes,G,W);return this.pos+=X+W,Y}stateIsMapKey(){if(this.stack.length>0)return this.stack.top().type===qJ;return!1}decodeBinary(W,X){if(W>this.maxBinLength)throw new x9(`Max length exceeded: bin length (${W}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(W+X))throw OO;let G=this.pos+X,Y=this.bytes.subarray(G,G+W);return this.pos+=X+W,Y}decodeExtension(W,X){if(W>this.maxExtLength)throw new x9(`Max length exceeded: ext length (${W}) > maxExtLength (${this.maxExtLength})`);let G=this.view.getInt8(this.pos+X),Y=this.decodeBinary(W,X+1);return this.extensionCodec.decode(Y,G,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let W=this.view.getUint8(this.pos);return this.pos++,W}readI8(){let W=this.view.getInt8(this.pos);return this.pos++,W}readU16(){let W=this.view.getUint16(this.pos);return this.pos+=2,W}readI16(){let W=this.view.getInt16(this.pos);return this.pos+=2,W}readU32(){let W=this.view.getUint32(this.pos);return this.pos+=4,W}readI32(){let W=this.view.getInt32(this.pos);return this.pos+=4,W}readU64(){let W=KO(this.view,this.pos);return this.pos+=8,W}readI64(){let W=gU(this.view,this.pos);return this.pos+=8,W}readU64AsBigInt(){let W=this.view.getBigUint64(this.pos);return this.pos+=8,W}readI64AsBigInt(){let W=this.view.getBigInt64(this.pos);return this.pos+=8,W}readF32(){let W=this.view.getFloat32(this.pos);return this.pos+=4,W}readF64(){let W=this.view.getFloat64(this.pos);return this.pos+=8,W}}function AW(W,X){return new mU(X).decode(W)}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function sX(W){let X=W.length;while(--X>=0)W[X]=0}var jy=0,VC=1,Ky=2,Dy=3,Oy=258,fA=29,LJ=256,KJ=LJ+1+fA,iX=30,pA=19,UC=2*KJ+1,zW=15,DA=16,Cy=7,cA=256,QC=16,NC=17,qC=18,kA=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),oU=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ty=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),HC=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),My=512,e7=Array((KJ+2)*2);sX(e7);var IJ=Array(iX*2);sX(IJ);var DJ=Array(My);sX(DJ);var OJ=Array(Oy-Dy+1);sX(OJ);var lA=Array(fA);sX(lA);var nU=Array(iX);sX(nU);function OA(W,X,G,Y,J){this.static_tree=W,this.extra_bits=X,this.extra_base=G,this.elems=Y,this.max_length=J,this.has_stree=W&&W.length}var AC,zC,IC;function CA(W,X){this.dyn_tree=W,this.max_code=0,this.stat_desc=X}var wC=(W)=>{return W<256?DJ[W]:DJ[256+(W>>>7)]},CJ=(W,X)=>{W.pending_buf[W.pending++]=X&255,W.pending_buf[W.pending++]=X>>>8&255},b9=(W,X,G)=>{if(W.bi_valid>DA-G)W.bi_buf|=X<<W.bi_valid&65535,CJ(W,W.bi_buf),W.bi_buf=X>>DA-W.bi_valid,W.bi_valid+=G-DA;else W.bi_buf|=X<<W.bi_valid&65535,W.bi_valid+=G},H7=(W,X,G)=>{b9(W,G[X*2],G[X*2+1])},jC=(W,X)=>{let G=0;do G|=W&1,W>>>=1,G<<=1;while(--X>0);return G>>>1},Py=(W)=>{if(W.bi_valid===16)CJ(W,W.bi_buf),W.bi_buf=0,W.bi_valid=0;else if(W.bi_valid>=8)W.pending_buf[W.pending++]=W.bi_buf&255,W.bi_buf>>=8,W.bi_valid-=8},Ry=(W,X)=>{let{dyn_tree:G,max_code:Y}=X,J=X.stat_desc.static_tree,Z=X.stat_desc.has_stree,V=X.stat_desc.extra_bits,U=X.stat_desc.extra_base,Q=X.stat_desc.max_length,N,q,A,H,I,w,D=0;for(H=0;H<=zW;H++)W.bl_count[H]=0;G[W.heap[W.heap_max]*2+1]=0;for(N=W.heap_max+1;N<UC;N++){if(q=W.heap[N],H=G[G[q*2+1]*2+1]+1,H>Q)H=Q,D++;if(G[q*2+1]=H,q>Y)continue;if(W.bl_count[H]++,I=0,q>=U)I=V[q-U];if(w=G[q*2],W.opt_len+=w*(H+I),Z)W.static_len+=w*(J[q*2+1]+I)}if(D===0)return;do{H=Q-1;while(W.bl_count[H]===0)H--;W.bl_count[H]--,W.bl_count[H+1]+=2,W.bl_count[Q]--,D-=2}while(D>0);for(H=Q;H!==0;H--){q=W.bl_count[H];while(q!==0){if(A=W.heap[--N],A>Y)continue;if(G[A*2+1]!==H)W.opt_len+=(H-G[A*2+1])*G[A*2],G[A*2+1]=H;q--}}},KC=(W,X,G)=>{let Y=Array(zW+1),J=0,Z,V;for(Z=1;Z<=zW;Z++)J=J+G[Z-1]<<1,Y[Z]=J;for(V=0;V<=X;V++){let U=W[V*2+1];if(U===0)continue;W[V*2]=jC(Y[U]++,U)}},Ly=()=>{let W,X,G,Y,J,Z=Array(zW+1);G=0;for(Y=0;Y<fA-1;Y++){lA[Y]=G;for(W=0;W<1<<kA[Y];W++)OJ[G++]=Y}OJ[G-1]=Y,J=0;for(Y=0;Y<16;Y++){nU[Y]=J;for(W=0;W<1<<oU[Y];W++)DJ[J++]=Y}J>>=7;for(;Y<iX;Y++){nU[Y]=J<<7;for(W=0;W<1<<oU[Y]-7;W++)DJ[256+J++]=Y}for(X=0;X<=zW;X++)Z[X]=0;W=0;while(W<=143)e7[W*2+1]=8,W++,Z[8]++;while(W<=255)e7[W*2+1]=9,W++,Z[9]++;while(W<=279)e7[W*2+1]=7,W++,Z[7]++;while(W<=287)e7[W*2+1]=8,W++,Z[8]++;KC(e7,KJ+1,Z);for(W=0;W<iX;W++)IJ[W*2+1]=5,IJ[W*2]=jC(W,5);AC=new OA(e7,kA,LJ+1,KJ,zW),zC=new OA(IJ,oU,0,iX,zW),IC=new OA([],Ty,0,pA,Cy)},DC=(W)=>{let X;for(X=0;X<KJ;X++)W.dyn_ltree[X*2]=0;for(X=0;X<iX;X++)W.dyn_dtree[X*2]=0;for(X=0;X<pA;X++)W.bl_tree[X*2]=0;W.dyn_ltree[cA*2]=1,W.opt_len=W.static_len=0,W.sym_next=W.matches=0},OC=(W)=>{if(W.bi_valid>8)CJ(W,W.bi_buf);else if(W.bi_valid>0)W.pending_buf[W.pending++]=W.bi_buf;W.bi_buf=0,W.bi_valid=0},MO=(W,X,G,Y)=>{let J=X*2,Z=G*2;return W[J]<W[Z]||W[J]===W[Z]&&Y[X]<=Y[G]},TA=(W,X,G)=>{let Y=W.heap[G],J=G<<1;while(J<=W.heap_len){if(J<W.heap_len&&MO(X,W.heap[J+1],W.heap[J],W.depth))J++;if(MO(X,Y,W.heap[J],W.depth))break;W.heap[G]=W.heap[J],G=J,J<<=1}W.heap[G]=Y},PO=(W,X,G)=>{let Y,J,Z=0,V,U;if(W.sym_next!==0)do if(Y=W.pending_buf[W.sym_buf+Z++]&255,Y+=(W.pending_buf[W.sym_buf+Z++]&255)<<8,J=W.pending_buf[W.sym_buf+Z++],Y===0)H7(W,J,X);else{if(V=OJ[J],H7(W,V+LJ+1,X),U=kA[V],U!==0)J-=lA[V],b9(W,J,U);if(Y--,V=wC(Y),H7(W,V,G),U=oU[V],U!==0)Y-=nU[V],b9(W,Y,U)}while(Z<W.sym_next);H7(W,cA,X)},_A=(W,X)=>{let G=X.dyn_tree,Y=X.stat_desc.static_tree,J=X.stat_desc.has_stree,Z=X.stat_desc.elems,V,U,Q=-1,N;W.heap_len=0,W.heap_max=UC;for(V=0;V<Z;V++)if(G[V*2]!==0)W.heap[++W.heap_len]=Q=V,W.depth[V]=0;else G[V*2+1]=0;while(W.heap_len<2)if(N=W.heap[++W.heap_len]=Q<2?++Q:0,G[N*2]=1,W.depth[N]=0,W.opt_len--,J)W.static_len-=Y[N*2+1];X.max_code=Q;for(V=W.heap_len>>1;V>=1;V--)TA(W,G,V);N=Z;do V=W.heap[1],W.heap[1]=W.heap[W.heap_len--],TA(W,G,1),U=W.heap[1],W.heap[--W.heap_max]=V,W.heap[--W.heap_max]=U,G[N*2]=G[V*2]+G[U*2],W.depth[N]=(W.depth[V]>=W.depth[U]?W.depth[V]:W.depth[U])+1,G[V*2+1]=G[U*2+1]=N,W.heap[1]=N++,TA(W,G,1);while(W.heap_len>=2);W.heap[--W.heap_max]=W.heap[1],Ry(W,X),KC(G,Q,W.bl_count)},RO=(W,X,G)=>{let Y,J=-1,Z,V=X[1],U=0,Q=7,N=4;if(V===0)Q=138,N=3;X[(G+1)*2+1]=65535;for(Y=0;Y<=G;Y++){if(Z=V,V=X[(Y+1)*2+1],++U<Q&&Z===V)continue;else if(U<N)W.bl_tree[Z*2]+=U;else if(Z!==0){if(Z!==J)W.bl_tree[Z*2]++;W.bl_tree[QC*2]++}else if(U<=10)W.bl_tree[NC*2]++;else W.bl_tree[qC*2]++;if(U=0,J=Z,V===0)Q=138,N=3;else if(Z===V)Q=6,N=3;else Q=7,N=4}},LO=(W,X,G)=>{let Y,J=-1,Z,V=X[1],U=0,Q=7,N=4;if(V===0)Q=138,N=3;for(Y=0;Y<=G;Y++){if(Z=V,V=X[(Y+1)*2+1],++U<Q&&Z===V)continue;else if(U<N)do H7(W,Z,W.bl_tree);while(--U!==0);else if(Z!==0){if(Z!==J)H7(W,Z,W.bl_tree),U--;H7(W,QC,W.bl_tree),b9(W,U-3,2)}else if(U<=10)H7(W,NC,W.bl_tree),b9(W,U-3,3);else H7(W,qC,W.bl_tree),b9(W,U-11,7);if(U=0,J=Z,V===0)Q=138,N=3;else if(Z===V)Q=6,N=3;else Q=7,N=4}},By=(W)=>{let X;RO(W,W.dyn_ltree,W.l_desc.max_code),RO(W,W.dyn_dtree,W.d_desc.max_code),_A(W,W.bl_desc);for(X=pA-1;X>=3;X--)if(W.bl_tree[HC[X]*2+1]!==0)break;return W.opt_len+=3*(X+1)+5+5+4,X},Ey=(W,X,G,Y)=>{let J;b9(W,X-257,5),b9(W,G-1,5),b9(W,Y-4,4);for(J=0;J<Y;J++)b9(W,W.bl_tree[HC[J]*2+1],3);LO(W,W.dyn_ltree,X-1),LO(W,W.dyn_dtree,G-1)},$y=(W)=>{let X=4093624447,G;for(G=0;G<=31;G++,X>>>=1)if(X&1&&W.dyn_ltree[G*2]!==0)return 0;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return 1;for(G=32;G<LJ;G++)if(W.dyn_ltree[G*2]!==0)return 1;return 0},BO=!1,Fy=(W)=>{if(!BO)Ly(),BO=!0;W.l_desc=new CA(W.dyn_ltree,AC),W.d_desc=new CA(W.dyn_dtree,zC),W.bl_desc=new CA(W.bl_tree,IC),W.bi_buf=0,W.bi_valid=0,DC(W)},CC=(W,X,G,Y)=>{if(b9(W,(jy<<1)+(Y?1:0),3),OC(W),CJ(W,G),CJ(W,~G),G)W.pending_buf.set(W.window.subarray(X,X+G),W.pending);W.pending+=G},Sy=(W)=>{b9(W,VC<<1,3),H7(W,cA,e7),Py(W)},xy=(W,X,G,Y)=>{let J,Z,V=0;if(W.level>0){if(W.strm.data_type===2)W.strm.data_type=$y(W);if(_A(W,W.l_desc),_A(W,W.d_desc),V=By(W),J=W.opt_len+3+7>>>3,Z=W.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=G+5;if(G+4<=J&&X!==-1)CC(W,X,G,Y);else if(W.strategy===4||Z===J)b9(W,(VC<<1)+(Y?1:0),3),PO(W,e7,IJ);else b9(W,(Ky<<1)+(Y?1:0),3),Ey(W,W.l_desc.max_code+1,W.d_desc.max_code+1,V+1),PO(W,W.dyn_ltree,W.dyn_dtree);if(DC(W),Y)OC(W)},ky=(W,X,G)=>{if(W.pending_buf[W.sym_buf+W.sym_next++]=X,W.pending_buf[W.sym_buf+W.sym_next++]=X>>8,W.pending_buf[W.sym_buf+W.sym_next++]=G,X===0)W.dyn_ltree[G*2]++;else W.matches++,X--,W.dyn_ltree[(OJ[G]+LJ+1)*2]++,W.dyn_dtree[wC(X)*2]++;return W.sym_next===W.sym_end},_y=Fy,yy=CC,vy=xy,gy=ky,uy=Sy,hy={_tr_init:_y,_tr_stored_block:yy,_tr_flush_block:vy,_tr_tally:gy,_tr_align:uy},by=(W,X,G,Y)=>{let J=W&65535|0,Z=W>>>16&65535|0,V=0;while(G!==0){V=G>2000?2000:G,G-=V;do J=J+X[Y++]|0,Z=Z+J|0;while(--V);J%=65521,Z%=65521}return J|Z<<16|0},TJ=by,my=()=>{let W,X=[];for(var G=0;G<256;G++){W=G;for(var Y=0;Y<8;Y++)W=W&1?3988292384^W>>>1:W>>>1;X[G]=W}return X},fy=new Uint32Array(my()),py=(W,X,G,Y)=>{let J=fy,Z=Y+G;W^=-1;for(let V=Y;V<Z;V++)W=W>>>8^J[(W^X[V])&255];return W^-1},r8=py,jW={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},OW={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:cy,_tr_stored_block:yA,_tr_flush_block:ly,_tr_tally:U6,_tr_align:dy}=hy,{Z_NO_FLUSH:Q6,Z_PARTIAL_FLUSH:oy,Z_FULL_FLUSH:ny,Z_FINISH:j5,Z_BLOCK:EO,Z_OK:W9,Z_STREAM_END:$O,Z_STREAM_ERROR:A7,Z_DATA_ERROR:iy,Z_BUF_ERROR:MA,Z_DEFAULT_COMPRESSION:ry,Z_FILTERED:ay,Z_HUFFMAN_ONLY:fU,Z_RLE:sy,Z_FIXED:ty,Z_DEFAULT_STRATEGY:ey,Z_UNKNOWN:Wv,Z_DEFLATED:aU}=OW,Xv=9,Gv=15,Yv=8,Jv=29,Zv=256,vA=Zv+1+Jv,Vv=30,Uv=19,Qv=2*vA+1,Nv=15,f1=3,V6=258,z7=V6+f1+1,qv=32,rX=42,dA=57,gA=69,uA=73,hA=91,bA=103,IW=113,AJ=666,k9=1,tX=2,KW=3,eX=4,Hv=3,wW=(W,X)=>{return W.msg=jW[X],X},FO=(W)=>{return W*2-(W>4?9:0)},Z6=(W)=>{let X=W.length;while(--X>=0)W[X]=0},Av=(W)=>{let X,G,Y,J=W.w_size;X=W.hash_size,Y=X;do G=W.head[--Y],W.head[Y]=G>=J?G-J:0;while(--X);X=J,Y=X;do G=W.prev[--Y],W.prev[Y]=G>=J?G-J:0;while(--X)},zv=(W,X,G)=>(X<<W.hash_shift^G)&W.hash_mask,N6=zv,X5=(W)=>{let X=W.state,G=X.pending;if(G>W.avail_out)G=W.avail_out;if(G===0)return;if(W.output.set(X.pending_buf.subarray(X.pending_out,X.pending_out+G),W.next_out),W.next_out+=G,X.pending_out+=G,W.total_out+=G,W.avail_out-=G,X.pending-=G,X.pending===0)X.pending_out=0},G5=(W,X)=>{ly(W,W.block_start>=0?W.block_start:-1,W.strstart-W.block_start,X),W.block_start=W.strstart,X5(W.strm)},t1=(W,X)=>{W.pending_buf[W.pending++]=X},HJ=(W,X)=>{W.pending_buf[W.pending++]=X>>>8&255,W.pending_buf[W.pending++]=X&255},mA=(W,X,G,Y)=>{let J=W.avail_in;if(J>Y)J=Y;if(J===0)return 0;if(W.avail_in-=J,X.set(W.input.subarray(W.next_in,W.next_in+J),G),W.state.wrap===1)W.adler=TJ(W.adler,X,J,G);else if(W.state.wrap===2)W.adler=r8(W.adler,X,J,G);return W.next_in+=J,W.total_in+=J,J},TC=(W,X)=>{let{max_chain_length:G,strstart:Y}=W,J,Z,V=W.prev_length,U=W.nice_match,Q=W.strstart>W.w_size-z7?W.strstart-(W.w_size-z7):0,N=W.window,q=W.w_mask,A=W.prev,H=W.strstart+V6,I=N[Y+V-1],w=N[Y+V];if(W.prev_length>=W.good_match)G>>=2;if(U>W.lookahead)U=W.lookahead;do{if(J=X,N[J+V]!==w||N[J+V-1]!==I||N[J]!==N[Y]||N[++J]!==N[Y+1])continue;Y+=2,J++;do;while(N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&N[++Y]===N[++J]&&Y<H);if(Z=V6-(H-Y),Y=H-V6,Z>V){if(W.match_start=X,V=Z,Z>=U)break;I=N[Y+V-1],w=N[Y+V]}}while((X=A[X&q])>Q&&--G!==0);if(V<=W.lookahead)return V;return W.lookahead},aX=(W)=>{let X=W.w_size,G,Y,J;do{if(Y=W.window_size-W.lookahead-W.strstart,W.strstart>=X+(X-z7)){if(W.window.set(W.window.subarray(X,X+X-Y),0),W.match_start-=X,W.strstart-=X,W.block_start-=X,W.insert>W.strstart)W.insert=W.strstart;Av(W),Y+=X}if(W.strm.avail_in===0)break;if(G=mA(W.strm,W.window,W.strstart+W.lookahead,Y),W.lookahead+=G,W.lookahead+W.insert>=f1){J=W.strstart-W.insert,W.ins_h=W.window[J],W.ins_h=N6(W,W.ins_h,W.window[J+1]);while(W.insert)if(W.ins_h=N6(W,W.ins_h,W.window[J+f1-1]),W.prev[J&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=J,J++,W.insert--,W.lookahead+W.insert<f1)break}}while(W.lookahead<z7&&W.strm.avail_in!==0)},MC=(W,X)=>{let G=W.pending_buf_size-5>W.w_size?W.w_size:W.pending_buf_size-5,Y,J,Z,V=0,U=W.strm.avail_in;do{if(Y=65535,Z=W.bi_valid+42>>3,W.strm.avail_out<Z)break;if(Z=W.strm.avail_out-Z,J=W.strstart-W.block_start,Y>J+W.strm.avail_in)Y=J+W.strm.avail_in;if(Y>Z)Y=Z;if(Y<G&&(Y===0&&X!==j5||X===Q6||Y!==J+W.strm.avail_in))break;if(V=X===j5&&Y===J+W.strm.avail_in?1:0,yA(W,0,0,V),W.pending_buf[W.pending-4]=Y,W.pending_buf[W.pending-3]=Y>>8,W.pending_buf[W.pending-2]=~Y,W.pending_buf[W.pending-1]=~Y>>8,X5(W.strm),J){if(J>Y)J=Y;W.strm.output.set(W.window.subarray(W.block_start,W.block_start+J),W.strm.next_out),W.strm.next_out+=J,W.strm.avail_out-=J,W.strm.total_out+=J,W.block_start+=J,Y-=J}if(Y)mA(W.strm,W.strm.output,W.strm.next_out,Y),W.strm.next_out+=Y,W.strm.avail_out-=Y,W.strm.total_out+=Y}while(V===0);if(U-=W.strm.avail_in,U){if(U>=W.w_size)W.matches=2,W.window.set(W.strm.input.subarray(W.strm.next_in-W.w_size,W.strm.next_in),0),W.strstart=W.w_size,W.insert=W.strstart;else{if(W.window_size-W.strstart<=U){if(W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(W.insert>W.strstart)W.insert=W.strstart}W.window.set(W.strm.input.subarray(W.strm.next_in-U,W.strm.next_in),W.strstart),W.strstart+=U,W.insert+=U>W.w_size-W.insert?W.w_size-W.insert:U}W.block_start=W.strstart}if(W.high_water<W.strstart)W.high_water=W.strstart;if(V)return eX;if(X!==Q6&&X!==j5&&W.strm.avail_in===0&&W.strstart===W.block_start)return tX;if(Z=W.window_size-W.strstart,W.strm.avail_in>Z&&W.block_start>=W.w_size){if(W.block_start-=W.w_size,W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(Z+=W.w_size,W.insert>W.strstart)W.insert=W.strstart}if(Z>W.strm.avail_in)Z=W.strm.avail_in;if(Z)mA(W.strm,W.window,W.strstart,Z),W.strstart+=Z,W.insert+=Z>W.w_size-W.insert?W.w_size-W.insert:Z;if(W.high_water<W.strstart)W.high_water=W.strstart;if(Z=W.bi_valid+42>>3,Z=W.pending_buf_size-Z>65535?65535:W.pending_buf_size-Z,G=Z>W.w_size?W.w_size:Z,J=W.strstart-W.block_start,J>=G||(J||X===j5)&&X!==Q6&&W.strm.avail_in===0&&J<=Z)Y=J>Z?Z:J,V=X===j5&&W.strm.avail_in===0&&Y===J?1:0,yA(W,W.block_start,Y,V),W.block_start+=Y,X5(W.strm);return V?KW:k9},PA=(W,X)=>{let G,Y;for(;;){if(W.lookahead<z7){if(aX(W),W.lookahead<z7&&X===Q6)return k9;if(W.lookahead===0)break}if(G=0,W.lookahead>=f1)W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(G!==0&&W.strstart-G<=W.w_size-z7)W.match_length=TC(W,G);if(W.match_length>=f1)if(Y=U6(W,W.strstart-W.match_start,W.match_length-f1),W.lookahead-=W.match_length,W.match_length<=W.max_lazy_match&&W.lookahead>=f1){W.match_length--;do W.strstart++,W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.match_length!==0);W.strstart++}else W.strstart+=W.match_length,W.match_length=0,W.ins_h=W.window[W.strstart],W.ins_h=N6(W,W.ins_h,W.window[W.strstart+1]);else Y=U6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(Y){if(G5(W,!1),W.strm.avail_out===0)return k9}}if(W.insert=W.strstart<f1-1?W.strstart:f1-1,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX},oX=(W,X)=>{let G,Y,J;for(;;){if(W.lookahead<z7){if(aX(W),W.lookahead<z7&&X===Q6)return k9;if(W.lookahead===0)break}if(G=0,W.lookahead>=f1)W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(W.prev_length=W.match_length,W.prev_match=W.match_start,W.match_length=f1-1,G!==0&&W.prev_length<W.max_lazy_match&&W.strstart-G<=W.w_size-z7){if(W.match_length=TC(W,G),W.match_length<=5&&(W.strategy===ay||W.match_length===f1&&W.strstart-W.match_start>4096))W.match_length=f1-1}if(W.prev_length>=f1&&W.match_length<=W.prev_length){J=W.strstart+W.lookahead-f1,Y=U6(W,W.strstart-1-W.prev_match,W.prev_length-f1),W.lookahead-=W.prev_length-1,W.prev_length-=2;do if(++W.strstart<=J)W.ins_h=N6(W,W.ins_h,W.window[W.strstart+f1-1]),G=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.prev_length!==0);if(W.match_available=0,W.match_length=f1-1,W.strstart++,Y){if(G5(W,!1),W.strm.avail_out===0)return k9}}else if(W.match_available){if(Y=U6(W,0,W.window[W.strstart-1]),Y)G5(W,!1);if(W.strstart++,W.lookahead--,W.strm.avail_out===0)return k9}else W.match_available=1,W.strstart++,W.lookahead--}if(W.match_available)Y=U6(W,0,W.window[W.strstart-1]),W.match_available=0;if(W.insert=W.strstart<f1-1?W.strstart:f1-1,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX},Iv=(W,X)=>{let G,Y,J,Z,V=W.window;for(;;){if(W.lookahead<=V6){if(aX(W),W.lookahead<=V6&&X===Q6)return k9;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=f1&&W.strstart>0){if(J=W.strstart-1,Y=V[J],Y===V[++J]&&Y===V[++J]&&Y===V[++J]){Z=W.strstart+V6;do;while(Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&Y===V[++J]&&J<Z);if(W.match_length=V6-(Z-J),W.match_length>W.lookahead)W.match_length=W.lookahead}}if(W.match_length>=f1)G=U6(W,1,W.match_length-f1),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0;else G=U6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(G){if(G5(W,!1),W.strm.avail_out===0)return k9}}if(W.insert=0,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX},wv=(W,X)=>{let G;for(;;){if(W.lookahead===0){if(aX(W),W.lookahead===0){if(X===Q6)return k9;break}}if(W.match_length=0,G=U6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,G){if(G5(W,!1),W.strm.avail_out===0)return k9}}if(W.insert=0,X===j5){if(G5(W,!0),W.strm.avail_out===0)return KW;return eX}if(W.sym_next){if(G5(W,!1),W.strm.avail_out===0)return k9}return tX};function q7(W,X,G,Y,J){this.good_length=W,this.max_lazy=X,this.nice_length=G,this.max_chain=Y,this.func=J}var zJ=[new q7(0,0,0,0,MC),new q7(4,4,8,4,PA),new q7(4,5,16,8,PA),new q7(4,6,32,32,PA),new q7(4,4,16,16,oX),new q7(8,16,32,32,oX),new q7(8,16,128,128,oX),new q7(8,32,128,256,oX),new q7(32,128,258,1024,oX),new q7(32,258,258,4096,oX)],jv=(W)=>{W.window_size=2*W.w_size,Z6(W.head),W.max_lazy_match=zJ[W.level].max_lazy,W.good_match=zJ[W.level].good_length,W.nice_match=zJ[W.level].nice_length,W.max_chain_length=zJ[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=f1-1,W.match_available=0,W.ins_h=0};function Kv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=aU,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Qv*2),this.dyn_dtree=new Uint16Array((2*Vv+1)*2),this.bl_tree=new Uint16Array((2*Uv+1)*2),Z6(this.dyn_ltree),Z6(this.dyn_dtree),Z6(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Nv+1),this.heap=new Uint16Array(2*vA+1),Z6(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*vA+1),Z6(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var BJ=(W)=>{if(!W)return 1;let X=W.state;if(!X||X.strm!==W||X.status!==rX&&X.status!==dA&&X.status!==gA&&X.status!==uA&&X.status!==hA&&X.status!==bA&&X.status!==IW&&X.status!==AJ)return 1;return 0},PC=(W)=>{if(BJ(W))return wW(W,A7);W.total_in=W.total_out=0,W.data_type=Wv;let X=W.state;if(X.pending=0,X.pending_out=0,X.wrap<0)X.wrap=-X.wrap;return X.status=X.wrap===2?dA:X.wrap?rX:IW,W.adler=X.wrap===2?0:1,X.last_flush=-2,cy(X),W9},RC=(W)=>{let X=PC(W);if(X===W9)jv(W.state);return X},Dv=(W,X)=>{if(BJ(W)||W.state.wrap!==2)return A7;return W.state.gzhead=X,W9},LC=(W,X,G,Y,J,Z)=>{if(!W)return A7;let V=1;if(X===ry)X=6;if(Y<0)V=0,Y=-Y;else if(Y>15)V=2,Y-=16;if(J<1||J>Xv||G!==aU||Y<8||Y>15||X<0||X>9||Z<0||Z>ty||Y===8&&V!==1)return wW(W,A7);if(Y===8)Y=9;let U=new Kv;return W.state=U,U.strm=W,U.status=rX,U.wrap=V,U.gzhead=null,U.w_bits=Y,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=J+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+f1-1)/f1),U.window=new Uint8Array(U.w_size*2),U.head=new Uint16Array(U.hash_size),U.prev=new Uint16Array(U.w_size),U.lit_bufsize=1<<J+6,U.pending_buf_size=U.lit_bufsize*4,U.pending_buf=new Uint8Array(U.pending_buf_size),U.sym_buf=U.lit_bufsize,U.sym_end=(U.lit_bufsize-1)*3,U.level=X,U.strategy=Z,U.method=G,RC(W)},Ov=(W,X)=>{return LC(W,X,aU,Gv,Yv,ey)},Cv=(W,X)=>{if(BJ(W)||X>EO||X<0)return W?wW(W,A7):A7;let G=W.state;if(!W.output||W.avail_in!==0&&!W.input||G.status===AJ&&X!==j5)return wW(W,W.avail_out===0?MA:A7);let Y=G.last_flush;if(G.last_flush=X,G.pending!==0){if(X5(W),W.avail_out===0)return G.last_flush=-1,W9}else if(W.avail_in===0&&FO(X)<=FO(Y)&&X!==j5)return wW(W,MA);if(G.status===AJ&&W.avail_in!==0)return wW(W,MA);if(G.status===rX&&G.wrap===0)G.status=IW;if(G.status===rX){let J=aU+(G.w_bits-8<<4)<<8,Z=-1;if(G.strategy>=fU||G.level<2)Z=0;else if(G.level<6)Z=1;else if(G.level===6)Z=2;else Z=3;if(J|=Z<<6,G.strstart!==0)J|=qv;if(J+=31-J%31,HJ(G,J),G.strstart!==0)HJ(G,W.adler>>>16),HJ(G,W.adler&65535);if(W.adler=1,G.status=IW,X5(W),G.pending!==0)return G.last_flush=-1,W9}if(G.status===dA)if(W.adler=0,t1(G,31),t1(G,139),t1(G,8),!G.gzhead){if(t1(G,0),t1(G,0),t1(G,0),t1(G,0),t1(G,0),t1(G,G.level===9?2:G.strategy>=fU||G.level<2?4:0),t1(G,Hv),G.status=IW,X5(W),G.pending!==0)return G.last_flush=-1,W9}else{if(t1(G,(G.gzhead.text?1:0)+(G.gzhead.hcrc?2:0)+(!G.gzhead.extra?0:4)+(!G.gzhead.name?0:8)+(!G.gzhead.comment?0:16)),t1(G,G.gzhead.time&255),t1(G,G.gzhead.time>>8&255),t1(G,G.gzhead.time>>16&255),t1(G,G.gzhead.time>>24&255),t1(G,G.level===9?2:G.strategy>=fU||G.level<2?4:0),t1(G,G.gzhead.os&255),G.gzhead.extra&&G.gzhead.extra.length)t1(G,G.gzhead.extra.length&255),t1(G,G.gzhead.extra.length>>8&255);if(G.gzhead.hcrc)W.adler=r8(W.adler,G.pending_buf,G.pending,0);G.gzindex=0,G.status=gA}if(G.status===gA){if(G.gzhead.extra){let J=G.pending,Z=(G.gzhead.extra.length&65535)-G.gzindex;while(G.pending+Z>G.pending_buf_size){let U=G.pending_buf_size-G.pending;if(G.pending_buf.set(G.gzhead.extra.subarray(G.gzindex,G.gzindex+U),G.pending),G.pending=G.pending_buf_size,G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);if(G.gzindex+=U,X5(W),G.pending!==0)return G.last_flush=-1,W9;J=0,Z-=U}let V=new Uint8Array(G.gzhead.extra);if(G.pending_buf.set(V.subarray(G.gzindex,G.gzindex+Z),G.pending),G.pending+=Z,G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);G.gzindex=0}G.status=uA}if(G.status===uA){if(G.gzhead.name){let J=G.pending,Z;do{if(G.pending===G.pending_buf_size){if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);if(X5(W),G.pending!==0)return G.last_flush=-1,W9;J=0}if(G.gzindex<G.gzhead.name.length)Z=G.gzhead.name.charCodeAt(G.gzindex++)&255;else Z=0;t1(G,Z)}while(Z!==0);if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);G.gzindex=0}G.status=hA}if(G.status===hA){if(G.gzhead.comment){let J=G.pending,Z;do{if(G.pending===G.pending_buf_size){if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J);if(X5(W),G.pending!==0)return G.last_flush=-1,W9;J=0}if(G.gzindex<G.gzhead.comment.length)Z=G.gzhead.comment.charCodeAt(G.gzindex++)&255;else Z=0;t1(G,Z)}while(Z!==0);if(G.gzhead.hcrc&&G.pending>J)W.adler=r8(W.adler,G.pending_buf,G.pending-J,J)}G.status=bA}if(G.status===bA){if(G.gzhead.hcrc){if(G.pending+2>G.pending_buf_size){if(X5(W),G.pending!==0)return G.last_flush=-1,W9}t1(G,W.adler&255),t1(G,W.adler>>8&255),W.adler=0}if(G.status=IW,X5(W),G.pending!==0)return G.last_flush=-1,W9}if(W.avail_in!==0||G.lookahead!==0||X!==Q6&&G.status!==AJ){let J=G.level===0?MC(G,X):G.strategy===fU?wv(G,X):G.strategy===sy?Iv(G,X):zJ[G.level].func(G,X);if(J===KW||J===eX)G.status=AJ;if(J===k9||J===KW){if(W.avail_out===0)G.last_flush=-1;return W9}if(J===tX){if(X===oy)dy(G);else if(X!==EO){if(yA(G,0,0,!1),X===ny){if(Z6(G.head),G.lookahead===0)G.strstart=0,G.block_start=0,G.insert=0}}if(X5(W),W.avail_out===0)return G.last_flush=-1,W9}}if(X!==j5)return W9;if(G.wrap<=0)return $O;if(G.wrap===2)t1(G,W.adler&255),t1(G,W.adler>>8&255),t1(G,W.adler>>16&255),t1(G,W.adler>>24&255),t1(G,W.total_in&255),t1(G,W.total_in>>8&255),t1(G,W.total_in>>16&255),t1(G,W.total_in>>24&255);else HJ(G,W.adler>>>16),HJ(G,W.adler&65535);if(X5(W),G.wrap>0)G.wrap=-G.wrap;return G.pending!==0?W9:$O},Tv=(W)=>{if(BJ(W))return A7;let X=W.state.status;return W.state=null,X===IW?wW(W,iy):W9},Mv=(W,X)=>{let G=X.length;if(BJ(W))return A7;let Y=W.state,J=Y.wrap;if(J===2||J===1&&Y.status!==rX||Y.lookahead)return A7;if(J===1)W.adler=TJ(W.adler,X,G,0);if(Y.wrap=0,G>=Y.w_size){if(J===0)Z6(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0;let Q=new Uint8Array(Y.w_size);Q.set(X.subarray(G-Y.w_size,G),0),X=Q,G=Y.w_size}let{avail_in:Z,next_in:V,input:U}=W;W.avail_in=G,W.next_in=0,W.input=X,aX(Y);while(Y.lookahead>=f1){let Q=Y.strstart,N=Y.lookahead-(f1-1);do Y.ins_h=N6(Y,Y.ins_h,Y.window[Q+f1-1]),Y.prev[Q&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=Q,Q++;while(--N);Y.strstart=Q,Y.lookahead=f1-1,aX(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=f1-1,Y.match_available=0,W.next_in=V,W.input=U,W.avail_in=Z,Y.wrap=J,W9},Pv=Ov,Rv=LC,Lv=RC,Bv=PC,Ev=Dv,$v=Cv,Fv=Tv,Sv=Mv,xv="pako deflate (from Nodeca project)",wJ={deflateInit:Pv,deflateInit2:Rv,deflateReset:Lv,deflateResetKeep:Bv,deflateSetHeader:Ev,deflate:$v,deflateEnd:Fv,deflateSetDictionary:Sv,deflateInfo:xv},kv=(W,X)=>{return Object.prototype.hasOwnProperty.call(W,X)},_v=function(W){let X=Array.prototype.slice.call(arguments,1);while(X.length){let G=X.shift();if(!G)continue;if(typeof G!=="object")throw TypeError(G+"must be non-object");for(let Y in G)if(kv(G,Y))W[Y]=G[Y]}return W},yv=(W)=>{let X=0;for(let Y=0,J=W.length;Y<J;Y++)X+=W[Y].length;let G=new Uint8Array(X);for(let Y=0,J=0,Z=W.length;Y<Z;Y++){let V=W[Y];G.set(V,J),J+=V.length}return G},sU={assign:_v,flattenChunks:yv},BC=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(W){BC=!1}var MJ=new Uint8Array(256);for(let W=0;W<256;W++)MJ[W]=W>=252?6:W>=248?5:W>=240?4:W>=224?3:W>=192?2:1;MJ[254]=MJ[254]=1;var vv=(W)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(W);let X,G,Y,J,Z,V=W.length,U=0;for(J=0;J<V;J++){if(G=W.charCodeAt(J),(G&64512)===55296&&J+1<V){if(Y=W.charCodeAt(J+1),(Y&64512)===56320)G=65536+(G-55296<<10)+(Y-56320),J++}U+=G<128?1:G<2048?2:G<65536?3:4}X=new Uint8Array(U);for(Z=0,J=0;Z<U;J++){if(G=W.charCodeAt(J),(G&64512)===55296&&J+1<V){if(Y=W.charCodeAt(J+1),(Y&64512)===56320)G=65536+(G-55296<<10)+(Y-56320),J++}if(G<128)X[Z++]=G;else if(G<2048)X[Z++]=192|G>>>6,X[Z++]=128|G&63;else if(G<65536)X[Z++]=224|G>>>12,X[Z++]=128|G>>>6&63,X[Z++]=128|G&63;else X[Z++]=240|G>>>18,X[Z++]=128|G>>>12&63,X[Z++]=128|G>>>6&63,X[Z++]=128|G&63}return X},gv=(W,X)=>{if(X<65534){if(W.subarray&&BC)return String.fromCharCode.apply(null,W.length===X?W:W.subarray(0,X))}let G="";for(let Y=0;Y<X;Y++)G+=String.fromCharCode(W[Y]);return G},uv=(W,X)=>{let G=X||W.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(W.subarray(0,X));let Y,J,Z=Array(G*2);for(J=0,Y=0;Y<G;){let V=W[Y++];if(V<128){Z[J++]=V;continue}let U=MJ[V];if(U>4){Z[J++]=65533,Y+=U-1;continue}V&=U===2?31:U===3?15:7;while(U>1&&Y<G)V=V<<6|W[Y++]&63,U--;if(U>1){Z[J++]=65533;continue}if(V<65536)Z[J++]=V;else V-=65536,Z[J++]=55296|V>>10&1023,Z[J++]=56320|V&1023}return gv(Z,J)},hv=(W,X)=>{if(X=X||W.length,X>W.length)X=W.length;let G=X-1;while(G>=0&&(W[G]&192)===128)G--;if(G<0)return X;if(G===0)return X;return G+MJ[W[G]]>X?G:X},PJ={string2buf:vv,buf2string:uv,utf8border:hv};function bv(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var EC=bv,$C=Object.prototype.toString,{Z_NO_FLUSH:mv,Z_SYNC_FLUSH:fv,Z_FULL_FLUSH:pv,Z_FINISH:cv,Z_OK:iU,Z_STREAM_END:lv,Z_DEFAULT_COMPRESSION:dv,Z_DEFAULT_STRATEGY:ov,Z_DEFLATED:nv}=OW;function EJ(W){this.options=sU.assign({level:dv,method:nv,chunkSize:16384,windowBits:15,memLevel:8,strategy:ov},W||{});let X=this.options;if(X.raw&&X.windowBits>0)X.windowBits=-X.windowBits;else if(X.gzip&&X.windowBits>0&&X.windowBits<16)X.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new EC,this.strm.avail_out=0;let G=wJ.deflateInit2(this.strm,X.level,X.method,X.windowBits,X.memLevel,X.strategy);if(G!==iU)throw Error(jW[G]);if(X.header)wJ.deflateSetHeader(this.strm,X.header);if(X.dictionary){let Y;if(typeof X.dictionary==="string")Y=PJ.string2buf(X.dictionary);else if($C.call(X.dictionary)==="[object ArrayBuffer]")Y=new Uint8Array(X.dictionary);else Y=X.dictionary;if(G=wJ.deflateSetDictionary(this.strm,Y),G!==iU)throw Error(jW[G]);this._dict_set=!0}}EJ.prototype.push=function(W,X){let G=this.strm,Y=this.options.chunkSize,J,Z;if(this.ended)return!1;if(X===~~X)Z=X;else Z=X===!0?cv:mv;if(typeof W==="string")G.input=PJ.string2buf(W);else if($C.call(W)==="[object ArrayBuffer]")G.input=new Uint8Array(W);else G.input=W;G.next_in=0,G.avail_in=G.input.length;for(;;){if(G.avail_out===0)G.output=new Uint8Array(Y),G.next_out=0,G.avail_out=Y;if((Z===fv||Z===pv)&&G.avail_out<=6){this.onData(G.output.subarray(0,G.next_out)),G.avail_out=0;continue}if(J=wJ.deflate(G,Z),J===lv){if(G.next_out>0)this.onData(G.output.subarray(0,G.next_out));return J=wJ.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===iU}if(G.avail_out===0){this.onData(G.output);continue}if(Z>0&&G.next_out>0){this.onData(G.output.subarray(0,G.next_out)),G.avail_out=0;continue}if(G.avail_in===0)break}return!0};EJ.prototype.onData=function(W){this.chunks.push(W)};EJ.prototype.onEnd=function(W){if(W===iU)this.result=sU.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function oA(W,X){let G=new EJ(X);if(G.push(W,!0),G.err)throw G.msg||jW[G.err];return G.result}function iv(W,X){return X=X||{},X.raw=!0,oA(W,X)}function rv(W,X){return X=X||{},X.gzip=!0,oA(W,X)}var av=EJ,sv=oA,tv=iv,ev=rv,Wg=OW,Xg={Deflate:av,deflate:sv,deflateRaw:tv,gzip:ev,constants:Wg},pU=16209,Gg=16191,Yg=function(X,G){let Y,J,Z,V,U,Q,N,q,A,H,I,w,D,T,x,h,$,F,u,c,p,s,y,t,H0=X.state;Y=X.next_in,y=X.input,J=Y+(X.avail_in-5),Z=X.next_out,t=X.output,V=Z-(G-X.avail_out),U=Z+(X.avail_out-257),Q=H0.dmax,N=H0.wsize,q=H0.whave,A=H0.wnext,H=H0.window,I=H0.hold,w=H0.bits,D=H0.lencode,T=H0.distcode,x=(1<<H0.lenbits)-1,h=(1<<H0.distbits)-1;W:do{if(w<15)I+=y[Y++]<<w,w+=8,I+=y[Y++]<<w,w+=8;$=D[I&x];X:for(;;){if(F=$>>>24,I>>>=F,w-=F,F=$>>>16&255,F===0)t[Z++]=$&65535;else if(F&16){if(u=$&65535,F&=15,F){if(w<F)I+=y[Y++]<<w,w+=8;u+=I&(1<<F)-1,I>>>=F,w-=F}if(w<15)I+=y[Y++]<<w,w+=8,I+=y[Y++]<<w,w+=8;$=T[I&h];G:for(;;){if(F=$>>>24,I>>>=F,w-=F,F=$>>>16&255,F&16){if(c=$&65535,F&=15,w<F){if(I+=y[Y++]<<w,w+=8,w<F)I+=y[Y++]<<w,w+=8}if(c+=I&(1<<F)-1,c>Q){X.msg="invalid distance too far back",H0.mode=pU;break W}if(I>>>=F,w-=F,F=Z-V,c>F){if(F=c-F,F>q){if(H0.sane){X.msg="invalid distance too far back",H0.mode=pU;break W}}if(p=0,s=H,A===0){if(p+=N-F,F<u){u-=F;do t[Z++]=H[p++];while(--F);p=Z-c,s=t}}else if(A<F){if(p+=N+A-F,F-=A,F<u){u-=F;do t[Z++]=H[p++];while(--F);if(p=0,A<u){F=A,u-=F;do t[Z++]=H[p++];while(--F);p=Z-c,s=t}}}else if(p+=A-F,F<u){u-=F;do t[Z++]=H[p++];while(--F);p=Z-c,s=t}while(u>2)t[Z++]=s[p++],t[Z++]=s[p++],t[Z++]=s[p++],u-=3;if(u){if(t[Z++]=s[p++],u>1)t[Z++]=s[p++]}}else{p=Z-c;do t[Z++]=t[p++],t[Z++]=t[p++],t[Z++]=t[p++],u-=3;while(u>2);if(u){if(t[Z++]=t[p++],u>1)t[Z++]=t[p++]}}}else if((F&64)===0){$=T[($&65535)+(I&(1<<F)-1)];continue G}else{X.msg="invalid distance code",H0.mode=pU;break W}break}}else if((F&64)===0){$=D[($&65535)+(I&(1<<F)-1)];continue X}else if(F&32){H0.mode=Gg;break W}else{X.msg="invalid literal/length code",H0.mode=pU;break W}break}}while(Y<J&&Z<U);u=w>>3,Y-=u,w-=u<<3,I&=(1<<w)-1,X.next_in=Y,X.next_out=Z,X.avail_in=Y<J?5+(J-Y):5-(Y-J),X.avail_out=Z<U?257+(U-Z):257-(Z-U),H0.hold=I,H0.bits=w;return},nX=15,SO=852,xO=592,kO=0,RA=1,_O=2,Jg=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Zg=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Vg=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ug=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Qg=(W,X,G,Y,J,Z,V,U)=>{let Q=U.bits,N=0,q=0,A=0,H=0,I=0,w=0,D=0,T=0,x=0,h=0,$,F,u,c,p,s=null,y,t=new Uint16Array(nX+1),H0=new Uint16Array(nX+1),g=null,d,P,E;for(N=0;N<=nX;N++)t[N]=0;for(q=0;q<Y;q++)t[X[G+q]]++;I=Q;for(H=nX;H>=1;H--)if(t[H]!==0)break;if(I>H)I=H;if(H===0)return J[Z++]=20971520,J[Z++]=20971520,U.bits=1,0;for(A=1;A<H;A++)if(t[A]!==0)break;if(I<A)I=A;T=1;for(N=1;N<=nX;N++)if(T<<=1,T-=t[N],T<0)return-1;if(T>0&&(W===kO||H!==1))return-1;H0[1]=0;for(N=1;N<nX;N++)H0[N+1]=H0[N]+t[N];for(q=0;q<Y;q++)if(X[G+q]!==0)V[H0[X[G+q]]++]=q;if(W===kO)s=g=V,y=20;else if(W===RA)s=Jg,g=Zg,y=257;else s=Vg,g=Ug,y=0;if(h=0,q=0,N=A,p=Z,w=I,D=0,u=-1,x=1<<I,c=x-1,W===RA&&x>SO||W===_O&&x>xO)return 1;for(;;){if(d=N-D,V[q]+1<y)P=0,E=V[q];else if(V[q]>=y)P=g[V[q]-y],E=s[V[q]-y];else P=96,E=0;$=1<<N-D,F=1<<w,A=F;do F-=$,J[p+(h>>D)+F]=d<<24|P<<16|E|0;while(F!==0);$=1<<N-1;while(h&$)$>>=1;if($!==0)h&=$-1,h+=$;else h=0;if(q++,--t[N]===0){if(N===H)break;N=X[G+V[q]]}if(N>I&&(h&c)!==u){if(D===0)D=I;p+=A,w=N-D,T=1<<w;while(w+D<H){if(T-=t[w+D],T<=0)break;w++,T<<=1}if(x+=1<<w,W===RA&&x>SO||W===_O&&x>xO)return 1;u=h&c,J[u]=I<<24|w<<16|p-Z|0}}if(h!==0)J[p+h]=N-D<<24|4194304|0;return U.bits=I,0},jJ=Qg,Ng=0,FC=1,SC=2,{Z_FINISH:yO,Z_BLOCK:qg,Z_TREES:cU,Z_OK:DW,Z_STREAM_END:Hg,Z_NEED_DICT:Ag,Z_STREAM_ERROR:K5,Z_DATA_ERROR:xC,Z_MEM_ERROR:kC,Z_BUF_ERROR:zg,Z_DEFLATED:vO}=OW,tU=16180,gO=16181,uO=16182,hO=16183,bO=16184,mO=16185,fO=16186,pO=16187,cO=16188,lO=16189,rU=16190,t7=16191,LA=16192,dO=16193,BA=16194,oO=16195,nO=16196,iO=16197,rO=16198,lU=16199,dU=16200,aO=16201,sO=16202,tO=16203,eO=16204,WC=16205,EA=16206,XC=16207,GC=16208,D8=16209,_C=16210,yC=16211,Ig=852,wg=592,jg=15,Kg=jg,YC=(W)=>{return(W>>>24&255)+(W>>>8&65280)+((W&65280)<<8)+((W&255)<<24)};function Dg(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var CW=(W)=>{if(!W)return 1;let X=W.state;if(!X||X.strm!==W||X.mode<tU||X.mode>yC)return 1;return 0},vC=(W)=>{if(CW(W))return K5;let X=W.state;if(W.total_in=W.total_out=X.total=0,W.msg="",X.wrap)W.adler=X.wrap&1;return X.mode=tU,X.last=0,X.havedict=0,X.flags=-1,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new Int32Array(Ig),X.distcode=X.distdyn=new Int32Array(wg),X.sane=1,X.back=-1,DW},gC=(W)=>{if(CW(W))return K5;let X=W.state;return X.wsize=0,X.whave=0,X.wnext=0,vC(W)},uC=(W,X)=>{let G;if(CW(W))return K5;let Y=W.state;if(X<0)G=0,X=-X;else if(G=(X>>4)+5,X<48)X&=15;if(X&&(X<8||X>15))return K5;if(Y.window!==null&&Y.wbits!==X)Y.window=null;return Y.wrap=G,Y.wbits=X,gC(W)},hC=(W,X)=>{if(!W)return K5;let G=new Dg;W.state=G,G.strm=W,G.window=null,G.mode=tU;let Y=uC(W,X);if(Y!==DW)W.state=null;return Y},Og=(W)=>{return hC(W,Kg)},JC=!0,$A,FA,Cg=(W)=>{if(JC){$A=new Int32Array(512),FA=new Int32Array(32);let X=0;while(X<144)W.lens[X++]=8;while(X<256)W.lens[X++]=9;while(X<280)W.lens[X++]=7;while(X<288)W.lens[X++]=8;jJ(FC,W.lens,0,288,$A,0,W.work,{bits:9}),X=0;while(X<32)W.lens[X++]=5;jJ(SC,W.lens,0,32,FA,0,W.work,{bits:5}),JC=!1}W.lencode=$A,W.lenbits=9,W.distcode=FA,W.distbits=5},bC=(W,X,G,Y)=>{let J,Z=W.state;if(Z.window===null)Z.wsize=1<<Z.wbits,Z.wnext=0,Z.whave=0,Z.window=new Uint8Array(Z.wsize);if(Y>=Z.wsize)Z.window.set(X.subarray(G-Z.wsize,G),0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>Y)J=Y;if(Z.window.set(X.subarray(G-Y,G-Y+J),Z.wnext),Y-=J,Y)Z.window.set(X.subarray(G-Y,G),0),Z.wnext=Y,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave<Z.wsize)Z.whave+=J}}return 0},Tg=(W,X)=>{let G,Y,J,Z,V,U,Q,N,q,A,H,I,w,D,T=0,x,h,$,F,u,c,p,s,y=new Uint8Array(4),t,H0,g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(CW(W)||!W.output||!W.input&&W.avail_in!==0)return K5;if(G=W.state,G.mode===t7)G.mode=LA;V=W.next_out,J=W.output,Q=W.avail_out,Z=W.next_in,Y=W.input,U=W.avail_in,N=G.hold,q=G.bits,A=U,H=Q,s=DW;W:for(;;)switch(G.mode){case tU:if(G.wrap===0){G.mode=LA;break}while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.wrap&2&&N===35615){if(G.wbits===0)G.wbits=15;G.check=0,y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0),N=0,q=0,G.mode=gO;break}if(G.head)G.head.done=!1;if(!(G.wrap&1)||(((N&255)<<8)+(N>>8))%31){W.msg="incorrect header check",G.mode=D8;break}if((N&15)!==vO){W.msg="unknown compression method",G.mode=D8;break}if(N>>>=4,q-=4,p=(N&15)+8,G.wbits===0)G.wbits=p;if(p>15||p>G.wbits){W.msg="invalid window size",G.mode=D8;break}G.dmax=1<<G.wbits,G.flags=0,W.adler=G.check=1,G.mode=N&512?lO:t7,N=0,q=0;break;case gO:while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.flags=N,(G.flags&255)!==vO){W.msg="unknown compression method",G.mode=D8;break}if(G.flags&57344){W.msg="unknown header flags set",G.mode=D8;break}if(G.head)G.head.text=N>>8&1;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0);N=0,q=0,G.mode=uO;case uO:while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.head)G.head.time=N;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,y[2]=N>>>16&255,y[3]=N>>>24&255,G.check=r8(G.check,y,4,0);N=0,q=0,G.mode=hO;case hO:while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.head)G.head.xflags=N&255,G.head.os=N>>8;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0);N=0,q=0,G.mode=bO;case bO:if(G.flags&1024){while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.length=N,G.head)G.head.extra_len=N;if(G.flags&512&&G.wrap&4)y[0]=N&255,y[1]=N>>>8&255,G.check=r8(G.check,y,2,0);N=0,q=0}else if(G.head)G.head.extra=null;G.mode=mO;case mO:if(G.flags&1024){if(I=G.length,I>U)I=U;if(I){if(G.head){if(p=G.head.extra_len-G.length,!G.head.extra)G.head.extra=new Uint8Array(G.head.extra_len);G.head.extra.set(Y.subarray(Z,Z+I),p)}if(G.flags&512&&G.wrap&4)G.check=r8(G.check,Y,I,Z);U-=I,Z+=I,G.length-=I}if(G.length)break W}G.length=0,G.mode=fO;case fO:if(G.flags&2048){if(U===0)break W;I=0;do if(p=Y[Z+I++],G.head&&p&&G.length<65536)G.head.name+=String.fromCharCode(p);while(p&&I<U);if(G.flags&512&&G.wrap&4)G.check=r8(G.check,Y,I,Z);if(U-=I,Z+=I,p)break W}else if(G.head)G.head.name=null;G.length=0,G.mode=pO;case pO:if(G.flags&4096){if(U===0)break W;I=0;do if(p=Y[Z+I++],G.head&&p&&G.length<65536)G.head.comment+=String.fromCharCode(p);while(p&&I<U);if(G.flags&512&&G.wrap&4)G.check=r8(G.check,Y,I,Z);if(U-=I,Z+=I,p)break W}else if(G.head)G.head.comment=null;G.mode=cO;case cO:if(G.flags&512){while(q<16){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.wrap&4&&N!==(G.check&65535)){W.msg="header crc mismatch",G.mode=D8;break}N=0,q=0}if(G.head)G.head.hcrc=G.flags>>9&1,G.head.done=!0;W.adler=G.check=0,G.mode=t7;break;case lO:while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}W.adler=G.check=YC(N),N=0,q=0,G.mode=rU;case rU:if(G.havedict===0)return W.next_out=V,W.avail_out=Q,W.next_in=Z,W.avail_in=U,G.hold=N,G.bits=q,Ag;W.adler=G.check=1,G.mode=t7;case t7:if(X===qg||X===cU)break W;case LA:if(G.last){N>>>=q&7,q-=q&7,G.mode=EA;break}while(q<3){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}switch(G.last=N&1,N>>>=1,q-=1,N&3){case 0:G.mode=dO;break;case 1:if(Cg(G),G.mode=lU,X===cU){N>>>=2,q-=2;break W}break;case 2:G.mode=nO;break;case 3:W.msg="invalid block type",G.mode=D8}N>>>=2,q-=2;break;case dO:N>>>=q&7,q-=q&7;while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if((N&65535)!==(N>>>16^65535)){W.msg="invalid stored block lengths",G.mode=D8;break}if(G.length=N&65535,N=0,q=0,G.mode=BA,X===cU)break W;case BA:G.mode=oO;case oO:if(I=G.length,I){if(I>U)I=U;if(I>Q)I=Q;if(I===0)break W;J.set(Y.subarray(Z,Z+I),V),U-=I,Z+=I,Q-=I,V+=I,G.length-=I;break}G.mode=t7;break;case nO:while(q<14){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.nlen=(N&31)+257,N>>>=5,q-=5,G.ndist=(N&31)+1,N>>>=5,q-=5,G.ncode=(N&15)+4,N>>>=4,q-=4,G.nlen>286||G.ndist>30){W.msg="too many length or distance symbols",G.mode=D8;break}G.have=0,G.mode=iO;case iO:while(G.have<G.ncode){while(q<3){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}G.lens[g[G.have++]]=N&7,N>>>=3,q-=3}while(G.have<19)G.lens[g[G.have++]]=0;if(G.lencode=G.lendyn,G.lenbits=7,t={bits:G.lenbits},s=jJ(Ng,G.lens,0,19,G.lencode,0,G.work,t),G.lenbits=t.bits,s){W.msg="invalid code lengths set",G.mode=D8;break}G.have=0,G.mode=rO;case rO:while(G.have<G.nlen+G.ndist){for(;;){if(T=G.lencode[N&(1<<G.lenbits)-1],x=T>>>24,h=T>>>16&255,$=T&65535,x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if($<16)N>>>=x,q-=x,G.lens[G.have++]=$;else{if($===16){H0=x+2;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(N>>>=x,q-=x,G.have===0){W.msg="invalid bit length repeat",G.mode=D8;break}p=G.lens[G.have-1],I=3+(N&3),N>>>=2,q-=2}else if($===17){H0=x+3;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=x,q-=x,p=0,I=3+(N&7),N>>>=3,q-=3}else{H0=x+7;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=x,q-=x,p=0,I=11+(N&127),N>>>=7,q-=7}if(G.have+I>G.nlen+G.ndist){W.msg="invalid bit length repeat",G.mode=D8;break}while(I--)G.lens[G.have++]=p}}if(G.mode===D8)break;if(G.lens[256]===0){W.msg="invalid code -- missing end-of-block",G.mode=D8;break}if(G.lenbits=9,t={bits:G.lenbits},s=jJ(FC,G.lens,0,G.nlen,G.lencode,0,G.work,t),G.lenbits=t.bits,s){W.msg="invalid literal/lengths set",G.mode=D8;break}if(G.distbits=6,G.distcode=G.distdyn,t={bits:G.distbits},s=jJ(SC,G.lens,G.nlen,G.ndist,G.distcode,0,G.work,t),G.distbits=t.bits,s){W.msg="invalid distances set",G.mode=D8;break}if(G.mode=lU,X===cU)break W;case lU:G.mode=dU;case dU:if(U>=6&&Q>=258){if(W.next_out=V,W.avail_out=Q,W.next_in=Z,W.avail_in=U,G.hold=N,G.bits=q,Yg(W,H),V=W.next_out,J=W.output,Q=W.avail_out,Z=W.next_in,Y=W.input,U=W.avail_in,N=G.hold,q=G.bits,G.mode===t7)G.back=-1;break}G.back=0;for(;;){if(T=G.lencode[N&(1<<G.lenbits)-1],x=T>>>24,h=T>>>16&255,$=T&65535,x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(h&&(h&240)===0){F=x,u=h,c=$;for(;;){if(T=G.lencode[c+((N&(1<<F+u)-1)>>F)],x=T>>>24,h=T>>>16&255,$=T&65535,F+x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=F,q-=F,G.back+=F}if(N>>>=x,q-=x,G.back+=x,G.length=$,h===0){G.mode=WC;break}if(h&32){G.back=-1,G.mode=t7;break}if(h&64){W.msg="invalid literal/length code",G.mode=D8;break}G.extra=h&15,G.mode=aO;case aO:if(G.extra){H0=G.extra;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}G.length+=N&(1<<G.extra)-1,N>>>=G.extra,q-=G.extra,G.back+=G.extra}G.was=G.length,G.mode=sO;case sO:for(;;){if(T=G.distcode[N&(1<<G.distbits)-1],x=T>>>24,h=T>>>16&255,$=T&65535,x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if((h&240)===0){F=x,u=h,c=$;for(;;){if(T=G.distcode[c+((N&(1<<F+u)-1)>>F)],x=T>>>24,h=T>>>16&255,$=T&65535,F+x<=q)break;if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}N>>>=F,q-=F,G.back+=F}if(N>>>=x,q-=x,G.back+=x,h&64){W.msg="invalid distance code",G.mode=D8;break}G.offset=$,G.extra=h&15,G.mode=tO;case tO:if(G.extra){H0=G.extra;while(q<H0){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}G.offset+=N&(1<<G.extra)-1,N>>>=G.extra,q-=G.extra,G.back+=G.extra}if(G.offset>G.dmax){W.msg="invalid distance too far back",G.mode=D8;break}G.mode=eO;case eO:if(Q===0)break W;if(I=H-Q,G.offset>I){if(I=G.offset-I,I>G.whave){if(G.sane){W.msg="invalid distance too far back",G.mode=D8;break}}if(I>G.wnext)I-=G.wnext,w=G.wsize-I;else w=G.wnext-I;if(I>G.length)I=G.length;D=G.window}else D=J,w=V-G.offset,I=G.length;if(I>Q)I=Q;Q-=I,G.length-=I;do J[V++]=D[w++];while(--I);if(G.length===0)G.mode=dU;break;case WC:if(Q===0)break W;J[V++]=G.length,Q--,G.mode=dU;break;case EA:if(G.wrap){while(q<32){if(U===0)break W;U--,N|=Y[Z++]<<q,q+=8}if(H-=Q,W.total_out+=H,G.total+=H,G.wrap&4&&H)W.adler=G.check=G.flags?r8(G.check,J,H,V-H):TJ(G.check,J,H,V-H);if(H=Q,G.wrap&4&&(G.flags?N:YC(N))!==G.check){W.msg="incorrect data check",G.mode=D8;break}N=0,q=0}G.mode=XC;case XC:if(G.wrap&&G.flags){while(q<32){if(U===0)break W;U--,N+=Y[Z++]<<q,q+=8}if(G.wrap&4&&N!==(G.total&4294967295)){W.msg="incorrect length check",G.mode=D8;break}N=0,q=0}G.mode=GC;case GC:s=Hg;break W;case D8:s=xC;break W;case _C:return kC;case yC:default:return K5}if(W.next_out=V,W.avail_out=Q,W.next_in=Z,W.avail_in=U,G.hold=N,G.bits=q,G.wsize||H!==W.avail_out&&G.mode<D8&&(G.mode<EA||X!==yO)){if(bC(W,W.output,W.next_out,H-W.avail_out));}if(A-=W.avail_in,H-=W.avail_out,W.total_in+=A,W.total_out+=H,G.total+=H,G.wrap&4&&H)W.adler=G.check=G.flags?r8(G.check,J,H,W.next_out-H):TJ(G.check,J,H,W.next_out-H);if(W.data_type=G.bits+(G.last?64:0)+(G.mode===t7?128:0)+(G.mode===lU||G.mode===BA?256:0),(A===0&&H===0||X===yO)&&s===DW)s=zg;return s},Mg=(W)=>{if(CW(W))return K5;let X=W.state;if(X.window)X.window=null;return W.state=null,DW},Pg=(W,X)=>{if(CW(W))return K5;let G=W.state;if((G.wrap&2)===0)return K5;return G.head=X,X.done=!1,DW},Rg=(W,X)=>{let G=X.length,Y,J,Z;if(CW(W))return K5;if(Y=W.state,Y.wrap!==0&&Y.mode!==rU)return K5;if(Y.mode===rU){if(J=1,J=TJ(J,X,G,0),J!==Y.check)return xC}if(Z=bC(W,X,G,G),Z)return Y.mode=_C,kC;return Y.havedict=1,DW},Lg=gC,Bg=uC,Eg=vC,$g=Og,Fg=hC,Sg=Tg,xg=Mg,kg=Pg,_g=Rg,yg="pako inflate (from Nodeca project)",W4={inflateReset:Lg,inflateReset2:Bg,inflateResetKeep:Eg,inflateInit:$g,inflateInit2:Fg,inflate:Sg,inflateEnd:xg,inflateGetHeader:kg,inflateSetDictionary:_g,inflateInfo:yg};function vg(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gg=vg,mC=Object.prototype.toString,{Z_NO_FLUSH:ug,Z_FINISH:hg,Z_OK:RJ,Z_STREAM_END:SA,Z_NEED_DICT:xA,Z_STREAM_ERROR:bg,Z_DATA_ERROR:ZC,Z_MEM_ERROR:mg}=OW;function $J(W){this.options=sU.assign({chunkSize:65536,windowBits:15,to:""},W||{});let X=this.options;if(X.raw&&X.windowBits>=0&&X.windowBits<16){if(X.windowBits=-X.windowBits,X.windowBits===0)X.windowBits=-15}if(X.windowBits>=0&&X.windowBits<16&&!(W&&W.windowBits))X.windowBits+=32;if(X.windowBits>15&&X.windowBits<48){if((X.windowBits&15)===0)X.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new EC,this.strm.avail_out=0;let G=W4.inflateInit2(this.strm,X.windowBits);if(G!==RJ)throw Error(jW[G]);if(this.header=new gg,W4.inflateGetHeader(this.strm,this.header),X.dictionary){if(typeof X.dictionary==="string")X.dictionary=PJ.string2buf(X.dictionary);else if(mC.call(X.dictionary)==="[object ArrayBuffer]")X.dictionary=new Uint8Array(X.dictionary);if(X.raw){if(G=W4.inflateSetDictionary(this.strm,X.dictionary),G!==RJ)throw Error(jW[G])}}}$J.prototype.push=function(W,X){let G=this.strm,Y=this.options.chunkSize,J=this.options.dictionary,Z,V,U;if(this.ended)return!1;if(X===~~X)V=X;else V=X===!0?hg:ug;if(mC.call(W)==="[object ArrayBuffer]")G.input=new Uint8Array(W);else G.input=W;G.next_in=0,G.avail_in=G.input.length;for(;;){if(G.avail_out===0)G.output=new Uint8Array(Y),G.next_out=0,G.avail_out=Y;if(Z=W4.inflate(G,V),Z===xA&&J){if(Z=W4.inflateSetDictionary(G,J),Z===RJ)Z=W4.inflate(G,V);else if(Z===ZC)Z=xA}while(G.avail_in>0&&Z===SA&&G.state.wrap>0&&W[G.next_in]!==0)W4.inflateReset(G),Z=W4.inflate(G,V);switch(Z){case bg:case ZC:case xA:case mg:return this.onEnd(Z),this.ended=!0,!1}if(U=G.avail_out,G.next_out){if(G.avail_out===0||Z===SA)if(this.options.to==="string"){let Q=PJ.utf8border(G.output,G.next_out),N=G.next_out-Q,q=PJ.buf2string(G.output,Q);if(G.next_out=N,G.avail_out=Y-N,N)G.output.set(G.output.subarray(Q,Q+N),0);this.onData(q)}else this.onData(G.output.length===G.next_out?G.output:G.output.subarray(0,G.next_out))}if(Z===RJ&&U===0)continue;if(Z===SA)return Z=W4.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,!0;if(G.avail_in===0)break}return!0};$J.prototype.onData=function(W){this.chunks.push(W)};$J.prototype.onEnd=function(W){if(W===RJ)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=sU.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function nA(W,X){let G=new $J(X);if(G.push(W),G.err)throw G.msg||jW[G.err];return G.result}function fg(W,X){return X=X||{},X.raw=!0,nA(W,X)}var pg=$J,cg=nA,lg=fg,dg=nA,og=OW,ng={Inflate:pg,inflate:cg,inflateRaw:lg,ungzip:dg,constants:og},{Deflate:ig,deflate:rg,deflateRaw:ag,gzip:sg}=Xg,{Inflate:tg,inflate:eg,inflateRaw:Wu,ungzip:Xu}=ng,Gu=ig,Yu=rg,Ju=ag,Zu=sg,Vu=tg,Uu=eg,Qu=Wu,Nu=Xu,qu=OW,WG={Deflate:Gu,deflate:Yu,deflateRaw:Ju,gzip:Zu,Inflate:Vu,inflate:Uu,inflateRaw:Qu,ungzip:Nu,constants:qu};function fC(){let W=Date.now(),X=0;return{now(){return W=Math.max(W,Date.now()),X++,{physical:W,logical:X}},update(G){if(!G||typeof G.physical!=="number"||typeof G.logical!=="number")return;W=Math.max(W,G.physical),X=Math.max(X,G.logical)+1},compare(G,Y){if(!G&&!Y)return 0;if(!G)return-1;if(!Y)return 1;if(G.physical!==Y.physical)return G.physical>Y.physical?1:-1;if(G.logical!==Y.logical)return G.logical>Y.logical?1:-1;return 0}}}function pC(W,X,G){let Y=X.timestamp;if(Y?.physical>Date.now()+7200000)Y={physical:Date.now()+7200000,logical:Y.logical};if(X?.value?.priority===!0&&typeof X.id==="string"&&X.id.startsWith("user:")&&"role"in X.value){let{priority:Z,...V}=X.value;return{resolved:!0,value:V,timestamp:Y}}if(X?.value?.priority!==void 0){let{priority:Z,...V}=X.value;X={...X,value:V}}if(!W?.timestamp)return{resolved:!0,value:X.value,timestamp:Y};let J=G.compare(Y,W.timestamp);if(J<0)return{resolved:!1};if(J===0&&JSON.stringify(X.value)<=JSON.stringify(W.value))return{resolved:!1};return{resolved:!0,value:X.value,timestamp:Y}}var FJ={$eq:(W,X)=>W===X,$ne:(W,X)=>W!==X,$gt:(W,X)=>W>X,$gte:(W,X)=>W>=X,$lt:(W,X)=>W<X,$lte:(W,X)=>W<=X,$in:(W,X)=>Array.isArray(X)&&(Array.isArray(W)?W.some((G)=>X.includes(G)):X.includes(W)),$between:(W,[X,G])=>W>=X&&W<=G,$exists:(W,X)=>X?W!==void 0:W===void 0,$startsWith:(W,X)=>typeof W==="string"&&W.startsWith(X),$endsWith:(W,X)=>typeof W==="string"&&W.endsWith(X),$contains:(W,X)=>typeof W==="string"&&W.includes(X),$text:{global:(W,X)=>{let G=(J)=>String(J).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=G(X);return Object.values(W).some((J)=>typeof J==="object"?null.fieldSearch(J,Y):G(J).includes(Y))},field:(W,X)=>{let G=(J)=>String(J).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=G(X);return Array.isArray(W)?W.some((J)=>G(J).includes(Y)):G(W).includes(Y)}},$like:(W,X)=>typeof W==="string"&&typeof X==="string"&&new RegExp(`^${X.replace(/%/g,".*").replace(/_/g,".")}$`,"i").test(W),$regex:(W,X)=>typeof W==="string"&&new RegExp(X.$regex||X,"i").test(W),$and:(W,X,G)=>X.every((Y)=>G.createFilter(Y,G.allNodes)(W)),$or:(W,X,G)=>X.some((Y)=>G.createFilter(Y,G.allNodes)(W)),$not:(W,X,G)=>!G.createFilter(X,G.allNodes)(W),$edge:(W,X,G)=>{if(!W.edges?.length||typeof X!=="object"||X===null)return!1;let Y=G.createFilter(X,G.allNodes),J=[...W.edges],Z=new Set(J).add(W.id),V=[];while(J.length){let U=J.shift(),Q=G.allNodes[U];if(!Q)continue;if(Y(Q))V.push(Q);Q.edges?.forEach((N)=>!Z.has(N)&&Z.add(N)&&J.push(N))}if(V.length)W._edgeResult=V;return V.length>0}},eU=(W,X)=>X.split(".").reduce((G,Y)=>G&&typeof G==="object"&&(Y in G)?G[Y]:void 0,W),WQ=(W,X)=>{if(Object.keys(W).length===0)return()=>!0;return(G)=>Object.entries(W).every(([Y,J])=>{if(Y.startsWith("$"))return FJ[Y](G,J,{createFilter:WQ,allNodes:X});let Z=eU(G.value,Y);if(Z===void 0)Z=eU(G,Y);if(J instanceof RegExp)return J.test(String(Z));if(typeof J!=="object"||J===null)return FJ.$eq(Z,J);return Object.entries(J).every(([V,U])=>{if(V==="$text")return FJ.$text.field(Z,U);if(V==="$between"&&U.every((Q)=>Q instanceof Date))return FJ.$between(new Date(Z),U);return FJ[V]?.(Z,U,{createFilter:WQ,allNodes:X})??!1})})},iA=(W,X)=>{let{$edge:G,...Y}=X.query||{},J=WQ(Y,W),Z=Object.values(W).filter(J),U=[...G?(()=>{let Q=WQ({$edge:G},W);Z.forEach((q)=>Q(q));let N=new Map;return Z.forEach((q)=>{if(q._edgeResult)q._edgeResult.forEach((A)=>N.set(A.id,A)),delete q._edgeResult}),Array.from(N.values())})():Z];if(X.field){let Q=X.order==="asc"?1:-1;U.sort((N,q)=>{let A=eU(N.value,X.field),H=eU(q.value,X.field);if(typeof A==="string"&&typeof H==="string")return A.localeCompare(H)*Q;return((A??0)-(H??0))*Q})}if(X.$after){let Q=U.findIndex((N)=>N.id===X.$after);U=Q>=0?U.slice(Q+1):[]}if(X.$before){let Q=U.findIndex((N)=>N.id===X.$before);U=Q>=0?U.slice(0,Q):[]}if(X.$limit)U=U.slice(0,X.$limit);return U.map((Q)=>({...Q,edges:(Q.edges??[]).filter((N)=>Object.hasOwn(W,N))}))};var JG=(()=>{let W=()=>{};return new Proxy(console,{get:(X,G)=>globalThis.__gdbDebug?X[G].bind(X):W})})(),XG=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function PQ(W){return W instanceof Uint8Array||ArrayBuffer.isView(W)&&W.constructor.name==="Uint8Array"}function Vz(W){if(!Number.isSafeInteger(W)||W<0)throw Error("positive integer expected, got "+W)}function LW(W,...X){if(!PQ(W))throw Error("Uint8Array expected");if(X.length>0&&!X.includes(W.length))throw Error("Uint8Array expected of length "+X+", got length="+W.length)}function NT(W){if(typeof W!=="function"||typeof W.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");Vz(W.outputLen),Vz(W.blockLen)}function AQ(W,X=!0){if(W.destroyed)throw Error("Hash instance has been destroyed");if(X&&W.finished)throw Error("Hash#digest() has already been called")}function Hu(W,X){LW(W);let G=X.outputLen;if(W.length<G)throw Error("digestInto() expects output buffer of length at least "+G)}function zQ(...W){for(let X=0;X<W.length;X++)W[X].fill(0)}function rA(W){return new DataView(W.buffer,W.byteOffset,W.byteLength)}function I7(W,X){return W<<32-X|W>>>X}var qT=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),Au=Array.from({length:256},(W,X)=>X.toString(16).padStart(2,"0"));function ZG(W){if(LW(W),qT)return W.toHex();let X="";for(let G=0;G<W.length;G++)X+=Au[W[G]];return X}var X4={_0:48,_9:57,A:65,F:70,a:97,f:102};function cC(W){if(W>=X4._0&&W<=X4._9)return W-X4._0;if(W>=X4.A&&W<=X4.F)return W-(X4.A-10);if(W>=X4.a&&W<=X4.f)return W-(X4.a-10);return}function IQ(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);if(qT)return Uint8Array.fromHex(W);let X=W.length,G=X/2;if(X%2)throw Error("hex string expected, got unpadded hex of length "+X);let Y=new Uint8Array(G);for(let J=0,Z=0;J<G;J++,Z+=2){let V=cC(W.charCodeAt(Z)),U=cC(W.charCodeAt(Z+1));if(V===void 0||U===void 0){let Q=W[Z]+W[Z+1];throw Error('hex string expected, got non-hex character "'+Q+'" at index '+Z)}Y[J]=V*16+U}return Y}function HT(W){if(typeof W!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(W))}function Iz(W){if(typeof W==="string")W=HT(W);return LW(W),W}function w7(...W){let X=0;for(let Y=0;Y<W.length;Y++){let J=W[Y];LW(J),X+=J.length}let G=new Uint8Array(X);for(let Y=0,J=0;Y<W.length;Y++){let Z=W[Y];G.set(Z,J),J+=Z.length}return G}class wz{}function zu(W){let X=(Y)=>W().update(Iz(Y)).digest(),G=W();return X.outputLen=G.outputLen,X.blockLen=G.blockLen,X.create=()=>W(),X}function RQ(W=32){if(XG&&typeof XG.getRandomValues==="function")return XG.getRandomValues(new Uint8Array(W));if(XG&&typeof XG.randomBytes==="function")return Uint8Array.from(XG.randomBytes(W));throw Error("crypto.getRandomValues must be defined")}function Iu(W,X,G,Y){if(typeof W.setBigUint64==="function")return W.setBigUint64(X,G,Y);let J=BigInt(32),Z=BigInt(4294967295),V=Number(G>>J&Z),U=Number(G&Z),Q=Y?4:0,N=Y?0:4;W.setUint32(X+Q,V,Y),W.setUint32(X+N,U,Y)}function wu(W,X,G){return W&X^~W&G}function ju(W,X,G){return W&X^W&G^X&G}class AT extends wz{constructor(W,X,G,Y){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=W,this.outputLen=X,this.padOffset=G,this.isLE=Y,this.buffer=new Uint8Array(W),this.view=rA(this.buffer)}update(W){AQ(this),W=Iz(W),LW(W);let{view:X,buffer:G,blockLen:Y}=this,J=W.length;for(let Z=0;Z<J;){let V=Math.min(Y-this.pos,J-Z);if(V===Y){let U=rA(W);for(;Y<=J-Z;Z+=Y)this.process(U,Z);continue}if(G.set(W.subarray(Z,Z+V),this.pos),this.pos+=V,Z+=V,this.pos===Y)this.process(X,0),this.pos=0}return this.length+=W.length,this.roundClean(),this}digestInto(W){AQ(this),Hu(W,this),this.finished=!0;let{buffer:X,view:G,blockLen:Y,isLE:J}=this,{pos:Z}=this;if(X[Z++]=128,zQ(this.buffer.subarray(Z)),this.padOffset>Y-Z)this.process(G,0),Z=0;for(let q=Z;q<Y;q++)X[q]=0;Iu(G,Y-8,BigInt(this.length*8),J),this.process(G,0);let V=rA(W),U=this.outputLen;if(U%4)throw Error("_sha2: outputLen should be aligned to 32bit");let Q=U/4,N=this.get();if(Q>N.length)throw Error("_sha2: outputLen bigger than state");for(let q=0;q<Q;q++)V.setUint32(4*q,N[q],J)}digest(){let{buffer:W,outputLen:X}=this;this.digestInto(W);let G=W.slice(0,X);return this.destroy(),G}_cloneInto(W){W||(W=new this.constructor),W.set(...this.get());let{blockLen:X,buffer:G,length:Y,finished:J,destroyed:Z,pos:V}=this;if(W.destroyed=Z,W.finished=J,W.length=Y,W.pos=V,Y%X)W.buffer.set(G);return W}clone(){return this._cloneInto()}}var q6=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ku=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]),H6=new Uint32Array(64);class zT extends AT{constructor(W=32){super(64,W,8,!1);this.A=q6[0]|0,this.B=q6[1]|0,this.C=q6[2]|0,this.D=q6[3]|0,this.E=q6[4]|0,this.F=q6[5]|0,this.G=q6[6]|0,this.H=q6[7]|0}get(){let{A:W,B:X,C:G,D:Y,E:J,F:Z,G:V,H:U}=this;return[W,X,G,Y,J,Z,V,U]}set(W,X,G,Y,J,Z,V,U){this.A=W|0,this.B=X|0,this.C=G|0,this.D=Y|0,this.E=J|0,this.F=Z|0,this.G=V|0,this.H=U|0}process(W,X){for(let q=0;q<16;q++,X+=4)H6[q]=W.getUint32(X,!1);for(let q=16;q<64;q++){let A=H6[q-15],H=H6[q-2],I=I7(A,7)^I7(A,18)^A>>>3,w=I7(H,17)^I7(H,19)^H>>>10;H6[q]=w+H6[q-7]+I+H6[q-16]|0}let{A:G,B:Y,C:J,D:Z,E:V,F:U,G:Q,H:N}=this;for(let q=0;q<64;q++){let A=I7(V,6)^I7(V,11)^I7(V,25),H=N+A+wu(V,U,Q)+Ku[q]+H6[q]|0,I=(I7(G,2)^I7(G,13)^I7(G,22))+ju(G,Y,J)|0;N=Q,Q=U,U=V,V=Z+H|0,Z=J,J=Y,Y=G,G=H+I|0}G=G+this.A|0,Y=Y+this.B|0,J=J+this.C|0,Z=Z+this.D|0,V=V+this.E|0,U=U+this.F|0,Q=Q+this.G|0,N=N+this.H|0,this.set(G,Y,J,Z,V,U,Q,N)}roundClean(){zQ(H6)}destroy(){this.set(0,0,0,0,0,0,0,0),zQ(this.buffer)}}var Uz=zu(()=>new zT);class jz extends wz{constructor(W,X){super();this.finished=!1,this.destroyed=!1,NT(W);let G=Iz(X);if(this.iHash=W.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let Y=this.blockLen,J=new Uint8Array(Y);J.set(G.length>Y?W.create().update(G).digest():G);for(let Z=0;Z<J.length;Z++)J[Z]^=54;this.iHash.update(J),this.oHash=W.create();for(let Z=0;Z<J.length;Z++)J[Z]^=106;this.oHash.update(J),zQ(J)}update(W){return AQ(this),this.iHash.update(W),this}digestInto(W){AQ(this),LW(W,this.outputLen),this.finished=!0,this.iHash.digestInto(W),this.oHash.update(W),this.oHash.digestInto(W),this.destroy()}digest(){let W=new Uint8Array(this.oHash.outputLen);return this.digestInto(W),W}_cloneInto(W){W||(W=Object.create(Object.getPrototypeOf(this),{}));let{oHash:X,iHash:G,finished:Y,destroyed:J,blockLen:Z,outputLen:V}=this;return W=W,W.finished=Y,W.destroyed=J,W.blockLen=Z,W.outputLen=V,W.oHash=X._cloneInto(W.oHash),W.iHash=G._cloneInto(W.iHash),W}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var IT=(W,X,G)=>new jz(W,X).update(G).digest();IT.create=(W,X)=>new jz(W,X);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Kz=BigInt(0),Qz=BigInt(1);function wQ(W,X=""){if(typeof W!=="boolean"){let G=X&&`"${X}"`;throw Error(G+"expected boolean, got type="+typeof W)}return W}function TW(W,X,G=""){let Y=PQ(W),J=W?.length,Z=X!==void 0;if(!Y||Z&&J!==X){let V=G&&`"${G}" `,U=Z?` of length ${X}`:"",Q=Y?`length=${J}`:`type=${typeof W}`;throw Error(V+"expected Uint8Array"+U+", got "+Q)}return W}function XQ(W){let X=W.toString(16);return X.length&1?"0"+X:X}function wT(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);return W===""?Kz:BigInt("0x"+W)}function qG(W){return wT(ZG(W))}function jT(W){return LW(W),wT(ZG(Uint8Array.from(W).reverse()))}function LQ(W,X){return IQ(W.toString(16).padStart(X*2,"0"))}function KT(W,X){return LQ(W,X).reverse()}function f8(W,X,G){let Y;if(typeof X==="string")try{Y=IQ(X)}catch(Z){throw Error(W+" must be hex string or Uint8Array, cause: "+Z)}else if(PQ(X))Y=Uint8Array.from(X);else throw Error(W+" must be hex string or Uint8Array");let J=Y.length;if(typeof G==="number"&&J!==G)throw Error(W+" of length "+G+" expected, got "+J);return Y}var aA=(W)=>typeof W==="bigint"&&Kz<=W;function Nz(W,X,G){return aA(W)&&aA(X)&&aA(G)&&X<=W&&W<G}function Du(W,X,G,Y){if(!Nz(X,G,Y))throw Error("expected valid "+W+": "+G+" <= n < "+Y+", got "+X)}function DT(W){let X;for(X=0;W>Kz;W>>=Qz,X+=1);return X}var hJ=(W)=>(Qz<<BigInt(W))-Qz;function Ou(W,X,G){if(typeof W!=="number"||W<2)throw Error("hashLen must be a number");if(typeof X!=="number"||X<2)throw Error("qByteLen must be a number");if(typeof G!=="function")throw Error("hmacFn must be a function");let Y=(H)=>new Uint8Array(H),J=(H)=>Uint8Array.of(H),Z=Y(W),V=Y(W),U=0,Q=()=>{Z.fill(1),V.fill(0),U=0},N=(...H)=>G(V,Z,...H),q=(H=Y(0))=>{if(V=N(J(0),H),Z=N(),H.length===0)return;V=N(J(1),H),Z=N()},A=()=>{if(U++>=1000)throw Error("drbg: tried 1000 values");let H=0,I=[];while(H<X){Z=N();let w=Z.slice();I.push(w),H+=Z.length}return w7(...I)};return(H,I)=>{Q(),q(H);let w=void 0;while(!(w=I(A())))q();return Q(),w}}function Dz(W,X,G={}){if(!W||typeof W!=="object")throw Error("expected valid options object");function Y(J,Z,V){let U=W[J];if(V&&U===void 0)return;let Q=typeof U;if(Q!==Z||U===null)throw Error(`param "${J}" is invalid: expected ${Z}, got ${Q}`)}Object.entries(X).forEach(([J,Z])=>Y(J,Z,!1)),Object.entries(G).forEach(([J,Z])=>Y(J,Z,!0))}function lC(W){let X=new WeakMap;return(G,...Y)=>{let J=X.get(G);if(J!==void 0)return J;let Z=W(G,...Y);return X.set(G,Z),Z}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var _9=BigInt(0),I9=BigInt(1),MW=BigInt(2),OT=BigInt(3),CT=BigInt(4),TT=BigInt(5),Cu=BigInt(7),MT=BigInt(8),Tu=BigInt(9),PT=BigInt(16);function C5(W,X){let G=W%X;return G>=_9?G:X+G}function D5(W,X,G){let Y=W;while(X-- >_9)Y*=Y,Y%=G;return Y}function dC(W,X){if(W===_9)throw Error("invert: expected non-zero number");if(X<=_9)throw Error("invert: expected positive modulus, got "+X);let G=C5(W,X),Y=X,J=_9,Z=I9,V=I9,U=_9;while(G!==_9){let Q=Y/G,N=Y%G,q=J-V*Q,A=Z-U*Q;Y=G,G=N,J=V,Z=U,V=q,U=A}if(Y!==I9)throw Error("invert: does not exist");return C5(J,X)}function Oz(W,X,G){if(!W.eql(W.sqr(X),G))throw Error("Cannot find square root")}function RT(W,X){let G=(W.ORDER+I9)/CT,Y=W.pow(X,G);return Oz(W,Y,X),Y}function Mu(W,X){let G=(W.ORDER-TT)/MT,Y=W.mul(X,MW),J=W.pow(Y,G),Z=W.mul(X,J),V=W.mul(W.mul(Z,MW),J),U=W.mul(Z,W.sub(V,W.ONE));return Oz(W,U,X),U}function Pu(W){let X=bJ(W),G=LT(W),Y=G(X,X.neg(X.ONE)),J=G(X,Y),Z=G(X,X.neg(Y)),V=(W+Cu)/PT;return(U,Q)=>{let N=U.pow(Q,V),q=U.mul(N,Y),A=U.mul(N,J),H=U.mul(N,Z),I=U.eql(U.sqr(q),Q),w=U.eql(U.sqr(A),Q);N=U.cmov(N,q,I),q=U.cmov(H,A,w);let D=U.eql(U.sqr(q),Q),T=U.cmov(N,q,D);return Oz(U,T,Q),T}}function LT(W){if(W<OT)throw Error("sqrt is not defined for small field");let X=W-I9,G=0;while(X%MW===_9)X/=MW,G++;let Y=MW,J=bJ(W);while(oC(J,Y)===1)if(Y++>1000)throw Error("Cannot find square root: probably non-prime P");if(G===1)return RT;let Z=J.pow(Y,X),V=(X+I9)/MW;return function(U,Q){if(U.is0(Q))return Q;if(oC(U,Q)!==1)throw Error("Cannot find square root");let N=G,q=U.mul(U.ONE,Z),A=U.pow(Q,X),H=U.pow(Q,V);while(!U.eql(A,U.ONE)){if(U.is0(A))return U.ZERO;let I=1,w=U.sqr(A);while(!U.eql(w,U.ONE))if(I++,w=U.sqr(w),I===N)throw Error("Cannot find square root");let D=I9<<BigInt(N-I-1),T=U.pow(q,D);N=I,q=U.sqr(T),A=U.mul(A,q),H=U.mul(H,T)}return H}}function Ru(W){if(W%CT===OT)return RT;if(W%MT===TT)return Mu;if(W%PT===Tu)return Pu(W);return LT(W)}var Lu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Bu(W){let X={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},G=Lu.reduce((Y,J)=>{return Y[J]="function",Y},X);return Dz(W,G),W}function Eu(W,X,G){if(G<_9)throw Error("invalid exponent, negatives unsupported");if(G===_9)return W.ONE;if(G===I9)return X;let Y=W.ONE,J=X;while(G>_9){if(G&I9)Y=W.mul(Y,J);J=W.sqr(J),G>>=I9}return Y}function BT(W,X,G=!1){let Y=Array(X.length).fill(G?W.ZERO:void 0),J=X.reduce((V,U,Q)=>{if(W.is0(U))return V;return Y[Q]=V,W.mul(V,U)},W.ONE),Z=W.inv(J);return X.reduceRight((V,U,Q)=>{if(W.is0(U))return V;return Y[Q]=W.mul(V,Y[Q]),W.mul(V,U)},Z),Y}function oC(W,X){let G=(W.ORDER-I9)/MW,Y=W.pow(X,G),J=W.eql(Y,W.ONE),Z=W.eql(Y,W.ZERO),V=W.eql(Y,W.neg(W.ONE));if(!J&&!Z&&!V)throw Error("invalid Legendre symbol result");return J?1:Z?0:-1}function ET(W,X){if(X!==void 0)Vz(X);let G=X!==void 0?X:W.toString(2).length,Y=Math.ceil(G/8);return{nBitLength:G,nByteLength:Y}}function bJ(W,X,G=!1,Y={}){if(W<=_9)throw Error("invalid field: expected ORDER > 0, got "+W);let J=void 0,Z=void 0,V=!1,U=void 0;if(typeof X==="object"&&X!=null){if(Y.sqrt||G)throw Error("cannot specify opts in two arguments");let H=X;if(H.BITS)J=H.BITS;if(H.sqrt)Z=H.sqrt;if(typeof H.isLE==="boolean")G=H.isLE;if(typeof H.modFromBytes==="boolean")V=H.modFromBytes;U=H.allowedLengths}else{if(typeof X==="number")J=X;if(Y.sqrt)Z=Y.sqrt}let{nBitLength:Q,nByteLength:N}=ET(W,J);if(N>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let q,A=Object.freeze({ORDER:W,isLE:G,BITS:Q,BYTES:N,MASK:hJ(Q),ZERO:_9,ONE:I9,allowedLengths:U,create:(H)=>C5(H,W),isValid:(H)=>{if(typeof H!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof H);return _9<=H&&H<W},is0:(H)=>H===_9,isValidNot0:(H)=>!A.is0(H)&&A.isValid(H),isOdd:(H)=>(H&I9)===I9,neg:(H)=>C5(-H,W),eql:(H,I)=>H===I,sqr:(H)=>C5(H*H,W),add:(H,I)=>C5(H+I,W),sub:(H,I)=>C5(H-I,W),mul:(H,I)=>C5(H*I,W),pow:(H,I)=>Eu(A,H,I),div:(H,I)=>C5(H*dC(I,W),W),sqrN:(H)=>H*H,addN:(H,I)=>H+I,subN:(H,I)=>H-I,mulN:(H,I)=>H*I,inv:(H)=>dC(H,W),sqrt:Z||((H)=>{if(!q)q=Ru(W);return q(A,H)}),toBytes:(H)=>G?KT(H,N):LQ(H,N),fromBytes:(H,I=!0)=>{if(U){if(!U.includes(H.length)||H.length>N)throw Error("Field.fromBytes: expected "+U+" bytes, got "+H.length);let D=new Uint8Array(N);D.set(H,G?0:D.length-H.length),H=D}if(H.length!==N)throw Error("Field.fromBytes: expected "+N+" bytes, got "+H.length);let w=G?jT(H):qG(H);if(V)w=C5(w,W);if(!I){if(!A.isValid(w))throw Error("invalid field element: outside of range 0..ORDER")}return w},invertBatch:(H)=>BT(A,H),cmov:(H,I,w)=>w?I:H});return Object.freeze(A)}function $T(W){if(typeof W!=="bigint")throw Error("field order must be bigint");let X=W.toString(2).length;return Math.ceil(X/8)}function FT(W){let X=$T(W);return X+Math.ceil(X/2)}function ST(W,X,G=!1){let Y=W.length,J=$T(X),Z=FT(X);if(Y<16||Y<Z||Y>1024)throw Error("expected "+Z+"-1024 bytes of input, got "+Y);let V=G?jT(W):qG(W),U=C5(V,X-I9)+I9;return G?KT(U,J):LQ(U,J)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var QG=BigInt(0),PW=BigInt(1);function jQ(W,X){let G=X.negate();return W?G:X}function sA(W,X){let G=BT(W.Fp,X.map((Y)=>Y.Z));return X.map((Y,J)=>W.fromAffine(Y.toAffine(G[J])))}function xT(W,X){if(!Number.isSafeInteger(W)||W<=0||W>X)throw Error("invalid window size, expected [1.."+X+"], got W="+W)}function tA(W,X){xT(W,X);let G=Math.ceil(X/W)+1,Y=2**(W-1),J=2**W,Z=hJ(W),V=BigInt(W);return{windows:G,windowSize:Y,mask:Z,maxNumber:J,shiftBy:V}}function nC(W,X,G){let{windowSize:Y,mask:J,maxNumber:Z,shiftBy:V}=G,U=Number(W&J),Q=W>>V;if(U>Y)U-=Z,Q+=PW;let N=X*Y,q=N+Math.abs(U)-1,A=U===0,H=U<0,I=X%2!==0;return{nextN:Q,offset:q,isZero:A,isNeg:H,isNegF:I,offsetF:N}}function $u(W,X){if(!Array.isArray(W))throw Error("array expected");W.forEach((G,Y)=>{if(!(G instanceof X))throw Error("invalid point at index "+Y)})}function Fu(W,X){if(!Array.isArray(W))throw Error("array of scalars expected");W.forEach((G,Y)=>{if(!X.isValid(G))throw Error("invalid scalar at index "+Y)})}var eA=new WeakMap,kT=new WeakMap;function Wz(W){return kT.get(W)||1}function iC(W){if(W!==QG)throw Error("invalid wNAF")}class _T{constructor(W,X){this.BASE=W.BASE,this.ZERO=W.ZERO,this.Fn=W.Fn,this.bits=X}_unsafeLadder(W,X,G=this.ZERO){let Y=W;while(X>QG){if(X&PW)G=G.add(Y);Y=Y.double(),X>>=PW}return G}precomputeWindow(W,X){let{windows:G,windowSize:Y}=tA(X,this.bits),J=[],Z=W,V=Z;for(let U=0;U<G;U++){V=Z,J.push(V);for(let Q=1;Q<Y;Q++)V=V.add(Z),J.push(V);Z=V.double()}return J}wNAF(W,X,G){if(!this.Fn.isValid(G))throw Error("invalid scalar");let Y=this.ZERO,J=this.BASE,Z=tA(W,this.bits);for(let V=0;V<Z.windows;V++){let{nextN:U,offset:Q,isZero:N,isNeg:q,isNegF:A,offsetF:H}=nC(G,V,Z);if(G=U,N)J=J.add(jQ(A,X[H]));else Y=Y.add(jQ(q,X[Q]))}return iC(G),{p:Y,f:J}}wNAFUnsafe(W,X,G,Y=this.ZERO){let J=tA(W,this.bits);for(let Z=0;Z<J.windows;Z++){if(G===QG)break;let{nextN:V,offset:U,isZero:Q,isNeg:N}=nC(G,Z,J);if(G=V,Q)continue;else{let q=X[U];Y=Y.add(N?q.negate():q)}}return iC(G),Y}getPrecomputes(W,X,G){let Y=eA.get(X);if(!Y){if(Y=this.precomputeWindow(X,W),W!==1){if(typeof G==="function")Y=G(Y);eA.set(X,Y)}}return Y}cached(W,X,G){let Y=Wz(W);return this.wNAF(Y,this.getPrecomputes(Y,W,G),X)}unsafe(W,X,G,Y){let J=Wz(W);if(J===1)return this._unsafeLadder(W,X,Y);return this.wNAFUnsafe(J,this.getPrecomputes(J,W,G),X,Y)}createCache(W,X){xT(X,this.bits),kT.set(W,X),eA.delete(W)}hasCache(W){return Wz(W)!==1}}function Su(W,X,G,Y){let J=X,Z=W.ZERO,V=W.ZERO;while(G>QG||Y>QG){if(G&PW)Z=Z.add(J);if(Y&PW)V=V.add(J);J=J.double(),G>>=PW,Y>>=PW}return{p1:Z,p2:V}}function xu(W,X,G,Y){$u(G,W),Fu(Y,X);let J=G.length,Z=Y.length;if(J!==Z)throw Error("arrays of points and scalars must have equal length");let V=W.ZERO,U=DT(BigInt(J)),Q=1;if(U>12)Q=U-3;else if(U>4)Q=U-2;else if(U>0)Q=2;let N=hJ(Q),q=Array(Number(N)+1).fill(V),A=Math.floor((X.BITS-1)/Q)*Q,H=V;for(let I=A;I>=0;I-=Q){q.fill(V);for(let D=0;D<Z;D++){let T=Y[D],x=Number(T>>BigInt(I)&N);q[x]=q[x].add(G[D])}let w=V;for(let D=q.length-1,T=V;D>0;D--)T=T.add(q[D]),w=w.add(T);if(H=H.add(w),I!==0)for(let D=0;D<Q;D++)H=H.double()}return H}function rC(W,X,G){if(X){if(X.ORDER!==W)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return Bu(X),X}else return bJ(W,{isLE:G})}function ku(W,X,G={},Y){if(Y===void 0)Y=W==="edwards";if(!X||typeof X!=="object")throw Error(`expected valid ${W} CURVE object`);for(let U of["p","n","h"]){let Q=X[U];if(!(typeof Q==="bigint"&&Q>QG))throw Error(`CURVE.${U} must be positive bigint`)}let J=rC(X.p,G.Fp,Y),Z=rC(X.n,G.Fn,Y),V=["Gx","Gy","a",W==="weierstrass"?"b":"d"];for(let U of V)if(!J.isValid(X[U]))throw Error(`CURVE.${U} must be valid field element of CURVE.Fp`);return X=Object.freeze(Object.assign({},X)),{CURVE:X,Fp:J,Fn:Z}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var aC=(W,X)=>(W+(W>=0?X:-X)/vT)/X;function _u(W,X,G){let[[Y,J],[Z,V]]=X,U=aC(V*W,G),Q=aC(-J*W,G),N=W-U*Y-Q*Z,q=-U*J-Q*V,A=N<Y4,H=q<Y4;if(A)N=-N;if(H)q=-q;let I=hJ(Math.ceil(DT(G)/2))+VG;if(N<Y4||N>=I||q<Y4||q>=I)throw Error("splitScalar (endomorphism): failed, k="+W);return{k1neg:A,k1:N,k2neg:H,k2:q}}function qz(W){if(!["compact","recovered","der"].includes(W))throw Error('Signature format must be "compact", "recovered", or "der"');return W}function Xz(W,X){let G={};for(let Y of Object.keys(X))G[Y]=W[Y]===void 0?X[Y]:W[Y];if(wQ(G.lowS,"lowS"),wQ(G.prehash,"prehash"),G.format!==void 0)qz(G.format);return G}class yT extends Error{constructor(W=""){super(W)}}var G4={Err:yT,_tlv:{encode:(W,X)=>{let{Err:G}=G4;if(W<0||W>256)throw new G("tlv.encode: wrong tag");if(X.length&1)throw new G("tlv.encode: unpadded data");let Y=X.length/2,J=XQ(Y);if(J.length/2&128)throw new G("tlv.encode: long form length too big");let Z=Y>127?XQ(J.length/2|128):"";return XQ(W)+Z+J+X},decode(W,X){let{Err:G}=G4,Y=0;if(W<0||W>256)throw new G("tlv.encode: wrong tag");if(X.length<2||X[Y++]!==W)throw new G("tlv.decode: wrong tlv");let J=X[Y++],Z=!!(J&128),V=0;if(!Z)V=J;else{let Q=J&127;if(!Q)throw new G("tlv.decode(long): indefinite length not supported");if(Q>4)throw new G("tlv.decode(long): byte length is too big");let N=X.subarray(Y,Y+Q);if(N.length!==Q)throw new G("tlv.decode: length bytes not complete");if(N[0]===0)throw new G("tlv.decode(long): zero leftmost byte");for(let q of N)V=V<<8|q;if(Y+=Q,V<128)throw new G("tlv.decode(long): not minimal encoding")}let U=X.subarray(Y,Y+V);if(U.length!==V)throw new G("tlv.decode: wrong value length");return{v:U,l:X.subarray(Y+V)}}},_int:{encode(W){let{Err:X}=G4;if(W<Y4)throw new X("integer: negative integers are not allowed");let G=XQ(W);if(Number.parseInt(G[0],16)&8)G="00"+G;if(G.length&1)throw new X("unexpected DER parsing assertion: unpadded hex");return G},decode(W){let{Err:X}=G4;if(W[0]&128)throw new X("invalid signature integer: negative");if(W[0]===0&&!(W[1]&128))throw new X("invalid signature integer: unnecessary leading zero");return qG(W)}},toSig(W){let{Err:X,_int:G,_tlv:Y}=G4,J=f8("signature",W),{v:Z,l:V}=Y.decode(48,J);if(V.length)throw new X("invalid signature: left bytes after parsing");let{v:U,l:Q}=Y.decode(2,Z),{v:N,l:q}=Y.decode(2,Q);if(q.length)throw new X("invalid signature: left bytes after parsing");return{r:G.decode(U),s:G.decode(N)}},hexFromSig(W){let{_tlv:X,_int:G}=G4,Y=X.encode(2,G.encode(W.r)),J=X.encode(2,G.encode(W.s)),Z=Y+J;return X.encode(48,Z)}},Y4=BigInt(0),VG=BigInt(1),vT=BigInt(2),GQ=BigInt(3),yu=BigInt(4);function RW(W,X){let{BYTES:G}=W,Y;if(typeof X==="bigint")Y=X;else{let J=f8("private key",X);try{Y=W.fromBytes(J)}catch(Z){throw Error(`invalid private key: expected ui8a of size ${G}, got ${typeof X}`)}}if(!W.isValidNot0(Y))throw Error("invalid private key: out of range [1..N-1]");return Y}function vu(W,X={}){let G=ku("weierstrass",W,X),{Fp:Y,Fn:J}=G,Z=G.CURVE,{h:V,n:U}=Z;Dz(X,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:Q}=X;if(Q){if(!Y.is0(Z.a)||typeof Q.beta!=="bigint"||!Array.isArray(Q.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let N=uT(Y,J);function q(){if(!Y.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function A(g,d,P){let{x:E,y:f}=d.toAffine(),r=Y.toBytes(E);if(wQ(P,"isCompressed"),P){q();let o=!Y.isOdd(f);return w7(gT(o),r)}else return w7(Uint8Array.of(4),r,Y.toBytes(f))}function H(g){TW(g,void 0,"Point");let{publicKey:d,publicKeyUncompressed:P}=N,E=g.length,f=g[0],r=g.subarray(1);if(E===d&&(f===2||f===3)){let o=Y.fromBytes(r);if(!Y.isValid(o))throw Error("bad point: is not on curve, wrong x");let B=D(o),S;try{S=Y.sqrt(B)}catch(v){let R=v instanceof Error?": "+v.message:"";throw Error("bad point: is not on curve, sqrt error"+R)}q();let _=Y.isOdd(S);if((f&1)===1!==_)S=Y.neg(S);return{x:o,y:S}}else if(E===P&&f===4){let o=Y.BYTES,B=Y.fromBytes(r.subarray(0,o)),S=Y.fromBytes(r.subarray(o,o*2));if(!T(B,S))throw Error("bad point: is not on curve");return{x:B,y:S}}else throw Error(`bad point: got length ${E}, expected compressed=${d} or uncompressed=${P}`)}let I=X.toBytes||A,w=X.fromBytes||H;function D(g){let d=Y.sqr(g),P=Y.mul(d,g);return Y.add(Y.add(P,Y.mul(g,Z.a)),Z.b)}function T(g,d){let P=Y.sqr(d),E=D(g);return Y.eql(P,E)}if(!T(Z.Gx,Z.Gy))throw Error("bad curve params: generator point");let x=Y.mul(Y.pow(Z.a,GQ),yu),h=Y.mul(Y.sqr(Z.b),BigInt(27));if(Y.is0(Y.add(x,h)))throw Error("bad curve params: a or b");function $(g,d,P=!1){if(!Y.isValid(d)||P&&Y.is0(d))throw Error(`bad point coordinate ${g}`);return d}function F(g){if(!(g instanceof y))throw Error("ProjectivePoint expected")}function u(g){if(!Q||!Q.basises)throw Error("no endo");return _u(g,Q.basises,J.ORDER)}let c=lC((g,d)=>{let{X:P,Y:E,Z:f}=g;if(Y.eql(f,Y.ONE))return{x:P,y:E};let r=g.is0();if(d==null)d=r?Y.ONE:Y.inv(f);let o=Y.mul(P,d),B=Y.mul(E,d),S=Y.mul(f,d);if(r)return{x:Y.ZERO,y:Y.ZERO};if(!Y.eql(S,Y.ONE))throw Error("invZ was invalid");return{x:o,y:B}}),p=lC((g)=>{if(g.is0()){if(X.allowInfinityPoint&&!Y.is0(g.Y))return;throw Error("bad point: ZERO")}let{x:d,y:P}=g.toAffine();if(!Y.isValid(d)||!Y.isValid(P))throw Error("bad point: x or y not field elements");if(!T(d,P))throw Error("bad point: equation left != right");if(!g.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function s(g,d,P,E,f){return P=new y(Y.mul(P.X,g),P.Y,P.Z),d=jQ(E,d),P=jQ(f,P),d.add(P)}class y{constructor(g,d,P){this.X=$("x",g),this.Y=$("y",d,!0),this.Z=$("z",P),Object.freeze(this)}static CURVE(){return Z}static fromAffine(g){let{x:d,y:P}=g||{};if(!g||!Y.isValid(d)||!Y.isValid(P))throw Error("invalid affine point");if(g instanceof y)throw Error("projective point not allowed");if(Y.is0(d)&&Y.is0(P))return y.ZERO;return new y(d,P,Y.ONE)}static fromBytes(g){let d=y.fromAffine(w(TW(g,void 0,"point")));return d.assertValidity(),d}static fromHex(g){return y.fromBytes(f8("pointHex",g))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(g=8,d=!0){if(H0.createCache(this,g),!d)this.multiply(GQ);return this}assertValidity(){p(this)}hasEvenY(){let{y:g}=this.toAffine();if(!Y.isOdd)throw Error("Field doesn't support isOdd");return!Y.isOdd(g)}equals(g){F(g);let{X:d,Y:P,Z:E}=this,{X:f,Y:r,Z:o}=g,B=Y.eql(Y.mul(d,o),Y.mul(f,E)),S=Y.eql(Y.mul(P,o),Y.mul(r,E));return B&&S}negate(){return new y(this.X,Y.neg(this.Y),this.Z)}double(){let{a:g,b:d}=Z,P=Y.mul(d,GQ),{X:E,Y:f,Z:r}=this,o=Y.ZERO,B=Y.ZERO,S=Y.ZERO,_=Y.mul(E,E),v=Y.mul(f,f),R=Y.mul(r,r),m=Y.mul(E,f);return m=Y.add(m,m),S=Y.mul(E,r),S=Y.add(S,S),o=Y.mul(g,S),B=Y.mul(P,R),B=Y.add(o,B),o=Y.sub(v,B),B=Y.add(v,B),B=Y.mul(o,B),o=Y.mul(m,o),S=Y.mul(P,S),R=Y.mul(g,R),m=Y.sub(_,R),m=Y.mul(g,m),m=Y.add(m,S),S=Y.add(_,_),_=Y.add(S,_),_=Y.add(_,R),_=Y.mul(_,m),B=Y.add(B,_),R=Y.mul(f,r),R=Y.add(R,R),_=Y.mul(R,m),o=Y.sub(o,_),S=Y.mul(R,v),S=Y.add(S,S),S=Y.add(S,S),new y(o,B,S)}add(g){F(g);let{X:d,Y:P,Z:E}=this,{X:f,Y:r,Z:o}=g,B=Y.ZERO,S=Y.ZERO,_=Y.ZERO,v=Z.a,R=Y.mul(Z.b,GQ),m=Y.mul(d,f),J0=Y.mul(P,r),U0=Y.mul(E,o),N0=Y.add(d,P),$0=Y.add(f,r);N0=Y.mul(N0,$0),$0=Y.add(m,J0),N0=Y.sub(N0,$0),$0=Y.add(d,E);let u0=Y.add(f,o);return $0=Y.mul($0,u0),u0=Y.add(m,U0),$0=Y.sub($0,u0),u0=Y.add(P,E),B=Y.add(r,o),u0=Y.mul(u0,B),B=Y.add(J0,U0),u0=Y.sub(u0,B),_=Y.mul(v,$0),B=Y.mul(R,U0),_=Y.add(B,_),B=Y.sub(J0,_),_=Y.add(J0,_),S=Y.mul(B,_),J0=Y.add(m,m),J0=Y.add(J0,m),U0=Y.mul(v,U0),$0=Y.mul(R,$0),J0=Y.add(J0,U0),U0=Y.sub(m,U0),U0=Y.mul(v,U0),$0=Y.add($0,U0),m=Y.mul(J0,$0),S=Y.add(S,m),m=Y.mul(u0,$0),B=Y.mul(N0,B),B=Y.sub(B,m),m=Y.mul(N0,J0),_=Y.mul(u0,_),_=Y.add(_,m),new y(B,S,_)}subtract(g){return this.add(g.negate())}is0(){return this.equals(y.ZERO)}multiply(g){let{endo:d}=X;if(!J.isValidNot0(g))throw Error("invalid scalar: out of range");let P,E,f=(r)=>H0.cached(this,r,(o)=>sA(y,o));if(d){let{k1neg:r,k1:o,k2neg:B,k2:S}=u(g),{p:_,f:v}=f(o),{p:R,f:m}=f(S);E=v.add(m),P=s(d.beta,_,R,r,B)}else{let{p:r,f:o}=f(g);P=r,E=o}return sA(y,[P,E])[0]}multiplyUnsafe(g){let{endo:d}=X,P=this;if(!J.isValid(g))throw Error("invalid scalar: out of range");if(g===Y4||P.is0())return y.ZERO;if(g===VG)return P;if(H0.hasCache(this))return this.multiply(g);if(d){let{k1neg:E,k1:f,k2neg:r,k2:o}=u(g),{p1:B,p2:S}=Su(y,P,f,o);return s(d.beta,B,S,E,r)}else return H0.unsafe(P,g)}multiplyAndAddUnsafe(g,d,P){let E=this.multiplyUnsafe(d).add(g.multiplyUnsafe(P));return E.is0()?void 0:E}toAffine(g){return c(this,g)}isTorsionFree(){let{isTorsionFree:g}=X;if(V===VG)return!0;if(g)return g(y,this);return H0.unsafe(this,U).is0()}clearCofactor(){let{clearCofactor:g}=X;if(V===VG)return this;if(g)return g(y,this);return this.multiplyUnsafe(V)}isSmallOrder(){return this.multiplyUnsafe(V).is0()}toBytes(g=!0){return wQ(g,"isCompressed"),this.assertValidity(),I(y,this,g)}toHex(g=!0){return ZG(this.toBytes(g))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(g=!0){return this.toBytes(g)}_setWindowSize(g){this.precompute(g)}static normalizeZ(g){return sA(y,g)}static msm(g,d){return xu(y,J,g,d)}static fromPrivateKey(g){return y.BASE.multiply(RW(J,g))}}y.BASE=new y(Z.Gx,Z.Gy,Y.ONE),y.ZERO=new y(Y.ZERO,Y.ONE,Y.ZERO),y.Fp=Y,y.Fn=J;let t=J.BITS,H0=new _T(y,X.endo?Math.ceil(t/2):t);return y.BASE.precompute(8),y}function gT(W){return Uint8Array.of(W?2:3)}function uT(W,X){return{secretKey:X.BYTES,publicKey:1+W.BYTES,publicKeyUncompressed:1+2*W.BYTES,publicKeyHasPrefix:!0,signature:2*X.BYTES}}function gu(W,X={}){let{Fn:G}=W,Y=X.randomBytes||RQ,J=Object.assign(uT(W.Fp,G),{seed:FT(G.ORDER)});function Z(H){try{return!!RW(G,H)}catch(I){return!1}}function V(H,I){let{publicKey:w,publicKeyUncompressed:D}=J;try{let T=H.length;if(I===!0&&T!==w)return!1;if(I===!1&&T!==D)return!1;return!!W.fromBytes(H)}catch(T){return!1}}function U(H=Y(J.seed)){return ST(TW(H,J.seed,"seed"),G.ORDER)}function Q(H,I=!0){return W.BASE.multiply(RW(G,H)).toBytes(I)}function N(H){let I=U(H);return{secretKey:I,publicKey:Q(I)}}function q(H){if(typeof H==="bigint")return!1;if(H instanceof W)return!0;let{secretKey:I,publicKey:w,publicKeyUncompressed:D}=J;if(G.allowedLengths||I===w)return;let T=f8("key",H).length;return T===w||T===D}function A(H,I,w=!0){if(q(H)===!0)throw Error("first arg must be private key");if(q(I)===!1)throw Error("second arg must be public key");let D=RW(G,H);return W.fromHex(I).multiply(D).toBytes(w)}return Object.freeze({getPublicKey:Q,getSharedSecret:A,keygen:N,Point:W,utils:{isValidSecretKey:Z,isValidPublicKey:V,randomSecretKey:U,isValidPrivateKey:Z,randomPrivateKey:U,normPrivateKeyToScalar:(H)=>RW(G,H),precompute(H=8,I=W.BASE){return I.precompute(H,!1)}},lengths:J})}function uu(W,X,G={}){NT(X),Dz(G,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let Y=G.randomBytes||RQ,J=G.hmac||((P,...E)=>IT(X,P,w7(...E))),{Fp:Z,Fn:V}=W,{ORDER:U,BITS:Q}=V,{keygen:N,getPublicKey:q,getSharedSecret:A,utils:H,lengths:I}=gu(W,G),w={prehash:!1,lowS:typeof G.lowS==="boolean"?G.lowS:!1,format:void 0,extraEntropy:!1},D="compact";function T(P){let E=U>>VG;return P>E}function x(P,E){if(!V.isValidNot0(E))throw Error(`invalid signature ${P}: out of range 1..Point.Fn.ORDER`);return E}function h(P,E){qz(E);let f=I.signature,r=E==="compact"?f:E==="recovered"?f+1:void 0;return TW(P,r,`${E} signature`)}class ${constructor(P,E,f){if(this.r=x("r",P),this.s=x("s",E),f!=null)this.recovery=f;Object.freeze(this)}static fromBytes(P,E=D){h(P,E);let f;if(E==="der"){let{r:S,s:_}=G4.toSig(TW(P));return new $(S,_)}if(E==="recovered")f=P[0],E="compact",P=P.subarray(1);let r=V.BYTES,o=P.subarray(0,r),B=P.subarray(r,r*2);return new $(V.fromBytes(o),V.fromBytes(B),f)}static fromHex(P,E){return this.fromBytes(IQ(P),E)}addRecoveryBit(P){return new $(this.r,this.s,P)}recoverPublicKey(P){let E=Z.ORDER,{r:f,s:r,recovery:o}=this;if(o==null||![0,1,2,3].includes(o))throw Error("recovery id invalid");if(U*vT<E&&o>1)throw Error("recovery id is ambiguous for h>1 curve");let B=o===2||o===3?f+U:f;if(!Z.isValid(B))throw Error("recovery id 2 or 3 invalid");let S=Z.toBytes(B),_=W.fromBytes(w7(gT((o&1)===0),S)),v=V.inv(B),R=u(f8("msgHash",P)),m=V.create(-R*v),J0=V.create(r*v),U0=W.BASE.multiplyUnsafe(m).add(_.multiplyUnsafe(J0));if(U0.is0())throw Error("point at infinify");return U0.assertValidity(),U0}hasHighS(){return T(this.s)}toBytes(P=D){if(qz(P),P==="der")return IQ(G4.hexFromSig(this));let E=V.toBytes(this.r),f=V.toBytes(this.s);if(P==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return w7(Uint8Array.of(this.recovery),E,f)}return w7(E,f)}toHex(P){return ZG(this.toBytes(P))}assertValidity(){}static fromCompact(P){return $.fromBytes(f8("sig",P),"compact")}static fromDER(P){return $.fromBytes(f8("sig",P),"der")}normalizeS(){return this.hasHighS()?new $(this.r,V.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ZG(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ZG(this.toBytes("compact"))}}let F=G.bits2int||function(P){if(P.length>8192)throw Error("input is too large");let E=qG(P),f=P.length*8-Q;return f>0?E>>BigInt(f):E},u=G.bits2int_modN||function(P){return V.create(F(P))},c=hJ(Q);function p(P){return Du("num < 2^"+Q,P,Y4,c),V.toBytes(P)}function s(P,E){return TW(P,void 0,"message"),E?TW(X(P),void 0,"prehashed message"):P}function y(P,E,f){if(["recovered","canonical"].some((U0)=>(U0 in f)))throw Error("sign() legacy options not supported");let{lowS:r,prehash:o,extraEntropy:B}=Xz(f,w);P=s(P,o);let S=u(P),_=RW(V,E),v=[p(_),p(S)];if(B!=null&&B!==!1){let U0=B===!0?Y(I.secretKey):B;v.push(f8("extraEntropy",U0))}let R=w7(...v),m=S;function J0(U0){let N0=F(U0);if(!V.isValidNot0(N0))return;let $0=V.inv(N0),u0=W.BASE.multiply(N0).toAffine(),q1=V.create(u0.x);if(q1===Y4)return;let g1=V.create($0*V.create(m+q1*_));if(g1===Y4)return;let h0=(u0.x===q1?0:2)|Number(u0.y&VG),S1=g1;if(r&&T(g1))S1=V.neg(g1),h0^=1;return new $(q1,S1,h0)}return{seed:R,k2sig:J0}}function t(P,E,f={}){P=f8("message",P);let{seed:r,k2sig:o}=y(P,E,f);return Ou(X.outputLen,V.BYTES,J)(r,o)}function H0(P){let E=void 0,f=typeof P==="string"||PQ(P),r=!f&&P!==null&&typeof P==="object"&&typeof P.r==="bigint"&&typeof P.s==="bigint";if(!f&&!r)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(r)E=new $(P.r,P.s);else if(f){try{E=$.fromBytes(f8("sig",P),"der")}catch(o){if(!(o instanceof G4.Err))throw o}if(!E)try{E=$.fromBytes(f8("sig",P),"compact")}catch(o){return!1}}if(!E)return!1;return E}function g(P,E,f,r={}){let{lowS:o,prehash:B,format:S}=Xz(r,w);if(f=f8("publicKey",f),E=s(f8("message",E),B),"strict"in r)throw Error("options.strict was renamed to lowS");let _=S===void 0?H0(P):$.fromBytes(f8("sig",P),S);if(_===!1)return!1;try{let v=W.fromBytes(f);if(o&&_.hasHighS())return!1;let{r:R,s:m}=_,J0=u(E),U0=V.inv(m),N0=V.create(J0*U0),$0=V.create(R*U0),u0=W.BASE.multiplyUnsafe(N0).add(v.multiplyUnsafe($0));if(u0.is0())return!1;return V.create(u0.x)===R}catch(v){return!1}}function d(P,E,f={}){let{prehash:r}=Xz(f,w);return E=s(E,r),$.fromBytes(P,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:N,getPublicKey:q,getSharedSecret:A,utils:H,lengths:I,Point:W,sign:t,verify:g,recoverPublicKey:d,Signature:$,hash:X})}function hu(W){let X={a:W.a,b:W.b,p:W.Fp.ORDER,n:W.n,h:W.h,Gx:W.Gx,Gy:W.Gy},G=W.Fp,Y=W.allowedPrivateKeyLengths?Array.from(new Set(W.allowedPrivateKeyLengths.map((V)=>Math.ceil(V/2)))):void 0,J=bJ(X.n,{BITS:W.nBitLength,allowedLengths:Y,modFromBytes:W.wrapPrivateKey}),Z={Fp:G,Fn:J,allowInfinityPoint:W.allowInfinityPoint,endo:W.endo,isTorsionFree:W.isTorsionFree,clearCofactor:W.clearCofactor,fromBytes:W.fromBytes,toBytes:W.toBytes};return{CURVE:X,curveOpts:Z}}function bu(W){let{CURVE:X,curveOpts:G}=hu(W),Y={hmac:W.hmac,randomBytes:W.randomBytes,lowS:W.lowS,bits2int:W.bits2int,bits2int_modN:W.bits2int_modN};return{CURVE:X,curveOpts:G,hash:W.hash,ecdsaOpts:Y}}function mu(W,X){let G=X.Point;return Object.assign({},X,{ProjectivePoint:G,CURVE:Object.assign({},W,ET(G.Fn.ORDER,G.Fn.BITS))})}function fu(W){let{CURVE:X,curveOpts:G,hash:Y,ecdsaOpts:J}=bu(W),Z=vu(X,G),V=uu(Z,Y,J);return mu(W,V)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pu(W,X){let G=(Y)=>fu({...W,hash:Y});return{...G(X),create:G}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var NG={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},cu={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},lu=BigInt(0),sC=BigInt(1),Hz=BigInt(2);function du(W){let X=NG.p,G=BigInt(3),Y=BigInt(6),J=BigInt(11),Z=BigInt(22),V=BigInt(23),U=BigInt(44),Q=BigInt(88),N=W*W*W%X,q=N*N*W%X,A=D5(q,G,X)*q%X,H=D5(A,G,X)*q%X,I=D5(H,Hz,X)*N%X,w=D5(I,J,X)*I%X,D=D5(w,Z,X)*w%X,T=D5(D,U,X)*D%X,x=D5(T,Q,X)*T%X,h=D5(x,U,X)*D%X,$=D5(h,G,X)*q%X,F=D5($,V,X)*w%X,u=D5(F,Y,X)*N%X,c=D5(u,Hz,X);if(!KQ.eql(KQ.sqr(c),W))throw Error("Cannot find square root");return c}var KQ=bJ(NG.p,{sqrt:du}),hT=pu({...NG,Fp:KQ,lowS:!0,endo:cu},Uz),tC={};function DQ(W,...X){let G=tC[W];if(G===void 0){let Y=Uz(HT(W));G=w7(Y,Y),tC[W]=G}return Uz(w7(G,...X))}var Cz=(W)=>W.toBytes(!0).slice(1),HG=(()=>hT.Point)(),Tz=(W)=>W%Hz===lu;function Az(W){let{Fn:X,BASE:G}=HG,Y=RW(X,W),J=G.multiply(Y);return{scalar:Tz(J.y)?Y:X.neg(Y),bytes:Cz(J)}}function bT(W){let X=KQ;if(!X.isValidNot0(W))throw Error("invalid x: Fail if x \u2265 p");let G=X.create(W*W),Y=X.create(G*W+BigInt(7)),J=X.sqrt(Y);if(!Tz(J))J=X.neg(J);let Z=HG.fromAffine({x:W,y:J});return Z.assertValidity(),Z}var gJ=qG;function mT(...W){return HG.Fn.create(gJ(DQ("BIP0340/challenge",...W)))}function eC(W){return Az(W).bytes}function ou(W,X,G=RQ(32)){let{Fn:Y}=HG,J=f8("message",W),{bytes:Z,scalar:V}=Az(X),U=f8("auxRand",G,32),Q=Y.toBytes(V^gJ(DQ("BIP0340/aux",U))),N=DQ("BIP0340/nonce",Q,Z,J),{bytes:q,scalar:A}=Az(N),H=mT(q,Z,J),I=new Uint8Array(64);if(I.set(q,0),I.set(Y.toBytes(Y.create(A+H*V)),32),!fT(I,J,Z))throw Error("sign: Invalid signature produced");return I}function fT(W,X,G){let{Fn:Y,BASE:J}=HG,Z=f8("signature",W,64),V=f8("message",X),U=f8("publicKey",G,32);try{let Q=bT(gJ(U)),N=gJ(Z.subarray(0,32));if(!Nz(N,sC,NG.p))return!1;let q=gJ(Z.subarray(32,64));if(!Nz(q,sC,NG.n))return!1;let A=mT(Y.toBytes(N),Cz(Q),V),H=J.multiplyUnsafe(q).add(Q.multiplyUnsafe(Y.neg(A))),{x:I,y:w}=H.toAffine();if(H.is0()||!Tz(w)||I!==N)return!1;return!0}catch(Q){return!1}}var Mz=(()=>{let W=(G=RQ(48))=>{return ST(G,NG.n)};hT.utils.randomSecretKey;function X(G){let Y=W(G);return{secretKey:Y,publicKey:eC(Y)}}return{keygen:X,getPublicKey:eC,sign:ou,verify:fT,Point:HG,utils:{randomSecretKey:W,randomPrivateKey:W,taggedHash:DQ,lift_x:bT,pointToBytes:Cz,numberToBytesBE:LQ,bytesToNumberBE:qG,mod:C5},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})(),nu=new TextEncoder,iu=new TextDecoder,J4=(W)=>nu.encode(W),kJ=(W)=>iu.decode(W),zz=(W)=>Array.from(W,(X)=>X.toString(16).padStart(2,"0")).join(""),j7=JSON.stringify,OQ=JSON.parse,ru=(W,X=Number.MAX_SAFE_INTEGER)=>W.split("").reduce((G,Y)=>G+Y.charCodeAt(0),0)%X,CQ="AES-GCM",au={},pT="$",cT=",",su=(W)=>{let X=new Uint8Array(W),G=32768,Y="";for(let J=0;J<X.length;J+=32768)Y+=String.fromCharCode(...X.subarray(J,J+32768));return btoa(Y)},tu=(W)=>Uint8Array.from(atob(W),(X)=>X.charCodeAt(0)).buffer,YQ=(W)=>au[W]??=crypto.subtle.digest("SHA-1",J4(W)).then((X)=>{let G=new Uint8Array(X),Y="";for(let J of G)Y+=J.toString(36);return Y}),eu=async(W,X,G)=>{if(!W){let J=await crypto.subtle.digest("SHA-256",J4(`:${X}:${G}`));return crypto.subtle.importKey("raw",J,{name:CQ},!1,["encrypt","decrypt"])}let Y=await crypto.subtle.importKey("raw",J4(W),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:J4(`${X}:${G}`),iterations:1e5,hash:"SHA-256"},Y,{name:CQ,length:256},!1,["encrypt","decrypt"])},Wh=async(W,X)=>{let G=crypto.getRandomValues(new Uint8Array(12)),Y=await W,J=await crypto.subtle.encrypt({name:CQ,iv:G},Y,J4(X));return`${G.join(cT)}${pT}${su(J)}`},Xh=async(W,X)=>{let[G,Y]=X.split(pT);if(!G||!Y)throw Error("Invalid encrypted payload format");let J=Uint8Array.from(G.split(cT),Number),Z=await W,V=await crypto.subtle.decrypt({name:CQ,iv:J},Z,tu(Y));return kJ(V)},O5="GenosRTC",BQ=(W,X)=>Array.from({length:W},X),TQ=(W)=>Array.from(crypto.getRandomValues(new Uint8Array(W)),(X)=>"0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"[X%62]).join(""),w8=typeof sessionStorage<"u"?sessionStorage.__genosrtcId??=TQ(20):TQ(20),YG=Promise.all.bind(Promise),Gh=typeof window<"u",{entries:Yh,fromEntries:lT,keys:ce}=Object,WT=()=>{},u5=(W)=>Error(`GenosRTC: ${W}`),JQ=(...W)=>W.join("@"),Jh=5000,XT="icegatheringstatechange",GT="offer",Zh="answer",Vh=[...BQ(3,(W,X)=>`stun:stun${X||""}.l.google.com:19302`),"stun:stun.cloudflare.com:3478"].map((W)=>({urls:W})),YT=(W,{rtcConfig:X,rtcPolyfill:G,turnConfig:Y})=>{let J=new(G||RTCPeerConnection)({iceServers:[...Vh,...Y||[]],...X}),Z={},V=!1,U=!1,Q,N=(H)=>Object.assign(H,{binaryType:"arraybuffer",bufferedAmountLowThreshold:65535,onmessage:(I)=>Z.data?.(I.data),onopen:()=>Z.connect?.(),onclose:()=>Z.close?.(),onerror:(I)=>!I?.error?.message?.includes("User-Initiated Abort")&&Z.error?.(I)}),q=()=>Promise.race([new Promise((H)=>{let I=()=>{if(J.iceGatheringState==="complete")J.removeEventListener(XT,I),H()};J.addEventListener(XT,I),I()}),new Promise((H)=>setTimeout(H,Jh))]).then(()=>({type:J.localDescription.type,sdp:J.localDescription.sdp.replace(/a=ice-options:trickle\s\n/g,"")}));if(W?N(Q=J.createDataChannel("data")):J.ondatachannel=({channel:H})=>N(Q=H),J.onnegotiationneeded=async()=>{try{V=!0,await J.setLocalDescription(),Z.signal?.(await q())}catch(H){Z.error?.(H)}finally{V=!1}},J.onconnectionstatechange=()=>{if(["disconnected","failed","closed"].includes(J.connectionState))Z.close?.()},J.ontrack=(H)=>{Z.track?.(H.track,H.streams[0]),Z.stream?.(H.streams[0])},J.onremovestream=(H)=>Z.stream?.(H.stream),W&&!J.canTrickleIceCandidates)J.onnegotiationneeded();let A=()=>J.getSenders();return{created:Date.now(),connection:J,get channel(){return Q},get isDead(){return J.connectionState==="closed"},async signal(H){if(Q?.readyState==="open"&&!H.sdp?.includes("a=rtpmap"))return;try{if(H.type===GT){if(V||J.signalingState!=="stable"&&!U){if(W)return;await YG([J.setLocalDescription({type:"rollback"}),J.setRemoteDescription(H)])}else await J.setRemoteDescription(H);await J.setLocalDescription();let I=await q();return Z.signal?.(I),I}if(H.type===Zh){U=!0;try{await J.setRemoteDescription(H)}finally{U=!1}}}catch(I){Z.error?.(I)}},sendData:(H)=>{if(Q?.readyState!=="open")return!1;return Q.send(H),!0},destroy:()=>{Q?.close(),J.close(),V=U=!1},setHandlers:(H)=>Object.assign(Z,H),offerPromise:W?new Promise((H)=>Z.signal=(I)=>I.type===GT&&H(I)):Promise.resolve(),addStream:(H)=>H.getTracks().forEach((I)=>J.addTrack(I,H)),removeStream:(H)=>A().filter((I)=>H.getTracks().includes(I.track)).forEach((I)=>J.removeTrack(I)),addTrack:(H,I)=>J.addTrack(H,I),removeTrack:(H)=>{let I=A().find((w)=>w.track===H);if(I)J.removeTrack(I)},replaceTrack:(H,I)=>A().find((w)=>w.track===H)?.replaceTrack(I)}},Uh=Object.getPrototypeOf(Uint8Array),QQ=12,dT=0,NQ=dT+QQ,qQ=NQ+1,_J=qQ+1,yJ=_J+1,SJ=16384-yJ,ZQ=255,Gz="bufferedamountlow",GG=(W)=>`@_${W}`,JT=GG("ping"),Yz=100,Qh=3,Nh=200,qh=512,Hh=33554432,ZT=async(W,X,G=1/0)=>{let Y=new Blob([W]).stream().pipeThrough(new X("deflate")).getReader(),J=[],Z=0;for(let Q=await Y.read();!Q.done;Q=await Y.read()){if((Z+=Q.value.byteLength)>G)throw Y.cancel(),u5(`inflated payload exceeds ${G} bytes`);J.push(Q.value)}let V=new Uint8Array(Z),U=0;for(let Q of J)V.set(Q,U),U+=Q.byteLength;return V},Ah=(W,X,G,Y,J)=>{let Z=new Map,V=new Map,U=new Map,Q={},N={},q={},A={},H=new Map,I=new Map,w=Promise.resolve(),D=(R,m)=>{if(!H.has(R))H.set(R,new Set);H.get(R).add(m)},T=(R,m)=>H.get(R)?.delete(m),x=(R,...m)=>H.get(R)?.forEach((J0)=>J0(...m)),h=(R,m)=>{let J0=R?Array.isArray(R)?R:[R]:Z.keys();return Array.from(J0,(U0)=>{let N0=Z.get(U0);if(!N0)return console.warn(`${O5}: no peer with id ${U0}`),null;return m(U0,N0)}).filter(Boolean)},$=(R)=>{if(!Z.has(R))return;Z.delete(R),I.delete(R),_.delete(R),delete Q[R],delete N[R],delete q[R],delete A[R],x("peer:leave",R),X(R)},F=(R)=>new Promise((m,J0)=>{let U0=setTimeout(()=>{R.removeEventListener(Gz,N0),J0(Error(`${O5}: bufferLow timeout`))},5000);function N0(){clearTimeout(U0),R.removeEventListener(Gz,N0),m()}R.addEventListener(Gz,N0)}),u=(R)=>{if(U.has(R))return U.get(R);if(!R)throw u5("action type is required");let m=J4(R);if(m.byteLength>QQ)throw u5(`\u274C "${R}" exceeds ${QQ} bytes. Use a shorter name.`);let J0=new Uint8Array(QQ).map((h0,S1)=>m[S1]||0),U0=0,N0=new Map([["message",new Set],["progress",new Set]]),$0=(h0,S1)=>N0.get(h0)?.add(S1),u0=(h0,S1)=>N0.get(h0)?.delete(S1),q1=async(h0,S1,x1,Q0)=>{if(x1&&typeof x1!=="object")throw u5("meta must be object");if(h0===void 0)throw u5("data cannot be undefined");let F0=h0 instanceof Blob,m0=F0||h0 instanceof ArrayBuffer||h0 instanceof Uh,Y0=typeof h0!=="string";if(x1&&!m0)throw u5("meta only allowed with binary");let K0=m0?new Uint8Array(F0?await h0.arrayBuffer():h0):J4(Y0?j7(h0):h0),M0=0;if(!m0&&K0.byteLength>=qh){let X0=await ZT(K0,CompressionStream);if(X0.byteLength<K0.byteLength)K0=X0,M0=1}let k0=x1?J4(j7(x1)):null,L1=Math.ceil(K0.byteLength/SJ)+(x1?1:0)||1;if(L1>Yz)throw u5(`Message too large, exceeds max chunks ${Yz}`);let Q1=BQ(L1,(X0,C0)=>{let x0=C0===L1-1,_1=x1&&C0===0,W8=_1?k0:K0.subarray(x1?(C0-1)*SJ:C0*SJ,x1?C0*SJ:(C0+1)*SJ),C1=new Uint8Array(yJ+W8.byteLength);return C1.set(J0),C1.set([U0],NQ),C1.set([x0|_1<<1|m0<<2|Y0<<3|M0<<4],qQ),C1.set([Math.round((C0+1)/L1*ZQ)],_J),C1.set(W8,yJ),C1});return U0=U0+1&ZQ,YG(h(S1,async(X0,C0)=>{let{channel:x0}=C0;for(let _1=0;_1<L1;_1++){let W8=0;while(x0.bufferedAmount>x0.bufferedAmountLowThreshold){if(W8++>Qh)throw u5(`${O5}: send buffer full, max retries reached for peer ${X0}`);try{await F(x0)}catch(C1){console.warn(C1.message),await new Promise((H1)=>setTimeout(H1,Nh))}}if(!Z.has(X0))break;if(!C0.sendData(Q1[_1]))throw u5(`channel not open for peer ${X0}`);Q0?.(Q1[_1][_J]/ZQ,X0,x1)}}))};V.set(R,{listeners:N0,send:q1});let g1={send:q1,on:$0,off:u0};return U.set(R,g1),g1},c=(R,m)=>{try{I.set(R,Date.now()),_.delete(R);let J0=new Uint8Array(m),U0=kJ(J0.subarray(dT,NQ)).replace(/\x00/g,"");if(!V.has(U0))return console.warn(`${O5}: unregistered type (${U0})`);if(U0===JT){y("",R).catch(()=>{});return}let[N0]=J0.subarray(NQ,qQ),[$0]=J0.subarray(qQ,_J),[u0]=J0.subarray(_J,yJ),q1=J0.subarray(yJ),g1=Boolean($0&1),h0=Boolean($0&2),S1=Boolean($0&4),x1=Boolean($0&8),Q0=Boolean($0&16),F0=V.get(U0),m0=(Q[R]||={})[U0]||={};if(m0[N0]?.chunks?.length>Yz){console.warn(`${O5}: peer ${R} sent too many chunks for nonce ${N0}, ignoring.`);return}let Y0=m0[N0]||={chunks:[]};if(h0)try{Y0.meta=OQ(kJ(q1))}catch{console.warn(`${O5}: failed to parse meta from peer ${R} for type ${U0}`);return}else Y0.chunks.push(q1);if(F0.listeners.get("progress").forEach((M0)=>{try{M0(u0/ZQ,R,Y0.meta)}catch(k0){console.error(k0)}}),!g1)return;let K0=new Uint8Array(Y0.chunks.reduce((M0,k0)=>M0+k0.byteLength,0));Y0.chunks.reduce((M0,k0)=>(K0.set(k0,M0),M0+k0.byteLength),0),delete m0[N0],w=w.then(async()=>{let M0=Q0?await ZT(K0,DecompressionStream,Hh):K0,k0;if(S1)k0=M0;else if(x1)try{k0=OQ(kJ(M0))}catch{console.warn(`${O5}: failed to parse JSON message data from peer ${R} for type ${U0}`);return}else k0=kJ(M0);F0.listeners.get("message").forEach((L1)=>{try{L1(k0,R,Y0.meta)}catch(Q1){console.error(Q1)}})}).catch((M0)=>console.error(`${O5}: dispatch error from peer ${R}:`,M0))}catch(J0){console.error(`${O5}: error handling data from peer ${R}:`,J0)}},p=async()=>{try{await r(""),await new Promise((R)=>setTimeout(R,99))}catch(R){console.warn(`${O5}: error sending leave`,R)}for(let[R,m]of Z){try{m.destroy()}catch{}Z.delete(R)}clearInterval(v),G()},{send:s}=u(JT),{send:y,on:t}=u(GG("pong")),{send:H0,on:g}=u(GG("signal")),{send:d,on:P}=u(GG("stream")),{send:E,on:f}=u(GG("track")),{send:r,on:o}=u(GG("leave"));W((R,m)=>{let J0=Z.get(m);if(J0===R)return;if(J0){let U0=()=>{};J0.setHandlers({data:U0,stream:U0,track:U0,signal:U0,close:U0,error:U0})}Z.set(m,R),I.set(m,Date.now()),_.delete(m),R.setHandlers({data:(U0)=>c(m,U0),stream:(U0)=>{x("stream:add",U0,m,q[m]),delete q[m]},track:(U0,N0)=>{x("track:add",U0,N0,m,A[m]),delete A[m]},signal:(U0)=>H0(U0,m),close:()=>$(m),error:(U0)=>{console.error(`${O5}: peer error for ${m}`,U0),$(m)}}),x("peer:join",m,Y?.(m))}),J?.((R,m,J0)=>x(J0?"peer:seen":"peer:lost",R,m)),t("message",(R,m)=>{N[m]?.(),delete N[m]}),g("message",(R,m)=>Z.get(m)?.signal(R)),P("message",(R,m)=>q[m]=R),f("message",(R,m)=>A[m]=R),o("message",(R,m)=>$(m));let B=1e4,S=20000,_=new Map,v=setInterval(()=>{let R=Date.now();for(let[m,J0]of Z){if(R-(I.get(m)??R)<=B)continue;let U0=_.get(m);if(U0===void 0)_.set(m,R),s("",m).catch(()=>{});else if(R-U0>S){_.delete(m);try{J0.destroy()}catch{}$(m)}}},5000);if(Gh)addEventListener("beforeunload",p);return{on:D,off:T,channel:u,leave:p,ping:async(R)=>{if(!R)throw u5("ping() requires target peer ID");let m=Date.now();return s("",R),await new Promise((J0)=>N[R]=J0),Date.now()-m},getPeers:()=>lT(Array.from(Z,([R,m])=>[R,m.connection])),addStream:(R,m,J0)=>h(m,async(U0,N0)=>{if(J0)await d(J0,U0);N0.addStream(R)}),removeStream:(R,m)=>h(m,(J0,U0)=>U0.removeStream(R)),addTrack:(R,m,J0,U0)=>h(J0,async(N0,$0)=>{if(U0)await E(U0,N0);$0.addTrack(R,m)}),removeTrack:(R,m)=>h(m,(J0,U0)=>U0.removeTrack(R)),replaceTrack:(R,m,J0,U0)=>h(J0,async(N0,$0)=>{if(U0)await E(U0,N0);$0.replaceTrack(R,m)})}},zh=5,Ih=10,wh=2500,VQ=57333,jh=({init:W,subscribe:X,announce:G,bye:Y})=>{let J={},Z=!1,V,U;return(Q,N,q)=>{let{appId:A}=Q;if(J[A]?.[N])return J[A][N];if(!Q||!N||!A&&!Q.firebaseApp)throw u5(!Q?"config required":!N?"roomId required":"appId missing");let H=WT,I=WT;if(!Z){let _=W(Q);U=BQ(zh,()=>{try{return YT(!0,Q)}catch{return null}}).filter(Boolean),V=Array.isArray(_)?_:[_];let v=setInterval(()=>{U=U.filter((R)=>{let m=Date.now()-R.created<VQ;if(!m)R.destroy();return m})},VQ);J.offerCleanupTimer||=v,Z=!0}let w={},D={},T=new Map,x=new Map,h=new Map,$={},F=JQ(O5,A,N),u=YQ(F),c=YQ(JQ(F,w8)),p=eu(Q.password||"",A,N),s=(_)=>async(v)=>({type:v.type,sdp:await _(p,v.sdp)}),y=s(Xh),t=s(Wh),H0=(_)=>{return setTimeout(()=>{if(!_.isDead&&!Object.values(D).includes(_))_.destroy()},VQ),_},g=(_)=>{try{return H0(YT(_,Q))}catch{return null}},d=(_,v)=>{if(D[v]===_)return;_.connectedAt=Date.now(),D[v]?.destroy(),D[v]=_,H(_,v),w[v]?.forEach((R)=>R!==_&&R.destroy()),delete w[v]},P=(_,v)=>{if(D[v]===_)delete D[v]},E=(_)=>async(v,R,m)=>{let[J0,U0]=await YG([u,c]);if(v!==J0&&v!==U0)return;let{peerId:N0,offer:$0,answer:u0,type:q1,bye:g1}=typeof R==="string"?OQ(R):R;if(g1){if(N0&&N0!==w8)x.delete(N0),I(N0,null,!1),h.set(N0,Date.now()),delete $[N0];return}if(N0&&N0!==w8)I(N0,q1,!0),x.set(N0,Date.now()),h.delete(N0);if(q1&&N0)$[N0]=q1;if(N0===w8)return;if(D[N0]){let h0=D[N0].channel?.readyState==="open";if(!$0||h0||Date.now()-D[N0].connectedAt<2000)return;D[N0].destroy(),delete D[N0]}if(Q.admit&&!Q.admit(N0))return;if($0){if(w[N0]?.[_]&&w8>N0)return;let h0=g(!1);if(!h0)return;h0.setHandlers({connect:()=>d(h0,N0),close:()=>P(h0,N0)});try{let S1=await y($0);if(h0.isDead)return;let[x1,Q0]=await YG([YQ(JQ(F,N0)),h0.signal(S1).then(t)]);m(x1,j7({peerId:w8,answer:Q0,...Q.type&&{type:Q.type}}))}catch{q?.({error:"decryption failed (offer)",appId:A,peerId:N0,roomId:N})}}else if(u0){let h0=w[N0]?.[_];if(!h0||h0.isDead)return;h0.setHandlers({connect:()=>d(h0,N0),close:()=>P(h0,N0)});try{h0.signal(await y(u0))}catch{q?.({error:"decryption failed (answer)",appId:A,peerId:N0,roomId:N})}}else{let h0=w[N0]||=[];if(h0.forEach((Q0,F0)=>{if(Q0&&(Q0.isDead||Date.now()-(Q0.dialedAt??Q0.created)>VQ)){if(Q0.isDead)T.set(N0,Date.now()+30000);Q0.destroy(),delete h0[F0]}}),h0[_]||h0.filter(Boolean).length>=2||T.get(N0)>Date.now())return;if(Object.values(w).reduce((Q0,F0)=>Q0+F0.filter((m0)=>m0&&!m0.isDead).length,0)>=Ih)return;let S1=U.pop(),x1=S1?H0(S1):g(!0);if(!x1){T.set(N0,Date.now()+30000);return}x1.dialedAt=Date.now(),h0[_]=x1;try{let[Q0,{offer:F0}]=await YG([YQ(JQ(F,N0)),x1.offerPromise.then(t).then((m0)=>({offer:m0}))]);x1.setHandlers({connect:()=>d(x1,N0),close:()=>P(x1,N0)}),m(Q0,j7({peerId:w8,offer:F0,...Q.type&&{type:Q.type}}))}catch{if(h0[_]===x1)delete h0[_];x1.destroy()}}},f=[],r=[],o=[],B=()=>o.forEach(({relay:_,rootTopic:v})=>Y?.(_,v));V.forEach(async(_,v)=>{let R=await _;if(!R)return;let[m,J0]=await YG([u,c]);r[v]=X(R,m,J0,E(v)),o.push({relay:R,rootTopic:m});let U0=async()=>{let N0=await G(R,m,J0);f[v]=setTimeout(U0,typeof N0==="number"?N0:wh)};U0()}),J[A]||={};let S=Ah((_)=>H=_,(_)=>delete D[_],()=>S.onCleanup?.(),(_)=>$[_],(_)=>I=_);if(typeof window<"u")window.addEventListener("pagehide",B);return S.onCleanup=()=>{if(B(),typeof window<"u")window.removeEventListener("pagehide",B);if(delete J[A][N],f.forEach(clearTimeout),r.forEach((_)=>_?.()),Object.keys(J).length===0)clearInterval(J.offerCleanupTimer),delete J.offerCleanupTimer},S._census=()=>{for(let v of Object.keys(D))x.set(v,Date.now());let _=Date.now()-120000;for(let[v,R]of x)if(R<_)x.delete(v);return[...x.keys()]},S._gone=()=>{let _=Date.now()-60000;for(let[v,R]of h)if(R<_)h.delete(v);return[...h.keys()]},J[A][N]=S}},VT=3333,Kh=30000,xJ={},oT={},Dh=(W,X)=>{let G={},Y=null;G.reopenHandlers=new Set;let J=()=>{if(Y)clearTimeout(Y),Y=null;if(G.socket)G.socket.onclose=null,G.socket.close();let Z=new WebSocket(W);Z.onclose=()=>{xJ[W]??=VT,Y=setTimeout(J,xJ[W]),xJ[W]=Math.min(xJ[W]*2,Kh)},Z.onmessage=(V)=>X(V.data),G.socket=Z,G.url=Z.url,G.ready=new Promise((V)=>{Z.onopen=()=>{xJ[W]=VT,V(G),G.reopenHandlers.forEach((U)=>U())}}),G.send=(V)=>{if(Z.readyState===1)Z.send(V)}};return G.forceReconnect=J,J(),oT[W]=G,G};if(typeof window<"u"){let W=(X)=>{JG.info("\u26A1 [GenosRTC] Network event detected. Forcing reconnection\u2026"),Object.values(oT).forEach((G)=>{if(G.socket&&G.socket.readyState!==WebSocket.OPEN&&(X||G.socket.readyState!==WebSocket.CONNECTING))G.forceReconnect()})};window.addEventListener("online",()=>{JG.info("\u2705 Reconnected to the network."),W(!0)}),window.addEventListener("offline",async()=>{JG.info("\u274C Disconnected from the network.")}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible")W()})}var Oh=(W)=>()=>lT(Yh(W).map(([X,G])=>[X,G.socket])),UG={},Ch=10,nT="x",iT="EVENT",Th=/pow:\s*(\d+)\s*bits needed\.?/i,HQ=new Set,rT=Mz.utils.randomSecretKey(),Mh=zz(Mz.getPublicKey(rT)),Pz={},vJ={},Ph={},aT=()=>Math.floor(Date.now()/1000),sT=(W)=>Ph[W]??=ru(W,1e4)+20000,uJ=(W)=>W.replace(/\/$/,""),Rh="https://cdn.jsdelivr.net/gh/estebanrfp/gdb@main/relays.json",tT=(W)=>Array.isArray(W)?[...new Set(W.filter((X)=>X?.startsWith?.("wss://")))]:[],eT="genosrtc_relays",Lh=()=>{try{return tT(JSON.parse(globalThis.localStorage?.getItem(eT)))}catch{return[]}},Bh=()=>fetch(`${Rh}?r=${Math.random().toString(36).slice(2)}`,{signal:AbortSignal.timeout(5000)}).then((W)=>W.json()).then(tT).then((W)=>(W.length&&globalThis.localStorage?.setItem(eT,JSON.stringify(W)),W)).catch(()=>[]).then((W)=>(W=W.length?W:Lh(),W.length||JG.warn("\u26A0\uFE0F [GenosRTC] Relay list unreachable - Pass rtc.relayUrls to override."),W)),Eh=(W,X)=>{let[G,Y,J,Z]=OQ(X);if(G===iT)return vJ[Y]?.(Pz[Y],J.content);if(G==="NOTICE"||G==="OK"&&!J){if(+((G==="NOTICE"?Y:Z).match(Th)?.[1]??0)>0){let V=uJ(W);HQ.add(V),UG[V]?.close?.(),delete UG[V]}}},$h=(W)=>{let X=uJ(W);if(UG[X])return UG[X];let G=Dh(X,(Y)=>Eh(X,Y));return UG[X]=G},Jz=async(W,X)=>{let G={kind:sT(W),content:X,pubkey:Mh,created_at:aT(),tags:[[nT,W]]},Y=J4(j7([0,G.pubkey,G.created_at,G.kind,G.tags,G.content])),J=new Uint8Array(await crypto.subtle.digest("SHA-256",Y)),Z=Mz.sign(J,rT);return j7([iT,{...G,id:zz(J),sig:zz(Z)}])},UT=(W,X)=>{return Pz[W]=X,j7(["REQ",W,{kinds:[sT(X)],since:aT(),["#"+nT]:[X]}])},QT=(W)=>{return delete Pz[W],j7(["CLOSE",W])},WM=jh({init:(W)=>{let X=W?.relayUrls?.length?W.relayUrls:null,G=X?Promise.resolve(X):Bh(),Y=X?.length??W.relayRedundancy??Ch;return BQ(Y,(J,Z)=>G.then((V)=>{let U=V[Z]&&$h(V[Z]);return U?U.ready.then(()=>U).catch(()=>null):null}))},subscribe:(W,X,G,Y)=>{let J=TQ(64),Z=TQ(64);vJ[J]=vJ[Z]=(U,Q)=>Y(U,Q,async(N,q)=>{if(HQ.has(uJ(W.url)))return;W.send(await Jz(N,q))});let V=()=>{W.send(UT(J,X)),W.send(UT(Z,G))};return V(),W.reopenHandlers.add(V),()=>{W.reopenHandlers.delete(V),W.send(QT(J)),W.send(QT(Z)),delete vJ[J],delete vJ[Z]}},announce:async(W,X)=>{if(HQ.has(uJ(W.url)))return;W.send(await Jz(X,j7({peerId:w8})))},bye:async(W,X)=>{if(HQ.has(uJ(W.url)))return;W.send(await Jz(X,j7({peerId:w8,bye:1})))}}),le=Oh(UG),Fh={cellSize:10},Sh=5000,xh=3000,kh=2000,_h=2000,yh=1e4,vh=30000,gh=5000,uh=30000,MQ=(W)=>{let X=String(W||"").match(/cell-(\d+)/);return X?Number(X[1]):null},Zz=(W,X)=>{let G=MQ(W);if(G==null)return[];let Y=[];for(let J=1;J<X;J*=2){if(G-J>=0)Y.push(`cell-${G-J}`);if(G+J<X)Y.push(`cell-${G+J}`)}return Y},UQ=(W)=>`c${(MQ(W)||0).toString(36)}`,hh=10,bh=(W,X)=>{let G=+X.cellSize>=2?X.cellSize|0:hh;return Math.max(1,Math.ceil(W/G))},XM=(W)=>{let X=0;for(let G=0;G<W.length;G++)X=Math.imul(X^W.charCodeAt(G),2654435761);return X>>>0},A6=(W,X)=>{let G=0,Y=-1;for(let J=0;J<X;J++){let Z=XM(`${W}:${J}`);if(Z>Y)Y=Z,G=J}return G};function mh(W,X={},G={}){let Y={...Fh,...X},J=1,Z={epoch:0,roster:[w8],set:new Set([w8]),key:w8,C:1,cellId:null,isBridge:!1,bridges:[],edgeBridges:[]},V={cellId:null},U=0,Q=0,N="",q=0,A=0,H=0,I=null,w=null,D=null,T=new Map,x=new Set,h=new Map,$=new Set,F=0,u=new Set,c=new Map,p=()=>Math.min(150,Math.ceil(Math.log2(Z.C+1))*2+3),s=(Q0)=>Zz(Q0,Z.C),y=W.on?.bind(W),t=W.off?.bind(W);if(y)W.on=(Q0,F0)=>String(Q0).startsWith("mesh:")?d(Q0,F0):y(Q0,F0);if(t)W.off=(Q0,F0)=>String(Q0).startsWith("mesh:")?h.get(Q0)?.delete(F0):t(Q0,F0);let H0=(Q0)=>(x.add(Q0),()=>x.delete(Q0)),g=(Q0,F0)=>{for(let m0 of x)try{m0(Q0,F0)}catch(Y0){JG.error("\uD83D\uDD78\uFE0F [Cells] Error in deliver handler:",Y0)}},d=(Q0,F0)=>{if(!h.has(Q0))h.set(Q0,new Set);return h.get(Q0).add(F0),()=>h.get(Q0)?.delete(F0)},P=(Q0,...F0)=>{let m0=h.get(Q0);if(m0)for(let Y0 of m0)try{Y0(...F0)}catch{}},E=(Q0)=>{try{return typeof Q0==="string"?JSON.parse(Q0):Q0}catch{return null}},f=()=>`${w8}:${Date.now().toString(36)}:${(F++&65535).toString(36)}`,r=()=>{if($.size>Sh)$.delete($.values().next().value)},o=()=>[...new Set([...W._census(),w8])].sort(),B=(Q0,F0,m0)=>F0.filter((Y0)=>A6(Y0,m0)===Q0),S=(Q0,F0,m0)=>{if(Q0==null)return null;let Y0=(k0)=>XM(`${k0}@${Q0}`),K0=null,M0=-1;for(let k0 of B(Q0,F0,m0)){let L1=Y0(k0);if(L1>M0)M0=L1,K0=k0}return K0},_=(Q0)=>{let F0=Z.audience?.get(Q0);if(!F0)return[];return Object.keys(W.getPeers?.()||{}).filter((m0)=>F0.has(m0))},v=(Q0,F0)=>{if(Q0!==w&&!(Z.isBridge&&Z.bridges.some((x0)=>UQ(x0)===Q0)))return;let m0=E(F0);if(!m0?.id||!m0?.t)return;if($.has(m0.id))return;$.add(m0.id),r();let{t:Y0,id:K0,ttl:M0,data:k0,origin:L1,originCell:Q1}=m0,X0=Z.cellId;if(Y0==="ping"&&k0?.pingId&&k0.target===w8&&L1!==w8){let x0={t:"pong",id:f(),ttl:p(),data:{pingId:k0.pingId,receivedAt:Date.now()},origin:w8,originCell:X0},_1=W.getPeers?.()?.[L1]?[L1]:_(X0);I?.send(JSON.stringify(x0),_1)}if(Y0==="pong"&&k0?.pingId){let x0=c.get(k0.pingId);if(x0)clearTimeout(x0.timeout),x0.resolve(Date.now()-x0.start),c.delete(k0.pingId)}if(Y0==="msg"&&L1!==w8)g(k0,L1);if(!Z.isBridge)return;if((M0??0)<=0)return;let C0=(x0,_1,W8=null)=>{if(!x0||!_1.length)return;let C1={t:Y0,id:K0,ttl:W8??(M0??p())-1,data:k0,origin:L1||w8,originCell:Q1||X0};x0.send(JSON.stringify(C1),_1)};if(Q0===w){for(let x0 of s(X0))C0(R(x0),_(x0));return}C0(I,_(X0));for(let x0 of s(X0))if(UQ(x0)!==Q0)C0(R(x0),_(x0))},R=(Q0)=>{let F0=UQ(Q0),m0=W.channel(F0);if(!u.has(F0))u.add(F0),m0.on("message",(Y0)=>v(F0,Y0));return m0},m=()=>{if(!Z.cellId)return;if(w=UQ(Z.cellId),I=W.channel(w),!u.has(w))u.add(w),I.on("message",(Q0)=>v(w,Q0));if(Z.isBridge)for(let Q0 of s(Z.cellId))R(Q0)},J0=(Q0,F0)=>{if(!Q0.cellId||!Q0.set.has(F0))return!1;let m0=`cell-${A6(F0,Q0.C)}`;return m0===Q0.cellId||Q0.bridges.includes(m0)||Zz(m0,Q0.C).includes(Q0.cellId)&&S(A6(F0,Q0.C),Q0.roster,Q0.C)===F0},U0=(Q0)=>Z.set.size<2&&(V.set?.size??0)<2||J0(Z,Q0)||Date.now()<U&&J0(V,Q0),N0=()=>{let Q0=W.getPeers?.()||{};for(let F0 of Object.keys(Q0))if(!U0(F0))Q0[F0].close?.()};G.admit=U0;let $0=()=>({epoch:Z.epoch,cellId:Z.cellId,isBridge:Z.isBridge,bridges:Z.bridges,roster:[...Z.roster],cellSize:J,dynamicTTL:p(),totalCells:Z.C}),u0=()=>{A=Date.now();for(let[Q0,F0]of T){if(Q0===w8)continue;P("mesh:peer-state",{id:Q0,cell:F0.cell,bridges:F0.bridges,timestamp:A})}},q1=(Q0)=>{let F0=bh(Q0.length,Y);J=Math.ceil(Q0.length/F0);let m0=`cell-${A6(w8,F0)}`,Y0=new Map,K0=new Set,M0=new Map,k0=(x0)=>M0.get(x0)??M0.set(x0,new Set).get(x0);for(let x0 of Q0)k0(`cell-${A6(x0,F0)}`).add(x0);let L1=new Map,Q1=(x0)=>L1.has(x0)?L1.get(x0):L1.set(x0,S(x0,Q0,F0)).get(x0);for(let x0 of new Set(Q0.map((_1)=>A6(_1,F0)))){let _1=`cell-${x0}`;for(let W8 of Zz(_1,F0)){if(MQ(W8)<x0)continue;for(let C1 of[Q1(x0),Q1(MQ(W8))]){if(!C1)continue;let H1=`cell-${A6(C1,F0)}`===_1?W8:_1,l=Y0.get(C1)??[];if(!l.includes(H1))l.push(H1);if(Y0.set(C1,l),k0(_1).add(C1),k0(W8).add(C1),_1===m0||W8===m0)K0.add(C1)}}}let X0=Y0.get(w8)??[],C0=Z.cellId!==m0||String(Z.bridges)!==String(X0);V=Z,Z={epoch:Z.epoch+1,roster:Q0,set:new Set(Q0),key:Q0.join("|"),C:F0,cellId:m0,isBridge:X0.length>0,bridges:X0,edgeBridges:[...K0],audience:M0},H=Date.now(),T.clear();for(let x0 of Q0){let _1=Y0.get(x0)??[];T.set(x0,{cell:`cell-${A6(x0,F0)}`,isBridge:_1.length>0,bridges:_1})}if(U=Date.now()+gh,C0)m();JG.info("\uD83D\uDD78\uFE0F [Cells] seal",{epoch:Z.epoch,myCell:m0,bridges:X0,C:F0,roster:Q0.length}),u0(),P("mesh:state",$0())},g1=()=>{let Q0=o(),F0=Q0.join("|");if(F0===Z.key)Q=0;else{let m0=Date.now();if(Q||=m0,F0!==N)N=F0,q=m0;if(Q0.some((Y0)=>!Z.set.has(Y0))||Z.edgeBridges.some((Y0)=>!Q0.includes(Y0))||(W._gone?.()??[]).some((Y0)=>Z.set.has(Y0))?m0-q>=_h||m0-Q>=yh:m0-Q>=vh)Q=0,q1(Q0)}if(U&&Date.now()>=U)U=0,N0()},h0=()=>{if(D)return;D=setInterval(()=>{if(g1(),Date.now()-A>=uh)u0()},kh)},S1=()=>{if(D)clearInterval(D),D=null},x1=(Q0)=>{return new Promise((F0,m0)=>{let Y0=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,K0=Date.now(),M0=setTimeout(()=>{c.delete(Y0),m0(Error("Ping timeout"))},xh);c.set(Y0,{start:K0,resolve:F0,reject:m0,timeout:M0,peerId:Q0});let k0={t:"ping",id:f(),ttl:p(),data:{pingId:Y0,target:Q0},origin:w8,originCell:Z.cellId};I?.send(JSON.stringify(k0),_(Z.cellId))})};return W.on?.("peer:join",()=>g1()),W.on?.("peer:leave",()=>g1()),q1(o()),h0(),{send:(Q0)=>{let F0={t:"msg",id:f(),ttl:p(),data:Q0,origin:w8,originCell:Z.cellId},m0=JSON.stringify(F0);return I.send(m0,_(Z.cellId)),v(w,m0),Promise.resolve()},on:(Q0,F0)=>Q0==="message"?H0(F0):void 0,ping:x1,getState:()=>({...$0(),knownCells:new Set([...T.values()].map((Q0)=>Q0.cell)).size}),getPeerInfo:()=>new Map(T),getStableRoster:()=>[...Z.roster],getKnownCells:()=>{let Q0=new Map;for(let[F0,{cell:m0}]of T)if(!Q0.has(m0))Q0.set(m0,{lastSeen:H,peerId:F0});return Q0},getCellSize:()=>J,destroy:()=>{S1(),c.forEach((Q0)=>clearTimeout(Q0.timeout)),c.clear()}}}function fh(W,X,G){let Y={},J=WM({...W,admit:(Q)=>Y.admit?.(Q)??!0},X,G),Z=W.overlay||{},V=mh(J,Z,Y),U=new Map;return{on:(Q,N)=>J.on(Q,N),off:(Q,N)=>J.off?.(Q,N),channel:(Q)=>{if(U.has(Q))return U.get(Q);let N=J.channel(Q),q={send:(A,H)=>{if(H){let I=[].concat(H),w=J.getPeers?.()||{};if(I.every((D)=>w[D]))return N.send(A,H)}return V.send({_ch:Q,_d:A,_t:H})},on:(A,H)=>{if(A==="message")V.on("message",(I,w)=>{if(I?._ch!==Q)return;if(I._t&&![].concat(I._t).includes(w8))return;H(I._d,w)}),N.on(A,H);else N.on(A,H)},off:(A,H)=>N.off?.(A,H),_original:N};return U.set(Q,q),q},get id(){return J.id},get peers(){return J.peers},getPeers:()=>J.getPeers?.()||{},mesh:V,_room:J,getState:()=>V.getState(),getPeerInfo:()=>V.getPeerInfo(),ping:(Q)=>V.ping(Q),leave:()=>{V.destroy(),U.clear(),J.leave()},destroy:()=>{V.destroy(),U.clear()}}}var Rz=(W,X,G)=>W?.cells||W?.overlay?fh(W,X,G):WM(W,X,G);import{randomBytes as C2}from"crypto";function ph(){var W,X=!1,G=this;G._DeArray=function(Y,J,Z){return[Y.slice(J,J+Z)]},G._EnArray=function(Y,J,Z,V){for(var U=0;U<Z;Y[J+U]=V[U]?V[U]:0,U++);},G._DeChar=function(Y,J){return String.fromCharCode(Y[J])},G._EnChar=function(Y,J,Z){Y[J]=Z.charCodeAt(0)},G._DeInt=function(Y,J){var Z=X?W.len-1:0,V=X?-1:1,U=Z+V*W.len,Q,N,q;for(Q=0,N=Z,q=1;N!=U;Q+=Y[J+N]*q,N+=V,q*=256);if(W.bSigned&&Q&Math.pow(2,W.len*8-1))Q-=Math.pow(2,W.len*8);return Q},G._EnInt=function(Y,J,Z){var V=X?W.len-1:0,U=X?-1:1,Q=V+U*W.len,N;Z=Z<W.min?W.min:Z>W.max?W.max:Z;for(N=V;N!=Q;Y[J+N]=Z&255,N+=U,Z>>=8);},G._DeString=function(Y,J,Z){for(var V=Array(Z),U=0;U<Z;V[U]=String.fromCharCode(Y[J+U]),U++);return V.join("")},G._EnString=function(Y,J,Z,V){for(var U,Q=0;Q<Z;Y[J+Q]=(U=V.charCodeAt(Q))?U:0,Q++);},G._De754=function(Y,J){var Z,V,U,Q,N,q,A,H,I,w;A=W.mLen,H=W.len*8-W.mLen-1,w=(1<<H)-1,I=w>>1,Q=X?0:W.len-1,N=X?1:-1,Z=Y[J+Q],Q+=N,q=-7;for(V=Z&(1<<-q)-1,Z>>=-q,q+=H;q>0;V=V*256+Y[J+Q],Q+=N,q-=8);for(U=V&(1<<-q)-1,V>>=-q,q+=A;q>0;U=U*256+Y[J+Q],Q+=N,q-=8);switch(V){case 0:V=1-I;break;case w:return U?NaN:(Z?-1:1)*(1/0);default:U=U+Math.pow(2,A),V=V-I;break}return(Z?-1:1)*U*Math.pow(2,V-A)},G._En754=function(Y,J,Z){var V,U,Q,N,q,A,H,I,w,D;if(H=W.mLen,I=W.len*8-W.mLen-1,D=(1<<I)-1,w=D>>1,V=Z<0?1:0,Z=Math.abs(Z),isNaN(Z)||Z==1/0)Q=isNaN(Z)?1:0,U=D;else{if(U=Math.floor(Math.log(Z)/Math.LN2),Z*(A=Math.pow(2,-U))<1)U--,A*=2;if(U+w>=1)Z+=W.rt/A;else Z+=W.rt*Math.pow(2,1-w);if(Z*A>=2)U++,A/=2;if(U+w>=D)Q=0,U=D;else if(U+w>=1)Q=(Z*A-1)*Math.pow(2,H),U=U+w;else Q=Z*Math.pow(2,w-1)*Math.pow(2,H),U=0}for(N=X?W.len-1:0,q=X?-1:1;H>=8;Y[J+N]=Q&255,N+=q,Q/=256,H-=8);for(U=U<<H|Q,I+=H;I>0;Y[J+N]=U&255,N+=q,U/=256,I-=8);Y[J+N-q]|=V*128},G._DeInt64=function(Y,J){var Z=X?0:7,V=X?1:-1,U=Z+V*8,Q=[0,0,!W.bSigned],N,q,A;for(N=Z,A=1,q=0;N!=U;Q[A]=(Q[A]<<8>>>0)+Y[J+N],N+=V,q++,A=q<4?1:0);return Q},G._EnInt64=function(Y,J,Z){var V=X?0:7,U=X?1:-1,Q=V+U*8,N,q,A,H;for(N=V,A=1,q=0,H=24;N!=Q;Y[J+N]=Z[A]>>H&255,N+=U,q++,A=q<4?1:0,H=24-8*(q%4));},G._sPattern="(\\d + )?([AxcbBhHsfdiIlLqQ])",G._lenLut={A:1,x:1,c:1,b:1,B:1,h:2,H:2,s:1,f:4,d:8,i:4,I:4,l:4,L:4,q:8,Q:8},G._elLut={A:{en:G._EnArray,de:G._DeArray},s:{en:G._EnString,de:G._DeString},c:{en:G._EnChar,de:G._DeChar},b:{en:G._EnInt,de:G._DeInt,len:1,bSigned:!0,min:-Math.pow(2,7),max:Math.pow(2,7)-1},B:{en:G._EnInt,de:G._DeInt,len:1,bSigned:!1,min:0,max:Math.pow(2,8)-1},h:{en:G._EnInt,de:G._DeInt,len:2,bSigned:!0,min:-Math.pow(2,15),max:Math.pow(2,15)-1},H:{en:G._EnInt,de:G._DeInt,len:2,bSigned:!1,min:0,max:Math.pow(2,16)-1},i:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},I:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},l:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},L:{en:G._EnInt,de:G._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},f:{en:G._En754,de:G._De754,len:4,mLen:23,rt:Math.pow(2,-24)-Math.pow(2,-77)},d:{en:G._En754,de:G._De754,len:8,mLen:52,rt:0},q:{en:G._EnInt64,de:G._DeInt64,bSigned:!0},Q:{en:G._EnInt64,de:G._DeInt64,bSigned:!1}},G._UnpackSeries=function(Y,J,Z,V){for(var U=W.de,Q=[],N=0;N<Y;Q.push(U(Z,V+N*J)),N++);return Q},G._PackSeries=function(Y,J,Z,V,U,Q){for(var N=W.en,q=0;q<Y;N(Z,V+q*J,U[Q+q]),q++);},G.Unpack=function(Y,J,Z){X=Y.charAt(0)!="<",Z=Z?Z:0;var V=new RegExp(this._sPattern,"g"),U,Q,N,q=[];while(U=V.exec(Y)){if(Q=U[1]==null||U[1]==""?1:parseInt(U[1]),N=this._lenLut[U[2]],Z+Q*N>J.length)return;switch(U[2]){case"A":case"s":q.push(this._elLut[U[2]].de(J,Z,Q));break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":W=this._elLut[U[2]],q.push(this._UnpackSeries(Q,N,J,Z));break}Z+=Q*N}return Array.prototype.concat.apply([],q)},G.PackTo=function(Y,J,Z,V){X=Y.charAt(0)!="<";var U=new RegExp(this._sPattern,"g"),Q,N,q,A,H=0;while(Q=U.exec(Y)){if(N=Q[1]==null||Q[1]==""?1:parseInt(Q[1]),q=this._lenLut[Q[2]],Z+N*q>J.length)return!1;switch(Q[2]){case"A":case"s":if(H+1>V.length)return!1;this._elLut[Q[2]].en(J,Z,N,V[H]),H+=1;break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":if(W=this._elLut[Q[2]],H+N>V.length)return!1;this._PackSeries(N,q,J,Z,V,H),H+=N;break;case"x":for(A=0;A<N;A++)J[Z+A]=0;break}Z+=N*q}return J},G.Pack=function(Y,J){return this.PackTo(Y,Array(this.CalcLength(Y)),0,J)},G.CalcLength=function(Y){var J=new RegExp(this._sPattern,"g"),Z=0,V;while(V=J.exec(Y))Z+=(V[1]==null||V[1]==""?1:parseInt(V[1]))*this._lenLut[V[2]];return Z}}var X8=new ph;var x2=m1(HM(),1),AH=m1(uz(),1);import{createSocket as pd}from"dgram";import{createSocket as dd}from"dgram";import*as k2 from"net";import{connect as od}from"net";import{createSign as id,randomBytes as rd,webcrypto as ad}from"crypto";var FN0=m1(bM(),1);var R7={};zA(R7,{verifySchema:()=>Wf,fromBER:()=>N4,compareSchema:()=>Z4,VisibleString:()=>FW,ViewWriter:()=>dJ,VideotexString:()=>RG,ValueBlock:()=>X9,Utf8String:()=>b5,UniversalString:()=>CG,UTCTime:()=>SW,TimeOfDay:()=>eQ,TeletexString:()=>PG,TIME:()=>GN,Set:()=>p9,Sequence:()=>y9,Repeated:()=>wG,RelativeObjectIdentifier:()=>sQ,RawData:()=>SP,PrintableString:()=>MG,Primitive:()=>D6,OctetString:()=>M7,ObjectIdentifier:()=>DG,NumericString:()=>TG,Null:()=>T7,Integer:()=>O6,IA5String:()=>LG,HexBlock:()=>C7,GraphicString:()=>BG,GeneralizedTime:()=>FG,GeneralString:()=>EG,Enumerated:()=>KG,EndOfContent:()=>rQ,Duration:()=>XN,DateTime:()=>WN,DEFAULT_MAX_NODES:()=>tM,DEFAULT_MAX_DEPTH:()=>sM,DEFAULT_MAX_CONTENT_LENGTH:()=>eM,DATE:()=>tQ,Constructed:()=>l8,Choice:()=>nJ,CharacterString:()=>$G,Boolean:()=>jG,BmpString:()=>OG,BitString:()=>P7,BaseStringBlock:()=>nQ,BaseBlock:()=>y8,Any:()=>U4});/*!
148
148
  * MIT License
149
149
  *
150
150
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC