From 867e00157531c7383d62405790092125de981415 Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Mon, 2 Oct 2023 23:05:37 +0000 Subject: [PATCH] Updates --- relay-direct-rtc/favicon.ico | Bin 0 -> 4286 bytes relay-direct-rtc/favicon.png | Bin 0 -> 14171 bytes relay-direct-rtc/index.html | 73 + relay-direct-rtc/index.js | 6499 ++++++++++++++++++++++++++++++++ relay-direct-rtc/manifest.json | 19 + relay-direct-rtc/style.css | 185 + 6 files changed, 6776 insertions(+) create mode 100644 relay-direct-rtc/favicon.ico create mode 100644 relay-direct-rtc/favicon.png create mode 100644 relay-direct-rtc/index.html create mode 100644 relay-direct-rtc/index.js create mode 100644 relay-direct-rtc/manifest.json create mode 100644 relay-direct-rtc/style.css diff --git a/relay-direct-rtc/favicon.ico b/relay-direct-rtc/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..74cf5df7f8b4404af213e373d45b126260fefdf9 GIT binary patch literal 4286 zcmc(j_fOPm5XSfZ0P*~V#MsbF;G*#~7K{}{!LG3-7VH6ItZ0mY3D#(gCH4|)tQZBm zqNrGiieN*c#)dsnvDet1+s~MHvwMe#HYinz73~OpH{D4z4YnRC#9yQDlRV0Y;g-deE6XI_wNUcxw+E*qJt0TCnhFp z(V|7Ztp^VtRL`D0_2tVK?cTjx-MV$t$B!R<^J~_u(TEWv^!f8=8~3-}x9BGi+qZAm z%$YN7758o4yt&SuJ7@3A_3z)`o==@RrM7L`>eZ`P_I~Bc6}4#5LPw4qvG;lN=4s=` zjrRO2UzaXjQes8Ke4{rYvaY}r!x?%mVdw{O+2Uq4Nm zGR5X@-@a{gIXOAMaRW^x^$@~O`2r)Bi9gOTC-+NHE!J4@*barhli_m>()NKU%!5}oWw5)2?^$x@#Dvv zZp>t5zA;a7SWHY{4Dz88T#uJ%iQ!{Cv%x zJzLePRkQofnKMUV)Sb&2tU*69M>cKRWNX3H)2B~uj4$R33k%I3VPRov-@d)-*RQY1 zlP8-#{4;CTEIohz+}1Q})=V8cc2vWL4b`Pf7atCtLSj09{(MD5L}7g%xIY*G7hSt{HSEA4_#VuT9Xr~ zy{Hw~#(Crz*uiJ;D!y`%*;&7Lwo?Pz#bepa^y%28Z^kx1QVRIZQC}(JvAPFgkQ>+FR$v=tE+bH z+UniAx8}~BYn)utnasgm(ROov~5v2Wi#tz5a%`d94o7q|d?a7VZaPU_I1gYPcnFnA0J2{An< zPMok>T&q?soj-rxRB;CJg1@*g_D+~EK^HGx4B!|4bI}XWa~Aq{?AT$vL@c?36JpF+ z=ghY#)EuJ^=N^w6(6{kE`#FX}wJjnL=eLok|`mlx0%u3o*` zuu0tk2hJ||hQ6mPLf&$BXFst4x8xoe!3VC_ByZ_m$bIq%Y$2B~U$%U9J^ZiOK}^98 z`2i2X3kMDyFcstp{wHq{c$@wVIez@O{ry4g5PatBv4K*4QJY*Z27mE!wUJm-FR&5e z8Gb>SgY)5eY{yq{TUiBt{C(?eaeC<0sVN9t<9x$AHJ!gloV|?w*K+jeQTrPlz0{II PFJ8(b?*9S)uiw7`Lr+Sc literal 0 HcmV?d00001 diff --git a/relay-direct-rtc/favicon.png b/relay-direct-rtc/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..f4cab92fbeb388f6a5a0bc99c9aca3851192ff76 GIT binary patch literal 14171 zcmV-hH>AjkP)PyA07*naRCr$P-3PQRMbQWFdFC8YF@Xui45%muK)@UU6M`TjikKA>Nd*;5C>T)? z5D-vFVio~WQNXN-2vzXp@etXXN?d{t=)06h@?%O)&p8Md=^z`&}byxlCU)8Ht zuU@^nSjb`o*3c1HwNQXH^vf?^do%(I1z1dkHF^XV3b00h{>95L6ky;v@UMUUtN6t) zeo@@)W;bj7q+k8&SH+dDeC6Ug*SSvXHWoL=M_{1<1I~;ijyR%t-t(SU{N*oyDQd>_xI=N_g%@T&@!8LQcJbD?zIDm0|ub$QB-S2+);!9up(voYp*=C#K)KgE* zx_@y|{Rk`+pni;6U9tP_yBF_#=R23&d&MhWvH0gd|C!z17F%pleEQR$UUK~d9`JzT z^wUqzZewxb!US58Ily^6@x&9CJbUf6*DfGBx$>}wJ*@cXM?bpc@_XO=-o@uW_qp6A z7T48`z+wj&Xo}qLe)lWRI_s<@twVyo{q1jOKQX368*H#a@%68NJ-dxI7ykLre=e?h z&1<%~b>{Awdj)vcyWUkCbkIS?-~RTuVyB&UDqiu5R}`1O{N)G#P!OPSqTchK_bkpm z_uTAf@3PA-#k=4A?j_f+x88cicfb4H>^7QQc;=aB7Q61cYw@EW{iwLjZEjN>bIdV? zKF_nvwE~=S$|=R8AN}Yh-|s~)dQtJZ*S&7=Z@TWf>lQ!#=}(tD=OGVy$TE|rsw2;O z*0YMYz3pvFF1gW-ZZrz4^({aA;SUSDi`BoBwbojz@c-v|H<)V$*lxS+iub?&{Y&PG z)&HDx&KZ1VgY?*S#%25Mw=a%A{`l;j^56$QxcI~;KC!G> zyTVpmZPoYVrl!5QR)D8I^{E9DD3m+i@s1;W{YqE5(jXt=kAM7Ql(t|+7azzKFe*4T zl*=x=tk=FXb#~r)=V-SszWCx|{q@(+?effBH`faAaIVFEFQ`jB7$`qzaB_3wW7yJgL7yY03G zGjg6~t`)$Cd*KUTSiIp4Z&>yXt^Rg_*hKC6!I=&BzyJN0HFM;VM;090Tmhp(fWCnhD`3>v^{5ai5nbfc zOD`?%eCInaL#nh%xz0ZO>=6UCiTvOPKNu+ukm1(1zIAcvp@$ZmZn|lcCMJIER4YKt zi9PA0la@i7Iiu#o9DexW%PzgjRjxAP+w^5pc);_Y|NP>RLk?N?tY7}}m&FZlc*C6T zj;{I1Pks{3BjDJ>>$`{@%1#xEyaS4Q``h2XQS(@@l$Ci_$~CTWjp94s`A%>CN}~>C zUOd$baDyA%p!n@?f4k&WIBXYOa6w~E{Ga~xr_m%2v3ZT(^{#g<&O7hC0#~OGiA8Xk zSL&wJi83N(fSVT%3#wtesWzNuCK zt5A$Oz-fy)hjoK<+G(dHO$QO;m%j9+bxmab{T}zYNAblkesRgQH@@+Wi=Y4e=UMlU zUv#yrU9I^0-~YbkK4u`(t&RNVH@_K~J~2)bUrE24E(HJm?|+Ls-RVxnMHgMPtVbAjw5z()vI2$al7RWs01AL zP?|=8%lkLmY_pM5IWC;kkS3ke;gp%;UO~6L_S!3_nI+c%7TEsZ_{KMu-8%%p(71y& zH%zqx==-Z*{px7&$e_dV+w1~RA-sB9cPM-8u}3s+kUQ`uLM-ps*riw=VfRhg!en8HZwb`s`;vTi6AgN{nx%4Z9#zh$B4BGW80;dA;Q=Z&^qs424bq z$VWc1)%d268VbcpY-_is{EW7^daR!&)i`ObZU87cg%9c3?&D)vNKm!gNGxkjJ6#?1 zHhpPx&(te`m)d{-{iC#njW^zSnX{QY2oM?fkHdE5y%JaW7;WeV;7^k_6j@v*VN*%P z6evLM>iWu8zOs1P%U%|J^qb!FrfBYRPCq~V;SU#&c*G-?U3$IiU2nu9&Fx>#vxd56 zCKQ0(ev4b&q7b|Zr3+gT{x8Ey?VeB`^q>b7BDYOVEQ#C#k=JMOq*#~pWE zb{ljoXVnJp@+1EJ?|(0AW6LeK9F<&YTV{nX!gLDdRj+zgl*HHc-6wJVOelbXNF|x0 z7MQ4QCB?YZ9u$gC&_pOsn6qnw!SvgpA)orxr=oP^99o4)x)_IGR49sUeeG*sD{g-C zn>TsA|6TiqFMMG{G>o-t^}qJDuidKMN#8Ux3IGYR3xt@s0c%Pz7$0Qzu}Nzs3Uf1KY};3OPqz zb}8l=Sa!U?mOkPdz2-HqNxm}XX^Jj^77|vhXfk%t9p+rvCp#S6AO1fpGE)k`j)v8T z@THX++p|mk&5wWlU?QWE(BT%l53eV zOqy{?)fi$9iulF^I%W0lBFJ+4?z``@Cgc@>MQ2TBP5}%sj(My&R3D*trj+;q=rt7C zQOq1H)tICl!>%cesYxeDI9{>g?Qeg3@yusFGuk)#1ERJ~Vcqe@K&gU~F-C1yC0{AU znMnmmh2J@5@bR{|cKH#QSa?RU1RB9C5M+$j?D=8l8MrYGQ?y!1Kz+rl8g z7fKUHzN%lT6is~yYnV29zm>dpCKUksV6s6YLXqaD{!Ukkl_V+K#KjNGm9V{;U!jBE zM=8S;<__ZAVTT?rT;NW!W#cgKP*$nP7>}&=nZlh>`F|KnDlj? zfCPCo^so=iL2(a?Hj6T|3c##jlZQ|r8M=cw{H!J7Qe)h9v-_{2gB;zlTl>IGk zA+@us-1Me5U6xP-3N-;!3I>r%ImAu-lZwHJ(4#)gs`RP=xb*1DRs{8<1}3XDiz0U(_Mm8DFsSZO<;>dD*9q0T47bEhzaFj zCdJ@W6NLHFCBdeAW{PAN>yr~`C|-<0(PlA9Fn8z$D0pF(ms(Ta?a3YQhbxced zeQojo$`F_vabU zct-85&?!K`10VRn+G}$!@E)q&g~B1Oii_m7AG?nEi3;w$$H(>QPk;Kz-0VwwQ-Ds|X^u4ziH?*t8;>^Yo=}j9Mg` z0~m`Gmtz0`fS&Y$!f3Oqgt?so8r3%%V^YTIgEBc&c?P+Y5wlk;hwqegaG(NVfB+S} z`z&iehys*@APEFUEK(Rt$qNUIBA^~y(VNzkOr_`X5n?rKaz9k+Iy)WmTT1S7m%A)G za_)0f{k{)|Bt zpnMRB)PxZ|4U;HRlY*^H5$p^(nD$y&>Kcj%Q^LMZAqd9NmvtP#E<1A$L?XSGP^uu$cbM*d!h9z^3Q%?$^ab{M^PAtCJy2G3 zW{p)scG!4SaMGAHzs5<5bw#S0!l9f(g}G8hyzrwdOe-6!FJUsqY8VNw#SYT*TqdCs zH733D3vzru_u(>G)Ih3zVf#(SVMP_7?5N}u14kKB+?Lo&fljR&uxf}8Q7b1_Hjwkh zG3`@QH0AIal-3Gu2dfhk34J6LK=YpAd0u=Zh*MwGkJ$Od`mIl4jUv8@IDsVlTr)>o zb{KIW->xsDtZr;$f1e5kC_85BPVupO)H@tF(xLB=f$$V`Z_jA{06KVX2gLZ@p4Kfv)iJZs0AS_QpLzu-J1q#LYO`G-mJpva z7@Rouf0|&}sdi0<7|*{vTQ^n8QG4jxaPcxtQIwZ|5Q{7`6YMgo*Od}04Fj36!*vn% zJmt!X%vL=|*%gSKgq*(ok}mI6b??k5!1zlrk2uXS3Ub{*nJ7LCM=z(iY^uG~xdr3Z zma91Y&<_z@4m*BJ%*J7Gj4juT z8GNwYGzc_ABo@LVXSJ!QW?=I95#ekipx9Ww{c#2=bHU^l_KyjF#j2ZHaiL-`Wmb0Q}?_k${<0*#}2tUR&})HaT80l7@Z^LELZiZDtITt3NsJO zx=Y%L)lLncLrG0~q`o!_hoF^3!=&fS^kGugeV?kopL_1PBR>PwJuag3-mj{El?qS= z$%)p1D-FU*55V|KgXDZ%J6EiPN6tV~26cfP{t)BC@FQZSS5isnR(N*1OsyP2vcrL? z5|r!^D!$$AZWk?yXeY8j@S%)NSi2~vPs}k~wAQK(da zoGdSlL0fgKC~VHa4tWieO?0x0fE*zselSk$fT{e0SfHqUHpLVJ2y1+Xeap>Z*n982 zN3i6$ScvREb|SkV)JwTSiWi=@oI56b3P_H+KkKf$ZtiV^UT5cnnz2GqMp6QHM(3z9 z%_TW? zL~KJrnksEGu*@P($h1@m(_b9&&{nr1uwj`4ZCA!{B7sCvBkDw-@NB|sOx4R{jfmTl5<4x43OZNBD>5UA2)aMm(Pg#0Xfev zuVLP8z4g|k)igZT$u%O+O%s!vJU{nZ0D@J&?)zBSdz3@8I6Nt$I7;gII6IOA(YvYIk=!krN5jz5t*k?Nk?=I_i*Oi`dil^8z&1fR9a1dX-PSOGL5Xk&%X zF^giVt2T0>W{O1U1AwPCMUd5Ro8yb-+Na84`n9s$T`VXI5h?#J5B|Hwn#|MOS%Sf z6|1A4bK-jLGiL3&6!$;ZH|p}f{6~&<9m0d82tys6c*&5Y6m}f5 z605UoozSWQ;ioWpLYbyuPahvNw+)LFs51<1f=SyDw@o<}XlW(%EDaRe*9bpeQ4M#SUC9ukkVD8}wO& zo^2b;W^)od^J`6!R6>s!LX0=nc3jx_h>>-95b_HkPi1YVw$E#G--;-Jj*6xVo>_gX z#I^~p>*5Ic5ZIS~@PEQMg=lbH{mnLmJFWMm5_*6U791qOt|lRqM>=Ti?Ba4!;yJ0px8u*U zD5%g~{)pS;VDL;HrY4F-mC2*%FA7c5T#h16r`VIYoz02_7B$@b=n(($@J_Q~*I~1L`uHJp_ zV9wHYcsMYB1T;ATD&6HAY}m&;qQD^GvHvkTDTE(8u>ZEh4{;n)tnb+hAVI$TVe1K@ z`)|&x6$PoxkI9Zo>nKbA_Wvd|u(20}9&Nnw#-r>flitrt7I5lg0u9jy&K4yQA*K+1 z`-Uqel!Ov6t^5X&`uF&6^@)66Kk@_o_;-_IsaE~>zyDp$*ifOi2TFXJ(QpzTbYT_&Zb5?U8v^7Hy*toNYh;Z7!G- z^4mG`s}4Nyz||nDSr-#uz-3KwWLN5Y$*~qINS#=@QvGWBT#zoZ=BjnpS!Z=sM7C+e zeO_-XQ@LRM_17O|JE>A2z>*Tz%HxeCzx3I!HMK1i7G$|pezaAVbIs3EkxhnRld~Nr zJ+7ScRco)k_Ue_i_1JWrP!5qv?nh3m-yEWGw16pwCO)!3JPi;1mT0>{OV zbT*#8No~TH|87IP!dGzwX{rb=JI_0%4xH%wUFW$yxW40zs!BQn7)<`A$c?rkfp&@# z6)cfL)jWVHK$IaA#k> z--L^a1&$33O_^nxX$3Iwv|3tYRhAJ#mz2n+Rl{ca!*=OAAOSZkRg_8`1#FHzI_om? z3Q&Fk3IL%<5#dCC(SWD*u(oNLNb(|7ib$b1%m;9D-N`G{@;-I_m>UJ~q9(Z05>wP_ zA$A|H?*p^z26L|_APC8c#;6w539Ym3;BrF<;t~*5D>#R)lu%C8K zfB{B8N>HdVIoqIi(>yM7rvL^U_Dl&nU!m9!vs~$Hm<2JVnaM48%NW0TT0G`L0l;_;nyX5vS6vw2X_`*A&zY2yzD9KnkY_5E zA_{CAH`{EpNq23K=gqtV_)v;x3E!v0DeVeymBhY5MskiC1rdXhF*0MKkbuM()%|8& zW?BL8%GJ29Iy6}g8jR3ssX{O-6UNxesqi}`pk(DMXL)Q#3UJ05XN(Gya&pQXN?Kl? z5ryhZ{FZkc{xB>2txRGDs|`ty)fb7|YD%V(d0^Nmulwz{->l5Jsp}_b)EHMCSmz+V z6HYi`P}5S5dRcVAt_0mfe-`Uu0gV6nf37cyeCW}oPgCZ%<1smb(k{2^sH2Wr&GG3w z@tv(Wt`N`z&ZmSJW%v9BL$*kAwE4gre~W7KFE)FOYYQ#nDcxuyAUjwAi6YE4w}}Cii$sWchDd zV5wY#yk2#`N-%WQT5GMfx~iOA_s6tvL5RLo3OU0jcGcl~uxh;jK90|9-|P9k(*)=E zrcxB8qHek6mLqdmQoKyEA<`N98ezxhuG(dnT~=2mJNNalq1#c7KwfH21>>RnGSBTh zEPTfucU*E<_$e5RuT`dd_+YJv)o3$5XMwQiz%jumMCjbB!2}wjjRNsp# zaP7aMMD?;LR{1+cGjIQte(wax@BvH6y99MS1$e{uXJ*SHWK}GILD|@)!@aU{AKNN0 zt`KU4&Rdd4&bS$KQC|=zNLj(LR1R=Xd%4$GnW05~?ARu{9~J$|(m5vgq-0P9$ax97 zL|HsZi4zrz{ZySUlGASPHDVU>U?f%CnM_KoF>pTnOU@c@qb)kO-!x@-MtE^F>;v!}z8} zra}Rf%ahDrbzn8q#Y(LXknP(&Y*s%UG{3u4E?yjwl%A5J>KsQW!T2%h{e%@ZEJ^^C zsuMRCM@ledtvW!t z3TA`MNY!)dU|#~(Wrv0<(+)fAP^*Z2^17ohuz(CWrz}%9RX}yy7ItLk~T4**NhX)-?VQ za@+p<@4sv;oYE;HtZz}U%uZXCyCFa+LJOf9;`_(mX>bJ)VYK3d-l|prFdCY(io`<+ zCps*rZkMV0C`0vSrQ3Dd&gPqMzN{O&?Y7&<92r8Go~lVRZL8?_zLQ;f5^0x%D!_#o zURdn1%PzG67eN^q@{napO!C;#NzjTadi4+!VH(LV=Vy zNpVO)k&%cMd;a)yEn0R1Q0x%Wy8>Kr!3CoXA{cy?U~7s2OzJ>8bm=qCJab8xtSpFo z^H}gHXR@fGAqEqQ9BL;)4lT?e=Fnby?N!M`!rEGP{9O>#Kxs0K{N2_a(h307jv+ zqHLX2VzsyGTm2^~f^CvGLQ(h?GL$3iRdfk43??2vi&IoqDtHFN7jcE#m&cRp6T7~N z_$DC;pgkr^Sqz~`du^`;i=$BBgVnK81=!Rp4O3>@JiC(u$j;w$&pk&UqROkEltYsm z00Rcz3&lz3sYGsw6`cI^(@!7$fbqh2B{usAM;viPvB@Tzbm?d7drf2zYsd*g>I%ts z7@>k?er(5OLQv}ALiv1%NttqGKM(;O9$qJSHWWdjU;!oy5{ma!H7}HvjE;lOok!ph zzA8SEK0D}yACWU2vGHoG049xK6>d$H*hZb%H8hM>Hwh%k$55Vq_St7Nz@S>!nDoqv zrsZMa>6>o4Xf9IQU>YBoQU|Xdin}`(?>SH%l@Tyc=<{bYhER2BsW^rp%wx&tH zs;*T*f@vLs7vVkns7#LU*)%IGTLGj)3TCmJQwPzN9g})^*kOkik|0)EAX0XqP!PW$ zRb4S}gHD;62)cpz2nf(bd2jb1~foc^1 zdQwMO)*-8jtyym8Gzi5t2vr9^~D zkgCN4Y#XDCP(%*Bz+S4TZSMP)*ZGzhyVJ0km3{Jl7FhhPD#0dZ*4CY6T&V!;{5tzq z#E=uxCpO#kLycd5$t9PJRtZ0F?lxjFdv9?9KP4+wblXlC3bcsXS0&OojZs~I5FQQ= zOu?)CFJ@>cD96k?a3Uo=?X=TIrEZKz7diFRQ%6qpG>KjCfCCN~am=dtWgBg@(XyR3 ze2+>603BM{W1llC zD7Udn`9t!@tN2FRt5g6JOD<^We4xu7eDJ|5N+D+7JFP@u%~sc@29Yh^gjWHX-B|Z= zMUvUfVM0EINqq#@nm{odyGl_xePP<-#TQ>3J)K3`;`!&FU#s^fj64gAg{o*xMIBdW znq8_b?AY{~IoGQQD1a84MRrTpNtM+40ANq7JRBdUfR%0~51Ce12&&_!P2nan0Vsh< z@8t8Q_ANX;T**2AV8pO33L^n0r5vhcizB2WpAZd!#!{q)#*QqNWTbFy6A^GKm7y+z zzszh{wQ59FmhHttXbR&t>1Xb>#t;<;kYL=IgLdXR>!elzayu~Ob?n-+&N^!Zt+Gi4 zO4^9Z60q&ML8)q+*>~W92QItBiaL%uaKgch%(9rsyQN65ZgGm(4#xZtWiQi0eN?7Q zD1uorZh!6=iG}c)&l2$XHx5iKZI;HKr#bNe^sbyKYXD#=OCu-f-glhW25iwQIt z;8a36$8|h^*@VEVjEP<7?6c4QU!24izTI})MHQQU&t$P1W@`4=MDeF^gx>9318MN-8N{hfBI z`P3+Yi4Lt`<}{_^a>%yde*2MwW`YTRg(ijn$4QFuVVZtyXBLEqib&+=C#CFk&w!jc zqc{aEQ~DGSpAy7^UpO-YM12WGj42xb52BJfd_4AiCa1PQ$J2T=?TRaa6&1&u{b>u% z6#*z_gOyj2rBbwG^$EpCkZj+FP_~ddVD}NkVrIom2!R=>RbABsNgwDHxdQg(%=aaH z0BBF>m{VS~5olJ^MT*bmTloglR(x#56abn7N@X^Ld8t(&lcR|srC?U9mM7L}EZBt3 ztejsT0-l77g~ASxnQV3)hzmPDM^eGA@LrSBirk0&Ki)PPbgY(-N^Xv%C8!)C?NFE8 zI<5QyCYG^ds!oGUTme)HgUwn+a``M^HgF>DHyb|XV8OX#xvZ3?4ep)#K+v1Im3;hO z?`u-$iWmoY5#m)PCQ(;=J=T7zei9Zb6K-74J5b{}{7s03=;#nN9H^Cam?x$HXcg>L z4qGnenB9me32)BH{*hY>3l61kJK2t9_o-vW>W3OP%$lZRRW-q@Dzy!jkYg9)Gl@}* z3p0-&6)T-sLe=$EfgUJGn-UnQ#FwUY<=nxoW63hvPCohM&L0!+ z2g(%-{xKb(HvFN!g&!5m;?ozA;~cZaVq`~P?&h99hj}Z_)H_XLN9bJvny&b8Vk;R^ z9cn;Z5lxNlG9^p0ZM&)aVw8yTT7)@Re;*}0IJrn}DU*VK#19yviW)X0@F0|?k!Q#f zgba89{K%1VM;O{P>P-QxP;mI;k3T-={YGhc%p5j;*XjdS8s<-Elbbjq$bEBF&>OsK zOgximgo)UPr1<~iZF{B_8&kAT;n<33hhlY3Q9P=i&m4jp;ppVjv;i105r=Y?dsBc^ z>5*_id?YZK07+km)1{95v8%8}`xLml!=O{_Qy(hE*J;~_+_(T#1<(K*?MwI|9NzF< zeK!kB+l9+wNfB_Wa*24%G1vE1QU@byhQX+Z^_F_Bt>Eu}TDOD^($V%L2Ua~+P z>Twk>sqY&5P4a)m8RT%}*yp)QB7h}^5sDZyn88fIQ^lZ8>raOmw+YN{dM(fz@ts*0(JdkN`*Pi7LXJpwk|oR z?s?(g`4=(zd#tQX)3(d&`8Q}VoZq^54F&*0U|$@g-W0&gcmX&(TaOcC#W(SX^yXzL zp%{cBIFqu|n|>%Ch%*)zqDr-6r|2U$+D;RLZ#lgF7M6O~AF!{<)K|e@tF#?9mR`!_ z8mFN&9oO)B&jOu757jqvebF`;v6X?t&n@eHsu(%Iae$; zsFYfeEmt5w{DiKOf_C{fl$*H~E8c~KCVjK76LxTuV!=Fdnq1JM$ynIkz`K%sLdB!} zxv8Z&&+J_Ravs{(HBh8j${QzJot-|!WM%@yqP`r&m_HzZ6wBOd+8+}jR(cTv1BpSE zke(WYNa6L&HOkOcBoTqAL+XmyjW|Ughw8=pD6>A)N6!dl{7Ban{lh&R*jT}f@y%z%lg2wcy#6d*tt0*e5qFyUiNxI9#FYld61xQ6lL9PNTO)EWw z1Ie)~dGF!hthS0yl~{X>JMV82O1e-XQbox)zYwlaWTQ!piB*_z?w7;Do1PsIKErdR zZH7X*>WU@zFzm9eK`eBrTudNiu}rom6Ds9&i$Y_+&YH}e z0;EFoeL$a5Em3!4qC89NG!pi84D**9uf4Wnl84z>+7kS-6QzU_Gf6_f#P$3E(eW;a zm59P}&O=Dl&cgg;hR%}Almeu<@jfgEunV2q>V?P_ld6D^KE)tcr{~17({d+A3;{wy zgE-ZhF<@Z3WQ>FFpgC2pyX=&yT?Vr^R=79!omb+znNomMmQu@wD!GZYwiPQql400Ck#~@2pMk2j zeayXYW)uK57n%_|rw|w0y~)u=Ok9O=V<-j`N0F|&Y7+VtvQa^Xb*0c#{RK6~vf`R5 z6_c$j))hW$yuw49aZ7QqW-Tx_GYXJGTiD8Vr;S&A;3~d-E~O!s9fquhwADu7>PUp4 z7y}b5S1cAxp%~}h4rAeH8!<-_iABM!{>;KY^Ad93x6O4kp#W@IHgU{EQK%_)%3;o6 zfbJBPjq!XO3Q<>!sZ5!QqUlxTpLy_{9ha( zl(tpiQiZ&<-=$;>o)Lf`6!ZvaRhK|u+X>zDzNuFL6BX7@?@m*(TSRvnqluf*y+ahJLmwS!m~!vm2wN^u_B= zpLzwbLX961QNA#zmkrw{{g2O}gm;WatTv4ur->lOiBE)rl-DLPC3XxFq{(8?=6&^x z@^I#33kg0Gq${@u)A)O)is>q|4w{~JlH61)0A7pLKNfnIONx!zRG>*#yO@K@Br*}2 zel&J;?0||k!LSspiu~tPmo9?ClsfQE-hoPUO~o#tZ!uF60;PEIG|N;gK+1N7L38fv z0z$EYPeqcum;zS1SOl~wYNNkwXThpax}sfWdnsN&XB`yGVQwlZ-jbb6)?QmDyJGRLpde?QUfe-6+2aupJ5khB2cZE{~^OHR;sW`+pdMA*#TpjY!()% zPSZL{GPf)MvC15F)GpMErtjDE`l(icSp7|>k6>&zUHzFpK5)#OQh!smvo0$Y1qc&k z+SCXVpo*0`?1I*WlfnTcawcLvP@7##`>AsoaHX15(r!9|yIw!l3J}A?L2ogKvu+?# zTfcyflQ7jS>LM}j4m79fX*VgSziZ?+e7D_q-+grcS}6PvlVDy@{_c+iar z#BXW3qvSlVuWP1S0XSF?8T4KgRpHziN4{<_uqsm&VyDxX3|%E=u5qekfugEsJ@0wX z8x@odMUmkq&}`lN*sY*K;i22^lUTzaXu8YtU-aKQdw1{AHquAB1$we_!NK(J#{&|1L{s-hY57n%udyScx=v6vT4T&mJ1(THD)*r4v!~(yxmExO z1P3>EXdVBeNwKTCj|HWPAwCe2CIKc8Xjt(Lr6BhluDX7Pe+Le*_rvptUDx*!tWEni ziRDVUHahBtn{tF!5JnMPK`_I30V})Bz)Xm3izszC+zV*9s7; zt!brhat?3qz(bRy1cuV&cvgWVj&mq|75l1s7X=0ItHvqkv&QYu{Z`}G&9wq}Q8j+> z(^XRw3qW>j3h(6%?6JolTSzqwr3r;uJOX?eO4pRnoc_B;_M5a*;D8-coFLYp-1cVS zy17??NqvMFKARUN}fP6bwu!M&<~H zs{^t_8R|UXoIcI_H46pk=?kYy88#vAsYw*8CDcd7yPjTi?wVOBKu@2PvkP7g1yy+0 zU3blTO6nkvHo3rA4_sVSEEJ%pNdQHO73Ok2Zmghe?6Ik2_$GctPp`AaG_z2E9zV5W zxZ{~o=oS}UbWt{)01Bh5;dta)5Dky1uj8J2eBHTdYM}rYRxjW16+FPrK2_$GVBN}6kyo#U9>*s lBd}0_DgQu=?hQKv{|5wP?Gj4H>ev7P002ovPDHLkV1l+8F+TtR literal 0 HcmV?d00001 diff --git a/relay-direct-rtc/index.html b/relay-direct-rtc/index.html new file mode 100644 index 0000000..15ef9b2 --- /dev/null +++ b/relay-direct-rtc/index.html @@ -0,0 +1,73 @@ + + + + + + Relay direct chat + + + + + + + +
+
+

Status:

+ +

+
+ + +
+ +

+
+ + +
+ +
+ + +
+ +
+ Peer's information + +

Content topic

+

+ +

Local Peer Id

+

+ +

Remote Peer Id

+

+ +

Relay mesh's protocols

+

+
+
+ +
+ + +
+ + + + + diff --git a/relay-direct-rtc/index.js b/relay-direct-rtc/index.js new file mode 100644 index 0000000..54198dc --- /dev/null +++ b/relay-direct-rtc/index.js @@ -0,0 +1,6499 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./index.js": +/*!******************!*\ + !*** ./index.js ***! + \******************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _waku_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/sdk */ \"./node_modules/@waku/sdk/dist/index.js\");\n/* harmony import */ var _libp2p_websockets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/websockets */ \"./node_modules/@libp2p/websockets/dist/src/index.js\");\n/* harmony import */ var _libp2p_websockets_filters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/websockets/filters */ \"./node_modules/@libp2p/websockets/dist/src/filters.js\");\n/* harmony import */ var _libp2p_webrtc__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/webrtc */ \"./node_modules/@libp2p/webrtc/dist/src/index.js\");\n/* harmony import */ var libp2p_circuit_relay__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libp2p/circuit-relay */ \"./node_modules/libp2p/dist/src/circuit-relay/index.js\");\n\n\n\n\n\n\n\n\nconst CONTENT_TOPIC = \"/toy-chat/2/huilong/proto\";\n\nconst ui = initUI();\nrunApp(ui).catch((err) => {\n console.error(err);\n ui.setStatus(`error: ${err.message}`, \"error\");\n});\n\nasync function runApp(ui) {\n const {\n info,\n sendMessage,\n unsubscribeFromMessages,\n dial,\n dialWebRTCpeer,\n dropNetworkConnections,\n ensureWebRTCconnectionInRelayMesh,\n } = await initWakuContext({\n ui,\n contentTopic: CONTENT_TOPIC,\n });\n\n ui.setLocalPeer(info.localPeerId);\n ui.setContentTopic(info.contentTopic);\n\n ui.onSendMessage(sendMessage);\n ui.onRemoteNodeConnect(dial);\n ui.onWebrtcConnect(dialWebRTCpeer);\n ui.onRelayWebRTC(ensureWebRTCconnectionInRelayMesh);\n ui.onDropNonWebRTC(dropNetworkConnections);\n\n ui.onExit(async () => {\n ui.setStatus(\"disconnecting...\", \"progress\");\n await unsubscribeFromMessages();\n ui.setStatus(\"disconnected\", \"terminated\");\n ui.resetMessages();\n });\n}\n\nasync function initWakuContext({ ui, contentTopic }) {\n const Decoder = (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.createDecoder)(contentTopic);\n const Encoder = (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.createEncoder)({ contentTopic });\n\n const ChatMessage = new protobuf.Type(\"ChatMessage\")\n .add(new protobuf.Field(\"timestamp\", 1, \"uint64\"))\n .add(new protobuf.Field(\"nick\", 2, \"string\"))\n .add(new protobuf.Field(\"text\", 3, \"bytes\"));\n\n ui.setStatus(\"starting...\", \"progress\");\n\n const node = await (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.createRelayNode)({\n libp2p: {\n addresses: {\n listen: [\"/webrtc\"],\n },\n connectionGater: {\n denyDialMultiaddr: () => {\n // refuse to deny localhost addresses\n return false;\n },\n },\n transports: [\n (0,_libp2p_webrtc__WEBPACK_IMPORTED_MODULE_3__.webRTC)({}),\n (0,libp2p_circuit_relay__WEBPACK_IMPORTED_MODULE_4__.circuitRelayTransport)({\n discoverRelays: 1,\n }),\n (0,_libp2p_websockets__WEBPACK_IMPORTED_MODULE_1__.webSockets)({ filter: _libp2p_websockets_filters__WEBPACK_IMPORTED_MODULE_2__.all }),\n ],\n },\n });\n\n await node.start();\n\n // Set a filter by using Decoder for a given ContentTopic\n const unsubscribeFromMessages = await node.relay.subscribe(\n [Decoder],\n (wakuMessage) => {\n const messageObj = ChatMessage.decode(wakuMessage.payload);\n ui.renderMessage({\n ...messageObj,\n text: (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.bytesToUtf8)(messageObj.text),\n });\n }\n );\n\n ui.setStatus(\"started\", \"success\");\n\n const localPeerId = node.libp2p.peerId.toString();\n\n const remotePeers = await node.libp2p.peerStore.all();\n const remotePeerIds = new Set(remotePeers.map((peer) => peer.id.toString()));\n\n ui.setRemotePeer(Array.from(remotePeerIds.keys()));\n\n node.libp2p.addEventListener(\"peer:connect\", async (event) => {\n remotePeerIds.add(event.detail.toString());\n ui.setRemotePeer(Array.from(remotePeerIds.keys()));\n ui.setRelayMeshInfo(node.relay.gossipSub);\n });\n\n node.libp2p.addEventListener(\"peer:disconnect\", (event) => {\n remotePeerIds.delete(event.detail.toString());\n ui.setRemotePeer(Array.from(remotePeerIds.keys()));\n ui.setRelayMeshInfo(node.relay.gossipSub);\n });\n\n node.libp2p.addEventListener(\"peer:identify\", (event) => {\n const peer = event.detail;\n\n if (!peer.protocols.includes(\"/webrtc-signaling/0.0.1\")) {\n return;\n }\n\n ui.setWebrtcPeer(peer.peerId.toString());\n ui.setRelayMeshInfo(node.relay.gossipSub);\n });\n\n window.node = node;\n\n return {\n unsubscribeFromMessages,\n info: {\n contentTopic,\n localPeerId,\n },\n sendMessage: async ({ text, nick }) => {\n if (!text || !nick) {\n return;\n }\n\n const protoMessage = ChatMessage.create({\n nick,\n timestamp: Date.now(),\n text: (0,_waku_sdk__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)(text),\n });\n\n await node.relay.send(Encoder, {\n payload: ChatMessage.encode(protoMessage).finish(),\n });\n },\n dial: async (multiaddr) => {\n ui.setStatus(\"connecting...\", \"progress\");\n await node.dial(multiaddr);\n ui.setStatus(\"connected\", \"success\");\n },\n dialWebRTCpeer: async (peerId) => {\n const peers = await node.libp2p.peerStore.all();\n const circuitPeer = peers.filter(\n (p) =>\n p.protocols.includes(\"/libp2p/circuit/relay/0.2.0/hop\") &&\n p.protocols.includes(\"/libp2p/circuit/relay/0.2.0/stop\")\n )[0];\n\n if (!circuitPeer) {\n throw Error(\"No Circuit peer is found\");\n }\n\n let multiaddr = circuitPeer.addresses.pop().multiaddr;\n multiaddr = `${multiaddr}/p2p/${circuitPeer.id.toString()}/p2p-circuit/webrtc/p2p/${peerId}`;\n\n await node.dial(multiaddr);\n ui.setRelayMeshInfo(node.relay.gossipSub);\n },\n ensureWebRTCconnectionInRelayMesh: async () => {\n const promises = node.libp2p\n .getConnections()\n .filter((c) => c.stat.multiplexer === \"/webrtc\")\n .map(async (c) => {\n const outboundStream = node.relay.gossipSub.streamsOutbound.get(\n c.remotePeer.toString()\n );\n const isWebRTCOutbound =\n outboundStream.rawStream.constructor.name === \"WebRTCStream\";\n\n if (isWebRTCOutbound) {\n return;\n }\n\n node.relay.gossipSub.streamsOutbound.delete(c.remotePeer.toString());\n await node.relay.gossipSub.createOutboundStream(\n c.remotePeer.toString(),\n c\n );\n });\n await Promise.all(promises);\n ui.setRelayMeshInfo(node.relay.gossipSub);\n },\n dropNetworkConnections: async () => {\n const promises = node.libp2p\n .getConnections()\n .filter((c) => c.stat.multiplexer !== \"/webrtc\")\n .map(async (c) => {\n const peerId = c.remotePeer.toString();\n\n node.relay.gossipSub.peers.delete(peerId);\n node.relay.gossipSub.streamsInbound.delete(peerId);\n node.relay.gossipSub.streamsOutbound.delete(peerId);\n\n await node.libp2p.peerStore.delete(c.remotePeer);\n await c.close();\n });\n await Promise.all(promises);\n ui.setRelayMeshInfo(node.relay.gossipSub);\n },\n };\n}\n\n// UI adapter\nfunction initUI() {\n const exitButton = document.getElementById(\"exit\");\n const sendButton = document.getElementById(\"send\");\n\n const statusBlock = document.getElementById(\"status\");\n const localPeerBlock = document.getElementById(\"localPeerId\");\n const remotePeerId = document.getElementById(\"remotePeerId\");\n const contentTopicBlock = document.getElementById(\"contentTopic\");\n\n const messagesBlock = document.getElementById(\"messages\");\n\n const nickText = document.getElementById(\"nickText\");\n const messageText = document.getElementById(\"messageText\");\n\n const remoteNode = document.getElementById(\"remoteNode\");\n const connectRemoteNode = document.getElementById(\"connectRemoteNode\");\n\n const webrtcPeer = document.getElementById(\"webrtcPeer\");\n const connectWebrtcPeer = document.getElementById(\"connectWebrtcPeer\");\n\n const relayWebRTCbutton = document.getElementById(\"relayWebRTC\");\n const dropNonWebRTCbutton = document.getElementById(\"dropNonWebRTC\");\n\n const relayMeshInfo = document.getElementById(\"relayMeshInfo\");\n\n return {\n // UI events\n onExit: (cb) => {\n exitButton.addEventListener(\"click\", cb);\n },\n onSendMessage: (cb) => {\n sendButton.addEventListener(\"click\", async () => {\n await cb({\n nick: nickText.value,\n text: messageText.value,\n });\n messageText.value = \"\";\n });\n },\n // UI renderers\n setStatus: (value, className) => {\n statusBlock.innerHTML = `${value}`;\n },\n setLocalPeer: (id) => {\n localPeerBlock.innerText = id.toString();\n },\n setRemotePeer: (ids) => {\n remotePeerId.innerText = ids.join(\"\\n\");\n },\n setContentTopic: (topic) => {\n contentTopicBlock.innerText = topic.toString();\n },\n renderMessage: (messageObj) => {\n const { nick, text, timestamp } = messageObj;\n const date = new Date(timestamp);\n\n // WARNING: XSS vulnerable\n messagesBlock.innerHTML += `\n
\n

${nick} (${date.toDateString()}):

\n

${text}

\n
\n `;\n },\n resetMessages: () => {\n messagesBlock.innerHTML = \"\";\n },\n setWebrtcPeer: (peerId) => {\n webrtcPeer.value = peerId;\n },\n onRemoteNodeConnect: (cb) => {\n connectRemoteNode.addEventListener(\"click\", () => {\n const multiaddr = remoteNode.value;\n\n if (!multiaddr) {\n throw Error(\"No multiaddr set to dial\");\n }\n\n cb(multiaddr);\n });\n },\n onWebrtcConnect: (cb) => {\n connectWebrtcPeer.addEventListener(\"click\", () => {\n const multiaddr = webrtcPeer.value;\n\n if (!multiaddr) {\n throw Error(\"No multiaddr to dial webrtc\");\n }\n\n cb(multiaddr);\n });\n },\n onRelayWebRTC: (cb) => {\n relayWebRTCbutton.addEventListener(\"click\", cb);\n },\n onDropNonWebRTC: (cb) => {\n dropNonWebRTCbutton.addEventListener(\"click\", cb);\n },\n setRelayMeshInfo: (gossipSub) => {\n relayMeshInfo.innerHTML = \"\";\n\n Array.from(gossipSub.peers)\n .map((peerId) => {\n let inbound = gossipSub.streamsInbound.get(peerId);\n inbound = inbound ? inbound.rawStream.constructor.name : \"none\";\n\n let outbound = gossipSub.streamsOutbound.get(peerId);\n outbound = outbound ? outbound.rawStream.constructor.name : \"none\";\n\n return [peerId, inbound, outbound];\n })\n .map(([peerId, inbound, outbound]) => {\n relayMeshInfo.innerHTML += `${peerId}
inbound: ${inbound}\\toutbound: ${outbound}`;\n relayMeshInfo.innerHTML += \"

\";\n });\n },\n };\n}\n\n\n//# sourceURL=webpack://light/./index.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/minimal.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/minimal.js ***! + \*************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("// minimal library entry point.\n\n\nmodule.exports = __webpack_require__(/*! ./src/index-minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/index-minimal.js\");\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/minimal.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/index-minimal.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/index-minimal.js ***! + \***********************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +eval("\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = __webpack_require__(/*! ./writer */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer.js\");\nprotobuf.BufferWriter = __webpack_require__(/*! ./writer_buffer */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer_buffer.js\");\nprotobuf.Reader = __webpack_require__(/*! ./reader */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader.js\");\nprotobuf.BufferReader = __webpack_require__(/*! ./reader_buffer */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader_buffer.js\");\n\n// Utility\nprotobuf.util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\nprotobuf.rpc = __webpack_require__(/*! ./rpc */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc.js\");\nprotobuf.roots = __webpack_require__(/*! ./roots */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/roots.js\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/index-minimal.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader.js ***! + \****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = Reader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader_buffer.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader_buffer.js ***! + \***********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = __webpack_require__(/*! ./reader */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader.js\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/reader_buffer.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/roots.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/roots.js ***! + \***************************************************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/roots.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +eval("\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = __webpack_require__(/*! ./rpc/service */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc/service.js\");\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc/service.js": +/*!*********************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc/service.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = Service;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/rpc/service.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/longbits.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/longbits.js ***! + \***********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = LongBits;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/longbits.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js": +/*!**********************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js ***! + \**********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +eval("\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = __webpack_require__(/*! @protobufjs/aspromise */ \"./node_modules/@protobufjs/aspromise/index.js\");\n\n// converts to / from base64 encoded strings\nutil.base64 = __webpack_require__(/*! @protobufjs/base64 */ \"./node_modules/@protobufjs/base64/index.js\");\n\n// base class of rpc.Service\nutil.EventEmitter = __webpack_require__(/*! @protobufjs/eventemitter */ \"./node_modules/@protobufjs/eventemitter/index.js\");\n\n// float handling accross browsers\nutil.float = __webpack_require__(/*! @protobufjs/float */ \"./node_modules/@protobufjs/float/index.js\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = __webpack_require__(/*! @protobufjs/inquire */ \"./node_modules/@protobufjs/inquire/index.js\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = __webpack_require__(/*! @protobufjs/utf8 */ \"./node_modules/@protobufjs/utf8/index.js\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = __webpack_require__(/*! @protobufjs/pool */ \"./node_modules/@protobufjs/pool/index.js\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = __webpack_require__(/*! ./longbits */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/longbits.js\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof __webpack_require__.g !== \"undefined\"\n && __webpack_require__.g\n && __webpack_require__.g.process\n && __webpack_require__.g.process.versions\n && __webpack_require__.g.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && __webpack_require__.g\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer.js ***! + \****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = Writer;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer_buffer.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer_buffer.js ***! + \***********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = __webpack_require__(/*! ./writer */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer.js\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/src/writer_buffer.js?"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/bytes/lib.esm/_version.js": +/*!***************************************************************!*\ + !*** ./node_modules/@ethersproject/bytes/lib.esm/_version.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"bytes/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://light/./node_modules/@ethersproject/bytes/lib.esm/_version.js?"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/bytes/lib.esm/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@ethersproject/bytes/lib.esm/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayify: () => (/* binding */ arrayify),\n/* harmony export */ concat: () => (/* binding */ concat),\n/* harmony export */ hexConcat: () => (/* binding */ hexConcat),\n/* harmony export */ hexDataLength: () => (/* binding */ hexDataLength),\n/* harmony export */ hexDataSlice: () => (/* binding */ hexDataSlice),\n/* harmony export */ hexStripZeros: () => (/* binding */ hexStripZeros),\n/* harmony export */ hexValue: () => (/* binding */ hexValue),\n/* harmony export */ hexZeroPad: () => (/* binding */ hexZeroPad),\n/* harmony export */ hexlify: () => (/* binding */ hexlify),\n/* harmony export */ isBytes: () => (/* binding */ isBytes),\n/* harmony export */ isBytesLike: () => (/* binding */ isBytesLike),\n/* harmony export */ isHexString: () => (/* binding */ isHexString),\n/* harmony export */ joinSignature: () => (/* binding */ joinSignature),\n/* harmony export */ splitSignature: () => (/* binding */ splitSignature),\n/* harmony export */ stripZeros: () => (/* binding */ stripZeros),\n/* harmony export */ zeroPad: () => (/* binding */ zeroPad)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0\" + hex;\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0,\n yParityAndS: \"0x\",\n compact: \"0x\"\n };\n if (isBytesLike(signature)) {\n let bytes = arrayify(signature);\n // Get the r, s and v\n if (bytes.length === 64) {\n // EIP-2098; pull the v from the top bit of s and clear it\n result.v = 27 + (bytes[32] >> 7);\n bytes[32] &= 0x7f;\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n }\n else if (bytes.length === 65) {\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n }\n else {\n logger.throwArgumentError(\"invalid signature string\", \"signature\", signature);\n }\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n result.yParityAndS = result._vs;\n result.compact = result.r + result.yParityAndS.substring(2);\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@ethersproject/bytes/lib.esm/index.js?"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/logger/lib.esm/_version.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/logger/lib.esm/_version.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"logger/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://light/./node_modules/@ethersproject/logger/lib.esm/_version.js?"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/logger/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/logger/lib.esm/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ErrorCode: () => (/* binding */ ErrorCode),\n/* harmony export */ LogLevel: () => (/* binding */ LogLevel),\n/* harmony export */ Logger: () => (/* binding */ Logger)\n/* harmony export */ });\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/logger/lib.esm/_version.js\");\n\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = { debug: 1, \"default\": 2, info: 2, warning: 3, error: 4, off: 5 };\nlet _logLevel = LogLevels[\"default\"];\n\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n ;\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nvar ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Ethereum Network, such as an invalid chain ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + gasLimit * gasPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The gas limit could not be estimated\n // - transaction: the transaction passed to estimateGas\n ErrorCode[\"UNPREDICTABLE_GAS_LIMIT\"] = \"UNPREDICTABLE_GAS_LIMIT\";\n // The transaction was replaced by one with a higher gas price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n ///////////////////\n // Interaction Errors\n // The user rejected the action, such as signing a message or sending\n // a transaction\n ErrorCode[\"ACTION_REJECTED\"] = \"ACTION_REJECTED\";\n})(ErrorCode || (ErrorCode = {}));\n;\nconst HEX = \"0123456789abcdef\";\nclass Logger {\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n let url = \"\";\n switch (code) {\n case ErrorCode.NUMERIC_FAULT: {\n url = \"NUMERIC_FAULT\";\n const fault = message;\n switch (fault) {\n case \"overflow\":\n case \"underflow\":\n case \"division-by-zero\":\n url += \"-\" + fault;\n break;\n case \"negative-power\":\n case \"negative-width\":\n url += \"-unsupported\";\n break;\n case \"unbound-bitwise-result\":\n url += \"-unbound-result\";\n break;\n }\n break;\n }\n case ErrorCode.CALL_EXCEPTION:\n case ErrorCode.INSUFFICIENT_FUNDS:\n case ErrorCode.MISSING_NEW:\n case ErrorCode.NONCE_EXPIRED:\n case ErrorCode.REPLACEMENT_UNDERPRICED:\n case ErrorCode.TRANSACTION_REPLACED:\n case ErrorCode.UNPREDICTABLE_GAS_LIMIT:\n url = code;\n break;\n }\n if (url) {\n message += \" [ See: https:/\\/links.ethers.org/v5-errors-\" + url + \" ]\";\n }\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\", form: _normalizeError\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof (value) !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" + JSON.stringify(kind.name) + \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__.version);\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\nLogger.errors = ErrorCode;\nLogger.levels = LogLevel;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@ethersproject/logger/lib.esm/index.js?"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/rlp/lib.esm/_version.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/rlp/lib.esm/_version.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"rlp/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://light/./node_modules/@ethersproject/rlp/lib.esm/_version.js?"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/rlp/lib.esm/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@ethersproject/rlp/lib.esm/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/rlp/lib.esm/_version.js\");\n\n//See: https://github.com/ethereum/wiki/wiki/RLP\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isBytesLike)(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n const data = Array.prototype.slice.call((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nfunction encode(object) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(_encode(object));\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data[offset]) };\n}\nfunction decode(data) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@ethersproject/rlp/lib.esm/index.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/base-x/src/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@multiformats/base-x/src/index.js ***! + \********************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n// base-x encoding / decoding\n// Copyright (c) 2018 base-x contributors\n// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)\n// Distributed under the MIT software license, see the accompanying\n// file LICENSE or http://www.opensource.org/licenses/mit-license.php.\nfunction base (ALPHABET) {\n if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }\n var BASE_MAP = new Uint8Array(256)\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i)\n var xc = x.charCodeAt(0)\n if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }\n BASE_MAP[xc] = i\n }\n var BASE = ALPHABET.length\n var LEADER = ALPHABET.charAt(0)\n var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up\n function encode (source) {\n if (source instanceof Uint8Array) {\n } else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength)\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source)\n }\n if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0\n var length = 0\n var pbegin = 0\n var pend = source.length\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++\n zeroes++\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0\n var b58 = new Uint8Array(size)\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin]\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0\n b58[it1] = (carry % BASE) >>> 0\n carry = (carry / BASE) >>> 0\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i\n pbegin++\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length\n while (it2 !== size && b58[it2] === 0) {\n it2++\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes)\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }\n return str\n }\n function decodeUnsafe (source) {\n if (typeof source !== 'string') { throw new TypeError('Expected String') }\n if (source.length === 0) { return new Uint8Array() }\n var psz = 0\n // Skip leading spaces.\n if (source[psz] === ' ') { return }\n // Skip and count leading '1's.\n var zeroes = 0\n var length = 0\n while (source[psz] === LEADER) {\n zeroes++\n psz++\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size)\n // Process the characters.\n while (source[psz]) {\n // Decode character\n var carry = BASE_MAP[source.charCodeAt(psz)]\n // Invalid character\n if (carry === 255) { return }\n var i = 0\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0\n b256[it3] = (carry % 256) >>> 0\n carry = (carry / 256) >>> 0\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i\n psz++\n }\n // Skip trailing spaces.\n if (source[psz] === ' ') { return }\n // Skip leading zeroes in b256.\n var it4 = size - length\n while (it4 !== size && b256[it4] === 0) {\n it4++\n }\n var vch = new Uint8Array(zeroes + (size - it4))\n var j = zeroes\n while (it4 !== size) {\n vch[j++] = b256[it4++]\n }\n return vch\n }\n function decode (string) {\n var buffer = decodeUnsafe(string)\n if (buffer) { return buffer }\n throw new Error('Non-base' + BASE + ' character')\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n}\nmodule.exports = base\n\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/base-x/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/aspromise/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/@protobufjs/aspromise/index.js ***! + \*****************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/aspromise/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/base64/index.js": +/*!**************************************************!*\ + !*** ./node_modules/@protobufjs/base64/index.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +eval("\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/base64/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/eventemitter/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@protobufjs/eventemitter/index.js ***! + \********************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/eventemitter/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/float/index.js": +/*!*************************************************!*\ + !*** ./node_modules/@protobufjs/float/index.js ***! + \*************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/float/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/inquire/index.js": +/*!***************************************************!*\ + !*** ./node_modules/@protobufjs/inquire/index.js ***! + \***************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/inquire/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/pool/index.js": +/*!************************************************!*\ + !*** ./node_modules/@protobufjs/pool/index.js ***! + \************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/pool/index.js?"); + +/***/ }), + +/***/ "./node_modules/@protobufjs/utf8/index.js": +/*!************************************************!*\ + !*** ./node_modules/@protobufjs/utf8/index.js ***! + \************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +eval("\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n\n\n//# sourceURL=webpack://light/./node_modules/@protobufjs/utf8/index.js?"); + +/***/ }), + +/***/ "./node_modules/debug/src/browser.js": +/*!*******************************************!*\ + !*** ./node_modules/debug/src/browser.js ***! + \*******************************************/ +/***/ ((module, exports, __webpack_require__) => { + +eval("/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = __webpack_require__(/*! ./common */ \"./node_modules/debug/src/common.js\")(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n\n\n//# sourceURL=webpack://light/./node_modules/debug/src/browser.js?"); + +/***/ }), + +/***/ "./node_modules/debug/src/common.js": +/*!******************************************!*\ + !*** ./node_modules/debug/src/common.js ***! + \******************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = __webpack_require__(/*! ms */ \"./node_modules/ms/index.js\");\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n\n\n//# sourceURL=webpack://light/./node_modules/debug/src/common.js?"); + +/***/ }), + +/***/ "./node_modules/denque/index.js": +/*!**************************************!*\ + !*** ./node_modules/denque/index.js ***! + \**************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\n/**\n * Custom implementation of a double ended queue.\n */\nfunction Denque(array, options) {\n var options = options || {};\n\n this._head = 0;\n this._tail = 0;\n this._capacity = options.capacity;\n this._capacityMask = 0x3;\n this._list = new Array(4);\n if (Array.isArray(array)) {\n this._fromArray(array);\n }\n}\n\n/**\n * -------------\n * PUBLIC API\n * -------------\n */\n\n/**\n * Returns the item at the specified index from the list.\n * 0 is the first element, 1 is the second, and so on...\n * Elements at negative values are that many from the end: -1 is one before the end\n * (the last element), -2 is two before the end (one before last), etc.\n * @param index\n * @returns {*}\n */\nDenque.prototype.peekAt = function peekAt(index) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n var len = this.size();\n if (i >= len || i < -len) return undefined;\n if (i < 0) i += len;\n i = (this._head + i) & this._capacityMask;\n return this._list[i];\n};\n\n/**\n * Alias for peekAt()\n * @param i\n * @returns {*}\n */\nDenque.prototype.get = function get(i) {\n return this.peekAt(i);\n};\n\n/**\n * Returns the first item in the list without removing it.\n * @returns {*}\n */\nDenque.prototype.peek = function peek() {\n if (this._head === this._tail) return undefined;\n return this._list[this._head];\n};\n\n/**\n * Alias for peek()\n * @returns {*}\n */\nDenque.prototype.peekFront = function peekFront() {\n return this.peek();\n};\n\n/**\n * Returns the item that is at the back of the queue without removing it.\n * Uses peekAt(-1)\n */\nDenque.prototype.peekBack = function peekBack() {\n return this.peekAt(-1);\n};\n\n/**\n * Returns the current length of the queue\n * @return {Number}\n */\nObject.defineProperty(Denque.prototype, 'length', {\n get: function length() {\n return this.size();\n }\n});\n\n/**\n * Return the number of items on the list, or 0 if empty.\n * @returns {number}\n */\nDenque.prototype.size = function size() {\n if (this._head === this._tail) return 0;\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Add an item at the beginning of the list.\n * @param item\n */\nDenque.prototype.unshift = function unshift(item) {\n if (item === undefined) return this.size();\n var len = this._list.length;\n this._head = (this._head - 1 + len) & this._capacityMask;\n this._list[this._head] = item;\n if (this._tail === this._head) this._growArray();\n if (this._capacity && this.size() > this._capacity) this.pop();\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Remove and return the first item on the list,\n * Returns undefined if the list is empty.\n * @returns {*}\n */\nDenque.prototype.shift = function shift() {\n var head = this._head;\n if (head === this._tail) return undefined;\n var item = this._list[head];\n this._list[head] = undefined;\n this._head = (head + 1) & this._capacityMask;\n if (head < 2 && this._tail > 10000 && this._tail <= this._list.length >>> 2) this._shrinkArray();\n return item;\n};\n\n/**\n * Add an item to the bottom of the list.\n * @param item\n */\nDenque.prototype.push = function push(item) {\n if (item === undefined) return this.size();\n var tail = this._tail;\n this._list[tail] = item;\n this._tail = (tail + 1) & this._capacityMask;\n if (this._tail === this._head) {\n this._growArray();\n }\n if (this._capacity && this.size() > this._capacity) {\n this.shift();\n }\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Remove and return the last item on the list.\n * Returns undefined if the list is empty.\n * @returns {*}\n */\nDenque.prototype.pop = function pop() {\n var tail = this._tail;\n if (tail === this._head) return undefined;\n var len = this._list.length;\n this._tail = (tail - 1 + len) & this._capacityMask;\n var item = this._list[this._tail];\n this._list[this._tail] = undefined;\n if (this._head < 2 && tail > 10000 && tail <= len >>> 2) this._shrinkArray();\n return item;\n};\n\n/**\n * Remove and return the item at the specified index from the list.\n * Returns undefined if the list is empty.\n * @param index\n * @returns {*}\n */\nDenque.prototype.removeOne = function removeOne(index) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n if (this._head === this._tail) return void 0;\n var size = this.size();\n var len = this._list.length;\n if (i >= size || i < -size) return void 0;\n if (i < 0) i += size;\n i = (this._head + i) & this._capacityMask;\n var item = this._list[i];\n var k;\n if (index < size / 2) {\n for (k = index; k > 0; k--) {\n this._list[i] = this._list[i = (i - 1 + len) & this._capacityMask];\n }\n this._list[i] = void 0;\n this._head = (this._head + 1 + len) & this._capacityMask;\n } else {\n for (k = size - 1 - index; k > 0; k--) {\n this._list[i] = this._list[i = ( i + 1 + len) & this._capacityMask];\n }\n this._list[i] = void 0;\n this._tail = (this._tail - 1 + len) & this._capacityMask;\n }\n return item;\n};\n\n/**\n * Remove number of items from the specified index from the list.\n * Returns array of removed items.\n * Returns undefined if the list is empty.\n * @param index\n * @param count\n * @returns {array}\n */\nDenque.prototype.remove = function remove(index, count) {\n var i = index;\n var removed;\n var del_count = count;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n if (this._head === this._tail) return void 0;\n var size = this.size();\n var len = this._list.length;\n if (i >= size || i < -size || count < 1) return void 0;\n if (i < 0) i += size;\n if (count === 1 || !count) {\n removed = new Array(1);\n removed[0] = this.removeOne(i);\n return removed;\n }\n if (i === 0 && i + count >= size) {\n removed = this.toArray();\n this.clear();\n return removed;\n }\n if (i + count > size) count = size - i;\n var k;\n removed = new Array(count);\n for (k = 0; k < count; k++) {\n removed[k] = this._list[(this._head + i + k) & this._capacityMask];\n }\n i = (this._head + i) & this._capacityMask;\n if (index + count === size) {\n this._tail = (this._tail - count + len) & this._capacityMask;\n for (k = count; k > 0; k--) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n }\n return removed;\n }\n if (index === 0) {\n this._head = (this._head + count + len) & this._capacityMask;\n for (k = count - 1; k > 0; k--) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n }\n return removed;\n }\n if (i < size / 2) {\n this._head = (this._head + index + count + len) & this._capacityMask;\n for (k = index; k > 0; k--) {\n this.unshift(this._list[i = (i - 1 + len) & this._capacityMask]);\n }\n i = (this._head - 1 + len) & this._capacityMask;\n while (del_count > 0) {\n this._list[i = (i - 1 + len) & this._capacityMask] = void 0;\n del_count--;\n }\n if (index < 0) this._tail = i;\n } else {\n this._tail = i;\n i = (i + count + len) & this._capacityMask;\n for (k = size - (count + index); k > 0; k--) {\n this.push(this._list[i++]);\n }\n i = this._tail;\n while (del_count > 0) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n del_count--;\n }\n }\n if (this._head < 2 && this._tail > 10000 && this._tail <= len >>> 2) this._shrinkArray();\n return removed;\n};\n\n/**\n * Native splice implementation.\n * Remove number of items from the specified index from the list and/or add new elements.\n * Returns array of removed items or empty array if count == 0.\n * Returns undefined if the list is empty.\n *\n * @param index\n * @param count\n * @param {...*} [elements]\n * @returns {array}\n */\nDenque.prototype.splice = function splice(index, count) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n var size = this.size();\n if (i < 0) i += size;\n if (i > size) return void 0;\n if (arguments.length > 2) {\n var k;\n var temp;\n var removed;\n var arg_len = arguments.length;\n var len = this._list.length;\n var arguments_index = 2;\n if (!size || i < size / 2) {\n temp = new Array(i);\n for (k = 0; k < i; k++) {\n temp[k] = this._list[(this._head + k) & this._capacityMask];\n }\n if (count === 0) {\n removed = [];\n if (i > 0) {\n this._head = (this._head + i + len) & this._capacityMask;\n }\n } else {\n removed = this.remove(i, count);\n this._head = (this._head + i + len) & this._capacityMask;\n }\n while (arg_len > arguments_index) {\n this.unshift(arguments[--arg_len]);\n }\n for (k = i; k > 0; k--) {\n this.unshift(temp[k - 1]);\n }\n } else {\n temp = new Array(size - (i + count));\n var leng = temp.length;\n for (k = 0; k < leng; k++) {\n temp[k] = this._list[(this._head + i + count + k) & this._capacityMask];\n }\n if (count === 0) {\n removed = [];\n if (i != size) {\n this._tail = (this._head + i + len) & this._capacityMask;\n }\n } else {\n removed = this.remove(i, count);\n this._tail = (this._tail - leng + len) & this._capacityMask;\n }\n while (arguments_index < arg_len) {\n this.push(arguments[arguments_index++]);\n }\n for (k = 0; k < leng; k++) {\n this.push(temp[k]);\n }\n }\n return removed;\n } else {\n return this.remove(i, count);\n }\n};\n\n/**\n * Soft clear - does not reset capacity.\n */\nDenque.prototype.clear = function clear() {\n this._head = 0;\n this._tail = 0;\n};\n\n/**\n * Returns true or false whether the list is empty.\n * @returns {boolean}\n */\nDenque.prototype.isEmpty = function isEmpty() {\n return this._head === this._tail;\n};\n\n/**\n * Returns an array of all queue items.\n * @returns {Array}\n */\nDenque.prototype.toArray = function toArray() {\n return this._copyArray(false);\n};\n\n/**\n * -------------\n * INTERNALS\n * -------------\n */\n\n/**\n * Fills the queue with items from an array\n * For use in the constructor\n * @param array\n * @private\n */\nDenque.prototype._fromArray = function _fromArray(array) {\n for (var i = 0; i < array.length; i++) this.push(array[i]);\n};\n\n/**\n *\n * @param fullCopy\n * @returns {Array}\n * @private\n */\nDenque.prototype._copyArray = function _copyArray(fullCopy) {\n var newArray = [];\n var list = this._list;\n var len = list.length;\n var i;\n if (fullCopy || this._head > this._tail) {\n for (i = this._head; i < len; i++) newArray.push(list[i]);\n for (i = 0; i < this._tail; i++) newArray.push(list[i]);\n } else {\n for (i = this._head; i < this._tail; i++) newArray.push(list[i]);\n }\n return newArray;\n};\n\n/**\n * Grows the internal list array.\n * @private\n */\nDenque.prototype._growArray = function _growArray() {\n if (this._head) {\n // copy existing data, head to end, then beginning to tail.\n this._list = this._copyArray(true);\n this._head = 0;\n }\n\n // head is at 0 and array is now full, safe to extend\n this._tail = this._list.length;\n\n this._list.length <<= 1;\n this._capacityMask = (this._capacityMask << 1) | 1;\n};\n\n/**\n * Shrinks the internal list array.\n * @private\n */\nDenque.prototype._shrinkArray = function _shrinkArray() {\n this._list.length >>>= 1;\n this._capacityMask >>>= 1;\n};\n\n\nmodule.exports = Denque;\n\n\n//# sourceURL=webpack://light/./node_modules/denque/index.js?"); + +/***/ }), + +/***/ "./node_modules/detect-browser/es/index.js": +/*!*************************************************!*\ + !*** ./node_modules/detect-browser/es/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BotInfo: () => (/* binding */ BotInfo),\n/* harmony export */ BrowserInfo: () => (/* binding */ BrowserInfo),\n/* harmony export */ NodeInfo: () => (/* binding */ NodeInfo),\n/* harmony export */ ReactNativeInfo: () => (/* binding */ ReactNativeInfo),\n/* harmony export */ SearchBotDeviceInfo: () => (/* binding */ SearchBotDeviceInfo),\n/* harmony export */ browserName: () => (/* binding */ browserName),\n/* harmony export */ detect: () => (/* binding */ detect),\n/* harmony export */ detectOS: () => (/* binding */ detectOS),\n/* harmony export */ getNodeVersion: () => (/* binding */ getNodeVersion),\n/* harmony export */ parseUserAgent: () => (/* binding */ parseUserAgent)\n/* harmony export */ });\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar BrowserInfo = /** @class */ (function () {\n function BrowserInfo(name, version, os) {\n this.name = name;\n this.version = version;\n this.os = os;\n this.type = 'browser';\n }\n return BrowserInfo;\n}());\n\nvar NodeInfo = /** @class */ (function () {\n function NodeInfo(version) {\n this.version = version;\n this.type = 'node';\n this.name = 'node';\n this.os = process.platform;\n }\n return NodeInfo;\n}());\n\nvar SearchBotDeviceInfo = /** @class */ (function () {\n function SearchBotDeviceInfo(name, version, os, bot) {\n this.name = name;\n this.version = version;\n this.os = os;\n this.bot = bot;\n this.type = 'bot-device';\n }\n return SearchBotDeviceInfo;\n}());\n\nvar BotInfo = /** @class */ (function () {\n function BotInfo() {\n this.type = 'bot';\n this.bot = true; // NOTE: deprecated test name instead\n this.name = 'bot';\n this.version = null;\n this.os = null;\n }\n return BotInfo;\n}());\n\nvar ReactNativeInfo = /** @class */ (function () {\n function ReactNativeInfo() {\n this.type = 'react-native';\n this.name = 'react-native';\n this.version = null;\n this.os = null;\n }\n return ReactNativeInfo;\n}());\n\n// tslint:disable-next-line:max-line-length\nvar SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;\nvar SEARCHBOT_OS_REGEX = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\\ Jeeves\\/Teoma|ia_archiver)/;\nvar REQUIRED_VERSION_PARTS = 3;\nvar userAgentRules = [\n ['aol', /AOLShield\\/([0-9\\._]+)/],\n ['edge', /Edge\\/([0-9\\._]+)/],\n ['edge-ios', /EdgiOS\\/([0-9\\._]+)/],\n ['yandexbrowser', /YaBrowser\\/([0-9\\._]+)/],\n ['kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/],\n ['samsung', /SamsungBrowser\\/([0-9\\.]+)/],\n ['silk', /\\bSilk\\/([0-9._-]+)\\b/],\n ['miui', /MiuiBrowser\\/([0-9\\.]+)$/],\n ['beaker', /BeakerBrowser\\/([0-9\\.]+)/],\n ['edge-chromium', /EdgA?\\/([0-9\\.]+)/],\n [\n 'chromium-webview',\n /(?!Chrom.*OPR)wv\\).*Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/,\n ],\n ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/],\n ['phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/],\n ['crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/],\n ['firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/],\n ['fxios', /FxiOS\\/([0-9\\.]+)/],\n ['opera-mini', /Opera Mini.*Version\\/([0-9\\.]+)/],\n ['opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/],\n ['opera', /OPR\\/([0-9\\.]+)(:?\\s|$)/],\n ['pie', /^Microsoft Pocket Internet Explorer\\/(\\d+\\.\\d+)$/],\n ['pie', /^Mozilla\\/\\d\\.\\d+\\s\\(compatible;\\s(?:MSP?IE|MSInternet Explorer) (\\d+\\.\\d+);.*Windows CE.*\\)$/],\n ['netfront', /^Mozilla\\/\\d\\.\\d+.*NetFront\\/(\\d.\\d)/],\n ['ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/],\n ['ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/],\n ['ie', /MSIE\\s(7\\.0)/],\n ['bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/],\n ['android', /Android\\s([0-9\\.]+)/],\n ['ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/],\n ['safari', /Version\\/([0-9\\._]+).*Safari/],\n ['facebook', /FB[AS]V\\/([0-9\\.]+)/],\n ['instagram', /Instagram\\s([0-9\\.]+)/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Mobile/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Gecko\\)$/],\n ['curl', /^curl\\/([0-9\\.]+)$/],\n ['searchbot', SEARCHBOX_UA_REGEX],\n];\nvar operatingSystemRules = [\n ['iOS', /iP(hone|od|ad)/],\n ['Android OS', /Android/],\n ['BlackBerry OS', /BlackBerry|BB10/],\n ['Windows Mobile', /IEMobile/],\n ['Amazon OS', /Kindle/],\n ['Windows 3.11', /Win16/],\n ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],\n ['Windows 98', /(Windows 98)|(Win98)/],\n ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],\n ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],\n ['Windows Server 2003', /(Windows NT 5.2)/],\n ['Windows Vista', /(Windows NT 6.0)/],\n ['Windows 7', /(Windows NT 6.1)/],\n ['Windows 8', /(Windows NT 6.2)/],\n ['Windows 8.1', /(Windows NT 6.3)/],\n ['Windows 10', /(Windows NT 10.0)/],\n ['Windows ME', /Windows ME/],\n ['Windows CE', /Windows CE|WinCE|Microsoft Pocket Internet Explorer/],\n ['Open BSD', /OpenBSD/],\n ['Sun OS', /SunOS/],\n ['Chrome OS', /CrOS/],\n ['Linux', /(Linux)|(X11)/],\n ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],\n ['QNX', /QNX/],\n ['BeOS', /BeOS/],\n ['OS/2', /OS\\/2/],\n];\nfunction detect(userAgent) {\n if (!!userAgent) {\n return parseUserAgent(userAgent);\n }\n if (typeof document === 'undefined' &&\n typeof navigator !== 'undefined' &&\n navigator.product === 'ReactNative') {\n return new ReactNativeInfo();\n }\n if (typeof navigator !== 'undefined') {\n return parseUserAgent(navigator.userAgent);\n }\n return getNodeVersion();\n}\nfunction matchUserAgent(ua) {\n // opted for using reduce here rather than Array#first with a regex.test call\n // this is primarily because using the reduce we only perform the regex\n // execution once rather than once for the test and for the exec again below\n // probably something that needs to be benchmarked though\n return (ua !== '' &&\n userAgentRules.reduce(function (matched, _a) {\n var browser = _a[0], regex = _a[1];\n if (matched) {\n return matched;\n }\n var uaMatch = regex.exec(ua);\n return !!uaMatch && [browser, uaMatch];\n }, false));\n}\nfunction browserName(ua) {\n var data = matchUserAgent(ua);\n return data ? data[0] : null;\n}\nfunction parseUserAgent(ua) {\n var matchedRule = matchUserAgent(ua);\n if (!matchedRule) {\n return null;\n }\n var name = matchedRule[0], match = matchedRule[1];\n if (name === 'searchbot') {\n return new BotInfo();\n }\n // Do not use RegExp for split operation as some browser do not support it (See: http://blog.stevenlevithan.com/archives/cross-browser-split)\n var versionParts = match[1] && match[1].split('.').join('_').split('_').slice(0, 3);\n if (versionParts) {\n if (versionParts.length < REQUIRED_VERSION_PARTS) {\n versionParts = __spreadArray(__spreadArray([], versionParts, true), createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length), true);\n }\n }\n else {\n versionParts = [];\n }\n var version = versionParts.join('.');\n var os = detectOS(ua);\n var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);\n if (searchBotMatch && searchBotMatch[1]) {\n return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]);\n }\n return new BrowserInfo(name, version, os);\n}\nfunction detectOS(ua) {\n for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {\n var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];\n var match = regex.exec(ua);\n if (match) {\n return os;\n }\n }\n return null;\n}\nfunction getNodeVersion() {\n var isNode = typeof process !== 'undefined' && process.version;\n return isNode ? new NodeInfo(process.version.slice(1)) : null;\n}\nfunction createVersionParts(count) {\n var output = [];\n for (var ii = 0; ii < count; ii++) {\n output.push('0');\n }\n return output;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/detect-browser/es/index.js?"); + +/***/ }), + +/***/ "./node_modules/err-code/index.js": +/*!****************************************!*\ + !*** ./node_modules/err-code/index.js ***! + \****************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\n/**\n * @typedef {{ [key: string]: any }} Extensions\n * @typedef {Error} Err\n * @property {string} message\n */\n\n/**\n *\n * @param {Error} obj\n * @param {Extensions} props\n * @returns {Error & Extensions}\n */\nfunction assign(obj, props) {\n for (const key in props) {\n Object.defineProperty(obj, key, {\n value: props[key],\n enumerable: true,\n configurable: true,\n });\n }\n\n return obj;\n}\n\n/**\n *\n * @param {any} err - An Error\n * @param {string|Extensions} code - A string code or props to set on the error\n * @param {Extensions} [props] - Props to set on the error\n * @returns {Error & Extensions}\n */\nfunction createError(err, code, props) {\n if (!err || typeof err === 'string') {\n throw new TypeError('Please pass an Error to err-code');\n }\n\n if (!props) {\n props = {};\n }\n\n if (typeof code === 'object') {\n props = code;\n code = '';\n }\n\n if (code) {\n props.code = code;\n }\n\n try {\n return assign(err, props);\n } catch (_) {\n props.message = err.message;\n props.stack = err.stack;\n\n const ErrClass = function () {};\n\n ErrClass.prototype = Object.create(Object.getPrototypeOf(err));\n\n // @ts-ignore\n const output = assign(new ErrClass(), props);\n\n return output;\n }\n}\n\nmodule.exports = createError;\n\n\n//# sourceURL=webpack://light/./node_modules/err-code/index.js?"); + +/***/ }), + +/***/ "./node_modules/event-iterator/lib/dom.js": +/*!************************************************!*\ + !*** ./node_modules/event-iterator/lib/dom.js ***! + \************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst event_iterator_1 = __webpack_require__(/*! ./event-iterator */ \"./node_modules/event-iterator/lib/event-iterator.js\");\nexports.EventIterator = event_iterator_1.EventIterator;\nfunction subscribe(event, options, evOptions) {\n return new event_iterator_1.EventIterator(({ push }) => {\n this.addEventListener(event, push, options);\n return () => this.removeEventListener(event, push, options);\n }, evOptions);\n}\nexports.subscribe = subscribe;\nexports[\"default\"] = event_iterator_1.EventIterator;\n\n\n//# sourceURL=webpack://light/./node_modules/event-iterator/lib/dom.js?"); + +/***/ }), + +/***/ "./node_modules/event-iterator/lib/event-iterator.js": +/*!***********************************************************!*\ + !*** ./node_modules/event-iterator/lib/event-iterator.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nclass EventQueue {\n constructor() {\n this.pullQueue = [];\n this.pushQueue = [];\n this.eventHandlers = {};\n this.isPaused = false;\n this.isStopped = false;\n }\n push(value) {\n if (this.isStopped)\n return;\n const resolution = { value, done: false };\n if (this.pullQueue.length) {\n const placeholder = this.pullQueue.shift();\n if (placeholder)\n placeholder.resolve(resolution);\n }\n else {\n this.pushQueue.push(Promise.resolve(resolution));\n if (this.highWaterMark !== undefined &&\n this.pushQueue.length >= this.highWaterMark &&\n !this.isPaused) {\n this.isPaused = true;\n if (this.eventHandlers.highWater) {\n this.eventHandlers.highWater();\n }\n else if (console) {\n console.warn(`EventIterator queue reached ${this.pushQueue.length} items`);\n }\n }\n }\n }\n stop() {\n if (this.isStopped)\n return;\n this.isStopped = true;\n this.remove();\n for (const placeholder of this.pullQueue) {\n placeholder.resolve({ value: undefined, done: true });\n }\n this.pullQueue.length = 0;\n }\n fail(error) {\n if (this.isStopped)\n return;\n this.isStopped = true;\n this.remove();\n if (this.pullQueue.length) {\n for (const placeholder of this.pullQueue) {\n placeholder.reject(error);\n }\n this.pullQueue.length = 0;\n }\n else {\n const rejection = Promise.reject(error);\n /* Attach error handler to avoid leaking an unhandled promise rejection. */\n rejection.catch(() => { });\n this.pushQueue.push(rejection);\n }\n }\n remove() {\n Promise.resolve().then(() => {\n if (this.removeCallback)\n this.removeCallback();\n });\n }\n [Symbol.asyncIterator]() {\n return {\n next: (value) => {\n const result = this.pushQueue.shift();\n if (result) {\n if (this.lowWaterMark !== undefined &&\n this.pushQueue.length <= this.lowWaterMark &&\n this.isPaused) {\n this.isPaused = false;\n if (this.eventHandlers.lowWater) {\n this.eventHandlers.lowWater();\n }\n }\n return result;\n }\n else if (this.isStopped) {\n return Promise.resolve({ value: undefined, done: true });\n }\n else {\n return new Promise((resolve, reject) => {\n this.pullQueue.push({ resolve, reject });\n });\n }\n },\n return: () => {\n this.isStopped = true;\n this.pushQueue.length = 0;\n this.remove();\n return Promise.resolve({ value: undefined, done: true });\n },\n };\n }\n}\nclass EventIterator {\n constructor(listen, { highWaterMark = 100, lowWaterMark = 1 } = {}) {\n const queue = new EventQueue();\n queue.highWaterMark = highWaterMark;\n queue.lowWaterMark = lowWaterMark;\n queue.removeCallback =\n listen({\n push: value => queue.push(value),\n stop: () => queue.stop(),\n fail: error => queue.fail(error),\n on: (event, fn) => {\n queue.eventHandlers[event] = fn;\n },\n }) || (() => { });\n this[Symbol.asyncIterator] = () => queue[Symbol.asyncIterator]();\n Object.freeze(this);\n }\n}\nexports.EventIterator = EventIterator;\nexports[\"default\"] = EventIterator;\n\n\n//# sourceURL=webpack://light/./node_modules/event-iterator/lib/event-iterator.js?"); + +/***/ }), + +/***/ "./node_modules/eventemitter3/index.js": +/*!*********************************************!*\ + !*** ./node_modules/eventemitter3/index.js ***! + \*********************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/eventemitter3/index.js?"); + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/***/ ((module) => { + +"use strict"; +eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/events/events.js?"); + +/***/ }), + +/***/ "./node_modules/hi-base32/src/base32.js": +/*!**********************************************!*\ + !*** ./node_modules/hi-base32/src/base32.js ***! + \**********************************************/ +/***/ ((module, exports, __webpack_require__) => { + +eval("var __WEBPACK_AMD_DEFINE_RESULT__;/*\n * [hi-base32]{@link https://github.com/emn178/hi-base32}\n *\n * @version 0.5.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var root = typeof window === 'object' ? window : {};\n var NODE_JS = !root.HI_BASE32_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = __webpack_require__.g;\n }\n var COMMON_JS = !root.HI_BASE32_NO_COMMON_JS && \"object\" === 'object' && module.exports;\n var AMD = true && __webpack_require__.amdO;\n var BASE32_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.split('');\n var BASE32_DECODE_CHAR = {\n 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8,\n 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16,\n 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24,\n 'Z': 25, '2': 26, '3': 27, '4': 28, '5': 29, '6': 30, '7': 31\n };\n\n var blocks = [0, 0, 0, 0, 0, 0, 0, 0];\n\n var throwInvalidUtf8 = function (position, partial) {\n if (partial.length > 10) {\n partial = '...' + partial.substr(-10);\n }\n var err = new Error('Decoded data is not valid UTF-8.'\n + ' Maybe try base32.decode.asBytes()?'\n + ' Partial data after reading ' + position + ' bytes: ' + partial + ' <-');\n err.position = position;\n throw err;\n };\n\n var toUtf8String = function (bytes) {\n var str = '', length = bytes.length, i = 0, followingChars = 0, b, c;\n while (i < length) {\n b = bytes[i++];\n if (b <= 0x7F) {\n str += String.fromCharCode(b);\n continue;\n } else if (b > 0xBF && b <= 0xDF) {\n c = b & 0x1F;\n followingChars = 1;\n } else if (b <= 0xEF) {\n c = b & 0x0F;\n followingChars = 2;\n } else if (b <= 0xF7) {\n c = b & 0x07;\n followingChars = 3;\n } else {\n throwInvalidUtf8(i, str);\n }\n\n for (var j = 0; j < followingChars; ++j) {\n b = bytes[i++];\n if (b < 0x80 || b > 0xBF) {\n throwInvalidUtf8(i, str);\n }\n c <<= 6;\n c += b & 0x3F;\n }\n if (c >= 0xD800 && c <= 0xDFFF) {\n throwInvalidUtf8(i, str);\n }\n if (c > 0x10FFFF) {\n throwInvalidUtf8(i, str);\n }\n\n if (c <= 0xFFFF) {\n str += String.fromCharCode(c);\n } else {\n c -= 0x10000;\n str += String.fromCharCode((c >> 10) + 0xD800);\n str += String.fromCharCode((c & 0x3FF) + 0xDC00);\n }\n }\n return str;\n };\n\n var decodeAsBytes = function (base32Str) {\n if (base32Str === '') {\n return [];\n } else if (!/^[A-Z2-7=]+$/.test(base32Str)) {\n throw new Error('Invalid base32 characters');\n }\n base32Str = base32Str.replace(/=/g, '');\n var v1, v2, v3, v4, v5, v6, v7, v8, bytes = [], index = 0, length = base32Str.length;\n\n // 4 char to 3 bytes\n for (var i = 0, count = length >> 3 << 3; i < count;) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v8 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n bytes[index++] = (v4 << 4 | v5 >>> 1) & 255;\n bytes[index++] = (v5 << 7 | v6 << 2 | v7 >>> 3) & 255;\n bytes[index++] = (v7 << 5 | v8) & 255;\n }\n\n // remain bytes\n var remain = length - count;\n if (remain === 2) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n } else if (remain === 4) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n } else if (remain === 5) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n bytes[index++] = (v4 << 4 | v5 >>> 1) & 255;\n } else if (remain === 7) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n bytes[index++] = (v1 << 3 | v2 >>> 2) & 255;\n bytes[index++] = (v2 << 6 | v3 << 1 | v4 >>> 4) & 255;\n bytes[index++] = (v4 << 4 | v5 >>> 1) & 255;\n bytes[index++] = (v5 << 7 | v6 << 2 | v7 >>> 3) & 255;\n }\n return bytes;\n };\n\n var encodeAscii = function (str) {\n var v1, v2, v3, v4, v5, base32Str = '', length = str.length;\n for (var i = 0, count = parseInt(length / 5) * 5; i < count;) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i++);\n v3 = str.charCodeAt(i++);\n v4 = str.charCodeAt(i++);\n v5 = str.charCodeAt(i++);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] +\n BASE32_ENCODE_CHAR[v5 & 31];\n }\n\n // remain char\n var remain = length - count;\n if (remain === 1) {\n v1 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2) & 31] +\n '======';\n } else if (remain === 2) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4) & 31] +\n '====';\n } else if (remain === 3) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i++);\n v3 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1) & 31] +\n '===';\n } else if (remain === 4) {\n v1 = str.charCodeAt(i++);\n v2 = str.charCodeAt(i++);\n v3 = str.charCodeAt(i++);\n v4 = str.charCodeAt(i);\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3) & 31] +\n '=';\n }\n return base32Str;\n };\n\n var encodeUtf8 = function (str) {\n var v1, v2, v3, v4, v5, code, end = false, base32Str = '',\n index = 0, i, start = 0, bytes = 0, length = str.length;\n if (str === '') {\n return base32Str;\n }\n do {\n blocks[0] = blocks[5];\n blocks[1] = blocks[6];\n blocks[2] = blocks[7];\n for (i = start; index < length && i < 5; ++index) {\n code = str.charCodeAt(index);\n if (code < 0x80) {\n blocks[i++] = code;\n } else if (code < 0x800) {\n blocks[i++] = 0xc0 | (code >> 6);\n blocks[i++] = 0x80 | (code & 0x3f);\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i++] = 0xe0 | (code >> 12);\n blocks[i++] = 0x80 | ((code >> 6) & 0x3f);\n blocks[i++] = 0x80 | (code & 0x3f);\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++index) & 0x3ff));\n blocks[i++] = 0xf0 | (code >> 18);\n blocks[i++] = 0x80 | ((code >> 12) & 0x3f);\n blocks[i++] = 0x80 | ((code >> 6) & 0x3f);\n blocks[i++] = 0x80 | (code & 0x3f);\n }\n }\n bytes += i - start;\n start = i - 5;\n if (index === length) {\n ++index;\n }\n if (index > length && i < 6) {\n end = true;\n }\n v1 = blocks[0];\n if (i > 4) {\n v2 = blocks[1];\n v3 = blocks[2];\n v4 = blocks[3];\n v5 = blocks[4];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] +\n BASE32_ENCODE_CHAR[v5 & 31];\n } else if (i === 1) {\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2) & 31] +\n '======';\n } else if (i === 2) {\n v2 = blocks[1];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4) & 31] +\n '====';\n } else if (i === 3) {\n v2 = blocks[1];\n v3 = blocks[2];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1) & 31] +\n '===';\n } else {\n v2 = blocks[1];\n v3 = blocks[2];\n v4 = blocks[3];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3) & 31] +\n '=';\n }\n } while (!end);\n return base32Str;\n };\n\n var encodeBytes = function (bytes) {\n var v1, v2, v3, v4, v5, base32Str = '', length = bytes.length;\n for (var i = 0, count = parseInt(length / 5) * 5; i < count;) {\n v1 = bytes[i++];\n v2 = bytes[i++];\n v3 = bytes[i++];\n v4 = bytes[i++];\n v5 = bytes[i++];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3 | v5 >>> 5) & 31] +\n BASE32_ENCODE_CHAR[v5 & 31];\n }\n\n // remain char\n var remain = length - count;\n if (remain === 1) {\n v1 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2) & 31] +\n '======';\n } else if (remain === 2) {\n v1 = bytes[i++];\n v2 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4) & 31] +\n '====';\n } else if (remain === 3) {\n v1 = bytes[i++];\n v2 = bytes[i++];\n v3 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1) & 31] +\n '===';\n } else if (remain === 4) {\n v1 = bytes[i++];\n v2 = bytes[i++];\n v3 = bytes[i++];\n v4 = bytes[i];\n base32Str += BASE32_ENCODE_CHAR[v1 >>> 3] +\n BASE32_ENCODE_CHAR[(v1 << 2 | v2 >>> 6) & 31] +\n BASE32_ENCODE_CHAR[(v2 >>> 1) & 31] +\n BASE32_ENCODE_CHAR[(v2 << 4 | v3 >>> 4) & 31] +\n BASE32_ENCODE_CHAR[(v3 << 1 | v4 >>> 7) & 31] +\n BASE32_ENCODE_CHAR[(v4 >>> 2) & 31] +\n BASE32_ENCODE_CHAR[(v4 << 3) & 31] +\n '=';\n }\n return base32Str;\n };\n\n var encode = function (input, asciiOnly) {\n var notString = typeof(input) !== 'string';\n if (notString && input.constructor === ArrayBuffer) {\n input = new Uint8Array(input);\n }\n if (notString) {\n return encodeBytes(input);\n } else if (asciiOnly) {\n return encodeAscii(input);\n } else {\n return encodeUtf8(input);\n }\n };\n\n var decode = function (base32Str, asciiOnly) {\n if (!asciiOnly) {\n return toUtf8String(decodeAsBytes(base32Str));\n }\n if (base32Str === '') {\n return '';\n } else if (!/^[A-Z2-7=]+$/.test(base32Str)) {\n throw new Error('Invalid base32 characters');\n }\n var v1, v2, v3, v4, v5, v6, v7, v8, str = '', length = base32Str.indexOf('=');\n if (length === -1) {\n length = base32Str.length;\n }\n\n // 8 char to 5 bytes\n for (var i = 0, count = length >> 3 << 3; i < count;) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v8 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) +\n String.fromCharCode((v4 << 4 | v5 >>> 1) & 255) +\n String.fromCharCode((v5 << 7 | v6 << 2 | v7 >>> 3) & 255) +\n String.fromCharCode((v7 << 5 | v8) & 255);\n }\n\n // remain bytes\n var remain = length - count;\n if (remain === 2) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255);\n } else if (remain === 4) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255);\n } else if (remain === 5) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) +\n String.fromCharCode((v4 << 4 | v5 >>> 1) & 255);\n } else if (remain === 7) {\n v1 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v2 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v3 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v4 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v5 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v6 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n v7 = BASE32_DECODE_CHAR[base32Str.charAt(i++)];\n str += String.fromCharCode((v1 << 3 | v2 >>> 2) & 255) +\n String.fromCharCode((v2 << 6 | v3 << 1 | v4 >>> 4) & 255) +\n String.fromCharCode((v4 << 4 | v5 >>> 1) & 255) +\n String.fromCharCode((v5 << 7 | v6 << 2 | v7 >>> 3) & 255);\n }\n return str;\n };\n\n var exports = {\n encode: encode,\n decode: decode\n };\n decode.asBytes = decodeAsBytes;\n\n if (COMMON_JS) {\n module.exports = exports;\n } else {\n root.base32 = exports;\n if (AMD) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {\n return exports;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n})();\n\n\n//# sourceURL=webpack://light/./node_modules/hi-base32/src/base32.js?"); + +/***/ }), + +/***/ "./node_modules/ipaddr.js/lib/ipaddr.js": +/*!**********************************************!*\ + !*** ./node_modules/ipaddr.js/lib/ipaddr.js ***! + \**********************************************/ +/***/ (function(module) { + +eval("(function (root) {\n 'use strict';\n // A list of regular expressions that match arbitrary IPv4 addresses,\n // for which a number of weird notations exist.\n // Note that an address like 0010.0xa5.1.1 is considered legal.\n const ipv4Part = '(0?\\\\d+|0x[a-f0-9]+)';\n const ipv4Regexes = {\n fourOctet: new RegExp(`^${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}$`, 'i'),\n threeOctet: new RegExp(`^${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}$`, 'i'),\n twoOctet: new RegExp(`^${ipv4Part}\\\\.${ipv4Part}$`, 'i'),\n longValue: new RegExp(`^${ipv4Part}$`, 'i')\n };\n\n // Regular Expression for checking Octal numbers\n const octalRegex = new RegExp(`^0[0-7]+$`, 'i');\n const hexRegex = new RegExp(`^0x[a-f0-9]+$`, 'i');\n\n const zoneIndex = '%[0-9a-z]{1,}';\n\n // IPv6-matching regular expressions.\n // For IPv6, the task is simpler: it is enough to match the colon-delimited\n // hexadecimal IPv6 and a transitional variant with dotted-decimal IPv4 at\n // the end.\n const ipv6Part = '(?:[0-9a-f]+::?)+';\n const ipv6Regexes = {\n zoneIndex: new RegExp(zoneIndex, 'i'),\n 'native': new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, 'i'),\n deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}(${zoneIndex})?)$`, 'i'),\n transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}\\\\.${ipv4Part}(${zoneIndex})?$`, 'i')\n };\n\n // Expand :: in an IPv6 address or address part consisting of `parts` groups.\n function expandIPv6 (string, parts) {\n // More than one '::' means invalid adddress\n if (string.indexOf('::') !== string.lastIndexOf('::')) {\n return null;\n }\n\n let colonCount = 0;\n let lastColon = -1;\n let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0];\n let replacement, replacementCount;\n\n // Remove zone index and save it for later\n if (zoneId) {\n zoneId = zoneId.substring(1);\n string = string.replace(/%.+$/, '');\n }\n\n // How many parts do we already have?\n while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) {\n colonCount++;\n }\n\n // 0::0 is two parts more than ::\n if (string.substr(0, 2) === '::') {\n colonCount--;\n }\n\n if (string.substr(-2, 2) === '::') {\n colonCount--;\n }\n\n // The following loop would hang if colonCount > parts\n if (colonCount > parts) {\n return null;\n }\n\n // replacement = ':' + '0:' * (parts - colonCount)\n replacementCount = parts - colonCount;\n replacement = ':';\n while (replacementCount--) {\n replacement += '0:';\n }\n\n // Insert the missing zeroes\n string = string.replace('::', replacement);\n\n // Trim any garbage which may be hanging around if :: was at the edge in\n // the source strin\n if (string[0] === ':') {\n string = string.slice(1);\n }\n\n if (string[string.length - 1] === ':') {\n string = string.slice(0, -1);\n }\n\n parts = (function () {\n const ref = string.split(':');\n const results = [];\n\n for (let i = 0; i < ref.length; i++) {\n results.push(parseInt(ref[i], 16));\n }\n\n return results;\n })();\n\n return {\n parts: parts,\n zoneId: zoneId\n };\n }\n\n // A generic CIDR (Classless Inter-Domain Routing) RFC1518 range matcher.\n function matchCIDR (first, second, partSize, cidrBits) {\n if (first.length !== second.length) {\n throw new Error('ipaddr: cannot match CIDR for objects with different lengths');\n }\n\n let part = 0;\n let shift;\n\n while (cidrBits > 0) {\n shift = partSize - cidrBits;\n if (shift < 0) {\n shift = 0;\n }\n\n if (first[part] >> shift !== second[part] >> shift) {\n return false;\n }\n\n cidrBits -= partSize;\n part += 1;\n }\n\n return true;\n }\n\n function parseIntAuto (string) {\n // Hexadedimal base 16 (0x#)\n if (hexRegex.test(string)) {\n return parseInt(string, 16);\n }\n // While octal representation is discouraged by ECMAScript 3\n // and forbidden by ECMAScript 5, we silently allow it to\n // work only if the rest of the string has numbers less than 8.\n if (string[0] === '0' && !isNaN(parseInt(string[1], 10))) {\n if (octalRegex.test(string)) {\n return parseInt(string, 8);\n }\n throw new Error(`ipaddr: cannot parse ${string} as octal`);\n }\n // Always include the base 10 radix!\n return parseInt(string, 10);\n }\n\n function padPart (part, length) {\n while (part.length < length) {\n part = `0${part}`;\n }\n\n return part;\n }\n\n const ipaddr = {};\n\n // An IPv4 address (RFC791).\n ipaddr.IPv4 = (function () {\n // Constructs a new IPv4 address from an array of four octets\n // in network order (MSB first)\n // Verifies the input.\n function IPv4 (octets) {\n if (octets.length !== 4) {\n throw new Error('ipaddr: ipv4 octet count should be 4');\n }\n\n let i, octet;\n\n for (i = 0; i < octets.length; i++) {\n octet = octets[i];\n if (!((0 <= octet && octet <= 255))) {\n throw new Error('ipaddr: ipv4 octet should fit in 8 bits');\n }\n }\n\n this.octets = octets;\n }\n\n // Special IPv4 address ranges.\n // See also https://en.wikipedia.org/wiki/Reserved_IP_addresses\n IPv4.prototype.SpecialRanges = {\n unspecified: [[new IPv4([0, 0, 0, 0]), 8]],\n broadcast: [[new IPv4([255, 255, 255, 255]), 32]],\n // RFC3171\n multicast: [[new IPv4([224, 0, 0, 0]), 4]],\n // RFC3927\n linkLocal: [[new IPv4([169, 254, 0, 0]), 16]],\n // RFC5735\n loopback: [[new IPv4([127, 0, 0, 0]), 8]],\n // RFC6598\n carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]],\n // RFC1918\n 'private': [\n [new IPv4([10, 0, 0, 0]), 8],\n [new IPv4([172, 16, 0, 0]), 12],\n [new IPv4([192, 168, 0, 0]), 16]\n ],\n // Reserved and testing-only ranges; RFCs 5735, 5737, 2544, 1700\n reserved: [\n [new IPv4([192, 0, 0, 0]), 24],\n [new IPv4([192, 0, 2, 0]), 24],\n [new IPv4([192, 88, 99, 0]), 24],\n [new IPv4([198, 18, 0, 0]), 15],\n [new IPv4([198, 51, 100, 0]), 24],\n [new IPv4([203, 0, 113, 0]), 24],\n [new IPv4([240, 0, 0, 0]), 4]\n ]\n };\n\n // The 'kind' method exists on both IPv4 and IPv6 classes.\n IPv4.prototype.kind = function () {\n return 'ipv4';\n };\n\n // Checks if this address matches other one within given CIDR range.\n IPv4.prototype.match = function (other, cidrRange) {\n let ref;\n if (cidrRange === undefined) {\n ref = other;\n other = ref[0];\n cidrRange = ref[1];\n }\n\n if (other.kind() !== 'ipv4') {\n throw new Error('ipaddr: cannot match ipv4 address with non-ipv4 one');\n }\n\n return matchCIDR(this.octets, other.octets, 8, cidrRange);\n };\n\n // returns a number of leading ones in IPv4 address, making sure that\n // the rest is a solid sequence of 0's (valid netmask)\n // returns either the CIDR length or null if mask is not valid\n IPv4.prototype.prefixLengthFromSubnetMask = function () {\n let cidr = 0;\n // non-zero encountered stop scanning for zeroes\n let stop = false;\n // number of zeroes in octet\n const zerotable = {\n 0: 8,\n 128: 7,\n 192: 6,\n 224: 5,\n 240: 4,\n 248: 3,\n 252: 2,\n 254: 1,\n 255: 0\n };\n let i, octet, zeros;\n\n for (i = 3; i >= 0; i -= 1) {\n octet = this.octets[i];\n if (octet in zerotable) {\n zeros = zerotable[octet];\n if (stop && zeros !== 0) {\n return null;\n }\n\n if (zeros !== 8) {\n stop = true;\n }\n\n cidr += zeros;\n } else {\n return null;\n }\n }\n\n return 32 - cidr;\n };\n\n // Checks if the address corresponds to one of the special ranges.\n IPv4.prototype.range = function () {\n return ipaddr.subnetMatch(this, this.SpecialRanges);\n };\n\n // Returns an array of byte-sized values in network order (MSB first)\n IPv4.prototype.toByteArray = function () {\n return this.octets.slice(0);\n };\n\n // Converts this IPv4 address to an IPv4-mapped IPv6 address.\n IPv4.prototype.toIPv4MappedAddress = function () {\n return ipaddr.IPv6.parse(`::ffff:${this.toString()}`);\n };\n\n // Symmetrical method strictly for aligning with the IPv6 methods.\n IPv4.prototype.toNormalizedString = function () {\n return this.toString();\n };\n\n // Returns the address in convenient, decimal-dotted format.\n IPv4.prototype.toString = function () {\n return this.octets.join('.');\n };\n\n return IPv4;\n })();\n\n // A utility function to return broadcast address given the IPv4 interface and prefix length in CIDR notation\n ipaddr.IPv4.broadcastAddressFromCIDR = function (string) {\n\n try {\n const cidr = this.parseCIDR(string);\n const ipInterfaceOctets = cidr[0].toByteArray();\n const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();\n const octets = [];\n let i = 0;\n while (i < 4) {\n // Broadcast address is bitwise OR between ip interface and inverted mask\n octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);\n i++;\n }\n\n return new this(octets);\n } catch (e) {\n throw new Error('ipaddr: the address does not have IPv4 CIDR format');\n }\n };\n\n // Checks if a given string is formatted like IPv4 address.\n ipaddr.IPv4.isIPv4 = function (string) {\n return this.parser(string) !== null;\n };\n\n // Checks if a given string is a valid IPv4 address.\n ipaddr.IPv4.isValid = function (string) {\n try {\n new this(this.parser(string));\n return true;\n } catch (e) {\n return false;\n }\n };\n\n // Checks if a given string is a full four-part IPv4 Address.\n ipaddr.IPv4.isValidFourPartDecimal = function (string) {\n if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){3}$/)) {\n return true;\n } else {\n return false;\n }\n };\n\n // A utility function to return network address given the IPv4 interface and prefix length in CIDR notation\n ipaddr.IPv4.networkAddressFromCIDR = function (string) {\n let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;\n\n try {\n cidr = this.parseCIDR(string);\n ipInterfaceOctets = cidr[0].toByteArray();\n subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();\n octets = [];\n i = 0;\n while (i < 4) {\n // Network address is bitwise AND between ip interface and mask\n octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));\n i++;\n }\n\n return new this(octets);\n } catch (e) {\n throw new Error('ipaddr: the address does not have IPv4 CIDR format');\n }\n };\n\n // Tries to parse and validate a string with IPv4 address.\n // Throws an error if it fails.\n ipaddr.IPv4.parse = function (string) {\n const parts = this.parser(string);\n\n if (parts === null) {\n throw new Error('ipaddr: string is not formatted like an IPv4 Address');\n }\n\n return new this(parts);\n };\n\n // Parses the string as an IPv4 Address with CIDR Notation.\n ipaddr.IPv4.parseCIDR = function (string) {\n let match;\n\n if ((match = string.match(/^(.+)\\/(\\d+)$/))) {\n const maskLength = parseInt(match[2]);\n if (maskLength >= 0 && maskLength <= 32) {\n const parsed = [this.parse(match[1]), maskLength];\n Object.defineProperty(parsed, 'toString', {\n value: function () {\n return this.join('/');\n }\n });\n return parsed;\n }\n }\n\n throw new Error('ipaddr: string is not formatted like an IPv4 CIDR range');\n };\n\n // Classful variants (like a.b, where a is an octet, and b is a 24-bit\n // value representing last three octets; this corresponds to a class C\n // address) are omitted due to classless nature of modern Internet.\n ipaddr.IPv4.parser = function (string) {\n let match, part, value;\n\n // parseInt recognizes all that octal & hexadecimal weirdness for us\n if ((match = string.match(ipv4Regexes.fourOctet))) {\n return (function () {\n const ref = match.slice(1, 6);\n const results = [];\n\n for (let i = 0; i < ref.length; i++) {\n part = ref[i];\n results.push(parseIntAuto(part));\n }\n\n return results;\n })();\n } else if ((match = string.match(ipv4Regexes.longValue))) {\n value = parseIntAuto(match[1]);\n if (value > 0xffffffff || value < 0) {\n throw new Error('ipaddr: address outside defined range');\n }\n\n return ((function () {\n const results = [];\n let shift;\n\n for (shift = 0; shift <= 24; shift += 8) {\n results.push((value >> shift) & 0xff);\n }\n\n return results;\n })()).reverse();\n } else if ((match = string.match(ipv4Regexes.twoOctet))) {\n return (function () {\n const ref = match.slice(1, 4);\n const results = [];\n\n value = parseIntAuto(ref[1]);\n if (value > 0xffffff || value < 0) {\n throw new Error('ipaddr: address outside defined range');\n }\n\n results.push(parseIntAuto(ref[0]));\n results.push((value >> 16) & 0xff);\n results.push((value >> 8) & 0xff);\n results.push( value & 0xff);\n\n return results;\n })();\n } else if ((match = string.match(ipv4Regexes.threeOctet))) {\n return (function () {\n const ref = match.slice(1, 5);\n const results = [];\n\n value = parseIntAuto(ref[2]);\n if (value > 0xffff || value < 0) {\n throw new Error('ipaddr: address outside defined range');\n }\n\n results.push(parseIntAuto(ref[0]));\n results.push(parseIntAuto(ref[1]));\n results.push((value >> 8) & 0xff);\n results.push( value & 0xff);\n\n return results;\n })();\n } else {\n return null;\n }\n };\n\n // A utility function to return subnet mask in IPv4 format given the prefix length\n ipaddr.IPv4.subnetMaskFromPrefixLength = function (prefix) {\n prefix = parseInt(prefix);\n if (prefix < 0 || prefix > 32) {\n throw new Error('ipaddr: invalid IPv4 prefix length');\n }\n\n const octets = [0, 0, 0, 0];\n let j = 0;\n const filledOctetCount = Math.floor(prefix / 8);\n\n while (j < filledOctetCount) {\n octets[j] = 255;\n j++;\n }\n\n if (filledOctetCount < 4) {\n octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8);\n }\n\n return new this(octets);\n };\n\n // An IPv6 address (RFC2460)\n ipaddr.IPv6 = (function () {\n // Constructs an IPv6 address from an array of eight 16 - bit parts\n // or sixteen 8 - bit parts in network order(MSB first).\n // Throws an error if the input is invalid.\n function IPv6 (parts, zoneId) {\n let i, part;\n\n if (parts.length === 16) {\n this.parts = [];\n for (i = 0; i <= 14; i += 2) {\n this.parts.push((parts[i] << 8) | parts[i + 1]);\n }\n } else if (parts.length === 8) {\n this.parts = parts;\n } else {\n throw new Error('ipaddr: ipv6 part count should be 8 or 16');\n }\n\n for (i = 0; i < this.parts.length; i++) {\n part = this.parts[i];\n if (!((0 <= part && part <= 0xffff))) {\n throw new Error('ipaddr: ipv6 part should fit in 16 bits');\n }\n }\n\n if (zoneId) {\n this.zoneId = zoneId;\n }\n }\n\n // Special IPv6 ranges\n IPv6.prototype.SpecialRanges = {\n // RFC4291, here and after\n unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128],\n linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10],\n multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8],\n loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128],\n uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7],\n ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96],\n // RFC6145\n rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96],\n // RFC6052\n rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96],\n // RFC3056\n '6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16],\n // RFC6052, RFC6146\n teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32],\n // RFC4291\n reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]],\n benchmarking: [new IPv6([0x2001, 0x2, 0, 0, 0, 0, 0, 0]), 48],\n amt: [new IPv6([0x2001, 0x3, 0, 0, 0, 0, 0, 0]), 32],\n as112v6: [new IPv6([0x2001, 0x4, 0x112, 0, 0, 0, 0, 0]), 48],\n deprecated: [new IPv6([0x2001, 0x10, 0, 0, 0, 0, 0, 0]), 28],\n orchid2: [new IPv6([0x2001, 0x20, 0, 0, 0, 0, 0, 0]), 28]\n };\n\n // Checks if this address is an IPv4-mapped IPv6 address.\n IPv6.prototype.isIPv4MappedAddress = function () {\n return this.range() === 'ipv4Mapped';\n };\n\n // The 'kind' method exists on both IPv4 and IPv6 classes.\n IPv6.prototype.kind = function () {\n return 'ipv6';\n };\n\n // Checks if this address matches other one within given CIDR range.\n IPv6.prototype.match = function (other, cidrRange) {\n let ref;\n\n if (cidrRange === undefined) {\n ref = other;\n other = ref[0];\n cidrRange = ref[1];\n }\n\n if (other.kind() !== 'ipv6') {\n throw new Error('ipaddr: cannot match ipv6 address with non-ipv6 one');\n }\n\n return matchCIDR(this.parts, other.parts, 16, cidrRange);\n };\n\n // returns a number of leading ones in IPv6 address, making sure that\n // the rest is a solid sequence of 0's (valid netmask)\n // returns either the CIDR length or null if mask is not valid\n IPv6.prototype.prefixLengthFromSubnetMask = function () {\n let cidr = 0;\n // non-zero encountered stop scanning for zeroes\n let stop = false;\n // number of zeroes in octet\n const zerotable = {\n 0: 16,\n 32768: 15,\n 49152: 14,\n 57344: 13,\n 61440: 12,\n 63488: 11,\n 64512: 10,\n 65024: 9,\n 65280: 8,\n 65408: 7,\n 65472: 6,\n 65504: 5,\n 65520: 4,\n 65528: 3,\n 65532: 2,\n 65534: 1,\n 65535: 0\n };\n let part, zeros;\n\n for (let i = 7; i >= 0; i -= 1) {\n part = this.parts[i];\n if (part in zerotable) {\n zeros = zerotable[part];\n if (stop && zeros !== 0) {\n return null;\n }\n\n if (zeros !== 16) {\n stop = true;\n }\n\n cidr += zeros;\n } else {\n return null;\n }\n }\n\n return 128 - cidr;\n };\n\n\n // Checks if the address corresponds to one of the special ranges.\n IPv6.prototype.range = function () {\n return ipaddr.subnetMatch(this, this.SpecialRanges);\n };\n\n // Returns an array of byte-sized values in network order (MSB first)\n IPv6.prototype.toByteArray = function () {\n let part;\n const bytes = [];\n const ref = this.parts;\n for (let i = 0; i < ref.length; i++) {\n part = ref[i];\n bytes.push(part >> 8);\n bytes.push(part & 0xff);\n }\n\n return bytes;\n };\n\n // Returns the address in expanded format with all zeroes included, like\n // 2001:0db8:0008:0066:0000:0000:0000:0001\n IPv6.prototype.toFixedLengthString = function () {\n const addr = ((function () {\n const results = [];\n for (let i = 0; i < this.parts.length; i++) {\n results.push(padPart(this.parts[i].toString(16), 4));\n }\n\n return results;\n }).call(this)).join(':');\n\n let suffix = '';\n\n if (this.zoneId) {\n suffix = `%${this.zoneId}`;\n }\n\n return addr + suffix;\n };\n\n // Converts this address to IPv4 address if it is an IPv4-mapped IPv6 address.\n // Throws an error otherwise.\n IPv6.prototype.toIPv4Address = function () {\n if (!this.isIPv4MappedAddress()) {\n throw new Error('ipaddr: trying to convert a generic ipv6 address to ipv4');\n }\n\n const ref = this.parts.slice(-2);\n const high = ref[0];\n const low = ref[1];\n\n return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]);\n };\n\n // Returns the address in expanded format with all zeroes included, like\n // 2001:db8:8:66:0:0:0:1\n //\n // Deprecated: use toFixedLengthString() instead.\n IPv6.prototype.toNormalizedString = function () {\n const addr = ((function () {\n const results = [];\n\n for (let i = 0; i < this.parts.length; i++) {\n results.push(this.parts[i].toString(16));\n }\n\n return results;\n }).call(this)).join(':');\n\n let suffix = '';\n\n if (this.zoneId) {\n suffix = `%${this.zoneId}`;\n }\n\n return addr + suffix;\n };\n\n // Returns the address in compact, human-readable format like\n // 2001:db8:8:66::1\n // in line with RFC 5952 (see https://tools.ietf.org/html/rfc5952#section-4)\n IPv6.prototype.toRFC5952String = function () {\n const regex = /((^|:)(0(:|$)){2,})/g;\n const string = this.toNormalizedString();\n let bestMatchIndex = 0;\n let bestMatchLength = -1;\n let match;\n\n while ((match = regex.exec(string))) {\n if (match[0].length > bestMatchLength) {\n bestMatchIndex = match.index;\n bestMatchLength = match[0].length;\n }\n }\n\n if (bestMatchLength < 0) {\n return string;\n }\n\n return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`;\n };\n\n // Returns the address in compact, human-readable format like\n // 2001:db8:8:66::1\n // Calls toRFC5952String under the hood.\n IPv6.prototype.toString = function () {\n return this.toRFC5952String();\n };\n\n return IPv6;\n\n })();\n\n // A utility function to return broadcast address given the IPv6 interface and prefix length in CIDR notation\n ipaddr.IPv6.broadcastAddressFromCIDR = function (string) {\n try {\n const cidr = this.parseCIDR(string);\n const ipInterfaceOctets = cidr[0].toByteArray();\n const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();\n const octets = [];\n let i = 0;\n while (i < 16) {\n // Broadcast address is bitwise OR between ip interface and inverted mask\n octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);\n i++;\n }\n\n return new this(octets);\n } catch (e) {\n throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);\n }\n };\n\n // Checks if a given string is formatted like IPv6 address.\n ipaddr.IPv6.isIPv6 = function (string) {\n return this.parser(string) !== null;\n };\n\n // Checks to see if string is a valid IPv6 Address\n ipaddr.IPv6.isValid = function (string) {\n\n // Since IPv6.isValid is always called first, this shortcut\n // provides a substantial performance gain.\n if (typeof string === 'string' && string.indexOf(':') === -1) {\n return false;\n }\n\n try {\n const addr = this.parser(string);\n new this(addr.parts, addr.zoneId);\n return true;\n } catch (e) {\n return false;\n }\n };\n\n // A utility function to return network address given the IPv6 interface and prefix length in CIDR notation\n ipaddr.IPv6.networkAddressFromCIDR = function (string) {\n let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;\n\n try {\n cidr = this.parseCIDR(string);\n ipInterfaceOctets = cidr[0].toByteArray();\n subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();\n octets = [];\n i = 0;\n while (i < 16) {\n // Network address is bitwise AND between ip interface and mask\n octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));\n i++;\n }\n\n return new this(octets);\n } catch (e) {\n throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);\n }\n };\n\n // Tries to parse and validate a string with IPv6 address.\n // Throws an error if it fails.\n ipaddr.IPv6.parse = function (string) {\n const addr = this.parser(string);\n\n if (addr.parts === null) {\n throw new Error('ipaddr: string is not formatted like an IPv6 Address');\n }\n\n return new this(addr.parts, addr.zoneId);\n };\n\n ipaddr.IPv6.parseCIDR = function (string) {\n let maskLength, match, parsed;\n\n if ((match = string.match(/^(.+)\\/(\\d+)$/))) {\n maskLength = parseInt(match[2]);\n if (maskLength >= 0 && maskLength <= 128) {\n parsed = [this.parse(match[1]), maskLength];\n Object.defineProperty(parsed, 'toString', {\n value: function () {\n return this.join('/');\n }\n });\n return parsed;\n }\n }\n\n throw new Error('ipaddr: string is not formatted like an IPv6 CIDR range');\n };\n\n // Parse an IPv6 address.\n ipaddr.IPv6.parser = function (string) {\n let addr, i, match, octet, octets, zoneId;\n\n if ((match = string.match(ipv6Regexes.deprecatedTransitional))) {\n return this.parser(`::ffff:${match[1]}`);\n }\n if (ipv6Regexes.native.test(string)) {\n return expandIPv6(string, 8);\n }\n if ((match = string.match(ipv6Regexes.transitional))) {\n zoneId = match[6] || '';\n addr = expandIPv6(match[1].slice(0, -1) + zoneId, 6);\n if (addr.parts) {\n octets = [\n parseInt(match[2]),\n parseInt(match[3]),\n parseInt(match[4]),\n parseInt(match[5])\n ];\n for (i = 0; i < octets.length; i++) {\n octet = octets[i];\n if (!((0 <= octet && octet <= 255))) {\n return null;\n }\n }\n\n addr.parts.push(octets[0] << 8 | octets[1]);\n addr.parts.push(octets[2] << 8 | octets[3]);\n return {\n parts: addr.parts,\n zoneId: addr.zoneId\n };\n }\n }\n\n return null;\n };\n\n // A utility function to return subnet mask in IPv6 format given the prefix length\n ipaddr.IPv6.subnetMaskFromPrefixLength = function (prefix) {\n prefix = parseInt(prefix);\n if (prefix < 0 || prefix > 128) {\n throw new Error('ipaddr: invalid IPv6 prefix length');\n }\n\n const octets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n let j = 0;\n const filledOctetCount = Math.floor(prefix / 8);\n\n while (j < filledOctetCount) {\n octets[j] = 255;\n j++;\n }\n\n if (filledOctetCount < 16) {\n octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8);\n }\n\n return new this(octets);\n };\n\n // Try to parse an array in network order (MSB first) for IPv4 and IPv6\n ipaddr.fromByteArray = function (bytes) {\n const length = bytes.length;\n\n if (length === 4) {\n return new ipaddr.IPv4(bytes);\n } else if (length === 16) {\n return new ipaddr.IPv6(bytes);\n } else {\n throw new Error('ipaddr: the binary input is neither an IPv6 nor IPv4 address');\n }\n };\n\n // Checks if the address is valid IP address\n ipaddr.isValid = function (string) {\n return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);\n };\n\n\n // Attempts to parse an IP Address, first through IPv6 then IPv4.\n // Throws an error if it could not be parsed.\n ipaddr.parse = function (string) {\n if (ipaddr.IPv6.isValid(string)) {\n return ipaddr.IPv6.parse(string);\n } else if (ipaddr.IPv4.isValid(string)) {\n return ipaddr.IPv4.parse(string);\n } else {\n throw new Error('ipaddr: the address has neither IPv6 nor IPv4 format');\n }\n };\n\n // Attempt to parse CIDR notation, first through IPv6 then IPv4.\n // Throws an error if it could not be parsed.\n ipaddr.parseCIDR = function (string) {\n try {\n return ipaddr.IPv6.parseCIDR(string);\n } catch (e) {\n try {\n return ipaddr.IPv4.parseCIDR(string);\n } catch (e2) {\n throw new Error('ipaddr: the address has neither IPv6 nor IPv4 CIDR format');\n }\n }\n };\n\n // Parse an address and return plain IPv4 address if it is an IPv4-mapped address\n ipaddr.process = function (string) {\n const addr = this.parse(string);\n\n if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) {\n return addr.toIPv4Address();\n } else {\n return addr;\n }\n };\n\n // An utility function to ease named range matching. See examples below.\n // rangeList can contain both IPv4 and IPv6 subnet entries and will not throw errors\n // on matching IPv4 addresses to IPv6 ranges or vice versa.\n ipaddr.subnetMatch = function (address, rangeList, defaultName) {\n let i, rangeName, rangeSubnets, subnet;\n\n if (defaultName === undefined || defaultName === null) {\n defaultName = 'unicast';\n }\n\n for (rangeName in rangeList) {\n if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) {\n rangeSubnets = rangeList[rangeName];\n // ECMA5 Array.isArray isn't available everywhere\n if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) {\n rangeSubnets = [rangeSubnets];\n }\n\n for (i = 0; i < rangeSubnets.length; i++) {\n subnet = rangeSubnets[i];\n if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) {\n return rangeName;\n }\n }\n }\n }\n\n return defaultName;\n };\n\n // Export for both the CommonJS and browser-like environment\n if ( true && module.exports) {\n module.exports = ipaddr;\n\n } else {\n root.ipaddr = ipaddr;\n }\n\n}(this));\n\n\n//# sourceURL=webpack://light/./node_modules/ipaddr.js/lib/ipaddr.js?"); + +/***/ }), + +/***/ "./node_modules/is-electron/index.js": +/*!*******************************************!*\ + !*** ./node_modules/is-electron/index.js ***! + \*******************************************/ +/***/ ((module) => { + +eval("// https://github.com/electron/electron/issues/2288\nfunction isElectron() {\n // Renderer process\n if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {\n return true;\n }\n\n // Main process\n if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {\n return true;\n }\n\n // Detect the user agent when the `nodeIntegration` option is set to false\n if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {\n return true;\n }\n\n return false;\n}\n\nmodule.exports = isElectron;\n\n\n//# sourceURL=webpack://light/./node_modules/is-electron/index.js?"); + +/***/ }), + +/***/ "./node_modules/is-plain-obj/index.js": +/*!********************************************!*\ + !*** ./node_modules/is-plain-obj/index.js ***! + \********************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\nmodule.exports = value => {\n\tif (Object.prototype.toString.call(value) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === null || prototype === Object.prototype;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/is-plain-obj/index.js?"); + +/***/ }), + +/***/ "./node_modules/iso-url/index.js": +/*!***************************************!*\ + !*** ./node_modules/iso-url/index.js ***! + \***************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\n\nconst {\n URLWithLegacySupport,\n format,\n URLSearchParams,\n defaultBase\n} = __webpack_require__(/*! ./src/url */ \"./node_modules/iso-url/src/url-browser.js\")\nconst relative = __webpack_require__(/*! ./src/relative */ \"./node_modules/iso-url/src/relative.js\")\n\nmodule.exports = {\n URL: URLWithLegacySupport,\n URLSearchParams,\n format,\n relative,\n defaultBase\n}\n\n\n//# sourceURL=webpack://light/./node_modules/iso-url/index.js?"); + +/***/ }), + +/***/ "./node_modules/iso-url/src/relative.js": +/*!**********************************************!*\ + !*** ./node_modules/iso-url/src/relative.js ***! + \**********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\n\nconst { URLWithLegacySupport, format } = __webpack_require__(/*! ./url */ \"./node_modules/iso-url/src/url-browser.js\")\n\n/**\n * @param {string | undefined} url\n * @param {any} [location]\n * @param {any} [protocolMap]\n * @param {any} [defaultProtocol]\n */\nmodule.exports = (url, location = {}, protocolMap = {}, defaultProtocol) => {\n let protocol = location.protocol\n ? location.protocol.replace(':', '')\n : 'http'\n\n // Check protocol map\n protocol = (protocolMap[protocol] || defaultProtocol || protocol) + ':'\n let urlParsed\n\n try {\n urlParsed = new URLWithLegacySupport(url)\n } catch (err) {\n urlParsed = {}\n }\n\n const base = Object.assign({}, location, {\n protocol: protocol || urlParsed.protocol,\n host: location.host || urlParsed.host\n })\n\n return new URLWithLegacySupport(url, format(base)).toString()\n}\n\n\n//# sourceURL=webpack://light/./node_modules/iso-url/src/relative.js?"); + +/***/ }), + +/***/ "./node_modules/iso-url/src/url-browser.js": +/*!*************************************************!*\ + !*** ./node_modules/iso-url/src/url-browser.js ***! + \*************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\nconst isReactNative =\n typeof navigator !== 'undefined' &&\n navigator.product === 'ReactNative'\n\nfunction getDefaultBase () {\n if (isReactNative) {\n return 'http://localhost'\n }\n // in some environments i.e. cloudflare workers location is not available\n if (!self.location) {\n return ''\n }\n\n return self.location.protocol + '//' + self.location.host\n}\n\nconst URL = self.URL\nconst defaultBase = getDefaultBase()\n\nclass URLWithLegacySupport {\n constructor (url = '', base = defaultBase) {\n this.super = new URL(url, base)\n this.path = this.pathname + this.search\n this.auth =\n this.username && this.password\n ? this.username + ':' + this.password\n : null\n\n this.query =\n this.search && this.search.startsWith('?')\n ? this.search.slice(1)\n : null\n }\n\n get hash () {\n return this.super.hash\n }\n\n get host () {\n return this.super.host\n }\n\n get hostname () {\n return this.super.hostname\n }\n\n get href () {\n return this.super.href\n }\n\n get origin () {\n return this.super.origin\n }\n\n get password () {\n return this.super.password\n }\n\n get pathname () {\n return this.super.pathname\n }\n\n get port () {\n return this.super.port\n }\n\n get protocol () {\n return this.super.protocol\n }\n\n get search () {\n return this.super.search\n }\n\n get searchParams () {\n return this.super.searchParams\n }\n\n get username () {\n return this.super.username\n }\n\n set hash (hash) {\n this.super.hash = hash\n }\n\n set host (host) {\n this.super.host = host\n }\n\n set hostname (hostname) {\n this.super.hostname = hostname\n }\n\n set href (href) {\n this.super.href = href\n }\n\n set password (password) {\n this.super.password = password\n }\n\n set pathname (pathname) {\n this.super.pathname = pathname\n }\n\n set port (port) {\n this.super.port = port\n }\n\n set protocol (protocol) {\n this.super.protocol = protocol\n }\n\n set search (search) {\n this.super.search = search\n }\n\n set username (username) {\n this.super.username = username\n }\n\n /**\n * @param {any} o\n */\n static createObjectURL (o) {\n return URL.createObjectURL(o)\n }\n\n /**\n * @param {string} o\n */\n static revokeObjectURL (o) {\n URL.revokeObjectURL(o)\n }\n\n toJSON () {\n return this.super.toJSON()\n }\n\n toString () {\n return this.super.toString()\n }\n\n format () {\n return this.toString()\n }\n}\n\n/**\n * @param {string | import('url').UrlObject} obj\n */\nfunction format (obj) {\n if (typeof obj === 'string') {\n const url = new URL(obj)\n\n return url.toString()\n }\n\n if (!(obj instanceof URL)) {\n const userPass =\n // @ts-ignore its not supported in node but we normalise\n obj.username && obj.password\n // @ts-ignore its not supported in node but we normalise\n ? `${obj.username}:${obj.password}@`\n : ''\n const auth = obj.auth ? obj.auth + '@' : ''\n const port = obj.port ? ':' + obj.port : ''\n const protocol = obj.protocol ? obj.protocol + '//' : ''\n const host = obj.host || ''\n const hostname = obj.hostname || ''\n const search = obj.search || (obj.query ? '?' + obj.query : '')\n const hash = obj.hash || ''\n const pathname = obj.pathname || ''\n // @ts-ignore - path is not supported in node but we normalise\n const path = obj.path || pathname + search\n\n return `${protocol}${userPass || auth}${\n host || hostname + port\n }${path}${hash}`\n }\n}\n\nmodule.exports = {\n URLWithLegacySupport,\n URLSearchParams: self.URLSearchParams,\n defaultBase,\n format\n}\n\n\n//# sourceURL=webpack://light/./node_modules/iso-url/src/url-browser.js?"); + +/***/ }), + +/***/ "./node_modules/js-sha3/src/sha3.js": +/*!******************************************!*\ + !*** ./node_modules/js-sha3/src/sha3.js ***! + \******************************************/ +/***/ ((module, exports, __webpack_require__) => { + +eval("var __WEBPACK_AMD_DEFINE_RESULT__;/**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.8.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = __webpack_require__.g;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && \"object\" === 'object' && module.exports;\n var AMD = true && __webpack_require__.amdO;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (!n && !s) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (notString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var notString, type = typeof str;\n if (type !== 'string') {\n if (type === 'object') {\n if (str === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {\n str = new Uint8Array(str);\n } else if (!Array.isArray(str)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var bytes = 0, length = str.length;\n if (notString) {\n bytes = length;\n } else {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = w - bytes % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n array[i] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n if (AMD) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return methods;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n})();\n\n\n//# sourceURL=webpack://light/./node_modules/js-sha3/src/sha3.js?"); + +/***/ }), + +/***/ "./node_modules/merge-options/index.js": +/*!*********************************************!*\ + !*** ./node_modules/merge-options/index.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +eval("\nconst isOptionObject = __webpack_require__(/*! is-plain-obj */ \"./node_modules/is-plain-obj/index.js\");\n\nconst {hasOwnProperty} = Object.prototype;\nconst {propertyIsEnumerable} = Object;\nconst defineProperty = (object, name, value) => Object.defineProperty(object, name, {\n\tvalue,\n\twritable: true,\n\tenumerable: true,\n\tconfigurable: true\n});\n\nconst globalThis = this;\nconst defaultMergeOptions = {\n\tconcatArrays: false,\n\tignoreUndefined: false\n};\n\nconst getEnumerableOwnPropertyKeys = value => {\n\tconst keys = [];\n\n\tfor (const key in value) {\n\t\tif (hasOwnProperty.call(value, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\n\t/* istanbul ignore else */\n\tif (Object.getOwnPropertySymbols) {\n\t\tconst symbols = Object.getOwnPropertySymbols(value);\n\n\t\tfor (const symbol of symbols) {\n\t\t\tif (propertyIsEnumerable.call(value, symbol)) {\n\t\t\t\tkeys.push(symbol);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn keys;\n};\n\nfunction clone(value) {\n\tif (Array.isArray(value)) {\n\t\treturn cloneArray(value);\n\t}\n\n\tif (isOptionObject(value)) {\n\t\treturn cloneOptionObject(value);\n\t}\n\n\treturn value;\n}\n\nfunction cloneArray(array) {\n\tconst result = array.slice(0, 0);\n\n\tgetEnumerableOwnPropertyKeys(array).forEach(key => {\n\t\tdefineProperty(result, key, clone(array[key]));\n\t});\n\n\treturn result;\n}\n\nfunction cloneOptionObject(object) {\n\tconst result = Object.getPrototypeOf(object) === null ? Object.create(null) : {};\n\n\tgetEnumerableOwnPropertyKeys(object).forEach(key => {\n\t\tdefineProperty(result, key, clone(object[key]));\n\t});\n\n\treturn result;\n}\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {string[]} keys keys to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nconst mergeKeys = (merged, source, keys, config) => {\n\tkeys.forEach(key => {\n\t\tif (typeof source[key] === 'undefined' && config.ignoreUndefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not recurse into prototype chain of merged\n\t\tif (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {\n\t\t\tdefineProperty(merged, key, merge(merged[key], source[key], config));\n\t\t} else {\n\t\t\tdefineProperty(merged, key, clone(source[key]));\n\t\t}\n\t});\n\n\treturn merged;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n *\n * see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)\n */\nconst concatArrays = (merged, source, config) => {\n\tlet result = merged.slice(0, 0);\n\tlet resultIndex = 0;\n\n\t[merged, source].forEach(array => {\n\t\tconst indices = [];\n\n\t\t// `result.concat(array)` with cloning\n\t\tfor (let k = 0; k < array.length; k++) {\n\t\t\tif (!hasOwnProperty.call(array, k)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tindices.push(String(k));\n\n\t\t\tif (array === merged) {\n\t\t\t\t// Already cloned\n\t\t\t\tdefineProperty(result, resultIndex++, array[k]);\n\t\t\t} else {\n\t\t\t\tdefineProperty(result, resultIndex++, clone(array[k]));\n\t\t\t}\n\t\t}\n\n\t\t// Merge non-index keys\n\t\tresult = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);\n\t});\n\n\treturn result;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nfunction merge(merged, source, config) {\n\tif (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {\n\t\treturn concatArrays(merged, source, config);\n\t}\n\n\tif (!isOptionObject(source) || !isOptionObject(merged)) {\n\t\treturn clone(source);\n\t}\n\n\treturn mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);\n}\n\nmodule.exports = function (...options) {\n\tconst config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions);\n\tlet merged = {_: {}};\n\n\tfor (const option of options) {\n\t\tif (option === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!isOptionObject(option)) {\n\t\t\tthrow new TypeError('`' + option + '` is not an Option Object');\n\t\t}\n\n\t\tmerged = merge(merged, {_: option}, config);\n\t}\n\n\treturn merged._;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/merge-options/index.js?"); + +/***/ }), + +/***/ "./node_modules/ms/index.js": +/*!**********************************!*\ + !*** ./node_modules/ms/index.js ***! + \**********************************/ +/***/ ((module) => { + +eval("/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n\n\n//# sourceURL=webpack://light/./node_modules/ms/index.js?"); + +/***/ }), + +/***/ "./node_modules/multibase/src/base.js": +/*!********************************************!*\ + !*** ./node_modules/multibase/src/base.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\n\nconst { encodeText } = __webpack_require__(/*! ./util */ \"./node_modules/multibase/src/util.js\")\n\n/** @typedef {import('./types').CodecFactory} CodecFactory */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n\n/**\n * Class to encode/decode in the supported Bases\n *\n */\nclass Base {\n /**\n * @param {BaseName} name\n * @param {BaseCode} code\n * @param {CodecFactory} factory\n * @param {string} alphabet\n */\n constructor (name, code, factory, alphabet) {\n this.name = name\n this.code = code\n this.codeBuf = encodeText(this.code)\n this.alphabet = alphabet\n this.codec = factory(alphabet)\n }\n\n /**\n * @param {Uint8Array} buf\n * @returns {string}\n */\n encode (buf) {\n return this.codec.encode(buf)\n }\n\n /**\n * @param {string} string\n * @returns {Uint8Array}\n */\n decode (string) {\n for (const char of string) {\n if (this.alphabet && this.alphabet.indexOf(char) < 0) {\n throw new Error(`invalid character '${char}' in '${string}'`)\n }\n }\n return this.codec.decode(string)\n }\n}\n\nmodule.exports = Base\n\n\n//# sourceURL=webpack://light/./node_modules/multibase/src/base.js?"); + +/***/ }), + +/***/ "./node_modules/multibase/src/constants.js": +/*!*************************************************!*\ + !*** ./node_modules/multibase/src/constants.js ***! + \*************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\n\nconst baseX = __webpack_require__(/*! @multiformats/base-x */ \"./node_modules/@multiformats/base-x/src/index.js\")\nconst Base = __webpack_require__(/*! ./base.js */ \"./node_modules/multibase/src/base.js\")\nconst { rfc4648 } = __webpack_require__(/*! ./rfc4648 */ \"./node_modules/multibase/src/rfc4648.js\")\nconst { decodeText, encodeText } = __webpack_require__(/*! ./util */ \"./node_modules/multibase/src/util.js\")\n\n/** @typedef {import('./types').CodecFactory} CodecFactory */\n/** @typedef {import('./types').Codec} Codec */\n/** @typedef {import('./types').BaseName} BaseName */\n/** @typedef {import('./types').BaseCode} BaseCode */\n\n/** @type {CodecFactory} */\nconst identity = () => {\n return {\n encode: decodeText,\n decode: encodeText\n }\n}\n\n/**\n *\n * name, code, implementation, alphabet\n *\n * @type {Array<[BaseName, BaseCode, CodecFactory, string]>}\n */\nconst constants = [\n ['identity', '\\x00', identity, ''],\n ['base2', '0', rfc4648(1), '01'],\n ['base8', '7', rfc4648(3), '01234567'],\n ['base10', '9', baseX, '0123456789'],\n ['base16', 'f', rfc4648(4), '0123456789abcdef'],\n ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'],\n ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'],\n ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'],\n ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='],\n ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='],\n ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'],\n ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'],\n ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='],\n ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='],\n ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'],\n ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'],\n ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'],\n ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'],\n ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'],\n ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'],\n ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='],\n ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'],\n ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=']\n]\n\n/** @type {Record} */\nconst names = constants.reduce((prev, tupple) => {\n prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3])\n return prev\n}, /** @type {Record} */({}))\n\n/** @type {Record} */\nconst codes = constants.reduce((prev, tupple) => {\n prev[tupple[1]] = names[tupple[0]]\n return prev\n}, /** @type {Record} */({}))\n\nmodule.exports = {\n names,\n codes\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multibase/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/multibase/src/index.js": +/*!*********************************************!*\ + !*** ./node_modules/multibase/src/index.js ***! + \*********************************************/ +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +eval("/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n\n\nconst constants = __webpack_require__(/*! ./constants */ \"./node_modules/multibase/src/constants.js\")\nconst { encodeText, decodeText, concat } = __webpack_require__(/*! ./util */ \"./node_modules/multibase/src/util.js\")\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nconst names = Object.freeze(constants.names)\nconst codes = Object.freeze(constants.codes)\nexports.names = names\nexports.codes = codes\n\n\n//# sourceURL=webpack://light/./node_modules/multibase/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/multibase/src/rfc4648.js": +/*!***********************************************!*\ + !*** ./node_modules/multibase/src/rfc4648.js ***! + \***********************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\n/** @typedef {import('./types').CodecFactory} CodecFactory */\n\n/**\n * @param {string} string\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @returns {Uint8Array}\n */\nconst decode = (string, alphabet, bitsPerChar) => {\n // Build the character lookup table:\n /** @type {Record} */\n const codes = {}\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i\n }\n\n // Count the padding bytes:\n let end = string.length\n while (string[end - 1] === '=') {\n --end\n }\n\n // Allocate the output:\n const out = new Uint8Array((end * bitsPerChar / 8) | 0)\n\n // Parse the data:\n let bits = 0 // Number of bits currently in the buffer\n let buffer = 0 // Bits waiting to be written out, MSB first\n let written = 0 // Next byte to write\n for (let i = 0; i < end; ++i) {\n // Read one character from the string:\n const value = codes[string[i]]\n if (value === undefined) {\n throw new SyntaxError('Invalid character ' + string[i])\n }\n\n // Append the bits to the buffer:\n buffer = (buffer << bitsPerChar) | value\n bits += bitsPerChar\n\n // Write out some bits if the buffer has a byte's worth:\n if (bits >= 8) {\n bits -= 8\n out[written++] = 0xff & (buffer >> bits)\n }\n }\n\n // Verify that we have received just enough bits:\n if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) {\n throw new SyntaxError('Unexpected end of data')\n }\n\n return out\n}\n\n/**\n * @param {Uint8Array} data\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @returns {string}\n */\nconst encode = (data, alphabet, bitsPerChar) => {\n const pad = alphabet[alphabet.length - 1] === '='\n const mask = (1 << bitsPerChar) - 1\n let out = ''\n\n let bits = 0 // Number of bits currently in the buffer\n let buffer = 0 // Bits waiting to be written out, MSB first\n for (let i = 0; i < data.length; ++i) {\n // Slurp data into the buffer:\n buffer = (buffer << 8) | data[i]\n bits += 8\n\n // Write out as much as we can:\n while (bits > bitsPerChar) {\n bits -= bitsPerChar\n out += alphabet[mask & (buffer >> bits)]\n }\n }\n\n // Partial character:\n if (bits) {\n out += alphabet[mask & (buffer << (bitsPerChar - bits))]\n }\n\n // Add padding characters until we hit a byte boundary:\n if (pad) {\n while ((out.length * bitsPerChar) & 7) {\n out += '='\n }\n }\n\n return out\n}\n\n/**\n * RFC4648 Factory\n *\n * @param {number} bitsPerChar\n * @returns {CodecFactory}\n */\nconst rfc4648 = (bitsPerChar) => (alphabet) => {\n return {\n /**\n * @param {Uint8Array} input\n * @returns {string}\n */\n encode (input) {\n return encode(input, alphabet, bitsPerChar)\n },\n /**\n * @param {string} input\n * @returns {Uint8Array}\n */\n decode (input) {\n return decode(input, alphabet, bitsPerChar)\n }\n }\n}\n\nmodule.exports = { rfc4648 }\n\n\n//# sourceURL=webpack://light/./node_modules/multibase/src/rfc4648.js?"); + +/***/ }), + +/***/ "./node_modules/multibase/src/util.js": +/*!********************************************!*\ + !*** ./node_modules/multibase/src/util.js ***! + \********************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n\n\n//# sourceURL=webpack://light/./node_modules/multibase/src/util.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/varint/decode.js": +/*!****************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/varint/decode.js ***! + \****************************************************************/ +/***/ ((module) => { + +eval("module.exports = read\n\nvar MSB = 0x80\n , REST = 0x7F\n\nfunction read(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length\n\n do {\n if (counter >= l) {\n read.bytes = 0\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++]\n res += shift < 28\n ? (b & REST) << shift\n : (b & REST) * Math.pow(2, shift)\n shift += 7\n } while (b >= MSB)\n\n read.bytes = counter - offset\n\n return res\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/varint/decode.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/varint/encode.js": +/*!****************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/varint/encode.js ***! + \****************************************************************/ +/***/ ((module) => { + +eval("module.exports = encode\n\nvar MSB = 0x80\n , REST = 0x7F\n , MSBALL = ~REST\n , INT = Math.pow(2, 31)\n\nfunction encode(num, out, offset) {\n out = out || []\n offset = offset || 0\n var oldOffset = offset\n\n while(num >= INT) {\n out[offset++] = (num & 0xFF) | MSB\n num /= 128\n }\n while(num & MSBALL) {\n out[offset++] = (num & 0xFF) | MSB\n num >>>= 7\n }\n out[offset] = num | 0\n \n encode.bytes = offset - oldOffset + 1\n \n return out\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/varint/encode.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/varint/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/varint/index.js ***! + \***************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("module.exports = {\n encode: __webpack_require__(/*! ./encode.js */ \"./node_modules/multihashes/node_modules/varint/encode.js\")\n , decode: __webpack_require__(/*! ./decode.js */ \"./node_modules/multihashes/node_modules/varint/decode.js\")\n , encodingLength: __webpack_require__(/*! ./length.js */ \"./node_modules/multihashes/node_modules/varint/length.js\")\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/varint/index.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/varint/length.js": +/*!****************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/varint/length.js ***! + \****************************************************************/ +/***/ ((module) => { + +eval("\nvar N1 = Math.pow(2, 7)\nvar N2 = Math.pow(2, 14)\nvar N3 = Math.pow(2, 21)\nvar N4 = Math.pow(2, 28)\nvar N5 = Math.pow(2, 35)\nvar N6 = Math.pow(2, 42)\nvar N7 = Math.pow(2, 49)\nvar N8 = Math.pow(2, 56)\nvar N9 = Math.pow(2, 63)\n\nmodule.exports = function (value) {\n return (\n value < N1 ? 1\n : value < N2 ? 2\n : value < N3 ? 3\n : value < N4 ? 4\n : value < N5 ? 5\n : value < N6 ? 6\n : value < N7 ? 7\n : value < N8 ? 8\n : value < N9 ? 9\n : 10\n )\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/varint/length.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/src/constants.js": +/*!***************************************************!*\ + !*** ./node_modules/multihashes/src/constants.js ***! + \***************************************************/ +/***/ ((module) => { + +"use strict"; +eval("/* eslint quote-props: off */\n\n\n/**\n * Names for all available hashes\n *\n * @typedef { \"identity\" | \"sha1\" | \"sha2-256\" | \"sha2-512\" | \"sha3-512\" | \"sha3-384\" | \"sha3-256\" | \"sha3-224\" | \"shake-128\" | \"shake-256\" | \"keccak-224\" | \"keccak-256\" | \"keccak-384\" | \"keccak-512\" | \"blake3\" | \"murmur3-128\" | \"murmur3-32\" | \"dbl-sha2-256\" | \"md4\" | \"md5\" | \"bmt\" | \"sha2-256-trunc254-padded\" | \"ripemd-128\" | \"ripemd-160\" | \"ripemd-256\" | \"ripemd-320\" | \"x11\" | \"kangarootwelve\" | \"sm3-256\" | \"blake2b-8\" | \"blake2b-16\" | \"blake2b-24\" | \"blake2b-32\" | \"blake2b-40\" | \"blake2b-48\" | \"blake2b-56\" | \"blake2b-64\" | \"blake2b-72\" | \"blake2b-80\" | \"blake2b-88\" | \"blake2b-96\" | \"blake2b-104\" | \"blake2b-112\" | \"blake2b-120\" | \"blake2b-128\" | \"blake2b-136\" | \"blake2b-144\" | \"blake2b-152\" | \"blake2b-160\" | \"blake2b-168\" | \"blake2b-176\" | \"blake2b-184\" | \"blake2b-192\" | \"blake2b-200\" | \"blake2b-208\" | \"blake2b-216\" | \"blake2b-224\" | \"blake2b-232\" | \"blake2b-240\" | \"blake2b-248\" | \"blake2b-256\" | \"blake2b-264\" | \"blake2b-272\" | \"blake2b-280\" | \"blake2b-288\" | \"blake2b-296\" | \"blake2b-304\" | \"blake2b-312\" | \"blake2b-320\" | \"blake2b-328\" | \"blake2b-336\" | \"blake2b-344\" | \"blake2b-352\" | \"blake2b-360\" | \"blake2b-368\" | \"blake2b-376\" | \"blake2b-384\" | \"blake2b-392\" | \"blake2b-400\" | \"blake2b-408\" | \"blake2b-416\" | \"blake2b-424\" | \"blake2b-432\" | \"blake2b-440\" | \"blake2b-448\" | \"blake2b-456\" | \"blake2b-464\" | \"blake2b-472\" | \"blake2b-480\" | \"blake2b-488\" | \"blake2b-496\" | \"blake2b-504\" | \"blake2b-512\" | \"blake2s-8\" | \"blake2s-16\" | \"blake2s-24\" | \"blake2s-32\" | \"blake2s-40\" | \"blake2s-48\" | \"blake2s-56\" | \"blake2s-64\" | \"blake2s-72\" | \"blake2s-80\" | \"blake2s-88\" | \"blake2s-96\" | \"blake2s-104\" | \"blake2s-112\" | \"blake2s-120\" | \"blake2s-128\" | \"blake2s-136\" | \"blake2s-144\" | \"blake2s-152\" | \"blake2s-160\" | \"blake2s-168\" | \"blake2s-176\" | \"blake2s-184\" | \"blake2s-192\" | \"blake2s-200\" | \"blake2s-208\" | \"blake2s-216\" | \"blake2s-224\" | \"blake2s-232\" | \"blake2s-240\" | \"blake2s-248\" | \"blake2s-256\" | \"skein256-8\" | \"skein256-16\" | \"skein256-24\" | \"skein256-32\" | \"skein256-40\" | \"skein256-48\" | \"skein256-56\" | \"skein256-64\" | \"skein256-72\" | \"skein256-80\" | \"skein256-88\" | \"skein256-96\" | \"skein256-104\" | \"skein256-112\" | \"skein256-120\" | \"skein256-128\" | \"skein256-136\" | \"skein256-144\" | \"skein256-152\" | \"skein256-160\" | \"skein256-168\" | \"skein256-176\" | \"skein256-184\" | \"skein256-192\" | \"skein256-200\" | \"skein256-208\" | \"skein256-216\" | \"skein256-224\" | \"skein256-232\" | \"skein256-240\" | \"skein256-248\" | \"skein256-256\" | \"skein512-8\" | \"skein512-16\" | \"skein512-24\" | \"skein512-32\" | \"skein512-40\" | \"skein512-48\" | \"skein512-56\" | \"skein512-64\" | \"skein512-72\" | \"skein512-80\" | \"skein512-88\" | \"skein512-96\" | \"skein512-104\" | \"skein512-112\" | \"skein512-120\" | \"skein512-128\" | \"skein512-136\" | \"skein512-144\" | \"skein512-152\" | \"skein512-160\" | \"skein512-168\" | \"skein512-176\" | \"skein512-184\" | \"skein512-192\" | \"skein512-200\" | \"skein512-208\" | \"skein512-216\" | \"skein512-224\" | \"skein512-232\" | \"skein512-240\" | \"skein512-248\" | \"skein512-256\" | \"skein512-264\" | \"skein512-272\" | \"skein512-280\" | \"skein512-288\" | \"skein512-296\" | \"skein512-304\" | \"skein512-312\" | \"skein512-320\" | \"skein512-328\" | \"skein512-336\" | \"skein512-344\" | \"skein512-352\" | \"skein512-360\" | \"skein512-368\" | \"skein512-376\" | \"skein512-384\" | \"skein512-392\" | \"skein512-400\" | \"skein512-408\" | \"skein512-416\" | \"skein512-424\" | \"skein512-432\" | \"skein512-440\" | \"skein512-448\" | \"skein512-456\" | \"skein512-464\" | \"skein512-472\" | \"skein512-480\" | \"skein512-488\" | \"skein512-496\" | \"skein512-504\" | \"skein512-512\" | \"skein1024-8\" | \"skein1024-16\" | \"skein1024-24\" | \"skein1024-32\" | \"skein1024-40\" | \"skein1024-48\" | \"skein1024-56\" | \"skein1024-64\" | \"skein1024-72\" | \"skein1024-80\" | \"skein1024-88\" | \"skein1024-96\" | \"skein1024-104\" | \"skein1024-112\" | \"skein1024-120\" | \"skein1024-128\" | \"skein1024-136\" | \"skein1024-144\" | \"skein1024-152\" | \"skein1024-160\" | \"skein1024-168\" | \"skein1024-176\" | \"skein1024-184\" | \"skein1024-192\" | \"skein1024-200\" | \"skein1024-208\" | \"skein1024-216\" | \"skein1024-224\" | \"skein1024-232\" | \"skein1024-240\" | \"skein1024-248\" | \"skein1024-256\" | \"skein1024-264\" | \"skein1024-272\" | \"skein1024-280\" | \"skein1024-288\" | \"skein1024-296\" | \"skein1024-304\" | \"skein1024-312\" | \"skein1024-320\" | \"skein1024-328\" | \"skein1024-336\" | \"skein1024-344\" | \"skein1024-352\" | \"skein1024-360\" | \"skein1024-368\" | \"skein1024-376\" | \"skein1024-384\" | \"skein1024-392\" | \"skein1024-400\" | \"skein1024-408\" | \"skein1024-416\" | \"skein1024-424\" | \"skein1024-432\" | \"skein1024-440\" | \"skein1024-448\" | \"skein1024-456\" | \"skein1024-464\" | \"skein1024-472\" | \"skein1024-480\" | \"skein1024-488\" | \"skein1024-496\" | \"skein1024-504\" | \"skein1024-512\" | \"skein1024-520\" | \"skein1024-528\" | \"skein1024-536\" | \"skein1024-544\" | \"skein1024-552\" | \"skein1024-560\" | \"skein1024-568\" | \"skein1024-576\" | \"skein1024-584\" | \"skein1024-592\" | \"skein1024-600\" | \"skein1024-608\" | \"skein1024-616\" | \"skein1024-624\" | \"skein1024-632\" | \"skein1024-640\" | \"skein1024-648\" | \"skein1024-656\" | \"skein1024-664\" | \"skein1024-672\" | \"skein1024-680\" | \"skein1024-688\" | \"skein1024-696\" | \"skein1024-704\" | \"skein1024-712\" | \"skein1024-720\" | \"skein1024-728\" | \"skein1024-736\" | \"skein1024-744\" | \"skein1024-752\" | \"skein1024-760\" | \"skein1024-768\" | \"skein1024-776\" | \"skein1024-784\" | \"skein1024-792\" | \"skein1024-800\" | \"skein1024-808\" | \"skein1024-816\" | \"skein1024-824\" | \"skein1024-832\" | \"skein1024-840\" | \"skein1024-848\" | \"skein1024-856\" | \"skein1024-864\" | \"skein1024-872\" | \"skein1024-880\" | \"skein1024-888\" | \"skein1024-896\" | \"skein1024-904\" | \"skein1024-912\" | \"skein1024-920\" | \"skein1024-928\" | \"skein1024-936\" | \"skein1024-944\" | \"skein1024-952\" | \"skein1024-960\" | \"skein1024-968\" | \"skein1024-976\" | \"skein1024-984\" | \"skein1024-992\" | \"skein1024-1000\" | \"skein1024-1008\" | \"skein1024-1016\" | \"skein1024-1024\" | \"poseidon-bls12_381-a2-fc1\" | \"poseidon-bls12_381-a2-fc1-sc\" } HashName\n */\n/**\n * Codes for all available hashes\n *\n * @typedef { 0x00 | 0x11 | 0x12 | 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1a | 0x1b | 0x1c | 0x1d | 0x1e | 0x22 | 0x23 | 0x56 | 0xd4 | 0xd5 | 0xd6 | 0x1012 | 0x1052 | 0x1053 | 0x1054 | 0x1055 | 0x1100 | 0x1d01 | 0x534d | 0xb201 | 0xb202 | 0xb203 | 0xb204 | 0xb205 | 0xb206 | 0xb207 | 0xb208 | 0xb209 | 0xb20a | 0xb20b | 0xb20c | 0xb20d | 0xb20e | 0xb20f | 0xb210 | 0xb211 | 0xb212 | 0xb213 | 0xb214 | 0xb215 | 0xb216 | 0xb217 | 0xb218 | 0xb219 | 0xb21a | 0xb21b | 0xb21c | 0xb21d | 0xb21e | 0xb21f | 0xb220 | 0xb221 | 0xb222 | 0xb223 | 0xb224 | 0xb225 | 0xb226 | 0xb227 | 0xb228 | 0xb229 | 0xb22a | 0xb22b | 0xb22c | 0xb22d | 0xb22e | 0xb22f | 0xb230 | 0xb231 | 0xb232 | 0xb233 | 0xb234 | 0xb235 | 0xb236 | 0xb237 | 0xb238 | 0xb239 | 0xb23a | 0xb23b | 0xb23c | 0xb23d | 0xb23e | 0xb23f | 0xb240 | 0xb241 | 0xb242 | 0xb243 | 0xb244 | 0xb245 | 0xb246 | 0xb247 | 0xb248 | 0xb249 | 0xb24a | 0xb24b | 0xb24c | 0xb24d | 0xb24e | 0xb24f | 0xb250 | 0xb251 | 0xb252 | 0xb253 | 0xb254 | 0xb255 | 0xb256 | 0xb257 | 0xb258 | 0xb259 | 0xb25a | 0xb25b | 0xb25c | 0xb25d | 0xb25e | 0xb25f | 0xb260 | 0xb301 | 0xb302 | 0xb303 | 0xb304 | 0xb305 | 0xb306 | 0xb307 | 0xb308 | 0xb309 | 0xb30a | 0xb30b | 0xb30c | 0xb30d | 0xb30e | 0xb30f | 0xb310 | 0xb311 | 0xb312 | 0xb313 | 0xb314 | 0xb315 | 0xb316 | 0xb317 | 0xb318 | 0xb319 | 0xb31a | 0xb31b | 0xb31c | 0xb31d | 0xb31e | 0xb31f | 0xb320 | 0xb321 | 0xb322 | 0xb323 | 0xb324 | 0xb325 | 0xb326 | 0xb327 | 0xb328 | 0xb329 | 0xb32a | 0xb32b | 0xb32c | 0xb32d | 0xb32e | 0xb32f | 0xb330 | 0xb331 | 0xb332 | 0xb333 | 0xb334 | 0xb335 | 0xb336 | 0xb337 | 0xb338 | 0xb339 | 0xb33a | 0xb33b | 0xb33c | 0xb33d | 0xb33e | 0xb33f | 0xb340 | 0xb341 | 0xb342 | 0xb343 | 0xb344 | 0xb345 | 0xb346 | 0xb347 | 0xb348 | 0xb349 | 0xb34a | 0xb34b | 0xb34c | 0xb34d | 0xb34e | 0xb34f | 0xb350 | 0xb351 | 0xb352 | 0xb353 | 0xb354 | 0xb355 | 0xb356 | 0xb357 | 0xb358 | 0xb359 | 0xb35a | 0xb35b | 0xb35c | 0xb35d | 0xb35e | 0xb35f | 0xb360 | 0xb361 | 0xb362 | 0xb363 | 0xb364 | 0xb365 | 0xb366 | 0xb367 | 0xb368 | 0xb369 | 0xb36a | 0xb36b | 0xb36c | 0xb36d | 0xb36e | 0xb36f | 0xb370 | 0xb371 | 0xb372 | 0xb373 | 0xb374 | 0xb375 | 0xb376 | 0xb377 | 0xb378 | 0xb379 | 0xb37a | 0xb37b | 0xb37c | 0xb37d | 0xb37e | 0xb37f | 0xb380 | 0xb381 | 0xb382 | 0xb383 | 0xb384 | 0xb385 | 0xb386 | 0xb387 | 0xb388 | 0xb389 | 0xb38a | 0xb38b | 0xb38c | 0xb38d | 0xb38e | 0xb38f | 0xb390 | 0xb391 | 0xb392 | 0xb393 | 0xb394 | 0xb395 | 0xb396 | 0xb397 | 0xb398 | 0xb399 | 0xb39a | 0xb39b | 0xb39c | 0xb39d | 0xb39e | 0xb39f | 0xb3a0 | 0xb3a1 | 0xb3a2 | 0xb3a3 | 0xb3a4 | 0xb3a5 | 0xb3a6 | 0xb3a7 | 0xb3a8 | 0xb3a9 | 0xb3aa | 0xb3ab | 0xb3ac | 0xb3ad | 0xb3ae | 0xb3af | 0xb3b0 | 0xb3b1 | 0xb3b2 | 0xb3b3 | 0xb3b4 | 0xb3b5 | 0xb3b6 | 0xb3b7 | 0xb3b8 | 0xb3b9 | 0xb3ba | 0xb3bb | 0xb3bc | 0xb3bd | 0xb3be | 0xb3bf | 0xb3c0 | 0xb3c1 | 0xb3c2 | 0xb3c3 | 0xb3c4 | 0xb3c5 | 0xb3c6 | 0xb3c7 | 0xb3c8 | 0xb3c9 | 0xb3ca | 0xb3cb | 0xb3cc | 0xb3cd | 0xb3ce | 0xb3cf | 0xb3d0 | 0xb3d1 | 0xb3d2 | 0xb3d3 | 0xb3d4 | 0xb3d5 | 0xb3d6 | 0xb3d7 | 0xb3d8 | 0xb3d9 | 0xb3da | 0xb3db | 0xb3dc | 0xb3dd | 0xb3de | 0xb3df | 0xb3e0 | 0xb401 | 0xb402 } HashCode\n */\n\n/**\n * @type { Record }\n */\nconst names = Object.freeze({\n 'identity': 0x00,\n 'sha1': 0x11,\n 'sha2-256': 0x12,\n 'sha2-512': 0x13,\n 'sha3-512': 0x14,\n 'sha3-384': 0x15,\n 'sha3-256': 0x16,\n 'sha3-224': 0x17,\n 'shake-128': 0x18,\n 'shake-256': 0x19,\n 'keccak-224': 0x1a,\n 'keccak-256': 0x1b,\n 'keccak-384': 0x1c,\n 'keccak-512': 0x1d,\n 'blake3': 0x1e,\n 'murmur3-128': 0x22,\n 'murmur3-32': 0x23,\n 'dbl-sha2-256': 0x56,\n 'md4': 0xd4,\n 'md5': 0xd5,\n 'bmt': 0xd6,\n 'sha2-256-trunc254-padded': 0x1012,\n 'ripemd-128': 0x1052,\n 'ripemd-160': 0x1053,\n 'ripemd-256': 0x1054,\n 'ripemd-320': 0x1055,\n 'x11': 0x1100,\n 'kangarootwelve': 0x1d01,\n 'sm3-256': 0x534d,\n 'blake2b-8': 0xb201,\n 'blake2b-16': 0xb202,\n 'blake2b-24': 0xb203,\n 'blake2b-32': 0xb204,\n 'blake2b-40': 0xb205,\n 'blake2b-48': 0xb206,\n 'blake2b-56': 0xb207,\n 'blake2b-64': 0xb208,\n 'blake2b-72': 0xb209,\n 'blake2b-80': 0xb20a,\n 'blake2b-88': 0xb20b,\n 'blake2b-96': 0xb20c,\n 'blake2b-104': 0xb20d,\n 'blake2b-112': 0xb20e,\n 'blake2b-120': 0xb20f,\n 'blake2b-128': 0xb210,\n 'blake2b-136': 0xb211,\n 'blake2b-144': 0xb212,\n 'blake2b-152': 0xb213,\n 'blake2b-160': 0xb214,\n 'blake2b-168': 0xb215,\n 'blake2b-176': 0xb216,\n 'blake2b-184': 0xb217,\n 'blake2b-192': 0xb218,\n 'blake2b-200': 0xb219,\n 'blake2b-208': 0xb21a,\n 'blake2b-216': 0xb21b,\n 'blake2b-224': 0xb21c,\n 'blake2b-232': 0xb21d,\n 'blake2b-240': 0xb21e,\n 'blake2b-248': 0xb21f,\n 'blake2b-256': 0xb220,\n 'blake2b-264': 0xb221,\n 'blake2b-272': 0xb222,\n 'blake2b-280': 0xb223,\n 'blake2b-288': 0xb224,\n 'blake2b-296': 0xb225,\n 'blake2b-304': 0xb226,\n 'blake2b-312': 0xb227,\n 'blake2b-320': 0xb228,\n 'blake2b-328': 0xb229,\n 'blake2b-336': 0xb22a,\n 'blake2b-344': 0xb22b,\n 'blake2b-352': 0xb22c,\n 'blake2b-360': 0xb22d,\n 'blake2b-368': 0xb22e,\n 'blake2b-376': 0xb22f,\n 'blake2b-384': 0xb230,\n 'blake2b-392': 0xb231,\n 'blake2b-400': 0xb232,\n 'blake2b-408': 0xb233,\n 'blake2b-416': 0xb234,\n 'blake2b-424': 0xb235,\n 'blake2b-432': 0xb236,\n 'blake2b-440': 0xb237,\n 'blake2b-448': 0xb238,\n 'blake2b-456': 0xb239,\n 'blake2b-464': 0xb23a,\n 'blake2b-472': 0xb23b,\n 'blake2b-480': 0xb23c,\n 'blake2b-488': 0xb23d,\n 'blake2b-496': 0xb23e,\n 'blake2b-504': 0xb23f,\n 'blake2b-512': 0xb240,\n 'blake2s-8': 0xb241,\n 'blake2s-16': 0xb242,\n 'blake2s-24': 0xb243,\n 'blake2s-32': 0xb244,\n 'blake2s-40': 0xb245,\n 'blake2s-48': 0xb246,\n 'blake2s-56': 0xb247,\n 'blake2s-64': 0xb248,\n 'blake2s-72': 0xb249,\n 'blake2s-80': 0xb24a,\n 'blake2s-88': 0xb24b,\n 'blake2s-96': 0xb24c,\n 'blake2s-104': 0xb24d,\n 'blake2s-112': 0xb24e,\n 'blake2s-120': 0xb24f,\n 'blake2s-128': 0xb250,\n 'blake2s-136': 0xb251,\n 'blake2s-144': 0xb252,\n 'blake2s-152': 0xb253,\n 'blake2s-160': 0xb254,\n 'blake2s-168': 0xb255,\n 'blake2s-176': 0xb256,\n 'blake2s-184': 0xb257,\n 'blake2s-192': 0xb258,\n 'blake2s-200': 0xb259,\n 'blake2s-208': 0xb25a,\n 'blake2s-216': 0xb25b,\n 'blake2s-224': 0xb25c,\n 'blake2s-232': 0xb25d,\n 'blake2s-240': 0xb25e,\n 'blake2s-248': 0xb25f,\n 'blake2s-256': 0xb260,\n 'skein256-8': 0xb301,\n 'skein256-16': 0xb302,\n 'skein256-24': 0xb303,\n 'skein256-32': 0xb304,\n 'skein256-40': 0xb305,\n 'skein256-48': 0xb306,\n 'skein256-56': 0xb307,\n 'skein256-64': 0xb308,\n 'skein256-72': 0xb309,\n 'skein256-80': 0xb30a,\n 'skein256-88': 0xb30b,\n 'skein256-96': 0xb30c,\n 'skein256-104': 0xb30d,\n 'skein256-112': 0xb30e,\n 'skein256-120': 0xb30f,\n 'skein256-128': 0xb310,\n 'skein256-136': 0xb311,\n 'skein256-144': 0xb312,\n 'skein256-152': 0xb313,\n 'skein256-160': 0xb314,\n 'skein256-168': 0xb315,\n 'skein256-176': 0xb316,\n 'skein256-184': 0xb317,\n 'skein256-192': 0xb318,\n 'skein256-200': 0xb319,\n 'skein256-208': 0xb31a,\n 'skein256-216': 0xb31b,\n 'skein256-224': 0xb31c,\n 'skein256-232': 0xb31d,\n 'skein256-240': 0xb31e,\n 'skein256-248': 0xb31f,\n 'skein256-256': 0xb320,\n 'skein512-8': 0xb321,\n 'skein512-16': 0xb322,\n 'skein512-24': 0xb323,\n 'skein512-32': 0xb324,\n 'skein512-40': 0xb325,\n 'skein512-48': 0xb326,\n 'skein512-56': 0xb327,\n 'skein512-64': 0xb328,\n 'skein512-72': 0xb329,\n 'skein512-80': 0xb32a,\n 'skein512-88': 0xb32b,\n 'skein512-96': 0xb32c,\n 'skein512-104': 0xb32d,\n 'skein512-112': 0xb32e,\n 'skein512-120': 0xb32f,\n 'skein512-128': 0xb330,\n 'skein512-136': 0xb331,\n 'skein512-144': 0xb332,\n 'skein512-152': 0xb333,\n 'skein512-160': 0xb334,\n 'skein512-168': 0xb335,\n 'skein512-176': 0xb336,\n 'skein512-184': 0xb337,\n 'skein512-192': 0xb338,\n 'skein512-200': 0xb339,\n 'skein512-208': 0xb33a,\n 'skein512-216': 0xb33b,\n 'skein512-224': 0xb33c,\n 'skein512-232': 0xb33d,\n 'skein512-240': 0xb33e,\n 'skein512-248': 0xb33f,\n 'skein512-256': 0xb340,\n 'skein512-264': 0xb341,\n 'skein512-272': 0xb342,\n 'skein512-280': 0xb343,\n 'skein512-288': 0xb344,\n 'skein512-296': 0xb345,\n 'skein512-304': 0xb346,\n 'skein512-312': 0xb347,\n 'skein512-320': 0xb348,\n 'skein512-328': 0xb349,\n 'skein512-336': 0xb34a,\n 'skein512-344': 0xb34b,\n 'skein512-352': 0xb34c,\n 'skein512-360': 0xb34d,\n 'skein512-368': 0xb34e,\n 'skein512-376': 0xb34f,\n 'skein512-384': 0xb350,\n 'skein512-392': 0xb351,\n 'skein512-400': 0xb352,\n 'skein512-408': 0xb353,\n 'skein512-416': 0xb354,\n 'skein512-424': 0xb355,\n 'skein512-432': 0xb356,\n 'skein512-440': 0xb357,\n 'skein512-448': 0xb358,\n 'skein512-456': 0xb359,\n 'skein512-464': 0xb35a,\n 'skein512-472': 0xb35b,\n 'skein512-480': 0xb35c,\n 'skein512-488': 0xb35d,\n 'skein512-496': 0xb35e,\n 'skein512-504': 0xb35f,\n 'skein512-512': 0xb360,\n 'skein1024-8': 0xb361,\n 'skein1024-16': 0xb362,\n 'skein1024-24': 0xb363,\n 'skein1024-32': 0xb364,\n 'skein1024-40': 0xb365,\n 'skein1024-48': 0xb366,\n 'skein1024-56': 0xb367,\n 'skein1024-64': 0xb368,\n 'skein1024-72': 0xb369,\n 'skein1024-80': 0xb36a,\n 'skein1024-88': 0xb36b,\n 'skein1024-96': 0xb36c,\n 'skein1024-104': 0xb36d,\n 'skein1024-112': 0xb36e,\n 'skein1024-120': 0xb36f,\n 'skein1024-128': 0xb370,\n 'skein1024-136': 0xb371,\n 'skein1024-144': 0xb372,\n 'skein1024-152': 0xb373,\n 'skein1024-160': 0xb374,\n 'skein1024-168': 0xb375,\n 'skein1024-176': 0xb376,\n 'skein1024-184': 0xb377,\n 'skein1024-192': 0xb378,\n 'skein1024-200': 0xb379,\n 'skein1024-208': 0xb37a,\n 'skein1024-216': 0xb37b,\n 'skein1024-224': 0xb37c,\n 'skein1024-232': 0xb37d,\n 'skein1024-240': 0xb37e,\n 'skein1024-248': 0xb37f,\n 'skein1024-256': 0xb380,\n 'skein1024-264': 0xb381,\n 'skein1024-272': 0xb382,\n 'skein1024-280': 0xb383,\n 'skein1024-288': 0xb384,\n 'skein1024-296': 0xb385,\n 'skein1024-304': 0xb386,\n 'skein1024-312': 0xb387,\n 'skein1024-320': 0xb388,\n 'skein1024-328': 0xb389,\n 'skein1024-336': 0xb38a,\n 'skein1024-344': 0xb38b,\n 'skein1024-352': 0xb38c,\n 'skein1024-360': 0xb38d,\n 'skein1024-368': 0xb38e,\n 'skein1024-376': 0xb38f,\n 'skein1024-384': 0xb390,\n 'skein1024-392': 0xb391,\n 'skein1024-400': 0xb392,\n 'skein1024-408': 0xb393,\n 'skein1024-416': 0xb394,\n 'skein1024-424': 0xb395,\n 'skein1024-432': 0xb396,\n 'skein1024-440': 0xb397,\n 'skein1024-448': 0xb398,\n 'skein1024-456': 0xb399,\n 'skein1024-464': 0xb39a,\n 'skein1024-472': 0xb39b,\n 'skein1024-480': 0xb39c,\n 'skein1024-488': 0xb39d,\n 'skein1024-496': 0xb39e,\n 'skein1024-504': 0xb39f,\n 'skein1024-512': 0xb3a0,\n 'skein1024-520': 0xb3a1,\n 'skein1024-528': 0xb3a2,\n 'skein1024-536': 0xb3a3,\n 'skein1024-544': 0xb3a4,\n 'skein1024-552': 0xb3a5,\n 'skein1024-560': 0xb3a6,\n 'skein1024-568': 0xb3a7,\n 'skein1024-576': 0xb3a8,\n 'skein1024-584': 0xb3a9,\n 'skein1024-592': 0xb3aa,\n 'skein1024-600': 0xb3ab,\n 'skein1024-608': 0xb3ac,\n 'skein1024-616': 0xb3ad,\n 'skein1024-624': 0xb3ae,\n 'skein1024-632': 0xb3af,\n 'skein1024-640': 0xb3b0,\n 'skein1024-648': 0xb3b1,\n 'skein1024-656': 0xb3b2,\n 'skein1024-664': 0xb3b3,\n 'skein1024-672': 0xb3b4,\n 'skein1024-680': 0xb3b5,\n 'skein1024-688': 0xb3b6,\n 'skein1024-696': 0xb3b7,\n 'skein1024-704': 0xb3b8,\n 'skein1024-712': 0xb3b9,\n 'skein1024-720': 0xb3ba,\n 'skein1024-728': 0xb3bb,\n 'skein1024-736': 0xb3bc,\n 'skein1024-744': 0xb3bd,\n 'skein1024-752': 0xb3be,\n 'skein1024-760': 0xb3bf,\n 'skein1024-768': 0xb3c0,\n 'skein1024-776': 0xb3c1,\n 'skein1024-784': 0xb3c2,\n 'skein1024-792': 0xb3c3,\n 'skein1024-800': 0xb3c4,\n 'skein1024-808': 0xb3c5,\n 'skein1024-816': 0xb3c6,\n 'skein1024-824': 0xb3c7,\n 'skein1024-832': 0xb3c8,\n 'skein1024-840': 0xb3c9,\n 'skein1024-848': 0xb3ca,\n 'skein1024-856': 0xb3cb,\n 'skein1024-864': 0xb3cc,\n 'skein1024-872': 0xb3cd,\n 'skein1024-880': 0xb3ce,\n 'skein1024-888': 0xb3cf,\n 'skein1024-896': 0xb3d0,\n 'skein1024-904': 0xb3d1,\n 'skein1024-912': 0xb3d2,\n 'skein1024-920': 0xb3d3,\n 'skein1024-928': 0xb3d4,\n 'skein1024-936': 0xb3d5,\n 'skein1024-944': 0xb3d6,\n 'skein1024-952': 0xb3d7,\n 'skein1024-960': 0xb3d8,\n 'skein1024-968': 0xb3d9,\n 'skein1024-976': 0xb3da,\n 'skein1024-984': 0xb3db,\n 'skein1024-992': 0xb3dc,\n 'skein1024-1000': 0xb3dd,\n 'skein1024-1008': 0xb3de,\n 'skein1024-1016': 0xb3df,\n 'skein1024-1024': 0xb3e0,\n 'poseidon-bls12_381-a2-fc1': 0xb401,\n 'poseidon-bls12_381-a2-fc1-sc': 0xb402\n})\n\nmodule.exports = { names }\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/src/index.js": +/*!***********************************************!*\ + !*** ./node_modules/multihashes/src/index.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("/**\n * Multihash implementation in JavaScript.\n */\n\n\nconst multibase = __webpack_require__(/*! multibase */ \"./node_modules/multibase/src/index.js\")\nconst varint = __webpack_require__(/*! varint */ \"./node_modules/multihashes/node_modules/varint/index.js\")\nconst { names } = __webpack_require__(/*! ./constants */ \"./node_modules/multihashes/src/constants.js\")\nconst { toString: uint8ArrayToString } = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/to-string.js\")\nconst { fromString: uint8ArrayFromString } = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/from-string.js\")\nconst { concat: uint8ArrayConcat } = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/concat.js\")\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\nObject.freeze(codes)\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes,\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/netmask/lib/netmask.js": +/*!*********************************************!*\ + !*** ./node_modules/netmask/lib/netmask.js ***! + \*********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var Netmask, atob, chr, chr0, chrA, chra, ip2long, long2ip;\n\n long2ip = function(long) {\n var a, b, c, d;\n a = (long & (0xff << 24)) >>> 24;\n b = (long & (0xff << 16)) >>> 16;\n c = (long & (0xff << 8)) >>> 8;\n d = long & 0xff;\n return [a, b, c, d].join('.');\n };\n\n ip2long = function(ip) {\n var b, c, i, j, n, ref;\n b = [];\n for (i = j = 0; j <= 3; i = ++j) {\n if (ip.length === 0) {\n break;\n }\n if (i > 0) {\n if (ip[0] !== '.') {\n throw new Error('Invalid IP');\n }\n ip = ip.substring(1);\n }\n ref = atob(ip), n = ref[0], c = ref[1];\n ip = ip.substring(c);\n b.push(n);\n }\n if (ip.length !== 0) {\n throw new Error('Invalid IP');\n }\n switch (b.length) {\n case 1:\n if (b[0] > 0xFFFFFFFF) {\n throw new Error('Invalid IP');\n }\n return b[0] >>> 0;\n case 2:\n if (b[0] > 0xFF || b[1] > 0xFFFFFF) {\n throw new Error('Invalid IP');\n }\n return (b[0] << 24 | b[1]) >>> 0;\n case 3:\n if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFFFF) {\n throw new Error('Invalid IP');\n }\n return (b[0] << 24 | b[1] << 16 | b[2]) >>> 0;\n case 4:\n if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFF || b[3] > 0xFF) {\n throw new Error('Invalid IP');\n }\n return (b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]) >>> 0;\n default:\n throw new Error('Invalid IP');\n }\n };\n\n chr = function(b) {\n return b.charCodeAt(0);\n };\n\n chr0 = chr('0');\n\n chra = chr('a');\n\n chrA = chr('A');\n\n atob = function(s) {\n var base, dmax, i, n, start;\n n = 0;\n base = 10;\n dmax = '9';\n i = 0;\n if (s.length > 1 && s[i] === '0') {\n if (s[i + 1] === 'x' || s[i + 1] === 'X') {\n i += 2;\n base = 16;\n } else if ('0' <= s[i + 1] && s[i + 1] <= '9') {\n i++;\n base = 8;\n dmax = '7';\n }\n }\n start = i;\n while (i < s.length) {\n if ('0' <= s[i] && s[i] <= dmax) {\n n = (n * base + (chr(s[i]) - chr0)) >>> 0;\n } else if (base === 16) {\n if ('a' <= s[i] && s[i] <= 'f') {\n n = (n * base + (10 + chr(s[i]) - chra)) >>> 0;\n } else if ('A' <= s[i] && s[i] <= 'F') {\n n = (n * base + (10 + chr(s[i]) - chrA)) >>> 0;\n } else {\n break;\n }\n } else {\n break;\n }\n if (n > 0xFFFFFFFF) {\n throw new Error('too large');\n }\n i++;\n }\n if (i === start) {\n throw new Error('empty octet');\n }\n return [n, i];\n };\n\n Netmask = (function() {\n function Netmask(net, mask) {\n var error, i, j, ref;\n if (typeof net !== 'string') {\n throw new Error(\"Missing `net' parameter\");\n }\n if (!mask) {\n ref = net.split('/', 2), net = ref[0], mask = ref[1];\n }\n if (!mask) {\n mask = 32;\n }\n if (typeof mask === 'string' && mask.indexOf('.') > -1) {\n try {\n this.maskLong = ip2long(mask);\n } catch (error1) {\n error = error1;\n throw new Error(\"Invalid mask: \" + mask);\n }\n for (i = j = 32; j >= 0; i = --j) {\n if (this.maskLong === (0xffffffff << (32 - i)) >>> 0) {\n this.bitmask = i;\n break;\n }\n }\n } else if (mask || mask === 0) {\n this.bitmask = parseInt(mask, 10);\n this.maskLong = 0;\n if (this.bitmask > 0) {\n this.maskLong = (0xffffffff << (32 - this.bitmask)) >>> 0;\n }\n } else {\n throw new Error(\"Invalid mask: empty\");\n }\n try {\n this.netLong = (ip2long(net) & this.maskLong) >>> 0;\n } catch (error1) {\n error = error1;\n throw new Error(\"Invalid net address: \" + net);\n }\n if (!(this.bitmask <= 32)) {\n throw new Error(\"Invalid mask for ip4: \" + mask);\n }\n this.size = Math.pow(2, 32 - this.bitmask);\n this.base = long2ip(this.netLong);\n this.mask = long2ip(this.maskLong);\n this.hostmask = long2ip(~this.maskLong);\n this.first = this.bitmask <= 30 ? long2ip(this.netLong + 1) : this.base;\n this.last = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 2) : long2ip(this.netLong + this.size - 1);\n this.broadcast = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 1) : void 0;\n }\n\n Netmask.prototype.contains = function(ip) {\n if (typeof ip === 'string' && (ip.indexOf('/') > 0 || ip.split('.').length !== 4)) {\n ip = new Netmask(ip);\n }\n if (ip instanceof Netmask) {\n return this.contains(ip.base) && this.contains(ip.broadcast || ip.last);\n } else {\n return (ip2long(ip) & this.maskLong) >>> 0 === (this.netLong & this.maskLong) >>> 0;\n }\n };\n\n Netmask.prototype.next = function(count) {\n if (count == null) {\n count = 1;\n }\n return new Netmask(long2ip(this.netLong + (this.size * count)), this.mask);\n };\n\n Netmask.prototype.forEach = function(fn) {\n var index, lastLong, long;\n long = ip2long(this.first);\n lastLong = ip2long(this.last);\n index = 0;\n while (long <= lastLong) {\n fn(long2ip(long), long, index);\n index++;\n long++;\n }\n };\n\n Netmask.prototype.toString = function() {\n return this.base + \"/\" + this.bitmask;\n };\n\n return Netmask;\n\n })();\n\n exports.ip2long = ip2long;\n\n exports.long2ip = long2ip;\n\n exports.Netmask = Netmask;\n\n}).call(this);\n\n\n//# sourceURL=webpack://light/./node_modules/netmask/lib/netmask.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/aes.js": +/*!********************************************!*\ + !*** ./node_modules/node-forge/lib/aes.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Advanced Encryption Standard (AES) implementation.\n *\n * This implementation is based on the public domain library 'jscrypto' which\n * was written by:\n *\n * Emily Stark (estark@stanford.edu)\n * Mike Hamburg (mhamburg@stanford.edu)\n * Dan Boneh (dabo@cs.stanford.edu)\n *\n * Parts of this code are based on the OpenSSL implementation of AES:\n * http://www.openssl.org\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./cipher */ \"./node_modules/node-forge/lib/cipher.js\");\n__webpack_require__(/*! ./cipherModes */ \"./node_modules/node-forge/lib/cipherModes.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n/* AES API */\nmodule.exports = forge.aes = forge.aes || {};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('AES-', key);\n * cipher.start({iv: iv});\n *\n * Creates an AES cipher object to encrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as a string of bytes, an array of bytes,\n * a byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.startEncrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: false,\n mode: mode\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('AES-', key);\n *\n * Creates an AES cipher object to encrypt data using the given symmetric key.\n *\n * The key may be given as a string of bytes, an array of bytes, a\n * byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.createEncryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: false,\n mode: mode\n });\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('AES-', key);\n * decipher.start({iv: iv});\n *\n * Creates an AES cipher object to decrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as a string of bytes, an array of bytes,\n * a byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.startDecrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: true,\n mode: mode\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('AES-', key);\n *\n * Creates an AES cipher object to decrypt data using the given symmetric key.\n *\n * The key may be given as a string of bytes, an array of bytes, a\n * byte buffer, or an array of 32-bit words.\n *\n * @param key the symmetric key to use.\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.aes.createDecryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: true,\n mode: mode\n });\n};\n\n/**\n * Creates a new AES cipher algorithm object.\n *\n * @param name the name of the algorithm.\n * @param mode the mode factory function.\n *\n * @return the AES algorithm object.\n */\nforge.aes.Algorithm = function(name, mode) {\n if(!init) {\n initialize();\n }\n var self = this;\n self.name = name;\n self.mode = new mode({\n blockSize: 16,\n cipher: {\n encrypt: function(inBlock, outBlock) {\n return _updateBlock(self._w, inBlock, outBlock, false);\n },\n decrypt: function(inBlock, outBlock) {\n return _updateBlock(self._w, inBlock, outBlock, true);\n }\n }\n });\n self._init = false;\n};\n\n/**\n * Initializes this AES algorithm by expanding its key.\n *\n * @param options the options to use.\n * key the key to use with this algorithm.\n * decrypt true if the algorithm should be initialized for decryption,\n * false for encryption.\n */\nforge.aes.Algorithm.prototype.initialize = function(options) {\n if(this._init) {\n return;\n }\n\n var key = options.key;\n var tmp;\n\n /* Note: The key may be a string of bytes, an array of bytes, a byte\n buffer, or an array of 32-bit integers. If the key is in bytes, then\n it must be 16, 24, or 32 bytes in length. If it is in 32-bit\n integers, it must be 4, 6, or 8 integers long. */\n\n if(typeof key === 'string' &&\n (key.length === 16 || key.length === 24 || key.length === 32)) {\n // convert key string into byte buffer\n key = forge.util.createBuffer(key);\n } else if(forge.util.isArray(key) &&\n (key.length === 16 || key.length === 24 || key.length === 32)) {\n // convert key integer array into byte buffer\n tmp = key;\n key = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n key.putByte(tmp[i]);\n }\n }\n\n // convert key byte buffer into 32-bit integer array\n if(!forge.util.isArray(key)) {\n tmp = key;\n key = [];\n\n // key lengths of 16, 24, 32 bytes allowed\n var len = tmp.length();\n if(len === 16 || len === 24 || len === 32) {\n len = len >>> 2;\n for(var i = 0; i < len; ++i) {\n key.push(tmp.getInt32());\n }\n }\n }\n\n // key must be an array of 32-bit integers by now\n if(!forge.util.isArray(key) ||\n !(key.length === 4 || key.length === 6 || key.length === 8)) {\n throw new Error('Invalid key parameter.');\n }\n\n // encryption operation is always used for these modes\n var mode = this.mode.name;\n var encryptOp = (['CFB', 'OFB', 'CTR', 'GCM'].indexOf(mode) !== -1);\n\n // do key expansion\n this._w = _expandKey(key, options.decrypt && !encryptOp);\n this._init = true;\n};\n\n/**\n * Expands a key. Typically only used for testing.\n *\n * @param key the symmetric key to expand, as an array of 32-bit words.\n * @param decrypt true to expand for decryption, false for encryption.\n *\n * @return the expanded key.\n */\nforge.aes._expandKey = function(key, decrypt) {\n if(!init) {\n initialize();\n }\n return _expandKey(key, decrypt);\n};\n\n/**\n * Updates a single block. Typically only used for testing.\n *\n * @param w the expanded key to use.\n * @param input an array of block-size 32-bit words.\n * @param output an array of block-size 32-bit words.\n * @param decrypt true to decrypt, false to encrypt.\n */\nforge.aes._updateBlock = _updateBlock;\n\n/** Register AES algorithms **/\n\nregisterAlgorithm('AES-ECB', forge.cipher.modes.ecb);\nregisterAlgorithm('AES-CBC', forge.cipher.modes.cbc);\nregisterAlgorithm('AES-CFB', forge.cipher.modes.cfb);\nregisterAlgorithm('AES-OFB', forge.cipher.modes.ofb);\nregisterAlgorithm('AES-CTR', forge.cipher.modes.ctr);\nregisterAlgorithm('AES-GCM', forge.cipher.modes.gcm);\n\nfunction registerAlgorithm(name, mode) {\n var factory = function() {\n return new forge.aes.Algorithm(name, mode);\n };\n forge.cipher.registerAlgorithm(name, factory);\n}\n\n/** AES implementation **/\n\nvar init = false; // not yet initialized\nvar Nb = 4; // number of words comprising the state (AES = 4)\nvar sbox; // non-linear substitution table used in key expansion\nvar isbox; // inversion of sbox\nvar rcon; // round constant word array\nvar mix; // mix-columns table\nvar imix; // inverse mix-columns table\n\n/**\n * Performs initialization, ie: precomputes tables to optimize for speed.\n *\n * One way to understand how AES works is to imagine that 'addition' and\n * 'multiplication' are interfaces that require certain mathematical\n * properties to hold true (ie: they are associative) but they might have\n * different implementations and produce different kinds of results ...\n * provided that their mathematical properties remain true. AES defines\n * its own methods of addition and multiplication but keeps some important\n * properties the same, ie: associativity and distributivity. The\n * explanation below tries to shed some light on how AES defines addition\n * and multiplication of bytes and 32-bit words in order to perform its\n * encryption and decryption algorithms.\n *\n * The basics:\n *\n * The AES algorithm views bytes as binary representations of polynomials\n * that have either 1 or 0 as the coefficients. It defines the addition\n * or subtraction of two bytes as the XOR operation. It also defines the\n * multiplication of two bytes as a finite field referred to as GF(2^8)\n * (Note: 'GF' means \"Galois Field\" which is a field that contains a finite\n * number of elements so GF(2^8) has 256 elements).\n *\n * This means that any two bytes can be represented as binary polynomials;\n * when they multiplied together and modularly reduced by an irreducible\n * polynomial of the 8th degree, the results are the field GF(2^8). The\n * specific irreducible polynomial that AES uses in hexadecimal is 0x11b.\n * This multiplication is associative with 0x01 as the identity:\n *\n * (b * 0x01 = GF(b, 0x01) = b).\n *\n * The operation GF(b, 0x02) can be performed at the byte level by left\n * shifting b once and then XOR'ing it (to perform the modular reduction)\n * with 0x11b if b is >= 128. Repeated application of the multiplication\n * of 0x02 can be used to implement the multiplication of any two bytes.\n *\n * For instance, multiplying 0x57 and 0x13, denoted as GF(0x57, 0x13), can\n * be performed by factoring 0x13 into 0x01, 0x02, and 0x10. Then these\n * factors can each be multiplied by 0x57 and then added together. To do\n * the multiplication, values for 0x57 multiplied by each of these 3 factors\n * can be precomputed and stored in a table. To add them, the values from\n * the table are XOR'd together.\n *\n * AES also defines addition and multiplication of words, that is 4-byte\n * numbers represented as polynomials of 3 degrees where the coefficients\n * are the values of the bytes.\n *\n * The word [a0, a1, a2, a3] is a polynomial a3x^3 + a2x^2 + a1x + a0.\n *\n * Addition is performed by XOR'ing like powers of x. Multiplication\n * is performed in two steps, the first is an algebriac expansion as\n * you would do normally (where addition is XOR). But the result is\n * a polynomial larger than 3 degrees and thus it cannot fit in a word. So\n * next the result is modularly reduced by an AES-specific polynomial of\n * degree 4 which will always produce a polynomial of less than 4 degrees\n * such that it will fit in a word. In AES, this polynomial is x^4 + 1.\n *\n * The modular product of two polynomials 'a' and 'b' is thus:\n *\n * d(x) = d3x^3 + d2x^2 + d1x + d0\n * with\n * d0 = GF(a0, b0) ^ GF(a3, b1) ^ GF(a2, b2) ^ GF(a1, b3)\n * d1 = GF(a1, b0) ^ GF(a0, b1) ^ GF(a3, b2) ^ GF(a2, b3)\n * d2 = GF(a2, b0) ^ GF(a1, b1) ^ GF(a0, b2) ^ GF(a3, b3)\n * d3 = GF(a3, b0) ^ GF(a2, b1) ^ GF(a1, b2) ^ GF(a0, b3)\n *\n * As a matrix:\n *\n * [d0] = [a0 a3 a2 a1][b0]\n * [d1] [a1 a0 a3 a2][b1]\n * [d2] [a2 a1 a0 a3][b2]\n * [d3] [a3 a2 a1 a0][b3]\n *\n * Special polynomials defined by AES (0x02 == {02}):\n * a(x) = {03}x^3 + {01}x^2 + {01}x + {02}\n * a^-1(x) = {0b}x^3 + {0d}x^2 + {09}x + {0e}.\n *\n * These polynomials are used in the MixColumns() and InverseMixColumns()\n * operations, respectively, to cause each element in the state to affect\n * the output (referred to as diffusing).\n *\n * RotWord() uses: a0 = a1 = a2 = {00} and a3 = {01}, which is the\n * polynomial x3.\n *\n * The ShiftRows() method modifies the last 3 rows in the state (where\n * the state is 4 words with 4 bytes per word) by shifting bytes cyclically.\n * The 1st byte in the second row is moved to the end of the row. The 1st\n * and 2nd bytes in the third row are moved to the end of the row. The 1st,\n * 2nd, and 3rd bytes are moved in the fourth row.\n *\n * More details on how AES arithmetic works:\n *\n * In the polynomial representation of binary numbers, XOR performs addition\n * and subtraction and multiplication in GF(2^8) denoted as GF(a, b)\n * corresponds with the multiplication of polynomials modulo an irreducible\n * polynomial of degree 8. In other words, for AES, GF(a, b) will multiply\n * polynomial 'a' with polynomial 'b' and then do a modular reduction by\n * an AES-specific irreducible polynomial of degree 8.\n *\n * A polynomial is irreducible if its only divisors are one and itself. For\n * the AES algorithm, this irreducible polynomial is:\n *\n * m(x) = x^8 + x^4 + x^3 + x + 1,\n *\n * or {01}{1b} in hexadecimal notation, where each coefficient is a bit:\n * 100011011 = 283 = 0x11b.\n *\n * For example, GF(0x57, 0x83) = 0xc1 because\n *\n * 0x57 = 87 = 01010111 = x^6 + x^4 + x^2 + x + 1\n * 0x85 = 131 = 10000101 = x^7 + x + 1\n *\n * (x^6 + x^4 + x^2 + x + 1) * (x^7 + x + 1)\n * = x^13 + x^11 + x^9 + x^8 + x^7 +\n * x^7 + x^5 + x^3 + x^2 + x +\n * x^6 + x^4 + x^2 + x + 1\n * = x^13 + x^11 + x^9 + x^8 + x^6 + x^5 + x^4 + x^3 + 1 = y\n * y modulo (x^8 + x^4 + x^3 + x + 1)\n * = x^7 + x^6 + 1.\n *\n * The modular reduction by m(x) guarantees the result will be a binary\n * polynomial of less than degree 8, so that it can fit in a byte.\n *\n * The operation to multiply a binary polynomial b with x (the polynomial\n * x in binary representation is 00000010) is:\n *\n * b_7x^8 + b_6x^7 + b_5x^6 + b_4x^5 + b_3x^4 + b_2x^3 + b_1x^2 + b_0x^1\n *\n * To get GF(b, x) we must reduce that by m(x). If b_7 is 0 (that is the\n * most significant bit is 0 in b) then the result is already reduced. If\n * it is 1, then we can reduce it by subtracting m(x) via an XOR.\n *\n * It follows that multiplication by x (00000010 or 0x02) can be implemented\n * by performing a left shift followed by a conditional bitwise XOR with\n * 0x1b. This operation on bytes is denoted by xtime(). Multiplication by\n * higher powers of x can be implemented by repeated application of xtime().\n *\n * By adding intermediate results, multiplication by any constant can be\n * implemented. For instance:\n *\n * GF(0x57, 0x13) = 0xfe because:\n *\n * xtime(b) = (b & 128) ? (b << 1 ^ 0x11b) : (b << 1)\n *\n * Note: We XOR with 0x11b instead of 0x1b because in javascript our\n * datatype for b can be larger than 1 byte, so a left shift will not\n * automatically eliminate bits that overflow a byte ... by XOR'ing the\n * overflow bit with 1 (the extra one from 0x11b) we zero it out.\n *\n * GF(0x57, 0x02) = xtime(0x57) = 0xae\n * GF(0x57, 0x04) = xtime(0xae) = 0x47\n * GF(0x57, 0x08) = xtime(0x47) = 0x8e\n * GF(0x57, 0x10) = xtime(0x8e) = 0x07\n *\n * GF(0x57, 0x13) = GF(0x57, (0x01 ^ 0x02 ^ 0x10))\n *\n * And by the distributive property (since XOR is addition and GF() is\n * multiplication):\n *\n * = GF(0x57, 0x01) ^ GF(0x57, 0x02) ^ GF(0x57, 0x10)\n * = 0x57 ^ 0xae ^ 0x07\n * = 0xfe.\n */\nfunction initialize() {\n init = true;\n\n /* Populate the Rcon table. These are the values given by\n [x^(i-1),{00},{00},{00}] where x^(i-1) are powers of x (and x = 0x02)\n in the field of GF(2^8), where i starts at 1.\n\n rcon[0] = [0x00, 0x00, 0x00, 0x00]\n rcon[1] = [0x01, 0x00, 0x00, 0x00] 2^(1-1) = 2^0 = 1\n rcon[2] = [0x02, 0x00, 0x00, 0x00] 2^(2-1) = 2^1 = 2\n ...\n rcon[9] = [0x1B, 0x00, 0x00, 0x00] 2^(9-1) = 2^8 = 0x1B\n rcon[10] = [0x36, 0x00, 0x00, 0x00] 2^(10-1) = 2^9 = 0x36\n\n We only store the first byte because it is the only one used.\n */\n rcon = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36];\n\n // compute xtime table which maps i onto GF(i, 0x02)\n var xtime = new Array(256);\n for(var i = 0; i < 128; ++i) {\n xtime[i] = i << 1;\n xtime[i + 128] = (i + 128) << 1 ^ 0x11B;\n }\n\n // compute all other tables\n sbox = new Array(256);\n isbox = new Array(256);\n mix = new Array(4);\n imix = new Array(4);\n for(var i = 0; i < 4; ++i) {\n mix[i] = new Array(256);\n imix[i] = new Array(256);\n }\n var e = 0, ei = 0, e2, e4, e8, sx, sx2, me, ime;\n for(var i = 0; i < 256; ++i) {\n /* We need to generate the SubBytes() sbox and isbox tables so that\n we can perform byte substitutions. This requires us to traverse\n all of the elements in GF, find their multiplicative inverses,\n and apply to each the following affine transformation:\n\n bi' = bi ^ b(i + 4) mod 8 ^ b(i + 5) mod 8 ^ b(i + 6) mod 8 ^\n b(i + 7) mod 8 ^ ci\n for 0 <= i < 8, where bi is the ith bit of the byte, and ci is the\n ith bit of a byte c with the value {63} or {01100011}.\n\n It is possible to traverse every possible value in a Galois field\n using what is referred to as a 'generator'. There are many\n generators (128 out of 256): 3,5,6,9,11,82 to name a few. To fully\n traverse GF we iterate 255 times, multiplying by our generator\n each time.\n\n On each iteration we can determine the multiplicative inverse for\n the current element.\n\n Suppose there is an element in GF 'e'. For a given generator 'g',\n e = g^x. The multiplicative inverse of e is g^(255 - x). It turns\n out that if use the inverse of a generator as another generator\n it will produce all of the corresponding multiplicative inverses\n at the same time. For this reason, we choose 5 as our inverse\n generator because it only requires 2 multiplies and 1 add and its\n inverse, 82, requires relatively few operations as well.\n\n In order to apply the affine transformation, the multiplicative\n inverse 'ei' of 'e' can be repeatedly XOR'd (4 times) with a\n bit-cycling of 'ei'. To do this 'ei' is first stored in 's' and\n 'x'. Then 's' is left shifted and the high bit of 's' is made the\n low bit. The resulting value is stored in 's'. Then 'x' is XOR'd\n with 's' and stored in 'x'. On each subsequent iteration the same\n operation is performed. When 4 iterations are complete, 'x' is\n XOR'd with 'c' (0x63) and the transformed value is stored in 'x'.\n For example:\n\n s = 01000001\n x = 01000001\n\n iteration 1: s = 10000010, x ^= s\n iteration 2: s = 00000101, x ^= s\n iteration 3: s = 00001010, x ^= s\n iteration 4: s = 00010100, x ^= s\n x ^= 0x63\n\n This can be done with a loop where s = (s << 1) | (s >> 7). However,\n it can also be done by using a single 16-bit (in this case 32-bit)\n number 'sx'. Since XOR is an associative operation, we can set 'sx'\n to 'ei' and then XOR it with 'sx' left-shifted 1,2,3, and 4 times.\n The most significant bits will flow into the high 8 bit positions\n and be correctly XOR'd with one another. All that remains will be\n to cycle the high 8 bits by XOR'ing them all with the lower 8 bits\n afterwards.\n\n At the same time we're populating sbox and isbox we can precompute\n the multiplication we'll need to do to do MixColumns() later.\n */\n\n // apply affine transformation\n sx = ei ^ (ei << 1) ^ (ei << 2) ^ (ei << 3) ^ (ei << 4);\n sx = (sx >> 8) ^ (sx & 255) ^ 0x63;\n\n // update tables\n sbox[e] = sx;\n isbox[sx] = e;\n\n /* Mixing columns is done using matrix multiplication. The columns\n that are to be mixed are each a single word in the current state.\n The state has Nb columns (4 columns). Therefore each column is a\n 4 byte word. So to mix the columns in a single column 'c' where\n its rows are r0, r1, r2, and r3, we use the following matrix\n multiplication:\n\n [2 3 1 1]*[r0,c]=[r'0,c]\n [1 2 3 1] [r1,c] [r'1,c]\n [1 1 2 3] [r2,c] [r'2,c]\n [3 1 1 2] [r3,c] [r'3,c]\n\n r0, r1, r2, and r3 are each 1 byte of one of the words in the\n state (a column). To do matrix multiplication for each mixed\n column c' we multiply the corresponding row from the left matrix\n with the corresponding column from the right matrix. In total, we\n get 4 equations:\n\n r0,c' = 2*r0,c + 3*r1,c + 1*r2,c + 1*r3,c\n r1,c' = 1*r0,c + 2*r1,c + 3*r2,c + 1*r3,c\n r2,c' = 1*r0,c + 1*r1,c + 2*r2,c + 3*r3,c\n r3,c' = 3*r0,c + 1*r1,c + 1*r2,c + 2*r3,c\n\n As usual, the multiplication is as previously defined and the\n addition is XOR. In order to optimize mixing columns we can store\n the multiplication results in tables. If you think of the whole\n column as a word (it might help to visualize by mentally rotating\n the equations above by counterclockwise 90 degrees) then you can\n see that it would be useful to map the multiplications performed on\n each byte (r0, r1, r2, r3) onto a word as well. For instance, we\n could map 2*r0,1*r0,1*r0,3*r0 onto a word by storing 2*r0 in the\n highest 8 bits and 3*r0 in the lowest 8 bits (with the other two\n respectively in the middle). This means that a table can be\n constructed that uses r0 as an index to the word. We can do the\n same with r1, r2, and r3, creating a total of 4 tables.\n\n To construct a full c', we can just look up each byte of c in\n their respective tables and XOR the results together.\n\n Also, to build each table we only have to calculate the word\n for 2,1,1,3 for every byte ... which we can do on each iteration\n of this loop since we will iterate over every byte. After we have\n calculated 2,1,1,3 we can get the results for the other tables\n by cycling the byte at the end to the beginning. For instance\n we can take the result of table 2,1,1,3 and produce table 3,2,1,1\n by moving the right most byte to the left most position just like\n how you can imagine the 3 moved out of 2,1,1,3 and to the front\n to produce 3,2,1,1.\n\n There is another optimization in that the same multiples of\n the current element we need in order to advance our generator\n to the next iteration can be reused in performing the 2,1,1,3\n calculation. We also calculate the inverse mix column tables,\n with e,9,d,b being the inverse of 2,1,1,3.\n\n When we're done, and we need to actually mix columns, the first\n byte of each state word should be put through mix[0] (2,1,1,3),\n the second through mix[1] (3,2,1,1) and so forth. Then they should\n be XOR'd together to produce the fully mixed column.\n */\n\n // calculate mix and imix table values\n sx2 = xtime[sx];\n e2 = xtime[e];\n e4 = xtime[e2];\n e8 = xtime[e4];\n me =\n (sx2 << 24) ^ // 2\n (sx << 16) ^ // 1\n (sx << 8) ^ // 1\n (sx ^ sx2); // 3\n ime =\n (e2 ^ e4 ^ e8) << 24 ^ // E (14)\n (e ^ e8) << 16 ^ // 9\n (e ^ e4 ^ e8) << 8 ^ // D (13)\n (e ^ e2 ^ e8); // B (11)\n // produce each of the mix tables by rotating the 2,1,1,3 value\n for(var n = 0; n < 4; ++n) {\n mix[n][e] = me;\n imix[n][sx] = ime;\n // cycle the right most byte to the left most position\n // ie: 2,1,1,3 becomes 3,2,1,1\n me = me << 24 | me >>> 8;\n ime = ime << 24 | ime >>> 8;\n }\n\n // get next element and inverse\n if(e === 0) {\n // 1 is the inverse of 1\n e = ei = 1;\n } else {\n // e = 2e + 2*2*2*(10e)) = multiply e by 82 (chosen generator)\n // ei = ei + 2*2*ei = multiply ei by 5 (inverse generator)\n e = e2 ^ xtime[xtime[xtime[e2 ^ e8]]];\n ei ^= xtime[xtime[ei]];\n }\n }\n}\n\n/**\n * Generates a key schedule using the AES key expansion algorithm.\n *\n * The AES algorithm takes the Cipher Key, K, and performs a Key Expansion\n * routine to generate a key schedule. The Key Expansion generates a total\n * of Nb*(Nr + 1) words: the algorithm requires an initial set of Nb words,\n * and each of the Nr rounds requires Nb words of key data. The resulting\n * key schedule consists of a linear array of 4-byte words, denoted [wi ],\n * with i in the range 0 <= i < Nb(Nr + 1).\n *\n * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk)\n * AES-128 (Nb=4, Nk=4, Nr=10)\n * AES-192 (Nb=4, Nk=6, Nr=12)\n * AES-256 (Nb=4, Nk=8, Nr=14)\n * Note: Nr=Nk+6.\n *\n * Nb is the number of columns (32-bit words) comprising the State (or\n * number of bytes in a block). For AES, Nb=4.\n *\n * @param key the key to schedule (as an array of 32-bit words).\n * @param decrypt true to modify the key schedule to decrypt, false not to.\n *\n * @return the generated key schedule.\n */\nfunction _expandKey(key, decrypt) {\n // copy the key's words to initialize the key schedule\n var w = key.slice(0);\n\n /* RotWord() will rotate a word, moving the first byte to the last\n byte's position (shifting the other bytes left).\n\n We will be getting the value of Rcon at i / Nk. 'i' will iterate\n from Nk to (Nb * Nr+1). Nk = 4 (4 byte key), Nb = 4 (4 words in\n a block), Nr = Nk + 6 (10). Therefore 'i' will iterate from\n 4 to 44 (exclusive). Each time we iterate 4 times, i / Nk will\n increase by 1. We use a counter iNk to keep track of this.\n */\n\n // go through the rounds expanding the key\n var temp, iNk = 1;\n var Nk = w.length;\n var Nr1 = Nk + 6 + 1;\n var end = Nb * Nr1;\n for(var i = Nk; i < end; ++i) {\n temp = w[i - 1];\n if(i % Nk === 0) {\n // temp = SubWord(RotWord(temp)) ^ Rcon[i / Nk]\n temp =\n sbox[temp >>> 16 & 255] << 24 ^\n sbox[temp >>> 8 & 255] << 16 ^\n sbox[temp & 255] << 8 ^\n sbox[temp >>> 24] ^ (rcon[iNk] << 24);\n iNk++;\n } else if(Nk > 6 && (i % Nk === 4)) {\n // temp = SubWord(temp)\n temp =\n sbox[temp >>> 24] << 24 ^\n sbox[temp >>> 16 & 255] << 16 ^\n sbox[temp >>> 8 & 255] << 8 ^\n sbox[temp & 255];\n }\n w[i] = w[i - Nk] ^ temp;\n }\n\n /* When we are updating a cipher block we always use the code path for\n encryption whether we are decrypting or not (to shorten code and\n simplify the generation of look up tables). However, because there\n are differences in the decryption algorithm, other than just swapping\n in different look up tables, we must transform our key schedule to\n account for these changes:\n\n 1. The decryption algorithm gets its key rounds in reverse order.\n 2. The decryption algorithm adds the round key before mixing columns\n instead of afterwards.\n\n We don't need to modify our key schedule to handle the first case,\n we can just traverse the key schedule in reverse order when decrypting.\n\n The second case requires a little work.\n\n The tables we built for performing rounds will take an input and then\n perform SubBytes() and MixColumns() or, for the decrypt version,\n InvSubBytes() and InvMixColumns(). But the decrypt algorithm requires\n us to AddRoundKey() before InvMixColumns(). This means we'll need to\n apply some transformations to the round key to inverse-mix its columns\n so they'll be correct for moving AddRoundKey() to after the state has\n had its columns inverse-mixed.\n\n To inverse-mix the columns of the state when we're decrypting we use a\n lookup table that will apply InvSubBytes() and InvMixColumns() at the\n same time. However, the round key's bytes are not inverse-substituted\n in the decryption algorithm. To get around this problem, we can first\n substitute the bytes in the round key so that when we apply the\n transformation via the InvSubBytes()+InvMixColumns() table, it will\n undo our substitution leaving us with the original value that we\n want -- and then inverse-mix that value.\n\n This change will correctly alter our key schedule so that we can XOR\n each round key with our already transformed decryption state. This\n allows us to use the same code path as the encryption algorithm.\n\n We make one more change to the decryption key. Since the decryption\n algorithm runs in reverse from the encryption algorithm, we reverse\n the order of the round keys to avoid having to iterate over the key\n schedule backwards when running the encryption algorithm later in\n decryption mode. In addition to reversing the order of the round keys,\n we also swap each round key's 2nd and 4th rows. See the comments\n section where rounds are performed for more details about why this is\n done. These changes are done inline with the other substitution\n described above.\n */\n if(decrypt) {\n var tmp;\n var m0 = imix[0];\n var m1 = imix[1];\n var m2 = imix[2];\n var m3 = imix[3];\n var wnew = w.slice(0);\n end = w.length;\n for(var i = 0, wi = end - Nb; i < end; i += Nb, wi -= Nb) {\n // do not sub the first or last round key (round keys are Nb\n // words) as no column mixing is performed before they are added,\n // but do change the key order\n if(i === 0 || i === (end - Nb)) {\n wnew[i] = w[wi];\n wnew[i + 1] = w[wi + 3];\n wnew[i + 2] = w[wi + 2];\n wnew[i + 3] = w[wi + 1];\n } else {\n // substitute each round key byte because the inverse-mix\n // table will inverse-substitute it (effectively cancel the\n // substitution because round key bytes aren't sub'd in\n // decryption mode) and swap indexes 3 and 1\n for(var n = 0; n < Nb; ++n) {\n tmp = w[wi + n];\n wnew[i + (3&-n)] =\n m0[sbox[tmp >>> 24]] ^\n m1[sbox[tmp >>> 16 & 255]] ^\n m2[sbox[tmp >>> 8 & 255]] ^\n m3[sbox[tmp & 255]];\n }\n }\n }\n w = wnew;\n }\n\n return w;\n}\n\n/**\n * Updates a single block (16 bytes) using AES. The update will either\n * encrypt or decrypt the block.\n *\n * @param w the key schedule.\n * @param input the input block (an array of 32-bit words).\n * @param output the updated output block.\n * @param decrypt true to decrypt the block, false to encrypt it.\n */\nfunction _updateBlock(w, input, output, decrypt) {\n /*\n Cipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)])\n begin\n byte state[4,Nb]\n state = in\n AddRoundKey(state, w[0, Nb-1])\n for round = 1 step 1 to Nr-1\n SubBytes(state)\n ShiftRows(state)\n MixColumns(state)\n AddRoundKey(state, w[round*Nb, (round+1)*Nb-1])\n end for\n SubBytes(state)\n ShiftRows(state)\n AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n out = state\n end\n\n InvCipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)])\n begin\n byte state[4,Nb]\n state = in\n AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n for round = Nr-1 step -1 downto 1\n InvShiftRows(state)\n InvSubBytes(state)\n AddRoundKey(state, w[round*Nb, (round+1)*Nb-1])\n InvMixColumns(state)\n end for\n InvShiftRows(state)\n InvSubBytes(state)\n AddRoundKey(state, w[0, Nb-1])\n out = state\n end\n */\n\n // Encrypt: AddRoundKey(state, w[0, Nb-1])\n // Decrypt: AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n var Nr = w.length / 4 - 1;\n var m0, m1, m2, m3, sub;\n if(decrypt) {\n m0 = imix[0];\n m1 = imix[1];\n m2 = imix[2];\n m3 = imix[3];\n sub = isbox;\n } else {\n m0 = mix[0];\n m1 = mix[1];\n m2 = mix[2];\n m3 = mix[3];\n sub = sbox;\n }\n var a, b, c, d, a2, b2, c2;\n a = input[0] ^ w[0];\n b = input[decrypt ? 3 : 1] ^ w[1];\n c = input[2] ^ w[2];\n d = input[decrypt ? 1 : 3] ^ w[3];\n var i = 3;\n\n /* In order to share code we follow the encryption algorithm when both\n encrypting and decrypting. To account for the changes required in the\n decryption algorithm, we use different lookup tables when decrypting\n and use a modified key schedule to account for the difference in the\n order of transformations applied when performing rounds. We also get\n key rounds in reverse order (relative to encryption). */\n for(var round = 1; round < Nr; ++round) {\n /* As described above, we'll be using table lookups to perform the\n column mixing. Each column is stored as a word in the state (the\n array 'input' has one column as a word at each index). In order to\n mix a column, we perform these transformations on each row in c,\n which is 1 byte in each word. The new column for c0 is c'0:\n\n m0 m1 m2 m3\n r0,c'0 = 2*r0,c0 + 3*r1,c0 + 1*r2,c0 + 1*r3,c0\n r1,c'0 = 1*r0,c0 + 2*r1,c0 + 3*r2,c0 + 1*r3,c0\n r2,c'0 = 1*r0,c0 + 1*r1,c0 + 2*r2,c0 + 3*r3,c0\n r3,c'0 = 3*r0,c0 + 1*r1,c0 + 1*r2,c0 + 2*r3,c0\n\n So using mix tables where c0 is a word with r0 being its upper\n 8 bits and r3 being its lower 8 bits:\n\n m0[c0 >> 24] will yield this word: [2*r0,1*r0,1*r0,3*r0]\n ...\n m3[c0 & 255] will yield this word: [1*r3,1*r3,3*r3,2*r3]\n\n Therefore to mix the columns in each word in the state we\n do the following (& 255 omitted for brevity):\n c'0,r0 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n c'0,r1 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n c'0,r2 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n c'0,r3 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3]\n\n However, before mixing, the algorithm requires us to perform\n ShiftRows(). The ShiftRows() transformation cyclically shifts the\n last 3 rows of the state over different offsets. The first row\n (r = 0) is not shifted.\n\n s'_r,c = s_r,(c + shift(r, Nb) mod Nb\n for 0 < r < 4 and 0 <= c < Nb and\n shift(1, 4) = 1\n shift(2, 4) = 2\n shift(3, 4) = 3.\n\n This causes the first byte in r = 1 to be moved to the end of\n the row, the first 2 bytes in r = 2 to be moved to the end of\n the row, the first 3 bytes in r = 3 to be moved to the end of\n the row:\n\n r1: [c0 c1 c2 c3] => [c1 c2 c3 c0]\n r2: [c0 c1 c2 c3] [c2 c3 c0 c1]\n r3: [c0 c1 c2 c3] [c3 c0 c1 c2]\n\n We can make these substitutions inline with our column mixing to\n generate an updated set of equations to produce each word in the\n state (note the columns have changed positions):\n\n c0 c1 c2 c3 => c0 c1 c2 c3\n c0 c1 c2 c3 c1 c2 c3 c0 (cycled 1 byte)\n c0 c1 c2 c3 c2 c3 c0 c1 (cycled 2 bytes)\n c0 c1 c2 c3 c3 c0 c1 c2 (cycled 3 bytes)\n\n Therefore:\n\n c'0 = 2*r0,c0 + 3*r1,c1 + 1*r2,c2 + 1*r3,c3\n c'0 = 1*r0,c0 + 2*r1,c1 + 3*r2,c2 + 1*r3,c3\n c'0 = 1*r0,c0 + 1*r1,c1 + 2*r2,c2 + 3*r3,c3\n c'0 = 3*r0,c0 + 1*r1,c1 + 1*r2,c2 + 2*r3,c3\n\n c'1 = 2*r0,c1 + 3*r1,c2 + 1*r2,c3 + 1*r3,c0\n c'1 = 1*r0,c1 + 2*r1,c2 + 3*r2,c3 + 1*r3,c0\n c'1 = 1*r0,c1 + 1*r1,c2 + 2*r2,c3 + 3*r3,c0\n c'1 = 3*r0,c1 + 1*r1,c2 + 1*r2,c3 + 2*r3,c0\n\n ... and so forth for c'2 and c'3. The important distinction is\n that the columns are cycling, with c0 being used with the m0\n map when calculating c0, but c1 being used with the m0 map when\n calculating c1 ... and so forth.\n\n When performing the inverse we transform the mirror image and\n skip the bottom row, instead of the top one, and move upwards:\n\n c3 c2 c1 c0 => c0 c3 c2 c1 (cycled 3 bytes) *same as encryption\n c3 c2 c1 c0 c1 c0 c3 c2 (cycled 2 bytes)\n c3 c2 c1 c0 c2 c1 c0 c3 (cycled 1 byte) *same as encryption\n c3 c2 c1 c0 c3 c2 c1 c0\n\n If you compare the resulting matrices for ShiftRows()+MixColumns()\n and for InvShiftRows()+InvMixColumns() the 2nd and 4th columns are\n different (in encrypt mode vs. decrypt mode). So in order to use\n the same code to handle both encryption and decryption, we will\n need to do some mapping.\n\n If in encryption mode we let a=c0, b=c1, c=c2, d=c3, and r be\n a row number in the state, then the resulting matrix in encryption\n mode for applying the above transformations would be:\n\n r1: a b c d\n r2: b c d a\n r3: c d a b\n r4: d a b c\n\n If we did the same in decryption mode we would get:\n\n r1: a d c b\n r2: b a d c\n r3: c b a d\n r4: d c b a\n\n If instead we swap d and b (set b=c3 and d=c1), then we get:\n\n r1: a b c d\n r2: d a b c\n r3: c d a b\n r4: b c d a\n\n Now the 1st and 3rd rows are the same as the encryption matrix. All\n we need to do then to make the mapping exactly the same is to swap\n the 2nd and 4th rows when in decryption mode. To do this without\n having to do it on each iteration, we swapped the 2nd and 4th rows\n in the decryption key schedule. We also have to do the swap above\n when we first pull in the input and when we set the final output. */\n a2 =\n m0[a >>> 24] ^\n m1[b >>> 16 & 255] ^\n m2[c >>> 8 & 255] ^\n m3[d & 255] ^ w[++i];\n b2 =\n m0[b >>> 24] ^\n m1[c >>> 16 & 255] ^\n m2[d >>> 8 & 255] ^\n m3[a & 255] ^ w[++i];\n c2 =\n m0[c >>> 24] ^\n m1[d >>> 16 & 255] ^\n m2[a >>> 8 & 255] ^\n m3[b & 255] ^ w[++i];\n d =\n m0[d >>> 24] ^\n m1[a >>> 16 & 255] ^\n m2[b >>> 8 & 255] ^\n m3[c & 255] ^ w[++i];\n a = a2;\n b = b2;\n c = c2;\n }\n\n /*\n Encrypt:\n SubBytes(state)\n ShiftRows(state)\n AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])\n\n Decrypt:\n InvShiftRows(state)\n InvSubBytes(state)\n AddRoundKey(state, w[0, Nb-1])\n */\n // Note: rows are shifted inline\n output[0] =\n (sub[a >>> 24] << 24) ^\n (sub[b >>> 16 & 255] << 16) ^\n (sub[c >>> 8 & 255] << 8) ^\n (sub[d & 255]) ^ w[++i];\n output[decrypt ? 3 : 1] =\n (sub[b >>> 24] << 24) ^\n (sub[c >>> 16 & 255] << 16) ^\n (sub[d >>> 8 & 255] << 8) ^\n (sub[a & 255]) ^ w[++i];\n output[2] =\n (sub[c >>> 24] << 24) ^\n (sub[d >>> 16 & 255] << 16) ^\n (sub[a >>> 8 & 255] << 8) ^\n (sub[b & 255]) ^ w[++i];\n output[decrypt ? 1 : 3] =\n (sub[d >>> 24] << 24) ^\n (sub[a >>> 16 & 255] << 16) ^\n (sub[b >>> 8 & 255] << 8) ^\n (sub[c & 255]) ^ w[++i];\n}\n\n/**\n * Deprecated. Instead, use:\n *\n * forge.cipher.createCipher('AES-', key);\n * forge.cipher.createDecipher('AES-', key);\n *\n * Creates a deprecated AES cipher object. This object's mode will default to\n * CBC (cipher-block-chaining).\n *\n * The key and iv may be given as a string of bytes, an array of bytes, a\n * byte buffer, or an array of 32-bit words.\n *\n * @param options the options to use.\n * key the symmetric key to use.\n * output the buffer to write to.\n * decrypt true for decryption, false for encryption.\n * mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nfunction _createCipher(options) {\n options = options || {};\n var mode = (options.mode || 'CBC').toUpperCase();\n var algorithm = 'AES-' + mode;\n\n var cipher;\n if(options.decrypt) {\n cipher = forge.cipher.createDecipher(algorithm, options.key);\n } else {\n cipher = forge.cipher.createCipher(algorithm, options.key);\n }\n\n // backwards compatible start API\n var start = cipher.start;\n cipher.start = function(iv, options) {\n // backwards compatibility: support second arg as output buffer\n var output = null;\n if(options instanceof forge.util.ByteBuffer) {\n output = options;\n options = {};\n }\n options = options || {};\n options.output = output;\n options.iv = iv;\n start.call(cipher, options);\n };\n\n return cipher;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/aes.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/asn1.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/asn1.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Javascript implementation of Abstract Syntax Notation Number One.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n *\n * An API for storing data using the Abstract Syntax Notation Number One\n * format using DER (Distinguished Encoding Rules) encoding. This encoding is\n * commonly used to store data for PKI, i.e. X.509 Certificates, and this\n * implementation exists for that purpose.\n *\n * Abstract Syntax Notation Number One (ASN.1) is used to define the abstract\n * syntax of information without restricting the way the information is encoded\n * for transmission. It provides a standard that allows for open systems\n * communication. ASN.1 defines the syntax of information data and a number of\n * simple data types as well as a notation for describing them and specifying\n * values for them.\n *\n * The RSA algorithm creates public and private keys that are often stored in\n * X.509 or PKCS#X formats -- which use ASN.1 (encoded in DER format). This\n * class provides the most basic functionality required to store and load DSA\n * keys that are encoded according to ASN.1.\n *\n * The most common binary encodings for ASN.1 are BER (Basic Encoding Rules)\n * and DER (Distinguished Encoding Rules). DER is just a subset of BER that\n * has stricter requirements for how data must be encoded.\n *\n * Each ASN.1 structure has a tag (a byte identifying the ASN.1 structure type)\n * and a byte array for the value of this ASN1 structure which may be data or a\n * list of ASN.1 structures.\n *\n * Each ASN.1 structure using BER is (Tag-Length-Value):\n *\n * | byte 0 | bytes X | bytes Y |\n * |--------|---------|----------\n * | tag | length | value |\n *\n * ASN.1 allows for tags to be of \"High-tag-number form\" which allows a tag to\n * be two or more octets, but that is not supported by this class. A tag is\n * only 1 byte. Bits 1-5 give the tag number (ie the data type within a\n * particular 'class'), 6 indicates whether or not the ASN.1 value is\n * constructed from other ASN.1 values, and bits 7 and 8 give the 'class'. If\n * bits 7 and 8 are both zero, the class is UNIVERSAL. If only bit 7 is set,\n * then the class is APPLICATION. If only bit 8 is set, then the class is\n * CONTEXT_SPECIFIC. If both bits 7 and 8 are set, then the class is PRIVATE.\n * The tag numbers for the data types for the class UNIVERSAL are listed below:\n *\n * UNIVERSAL 0 Reserved for use by the encoding rules\n * UNIVERSAL 1 Boolean type\n * UNIVERSAL 2 Integer type\n * UNIVERSAL 3 Bitstring type\n * UNIVERSAL 4 Octetstring type\n * UNIVERSAL 5 Null type\n * UNIVERSAL 6 Object identifier type\n * UNIVERSAL 7 Object descriptor type\n * UNIVERSAL 8 External type and Instance-of type\n * UNIVERSAL 9 Real type\n * UNIVERSAL 10 Enumerated type\n * UNIVERSAL 11 Embedded-pdv type\n * UNIVERSAL 12 UTF8String type\n * UNIVERSAL 13 Relative object identifier type\n * UNIVERSAL 14-15 Reserved for future editions\n * UNIVERSAL 16 Sequence and Sequence-of types\n * UNIVERSAL 17 Set and Set-of types\n * UNIVERSAL 18-22, 25-30 Character string types\n * UNIVERSAL 23-24 Time types\n *\n * The length of an ASN.1 structure is specified after the tag identifier.\n * There is a definite form and an indefinite form. The indefinite form may\n * be used if the encoding is constructed and not all immediately available.\n * The indefinite form is encoded using a length byte with only the 8th bit\n * set. The end of the constructed object is marked using end-of-contents\n * octets (two zero bytes).\n *\n * The definite form looks like this:\n *\n * The length may take up 1 or more bytes, it depends on the length of the\n * value of the ASN.1 structure. DER encoding requires that if the ASN.1\n * structure has a value that has a length greater than 127, more than 1 byte\n * will be used to store its length, otherwise just one byte will be used.\n * This is strict.\n *\n * In the case that the length of the ASN.1 value is less than 127, 1 octet\n * (byte) is used to store the \"short form\" length. The 8th bit has a value of\n * 0 indicating the length is \"short form\" and not \"long form\" and bits 7-1\n * give the length of the data. (The 8th bit is the left-most, most significant\n * bit: also known as big endian or network format).\n *\n * In the case that the length of the ASN.1 value is greater than 127, 2 to\n * 127 octets (bytes) are used to store the \"long form\" length. The first\n * byte's 8th bit is set to 1 to indicate the length is \"long form.\" Bits 7-1\n * give the number of additional octets. All following octets are in base 256\n * with the most significant digit first (typical big-endian binary unsigned\n * integer storage). So, for instance, if the length of a value was 257, the\n * first byte would be set to:\n *\n * 10000010 = 130 = 0x82.\n *\n * This indicates there are 2 octets (base 256) for the length. The second and\n * third bytes (the octets just mentioned) would store the length in base 256:\n *\n * octet 2: 00000001 = 1 * 256^1 = 256\n * octet 3: 00000001 = 1 * 256^0 = 1\n * total = 257\n *\n * The algorithm for converting a js integer value of 257 to base-256 is:\n *\n * var value = 257;\n * var bytes = [];\n * bytes[0] = (value >>> 8) & 0xFF; // most significant byte first\n * bytes[1] = value & 0xFF; // least significant byte last\n *\n * On the ASN.1 UNIVERSAL Object Identifier (OID) type:\n *\n * An OID can be written like: \"value1.value2.value3...valueN\"\n *\n * The DER encoding rules:\n *\n * The first byte has the value 40 * value1 + value2.\n * The following bytes, if any, encode the remaining values. Each value is\n * encoded in base 128, most significant digit first (big endian), with as\n * few digits as possible, and the most significant bit of each byte set\n * to 1 except the last in each value's encoding. For example: Given the\n * OID \"1.2.840.113549\", its DER encoding is (remember each byte except the\n * last one in each encoding is OR'd with 0x80):\n *\n * byte 1: 40 * 1 + 2 = 42 = 0x2A.\n * bytes 2-3: 128 * 6 + 72 = 840 = 6 72 = 6 72 = 0x0648 = 0x8648\n * bytes 4-6: 16384 * 6 + 128 * 119 + 13 = 6 119 13 = 0x06770D = 0x86F70D\n *\n * The final value is: 0x2A864886F70D.\n * The full OID (including ASN.1 tag and length of 6 bytes) is:\n * 0x06062A864886F70D\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n__webpack_require__(/*! ./oids */ \"./node_modules/node-forge/lib/oids.js\");\n\n/* ASN.1 API */\nvar asn1 = module.exports = forge.asn1 = forge.asn1 || {};\n\n/**\n * ASN.1 classes.\n */\nasn1.Class = {\n UNIVERSAL: 0x00,\n APPLICATION: 0x40,\n CONTEXT_SPECIFIC: 0x80,\n PRIVATE: 0xC0\n};\n\n/**\n * ASN.1 types. Not all types are supported by this implementation, only\n * those necessary to implement a simple PKI are implemented.\n */\nasn1.Type = {\n NONE: 0,\n BOOLEAN: 1,\n INTEGER: 2,\n BITSTRING: 3,\n OCTETSTRING: 4,\n NULL: 5,\n OID: 6,\n ODESC: 7,\n EXTERNAL: 8,\n REAL: 9,\n ENUMERATED: 10,\n EMBEDDED: 11,\n UTF8: 12,\n ROID: 13,\n SEQUENCE: 16,\n SET: 17,\n PRINTABLESTRING: 19,\n IA5STRING: 22,\n UTCTIME: 23,\n GENERALIZEDTIME: 24,\n BMPSTRING: 30\n};\n\n/**\n * Creates a new asn1 object.\n *\n * @param tagClass the tag class for the object.\n * @param type the data type (tag number) for the object.\n * @param constructed true if the asn1 object is in constructed form.\n * @param value the value for the object, if it is not constructed.\n * @param [options] the options to use:\n * [bitStringContents] the plain BIT STRING content including padding\n * byte.\n *\n * @return the asn1 object.\n */\nasn1.create = function(tagClass, type, constructed, value, options) {\n /* An asn1 object has a tagClass, a type, a constructed flag, and a\n value. The value's type depends on the constructed flag. If\n constructed, it will contain a list of other asn1 objects. If not,\n it will contain the ASN.1 value as an array of bytes formatted\n according to the ASN.1 data type. */\n\n // remove undefined values\n if(forge.util.isArray(value)) {\n var tmp = [];\n for(var i = 0; i < value.length; ++i) {\n if(value[i] !== undefined) {\n tmp.push(value[i]);\n }\n }\n value = tmp;\n }\n\n var obj = {\n tagClass: tagClass,\n type: type,\n constructed: constructed,\n composed: constructed || forge.util.isArray(value),\n value: value\n };\n if(options && 'bitStringContents' in options) {\n // TODO: copy byte buffer if it's a buffer not a string\n obj.bitStringContents = options.bitStringContents;\n // TODO: add readonly flag to avoid this overhead\n // save copy to detect changes\n obj.original = asn1.copy(obj);\n }\n return obj;\n};\n\n/**\n * Copies an asn1 object.\n *\n * @param obj the asn1 object.\n * @param [options] copy options:\n * [excludeBitStringContents] true to not copy bitStringContents\n *\n * @return the a copy of the asn1 object.\n */\nasn1.copy = function(obj, options) {\n var copy;\n\n if(forge.util.isArray(obj)) {\n copy = [];\n for(var i = 0; i < obj.length; ++i) {\n copy.push(asn1.copy(obj[i], options));\n }\n return copy;\n }\n\n if(typeof obj === 'string') {\n // TODO: copy byte buffer if it's a buffer not a string\n return obj;\n }\n\n copy = {\n tagClass: obj.tagClass,\n type: obj.type,\n constructed: obj.constructed,\n composed: obj.composed,\n value: asn1.copy(obj.value, options)\n };\n if(options && !options.excludeBitStringContents) {\n // TODO: copy byte buffer if it's a buffer not a string\n copy.bitStringContents = obj.bitStringContents;\n }\n return copy;\n};\n\n/**\n * Compares asn1 objects for equality.\n *\n * Note this function does not run in constant time.\n *\n * @param obj1 the first asn1 object.\n * @param obj2 the second asn1 object.\n * @param [options] compare options:\n * [includeBitStringContents] true to compare bitStringContents\n *\n * @return true if the asn1 objects are equal.\n */\nasn1.equals = function(obj1, obj2, options) {\n if(forge.util.isArray(obj1)) {\n if(!forge.util.isArray(obj2)) {\n return false;\n }\n if(obj1.length !== obj2.length) {\n return false;\n }\n for(var i = 0; i < obj1.length; ++i) {\n if(!asn1.equals(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n\n if(typeof obj1 !== typeof obj2) {\n return false;\n }\n\n if(typeof obj1 === 'string') {\n return obj1 === obj2;\n }\n\n var equal = obj1.tagClass === obj2.tagClass &&\n obj1.type === obj2.type &&\n obj1.constructed === obj2.constructed &&\n obj1.composed === obj2.composed &&\n asn1.equals(obj1.value, obj2.value);\n if(options && options.includeBitStringContents) {\n equal = equal && (obj1.bitStringContents === obj2.bitStringContents);\n }\n\n return equal;\n};\n\n/**\n * Gets the length of a BER-encoded ASN.1 value.\n *\n * In case the length is not specified, undefined is returned.\n *\n * @param b the BER-encoded ASN.1 byte buffer, starting with the first\n * length byte.\n *\n * @return the length of the BER-encoded ASN.1 value or undefined.\n */\nasn1.getBerValueLength = function(b) {\n // TODO: move this function and related DER/BER functions to a der.js\n // file; better abstract ASN.1 away from der/ber.\n var b2 = b.getByte();\n if(b2 === 0x80) {\n return undefined;\n }\n\n // see if the length is \"short form\" or \"long form\" (bit 8 set)\n var length;\n var longForm = b2 & 0x80;\n if(!longForm) {\n // length is just the first byte\n length = b2;\n } else {\n // the number of bytes the length is specified in bits 7 through 1\n // and each length byte is in big-endian base-256\n length = b.getInt((b2 & 0x7F) << 3);\n }\n return length;\n};\n\n/**\n * Check if the byte buffer has enough bytes. Throws an Error if not.\n *\n * @param bytes the byte buffer to parse from.\n * @param remaining the bytes remaining in the current parsing state.\n * @param n the number of bytes the buffer must have.\n */\nfunction _checkBufferLength(bytes, remaining, n) {\n if(n > remaining) {\n var error = new Error('Too few bytes to parse DER.');\n error.available = bytes.length();\n error.remaining = remaining;\n error.requested = n;\n throw error;\n }\n}\n\n/**\n * Gets the length of a BER-encoded ASN.1 value.\n *\n * In case the length is not specified, undefined is returned.\n *\n * @param bytes the byte buffer to parse from.\n * @param remaining the bytes remaining in the current parsing state.\n *\n * @return the length of the BER-encoded ASN.1 value or undefined.\n */\nvar _getValueLength = function(bytes, remaining) {\n // TODO: move this function and related DER/BER functions to a der.js\n // file; better abstract ASN.1 away from der/ber.\n // fromDer already checked that this byte exists\n var b2 = bytes.getByte();\n remaining--;\n if(b2 === 0x80) {\n return undefined;\n }\n\n // see if the length is \"short form\" or \"long form\" (bit 8 set)\n var length;\n var longForm = b2 & 0x80;\n if(!longForm) {\n // length is just the first byte\n length = b2;\n } else {\n // the number of bytes the length is specified in bits 7 through 1\n // and each length byte is in big-endian base-256\n var longFormBytes = b2 & 0x7F;\n _checkBufferLength(bytes, remaining, longFormBytes);\n length = bytes.getInt(longFormBytes << 3);\n }\n // FIXME: this will only happen for 32 bit getInt with high bit set\n if(length < 0) {\n throw new Error('Negative length: ' + length);\n }\n return length;\n};\n\n/**\n * Parses an asn1 object from a byte buffer in DER format.\n *\n * @param bytes the byte buffer to parse from.\n * @param [strict] true to be strict when checking value lengths, false to\n * allow truncated values (default: true).\n * @param [options] object with options or boolean strict flag\n * [strict] true to be strict when checking value lengths, false to\n * allow truncated values (default: true).\n * [parseAllBytes] true to ensure all bytes are parsed\n * (default: true)\n * [decodeBitStrings] true to attempt to decode the content of\n * BIT STRINGs (not OCTET STRINGs) using strict mode. Note that\n * without schema support to understand the data context this can\n * erroneously decode values that happen to be valid ASN.1. This\n * flag will be deprecated or removed as soon as schema support is\n * available. (default: true)\n *\n * @throws Will throw an error for various malformed input conditions.\n *\n * @return the parsed asn1 object.\n */\nasn1.fromDer = function(bytes, options) {\n if(options === undefined) {\n options = {\n strict: true,\n parseAllBytes: true,\n decodeBitStrings: true\n };\n }\n if(typeof options === 'boolean') {\n options = {\n strict: options,\n parseAllBytes: true,\n decodeBitStrings: true\n };\n }\n if(!('strict' in options)) {\n options.strict = true;\n }\n if(!('parseAllBytes' in options)) {\n options.parseAllBytes = true;\n }\n if(!('decodeBitStrings' in options)) {\n options.decodeBitStrings = true;\n }\n\n // wrap in buffer if needed\n if(typeof bytes === 'string') {\n bytes = forge.util.createBuffer(bytes);\n }\n\n var byteCount = bytes.length();\n var value = _fromDer(bytes, bytes.length(), 0, options);\n if(options.parseAllBytes && bytes.length() !== 0) {\n var error = new Error('Unparsed DER bytes remain after ASN.1 parsing.');\n error.byteCount = byteCount;\n error.remaining = bytes.length();\n throw error;\n }\n return value;\n};\n\n/**\n * Internal function to parse an asn1 object from a byte buffer in DER format.\n *\n * @param bytes the byte buffer to parse from.\n * @param remaining the number of bytes remaining for this chunk.\n * @param depth the current parsing depth.\n * @param options object with same options as fromDer().\n *\n * @return the parsed asn1 object.\n */\nfunction _fromDer(bytes, remaining, depth, options) {\n // temporary storage for consumption calculations\n var start;\n\n // minimum length for ASN.1 DER structure is 2\n _checkBufferLength(bytes, remaining, 2);\n\n // get the first byte\n var b1 = bytes.getByte();\n // consumed one byte\n remaining--;\n\n // get the tag class\n var tagClass = (b1 & 0xC0);\n\n // get the type (bits 1-5)\n var type = b1 & 0x1F;\n\n // get the variable value length and adjust remaining bytes\n start = bytes.length();\n var length = _getValueLength(bytes, remaining);\n remaining -= start - bytes.length();\n\n // ensure there are enough bytes to get the value\n if(length !== undefined && length > remaining) {\n if(options.strict) {\n var error = new Error('Too few bytes to read ASN.1 value.');\n error.available = bytes.length();\n error.remaining = remaining;\n error.requested = length;\n throw error;\n }\n // Note: be lenient with truncated values and use remaining state bytes\n length = remaining;\n }\n\n // value storage\n var value;\n // possible BIT STRING contents storage\n var bitStringContents;\n\n // constructed flag is bit 6 (32 = 0x20) of the first byte\n var constructed = ((b1 & 0x20) === 0x20);\n if(constructed) {\n // parse child asn1 objects from the value\n value = [];\n if(length === undefined) {\n // asn1 object of indefinite length, read until end tag\n for(;;) {\n _checkBufferLength(bytes, remaining, 2);\n if(bytes.bytes(2) === String.fromCharCode(0, 0)) {\n bytes.getBytes(2);\n remaining -= 2;\n break;\n }\n start = bytes.length();\n value.push(_fromDer(bytes, remaining, depth + 1, options));\n remaining -= start - bytes.length();\n }\n } else {\n // parsing asn1 object of definite length\n while(length > 0) {\n start = bytes.length();\n value.push(_fromDer(bytes, length, depth + 1, options));\n remaining -= start - bytes.length();\n length -= start - bytes.length();\n }\n }\n }\n\n // if a BIT STRING, save the contents including padding\n if(value === undefined && tagClass === asn1.Class.UNIVERSAL &&\n type === asn1.Type.BITSTRING) {\n bitStringContents = bytes.bytes(length);\n }\n\n // determine if a non-constructed value should be decoded as a composed\n // value that contains other ASN.1 objects. BIT STRINGs (and OCTET STRINGs)\n // can be used this way.\n if(value === undefined && options.decodeBitStrings &&\n tagClass === asn1.Class.UNIVERSAL &&\n // FIXME: OCTET STRINGs not yet supported here\n // .. other parts of forge expect to decode OCTET STRINGs manually\n (type === asn1.Type.BITSTRING /*|| type === asn1.Type.OCTETSTRING*/) &&\n length > 1) {\n // save read position\n var savedRead = bytes.read;\n var savedRemaining = remaining;\n var unused = 0;\n if(type === asn1.Type.BITSTRING) {\n /* The first octet gives the number of bits by which the length of the\n bit string is less than the next multiple of eight (this is called\n the \"number of unused bits\").\n\n The second and following octets give the value of the bit string\n converted to an octet string. */\n _checkBufferLength(bytes, remaining, 1);\n unused = bytes.getByte();\n remaining--;\n }\n // if all bits are used, maybe the BIT/OCTET STRING holds ASN.1 objs\n if(unused === 0) {\n try {\n // attempt to parse child asn1 object from the value\n // (stored in array to signal composed value)\n start = bytes.length();\n var subOptions = {\n // enforce strict mode to avoid parsing ASN.1 from plain data\n strict: true,\n decodeBitStrings: true\n };\n var composed = _fromDer(bytes, remaining, depth + 1, subOptions);\n var used = start - bytes.length();\n remaining -= used;\n if(type == asn1.Type.BITSTRING) {\n used++;\n }\n\n // if the data all decoded and the class indicates UNIVERSAL or\n // CONTEXT_SPECIFIC then assume we've got an encapsulated ASN.1 object\n var tc = composed.tagClass;\n if(used === length &&\n (tc === asn1.Class.UNIVERSAL || tc === asn1.Class.CONTEXT_SPECIFIC)) {\n value = [composed];\n }\n } catch(ex) {\n }\n }\n if(value === undefined) {\n // restore read position\n bytes.read = savedRead;\n remaining = savedRemaining;\n }\n }\n\n if(value === undefined) {\n // asn1 not constructed or composed, get raw value\n // TODO: do DER to OID conversion and vice-versa in .toDer?\n\n if(length === undefined) {\n if(options.strict) {\n throw new Error('Non-constructed ASN.1 object of indefinite length.');\n }\n // be lenient and use remaining state bytes\n length = remaining;\n }\n\n if(type === asn1.Type.BMPSTRING) {\n value = '';\n for(; length > 0; length -= 2) {\n _checkBufferLength(bytes, remaining, 2);\n value += String.fromCharCode(bytes.getInt16());\n remaining -= 2;\n }\n } else {\n value = bytes.getBytes(length);\n remaining -= length;\n }\n }\n\n // add BIT STRING contents if available\n var asn1Options = bitStringContents === undefined ? null : {\n bitStringContents: bitStringContents\n };\n\n // create and return asn1 object\n return asn1.create(tagClass, type, constructed, value, asn1Options);\n}\n\n/**\n * Converts the given asn1 object to a buffer of bytes in DER format.\n *\n * @param asn1 the asn1 object to convert to bytes.\n *\n * @return the buffer of bytes.\n */\nasn1.toDer = function(obj) {\n var bytes = forge.util.createBuffer();\n\n // build the first byte\n var b1 = obj.tagClass | obj.type;\n\n // for storing the ASN.1 value\n var value = forge.util.createBuffer();\n\n // use BIT STRING contents if available and data not changed\n var useBitStringContents = false;\n if('bitStringContents' in obj) {\n useBitStringContents = true;\n if(obj.original) {\n useBitStringContents = asn1.equals(obj, obj.original);\n }\n }\n\n if(useBitStringContents) {\n value.putBytes(obj.bitStringContents);\n } else if(obj.composed) {\n // if composed, use each child asn1 object's DER bytes as value\n // turn on 6th bit (0x20 = 32) to indicate asn1 is constructed\n // from other asn1 objects\n if(obj.constructed) {\n b1 |= 0x20;\n } else {\n // type is a bit string, add unused bits of 0x00\n value.putByte(0x00);\n }\n\n // add all of the child DER bytes together\n for(var i = 0; i < obj.value.length; ++i) {\n if(obj.value[i] !== undefined) {\n value.putBuffer(asn1.toDer(obj.value[i]));\n }\n }\n } else {\n // use asn1.value directly\n if(obj.type === asn1.Type.BMPSTRING) {\n for(var i = 0; i < obj.value.length; ++i) {\n value.putInt16(obj.value.charCodeAt(i));\n }\n } else {\n // ensure integer is minimally-encoded\n // TODO: should all leading bytes be stripped vs just one?\n // .. ex '00 00 01' => '01'?\n if(obj.type === asn1.Type.INTEGER &&\n obj.value.length > 1 &&\n // leading 0x00 for positive integer\n ((obj.value.charCodeAt(0) === 0 &&\n (obj.value.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (obj.value.charCodeAt(0) === 0xFF &&\n (obj.value.charCodeAt(1) & 0x80) === 0x80))) {\n value.putBytes(obj.value.substr(1));\n } else {\n value.putBytes(obj.value);\n }\n }\n }\n\n // add tag byte\n bytes.putByte(b1);\n\n // use \"short form\" encoding\n if(value.length() <= 127) {\n // one byte describes the length\n // bit 8 = 0 and bits 7-1 = length\n bytes.putByte(value.length() & 0x7F);\n } else {\n // use \"long form\" encoding\n // 2 to 127 bytes describe the length\n // first byte: bit 8 = 1 and bits 7-1 = # of additional bytes\n // other bytes: length in base 256, big-endian\n var len = value.length();\n var lenBytes = '';\n do {\n lenBytes += String.fromCharCode(len & 0xFF);\n len = len >>> 8;\n } while(len > 0);\n\n // set first byte to # bytes used to store the length and turn on\n // bit 8 to indicate long-form length is used\n bytes.putByte(lenBytes.length | 0x80);\n\n // concatenate length bytes in reverse since they were generated\n // little endian and we need big endian\n for(var i = lenBytes.length - 1; i >= 0; --i) {\n bytes.putByte(lenBytes.charCodeAt(i));\n }\n }\n\n // concatenate value bytes\n bytes.putBuffer(value);\n return bytes;\n};\n\n/**\n * Converts an OID dot-separated string to a byte buffer. The byte buffer\n * contains only the DER-encoded value, not any tag or length bytes.\n *\n * @param oid the OID dot-separated string.\n *\n * @return the byte buffer.\n */\nasn1.oidToDer = function(oid) {\n // split OID into individual values\n var values = oid.split('.');\n var bytes = forge.util.createBuffer();\n\n // first byte is 40 * value1 + value2\n bytes.putByte(40 * parseInt(values[0], 10) + parseInt(values[1], 10));\n // other bytes are each value in base 128 with 8th bit set except for\n // the last byte for each value\n var last, valueBytes, value, b;\n for(var i = 2; i < values.length; ++i) {\n // produce value bytes in reverse because we don't know how many\n // bytes it will take to store the value\n last = true;\n valueBytes = [];\n value = parseInt(values[i], 10);\n do {\n b = value & 0x7F;\n value = value >>> 7;\n // if value is not last, then turn on 8th bit\n if(!last) {\n b |= 0x80;\n }\n valueBytes.push(b);\n last = false;\n } while(value > 0);\n\n // add value bytes in reverse (needs to be in big endian)\n for(var n = valueBytes.length - 1; n >= 0; --n) {\n bytes.putByte(valueBytes[n]);\n }\n }\n\n return bytes;\n};\n\n/**\n * Converts a DER-encoded byte buffer to an OID dot-separated string. The\n * byte buffer should contain only the DER-encoded value, not any tag or\n * length bytes.\n *\n * @param bytes the byte buffer.\n *\n * @return the OID dot-separated string.\n */\nasn1.derToOid = function(bytes) {\n var oid;\n\n // wrap in buffer if needed\n if(typeof bytes === 'string') {\n bytes = forge.util.createBuffer(bytes);\n }\n\n // first byte is 40 * value1 + value2\n var b = bytes.getByte();\n oid = Math.floor(b / 40) + '.' + (b % 40);\n\n // other bytes are each value in base 128 with 8th bit set except for\n // the last byte for each value\n var value = 0;\n while(bytes.length() > 0) {\n b = bytes.getByte();\n value = value << 7;\n // not the last byte for the value\n if(b & 0x80) {\n value += b & 0x7F;\n } else {\n // last byte\n oid += '.' + (value + b);\n value = 0;\n }\n }\n\n return oid;\n};\n\n/**\n * Converts a UTCTime value to a date.\n *\n * Note: GeneralizedTime has 4 digits for the year and is used for X.509\n * dates past 2049. Parsing that structure hasn't been implemented yet.\n *\n * @param utc the UTCTime value to convert.\n *\n * @return the date.\n */\nasn1.utcTimeToDate = function(utc) {\n /* The following formats can be used:\n\n YYMMDDhhmmZ\n YYMMDDhhmm+hh'mm'\n YYMMDDhhmm-hh'mm'\n YYMMDDhhmmssZ\n YYMMDDhhmmss+hh'mm'\n YYMMDDhhmmss-hh'mm'\n\n Where:\n\n YY is the least significant two digits of the year\n MM is the month (01 to 12)\n DD is the day (01 to 31)\n hh is the hour (00 to 23)\n mm are the minutes (00 to 59)\n ss are the seconds (00 to 59)\n Z indicates that local time is GMT, + indicates that local time is\n later than GMT, and - indicates that local time is earlier than GMT\n hh' is the absolute value of the offset from GMT in hours\n mm' is the absolute value of the offset from GMT in minutes */\n var date = new Date();\n\n // if YY >= 50 use 19xx, if YY < 50 use 20xx\n var year = parseInt(utc.substr(0, 2), 10);\n year = (year >= 50) ? 1900 + year : 2000 + year;\n var MM = parseInt(utc.substr(2, 2), 10) - 1; // use 0-11 for month\n var DD = parseInt(utc.substr(4, 2), 10);\n var hh = parseInt(utc.substr(6, 2), 10);\n var mm = parseInt(utc.substr(8, 2), 10);\n var ss = 0;\n\n // not just YYMMDDhhmmZ\n if(utc.length > 11) {\n // get character after minutes\n var c = utc.charAt(10);\n var end = 10;\n\n // see if seconds are present\n if(c !== '+' && c !== '-') {\n // get seconds\n ss = parseInt(utc.substr(10, 2), 10);\n end += 2;\n }\n }\n\n // update date\n date.setUTCFullYear(year, MM, DD);\n date.setUTCHours(hh, mm, ss, 0);\n\n if(end) {\n // get +/- after end of time\n c = utc.charAt(end);\n if(c === '+' || c === '-') {\n // get hours+minutes offset\n var hhoffset = parseInt(utc.substr(end + 1, 2), 10);\n var mmoffset = parseInt(utc.substr(end + 4, 2), 10);\n\n // calculate offset in milliseconds\n var offset = hhoffset * 60 + mmoffset;\n offset *= 60000;\n\n // apply offset\n if(c === '+') {\n date.setTime(+date - offset);\n } else {\n date.setTime(+date + offset);\n }\n }\n }\n\n return date;\n};\n\n/**\n * Converts a GeneralizedTime value to a date.\n *\n * @param gentime the GeneralizedTime value to convert.\n *\n * @return the date.\n */\nasn1.generalizedTimeToDate = function(gentime) {\n /* The following formats can be used:\n\n YYYYMMDDHHMMSS\n YYYYMMDDHHMMSS.fff\n YYYYMMDDHHMMSSZ\n YYYYMMDDHHMMSS.fffZ\n YYYYMMDDHHMMSS+hh'mm'\n YYYYMMDDHHMMSS.fff+hh'mm'\n YYYYMMDDHHMMSS-hh'mm'\n YYYYMMDDHHMMSS.fff-hh'mm'\n\n Where:\n\n YYYY is the year\n MM is the month (01 to 12)\n DD is the day (01 to 31)\n hh is the hour (00 to 23)\n mm are the minutes (00 to 59)\n ss are the seconds (00 to 59)\n .fff is the second fraction, accurate to three decimal places\n Z indicates that local time is GMT, + indicates that local time is\n later than GMT, and - indicates that local time is earlier than GMT\n hh' is the absolute value of the offset from GMT in hours\n mm' is the absolute value of the offset from GMT in minutes */\n var date = new Date();\n\n var YYYY = parseInt(gentime.substr(0, 4), 10);\n var MM = parseInt(gentime.substr(4, 2), 10) - 1; // use 0-11 for month\n var DD = parseInt(gentime.substr(6, 2), 10);\n var hh = parseInt(gentime.substr(8, 2), 10);\n var mm = parseInt(gentime.substr(10, 2), 10);\n var ss = parseInt(gentime.substr(12, 2), 10);\n var fff = 0;\n var offset = 0;\n var isUTC = false;\n\n if(gentime.charAt(gentime.length - 1) === 'Z') {\n isUTC = true;\n }\n\n var end = gentime.length - 5, c = gentime.charAt(end);\n if(c === '+' || c === '-') {\n // get hours+minutes offset\n var hhoffset = parseInt(gentime.substr(end + 1, 2), 10);\n var mmoffset = parseInt(gentime.substr(end + 4, 2), 10);\n\n // calculate offset in milliseconds\n offset = hhoffset * 60 + mmoffset;\n offset *= 60000;\n\n // apply offset\n if(c === '+') {\n offset *= -1;\n }\n\n isUTC = true;\n }\n\n // check for second fraction\n if(gentime.charAt(14) === '.') {\n fff = parseFloat(gentime.substr(14), 10) * 1000;\n }\n\n if(isUTC) {\n date.setUTCFullYear(YYYY, MM, DD);\n date.setUTCHours(hh, mm, ss, fff);\n\n // apply offset\n date.setTime(+date + offset);\n } else {\n date.setFullYear(YYYY, MM, DD);\n date.setHours(hh, mm, ss, fff);\n }\n\n return date;\n};\n\n/**\n * Converts a date to a UTCTime value.\n *\n * Note: GeneralizedTime has 4 digits for the year and is used for X.509\n * dates past 2049. Converting to a GeneralizedTime hasn't been\n * implemented yet.\n *\n * @param date the date to convert.\n *\n * @return the UTCTime value.\n */\nasn1.dateToUtcTime = function(date) {\n // TODO: validate; currently assumes proper format\n if(typeof date === 'string') {\n return date;\n }\n\n var rval = '';\n\n // create format YYMMDDhhmmssZ\n var format = [];\n format.push(('' + date.getUTCFullYear()).substr(2));\n format.push('' + (date.getUTCMonth() + 1));\n format.push('' + date.getUTCDate());\n format.push('' + date.getUTCHours());\n format.push('' + date.getUTCMinutes());\n format.push('' + date.getUTCSeconds());\n\n // ensure 2 digits are used for each format entry\n for(var i = 0; i < format.length; ++i) {\n if(format[i].length < 2) {\n rval += '0';\n }\n rval += format[i];\n }\n rval += 'Z';\n\n return rval;\n};\n\n/**\n * Converts a date to a GeneralizedTime value.\n *\n * @param date the date to convert.\n *\n * @return the GeneralizedTime value as a string.\n */\nasn1.dateToGeneralizedTime = function(date) {\n // TODO: validate; currently assumes proper format\n if(typeof date === 'string') {\n return date;\n }\n\n var rval = '';\n\n // create format YYYYMMDDHHMMSSZ\n var format = [];\n format.push('' + date.getUTCFullYear());\n format.push('' + (date.getUTCMonth() + 1));\n format.push('' + date.getUTCDate());\n format.push('' + date.getUTCHours());\n format.push('' + date.getUTCMinutes());\n format.push('' + date.getUTCSeconds());\n\n // ensure 2 digits are used for each format entry\n for(var i = 0; i < format.length; ++i) {\n if(format[i].length < 2) {\n rval += '0';\n }\n rval += format[i];\n }\n rval += 'Z';\n\n return rval;\n};\n\n/**\n * Converts a javascript integer to a DER-encoded byte buffer to be used\n * as the value for an INTEGER type.\n *\n * @param x the integer.\n *\n * @return the byte buffer.\n */\nasn1.integerToDer = function(x) {\n var rval = forge.util.createBuffer();\n if(x >= -0x80 && x < 0x80) {\n return rval.putSignedInt(x, 8);\n }\n if(x >= -0x8000 && x < 0x8000) {\n return rval.putSignedInt(x, 16);\n }\n if(x >= -0x800000 && x < 0x800000) {\n return rval.putSignedInt(x, 24);\n }\n if(x >= -0x80000000 && x < 0x80000000) {\n return rval.putSignedInt(x, 32);\n }\n var error = new Error('Integer too large; max is 32-bits.');\n error.integer = x;\n throw error;\n};\n\n/**\n * Converts a DER-encoded byte buffer to a javascript integer. This is\n * typically used to decode the value of an INTEGER type.\n *\n * @param bytes the byte buffer.\n *\n * @return the integer.\n */\nasn1.derToInteger = function(bytes) {\n // wrap in buffer if needed\n if(typeof bytes === 'string') {\n bytes = forge.util.createBuffer(bytes);\n }\n\n var n = bytes.length() * 8;\n if(n > 32) {\n throw new Error('Integer too large; max is 32-bits.');\n }\n return bytes.getSignedInt(n);\n};\n\n/**\n * Validates that the given ASN.1 object is at least a super set of the\n * given ASN.1 structure. Only tag classes and types are checked. An\n * optional map may also be provided to capture ASN.1 values while the\n * structure is checked.\n *\n * To capture an ASN.1 value, set an object in the validator's 'capture'\n * parameter to the key to use in the capture map. To capture the full\n * ASN.1 object, specify 'captureAsn1'. To capture BIT STRING bytes, including\n * the leading unused bits counter byte, specify 'captureBitStringContents'.\n * To capture BIT STRING bytes, without the leading unused bits counter byte,\n * specify 'captureBitStringValue'.\n *\n * Objects in the validator may set a field 'optional' to true to indicate\n * that it isn't necessary to pass validation.\n *\n * @param obj the ASN.1 object to validate.\n * @param v the ASN.1 structure validator.\n * @param capture an optional map to capture values in.\n * @param errors an optional array for storing validation errors.\n *\n * @return true on success, false on failure.\n */\nasn1.validate = function(obj, v, capture, errors) {\n var rval = false;\n\n // ensure tag class and type are the same if specified\n if((obj.tagClass === v.tagClass || typeof(v.tagClass) === 'undefined') &&\n (obj.type === v.type || typeof(v.type) === 'undefined')) {\n // ensure constructed flag is the same if specified\n if(obj.constructed === v.constructed ||\n typeof(v.constructed) === 'undefined') {\n rval = true;\n\n // handle sub values\n if(v.value && forge.util.isArray(v.value)) {\n var j = 0;\n for(var i = 0; rval && i < v.value.length; ++i) {\n rval = v.value[i].optional || false;\n if(obj.value[j]) {\n rval = asn1.validate(obj.value[j], v.value[i], capture, errors);\n if(rval) {\n ++j;\n } else if(v.value[i].optional) {\n rval = true;\n }\n }\n if(!rval && errors) {\n errors.push(\n '[' + v.name + '] ' +\n 'Tag class \"' + v.tagClass + '\", type \"' +\n v.type + '\" expected value length \"' +\n v.value.length + '\", got \"' +\n obj.value.length + '\"');\n }\n }\n }\n\n if(rval && capture) {\n if(v.capture) {\n capture[v.capture] = obj.value;\n }\n if(v.captureAsn1) {\n capture[v.captureAsn1] = obj;\n }\n if(v.captureBitStringContents && 'bitStringContents' in obj) {\n capture[v.captureBitStringContents] = obj.bitStringContents;\n }\n if(v.captureBitStringValue && 'bitStringContents' in obj) {\n var value;\n if(obj.bitStringContents.length < 2) {\n capture[v.captureBitStringValue] = '';\n } else {\n // FIXME: support unused bits with data shifting\n var unused = obj.bitStringContents.charCodeAt(0);\n if(unused !== 0) {\n throw new Error(\n 'captureBitStringValue only supported for zero unused bits');\n }\n capture[v.captureBitStringValue] = obj.bitStringContents.slice(1);\n }\n }\n }\n } else if(errors) {\n errors.push(\n '[' + v.name + '] ' +\n 'Expected constructed \"' + v.constructed + '\", got \"' +\n obj.constructed + '\"');\n }\n } else if(errors) {\n if(obj.tagClass !== v.tagClass) {\n errors.push(\n '[' + v.name + '] ' +\n 'Expected tag class \"' + v.tagClass + '\", got \"' +\n obj.tagClass + '\"');\n }\n if(obj.type !== v.type) {\n errors.push(\n '[' + v.name + '] ' +\n 'Expected type \"' + v.type + '\", got \"' + obj.type + '\"');\n }\n }\n return rval;\n};\n\n// regex for testing for non-latin characters\nvar _nonLatinRegex = /[^\\\\u0000-\\\\u00ff]/;\n\n/**\n * Pretty prints an ASN.1 object to a string.\n *\n * @param obj the object to write out.\n * @param level the level in the tree.\n * @param indentation the indentation to use.\n *\n * @return the string.\n */\nasn1.prettyPrint = function(obj, level, indentation) {\n var rval = '';\n\n // set default level and indentation\n level = level || 0;\n indentation = indentation || 2;\n\n // start new line for deep levels\n if(level > 0) {\n rval += '\\n';\n }\n\n // create indent\n var indent = '';\n for(var i = 0; i < level * indentation; ++i) {\n indent += ' ';\n }\n\n // print class:type\n rval += indent + 'Tag: ';\n switch(obj.tagClass) {\n case asn1.Class.UNIVERSAL:\n rval += 'Universal:';\n break;\n case asn1.Class.APPLICATION:\n rval += 'Application:';\n break;\n case asn1.Class.CONTEXT_SPECIFIC:\n rval += 'Context-Specific:';\n break;\n case asn1.Class.PRIVATE:\n rval += 'Private:';\n break;\n }\n\n if(obj.tagClass === asn1.Class.UNIVERSAL) {\n rval += obj.type;\n\n // known types\n switch(obj.type) {\n case asn1.Type.NONE:\n rval += ' (None)';\n break;\n case asn1.Type.BOOLEAN:\n rval += ' (Boolean)';\n break;\n case asn1.Type.INTEGER:\n rval += ' (Integer)';\n break;\n case asn1.Type.BITSTRING:\n rval += ' (Bit string)';\n break;\n case asn1.Type.OCTETSTRING:\n rval += ' (Octet string)';\n break;\n case asn1.Type.NULL:\n rval += ' (Null)';\n break;\n case asn1.Type.OID:\n rval += ' (Object Identifier)';\n break;\n case asn1.Type.ODESC:\n rval += ' (Object Descriptor)';\n break;\n case asn1.Type.EXTERNAL:\n rval += ' (External or Instance of)';\n break;\n case asn1.Type.REAL:\n rval += ' (Real)';\n break;\n case asn1.Type.ENUMERATED:\n rval += ' (Enumerated)';\n break;\n case asn1.Type.EMBEDDED:\n rval += ' (Embedded PDV)';\n break;\n case asn1.Type.UTF8:\n rval += ' (UTF8)';\n break;\n case asn1.Type.ROID:\n rval += ' (Relative Object Identifier)';\n break;\n case asn1.Type.SEQUENCE:\n rval += ' (Sequence)';\n break;\n case asn1.Type.SET:\n rval += ' (Set)';\n break;\n case asn1.Type.PRINTABLESTRING:\n rval += ' (Printable String)';\n break;\n case asn1.Type.IA5String:\n rval += ' (IA5String (ASCII))';\n break;\n case asn1.Type.UTCTIME:\n rval += ' (UTC time)';\n break;\n case asn1.Type.GENERALIZEDTIME:\n rval += ' (Generalized time)';\n break;\n case asn1.Type.BMPSTRING:\n rval += ' (BMP String)';\n break;\n }\n } else {\n rval += obj.type;\n }\n\n rval += '\\n';\n rval += indent + 'Constructed: ' + obj.constructed + '\\n';\n\n if(obj.composed) {\n var subvalues = 0;\n var sub = '';\n for(var i = 0; i < obj.value.length; ++i) {\n if(obj.value[i] !== undefined) {\n subvalues += 1;\n sub += asn1.prettyPrint(obj.value[i], level + 1, indentation);\n if((i + 1) < obj.value.length) {\n sub += ',';\n }\n }\n }\n rval += indent + 'Sub values: ' + subvalues + sub;\n } else {\n rval += indent + 'Value: ';\n if(obj.type === asn1.Type.OID) {\n var oid = asn1.derToOid(obj.value);\n rval += oid;\n if(forge.pki && forge.pki.oids) {\n if(oid in forge.pki.oids) {\n rval += ' (' + forge.pki.oids[oid] + ') ';\n }\n }\n }\n if(obj.type === asn1.Type.INTEGER) {\n try {\n rval += asn1.derToInteger(obj.value);\n } catch(ex) {\n rval += '0x' + forge.util.bytesToHex(obj.value);\n }\n } else if(obj.type === asn1.Type.BITSTRING) {\n // TODO: shift bits as needed to display without padding\n if(obj.value.length > 1) {\n // remove unused bits field\n rval += '0x' + forge.util.bytesToHex(obj.value.slice(1));\n } else {\n rval += '(none)';\n }\n // show unused bit count\n if(obj.value.length > 0) {\n var unused = obj.value.charCodeAt(0);\n if(unused == 1) {\n rval += ' (1 unused bit shown)';\n } else if(unused > 1) {\n rval += ' (' + unused + ' unused bits shown)';\n }\n }\n } else if(obj.type === asn1.Type.OCTETSTRING) {\n if(!_nonLatinRegex.test(obj.value)) {\n rval += '(' + obj.value + ') ';\n }\n rval += '0x' + forge.util.bytesToHex(obj.value);\n } else if(obj.type === asn1.Type.UTF8) {\n try {\n rval += forge.util.decodeUtf8(obj.value);\n } catch(e) {\n if(e.message === 'URI malformed') {\n rval +=\n '0x' + forge.util.bytesToHex(obj.value) + ' (malformed UTF8)';\n } else {\n throw e;\n }\n }\n } else if(obj.type === asn1.Type.PRINTABLESTRING ||\n obj.type === asn1.Type.IA5String) {\n rval += obj.value;\n } else if(_nonLatinRegex.test(obj.value)) {\n rval += '0x' + forge.util.bytesToHex(obj.value);\n } else if(obj.value.length === 0) {\n rval += '[null]';\n } else {\n rval += obj.value;\n }\n }\n\n return rval;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/asn1.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/baseN.js": +/*!**********************************************!*\ + !*** ./node_modules/node-forge/lib/baseN.js ***! + \**********************************************/ +/***/ ((module) => { + +eval("/**\n * Base-N/Base-X encoding/decoding functions.\n *\n * Original implementation from base-x:\n * https://github.com/cryptocoinjs/base-x\n *\n * Which is MIT licensed:\n *\n * The MIT License (MIT)\n *\n * Copyright base-x contributors (c) 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nvar api = {};\nmodule.exports = api;\n\n// baseN alphabet indexes\nvar _reverseAlphabets = {};\n\n/**\n * BaseN-encodes a Uint8Array using the given alphabet.\n *\n * @param input the Uint8Array to encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the baseN-encoded output string.\n */\napi.encode = function(input, alphabet, maxline) {\n if(typeof alphabet !== 'string') {\n throw new TypeError('\"alphabet\" must be a string.');\n }\n if(maxline !== undefined && typeof maxline !== 'number') {\n throw new TypeError('\"maxline\" must be a number.');\n }\n\n var output = '';\n\n if(!(input instanceof Uint8Array)) {\n // assume forge byte buffer\n output = _encodeWithByteBuffer(input, alphabet);\n } else {\n var i = 0;\n var base = alphabet.length;\n var first = alphabet.charAt(0);\n var digits = [0];\n for(i = 0; i < input.length; ++i) {\n for(var j = 0, carry = input[i]; j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % base;\n carry = (carry / base) | 0;\n }\n\n while(carry > 0) {\n digits.push(carry % base);\n carry = (carry / base) | 0;\n }\n }\n\n // deal with leading zeros\n for(i = 0; input[i] === 0 && i < input.length - 1; ++i) {\n output += first;\n }\n // convert digits to a string\n for(i = digits.length - 1; i >= 0; --i) {\n output += alphabet[digits[i]];\n }\n }\n\n if(maxline) {\n var regex = new RegExp('.{1,' + maxline + '}', 'g');\n output = output.match(regex).join('\\r\\n');\n }\n\n return output;\n};\n\n/**\n * Decodes a baseN-encoded (using the given alphabet) string to a\n * Uint8Array.\n *\n * @param input the baseN-encoded input string.\n *\n * @return the Uint8Array.\n */\napi.decode = function(input, alphabet) {\n if(typeof input !== 'string') {\n throw new TypeError('\"input\" must be a string.');\n }\n if(typeof alphabet !== 'string') {\n throw new TypeError('\"alphabet\" must be a string.');\n }\n\n var table = _reverseAlphabets[alphabet];\n if(!table) {\n // compute reverse alphabet\n table = _reverseAlphabets[alphabet] = [];\n for(var i = 0; i < alphabet.length; ++i) {\n table[alphabet.charCodeAt(i)] = i;\n }\n }\n\n // remove whitespace characters\n input = input.replace(/\\s/g, '');\n\n var base = alphabet.length;\n var first = alphabet.charAt(0);\n var bytes = [0];\n for(var i = 0; i < input.length; i++) {\n var value = table[input.charCodeAt(i)];\n if(value === undefined) {\n return;\n }\n\n for(var j = 0, carry = value; j < bytes.length; ++j) {\n carry += bytes[j] * base;\n bytes[j] = carry & 0xff;\n carry >>= 8;\n }\n\n while(carry > 0) {\n bytes.push(carry & 0xff);\n carry >>= 8;\n }\n }\n\n // deal with leading zeros\n for(var k = 0; input[k] === first && k < input.length - 1; ++k) {\n bytes.push(0);\n }\n\n if(typeof Buffer !== 'undefined') {\n return Buffer.from(bytes.reverse());\n }\n\n return new Uint8Array(bytes.reverse());\n};\n\nfunction _encodeWithByteBuffer(input, alphabet) {\n var i = 0;\n var base = alphabet.length;\n var first = alphabet.charAt(0);\n var digits = [0];\n for(i = 0; i < input.length(); ++i) {\n for(var j = 0, carry = input.at(i); j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % base;\n carry = (carry / base) | 0;\n }\n\n while(carry > 0) {\n digits.push(carry % base);\n carry = (carry / base) | 0;\n }\n }\n\n var output = '';\n\n // deal with leading zeros\n for(i = 0; input.at(i) === 0 && i < input.length() - 1; ++i) {\n output += first;\n }\n // convert digits to a string\n for(i = digits.length - 1; i >= 0; --i) {\n output += alphabet[digits[i]];\n }\n\n return output;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/baseN.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/cipher.js": +/*!***********************************************!*\ + !*** ./node_modules/node-forge/lib/cipher.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Cipher base API.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nmodule.exports = forge.cipher = forge.cipher || {};\n\n// registered algorithms\nforge.cipher.algorithms = forge.cipher.algorithms || {};\n\n/**\n * Creates a cipher object that can be used to encrypt data using the given\n * algorithm and key. The algorithm may be provided as a string value for a\n * previously registered algorithm or it may be given as a cipher algorithm\n * API object.\n *\n * @param algorithm the algorithm to use, either a string or an algorithm API\n * object.\n * @param key the key to use, as a binary-encoded string of bytes or a\n * byte buffer.\n *\n * @return the cipher.\n */\nforge.cipher.createCipher = function(algorithm, key) {\n var api = algorithm;\n if(typeof api === 'string') {\n api = forge.cipher.getAlgorithm(api);\n if(api) {\n api = api();\n }\n }\n if(!api) {\n throw new Error('Unsupported algorithm: ' + algorithm);\n }\n\n // assume block cipher\n return new forge.cipher.BlockCipher({\n algorithm: api,\n key: key,\n decrypt: false\n });\n};\n\n/**\n * Creates a decipher object that can be used to decrypt data using the given\n * algorithm and key. The algorithm may be provided as a string value for a\n * previously registered algorithm or it may be given as a cipher algorithm\n * API object.\n *\n * @param algorithm the algorithm to use, either a string or an algorithm API\n * object.\n * @param key the key to use, as a binary-encoded string of bytes or a\n * byte buffer.\n *\n * @return the cipher.\n */\nforge.cipher.createDecipher = function(algorithm, key) {\n var api = algorithm;\n if(typeof api === 'string') {\n api = forge.cipher.getAlgorithm(api);\n if(api) {\n api = api();\n }\n }\n if(!api) {\n throw new Error('Unsupported algorithm: ' + algorithm);\n }\n\n // assume block cipher\n return new forge.cipher.BlockCipher({\n algorithm: api,\n key: key,\n decrypt: true\n });\n};\n\n/**\n * Registers an algorithm by name. If the name was already registered, the\n * algorithm API object will be overwritten.\n *\n * @param name the name of the algorithm.\n * @param algorithm the algorithm API object.\n */\nforge.cipher.registerAlgorithm = function(name, algorithm) {\n name = name.toUpperCase();\n forge.cipher.algorithms[name] = algorithm;\n};\n\n/**\n * Gets a registered algorithm by name.\n *\n * @param name the name of the algorithm.\n *\n * @return the algorithm, if found, null if not.\n */\nforge.cipher.getAlgorithm = function(name) {\n name = name.toUpperCase();\n if(name in forge.cipher.algorithms) {\n return forge.cipher.algorithms[name];\n }\n return null;\n};\n\nvar BlockCipher = forge.cipher.BlockCipher = function(options) {\n this.algorithm = options.algorithm;\n this.mode = this.algorithm.mode;\n this.blockSize = this.mode.blockSize;\n this._finish = false;\n this._input = null;\n this.output = null;\n this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt;\n this._decrypt = options.decrypt;\n this.algorithm.initialize(options);\n};\n\n/**\n * Starts or restarts the encryption or decryption process, whichever\n * was previously configured.\n *\n * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array\n * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in\n * bytes, then it must be Nb (16) bytes in length. If the IV is given in as\n * 32-bit integers, then it must be 4 integers long.\n *\n * Note: an IV is not required or used in ECB mode.\n *\n * For GCM-mode, the IV must be given as a binary-encoded string of bytes or\n * a byte buffer. The number of bytes should be 12 (96 bits) as recommended\n * by NIST SP-800-38D but another length may be given.\n *\n * @param options the options to use:\n * iv the initialization vector to use as a binary-encoded string of\n * bytes, null to reuse the last ciphered block from a previous\n * update() (this \"residue\" method is for legacy support only).\n * additionalData additional authentication data as a binary-encoded\n * string of bytes, for 'GCM' mode, (default: none).\n * tagLength desired length of authentication tag, in bits, for\n * 'GCM' mode (0-128, default: 128).\n * tag the authentication tag to check if decrypting, as a\n * binary-encoded string of bytes.\n * output the output the buffer to write to, null to create one.\n */\nBlockCipher.prototype.start = function(options) {\n options = options || {};\n var opts = {};\n for(var key in options) {\n opts[key] = options[key];\n }\n opts.decrypt = this._decrypt;\n this._finish = false;\n this._input = forge.util.createBuffer();\n this.output = options.output || forge.util.createBuffer();\n this.mode.start(opts);\n};\n\n/**\n * Updates the next block according to the cipher mode.\n *\n * @param input the buffer to read from.\n */\nBlockCipher.prototype.update = function(input) {\n if(input) {\n // input given, so empty it into the input buffer\n this._input.putBuffer(input);\n }\n\n // do cipher operation until it needs more input and not finished\n while(!this._op.call(this.mode, this._input, this.output, this._finish) &&\n !this._finish) {}\n\n // free consumed memory from input buffer\n this._input.compact();\n};\n\n/**\n * Finishes encrypting or decrypting.\n *\n * @param pad a padding function to use in CBC mode, null for default,\n * signature(blockSize, buffer, decrypt).\n *\n * @return true if successful, false on error.\n */\nBlockCipher.prototype.finish = function(pad) {\n // backwards-compatibility w/deprecated padding API\n // Note: will overwrite padding functions even after another start() call\n if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) {\n this.mode.pad = function(input) {\n return pad(this.blockSize, input, false);\n };\n this.mode.unpad = function(output) {\n return pad(this.blockSize, output, true);\n };\n }\n\n // build options for padding and afterFinish functions\n var options = {};\n options.decrypt = this._decrypt;\n\n // get # of bytes that won't fill a block\n options.overflow = this._input.length() % this.blockSize;\n\n if(!this._decrypt && this.mode.pad) {\n if(!this.mode.pad(this._input, options)) {\n return false;\n }\n }\n\n // do final update\n this._finish = true;\n this.update();\n\n if(this._decrypt && this.mode.unpad) {\n if(!this.mode.unpad(this.output, options)) {\n return false;\n }\n }\n\n if(this.mode.afterFinish) {\n if(!this.mode.afterFinish(this.output, options)) {\n return false;\n }\n }\n\n return true;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/cipher.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/cipherModes.js": +/*!****************************************************!*\ + !*** ./node_modules/node-forge/lib/cipherModes.js ***! + \****************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Supported cipher modes.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nforge.cipher = forge.cipher || {};\n\n// supported cipher modes\nvar modes = module.exports = forge.cipher.modes = forge.cipher.modes || {};\n\n/** Electronic codebook (ECB) (Don't use this; it's not secure) **/\n\nmodes.ecb = function(options) {\n options = options || {};\n this.name = 'ECB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n};\n\nmodes.ecb.prototype.start = function(options) {};\n\nmodes.ecb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // write output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n};\n\nmodes.ecb.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // decrypt block\n this.cipher.decrypt(this._inBlock, this._outBlock);\n\n // write output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n};\n\nmodes.ecb.prototype.pad = function(input, options) {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (input.length() === this.blockSize ?\n this.blockSize : (this.blockSize - input.length()));\n input.fillWithByte(padding, padding);\n return true;\n};\n\nmodes.ecb.prototype.unpad = function(output, options) {\n // check for error: input data not a multiple of blockSize\n if(options.overflow > 0) {\n return false;\n }\n\n // ensure padding byte count is valid\n var len = output.length();\n var count = output.at(len - 1);\n if(count > (this.blockSize << 2)) {\n return false;\n }\n\n // trim off padding bytes\n output.truncate(count);\n return true;\n};\n\n/** Cipher-block Chaining (CBC) **/\n\nmodes.cbc = function(options) {\n options = options || {};\n this.name = 'CBC';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n};\n\nmodes.cbc.prototype.start = function(options) {\n // Note: legacy support for using IV residue (has security flaws)\n // if IV is null, reuse block from previous processing\n if(options.iv === null) {\n // must have a previous block\n if(!this._prev) {\n throw new Error('Invalid IV parameter.');\n }\n this._iv = this._prev.slice(0);\n } else if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n } else {\n // save IV as \"previous\" block\n this._iv = transformIV(options.iv, this.blockSize);\n this._prev = this._iv.slice(0);\n }\n};\n\nmodes.cbc.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n // CBC XOR's IV (or previous block) with plaintext\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._prev[i] ^ input.getInt32();\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // write output, save previous block\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n this._prev = this._outBlock;\n};\n\nmodes.cbc.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // decrypt block\n this.cipher.decrypt(this._inBlock, this._outBlock);\n\n // write output, save previous ciphered block\n // CBC XOR's IV (or previous block) with ciphertext\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._prev[i] ^ this._outBlock[i]);\n }\n this._prev = this._inBlock.slice(0);\n};\n\nmodes.cbc.prototype.pad = function(input, options) {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (input.length() === this.blockSize ?\n this.blockSize : (this.blockSize - input.length()));\n input.fillWithByte(padding, padding);\n return true;\n};\n\nmodes.cbc.prototype.unpad = function(output, options) {\n // check for error: input data not a multiple of blockSize\n if(options.overflow > 0) {\n return false;\n }\n\n // ensure padding byte count is valid\n var len = output.length();\n var count = output.at(len - 1);\n if(count > (this.blockSize << 2)) {\n return false;\n }\n\n // trim off padding bytes\n output.truncate(count);\n return true;\n};\n\n/** Cipher feedback (CFB) **/\n\nmodes.cfb = function(options) {\n options = options || {};\n this.name = 'CFB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output, write input as output\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32() ^ this._outBlock[i];\n output.putInt32(this._inBlock[i]);\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output, write input as partial output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialBlock[i] = input.getInt32() ^ this._outBlock[i];\n this._partialOutput.putInt32(this._partialBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._partialBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block (CFB always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output, write input as output\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n output.putInt32(this._inBlock[i] ^ this._outBlock[i]);\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output, write input as partial output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialBlock[i] = input.getInt32();\n this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._partialBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\n/** Output feedback (OFB) **/\n\nmodes.ofb = function(options) {\n options = options || {};\n this.name = 'OFB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(input.length() === 0) {\n return true;\n }\n\n // encrypt block (OFB always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output and update next input\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(input.getInt32() ^ this._outBlock[i]);\n this._inBlock[i] = this._outBlock[i];\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._outBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt;\n\n/** Counter (CTR) **/\n\nmodes.ctr = function(options) {\n options = options || {};\n this.name = 'CTR';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.ctr.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.ctr.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block (CTR always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n } else {\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n }\n\n // block complete, increment counter (input block)\n inc32(this._inBlock);\n};\n\nmodes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt;\n\n/** Galois/Counter Mode (GCM) **/\n\nmodes.gcm = function(options) {\n options = options || {};\n this.name = 'GCM';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n\n // R is actually this value concatenated with 120 more zero bits, but\n // we only XOR against R so the other zeros have no effect -- we just\n // apply this value to the first integer in a block\n this._R = 0xE1000000;\n};\n\nmodes.gcm.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // ensure IV is a byte buffer\n var iv = forge.util.createBuffer(options.iv);\n\n // no ciphered data processed yet\n this._cipherLength = 0;\n\n // default additional data is none\n var additionalData;\n if('additionalData' in options) {\n additionalData = forge.util.createBuffer(options.additionalData);\n } else {\n additionalData = forge.util.createBuffer();\n }\n\n // default tag length is 128 bits\n if('tagLength' in options) {\n this._tagLength = options.tagLength;\n } else {\n this._tagLength = 128;\n }\n\n // if tag is given, ensure tag matches tag length\n this._tag = null;\n if(options.decrypt) {\n // save tag to check later\n this._tag = forge.util.createBuffer(options.tag).getBytes();\n if(this._tag.length !== (this._tagLength / 8)) {\n throw new Error('Authentication tag does not match tag length.');\n }\n }\n\n // create tmp storage for hash calculation\n this._hashBlock = new Array(this._ints);\n\n // no tag generated yet\n this.tag = null;\n\n // generate hash subkey\n // (apply block cipher to \"zero\" block)\n this._hashSubkey = new Array(this._ints);\n this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey);\n\n // generate table M\n // use 4-bit tables (32 component decomposition of a 16 byte value)\n // 8-bit tables take more space and are known to have security\n // vulnerabilities (in native implementations)\n this.componentBits = 4;\n this._m = this.generateHashTable(this._hashSubkey, this.componentBits);\n\n // Note: support IV length different from 96 bits? (only supporting\n // 96 bits is recommended by NIST SP-800-38D)\n // generate J_0\n var ivLength = iv.length();\n if(ivLength === 12) {\n // 96-bit IV\n this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1];\n } else {\n // IV is NOT 96-bits\n this._j0 = [0, 0, 0, 0];\n while(iv.length() > 0) {\n this._j0 = this.ghash(\n this._hashSubkey, this._j0,\n [iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]);\n }\n this._j0 = this.ghash(\n this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8)));\n }\n\n // generate ICB (initial counter block)\n this._inBlock = this._j0.slice(0);\n inc32(this._inBlock);\n this._partialBytes = 0;\n\n // consume authentication data\n additionalData = forge.util.createBuffer(additionalData);\n // save additional data length as a BE 64-bit number\n this._aDataLength = from64To32(additionalData.length() * 8);\n // pad additional data to 128 bit (16 byte) block size\n var overflow = additionalData.length() % this.blockSize;\n if(overflow) {\n additionalData.fillWithByte(0, this.blockSize - overflow);\n }\n this._s = [0, 0, 0, 0];\n while(additionalData.length() > 0) {\n this._s = this.ghash(this._hashSubkey, this._s, [\n additionalData.getInt32(),\n additionalData.getInt32(),\n additionalData.getInt32(),\n additionalData.getInt32()\n ]);\n }\n};\n\nmodes.gcm.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i] ^= input.getInt32());\n }\n this._cipherLength += this.blockSize;\n } else {\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes <= 0 || finish) {\n // handle overflow prior to hashing\n if(finish) {\n // get block overflow\n var overflow = inputLength % this.blockSize;\n this._cipherLength += overflow;\n // truncate for hash function\n this._partialOutput.truncate(this.blockSize - overflow);\n } else {\n this._cipherLength += this.blockSize;\n }\n\n // get output block for hashing\n for(var i = 0; i < this._ints; ++i) {\n this._outBlock[i] = this._partialOutput.getInt32();\n }\n this._partialOutput.read -= this.blockSize;\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n // block still incomplete, restore input buffer, get partial output,\n // and return early\n input.read -= this.blockSize;\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n }\n\n // update hash block S\n this._s = this.ghash(this._hashSubkey, this._s, this._outBlock);\n\n // increment counter (input block)\n inc32(this._inBlock);\n};\n\nmodes.gcm.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n var inputLength = input.length();\n if(inputLength < this.blockSize && !(finish && inputLength > 0)) {\n return true;\n }\n\n // encrypt block (GCM always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // increment counter (input block)\n inc32(this._inBlock);\n\n // update hash block S\n this._hashBlock[0] = input.getInt32();\n this._hashBlock[1] = input.getInt32();\n this._hashBlock[2] = input.getInt32();\n this._hashBlock[3] = input.getInt32();\n this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock);\n\n // XOR hash input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i] ^ this._hashBlock[i]);\n }\n\n // increment cipher data length\n if(inputLength < this.blockSize) {\n this._cipherLength += inputLength % this.blockSize;\n } else {\n this._cipherLength += this.blockSize;\n }\n};\n\nmodes.gcm.prototype.afterFinish = function(output, options) {\n var rval = true;\n\n // handle overflow\n if(options.decrypt && options.overflow) {\n output.truncate(this.blockSize - options.overflow);\n }\n\n // handle authentication tag\n this.tag = forge.util.createBuffer();\n\n // concatenate additional data length with cipher length\n var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8));\n\n // include lengths in hash\n this._s = this.ghash(this._hashSubkey, this._s, lengths);\n\n // do GCTR(J_0, S)\n var tag = [];\n this.cipher.encrypt(this._j0, tag);\n for(var i = 0; i < this._ints; ++i) {\n this.tag.putInt32(this._s[i] ^ tag[i]);\n }\n\n // trim tag to length\n this.tag.truncate(this.tag.length() % (this._tagLength / 8));\n\n // check authentication tag\n if(options.decrypt && this.tag.bytes() !== this._tag) {\n rval = false;\n }\n\n return rval;\n};\n\n/**\n * See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois\n * field multiplication. The field, GF(2^128), is defined by the polynomial:\n *\n * x^128 + x^7 + x^2 + x + 1\n *\n * Which is represented in little-endian binary form as: 11100001 (0xe1). When\n * the value of a coefficient is 1, a bit is set. The value R, is the\n * concatenation of this value and 120 zero bits, yielding a 128-bit value\n * which matches the block size.\n *\n * This function will multiply two elements (vectors of bytes), X and Y, in\n * the field GF(2^128). The result is initialized to zero. For each bit of\n * X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd)\n * by the current value of Y. For each bit, the value of Y will be raised by\n * a power of x (multiplied by the polynomial x). This can be achieved by\n * shifting Y once to the right. If the current value of Y, prior to being\n * multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial.\n * Otherwise, we must divide by R after shifting to find the remainder.\n *\n * @param x the first block to multiply by the second.\n * @param y the second block to multiply by the first.\n *\n * @return the block result of the multiplication.\n */\nmodes.gcm.prototype.multiply = function(x, y) {\n var z_i = [0, 0, 0, 0];\n var v_i = y.slice(0);\n\n // calculate Z_128 (block has 128 bits)\n for(var i = 0; i < 128; ++i) {\n // if x_i is 0, Z_{i+1} = Z_i (unchanged)\n // else Z_{i+1} = Z_i ^ V_i\n // get x_i by finding 32-bit int position, then left shift 1 by remainder\n var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32));\n if(x_i) {\n z_i[0] ^= v_i[0];\n z_i[1] ^= v_i[1];\n z_i[2] ^= v_i[2];\n z_i[3] ^= v_i[3];\n }\n\n // if LSB(V_i) is 1, V_i = V_i >> 1\n // else V_i = (V_i >> 1) ^ R\n this.pow(v_i, v_i);\n }\n\n return z_i;\n};\n\nmodes.gcm.prototype.pow = function(x, out) {\n // if LSB(x) is 1, x = x >>> 1\n // else x = (x >>> 1) ^ R\n var lsb = x[3] & 1;\n\n // always do x >>> 1:\n // starting with the rightmost integer, shift each integer to the right\n // one bit, pulling in the bit from the integer to the left as its top\n // most bit (do this for the last 3 integers)\n for(var i = 3; i > 0; --i) {\n out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31);\n }\n // shift the first integer normally\n out[0] = x[0] >>> 1;\n\n // if lsb was not set, then polynomial had a degree of 127 and doesn't\n // need to divided; otherwise, XOR with R to find the remainder; we only\n // need to XOR the first integer since R technically ends w/120 zero bits\n if(lsb) {\n out[0] ^= this._R;\n }\n};\n\nmodes.gcm.prototype.tableMultiply = function(x) {\n // assumes 4-bit tables are used\n var z = [0, 0, 0, 0];\n for(var i = 0; i < 32; ++i) {\n var idx = (i / 8) | 0;\n var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF;\n var ah = this._m[i][x_i];\n z[0] ^= ah[0];\n z[1] ^= ah[1];\n z[2] ^= ah[2];\n z[3] ^= ah[3];\n }\n return z;\n};\n\n/**\n * A continuing version of the GHASH algorithm that operates on a single\n * block. The hash block, last hash value (Ym) and the new block to hash\n * are given.\n *\n * @param h the hash block.\n * @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash.\n * @param x the block to hash.\n *\n * @return the hashed value (Ym).\n */\nmodes.gcm.prototype.ghash = function(h, y, x) {\n y[0] ^= x[0];\n y[1] ^= x[1];\n y[2] ^= x[2];\n y[3] ^= x[3];\n return this.tableMultiply(y);\n //return this.multiply(y, h);\n};\n\n/**\n * Precomputes a table for multiplying against the hash subkey. This\n * mechanism provides a substantial speed increase over multiplication\n * performed without a table. The table-based multiplication this table is\n * for solves X * H by multiplying each component of X by H and then\n * composing the results together using XOR.\n *\n * This function can be used to generate tables with different bit sizes\n * for the components, however, this implementation assumes there are\n * 32 components of X (which is a 16 byte vector), therefore each component\n * takes 4-bits (so the table is constructed with bits=4).\n *\n * @param h the hash subkey.\n * @param bits the bit size for a component.\n */\nmodes.gcm.prototype.generateHashTable = function(h, bits) {\n // TODO: There are further optimizations that would use only the\n // first table M_0 (or some variant) along with a remainder table;\n // this can be explored in the future\n var multiplier = 8 / bits;\n var perInt = 4 * multiplier;\n var size = 16 * multiplier;\n var m = new Array(size);\n for(var i = 0; i < size; ++i) {\n var tmp = [0, 0, 0, 0];\n var idx = (i / perInt) | 0;\n var shft = ((perInt - 1 - (i % perInt)) * bits);\n tmp[idx] = (1 << (bits - 1)) << shft;\n m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits);\n }\n return m;\n};\n\n/**\n * Generates a table for multiplying against the hash subkey for one\n * particular component (out of all possible component values).\n *\n * @param mid the pre-multiplied value for the middle key of the table.\n * @param bits the bit size for a component.\n */\nmodes.gcm.prototype.generateSubHashTable = function(mid, bits) {\n // compute the table quickly by minimizing the number of\n // POW operations -- they only need to be performed for powers of 2,\n // all other entries can be composed from those powers using XOR\n var size = 1 << bits;\n var half = size >>> 1;\n var m = new Array(size);\n m[half] = mid.slice(0);\n var i = half >>> 1;\n while(i > 0) {\n // raise m0[2 * i] and store in m0[i]\n this.pow(m[2 * i], m[i] = []);\n i >>= 1;\n }\n i = 2;\n while(i < half) {\n for(var j = 1; j < i; ++j) {\n var m_i = m[i];\n var m_j = m[j];\n m[i + j] = [\n m_i[0] ^ m_j[0],\n m_i[1] ^ m_j[1],\n m_i[2] ^ m_j[2],\n m_i[3] ^ m_j[3]\n ];\n }\n i *= 2;\n }\n m[0] = [0, 0, 0, 0];\n /* Note: We could avoid storing these by doing composition during multiply\n calculate top half using composition by speed is preferred. */\n for(i = half + 1; i < size; ++i) {\n var c = m[i ^ half];\n m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]];\n }\n return m;\n};\n\n/** Utility functions */\n\nfunction transformIV(iv, blockSize) {\n if(typeof iv === 'string') {\n // convert iv string into byte buffer\n iv = forge.util.createBuffer(iv);\n }\n\n if(forge.util.isArray(iv) && iv.length > 4) {\n // convert iv byte array into byte buffer\n var tmp = iv;\n iv = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n iv.putByte(tmp[i]);\n }\n }\n\n if(iv.length() < blockSize) {\n throw new Error(\n 'Invalid IV length; got ' + iv.length() +\n ' bytes and expected ' + blockSize + ' bytes.');\n }\n\n if(!forge.util.isArray(iv)) {\n // convert iv byte buffer into 32-bit integer array\n var ints = [];\n var blocks = blockSize / 4;\n for(var i = 0; i < blocks; ++i) {\n ints.push(iv.getInt32());\n }\n iv = ints;\n }\n\n return iv;\n}\n\nfunction inc32(block) {\n // increment last 32 bits of block only\n block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF;\n}\n\nfunction from64To32(num) {\n // convert 64-bit number to two BE Int32s\n return [(num / 0x100000000) | 0, num & 0xFFFFFFFF];\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/cipherModes.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/des.js": +/*!********************************************!*\ + !*** ./node_modules/node-forge/lib/des.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * DES (Data Encryption Standard) implementation.\n *\n * This implementation supports DES as well as 3DES-EDE in ECB and CBC mode.\n * It is based on the BSD-licensed implementation by Paul Tero:\n *\n * Paul Tero, July 2001\n * http://www.tero.co.uk/des/\n *\n * Optimised for performance with large blocks by\n * Michael Hayworth, November 2001\n * http://www.netdealing.com\n *\n * THIS SOFTWARE IS PROVIDED \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @author Stefan Siegl\n * @author Dave Longley\n *\n * Copyright (c) 2012 Stefan Siegl \n * Copyright (c) 2012-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./cipher */ \"./node_modules/node-forge/lib/cipher.js\");\n__webpack_require__(/*! ./cipherModes */ \"./node_modules/node-forge/lib/cipherModes.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n/* DES API */\nmodule.exports = forge.des = forge.des || {};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('DES-', key);\n * cipher.start({iv: iv});\n *\n * Creates an DES cipher object to encrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as binary-encoded strings of bytes or\n * byte buffers.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC' if IV is\n * given, 'ECB' if null).\n *\n * @return the cipher.\n */\nforge.des.startEncrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: false,\n mode: mode || (iv === null ? 'ECB' : 'CBC')\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var cipher = forge.cipher.createCipher('DES-', key);\n *\n * Creates an DES cipher object to encrypt data using the given symmetric key.\n *\n * The key may be given as a binary-encoded string of bytes or a byte buffer.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.des.createEncryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: false,\n mode: mode\n });\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('DES-', key);\n * decipher.start({iv: iv});\n *\n * Creates an DES cipher object to decrypt data using the given symmetric key.\n * The output will be stored in the 'output' member of the returned cipher.\n *\n * The key and iv may be given as binary-encoded strings of bytes or\n * byte buffers.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n * @param mode the cipher mode to use (default: 'CBC' if IV is\n * given, 'ECB' if null).\n *\n * @return the cipher.\n */\nforge.des.startDecrypting = function(key, iv, output, mode) {\n var cipher = _createCipher({\n key: key,\n output: output,\n decrypt: true,\n mode: mode || (iv === null ? 'ECB' : 'CBC')\n });\n cipher.start(iv);\n return cipher;\n};\n\n/**\n * Deprecated. Instead, use:\n *\n * var decipher = forge.cipher.createDecipher('DES-', key);\n *\n * Creates an DES cipher object to decrypt data using the given symmetric key.\n *\n * The key may be given as a binary-encoded string of bytes or a byte buffer.\n *\n * @param key the symmetric key to use (64 or 192 bits).\n * @param mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nforge.des.createDecryptionCipher = function(key, mode) {\n return _createCipher({\n key: key,\n output: null,\n decrypt: true,\n mode: mode\n });\n};\n\n/**\n * Creates a new DES cipher algorithm object.\n *\n * @param name the name of the algorithm.\n * @param mode the mode factory function.\n *\n * @return the DES algorithm object.\n */\nforge.des.Algorithm = function(name, mode) {\n var self = this;\n self.name = name;\n self.mode = new mode({\n blockSize: 8,\n cipher: {\n encrypt: function(inBlock, outBlock) {\n return _updateBlock(self._keys, inBlock, outBlock, false);\n },\n decrypt: function(inBlock, outBlock) {\n return _updateBlock(self._keys, inBlock, outBlock, true);\n }\n }\n });\n self._init = false;\n};\n\n/**\n * Initializes this DES algorithm by expanding its key.\n *\n * @param options the options to use.\n * key the key to use with this algorithm.\n * decrypt true if the algorithm should be initialized for decryption,\n * false for encryption.\n */\nforge.des.Algorithm.prototype.initialize = function(options) {\n if(this._init) {\n return;\n }\n\n var key = forge.util.createBuffer(options.key);\n if(this.name.indexOf('3DES') === 0) {\n if(key.length() !== 24) {\n throw new Error('Invalid Triple-DES key size: ' + key.length() * 8);\n }\n }\n\n // do key expansion to 16 or 48 subkeys (single or triple DES)\n this._keys = _createKeys(key);\n this._init = true;\n};\n\n/** Register DES algorithms **/\n\nregisterAlgorithm('DES-ECB', forge.cipher.modes.ecb);\nregisterAlgorithm('DES-CBC', forge.cipher.modes.cbc);\nregisterAlgorithm('DES-CFB', forge.cipher.modes.cfb);\nregisterAlgorithm('DES-OFB', forge.cipher.modes.ofb);\nregisterAlgorithm('DES-CTR', forge.cipher.modes.ctr);\n\nregisterAlgorithm('3DES-ECB', forge.cipher.modes.ecb);\nregisterAlgorithm('3DES-CBC', forge.cipher.modes.cbc);\nregisterAlgorithm('3DES-CFB', forge.cipher.modes.cfb);\nregisterAlgorithm('3DES-OFB', forge.cipher.modes.ofb);\nregisterAlgorithm('3DES-CTR', forge.cipher.modes.ctr);\n\nfunction registerAlgorithm(name, mode) {\n var factory = function() {\n return new forge.des.Algorithm(name, mode);\n };\n forge.cipher.registerAlgorithm(name, factory);\n}\n\n/** DES implementation **/\n\nvar spfunction1 = [0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004];\nvar spfunction2 = [-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000];\nvar spfunction3 = [0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200];\nvar spfunction4 = [0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080];\nvar spfunction5 = [0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100];\nvar spfunction6 = [0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010];\nvar spfunction7 = [0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002];\nvar spfunction8 = [0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000];\n\n/**\n * Create necessary sub keys.\n *\n * @param key the 64-bit or 192-bit key.\n *\n * @return the expanded keys.\n */\nfunction _createKeys(key) {\n var pc2bytes0 = [0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204],\n pc2bytes1 = [0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101],\n pc2bytes2 = [0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808],\n pc2bytes3 = [0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000],\n pc2bytes4 = [0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010],\n pc2bytes5 = [0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420],\n pc2bytes6 = [0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002],\n pc2bytes7 = [0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800],\n pc2bytes8 = [0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002],\n pc2bytes9 = [0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408],\n pc2bytes10 = [0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020],\n pc2bytes11 = [0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200],\n pc2bytes12 = [0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010],\n pc2bytes13 = [0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105];\n\n // how many iterations (1 for des, 3 for triple des)\n // changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys\n var iterations = key.length() > 8 ? 3 : 1;\n\n // stores the return keys\n var keys = [];\n\n // now define the left shifts which need to be done\n var shifts = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0];\n\n var n = 0, tmp;\n for(var j = 0; j < iterations; j++) {\n var left = key.getInt32();\n var right = key.getInt32();\n\n tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;\n right ^= tmp;\n left ^= (tmp << 4);\n\n tmp = ((right >>> -16) ^ left) & 0x0000ffff;\n left ^= tmp;\n right ^= (tmp << -16);\n\n tmp = ((left >>> 2) ^ right) & 0x33333333;\n right ^= tmp;\n left ^= (tmp << 2);\n\n tmp = ((right >>> -16) ^ left) & 0x0000ffff;\n left ^= tmp;\n right ^= (tmp << -16);\n\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n tmp = ((right >>> 8) ^ left) & 0x00ff00ff;\n left ^= tmp;\n right ^= (tmp << 8);\n\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n // right needs to be shifted and OR'd with last four bits of left\n tmp = (left << 8) | ((right >>> 20) & 0x000000f0);\n\n // left needs to be put upside down\n left = ((right << 24) | ((right << 8) & 0xff0000) |\n ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0));\n right = tmp;\n\n // now go through and perform these shifts on the left and right keys\n for(var i = 0; i < shifts.length; ++i) {\n //shift the keys either one or two bits to the left\n if(shifts[i]) {\n left = (left << 2) | (left >>> 26);\n right = (right << 2) | (right >>> 26);\n } else {\n left = (left << 1) | (left >>> 27);\n right = (right << 1) | (right >>> 27);\n }\n left &= -0xf;\n right &= -0xf;\n\n // now apply PC-2, in such a way that E is easier when encrypting or\n // decrypting this conversion will look like PC-2 except only the last 6\n // bits of each byte are used rather than 48 consecutive bits and the\n // order of lines will be according to how the S selection functions will\n // be applied: S2, S4, S6, S8, S1, S3, S5, S7\n var lefttmp = (\n pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] |\n pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] |\n pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] |\n pc2bytes6[(left >>> 4) & 0xf]);\n var righttmp = (\n pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] |\n pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] |\n pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] |\n pc2bytes13[(right >>> 4) & 0xf]);\n tmp = ((righttmp >>> 16) ^ lefttmp) & 0x0000ffff;\n keys[n++] = lefttmp ^ tmp;\n keys[n++] = righttmp ^ (tmp << 16);\n }\n }\n\n return keys;\n}\n\n/**\n * Updates a single block (1 byte) using DES. The update will either\n * encrypt or decrypt the block.\n *\n * @param keys the expanded keys.\n * @param input the input block (an array of 32-bit words).\n * @param output the updated output block.\n * @param decrypt true to decrypt the block, false to encrypt it.\n */\nfunction _updateBlock(keys, input, output, decrypt) {\n // set up loops for single or triple DES\n var iterations = keys.length === 32 ? 3 : 9;\n var looping;\n if(iterations === 3) {\n looping = decrypt ? [30, -2, -2] : [0, 32, 2];\n } else {\n looping = (decrypt ?\n [94, 62, -2, 32, 64, 2, 30, -2, -2] :\n [0, 32, 2, 62, 30, -2, 64, 96, 2]);\n }\n\n var tmp;\n\n var left = input[0];\n var right = input[1];\n\n // first each 64 bit chunk of the message must be permuted according to IP\n tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;\n right ^= tmp;\n left ^= (tmp << 4);\n\n tmp = ((left >>> 16) ^ right) & 0x0000ffff;\n right ^= tmp;\n left ^= (tmp << 16);\n\n tmp = ((right >>> 2) ^ left) & 0x33333333;\n left ^= tmp;\n right ^= (tmp << 2);\n\n tmp = ((right >>> 8) ^ left) & 0x00ff00ff;\n left ^= tmp;\n right ^= (tmp << 8);\n\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n // rotate left 1 bit\n left = ((left << 1) | (left >>> 31));\n right = ((right << 1) | (right >>> 31));\n\n for(var j = 0; j < iterations; j += 3) {\n var endloop = looping[j + 1];\n var loopinc = looping[j + 2];\n\n // now go through and perform the encryption or decryption\n for(var i = looping[j]; i != endloop; i += loopinc) {\n var right1 = right ^ keys[i];\n var right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1];\n\n // passing these bytes through the S selection functions\n tmp = left;\n left = right;\n right = tmp ^ (\n spfunction2[(right1 >>> 24) & 0x3f] |\n spfunction4[(right1 >>> 16) & 0x3f] |\n spfunction6[(right1 >>> 8) & 0x3f] |\n spfunction8[right1 & 0x3f] |\n spfunction1[(right2 >>> 24) & 0x3f] |\n spfunction3[(right2 >>> 16) & 0x3f] |\n spfunction5[(right2 >>> 8) & 0x3f] |\n spfunction7[right2 & 0x3f]);\n }\n // unreverse left and right\n tmp = left;\n left = right;\n right = tmp;\n }\n\n // rotate right 1 bit\n left = ((left >>> 1) | (left << 31));\n right = ((right >>> 1) | (right << 31));\n\n // now perform IP-1, which is IP in the opposite direction\n tmp = ((left >>> 1) ^ right) & 0x55555555;\n right ^= tmp;\n left ^= (tmp << 1);\n\n tmp = ((right >>> 8) ^ left) & 0x00ff00ff;\n left ^= tmp;\n right ^= (tmp << 8);\n\n tmp = ((right >>> 2) ^ left) & 0x33333333;\n left ^= tmp;\n right ^= (tmp << 2);\n\n tmp = ((left >>> 16) ^ right) & 0x0000ffff;\n right ^= tmp;\n left ^= (tmp << 16);\n\n tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;\n right ^= tmp;\n left ^= (tmp << 4);\n\n output[0] = left;\n output[1] = right;\n}\n\n/**\n * Deprecated. Instead, use:\n *\n * forge.cipher.createCipher('DES-', key);\n * forge.cipher.createDecipher('DES-', key);\n *\n * Creates a deprecated DES cipher object. This object's mode will default to\n * CBC (cipher-block-chaining).\n *\n * The key may be given as a binary-encoded string of bytes or a byte buffer.\n *\n * @param options the options to use.\n * key the symmetric key to use (64 or 192 bits).\n * output the buffer to write to.\n * decrypt true for decryption, false for encryption.\n * mode the cipher mode to use (default: 'CBC').\n *\n * @return the cipher.\n */\nfunction _createCipher(options) {\n options = options || {};\n var mode = (options.mode || 'CBC').toUpperCase();\n var algorithm = 'DES-' + mode;\n\n var cipher;\n if(options.decrypt) {\n cipher = forge.cipher.createDecipher(algorithm, options.key);\n } else {\n cipher = forge.cipher.createCipher(algorithm, options.key);\n }\n\n // backwards compatible start API\n var start = cipher.start;\n cipher.start = function(iv, options) {\n // backwards compatibility: support second arg as output buffer\n var output = null;\n if(options instanceof forge.util.ByteBuffer) {\n output = options;\n options = {};\n }\n options = options || {};\n options.output = output;\n options.iv = iv;\n start.call(cipher, options);\n };\n\n return cipher;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/des.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/forge.js": +/*!**********************************************!*\ + !*** ./node_modules/node-forge/lib/forge.js ***! + \**********************************************/ +/***/ ((module) => { + +eval("/**\n * Node.js module for Forge.\n *\n * @author Dave Longley\n *\n * Copyright 2011-2016 Digital Bazaar, Inc.\n */\nmodule.exports = {\n // default options\n options: {\n usePureJavaScript: false\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/forge.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/hmac.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/hmac.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Hash-based Message Authentication Code implementation. Requires a message\n * digest object that can be obtained, for example, from forge.md.sha1 or\n * forge.md.md5.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2012 Digital Bazaar, Inc. All rights reserved.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n/* HMAC API */\nvar hmac = module.exports = forge.hmac = forge.hmac || {};\n\n/**\n * Creates an HMAC object that uses the given message digest object.\n *\n * @return an HMAC object.\n */\nhmac.create = function() {\n // the hmac key to use\n var _key = null;\n\n // the message digest to use\n var _md = null;\n\n // the inner padding\n var _ipadding = null;\n\n // the outer padding\n var _opadding = null;\n\n // hmac context\n var ctx = {};\n\n /**\n * Starts or restarts the HMAC with the given key and message digest.\n *\n * @param md the message digest to use, null to reuse the previous one,\n * a string to use builtin 'sha1', 'md5', 'sha256'.\n * @param key the key to use as a string, array of bytes, byte buffer,\n * or null to reuse the previous key.\n */\n ctx.start = function(md, key) {\n if(md !== null) {\n if(typeof md === 'string') {\n // create builtin message digest\n md = md.toLowerCase();\n if(md in forge.md.algorithms) {\n _md = forge.md.algorithms[md].create();\n } else {\n throw new Error('Unknown hash algorithm \"' + md + '\"');\n }\n } else {\n // store message digest\n _md = md;\n }\n }\n\n if(key === null) {\n // reuse previous key\n key = _key;\n } else {\n if(typeof key === 'string') {\n // convert string into byte buffer\n key = forge.util.createBuffer(key);\n } else if(forge.util.isArray(key)) {\n // convert byte array into byte buffer\n var tmp = key;\n key = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n key.putByte(tmp[i]);\n }\n }\n\n // if key is longer than blocksize, hash it\n var keylen = key.length();\n if(keylen > _md.blockLength) {\n _md.start();\n _md.update(key.bytes());\n key = _md.digest();\n }\n\n // mix key into inner and outer padding\n // ipadding = [0x36 * blocksize] ^ key\n // opadding = [0x5C * blocksize] ^ key\n _ipadding = forge.util.createBuffer();\n _opadding = forge.util.createBuffer();\n keylen = key.length();\n for(var i = 0; i < keylen; ++i) {\n var tmp = key.at(i);\n _ipadding.putByte(0x36 ^ tmp);\n _opadding.putByte(0x5C ^ tmp);\n }\n\n // if key is shorter than blocksize, add additional padding\n if(keylen < _md.blockLength) {\n var tmp = _md.blockLength - keylen;\n for(var i = 0; i < tmp; ++i) {\n _ipadding.putByte(0x36);\n _opadding.putByte(0x5C);\n }\n }\n _key = key;\n _ipadding = _ipadding.bytes();\n _opadding = _opadding.bytes();\n }\n\n // digest is done like so: hash(opadding | hash(ipadding | message))\n\n // prepare to do inner hash\n // hash(ipadding | message)\n _md.start();\n _md.update(_ipadding);\n };\n\n /**\n * Updates the HMAC with the given message bytes.\n *\n * @param bytes the bytes to update with.\n */\n ctx.update = function(bytes) {\n _md.update(bytes);\n };\n\n /**\n * Produces the Message Authentication Code (MAC).\n *\n * @return a byte buffer containing the digest value.\n */\n ctx.getMac = function() {\n // digest is done like so: hash(opadding | hash(ipadding | message))\n // here we do the outer hashing\n var inner = _md.digest().bytes();\n _md.start();\n _md.update(_opadding);\n _md.update(inner);\n return _md.digest();\n };\n // alias for getMac\n ctx.digest = ctx.getMac;\n\n return ctx;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/hmac.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/jsbn.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/jsbn.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n\n// Basic JavaScript BN library - subset useful for RSA encryption.\n\n/*\nLicensing (LICENSE)\n-------------------\n\nThis software is covered under the following copyright:\n*/\n/*\n * Copyright (c) 2003-2005 Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n/*\nAddress all questions regarding this license to:\n\n Tom Wu\n tjw@cs.Stanford.EDU\n*/\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n\nmodule.exports = forge.jsbn = forge.jsbn || {};\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary&0xffffff)==0xefcafe);\n\n// (public) Constructor\nfunction BigInteger(a,b,c) {\n this.data = [];\n if(a != null)\n if(\"number\" == typeof a) this.fromNumber(a,b,c);\n else if(b == null && \"string\" != typeof a) this.fromString(a,256);\n else this.fromString(a,b);\n}\nforge.jsbn.BigInteger = BigInteger;\n\n// return new, unset BigInteger\nfunction nbi() { return new BigInteger(null); }\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i,x,w,j,c,n) {\n while(--n >= 0) {\n var v = x*this.data[i++]+w.data[j]+c;\n c = Math.floor(v/0x4000000);\n w.data[j++] = v&0x3ffffff;\n }\n return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i,x,w,j,c,n) {\n var xl = x&0x7fff, xh = x>>15;\n while(--n >= 0) {\n var l = this.data[i]&0x7fff;\n var h = this.data[i++]>>15;\n var m = xh*l+h*xl;\n l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff);\n c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);\n w.data[j++] = l&0x3fffffff;\n }\n return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i,x,w,j,c,n) {\n var xl = x&0x3fff, xh = x>>14;\n while(--n >= 0) {\n var l = this.data[i]&0x3fff;\n var h = this.data[i++]>>14;\n var m = xh*l+h*xl;\n l = xl*l+((m&0x3fff)<<14)+w.data[j]+c;\n c = (l>>28)+(m>>14)+xh*h;\n w.data[j++] = l&0xfffffff;\n }\n return c;\n}\n\n// node.js (no browser)\nif(typeof(navigator) === 'undefined')\n{\n BigInteger.prototype.am = am3;\n dbits = 28;\n} else if(j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n BigInteger.prototype.am = am2;\n dbits = 30;\n} else if(j_lm && (navigator.appName != \"Netscape\")) {\n BigInteger.prototype.am = am1;\n dbits = 26;\n} else { // Mozilla/Netscape seems to prefer am3\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1<= 0; --i) r.data[i] = this.data[i];\n r.t = this.t;\n r.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n this.t = 1;\n this.s = (x<0)?-1:0;\n if(x > 0) this.data[0] = x;\n else if(x < -1) this.data[0] = x+this.DV;\n else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) { var r = nbi(); r.fromInt(i); return r; }\n\n// (protected) set from string and radix\nfunction bnpFromString(s,b) {\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 256) k = 8; // byte array\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else { this.fromRadix(s,b); return; }\n this.t = 0;\n this.s = 0;\n var i = s.length, mi = false, sh = 0;\n while(--i >= 0) {\n var x = (k==8)?s[i]&0xff:intAt(s,i);\n if(x < 0) {\n if(s.charAt(i) == \"-\") mi = true;\n continue;\n }\n mi = false;\n if(sh == 0)\n this.data[this.t++] = x;\n else if(sh+k > this.DB) {\n this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh));\n } else\n this.data[this.t-1] |= x<= this.DB) sh -= this.DB;\n }\n if(k == 8 && (s[0]&0x80) != 0) {\n this.s = -1;\n if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this.data[this.t-1] == c) --this.t;\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1< 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}\n\n// (public) -this\nfunction bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }\n\n// (public) |this|\nfunction bnAbs() { return (this.s<0)?this.negate():this; }\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n var r = this.s-a.s;\n if(r != 0) return r;\n var i = this.t;\n r = i-a.t;\n if(r != 0) return (this.s<0)?-r:r;\n while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r;\n return 0;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1, t;\n if((t=x>>>16) != 0) { x = t; r += 16; }\n if((t=x>>8) != 0) { x = t; r += 8; }\n if((t=x>>4) != 0) { x = t; r += 4; }\n if((t=x>>2) != 0) { x = t; r += 2; }\n if((t=x>>1) != 0) { x = t; r += 1; }\n return r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n if(this.t <= 0) return 0;\n return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM));\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n,r) {\n var i;\n for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i];\n for(i = n-1; i >= 0; --i) r.data[i] = 0;\n r.t = this.t+n;\n r.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n,r) {\n for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i];\n r.t = Math.max(this.t-n,0);\n r.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n,r) {\n var bs = n%this.DB;\n var cbs = this.DB-bs;\n var bm = (1<= 0; --i) {\n r.data[i+ds+1] = (this.data[i]>>cbs)|c;\n c = (this.data[i]&bm)<= 0; --i) r.data[i] = 0;\n r.data[ds] = c;\n r.t = this.t+ds+1;\n r.s = this.s;\n r.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n,r) {\n r.s = this.s;\n var ds = Math.floor(n/this.DB);\n if(ds >= this.t) { r.t = 0; return; }\n var bs = n%this.DB;\n var cbs = this.DB-bs;\n var bm = (1<>bs;\n for(var i = ds+1; i < this.t; ++i) {\n r.data[i-ds-1] |= (this.data[i]&bm)<>bs;\n }\n if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<>= this.DB;\n }\n if(a.t < this.t) {\n c -= a.s;\n while(i < this.t) {\n c += this.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += this.s;\n } else {\n c += this.s;\n while(i < a.t) {\n c -= a.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c<0)?-1:0;\n if(c < -1) r.data[i++] = this.DV+c;\n else if(c > 0) r.data[i++] = c;\n r.t = i;\n r.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a,r) {\n var x = this.abs(), y = a.abs();\n var i = x.t;\n r.t = i+y.t;\n while(--i >= 0) r.data[i] = 0;\n for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t);\n r.s = 0;\n r.clamp();\n if(this.s != a.s) BigInteger.ZERO.subTo(r,r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n var x = this.abs();\n var i = r.t = 2*x.t;\n while(--i >= 0) r.data[i] = 0;\n for(i = 0; i < x.t-1; ++i) {\n var c = x.am(i,x.data[i],r,2*i,0,1);\n if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {\n r.data[i+x.t] -= x.DV;\n r.data[i+x.t+1] = 1;\n }\n }\n if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1);\n r.s = 0;\n r.clamp();\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\nfunction bnpDivRemTo(m,q,r) {\n var pm = m.abs();\n if(pm.t <= 0) return;\n var pt = this.abs();\n if(pt.t < pm.t) {\n if(q != null) q.fromInt(0);\n if(r != null) this.copyTo(r);\n return;\n }\n if(r == null) r = nbi();\n var y = nbi(), ts = this.s, ms = m.s;\n var nsh = this.DB-nbits(pm.data[pm.t-1]);\t// normalize modulus\n if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); }\n var ys = y.t;\n var y0 = y.data[ys-1];\n if(y0 == 0) return;\n var yt = y0*(1<1)?y.data[ys-2]>>this.F2:0);\n var d1 = this.FV/yt, d2 = (1<= 0) {\n r.data[r.t++] = 1;\n r.subTo(t,r);\n }\n BigInteger.ONE.dlShiftTo(ys,t);\n t.subTo(y,y);\t// \"negative\" y so we can replace sub with am later\n while(y.t < ys) y.data[y.t++] = 0;\n while(--j >= 0) {\n // Estimate quotient digit\n var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2);\n if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) {\t// Try it out\n y.dlShiftTo(j,t);\n r.subTo(t,r);\n while(r.data[i] < --qd) r.subTo(t,r);\n }\n }\n if(q != null) {\n r.drShiftTo(ys,q);\n if(ts != ms) BigInteger.ZERO.subTo(q,q);\n }\n r.t = ys;\n r.clamp();\n if(nsh > 0) r.rShiftTo(nsh,r);\t// Denormalize remainder\n if(ts < 0) BigInteger.ZERO.subTo(r,r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a,null,r);\n if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);\n return r;\n}\n\n// Modular reduction using \"classic\" algorithm\nfunction Classic(m) { this.m = m; }\nfunction cConvert(x) {\n if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n else return x;\n}\nfunction cRevert(x) { return x; }\nfunction cReduce(x) { x.divRemTo(this.m,null,x); }\nfunction cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\nfunction cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\nClassic.prototype.convert = cConvert;\nClassic.prototype.revert = cRevert;\nClassic.prototype.reduce = cReduce;\nClassic.prototype.mulTo = cMulTo;\nClassic.prototype.sqrTo = cSqrTo;\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n if(this.t < 1) return 0;\n var x = this.data[0];\n if((x&1) == 0) return 0;\n var y = x&3;\t\t// y == 1/x mod 2^2\n y = (y*(2-(x&0xf)*y))&0xf;\t// y == 1/x mod 2^4\n y = (y*(2-(x&0xff)*y))&0xff;\t// y == 1/x mod 2^8\n y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff;\t// y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y*(2-x*y%this.DV))%this.DV;\t\t// y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y>0)?this.DV-y:-y;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp&0x7fff;\n this.mph = this.mp>>15;\n this.um = (1<<(m.DB-15))-1;\n this.mt2 = 2*m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t,r);\n r.divRemTo(this.m,null,r);\n if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);\n return r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n while(x.t <= this.mt2)\t// pad x so am has enough room later\n x.data[x.t++] = 0;\n for(var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x.data[i]*mp mod DV\n var j = x.data[i]&0x7fff;\n var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i+this.m.t;\n x.data[j] += this.m.am(0,u0,x,i,0,this.m.t);\n // propagate carry\n while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; }\n }\n x.clamp();\n x.drShiftTo(this.m.t,x);\n if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (protected) true iff this is even\nfunction bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; }\n\n// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\nfunction bnpExp(e,z) {\n if(e > 0xffffffff || e < 1) return BigInteger.ONE;\n var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;\n g.copyTo(r);\n while(--i >= 0) {\n z.sqrTo(r,r2);\n if((e&(1< 0) z.mulTo(r2,g,r);\n else { var t = r; r = r2; r2 = t; }\n }\n return z.revert(r);\n}\n\n// (public) this^e % m, 0 <= e < 2^32\nfunction bnModPowInt(e,m) {\n var z;\n if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);\n return this.exp(e,z);\n}\n\n// protected\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.isEven = bnpIsEven;\nBigInteger.prototype.exp = bnpExp;\n\n// public\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.modPowInt = bnModPowInt;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n\n// jsbn2 lib\n\n//Copyright (c) 2005-2009 Tom Wu\n//All Rights Reserved.\n//See \"LICENSE\" for details (See jsbn.js for LICENSE).\n\n//Extended JavaScript BN functions, required for RSA private ops.\n\n//Version 1.1: new BigInteger(\"0\", 10) returns \"proper\" zero\n\n//(public)\nfunction bnClone() { var r = nbi(); this.copyTo(r); return r; }\n\n//(public) return value as integer\nfunction bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<>24; }\n\n//(public) return value as short (assumes DB>=16)\nfunction bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; }\n\n//(protected) return x s.t. r^x < DV\nfunction bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }\n\n//(public) 0 if this == 0, 1 if this > 0\nfunction bnSigNum() {\nif(this.s < 0) return -1;\nelse if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0;\nelse return 1;\n}\n\n//(protected) convert to radix string\nfunction bnpToRadix(b) {\nif(b == null) b = 10;\nif(this.signum() == 0 || b < 2 || b > 36) return \"0\";\nvar cs = this.chunkSize(b);\nvar a = Math.pow(b,cs);\nvar d = nbv(a), y = nbi(), z = nbi(), r = \"\";\nthis.divRemTo(d,y,z);\nwhile(y.signum() > 0) {\n r = (a+z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d,y,z);\n}\nreturn z.intValue().toString(b) + r;\n}\n\n//(protected) convert from radix string\nfunction bnpFromRadix(s,b) {\nthis.fromInt(0);\nif(b == null) b = 10;\nvar cs = this.chunkSize(b);\nvar d = Math.pow(b,cs), mi = false, j = 0, w = 0;\nfor(var i = 0; i < s.length; ++i) {\n var x = intAt(s,i);\n if(x < 0) {\n if(s.charAt(i) == \"-\" && this.signum() == 0) mi = true;\n continue;\n }\n w = b*w+x;\n if(++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w,0);\n j = 0;\n w = 0;\n }\n}\nif(j > 0) {\n this.dMultiply(Math.pow(b,j));\n this.dAddOffset(w,0);\n}\nif(mi) BigInteger.ZERO.subTo(this,this);\n}\n\n//(protected) alternate constructor\nfunction bnpFromNumber(a,b,c) {\nif(\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if(a < 2) this.fromInt(1);\n else {\n this.fromNumber(a,c);\n if(!this.testBit(a-1)) // force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);\n if(this.isEven()) this.dAddOffset(1,0); // force odd\n while(!this.isProbablePrime(b)) {\n this.dAddOffset(2,0);\n if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);\n }\n }\n} else {\n // new BigInteger(int,RNG)\n var x = new Array(), t = a&7;\n x.length = (a>>3)+1;\n b.nextBytes(x);\n if(t > 0) x[0] &= ((1< 0) {\n if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p)\n r[k++] = d|(this.s<<(this.DB-p));\n while(i >= 0) {\n if(p < 8) {\n d = (this.data[i]&((1<>(p+=this.DB-8);\n } else {\n d = (this.data[i]>>(p-=8))&0xff;\n if(p <= 0) { p += this.DB; --i; }\n }\n if((d&0x80) != 0) d |= -256;\n if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;\n if(k > 0 || d != this.s) r[k++] = d;\n }\n}\nreturn r;\n}\n\nfunction bnEquals(a) { return(this.compareTo(a)==0); }\nfunction bnMin(a) { return(this.compareTo(a)<0)?this:a; }\nfunction bnMax(a) { return(this.compareTo(a)>0)?this:a; }\n\n//(protected) r = this op a (bitwise)\nfunction bnpBitwiseTo(a,op,r) {\nvar i, f, m = Math.min(a.t,this.t);\nfor(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]);\nif(a.t < this.t) {\n f = a.s&this.DM;\n for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f);\n r.t = this.t;\n} else {\n f = this.s&this.DM;\n for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]);\n r.t = a.t;\n}\nr.s = op(this.s,a.s);\nr.clamp();\n}\n\n//(public) this & a\nfunction op_and(x,y) { return x&y; }\nfunction bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }\n\n//(public) this | a\nfunction op_or(x,y) { return x|y; }\nfunction bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }\n\n//(public) this ^ a\nfunction op_xor(x,y) { return x^y; }\nfunction bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }\n\n//(public) this & ~a\nfunction op_andnot(x,y) { return x&~y; }\nfunction bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }\n\n//(public) ~this\nfunction bnNot() {\nvar r = nbi();\nfor(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i];\nr.t = this.t;\nr.s = ~this.s;\nreturn r;\n}\n\n//(public) this << n\nfunction bnShiftLeft(n) {\nvar r = nbi();\nif(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);\nreturn r;\n}\n\n//(public) this >> n\nfunction bnShiftRight(n) {\nvar r = nbi();\nif(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);\nreturn r;\n}\n\n//return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x) {\nif(x == 0) return -1;\nvar r = 0;\nif((x&0xffff) == 0) { x >>= 16; r += 16; }\nif((x&0xff) == 0) { x >>= 8; r += 8; }\nif((x&0xf) == 0) { x >>= 4; r += 4; }\nif((x&3) == 0) { x >>= 2; r += 2; }\nif((x&1) == 0) ++r;\nreturn r;\n}\n\n//(public) returns index of lowest 1-bit (or -1 if none)\nfunction bnGetLowestSetBit() {\nfor(var i = 0; i < this.t; ++i)\n if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]);\nif(this.s < 0) return this.t*this.DB;\nreturn -1;\n}\n\n//return number of 1 bits in x\nfunction cbit(x) {\nvar r = 0;\nwhile(x != 0) { x &= x-1; ++r; }\nreturn r;\n}\n\n//(public) return number of set bits\nfunction bnBitCount() {\nvar r = 0, x = this.s&this.DM;\nfor(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x);\nreturn r;\n}\n\n//(public) true iff nth bit is set\nfunction bnTestBit(n) {\nvar j = Math.floor(n/this.DB);\nif(j >= this.t) return(this.s!=0);\nreturn((this.data[j]&(1<<(n%this.DB)))!=0);\n}\n\n//(protected) this op (1<>= this.DB;\n}\nif(a.t < this.t) {\n c += a.s;\n while(i < this.t) {\n c += this.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += this.s;\n} else {\n c += this.s;\n while(i < a.t) {\n c += a.data[i];\n r.data[i++] = c&this.DM;\n c >>= this.DB;\n }\n c += a.s;\n}\nr.s = (c<0)?-1:0;\nif(c > 0) r.data[i++] = c;\nelse if(c < -1) r.data[i++] = this.DV+c;\nr.t = i;\nr.clamp();\n}\n\n//(public) this + a\nfunction bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }\n\n//(public) this - a\nfunction bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }\n\n//(public) this * a\nfunction bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }\n\n//(public) this / a\nfunction bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }\n\n//(public) this % a\nfunction bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }\n\n//(public) [this/a,this%a]\nfunction bnDivideAndRemainder(a) {\nvar q = nbi(), r = nbi();\nthis.divRemTo(a,q,r);\nreturn new Array(q,r);\n}\n\n//(protected) this *= n, this >= 0, 1 < n < DV\nfunction bnpDMultiply(n) {\nthis.data[this.t] = this.am(0,n-1,this,0,0,this.t);\n++this.t;\nthis.clamp();\n}\n\n//(protected) this += n << w words, this >= 0\nfunction bnpDAddOffset(n,w) {\nif(n == 0) return;\nwhile(this.t <= w) this.data[this.t++] = 0;\nthis.data[w] += n;\nwhile(this.data[w] >= this.DV) {\n this.data[w] -= this.DV;\n if(++w >= this.t) this.data[this.t++] = 0;\n ++this.data[w];\n}\n}\n\n//A \"null\" reducer\nfunction NullExp() {}\nfunction nNop(x) { return x; }\nfunction nMulTo(x,y,r) { x.multiplyTo(y,r); }\nfunction nSqrTo(x,r) { x.squareTo(r); }\n\nNullExp.prototype.convert = nNop;\nNullExp.prototype.revert = nNop;\nNullExp.prototype.mulTo = nMulTo;\nNullExp.prototype.sqrTo = nSqrTo;\n\n//(public) this^e\nfunction bnPow(e) { return this.exp(e,new NullExp()); }\n\n//(protected) r = lower n words of \"this * a\", a.t <= n\n//\"this\" should be the larger one if appropriate.\nfunction bnpMultiplyLowerTo(a,n,r) {\nvar i = Math.min(this.t+a.t,n);\nr.s = 0; // assumes a,this >= 0\nr.t = i;\nwhile(i > 0) r.data[--i] = 0;\nvar j;\nfor(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t);\nfor(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i);\nr.clamp();\n}\n\n//(protected) r = \"this * a\" without lower n words, n > 0\n//\"this\" should be the larger one if appropriate.\nfunction bnpMultiplyUpperTo(a,n,r) {\n--n;\nvar i = r.t = this.t+a.t-n;\nr.s = 0; // assumes a,this >= 0\nwhile(--i >= 0) r.data[i] = 0;\nfor(i = Math.max(n-this.t,0); i < a.t; ++i)\n r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n);\nr.clamp();\nr.drShiftTo(1,r);\n}\n\n//Barrett modular reduction\nfunction Barrett(m) {\n// setup Barrett\nthis.r2 = nbi();\nthis.q3 = nbi();\nBigInteger.ONE.dlShiftTo(2*m.t,this.r2);\nthis.mu = this.r2.divide(m);\nthis.m = m;\n}\n\nfunction barrettConvert(x) {\nif(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);\nelse if(x.compareTo(this.m) < 0) return x;\nelse { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }\n}\n\nfunction barrettRevert(x) { return x; }\n\n//x = x mod m (HAC 14.42)\nfunction barrettReduce(x) {\nx.drShiftTo(this.m.t-1,this.r2);\nif(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }\nthis.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);\nthis.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);\nwhile(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);\nx.subTo(this.r2,x);\nwhile(x.compareTo(this.m) >= 0) x.subTo(this.m,x);\n}\n\n//r = x^2 mod m; x != r\nfunction barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }\n\n//r = x*y mod m; x,y != r\nfunction barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }\n\nBarrett.prototype.convert = barrettConvert;\nBarrett.prototype.revert = barrettRevert;\nBarrett.prototype.reduce = barrettReduce;\nBarrett.prototype.mulTo = barrettMulTo;\nBarrett.prototype.sqrTo = barrettSqrTo;\n\n//(public) this^e % m (HAC 14.85)\nfunction bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1< 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1< 0) {\n x.rShiftTo(g,x);\n y.rShiftTo(g,y);\n}\nwhile(x.signum() > 0) {\n if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);\n if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);\n if(x.compareTo(y) >= 0) {\n x.subTo(y,x);\n x.rShiftTo(1,x);\n } else {\n y.subTo(x,y);\n y.rShiftTo(1,y);\n }\n}\nif(g > 0) y.lShiftTo(g,y);\nreturn y;\n}\n\n//(protected) this % n, n < 2^26\nfunction bnpModInt(n) {\nif(n <= 0) return 0;\nvar d = this.DV%n, r = (this.s<0)?n-1:0;\nif(this.t > 0)\n if(d == 0) r = this.data[0]%n;\n else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n;\nreturn r;\n}\n\n//(public) 1/this % m (HAC 14.61)\nfunction bnModInverse(m) {\nvar ac = m.isEven();\nif((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;\nvar u = m.clone(), v = this.clone();\nvar a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);\nwhile(u.signum() != 0) {\n while(u.isEven()) {\n u.rShiftTo(1,u);\n if(ac) {\n if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }\n a.rShiftTo(1,a);\n } else if(!b.isEven()) b.subTo(m,b);\n b.rShiftTo(1,b);\n }\n while(v.isEven()) {\n v.rShiftTo(1,v);\n if(ac) {\n if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }\n c.rShiftTo(1,c);\n } else if(!d.isEven()) d.subTo(m,d);\n d.rShiftTo(1,d);\n }\n if(u.compareTo(v) >= 0) {\n u.subTo(v,u);\n if(ac) a.subTo(c,a);\n b.subTo(d,b);\n } else {\n v.subTo(u,v);\n if(ac) c.subTo(a,c);\n d.subTo(b,d);\n }\n}\nif(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;\nif(d.compareTo(m) >= 0) return d.subtract(m);\nif(d.signum() < 0) d.addTo(m,d); else return d;\nif(d.signum() < 0) return d.add(m); else return d;\n}\n\nvar lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];\nvar lplim = (1<<26)/lowprimes[lowprimes.length-1];\n\n//(public) test primality with certainty >= 1-.5^t\nfunction bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}\n\n//(protected) true if probably prime (HAC 4.24, Miller-Rabin)\nfunction bnpMillerRabin(t) {\nvar n1 = this.subtract(BigInteger.ONE);\nvar k = n1.getLowestSetBit();\nif(k <= 0) return false;\nvar r = n1.shiftRight(k);\nvar prng = bnGetPrng();\nvar a;\nfor(var i = 0; i < t; ++i) {\n // select witness 'a' at random from between 1 and n1\n do {\n a = new BigInteger(this.bitLength(), prng);\n }\n while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0);\n var y = a.modPow(r,this);\n if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while(j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2,this);\n if(y.compareTo(BigInteger.ONE) == 0) return false;\n }\n if(y.compareTo(n1) != 0) return false;\n }\n}\nreturn true;\n}\n\n// get pseudo random number generator\nfunction bnGetPrng() {\n // create prng with api that matches BigInteger secure random\n return {\n // x is an array to fill with bytes\n nextBytes: function(x) {\n for(var i = 0; i < x.length; ++i) {\n x[i] = Math.floor(Math.random() * 0x0100);\n }\n }\n };\n}\n\n//protected\nBigInteger.prototype.chunkSize = bnpChunkSize;\nBigInteger.prototype.toRadix = bnpToRadix;\nBigInteger.prototype.fromRadix = bnpFromRadix;\nBigInteger.prototype.fromNumber = bnpFromNumber;\nBigInteger.prototype.bitwiseTo = bnpBitwiseTo;\nBigInteger.prototype.changeBit = bnpChangeBit;\nBigInteger.prototype.addTo = bnpAddTo;\nBigInteger.prototype.dMultiply = bnpDMultiply;\nBigInteger.prototype.dAddOffset = bnpDAddOffset;\nBigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\nBigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\nBigInteger.prototype.modInt = bnpModInt;\nBigInteger.prototype.millerRabin = bnpMillerRabin;\n\n//public\nBigInteger.prototype.clone = bnClone;\nBigInteger.prototype.intValue = bnIntValue;\nBigInteger.prototype.byteValue = bnByteValue;\nBigInteger.prototype.shortValue = bnShortValue;\nBigInteger.prototype.signum = bnSigNum;\nBigInteger.prototype.toByteArray = bnToByteArray;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.min = bnMin;\nBigInteger.prototype.max = bnMax;\nBigInteger.prototype.and = bnAnd;\nBigInteger.prototype.or = bnOr;\nBigInteger.prototype.xor = bnXor;\nBigInteger.prototype.andNot = bnAndNot;\nBigInteger.prototype.not = bnNot;\nBigInteger.prototype.shiftLeft = bnShiftLeft;\nBigInteger.prototype.shiftRight = bnShiftRight;\nBigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\nBigInteger.prototype.bitCount = bnBitCount;\nBigInteger.prototype.testBit = bnTestBit;\nBigInteger.prototype.setBit = bnSetBit;\nBigInteger.prototype.clearBit = bnClearBit;\nBigInteger.prototype.flipBit = bnFlipBit;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.remainder = bnRemainder;\nBigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\nBigInteger.prototype.modPow = bnModPow;\nBigInteger.prototype.modInverse = bnModInverse;\nBigInteger.prototype.pow = bnPow;\nBigInteger.prototype.gcd = bnGCD;\nBigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n\n//BigInteger interfaces not implemented in jsbn:\n\n//BigInteger(int signum, byte[] magnitude)\n//double doubleValue()\n//float floatValue()\n//int hashCode()\n//long longValue()\n//static BigInteger valueOf(long val)\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/jsbn.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/md.js": +/*!*******************************************!*\ + !*** ./node_modules/node-forge/lib/md.js ***! + \*******************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Node.js module for Forge message digests.\n *\n * @author Dave Longley\n *\n * Copyright 2011-2017 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n\nmodule.exports = forge.md = forge.md || {};\nforge.md.algorithms = forge.md.algorithms || {};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/md.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/oids.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/oids.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Object IDs for ASN.1.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n\nforge.pki = forge.pki || {};\nvar oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {};\n\n// set id to name mapping and name to id mapping\nfunction _IN(id, name) {\n oids[id] = name;\n oids[name] = id;\n}\n// set id to name mapping only\nfunction _I_(id, name) {\n oids[id] = name;\n}\n\n// algorithm OIDs\n_IN('1.2.840.113549.1.1.1', 'rsaEncryption');\n// Note: md2 & md4 not implemented\n//_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption');\n//_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption');\n_IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption');\n_IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption');\n_IN('1.2.840.113549.1.1.7', 'RSAES-OAEP');\n_IN('1.2.840.113549.1.1.8', 'mgf1');\n_IN('1.2.840.113549.1.1.9', 'pSpecified');\n_IN('1.2.840.113549.1.1.10', 'RSASSA-PSS');\n_IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption');\n_IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption');\n_IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption');\n// Edwards-curve Digital Signature Algorithm (EdDSA) Ed25519\n_IN('1.3.101.112', 'EdDSA25519');\n\n_IN('1.2.840.10040.4.3', 'dsa-with-sha1');\n\n_IN('1.3.14.3.2.7', 'desCBC');\n\n_IN('1.3.14.3.2.26', 'sha1');\n// Deprecated equivalent of sha1WithRSAEncryption\n_IN('1.3.14.3.2.29', 'sha1WithRSASignature');\n_IN('2.16.840.1.101.3.4.2.1', 'sha256');\n_IN('2.16.840.1.101.3.4.2.2', 'sha384');\n_IN('2.16.840.1.101.3.4.2.3', 'sha512');\n_IN('2.16.840.1.101.3.4.2.4', 'sha224');\n_IN('2.16.840.1.101.3.4.2.5', 'sha512-224');\n_IN('2.16.840.1.101.3.4.2.6', 'sha512-256');\n_IN('1.2.840.113549.2.2', 'md2');\n_IN('1.2.840.113549.2.5', 'md5');\n\n// pkcs#7 content types\n_IN('1.2.840.113549.1.7.1', 'data');\n_IN('1.2.840.113549.1.7.2', 'signedData');\n_IN('1.2.840.113549.1.7.3', 'envelopedData');\n_IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData');\n_IN('1.2.840.113549.1.7.5', 'digestedData');\n_IN('1.2.840.113549.1.7.6', 'encryptedData');\n\n// pkcs#9 oids\n_IN('1.2.840.113549.1.9.1', 'emailAddress');\n_IN('1.2.840.113549.1.9.2', 'unstructuredName');\n_IN('1.2.840.113549.1.9.3', 'contentType');\n_IN('1.2.840.113549.1.9.4', 'messageDigest');\n_IN('1.2.840.113549.1.9.5', 'signingTime');\n_IN('1.2.840.113549.1.9.6', 'counterSignature');\n_IN('1.2.840.113549.1.9.7', 'challengePassword');\n_IN('1.2.840.113549.1.9.8', 'unstructuredAddress');\n_IN('1.2.840.113549.1.9.14', 'extensionRequest');\n\n_IN('1.2.840.113549.1.9.20', 'friendlyName');\n_IN('1.2.840.113549.1.9.21', 'localKeyId');\n_IN('1.2.840.113549.1.9.22.1', 'x509Certificate');\n\n// pkcs#12 safe bags\n_IN('1.2.840.113549.1.12.10.1.1', 'keyBag');\n_IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag');\n_IN('1.2.840.113549.1.12.10.1.3', 'certBag');\n_IN('1.2.840.113549.1.12.10.1.4', 'crlBag');\n_IN('1.2.840.113549.1.12.10.1.5', 'secretBag');\n_IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag');\n\n// password-based-encryption for pkcs#12\n_IN('1.2.840.113549.1.5.13', 'pkcs5PBES2');\n_IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2');\n\n_IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4');\n_IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4');\n_IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC');\n_IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC');\n_IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC');\n_IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC');\n\n// hmac OIDs\n_IN('1.2.840.113549.2.7', 'hmacWithSHA1');\n_IN('1.2.840.113549.2.8', 'hmacWithSHA224');\n_IN('1.2.840.113549.2.9', 'hmacWithSHA256');\n_IN('1.2.840.113549.2.10', 'hmacWithSHA384');\n_IN('1.2.840.113549.2.11', 'hmacWithSHA512');\n\n// symmetric key algorithm oids\n_IN('1.2.840.113549.3.7', 'des-EDE3-CBC');\n_IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC');\n_IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC');\n_IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC');\n\n// certificate issuer/subject OIDs\n_IN('2.5.4.3', 'commonName');\n_IN('2.5.4.4', 'surname');\n_IN('2.5.4.5', 'serialNumber');\n_IN('2.5.4.6', 'countryName');\n_IN('2.5.4.7', 'localityName');\n_IN('2.5.4.8', 'stateOrProvinceName');\n_IN('2.5.4.9', 'streetAddress');\n_IN('2.5.4.10', 'organizationName');\n_IN('2.5.4.11', 'organizationalUnitName');\n_IN('2.5.4.12', 'title');\n_IN('2.5.4.13', 'description');\n_IN('2.5.4.15', 'businessCategory');\n_IN('2.5.4.17', 'postalCode');\n_IN('2.5.4.42', 'givenName');\n_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName');\n_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName');\n\n// X.509 extension OIDs\n_IN('2.16.840.1.113730.1.1', 'nsCertType');\n_IN('2.16.840.1.113730.1.13', 'nsComment'); // deprecated in theory; still widely used\n_I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35\n_I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15\n_I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32\n_I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15\n_I_('2.5.29.5', 'policyMapping'); // deprecated use .33\n_I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30\n_I_('2.5.29.7', 'subjectAltName'); // deprecated use .17\n_I_('2.5.29.8', 'issuerAltName'); // deprecated use .18\n_I_('2.5.29.9', 'subjectDirectoryAttributes');\n_I_('2.5.29.10', 'basicConstraints'); // deprecated use .19\n_I_('2.5.29.11', 'nameConstraints'); // deprecated use .30\n_I_('2.5.29.12', 'policyConstraints'); // deprecated use .36\n_I_('2.5.29.13', 'basicConstraints'); // deprecated use .19\n_IN('2.5.29.14', 'subjectKeyIdentifier');\n_IN('2.5.29.15', 'keyUsage');\n_I_('2.5.29.16', 'privateKeyUsagePeriod');\n_IN('2.5.29.17', 'subjectAltName');\n_IN('2.5.29.18', 'issuerAltName');\n_IN('2.5.29.19', 'basicConstraints');\n_I_('2.5.29.20', 'cRLNumber');\n_I_('2.5.29.21', 'cRLReason');\n_I_('2.5.29.22', 'expirationDate');\n_I_('2.5.29.23', 'instructionCode');\n_I_('2.5.29.24', 'invalidityDate');\n_I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31\n_I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28\n_I_('2.5.29.27', 'deltaCRLIndicator');\n_I_('2.5.29.28', 'issuingDistributionPoint');\n_I_('2.5.29.29', 'certificateIssuer');\n_I_('2.5.29.30', 'nameConstraints');\n_IN('2.5.29.31', 'cRLDistributionPoints');\n_IN('2.5.29.32', 'certificatePolicies');\n_I_('2.5.29.33', 'policyMappings');\n_I_('2.5.29.34', 'policyConstraints'); // deprecated use .36\n_IN('2.5.29.35', 'authorityKeyIdentifier');\n_I_('2.5.29.36', 'policyConstraints');\n_IN('2.5.29.37', 'extKeyUsage');\n_I_('2.5.29.46', 'freshestCRL');\n_I_('2.5.29.54', 'inhibitAnyPolicy');\n\n// extKeyUsage purposes\n_IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList');\n_IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess');\n_IN('1.3.6.1.5.5.7.3.1', 'serverAuth');\n_IN('1.3.6.1.5.5.7.3.2', 'clientAuth');\n_IN('1.3.6.1.5.5.7.3.3', 'codeSigning');\n_IN('1.3.6.1.5.5.7.3.4', 'emailProtection');\n_IN('1.3.6.1.5.5.7.3.8', 'timeStamping');\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/oids.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/pbe.js": +/*!********************************************!*\ + !*** ./node_modules/node-forge/lib/pbe.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Password-based encryption functions.\n *\n * @author Dave Longley\n * @author Stefan Siegl \n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n * Copyright (c) 2012 Stefan Siegl \n *\n * An EncryptedPrivateKeyInfo:\n *\n * EncryptedPrivateKeyInfo ::= SEQUENCE {\n * encryptionAlgorithm EncryptionAlgorithmIdentifier,\n * encryptedData EncryptedData }\n *\n * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier\n *\n * EncryptedData ::= OCTET STRING\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./aes */ \"./node_modules/node-forge/lib/aes.js\");\n__webpack_require__(/*! ./asn1 */ \"./node_modules/node-forge/lib/asn1.js\");\n__webpack_require__(/*! ./des */ \"./node_modules/node-forge/lib/des.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./oids */ \"./node_modules/node-forge/lib/oids.js\");\n__webpack_require__(/*! ./pbkdf2 */ \"./node_modules/node-forge/lib/pbkdf2.js\");\n__webpack_require__(/*! ./pem */ \"./node_modules/node-forge/lib/pem.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n__webpack_require__(/*! ./rc2 */ \"./node_modules/node-forge/lib/rc2.js\");\n__webpack_require__(/*! ./rsa */ \"./node_modules/node-forge/lib/rsa.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nif(typeof BigInteger === 'undefined') {\n var BigInteger = forge.jsbn.BigInteger;\n}\n\n// shortcut for asn.1 API\nvar asn1 = forge.asn1;\n\n/* Password-based encryption implementation. */\nvar pki = forge.pki = forge.pki || {};\nmodule.exports = pki.pbe = forge.pbe = forge.pbe || {};\nvar oids = pki.oids;\n\n// validator for an EncryptedPrivateKeyInfo structure\n// Note: Currently only works w/algorithm params\nvar encryptedPrivateKeyValidator = {\n name: 'EncryptedPrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'EncryptedPrivateKeyInfo.encryptionAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'encryptionOid'\n }, {\n name: 'AlgorithmIdentifier.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'encryptionParams'\n }]\n }, {\n // encryptedData\n name: 'EncryptedPrivateKeyInfo.encryptedData',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'encryptedData'\n }]\n};\n\n// validator for a PBES2Algorithms structure\n// Note: Currently only works w/PBKDF2 + AES encryption schemes\nvar PBES2AlgorithmsValidator = {\n name: 'PBES2Algorithms',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.keyDerivationFunc',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.keyDerivationFunc.oid',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'kdfOid'\n }, {\n name: 'PBES2Algorithms.params',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.params.salt',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'kdfSalt'\n }, {\n name: 'PBES2Algorithms.params.iterationCount',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'kdfIterationCount'\n }, {\n name: 'PBES2Algorithms.params.keyLength',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n optional: true,\n capture: 'keyLength'\n }, {\n // prf\n name: 'PBES2Algorithms.params.prf',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n optional: true,\n value: [{\n name: 'PBES2Algorithms.params.prf.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'prfOid'\n }]\n }]\n }]\n }, {\n name: 'PBES2Algorithms.encryptionScheme',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.encryptionScheme.oid',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'encOid'\n }, {\n name: 'PBES2Algorithms.encryptionScheme.iv',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'encIv'\n }]\n }]\n};\n\nvar pkcs12PbeParamsValidator = {\n name: 'pkcs-12PbeParams',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'pkcs-12PbeParams.salt',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'salt'\n }, {\n name: 'pkcs-12PbeParams.iterations',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'iterations'\n }]\n};\n\n/**\n * Encrypts a ASN.1 PrivateKeyInfo object, producing an EncryptedPrivateKeyInfo.\n *\n * PBES2Algorithms ALGORITHM-IDENTIFIER ::=\n * { {PBES2-params IDENTIFIED BY id-PBES2}, ...}\n *\n * id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13}\n *\n * PBES2-params ::= SEQUENCE {\n * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},\n * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}}\n * }\n *\n * PBES2-KDFs ALGORITHM-IDENTIFIER ::=\n * { {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... }\n *\n * PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... }\n *\n * PBKDF2-params ::= SEQUENCE {\n * salt CHOICE {\n * specified OCTET STRING,\n * otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}\n * },\n * iterationCount INTEGER (1..MAX),\n * keyLength INTEGER (1..MAX) OPTIONAL,\n * prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1\n * }\n *\n * @param obj the ASN.1 PrivateKeyInfo object.\n * @param password the password to encrypt with.\n * @param options:\n * algorithm the encryption algorithm to use\n * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'.\n * count the iteration count to use.\n * saltSize the salt size to use.\n * prfAlgorithm the PRF message digest algorithm to use\n * ('sha1', 'sha224', 'sha256', 'sha384', 'sha512')\n *\n * @return the ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptPrivateKeyInfo = function(obj, password, options) {\n // set default options\n options = options || {};\n options.saltSize = options.saltSize || 8;\n options.count = options.count || 2048;\n options.algorithm = options.algorithm || 'aes128';\n options.prfAlgorithm = options.prfAlgorithm || 'sha1';\n\n // generate PBE params\n var salt = forge.random.getBytesSync(options.saltSize);\n var count = options.count;\n var countBytes = asn1.integerToDer(count);\n var dkLen;\n var encryptionAlgorithm;\n var encryptedData;\n if(options.algorithm.indexOf('aes') === 0 || options.algorithm === 'des') {\n // do PBES2\n var ivLen, encOid, cipherFn;\n switch(options.algorithm) {\n case 'aes128':\n dkLen = 16;\n ivLen = 16;\n encOid = oids['aes128-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes192':\n dkLen = 24;\n ivLen = 16;\n encOid = oids['aes192-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes256':\n dkLen = 32;\n ivLen = 16;\n encOid = oids['aes256-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'des':\n dkLen = 8;\n ivLen = 8;\n encOid = oids['desCBC'];\n cipherFn = forge.des.createEncryptionCipher;\n break;\n default:\n var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // get PRF message digest\n var prfAlgorithm = 'hmacWith' + options.prfAlgorithm.toUpperCase();\n var md = prfAlgorithmToMessageDigest(prfAlgorithm);\n\n // encrypt private key using pbe SHA-1 and AES/DES\n var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md);\n var iv = forge.random.getBytesSync(ivLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(obj));\n cipher.finish();\n encryptedData = cipher.output.getBytes();\n\n // get PBKDF2-params\n var params = createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm);\n\n encryptionAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pkcs5PBES2']).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // keyDerivationFunc\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pkcs5PBKDF2']).getBytes()),\n // PBKDF2-params\n params\n ]),\n // encryptionScheme\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(encOid).getBytes()),\n // iv\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, iv)\n ])\n ])\n ]);\n } else if(options.algorithm === '3des') {\n // Do PKCS12 PBE\n dkLen = 24;\n\n var saltBytes = new forge.util.ByteBuffer(salt);\n var dk = pki.pbe.generatePkcs12Key(password, saltBytes, 1, count, dkLen);\n var iv = pki.pbe.generatePkcs12Key(password, saltBytes, 2, count, dkLen);\n var cipher = forge.des.createEncryptionCipher(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(obj));\n cipher.finish();\n encryptedData = cipher.output.getBytes();\n\n encryptionAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pbeWithSHAAnd3-KeyTripleDES-CBC']).getBytes()),\n // pkcs-12PbeParams\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // salt\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt),\n // iteration count\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n countBytes.getBytes())\n ])\n ]);\n } else {\n var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // EncryptedPrivateKeyInfo\n var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // encryptionAlgorithm\n encryptionAlgorithm,\n // encryptedData\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, encryptedData)\n ]);\n return rval;\n};\n\n/**\n * Decrypts a ASN.1 PrivateKeyInfo object.\n *\n * @param obj the ASN.1 EncryptedPrivateKeyInfo object.\n * @param password the password to decrypt with.\n *\n * @return the ASN.1 PrivateKeyInfo on success, null on failure.\n */\npki.decryptPrivateKeyInfo = function(obj, password) {\n var rval = null;\n\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, encryptedPrivateKeyValidator, capture, errors)) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n // get cipher\n var oid = asn1.derToOid(capture.encryptionOid);\n var cipher = pki.pbe.getCipher(oid, capture.encryptionParams, password);\n\n // get encrypted data\n var encrypted = forge.util.createBuffer(capture.encryptedData);\n\n cipher.update(encrypted);\n if(cipher.finish()) {\n rval = asn1.fromDer(cipher.output);\n }\n\n return rval;\n};\n\n/**\n * Converts a EncryptedPrivateKeyInfo to PEM format.\n *\n * @param epki the EncryptedPrivateKeyInfo.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted encrypted private key.\n */\npki.encryptedPrivateKeyToPem = function(epki, maxline) {\n // convert to DER, then PEM-encode\n var msg = {\n type: 'ENCRYPTED PRIVATE KEY',\n body: asn1.toDer(epki).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format. Decryption\n * is not performed.\n *\n * @param pem the EncryptedPrivateKeyInfo in PEM-format.\n *\n * @return the ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptedPrivateKeyFromPem = function(pem) {\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'ENCRYPTED PRIVATE KEY') {\n var error = new Error('Could not convert encrypted private key from PEM; ' +\n 'PEM header type is \"ENCRYPTED PRIVATE KEY\".');\n error.headerType = msg.type;\n throw error;\n }\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n throw new Error('Could not convert encrypted private key from PEM; ' +\n 'PEM is encrypted.');\n }\n\n // convert DER to ASN.1 object\n return asn1.fromDer(msg.body);\n};\n\n/**\n * Encrypts an RSA private key. By default, the key will be wrapped in\n * a PrivateKeyInfo and encrypted to produce a PKCS#8 EncryptedPrivateKeyInfo.\n * This is the standard, preferred way to encrypt a private key.\n *\n * To produce a non-standard PEM-encrypted private key that uses encapsulated\n * headers to indicate the encryption algorithm (old-style non-PKCS#8 OpenSSL\n * private key encryption), set the 'legacy' option to true. Note: Using this\n * option will cause the iteration count to be forced to 1.\n *\n * Note: The 'des' algorithm is supported, but it is not considered to be\n * secure because it only uses a single 56-bit key. If possible, it is highly\n * recommended that a different algorithm be used.\n *\n * @param rsaKey the RSA key to encrypt.\n * @param password the password to use.\n * @param options:\n * algorithm: the encryption algorithm to use\n * ('aes128', 'aes192', 'aes256', '3des', 'des').\n * count: the iteration count to use.\n * saltSize: the salt size to use.\n * legacy: output an old non-PKCS#8 PEM-encrypted+encapsulated\n * headers (DEK-Info) private key.\n *\n * @return the PEM-encoded ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptRsaPrivateKey = function(rsaKey, password, options) {\n // standard PKCS#8\n options = options || {};\n if(!options.legacy) {\n // encrypt PrivateKeyInfo\n var rval = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(rsaKey));\n rval = pki.encryptPrivateKeyInfo(rval, password, options);\n return pki.encryptedPrivateKeyToPem(rval);\n }\n\n // legacy non-PKCS#8\n var algorithm;\n var iv;\n var dkLen;\n var cipherFn;\n switch(options.algorithm) {\n case 'aes128':\n algorithm = 'AES-128-CBC';\n dkLen = 16;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes192':\n algorithm = 'AES-192-CBC';\n dkLen = 24;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes256':\n algorithm = 'AES-256-CBC';\n dkLen = 32;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case '3des':\n algorithm = 'DES-EDE3-CBC';\n dkLen = 24;\n iv = forge.random.getBytesSync(8);\n cipherFn = forge.des.createEncryptionCipher;\n break;\n case 'des':\n algorithm = 'DES-CBC';\n dkLen = 8;\n iv = forge.random.getBytesSync(8);\n cipherFn = forge.des.createEncryptionCipher;\n break;\n default:\n var error = new Error('Could not encrypt RSA private key; unsupported ' +\n 'encryption algorithm \"' + options.algorithm + '\".');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // encrypt private key using OpenSSL legacy key derivation\n var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(pki.privateKeyToAsn1(rsaKey)));\n cipher.finish();\n\n var msg = {\n type: 'RSA PRIVATE KEY',\n procType: {\n version: '4',\n type: 'ENCRYPTED'\n },\n dekInfo: {\n algorithm: algorithm,\n parameters: forge.util.bytesToHex(iv).toUpperCase()\n },\n body: cipher.output.getBytes()\n };\n return forge.pem.encode(msg);\n};\n\n/**\n * Decrypts an RSA private key.\n *\n * @param pem the PEM-formatted EncryptedPrivateKeyInfo to decrypt.\n * @param password the password to use.\n *\n * @return the RSA key on success, null on failure.\n */\npki.decryptRsaPrivateKey = function(pem, password) {\n var rval = null;\n\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'ENCRYPTED PRIVATE KEY' &&\n msg.type !== 'PRIVATE KEY' &&\n msg.type !== 'RSA PRIVATE KEY') {\n var error = new Error('Could not convert private key from PEM; PEM header type ' +\n 'is not \"ENCRYPTED PRIVATE KEY\", \"PRIVATE KEY\", or \"RSA PRIVATE KEY\".');\n error.headerType = error;\n throw error;\n }\n\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n var dkLen;\n var cipherFn;\n switch(msg.dekInfo.algorithm) {\n case 'DES-CBC':\n dkLen = 8;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'DES-EDE3-CBC':\n dkLen = 24;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'AES-128-CBC':\n dkLen = 16;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'AES-192-CBC':\n dkLen = 24;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'AES-256-CBC':\n dkLen = 32;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'RC2-40-CBC':\n dkLen = 5;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 40);\n };\n break;\n case 'RC2-64-CBC':\n dkLen = 8;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 64);\n };\n break;\n case 'RC2-128-CBC':\n dkLen = 16;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 128);\n };\n break;\n default:\n var error = new Error('Could not decrypt private key; unsupported ' +\n 'encryption algorithm \"' + msg.dekInfo.algorithm + '\".');\n error.algorithm = msg.dekInfo.algorithm;\n throw error;\n }\n\n // use OpenSSL legacy key derivation\n var iv = forge.util.hexToBytes(msg.dekInfo.parameters);\n var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(forge.util.createBuffer(msg.body));\n if(cipher.finish()) {\n rval = cipher.output.getBytes();\n } else {\n return rval;\n }\n } else {\n rval = msg.body;\n }\n\n if(msg.type === 'ENCRYPTED PRIVATE KEY') {\n rval = pki.decryptPrivateKeyInfo(asn1.fromDer(rval), password);\n } else {\n // decryption already performed above\n rval = asn1.fromDer(rval);\n }\n\n if(rval !== null) {\n rval = pki.privateKeyFromAsn1(rval);\n }\n\n return rval;\n};\n\n/**\n * Derives a PKCS#12 key.\n *\n * @param password the password to derive the key material from, null or\n * undefined for none.\n * @param salt the salt, as a ByteBuffer, to use.\n * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC).\n * @param iter the iteration count.\n * @param n the number of bytes to derive from the password.\n * @param md the message digest to use, defaults to SHA-1.\n *\n * @return a ByteBuffer with the bytes derived from the password.\n */\npki.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md) {\n var j, l;\n\n if(typeof md === 'undefined' || md === null) {\n if(!('sha1' in forge.md)) {\n throw new Error('\"sha1\" hash algorithm unavailable.');\n }\n md = forge.md.sha1.create();\n }\n\n var u = md.digestLength;\n var v = md.blockLength;\n var result = new forge.util.ByteBuffer();\n\n /* Convert password to Unicode byte buffer + trailing 0-byte. */\n var passBuf = new forge.util.ByteBuffer();\n if(password !== null && password !== undefined) {\n for(l = 0; l < password.length; l++) {\n passBuf.putInt16(password.charCodeAt(l));\n }\n passBuf.putInt16(0);\n }\n\n /* Length of salt and password in BYTES. */\n var p = passBuf.length();\n var s = salt.length();\n\n /* 1. Construct a string, D (the \"diversifier\"), by concatenating\n v copies of ID. */\n var D = new forge.util.ByteBuffer();\n D.fillWithByte(id, v);\n\n /* 2. Concatenate copies of the salt together to create a string S of length\n v * ceil(s / v) bytes (the final copy of the salt may be trunacted\n to create S).\n Note that if the salt is the empty string, then so is S. */\n var Slen = v * Math.ceil(s / v);\n var S = new forge.util.ByteBuffer();\n for(l = 0; l < Slen; l++) {\n S.putByte(salt.at(l % s));\n }\n\n /* 3. Concatenate copies of the password together to create a string P of\n length v * ceil(p / v) bytes (the final copy of the password may be\n truncated to create P).\n Note that if the password is the empty string, then so is P. */\n var Plen = v * Math.ceil(p / v);\n var P = new forge.util.ByteBuffer();\n for(l = 0; l < Plen; l++) {\n P.putByte(passBuf.at(l % p));\n }\n\n /* 4. Set I=S||P to be the concatenation of S and P. */\n var I = S;\n I.putBuffer(P);\n\n /* 5. Set c=ceil(n / u). */\n var c = Math.ceil(n / u);\n\n /* 6. For i=1, 2, ..., c, do the following: */\n for(var i = 1; i <= c; i++) {\n /* a) Set Ai=H^r(D||I). (l.e. the rth hash of D||I, H(H(H(...H(D||I)))) */\n var buf = new forge.util.ByteBuffer();\n buf.putBytes(D.bytes());\n buf.putBytes(I.bytes());\n for(var round = 0; round < iter; round++) {\n md.start();\n md.update(buf.getBytes());\n buf = md.digest();\n }\n\n /* b) Concatenate copies of Ai to create a string B of length v bytes (the\n final copy of Ai may be truncated to create B). */\n var B = new forge.util.ByteBuffer();\n for(l = 0; l < v; l++) {\n B.putByte(buf.at(l % u));\n }\n\n /* c) Treating I as a concatenation I0, I1, ..., Ik-1 of v-byte blocks,\n where k=ceil(s / v) + ceil(p / v), modify I by setting\n Ij=(Ij+B+1) mod 2v for each j. */\n var k = Math.ceil(s / v) + Math.ceil(p / v);\n var Inew = new forge.util.ByteBuffer();\n for(j = 0; j < k; j++) {\n var chunk = new forge.util.ByteBuffer(I.getBytes(v));\n var x = 0x1ff;\n for(l = B.length() - 1; l >= 0; l--) {\n x = x >> 8;\n x += B.at(l) + chunk.at(l);\n chunk.setAt(l, x & 0xff);\n }\n Inew.putBuffer(chunk);\n }\n I = Inew;\n\n /* Add Ai to A. */\n result.putBuffer(buf);\n }\n\n result.truncate(result.length() - n);\n return result;\n};\n\n/**\n * Get new Forge cipher object instance.\n *\n * @param oid the OID (in string notation).\n * @param params the ASN.1 params object.\n * @param password the password to decrypt with.\n *\n * @return new cipher object instance.\n */\npki.pbe.getCipher = function(oid, params, password) {\n switch(oid) {\n case pki.oids['pkcs5PBES2']:\n return pki.pbe.getCipherForPBES2(oid, params, password);\n\n case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']:\n case pki.oids['pbewithSHAAnd40BitRC2-CBC']:\n return pki.pbe.getCipherForPKCS12PBE(oid, params, password);\n\n default:\n var error = new Error('Cannot read encrypted PBE data block. Unsupported OID.');\n error.oid = oid;\n error.supportedOids = [\n 'pkcs5PBES2',\n 'pbeWithSHAAnd3-KeyTripleDES-CBC',\n 'pbewithSHAAnd40BitRC2-CBC'\n ];\n throw error;\n }\n};\n\n/**\n * Get new Forge cipher object instance according to PBES2 params block.\n *\n * The returned cipher instance is already started using the IV\n * from PBES2 parameter block.\n *\n * @param oid the PKCS#5 PBKDF2 OID (in string notation).\n * @param params the ASN.1 PBES2-params object.\n * @param password the password to decrypt with.\n *\n * @return new cipher object instance.\n */\npki.pbe.getCipherForPBES2 = function(oid, params, password) {\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(params, PBES2AlgorithmsValidator, capture, errors)) {\n var error = new Error('Cannot read password-based-encryption algorithm ' +\n 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n // check oids\n oid = asn1.derToOid(capture.kdfOid);\n if(oid !== pki.oids['pkcs5PBKDF2']) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'Unsupported key derivation function OID.');\n error.oid = oid;\n error.supportedOids = ['pkcs5PBKDF2'];\n throw error;\n }\n oid = asn1.derToOid(capture.encOid);\n if(oid !== pki.oids['aes128-CBC'] &&\n oid !== pki.oids['aes192-CBC'] &&\n oid !== pki.oids['aes256-CBC'] &&\n oid !== pki.oids['des-EDE3-CBC'] &&\n oid !== pki.oids['desCBC']) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'Unsupported encryption scheme OID.');\n error.oid = oid;\n error.supportedOids = [\n 'aes128-CBC', 'aes192-CBC', 'aes256-CBC', 'des-EDE3-CBC', 'desCBC'];\n throw error;\n }\n\n // set PBE params\n var salt = capture.kdfSalt;\n var count = forge.util.createBuffer(capture.kdfIterationCount);\n count = count.getInt(count.length() << 3);\n var dkLen;\n var cipherFn;\n switch(pki.oids[oid]) {\n case 'aes128-CBC':\n dkLen = 16;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'aes192-CBC':\n dkLen = 24;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'aes256-CBC':\n dkLen = 32;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'des-EDE3-CBC':\n dkLen = 24;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'desCBC':\n dkLen = 8;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n }\n\n // get PRF message digest\n var md = prfOidToMessageDigest(capture.prfOid);\n\n // decrypt private key using pbe with chosen PRF and AES/DES\n var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md);\n var iv = capture.encIv;\n var cipher = cipherFn(dk);\n cipher.start(iv);\n\n return cipher;\n};\n\n/**\n * Get new Forge cipher object instance for PKCS#12 PBE.\n *\n * The returned cipher instance is already started using the key & IV\n * derived from the provided password and PKCS#12 PBE salt.\n *\n * @param oid The PKCS#12 PBE OID (in string notation).\n * @param params The ASN.1 PKCS#12 PBE-params object.\n * @param password The password to decrypt with.\n *\n * @return the new cipher object instance.\n */\npki.pbe.getCipherForPKCS12PBE = function(oid, params, password) {\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(params, pkcs12PbeParamsValidator, capture, errors)) {\n var error = new Error('Cannot read password-based-encryption algorithm ' +\n 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n var salt = forge.util.createBuffer(capture.salt);\n var count = forge.util.createBuffer(capture.iterations);\n count = count.getInt(count.length() << 3);\n\n var dkLen, dIvLen, cipherFn;\n switch(oid) {\n case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']:\n dkLen = 24;\n dIvLen = 8;\n cipherFn = forge.des.startDecrypting;\n break;\n\n case pki.oids['pbewithSHAAnd40BitRC2-CBC']:\n dkLen = 5;\n dIvLen = 8;\n cipherFn = function(key, iv) {\n var cipher = forge.rc2.createDecryptionCipher(key, 40);\n cipher.start(iv, null);\n return cipher;\n };\n break;\n\n default:\n var error = new Error('Cannot read PKCS #12 PBE data block. Unsupported OID.');\n error.oid = oid;\n throw error;\n }\n\n // get PRF message digest\n var md = prfOidToMessageDigest(capture.prfOid);\n var key = pki.pbe.generatePkcs12Key(password, salt, 1, count, dkLen, md);\n md.start();\n var iv = pki.pbe.generatePkcs12Key(password, salt, 2, count, dIvLen, md);\n\n return cipherFn(key, iv);\n};\n\n/**\n * OpenSSL's legacy key derivation function.\n *\n * See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html\n *\n * @param password the password to derive the key from.\n * @param salt the salt to use, null for none.\n * @param dkLen the number of bytes needed for the derived key.\n * @param [options] the options to use:\n * [md] an optional message digest object to use.\n */\npki.pbe.opensslDeriveBytes = function(password, salt, dkLen, md) {\n if(typeof md === 'undefined' || md === null) {\n if(!('md5' in forge.md)) {\n throw new Error('\"md5\" hash algorithm unavailable.');\n }\n md = forge.md.md5.create();\n }\n if(salt === null) {\n salt = '';\n }\n var digests = [hash(md, password + salt)];\n for(var length = 16, i = 1; length < dkLen; ++i, length += 16) {\n digests.push(hash(md, digests[i - 1] + password + salt));\n }\n return digests.join('').substr(0, dkLen);\n};\n\nfunction hash(md, bytes) {\n return md.start().update(bytes).digest().getBytes();\n}\n\nfunction prfOidToMessageDigest(prfOid) {\n // get PRF algorithm, default to SHA-1\n var prfAlgorithm;\n if(!prfOid) {\n prfAlgorithm = 'hmacWithSHA1';\n } else {\n prfAlgorithm = pki.oids[asn1.derToOid(prfOid)];\n if(!prfAlgorithm) {\n var error = new Error('Unsupported PRF OID.');\n error.oid = prfOid;\n error.supported = [\n 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384',\n 'hmacWithSHA512'];\n throw error;\n }\n }\n return prfAlgorithmToMessageDigest(prfAlgorithm);\n}\n\nfunction prfAlgorithmToMessageDigest(prfAlgorithm) {\n var factory = forge.md;\n switch(prfAlgorithm) {\n case 'hmacWithSHA224':\n factory = forge.md.sha512;\n case 'hmacWithSHA1':\n case 'hmacWithSHA256':\n case 'hmacWithSHA384':\n case 'hmacWithSHA512':\n prfAlgorithm = prfAlgorithm.substr(8).toLowerCase();\n break;\n default:\n var error = new Error('Unsupported PRF algorithm.');\n error.algorithm = prfAlgorithm;\n error.supported = [\n 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384',\n 'hmacWithSHA512'];\n throw error;\n }\n if(!factory || !(prfAlgorithm in factory)) {\n throw new Error('Unknown hash algorithm: ' + prfAlgorithm);\n }\n return factory[prfAlgorithm].create();\n}\n\nfunction createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm) {\n var params = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // salt\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt),\n // iteration count\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n countBytes.getBytes())\n ]);\n // when PRF algorithm is not SHA-1 default, add key length and PRF algorithm\n if(prfAlgorithm !== 'hmacWithSHA1') {\n params.value.push(\n // key length\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n forge.util.hexToBytes(dkLen.toString(16))),\n // AlgorithmIdentifier\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids[prfAlgorithm]).getBytes()),\n // parameters (null)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]));\n }\n return params;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/pbe.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/pbkdf2.js": +/*!***********************************************!*\ + !*** ./node_modules/node-forge/lib/pbkdf2.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Password-Based Key-Derivation Function #2 implementation.\n *\n * See RFC 2898 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./hmac */ \"./node_modules/node-forge/lib/hmac.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar pkcs5 = forge.pkcs5 = forge.pkcs5 || {};\n\nvar crypto;\nif(forge.util.isNodejs && !forge.options.usePureJavaScript) {\n crypto = __webpack_require__(/*! crypto */ \"?b254\");\n}\n\n/**\n * Derives a key from a password.\n *\n * @param p the password as a binary-encoded string of bytes.\n * @param s the salt as a binary-encoded string of bytes.\n * @param c the iteration count, a positive integer.\n * @param dkLen the intended length, in bytes, of the derived key,\n * (max: 2^32 - 1) * hash length of the PRF.\n * @param [md] the message digest (or algorithm identifier as a string) to use\n * in the PRF, defaults to SHA-1.\n * @param [callback(err, key)] presence triggers asynchronous version, called\n * once the operation completes.\n *\n * @return the derived key, as a binary-encoded string of bytes, for the\n * synchronous version (if no callback is specified).\n */\nmodule.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function(\n p, s, c, dkLen, md, callback) {\n if(typeof md === 'function') {\n callback = md;\n md = null;\n }\n\n // use native implementation if possible and not disabled, note that\n // some node versions only support SHA-1, others allow digest to be changed\n if(forge.util.isNodejs && !forge.options.usePureJavaScript &&\n crypto.pbkdf2 && (md === null || typeof md !== 'object') &&\n (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) {\n if(typeof md !== 'string') {\n // default prf to SHA-1\n md = 'sha1';\n }\n p = Buffer.from(p, 'binary');\n s = Buffer.from(s, 'binary');\n if(!callback) {\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary');\n }\n return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary');\n }\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2(p, s, c, dkLen, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n\n if(typeof md === 'undefined' || md === null) {\n // default prf to SHA-1\n md = 'sha1';\n }\n if(typeof md === 'string') {\n if(!(md in forge.md.algorithms)) {\n throw new Error('Unknown hash algorithm: ' + md);\n }\n md = forge.md[md].create();\n }\n\n var hLen = md.digestLength;\n\n /* 1. If dkLen > (2^32 - 1) * hLen, output \"derived key too long\" and\n stop. */\n if(dkLen > (0xFFFFFFFF * hLen)) {\n var err = new Error('Derived key is too long.');\n if(callback) {\n return callback(err);\n }\n throw err;\n }\n\n /* 2. Let len be the number of hLen-octet blocks in the derived key,\n rounding up, and let r be the number of octets in the last\n block:\n\n len = CEIL(dkLen / hLen),\n r = dkLen - (len - 1) * hLen. */\n var len = Math.ceil(dkLen / hLen);\n var r = dkLen - (len - 1) * hLen;\n\n /* 3. For each block of the derived key apply the function F defined\n below to the password P, the salt S, the iteration count c, and\n the block index to compute the block:\n\n T_1 = F(P, S, c, 1),\n T_2 = F(P, S, c, 2),\n ...\n T_len = F(P, S, c, len),\n\n where the function F is defined as the exclusive-or sum of the\n first c iterates of the underlying pseudorandom function PRF\n applied to the password P and the concatenation of the salt S\n and the block index i:\n\n F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c\n\n where\n\n u_1 = PRF(P, S || INT(i)),\n u_2 = PRF(P, u_1),\n ...\n u_c = PRF(P, u_{c-1}).\n\n Here, INT(i) is a four-octet encoding of the integer i, most\n significant octet first. */\n var prf = forge.hmac.create();\n prf.start(md, p);\n var dk = '';\n var xor, u_c, u_c1;\n\n // sync version\n if(!callback) {\n for(var i = 1; i <= len; ++i) {\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n for(var j = 2; j <= c; ++j) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n }\n /* 5. Output the derived key DK. */\n return dk;\n }\n\n // async version\n var i = 1, j;\n function outer() {\n if(i > len) {\n // done\n return callback(null, dk);\n }\n\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n j = 2;\n inner();\n }\n\n function inner() {\n if(j <= c) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n ++j;\n return forge.util.setImmediate(inner);\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n\n ++i;\n outer();\n }\n\n outer();\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/pbkdf2.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/pem.js": +/*!********************************************!*\ + !*** ./node_modules/node-forge/lib/pem.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Javascript implementation of basic PEM (Privacy Enhanced Mail) algorithms.\n *\n * See: RFC 1421.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2013-2014 Digital Bazaar, Inc.\n *\n * A Forge PEM object has the following fields:\n *\n * type: identifies the type of message (eg: \"RSA PRIVATE KEY\").\n *\n * procType: identifies the type of processing performed on the message,\n * it has two subfields: version and type, eg: 4,ENCRYPTED.\n *\n * contentDomain: identifies the type of content in the message, typically\n * only uses the value: \"RFC822\".\n *\n * dekInfo: identifies the message encryption algorithm and mode and includes\n * any parameters for the algorithm, it has two subfields: algorithm and\n * parameters, eg: DES-CBC,F8143EDE5960C597.\n *\n * headers: contains all other PEM encapsulated headers -- where order is\n * significant (for pairing data like recipient ID + key info).\n *\n * body: the binary-encoded body.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n// shortcut for pem API\nvar pem = module.exports = forge.pem = forge.pem || {};\n\n/**\n * Encodes (serializes) the given PEM object.\n *\n * @param msg the PEM message object to encode.\n * @param options the options to use:\n * maxline the maximum characters per line for the body, (default: 64).\n *\n * @return the PEM-formatted string.\n */\npem.encode = function(msg, options) {\n options = options || {};\n var rval = '-----BEGIN ' + msg.type + '-----\\r\\n';\n\n // encode special headers\n var header;\n if(msg.procType) {\n header = {\n name: 'Proc-Type',\n values: [String(msg.procType.version), msg.procType.type]\n };\n rval += foldHeader(header);\n }\n if(msg.contentDomain) {\n header = {name: 'Content-Domain', values: [msg.contentDomain]};\n rval += foldHeader(header);\n }\n if(msg.dekInfo) {\n header = {name: 'DEK-Info', values: [msg.dekInfo.algorithm]};\n if(msg.dekInfo.parameters) {\n header.values.push(msg.dekInfo.parameters);\n }\n rval += foldHeader(header);\n }\n\n if(msg.headers) {\n // encode all other headers\n for(var i = 0; i < msg.headers.length; ++i) {\n rval += foldHeader(msg.headers[i]);\n }\n }\n\n // terminate header\n if(msg.procType) {\n rval += '\\r\\n';\n }\n\n // add body\n rval += forge.util.encode64(msg.body, options.maxline || 64) + '\\r\\n';\n\n rval += '-----END ' + msg.type + '-----\\r\\n';\n return rval;\n};\n\n/**\n * Decodes (deserializes) all PEM messages found in the given string.\n *\n * @param str the PEM-formatted string to decode.\n *\n * @return the PEM message objects in an array.\n */\npem.decode = function(str) {\n var rval = [];\n\n // split string into PEM messages (be lenient w/EOF on BEGIN line)\n var rMessage = /\\s*-----BEGIN ([A-Z0-9- ]+)-----\\r?\\n?([\\x21-\\x7e\\s]+?(?:\\r?\\n\\r?\\n))?([:A-Za-z0-9+\\/=\\s]+?)-----END \\1-----/g;\n var rHeader = /([\\x21-\\x7e]+):\\s*([\\x21-\\x7e\\s^:]+)/;\n var rCRLF = /\\r?\\n/;\n var match;\n while(true) {\n match = rMessage.exec(str);\n if(!match) {\n break;\n }\n\n // accept \"NEW CERTIFICATE REQUEST\" as \"CERTIFICATE REQUEST\"\n // https://datatracker.ietf.org/doc/html/rfc7468#section-7\n var type = match[1];\n if(type === 'NEW CERTIFICATE REQUEST') {\n type = 'CERTIFICATE REQUEST';\n }\n\n var msg = {\n type: type,\n procType: null,\n contentDomain: null,\n dekInfo: null,\n headers: [],\n body: forge.util.decode64(match[3])\n };\n rval.push(msg);\n\n // no headers\n if(!match[2]) {\n continue;\n }\n\n // parse headers\n var lines = match[2].split(rCRLF);\n var li = 0;\n while(match && li < lines.length) {\n // get line, trim any rhs whitespace\n var line = lines[li].replace(/\\s+$/, '');\n\n // RFC2822 unfold any following folded lines\n for(var nl = li + 1; nl < lines.length; ++nl) {\n var next = lines[nl];\n if(!/\\s/.test(next[0])) {\n break;\n }\n line += next;\n li = nl;\n }\n\n // parse header\n match = line.match(rHeader);\n if(match) {\n var header = {name: match[1], values: []};\n var values = match[2].split(',');\n for(var vi = 0; vi < values.length; ++vi) {\n header.values.push(ltrim(values[vi]));\n }\n\n // Proc-Type must be the first header\n if(!msg.procType) {\n if(header.name !== 'Proc-Type') {\n throw new Error('Invalid PEM formatted message. The first ' +\n 'encapsulated header must be \"Proc-Type\".');\n } else if(header.values.length !== 2) {\n throw new Error('Invalid PEM formatted message. The \"Proc-Type\" ' +\n 'header must have two subfields.');\n }\n msg.procType = {version: values[0], type: values[1]};\n } else if(!msg.contentDomain && header.name === 'Content-Domain') {\n // special-case Content-Domain\n msg.contentDomain = values[0] || '';\n } else if(!msg.dekInfo && header.name === 'DEK-Info') {\n // special-case DEK-Info\n if(header.values.length === 0) {\n throw new Error('Invalid PEM formatted message. The \"DEK-Info\" ' +\n 'header must have at least one subfield.');\n }\n msg.dekInfo = {algorithm: values[0], parameters: values[1] || null};\n } else {\n msg.headers.push(header);\n }\n }\n\n ++li;\n }\n\n if(msg.procType === 'ENCRYPTED' && !msg.dekInfo) {\n throw new Error('Invalid PEM formatted message. The \"DEK-Info\" ' +\n 'header must be present if \"Proc-Type\" is \"ENCRYPTED\".');\n }\n }\n\n if(rval.length === 0) {\n throw new Error('Invalid PEM formatted message.');\n }\n\n return rval;\n};\n\nfunction foldHeader(header) {\n var rval = header.name + ': ';\n\n // ensure values with CRLF are folded\n var values = [];\n var insertSpace = function(match, $1) {\n return ' ' + $1;\n };\n for(var i = 0; i < header.values.length; ++i) {\n values.push(header.values[i].replace(/^(\\S+\\r\\n)/, insertSpace));\n }\n rval += values.join(',') + '\\r\\n';\n\n // do folding\n var length = 0;\n var candidate = -1;\n for(var i = 0; i < rval.length; ++i, ++length) {\n if(length > 65 && candidate !== -1) {\n var insert = rval[candidate];\n if(insert === ',') {\n ++candidate;\n rval = rval.substr(0, candidate) + '\\r\\n ' + rval.substr(candidate);\n } else {\n rval = rval.substr(0, candidate) +\n '\\r\\n' + insert + rval.substr(candidate + 1);\n }\n length = (i - candidate - 1);\n candidate = -1;\n ++i;\n } else if(rval[i] === ' ' || rval[i] === '\\t' || rval[i] === ',') {\n candidate = i;\n }\n }\n\n return rval;\n}\n\nfunction ltrim(str) {\n return str.replace(/^\\s+/, '');\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/pem.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/pkcs1.js": +/*!**********************************************!*\ + !*** ./node_modules/node-forge/lib/pkcs1.js ***! + \**********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Partial implementation of PKCS#1 v2.2: RSA-OEAP\n *\n * Modified but based on the following MIT and BSD licensed code:\n *\n * https://github.com/kjur/jsjws/blob/master/rsa.js:\n *\n * The 'jsjws'(JSON Web Signature JavaScript Library) License\n *\n * Copyright (c) 2012 Kenji Urushima\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * http://webrsa.cvs.sourceforge.net/viewvc/webrsa/Client/RSAES-OAEP.js?content-type=text%2Fplain:\n *\n * RSAES-OAEP.js\n * $Id: RSAES-OAEP.js,v 1.1.1.1 2003/03/19 15:37:20 ellispritchard Exp $\n * JavaScript Implementation of PKCS #1 v2.1 RSA CRYPTOGRAPHY STANDARD (RSA Laboratories, June 14, 2002)\n * Copyright (C) Ellis Pritchard, Guardian Unlimited 2003.\n * Contact: ellis@nukinetics.com\n * Distributed under the BSD License.\n *\n * Official documentation: http://www.rsa.com/rsalabs/node.asp?id=2125\n *\n * @author Evan Jones (http://evanjones.ca/)\n * @author Dave Longley\n *\n * Copyright (c) 2013-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n__webpack_require__(/*! ./sha1 */ \"./node_modules/node-forge/lib/sha1.js\");\n\n// shortcut for PKCS#1 API\nvar pkcs1 = module.exports = forge.pkcs1 = forge.pkcs1 || {};\n\n/**\n * Encode the given RSAES-OAEP message (M) using key, with optional label (L)\n * and seed.\n *\n * This method does not perform RSA encryption, it only encodes the message\n * using RSAES-OAEP.\n *\n * @param key the RSA key to use.\n * @param message the message to encode.\n * @param options the options to use:\n * label an optional label to use.\n * seed the seed to use.\n * md the message digest object to use, undefined for SHA-1.\n * mgf1 optional mgf1 parameters:\n * md the message digest object to use for MGF1.\n *\n * @return the encoded message bytes.\n */\npkcs1.encode_rsa_oaep = function(key, message, options) {\n // parse arguments\n var label;\n var seed;\n var md;\n var mgf1Md;\n // legacy args (label, seed, md)\n if(typeof options === 'string') {\n label = options;\n seed = arguments[3] || undefined;\n md = arguments[4] || undefined;\n } else if(options) {\n label = options.label || undefined;\n seed = options.seed || undefined;\n md = options.md || undefined;\n if(options.mgf1 && options.mgf1.md) {\n mgf1Md = options.mgf1.md;\n }\n }\n\n // default OAEP to SHA-1 message digest\n if(!md) {\n md = forge.md.sha1.create();\n } else {\n md.start();\n }\n\n // default MGF-1 to same as OAEP\n if(!mgf1Md) {\n mgf1Md = md;\n }\n\n // compute length in bytes and check output\n var keyLength = Math.ceil(key.n.bitLength() / 8);\n var maxLength = keyLength - 2 * md.digestLength - 2;\n if(message.length > maxLength) {\n var error = new Error('RSAES-OAEP input message length is too long.');\n error.length = message.length;\n error.maxLength = maxLength;\n throw error;\n }\n\n if(!label) {\n label = '';\n }\n md.update(label, 'raw');\n var lHash = md.digest();\n\n var PS = '';\n var PS_length = maxLength - message.length;\n for(var i = 0; i < PS_length; i++) {\n PS += '\\x00';\n }\n\n var DB = lHash.getBytes() + PS + '\\x01' + message;\n\n if(!seed) {\n seed = forge.random.getBytes(md.digestLength);\n } else if(seed.length !== md.digestLength) {\n var error = new Error('Invalid RSAES-OAEP seed. The seed length must ' +\n 'match the digest length.');\n error.seedLength = seed.length;\n error.digestLength = md.digestLength;\n throw error;\n }\n\n var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);\n var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length);\n\n var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);\n var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length);\n\n // return encoded message\n return '\\x00' + maskedSeed + maskedDB;\n};\n\n/**\n * Decode the given RSAES-OAEP encoded message (EM) using key, with optional\n * label (L).\n *\n * This method does not perform RSA decryption, it only decodes the message\n * using RSAES-OAEP.\n *\n * @param key the RSA key to use.\n * @param em the encoded message to decode.\n * @param options the options to use:\n * label an optional label to use.\n * md the message digest object to use for OAEP, undefined for SHA-1.\n * mgf1 optional mgf1 parameters:\n * md the message digest object to use for MGF1.\n *\n * @return the decoded message bytes.\n */\npkcs1.decode_rsa_oaep = function(key, em, options) {\n // parse args\n var label;\n var md;\n var mgf1Md;\n // legacy args\n if(typeof options === 'string') {\n label = options;\n md = arguments[3] || undefined;\n } else if(options) {\n label = options.label || undefined;\n md = options.md || undefined;\n if(options.mgf1 && options.mgf1.md) {\n mgf1Md = options.mgf1.md;\n }\n }\n\n // compute length in bytes\n var keyLength = Math.ceil(key.n.bitLength() / 8);\n\n if(em.length !== keyLength) {\n var error = new Error('RSAES-OAEP encoded message length is invalid.');\n error.length = em.length;\n error.expectedLength = keyLength;\n throw error;\n }\n\n // default OAEP to SHA-1 message digest\n if(md === undefined) {\n md = forge.md.sha1.create();\n } else {\n md.start();\n }\n\n // default MGF-1 to same as OAEP\n if(!mgf1Md) {\n mgf1Md = md;\n }\n\n if(keyLength < 2 * md.digestLength + 2) {\n throw new Error('RSAES-OAEP key is too short for the hash function.');\n }\n\n if(!label) {\n label = '';\n }\n md.update(label, 'raw');\n var lHash = md.digest().getBytes();\n\n // split the message into its parts\n var y = em.charAt(0);\n var maskedSeed = em.substring(1, md.digestLength + 1);\n var maskedDB = em.substring(1 + md.digestLength);\n\n var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);\n var seed = forge.util.xorBytes(maskedSeed, seedMask, maskedSeed.length);\n\n var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);\n var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length);\n\n var lHashPrime = db.substring(0, md.digestLength);\n\n // constant time check that all values match what is expected\n var error = (y !== '\\x00');\n\n // constant time check lHash vs lHashPrime\n for(var i = 0; i < md.digestLength; ++i) {\n error |= (lHash.charAt(i) !== lHashPrime.charAt(i));\n }\n\n // \"constant time\" find the 0x1 byte separating the padding (zeros) from the\n // message\n // TODO: It must be possible to do this in a better/smarter way?\n var in_ps = 1;\n var index = md.digestLength;\n for(var j = md.digestLength; j < db.length; j++) {\n var code = db.charCodeAt(j);\n\n var is_0 = (code & 0x1) ^ 0x1;\n\n // non-zero if not 0 or 1 in the ps section\n var error_mask = in_ps ? 0xfffe : 0x0000;\n error |= (code & error_mask);\n\n // latch in_ps to zero after we find 0x1\n in_ps = in_ps & is_0;\n index += in_ps;\n }\n\n if(error || db.charCodeAt(index) !== 0x1) {\n throw new Error('Invalid RSAES-OAEP padding.');\n }\n\n return db.substring(index + 1);\n};\n\nfunction rsa_mgf1(seed, maskLength, hash) {\n // default to SHA-1 message digest\n if(!hash) {\n hash = forge.md.sha1.create();\n }\n var t = '';\n var count = Math.ceil(maskLength / hash.digestLength);\n for(var i = 0; i < count; ++i) {\n var c = String.fromCharCode(\n (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);\n hash.start();\n hash.update(seed + c);\n t += hash.digest().getBytes();\n }\n return t.substring(0, maskLength);\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/pkcs1.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/prime.js": +/*!**********************************************!*\ + !*** ./node_modules/node-forge/lib/prime.js ***! + \**********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Prime number generation API.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n__webpack_require__(/*! ./jsbn */ \"./node_modules/node-forge/lib/jsbn.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n\n(function() {\n\n// forge.prime already defined\nif(forge.prime) {\n module.exports = forge.prime;\n return;\n}\n\n/* PRIME API */\nvar prime = module.exports = forge.prime = forge.prime || {};\n\nvar BigInteger = forge.jsbn.BigInteger;\n\n// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29\nvar GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2];\nvar THIRTY = new BigInteger(null);\nTHIRTY.fromInt(30);\nvar op_or = function(x, y) {return x|y;};\n\n/**\n * Generates a random probable prime with the given number of bits.\n *\n * Alternative algorithms can be specified by name as a string or as an\n * object with custom options like so:\n *\n * {\n * name: 'PRIMEINC',\n * options: {\n * maxBlockTime: ,\n * millerRabinTests: ,\n * workerScript: ,\n * workers: .\n * workLoad: the size of the work load, ie: number of possible prime\n * numbers for each web worker to check per work assignment,\n * (default: 100).\n * }\n * }\n *\n * @param bits the number of bits for the prime number.\n * @param options the options to use.\n * [algorithm] the algorithm to use (default: 'PRIMEINC').\n * [prng] a custom crypto-secure pseudo-random number generator to use,\n * that must define \"getBytesSync\".\n *\n * @return callback(err, num) called once the operation completes.\n */\nprime.generateProbablePrime = function(bits, options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n // default to PRIMEINC algorithm\n var algorithm = options.algorithm || 'PRIMEINC';\n if(typeof algorithm === 'string') {\n algorithm = {name: algorithm};\n }\n algorithm.options = algorithm.options || {};\n\n // create prng with api that matches BigInteger secure random\n var prng = options.prng || forge.random;\n var rng = {\n // x is an array to fill with bytes\n nextBytes: function(x) {\n var b = prng.getBytesSync(x.length);\n for(var i = 0; i < x.length; ++i) {\n x[i] = b.charCodeAt(i);\n }\n }\n };\n\n if(algorithm.name === 'PRIMEINC') {\n return primeincFindPrime(bits, rng, algorithm.options, callback);\n }\n\n throw new Error('Invalid prime generation algorithm: ' + algorithm.name);\n};\n\nfunction primeincFindPrime(bits, rng, options, callback) {\n if('workers' in options) {\n return primeincFindPrimeWithWorkers(bits, rng, options, callback);\n }\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n}\n\nfunction primeincFindPrimeWithoutWorkers(bits, rng, options, callback) {\n // initialize random number\n var num = generateRandom(bits, rng);\n\n /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The\n number we are given is always aligned at 30k + 1. Each time the number is\n determined not to be prime we add to get to the next 'i', eg: if the number\n was at 30k + 1 we add 6. */\n var deltaIdx = 0;\n\n // get required number of MR tests\n var mrTests = getMillerRabinTests(num.bitLength());\n if('millerRabinTests' in options) {\n mrTests = options.millerRabinTests;\n }\n\n // find prime nearest to 'num' for maxBlockTime ms\n // 10 ms gives 5ms of leeway for other calculations before dropping\n // below 60fps (1000/60 == 16.67), but in reality, the number will\n // likely be higher due to an 'atomic' big int modPow\n var maxBlockTime = 10;\n if('maxBlockTime' in options) {\n maxBlockTime = options.maxBlockTime;\n }\n\n _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback);\n}\n\nfunction _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback) {\n var start = +new Date();\n do {\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n // do primality test\n if(num.isProbablePrime(mrTests)) {\n return callback(null, num);\n }\n // get next potential prime\n num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0);\n } while(maxBlockTime < 0 || (+new Date() - start < maxBlockTime));\n\n // keep trying later\n forge.util.setImmediate(function() {\n _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback);\n });\n}\n\n// NOTE: This algorithm is indeterminate in nature because workers\n// run in parallel looking at different segments of numbers. Even if this\n// algorithm is run twice with the same input from a predictable RNG, it\n// may produce different outputs.\nfunction primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}\n\n/**\n * Generates a random number using the given number of bits and RNG.\n *\n * @param bits the number of bits for the number.\n * @param rng the random number generator to use.\n *\n * @return the random number.\n */\nfunction generateRandom(bits, rng) {\n var num = new BigInteger(bits, rng);\n // force MSB set\n var bits1 = bits - 1;\n if(!num.testBit(bits1)) {\n num.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num);\n }\n // align number on 30k+1 boundary\n num.dAddOffset(31 - num.mod(THIRTY).byteValue(), 0);\n return num;\n}\n\n/**\n * Returns the required number of Miller-Rabin tests to generate a\n * prime with an error probability of (1/2)^80.\n *\n * See Handbook of Applied Cryptography Chapter 4, Table 4.4.\n *\n * @param bits the bit size.\n *\n * @return the required number of iterations.\n */\nfunction getMillerRabinTests(bits) {\n if(bits <= 100) return 27;\n if(bits <= 150) return 18;\n if(bits <= 200) return 15;\n if(bits <= 250) return 12;\n if(bits <= 300) return 9;\n if(bits <= 350) return 8;\n if(bits <= 400) return 7;\n if(bits <= 500) return 6;\n if(bits <= 600) return 5;\n if(bits <= 800) return 4;\n if(bits <= 1250) return 3;\n return 2;\n}\n\n})();\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/prime.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/prng.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/prng.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * A javascript implementation of a cryptographically-secure\n * Pseudo Random Number Generator (PRNG). The Fortuna algorithm is followed\n * here though the use of SHA-256 is not enforced; when generating an\n * a PRNG context, the hashing algorithm and block cipher used for\n * the generator are specified via a plugin.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar _crypto = null;\nif(forge.util.isNodejs && !forge.options.usePureJavaScript &&\n !process.versions['node-webkit']) {\n _crypto = __webpack_require__(/*! crypto */ \"?b254\");\n}\n\n/* PRNG API */\nvar prng = module.exports = forge.prng = forge.prng || {};\n\n/**\n * Creates a new PRNG context.\n *\n * A PRNG plugin must be passed in that will provide:\n *\n * 1. A function that initializes the key and seed of a PRNG context. It\n * will be given a 16 byte key and a 16 byte seed. Any key expansion\n * or transformation of the seed from a byte string into an array of\n * integers (or similar) should be performed.\n * 2. The cryptographic function used by the generator. It takes a key and\n * a seed.\n * 3. A seed increment function. It takes the seed and returns seed + 1.\n * 4. An api to create a message digest.\n *\n * For an example, see random.js.\n *\n * @param plugin the PRNG plugin to use.\n */\nprng.create = function(plugin) {\n var ctx = {\n plugin: plugin,\n key: null,\n seed: null,\n time: null,\n // number of reseeds so far\n reseeds: 0,\n // amount of data generated so far\n generated: 0,\n // no initial key bytes\n keyBytes: ''\n };\n\n // create 32 entropy pools (each is a message digest)\n var md = plugin.md;\n var pools = new Array(32);\n for(var i = 0; i < 32; ++i) {\n pools[i] = md.create();\n }\n ctx.pools = pools;\n\n // entropy pools are written to cyclically, starting at index 0\n ctx.pool = 0;\n\n /**\n * Generates random bytes. The bytes may be generated synchronously or\n * asynchronously. Web workers must use the asynchronous interface or\n * else the behavior is undefined.\n *\n * @param count the number of random bytes to generate.\n * @param [callback(err, bytes)] called once the operation completes.\n *\n * @return count random bytes as a string.\n */\n ctx.generate = function(count, callback) {\n // do synchronously\n if(!callback) {\n return ctx.generateSync(count);\n }\n\n // simple generator using counter-based CBC\n var cipher = ctx.plugin.cipher;\n var increment = ctx.plugin.increment;\n var formatKey = ctx.plugin.formatKey;\n var formatSeed = ctx.plugin.formatSeed;\n var b = forge.util.createBuffer();\n\n // paranoid deviation from Fortuna:\n // reset key for every request to protect previously\n // generated random bytes should the key be discovered;\n // there is no 100ms based reseeding because of this\n // forced reseed for every `generate` call\n ctx.key = null;\n\n generate();\n\n function generate(err) {\n if(err) {\n return callback(err);\n }\n\n // sufficient bytes generated\n if(b.length() >= count) {\n return callback(null, b.getBytes(count));\n }\n\n // if amount of data generated is greater than 1 MiB, trigger reseed\n if(ctx.generated > 0xfffff) {\n ctx.key = null;\n }\n\n if(ctx.key === null) {\n // prevent stack overflow\n return forge.util.nextTick(function() {\n _reseed(generate);\n });\n }\n\n // generate the random bytes\n var bytes = cipher(ctx.key, ctx.seed);\n ctx.generated += bytes.length;\n b.putBytes(bytes);\n\n // generate bytes for a new key and seed\n ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed)));\n ctx.seed = formatSeed(cipher(ctx.key, ctx.seed));\n\n forge.util.setImmediate(generate);\n }\n };\n\n /**\n * Generates random bytes synchronously.\n *\n * @param count the number of random bytes to generate.\n *\n * @return count random bytes as a string.\n */\n ctx.generateSync = function(count) {\n // simple generator using counter-based CBC\n var cipher = ctx.plugin.cipher;\n var increment = ctx.plugin.increment;\n var formatKey = ctx.plugin.formatKey;\n var formatSeed = ctx.plugin.formatSeed;\n\n // paranoid deviation from Fortuna:\n // reset key for every request to protect previously\n // generated random bytes should the key be discovered;\n // there is no 100ms based reseeding because of this\n // forced reseed for every `generateSync` call\n ctx.key = null;\n\n var b = forge.util.createBuffer();\n while(b.length() < count) {\n // if amount of data generated is greater than 1 MiB, trigger reseed\n if(ctx.generated > 0xfffff) {\n ctx.key = null;\n }\n\n if(ctx.key === null) {\n _reseedSync();\n }\n\n // generate the random bytes\n var bytes = cipher(ctx.key, ctx.seed);\n ctx.generated += bytes.length;\n b.putBytes(bytes);\n\n // generate bytes for a new key and seed\n ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed)));\n ctx.seed = formatSeed(cipher(ctx.key, ctx.seed));\n }\n\n return b.getBytes(count);\n };\n\n /**\n * Private function that asynchronously reseeds a generator.\n *\n * @param callback(err) called once the operation completes.\n */\n function _reseed(callback) {\n if(ctx.pools[0].messageLength >= 32) {\n _seed();\n return callback();\n }\n // not enough seed data...\n var needed = (32 - ctx.pools[0].messageLength) << 5;\n ctx.seedFile(needed, function(err, bytes) {\n if(err) {\n return callback(err);\n }\n ctx.collect(bytes);\n _seed();\n callback();\n });\n }\n\n /**\n * Private function that synchronously reseeds a generator.\n */\n function _reseedSync() {\n if(ctx.pools[0].messageLength >= 32) {\n return _seed();\n }\n // not enough seed data...\n var needed = (32 - ctx.pools[0].messageLength) << 5;\n ctx.collect(ctx.seedFileSync(needed));\n _seed();\n }\n\n /**\n * Private function that seeds a generator once enough bytes are available.\n */\n function _seed() {\n // update reseed count\n ctx.reseeds = (ctx.reseeds === 0xffffffff) ? 0 : ctx.reseeds + 1;\n\n // goal is to update `key` via:\n // key = hash(key + s)\n // where 's' is all collected entropy from selected pools, then...\n\n // create a plugin-based message digest\n var md = ctx.plugin.md.create();\n\n // consume current key bytes\n md.update(ctx.keyBytes);\n\n // digest the entropy of pools whose index k meet the\n // condition 'n mod 2^k == 0' where n is the number of reseeds\n var _2powK = 1;\n for(var k = 0; k < 32; ++k) {\n if(ctx.reseeds % _2powK === 0) {\n md.update(ctx.pools[k].digest().getBytes());\n ctx.pools[k].start();\n }\n _2powK = _2powK << 1;\n }\n\n // get digest for key bytes\n ctx.keyBytes = md.digest().getBytes();\n\n // paranoid deviation from Fortuna:\n // update `seed` via `seed = hash(key)`\n // instead of initializing to zero once and only\n // ever incrementing it\n md.start();\n md.update(ctx.keyBytes);\n var seedBytes = md.digest().getBytes();\n\n // update state\n ctx.key = ctx.plugin.formatKey(ctx.keyBytes);\n ctx.seed = ctx.plugin.formatSeed(seedBytes);\n ctx.generated = 0;\n }\n\n /**\n * The built-in default seedFile. This seedFile is used when entropy\n * is needed immediately.\n *\n * @param needed the number of bytes that are needed.\n *\n * @return the random bytes.\n */\n function defaultSeedFile(needed) {\n // use window.crypto.getRandomValues strong source of entropy if available\n var getRandomValues = null;\n var globalScope = forge.util.globalScope;\n var _crypto = globalScope.crypto || globalScope.msCrypto;\n if(_crypto && _crypto.getRandomValues) {\n getRandomValues = function(arr) {\n return _crypto.getRandomValues(arr);\n };\n }\n\n var b = forge.util.createBuffer();\n if(getRandomValues) {\n while(b.length() < needed) {\n // max byte length is 65536 before QuotaExceededError is thrown\n // http://www.w3.org/TR/WebCryptoAPI/#RandomSource-method-getRandomValues\n var count = Math.max(1, Math.min(needed - b.length(), 65536) / 4);\n var entropy = new Uint32Array(Math.floor(count));\n try {\n getRandomValues(entropy);\n for(var i = 0; i < entropy.length; ++i) {\n b.putInt32(entropy[i]);\n }\n } catch(e) {\n /* only ignore QuotaExceededError */\n if(!(typeof QuotaExceededError !== 'undefined' &&\n e instanceof QuotaExceededError)) {\n throw e;\n }\n }\n }\n }\n\n // be sad and add some weak random data\n if(b.length() < needed) {\n /* Draws from Park-Miller \"minimal standard\" 31 bit PRNG,\n implemented with David G. Carta's optimization: with 32 bit math\n and without division (Public Domain). */\n var hi, lo, next;\n var seed = Math.floor(Math.random() * 0x010000);\n while(b.length() < needed) {\n lo = 16807 * (seed & 0xFFFF);\n hi = 16807 * (seed >> 16);\n lo += (hi & 0x7FFF) << 16;\n lo += hi >> 15;\n lo = (lo & 0x7FFFFFFF) + (lo >> 31);\n seed = lo & 0xFFFFFFFF;\n\n // consume lower 3 bytes of seed\n for(var i = 0; i < 3; ++i) {\n // throw in more pseudo random\n next = seed >>> (i << 3);\n next ^= Math.floor(Math.random() * 0x0100);\n b.putByte(next & 0xFF);\n }\n }\n }\n\n return b.getBytes(needed);\n }\n // initialize seed file APIs\n if(_crypto) {\n // use nodejs async API\n ctx.seedFile = function(needed, callback) {\n _crypto.randomBytes(needed, function(err, bytes) {\n if(err) {\n return callback(err);\n }\n callback(null, bytes.toString());\n });\n };\n // use nodejs sync API\n ctx.seedFileSync = function(needed) {\n return _crypto.randomBytes(needed).toString();\n };\n } else {\n ctx.seedFile = function(needed, callback) {\n try {\n callback(null, defaultSeedFile(needed));\n } catch(e) {\n callback(e);\n }\n };\n ctx.seedFileSync = defaultSeedFile;\n }\n\n /**\n * Adds entropy to a prng ctx's accumulator.\n *\n * @param bytes the bytes of entropy as a string.\n */\n ctx.collect = function(bytes) {\n // iterate over pools distributing entropy cyclically\n var count = bytes.length;\n for(var i = 0; i < count; ++i) {\n ctx.pools[ctx.pool].update(bytes.substr(i, 1));\n ctx.pool = (ctx.pool === 31) ? 0 : ctx.pool + 1;\n }\n };\n\n /**\n * Collects an integer of n bits.\n *\n * @param i the integer entropy.\n * @param n the number of bits in the integer.\n */\n ctx.collectInt = function(i, n) {\n var bytes = '';\n for(var x = 0; x < n; x += 8) {\n bytes += String.fromCharCode((i >> x) & 0xFF);\n }\n ctx.collect(bytes);\n };\n\n /**\n * Registers a Web Worker to receive immediate entropy from the main thread.\n * This method is required until Web Workers can access the native crypto\n * API. This method should be called twice for each created worker, once in\n * the main thread, and once in the worker itself.\n *\n * @param worker the worker to register.\n */\n ctx.registerWorker = function(worker) {\n // worker receives random bytes\n if(worker === self) {\n ctx.seedFile = function(needed, callback) {\n function listener(e) {\n var data = e.data;\n if(data.forge && data.forge.prng) {\n self.removeEventListener('message', listener);\n callback(data.forge.prng.err, data.forge.prng.bytes);\n }\n }\n self.addEventListener('message', listener);\n self.postMessage({forge: {prng: {needed: needed}}});\n };\n } else {\n // main thread sends random bytes upon request\n var listener = function(e) {\n var data = e.data;\n if(data.forge && data.forge.prng) {\n ctx.seedFile(data.forge.prng.needed, function(err, bytes) {\n worker.postMessage({forge: {prng: {err: err, bytes: bytes}}});\n });\n }\n };\n // TODO: do we need to remove the event listener when the worker dies?\n worker.addEventListener('message', listener);\n }\n };\n\n return ctx;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/prng.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/random.js": +/*!***********************************************!*\ + !*** ./node_modules/node-forge/lib/random.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * An API for getting cryptographically-secure random bytes. The bytes are\n * generated using the Fortuna algorithm devised by Bruce Schneier and\n * Niels Ferguson.\n *\n * Getting strong random bytes is not yet easy to do in javascript. The only\n * truish random entropy that can be collected is from the mouse, keyboard, or\n * from timing with respect to page loads, etc. This generator makes a poor\n * attempt at providing random bytes when those sources haven't yet provided\n * enough entropy to initially seed or to reseed the PRNG.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2009-2014 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./aes */ \"./node_modules/node-forge/lib/aes.js\");\n__webpack_require__(/*! ./sha256 */ \"./node_modules/node-forge/lib/sha256.js\");\n__webpack_require__(/*! ./prng */ \"./node_modules/node-forge/lib/prng.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\n(function() {\n\n// forge.random already defined\nif(forge.random && forge.random.getBytes) {\n module.exports = forge.random;\n return;\n}\n\n(function(jQuery) {\n\n// the default prng plugin, uses AES-128\nvar prng_aes = {};\nvar _prng_aes_output = new Array(4);\nvar _prng_aes_buffer = forge.util.createBuffer();\nprng_aes.formatKey = function(key) {\n // convert the key into 32-bit integers\n var tmp = forge.util.createBuffer(key);\n key = new Array(4);\n key[0] = tmp.getInt32();\n key[1] = tmp.getInt32();\n key[2] = tmp.getInt32();\n key[3] = tmp.getInt32();\n\n // return the expanded key\n return forge.aes._expandKey(key, false);\n};\nprng_aes.formatSeed = function(seed) {\n // convert seed into 32-bit integers\n var tmp = forge.util.createBuffer(seed);\n seed = new Array(4);\n seed[0] = tmp.getInt32();\n seed[1] = tmp.getInt32();\n seed[2] = tmp.getInt32();\n seed[3] = tmp.getInt32();\n return seed;\n};\nprng_aes.cipher = function(key, seed) {\n forge.aes._updateBlock(key, seed, _prng_aes_output, false);\n _prng_aes_buffer.putInt32(_prng_aes_output[0]);\n _prng_aes_buffer.putInt32(_prng_aes_output[1]);\n _prng_aes_buffer.putInt32(_prng_aes_output[2]);\n _prng_aes_buffer.putInt32(_prng_aes_output[3]);\n return _prng_aes_buffer.getBytes();\n};\nprng_aes.increment = function(seed) {\n // FIXME: do we care about carry or signed issues?\n ++seed[3];\n return seed;\n};\nprng_aes.md = forge.md.sha256;\n\n/**\n * Creates a new PRNG.\n */\nfunction spawnPrng() {\n var ctx = forge.prng.create(prng_aes);\n\n /**\n * Gets random bytes. If a native secure crypto API is unavailable, this\n * method tries to make the bytes more unpredictable by drawing from data that\n * can be collected from the user of the browser, eg: mouse movement.\n *\n * If a callback is given, this method will be called asynchronously.\n *\n * @param count the number of random bytes to get.\n * @param [callback(err, bytes)] called once the operation completes.\n *\n * @return the random bytes in a string.\n */\n ctx.getBytes = function(count, callback) {\n return ctx.generate(count, callback);\n };\n\n /**\n * Gets random bytes asynchronously. If a native secure crypto API is\n * unavailable, this method tries to make the bytes more unpredictable by\n * drawing from data that can be collected from the user of the browser,\n * eg: mouse movement.\n *\n * @param count the number of random bytes to get.\n *\n * @return the random bytes in a string.\n */\n ctx.getBytesSync = function(count) {\n return ctx.generate(count);\n };\n\n return ctx;\n}\n\n// create default prng context\nvar _ctx = spawnPrng();\n\n// add other sources of entropy only if window.crypto.getRandomValues is not\n// available -- otherwise this source will be automatically used by the prng\nvar getRandomValues = null;\nvar globalScope = forge.util.globalScope;\nvar _crypto = globalScope.crypto || globalScope.msCrypto;\nif(_crypto && _crypto.getRandomValues) {\n getRandomValues = function(arr) {\n return _crypto.getRandomValues(arr);\n };\n}\n\nif(forge.options.usePureJavaScript ||\n (!forge.util.isNodejs && !getRandomValues)) {\n // if this is a web worker, do not use weak entropy, instead register to\n // receive strong entropy asynchronously from the main thread\n if(typeof window === 'undefined' || window.document === undefined) {\n // FIXME:\n }\n\n // get load time entropy\n _ctx.collectInt(+new Date(), 32);\n\n // add some entropy from navigator object\n if(typeof(navigator) !== 'undefined') {\n var _navBytes = '';\n for(var key in navigator) {\n try {\n if(typeof(navigator[key]) == 'string') {\n _navBytes += navigator[key];\n }\n } catch(e) {\n /* Some navigator keys might not be accessible, e.g. the geolocation\n attribute throws an exception if touched in Mozilla chrome://\n context.\n\n Silently ignore this and just don't use this as a source of\n entropy. */\n }\n }\n _ctx.collect(_navBytes);\n _navBytes = null;\n }\n\n // add mouse and keyboard collectors if jquery is available\n if(jQuery) {\n // set up mouse entropy capture\n jQuery().mousemove(function(e) {\n // add mouse coords\n _ctx.collectInt(e.clientX, 16);\n _ctx.collectInt(e.clientY, 16);\n });\n\n // set up keyboard entropy capture\n jQuery().keypress(function(e) {\n _ctx.collectInt(e.charCode, 8);\n });\n }\n}\n\n/* Random API */\nif(!forge.random) {\n forge.random = _ctx;\n} else {\n // extend forge.random with _ctx\n for(var key in _ctx) {\n forge.random[key] = _ctx[key];\n }\n}\n\n// expose spawn PRNG\nforge.random.createInstance = spawnPrng;\n\nmodule.exports = forge.random;\n\n})(typeof(jQuery) !== 'undefined' ? jQuery : null);\n\n})();\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/random.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/rc2.js": +/*!********************************************!*\ + !*** ./node_modules/node-forge/lib/rc2.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * RC2 implementation.\n *\n * @author Stefan Siegl\n *\n * Copyright (c) 2012 Stefan Siegl \n *\n * Information on the RC2 cipher is available from RFC #2268,\n * http://www.ietf.org/rfc/rfc2268.txt\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar piTable = [\n 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,\n 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,\n 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,\n 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,\n 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,\n 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,\n 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,\n 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,\n 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,\n 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,\n 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,\n 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,\n 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,\n 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,\n 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,\n 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad\n];\n\nvar s = [1, 2, 3, 5];\n\n/**\n * Rotate a word left by given number of bits.\n *\n * Bits that are shifted out on the left are put back in on the right\n * hand side.\n *\n * @param word The word to shift left.\n * @param bits The number of bits to shift by.\n * @return The rotated word.\n */\nvar rol = function(word, bits) {\n return ((word << bits) & 0xffff) | ((word & 0xffff) >> (16 - bits));\n};\n\n/**\n * Rotate a word right by given number of bits.\n *\n * Bits that are shifted out on the right are put back in on the left\n * hand side.\n *\n * @param word The word to shift right.\n * @param bits The number of bits to shift by.\n * @return The rotated word.\n */\nvar ror = function(word, bits) {\n return ((word & 0xffff) >> bits) | ((word << (16 - bits)) & 0xffff);\n};\n\n/* RC2 API */\nmodule.exports = forge.rc2 = forge.rc2 || {};\n\n/**\n * Perform RC2 key expansion as per RFC #2268, section 2.\n *\n * @param key variable-length user key (between 1 and 128 bytes)\n * @param effKeyBits number of effective key bits (default: 128)\n * @return the expanded RC2 key (ByteBuffer of 128 bytes)\n */\nforge.rc2.expandKey = function(key, effKeyBits) {\n if(typeof key === 'string') {\n key = forge.util.createBuffer(key);\n }\n effKeyBits = effKeyBits || 128;\n\n /* introduce variables that match the names used in RFC #2268 */\n var L = key;\n var T = key.length();\n var T1 = effKeyBits;\n var T8 = Math.ceil(T1 / 8);\n var TM = 0xff >> (T1 & 0x07);\n var i;\n\n for(i = T; i < 128; i++) {\n L.putByte(piTable[(L.at(i - 1) + L.at(i - T)) & 0xff]);\n }\n\n L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]);\n\n for(i = 127 - T8; i >= 0; i--) {\n L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]);\n }\n\n return L;\n};\n\n/**\n * Creates a RC2 cipher object.\n *\n * @param key the symmetric key to use (as base for key generation).\n * @param bits the number of effective key bits.\n * @param encrypt false for decryption, true for encryption.\n *\n * @return the cipher.\n */\nvar createCipher = function(key, bits, encrypt) {\n var _finish = false, _input = null, _output = null, _iv = null;\n var mixRound, mashRound;\n var i, j, K = [];\n\n /* Expand key and fill into K[] Array */\n key = forge.rc2.expandKey(key, bits);\n for(i = 0; i < 64; i++) {\n K.push(key.getInt16Le());\n }\n\n if(encrypt) {\n /**\n * Perform one mixing round \"in place\".\n *\n * @param R Array of four words to perform mixing on.\n */\n mixRound = function(R) {\n for(i = 0; i < 4; i++) {\n R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) +\n ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);\n R[i] = rol(R[i], s[i]);\n j++;\n }\n };\n\n /**\n * Perform one mashing round \"in place\".\n *\n * @param R Array of four words to perform mashing on.\n */\n mashRound = function(R) {\n for(i = 0; i < 4; i++) {\n R[i] += K[R[(i + 3) % 4] & 63];\n }\n };\n } else {\n /**\n * Perform one r-mixing round \"in place\".\n *\n * @param R Array of four words to perform mixing on.\n */\n mixRound = function(R) {\n for(i = 3; i >= 0; i--) {\n R[i] = ror(R[i], s[i]);\n R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) +\n ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);\n j--;\n }\n };\n\n /**\n * Perform one r-mashing round \"in place\".\n *\n * @param R Array of four words to perform mashing on.\n */\n mashRound = function(R) {\n for(i = 3; i >= 0; i--) {\n R[i] -= K[R[(i + 3) % 4] & 63];\n }\n };\n }\n\n /**\n * Run the specified cipher execution plan.\n *\n * This function takes four words from the input buffer, applies the IV on\n * it (if requested) and runs the provided execution plan.\n *\n * The plan must be put together in form of a array of arrays. Where the\n * outer one is simply a list of steps to perform and the inner one needs\n * to have two elements: the first one telling how many rounds to perform,\n * the second one telling what to do (i.e. the function to call).\n *\n * @param {Array} plan The plan to execute.\n */\n var runPlan = function(plan) {\n var R = [];\n\n /* Get data from input buffer and fill the four words into R */\n for(i = 0; i < 4; i++) {\n var val = _input.getInt16Le();\n\n if(_iv !== null) {\n if(encrypt) {\n /* We're encrypting, apply the IV first. */\n val ^= _iv.getInt16Le();\n } else {\n /* We're decryption, keep cipher text for next block. */\n _iv.putInt16Le(val);\n }\n }\n\n R.push(val & 0xffff);\n }\n\n /* Reset global \"j\" variable as per spec. */\n j = encrypt ? 0 : 63;\n\n /* Run execution plan. */\n for(var ptr = 0; ptr < plan.length; ptr++) {\n for(var ctr = 0; ctr < plan[ptr][0]; ctr++) {\n plan[ptr][1](R);\n }\n }\n\n /* Write back result to output buffer. */\n for(i = 0; i < 4; i++) {\n if(_iv !== null) {\n if(encrypt) {\n /* We're encrypting in CBC-mode, feed back encrypted bytes into\n IV buffer to carry it forward to next block. */\n _iv.putInt16Le(R[i]);\n } else {\n R[i] ^= _iv.getInt16Le();\n }\n }\n\n _output.putInt16Le(R[i]);\n }\n };\n\n /* Create cipher object */\n var cipher = null;\n cipher = {\n /**\n * Starts or restarts the encryption or decryption process, whichever\n * was previously configured.\n *\n * To use the cipher in CBC mode, iv may be given either as a string\n * of bytes, or as a byte buffer. For ECB mode, give null as iv.\n *\n * @param iv the initialization vector to use, null for ECB mode.\n * @param output the output the buffer to write to, null to create one.\n */\n start: function(iv, output) {\n if(iv) {\n /* CBC mode */\n if(typeof iv === 'string') {\n iv = forge.util.createBuffer(iv);\n }\n }\n\n _finish = false;\n _input = forge.util.createBuffer();\n _output = output || new forge.util.createBuffer();\n _iv = iv;\n\n cipher.output = _output;\n },\n\n /**\n * Updates the next block.\n *\n * @param input the buffer to read from.\n */\n update: function(input) {\n if(!_finish) {\n // not finishing, so fill the input buffer with more input\n _input.putBuffer(input);\n }\n\n while(_input.length() >= 8) {\n runPlan([\n [ 5, mixRound ],\n [ 1, mashRound ],\n [ 6, mixRound ],\n [ 1, mashRound ],\n [ 5, mixRound ]\n ]);\n }\n },\n\n /**\n * Finishes encrypting or decrypting.\n *\n * @param pad a padding function to use, null for PKCS#7 padding,\n * signature(blockSize, buffer, decrypt).\n *\n * @return true if successful, false on error.\n */\n finish: function(pad) {\n var rval = true;\n\n if(encrypt) {\n if(pad) {\n rval = pad(8, _input, !encrypt);\n } else {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (_input.length() === 8) ? 8 : (8 - _input.length());\n _input.fillWithByte(padding, padding);\n }\n }\n\n if(rval) {\n // do final update\n _finish = true;\n cipher.update();\n }\n\n if(!encrypt) {\n // check for error: input data not a multiple of block size\n rval = (_input.length() === 0);\n if(rval) {\n if(pad) {\n rval = pad(8, _output, !encrypt);\n } else {\n // ensure padding byte count is valid\n var len = _output.length();\n var count = _output.at(len - 1);\n\n if(count > len) {\n rval = false;\n } else {\n // trim off padding bytes\n _output.truncate(count);\n }\n }\n }\n }\n\n return rval;\n }\n };\n\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the\n * given symmetric key. The output will be stored in the 'output' member\n * of the returned cipher.\n *\n * The key and iv may be given as a string of bytes or a byte buffer.\n * The cipher is initialized to use 128 effective key bits.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n *\n * @return the cipher.\n */\nforge.rc2.startEncrypting = function(key, iv, output) {\n var cipher = forge.rc2.createEncryptionCipher(key, 128);\n cipher.start(iv, output);\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the\n * given symmetric key.\n *\n * The key may be given as a string of bytes or a byte buffer.\n *\n * To start encrypting call start() on the cipher with an iv and optional\n * output buffer.\n *\n * @param key the symmetric key to use.\n *\n * @return the cipher.\n */\nforge.rc2.createEncryptionCipher = function(key, bits) {\n return createCipher(key, bits, true);\n};\n\n/**\n * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the\n * given symmetric key. The output will be stored in the 'output' member\n * of the returned cipher.\n *\n * The key and iv may be given as a string of bytes or a byte buffer.\n * The cipher is initialized to use 128 effective key bits.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n *\n * @return the cipher.\n */\nforge.rc2.startDecrypting = function(key, iv, output) {\n var cipher = forge.rc2.createDecryptionCipher(key, 128);\n cipher.start(iv, output);\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the\n * given symmetric key.\n *\n * The key may be given as a string of bytes or a byte buffer.\n *\n * To start decrypting call start() on the cipher with an iv and optional\n * output buffer.\n *\n * @param key the symmetric key to use.\n *\n * @return the cipher.\n */\nforge.rc2.createDecryptionCipher = function(key, bits) {\n return createCipher(key, bits, false);\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/rc2.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/rsa.js": +/*!********************************************!*\ + !*** ./node_modules/node-forge/lib/rsa.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Javascript implementation of basic RSA algorithms.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n *\n * The only algorithm currently supported for PKI is RSA.\n *\n * An RSA key is often stored in ASN.1 DER format. The SubjectPublicKeyInfo\n * ASN.1 structure is composed of an algorithm of type AlgorithmIdentifier\n * and a subjectPublicKey of type bit string.\n *\n * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters\n * for the algorithm, if any. In the case of RSA, there aren't any.\n *\n * SubjectPublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * subjectPublicKey BIT STRING\n * }\n *\n * AlgorithmIdentifer ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER,\n * parameters ANY DEFINED BY algorithm OPTIONAL\n * }\n *\n * For an RSA public key, the subjectPublicKey is:\n *\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n *\n * PrivateKeyInfo ::= SEQUENCE {\n * version Version,\n * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,\n * privateKey PrivateKey,\n * attributes [0] IMPLICIT Attributes OPTIONAL\n * }\n *\n * Version ::= INTEGER\n * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier\n * PrivateKey ::= OCTET STRING\n * Attributes ::= SET OF Attribute\n *\n * An RSA private key as the following structure:\n *\n * RSAPrivateKey ::= SEQUENCE {\n * version Version,\n * modulus INTEGER, -- n\n * publicExponent INTEGER, -- e\n * privateExponent INTEGER, -- d\n * prime1 INTEGER, -- p\n * prime2 INTEGER, -- q\n * exponent1 INTEGER, -- d mod (p-1)\n * exponent2 INTEGER, -- d mod (q-1)\n * coefficient INTEGER -- (inverse of q) mod p\n * }\n *\n * Version ::= INTEGER\n *\n * The OID for the RSA key algorithm is: 1.2.840.113549.1.1.1\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./asn1 */ \"./node_modules/node-forge/lib/asn1.js\");\n__webpack_require__(/*! ./jsbn */ \"./node_modules/node-forge/lib/jsbn.js\");\n__webpack_require__(/*! ./oids */ \"./node_modules/node-forge/lib/oids.js\");\n__webpack_require__(/*! ./pkcs1 */ \"./node_modules/node-forge/lib/pkcs1.js\");\n__webpack_require__(/*! ./prime */ \"./node_modules/node-forge/lib/prime.js\");\n__webpack_require__(/*! ./random */ \"./node_modules/node-forge/lib/random.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nif(typeof BigInteger === 'undefined') {\n var BigInteger = forge.jsbn.BigInteger;\n}\n\nvar _crypto = forge.util.isNodejs ? __webpack_require__(/*! crypto */ \"?b254\") : null;\n\n// shortcut for asn.1 API\nvar asn1 = forge.asn1;\n\n// shortcut for util API\nvar util = forge.util;\n\n/*\n * RSA encryption and decryption, see RFC 2313.\n */\nforge.pki = forge.pki || {};\nmodule.exports = forge.pki.rsa = forge.rsa = forge.rsa || {};\nvar pki = forge.pki;\n\n// for finding primes, which are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29\nvar GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2];\n\n// validator for a PrivateKeyInfo structure\nvar privateKeyValidator = {\n // PrivateKeyInfo\n name: 'PrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // Version (INTEGER)\n name: 'PrivateKeyInfo.version',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyVersion'\n }, {\n // privateKeyAlgorithm\n name: 'PrivateKeyInfo.privateKeyAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'privateKeyOid'\n }]\n }, {\n // PrivateKey\n name: 'PrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'privateKey'\n }]\n};\n\n// validator for an RSA private key\nvar rsaPrivateKeyValidator = {\n // RSAPrivateKey\n name: 'RSAPrivateKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // Version (INTEGER)\n name: 'RSAPrivateKey.version',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyVersion'\n }, {\n // modulus (n)\n name: 'RSAPrivateKey.modulus',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyModulus'\n }, {\n // publicExponent (e)\n name: 'RSAPrivateKey.publicExponent',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPublicExponent'\n }, {\n // privateExponent (d)\n name: 'RSAPrivateKey.privateExponent',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPrivateExponent'\n }, {\n // prime1 (p)\n name: 'RSAPrivateKey.prime1',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPrime1'\n }, {\n // prime2 (q)\n name: 'RSAPrivateKey.prime2',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyPrime2'\n }, {\n // exponent1 (d mod (p-1))\n name: 'RSAPrivateKey.exponent1',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyExponent1'\n }, {\n // exponent2 (d mod (q-1))\n name: 'RSAPrivateKey.exponent2',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyExponent2'\n }, {\n // coefficient ((inverse of q) mod p)\n name: 'RSAPrivateKey.coefficient',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'privateKeyCoefficient'\n }]\n};\n\n// validator for an RSA public key\nvar rsaPublicKeyValidator = {\n // RSAPublicKey\n name: 'RSAPublicKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // modulus (n)\n name: 'RSAPublicKey.modulus',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'publicKeyModulus'\n }, {\n // publicExponent (e)\n name: 'RSAPublicKey.exponent',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'publicKeyExponent'\n }]\n};\n\n// validator for an SubjectPublicKeyInfo structure\n// Note: Currently only works with an RSA public key\nvar publicKeyValidator = forge.pki.rsa.publicKeyValidator = {\n name: 'SubjectPublicKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'subjectPublicKeyInfo',\n value: [{\n name: 'SubjectPublicKeyInfo.AlgorithmIdentifier',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'publicKeyOid'\n }]\n }, {\n // subjectPublicKey\n name: 'SubjectPublicKeyInfo.subjectPublicKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.BITSTRING,\n constructed: false,\n value: [{\n // RSAPublicKey\n name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n optional: true,\n captureAsn1: 'rsaPublicKey'\n }]\n }]\n};\n\n// validator for a DigestInfo structure\nvar digestInfoValidator = {\n name: 'DigestInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'DigestInfo.DigestAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'DigestInfo.DigestAlgorithm.algorithmIdentifier',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'algorithmIdentifier'\n }, {\n // NULL paramters\n name: 'DigestInfo.DigestAlgorithm.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.NULL,\n // captured only to check existence for md2 and md5\n capture: 'parameters',\n optional: true,\n constructed: false\n }]\n }, {\n // digest\n name: 'DigestInfo.digest',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'digest'\n }]\n};\n\n/**\n * Wrap digest in DigestInfo object.\n *\n * This function implements EMSA-PKCS1-v1_5-ENCODE as per RFC 3447.\n *\n * DigestInfo ::= SEQUENCE {\n * digestAlgorithm DigestAlgorithmIdentifier,\n * digest Digest\n * }\n *\n * DigestAlgorithmIdentifier ::= AlgorithmIdentifier\n * Digest ::= OCTET STRING\n *\n * @param md the message digest object with the hash to sign.\n *\n * @return the encoded message (ready for RSA encrytion)\n */\nvar emsaPkcs1v15encode = function(md) {\n // get the oid for the algorithm\n var oid;\n if(md.algorithm in pki.oids) {\n oid = pki.oids[md.algorithm];\n } else {\n var error = new Error('Unknown message digest algorithm.');\n error.algorithm = md.algorithm;\n throw error;\n }\n var oidBytes = asn1.oidToDer(oid).getBytes();\n\n // create the digest info\n var digestInfo = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n var digestAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n digestAlgorithm.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OID, false, oidBytes));\n digestAlgorithm.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.NULL, false, ''));\n var digest = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING,\n false, md.digest().getBytes());\n digestInfo.value.push(digestAlgorithm);\n digestInfo.value.push(digest);\n\n // encode digest info\n return asn1.toDer(digestInfo).getBytes();\n};\n\n/**\n * Performs x^c mod n (RSA encryption or decryption operation).\n *\n * @param x the number to raise and mod.\n * @param key the key to use.\n * @param pub true if the key is public, false if private.\n *\n * @return the result of x^c mod n.\n */\nvar _modPow = function(x, key, pub) {\n if(pub) {\n return x.modPow(key.e, key.n);\n }\n\n if(!key.p || !key.q) {\n // allow calculation without CRT params (slow)\n return x.modPow(key.d, key.n);\n }\n\n // pre-compute dP, dQ, and qInv if necessary\n if(!key.dP) {\n key.dP = key.d.mod(key.p.subtract(BigInteger.ONE));\n }\n if(!key.dQ) {\n key.dQ = key.d.mod(key.q.subtract(BigInteger.ONE));\n }\n if(!key.qInv) {\n key.qInv = key.q.modInverse(key.p);\n }\n\n /* Chinese remainder theorem (CRT) states:\n\n Suppose n1, n2, ..., nk are positive integers which are pairwise\n coprime (n1 and n2 have no common factors other than 1). For any\n integers x1, x2, ..., xk there exists an integer x solving the\n system of simultaneous congruences (where ~= means modularly\n congruent so a ~= b mod n means a mod n = b mod n):\n\n x ~= x1 mod n1\n x ~= x2 mod n2\n ...\n x ~= xk mod nk\n\n This system of congruences has a single simultaneous solution x\n between 0 and n - 1. Furthermore, each xk solution and x itself\n is congruent modulo the product n = n1*n2*...*nk.\n So x1 mod n = x2 mod n = xk mod n = x mod n.\n\n The single simultaneous solution x can be solved with the following\n equation:\n\n x = sum(xi*ri*si) mod n where ri = n/ni and si = ri^-1 mod ni.\n\n Where x is less than n, xi = x mod ni.\n\n For RSA we are only concerned with k = 2. The modulus n = pq, where\n p and q are coprime. The RSA decryption algorithm is:\n\n y = x^d mod n\n\n Given the above:\n\n x1 = x^d mod p\n r1 = n/p = q\n s1 = q^-1 mod p\n x2 = x^d mod q\n r2 = n/q = p\n s2 = p^-1 mod q\n\n So y = (x1r1s1 + x2r2s2) mod n\n = ((x^d mod p)q(q^-1 mod p) + (x^d mod q)p(p^-1 mod q)) mod n\n\n According to Fermat's Little Theorem, if the modulus P is prime,\n for any integer A not evenly divisible by P, A^(P-1) ~= 1 mod P.\n Since A is not divisible by P it follows that if:\n N ~= M mod (P - 1), then A^N mod P = A^M mod P. Therefore:\n\n A^N mod P = A^(M mod (P - 1)) mod P. (The latter takes less effort\n to calculate). In order to calculate x^d mod p more quickly the\n exponent d mod (p - 1) is stored in the RSA private key (the same\n is done for x^d mod q). These values are referred to as dP and dQ\n respectively. Therefore we now have:\n\n y = ((x^dP mod p)q(q^-1 mod p) + (x^dQ mod q)p(p^-1 mod q)) mod n\n\n Since we'll be reducing x^dP by modulo p (same for q) we can also\n reduce x by p (and q respectively) before hand. Therefore, let\n\n xp = ((x mod p)^dP mod p), and\n xq = ((x mod q)^dQ mod q), yielding:\n\n y = (xp*q*(q^-1 mod p) + xq*p*(p^-1 mod q)) mod n\n\n This can be further reduced to a simple algorithm that only\n requires 1 inverse (the q inverse is used) to be used and stored.\n The algorithm is called Garner's algorithm. If qInv is the\n inverse of q, we simply calculate:\n\n y = (qInv*(xp - xq) mod p) * q + xq\n\n However, there are two further complications. First, we need to\n ensure that xp > xq to prevent signed BigIntegers from being used\n so we add p until this is true (since we will be mod'ing with\n p anyway). Then, there is a known timing attack on algorithms\n using the CRT. To mitigate this risk, \"cryptographic blinding\"\n should be used. This requires simply generating a random number r\n between 0 and n-1 and its inverse and multiplying x by r^e before\n calculating y and then multiplying y by r^-1 afterwards. Note that\n r must be coprime with n (gcd(r, n) === 1) in order to have an\n inverse.\n */\n\n // cryptographic blinding\n var r;\n do {\n r = new BigInteger(\n forge.util.bytesToHex(forge.random.getBytes(key.n.bitLength() / 8)),\n 16);\n } while(r.compareTo(key.n) >= 0 || !r.gcd(key.n).equals(BigInteger.ONE));\n x = x.multiply(r.modPow(key.e, key.n)).mod(key.n);\n\n // calculate xp and xq\n var xp = x.mod(key.p).modPow(key.dP, key.p);\n var xq = x.mod(key.q).modPow(key.dQ, key.q);\n\n // xp must be larger than xq to avoid signed bit usage\n while(xp.compareTo(xq) < 0) {\n xp = xp.add(key.p);\n }\n\n // do last step\n var y = xp.subtract(xq)\n .multiply(key.qInv).mod(key.p)\n .multiply(key.q).add(xq);\n\n // remove effect of random for cryptographic blinding\n y = y.multiply(r.modInverse(key.n)).mod(key.n);\n\n return y;\n};\n\n/**\n * NOTE: THIS METHOD IS DEPRECATED, use 'sign' on a private key object or\n * 'encrypt' on a public key object instead.\n *\n * Performs RSA encryption.\n *\n * The parameter bt controls whether to put padding bytes before the\n * message passed in. Set bt to either true or false to disable padding\n * completely (in order to handle e.g. EMSA-PSS encoding seperately before),\n * signaling whether the encryption operation is a public key operation\n * (i.e. encrypting data) or not, i.e. private key operation (data signing).\n *\n * For PKCS#1 v1.5 padding pass in the block type to use, i.e. either 0x01\n * (for signing) or 0x02 (for encryption). The key operation mode (private\n * or public) is derived from this flag in that case).\n *\n * @param m the message to encrypt as a byte string.\n * @param key the RSA key to use.\n * @param bt for PKCS#1 v1.5 padding, the block type to use\n * (0x01 for private key, 0x02 for public),\n * to disable padding: true = public key, false = private key.\n *\n * @return the encrypted bytes as a string.\n */\npki.rsa.encrypt = function(m, key, bt) {\n var pub = bt;\n var eb;\n\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n if(bt !== false && bt !== true) {\n // legacy, default to PKCS#1 v1.5 padding\n pub = (bt === 0x02);\n eb = _encodePkcs1_v1_5(m, key, bt);\n } else {\n eb = forge.util.createBuffer();\n eb.putBytes(m);\n }\n\n // load encryption block as big integer 'x'\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var x = new BigInteger(eb.toHex(), 16);\n\n // do RSA encryption\n var y = _modPow(x, key, pub);\n\n // convert y into the encrypted data byte string, if y is shorter in\n // bytes than k, then prepend zero bytes to fill up ed\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var yhex = y.toString(16);\n var ed = forge.util.createBuffer();\n var zeros = k - Math.ceil(yhex.length / 2);\n while(zeros > 0) {\n ed.putByte(0x00);\n --zeros;\n }\n ed.putBytes(forge.util.hexToBytes(yhex));\n return ed.getBytes();\n};\n\n/**\n * NOTE: THIS METHOD IS DEPRECATED, use 'decrypt' on a private key object or\n * 'verify' on a public key object instead.\n *\n * Performs RSA decryption.\n *\n * The parameter ml controls whether to apply PKCS#1 v1.5 padding\n * or not. Set ml = false to disable padding removal completely\n * (in order to handle e.g. EMSA-PSS later on) and simply pass back\n * the RSA encryption block.\n *\n * @param ed the encrypted data to decrypt in as a byte string.\n * @param key the RSA key to use.\n * @param pub true for a public key operation, false for private.\n * @param ml the message length, if known, false to disable padding.\n *\n * @return the decrypted message as a byte string.\n */\npki.rsa.decrypt = function(ed, key, pub, ml) {\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n // error if the length of the encrypted data ED is not k\n if(ed.length !== k) {\n var error = new Error('Encrypted message length is invalid.');\n error.length = ed.length;\n error.expected = k;\n throw error;\n }\n\n // convert encrypted data into a big integer\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var y = new BigInteger(forge.util.createBuffer(ed).toHex(), 16);\n\n // y must be less than the modulus or it wasn't the result of\n // a previous mod operation (encryption) using that modulus\n if(y.compareTo(key.n) >= 0) {\n throw new Error('Encrypted message is invalid.');\n }\n\n // do RSA decryption\n var x = _modPow(y, key, pub);\n\n // create the encryption block, if x is shorter in bytes than k, then\n // prepend zero bytes to fill up eb\n // FIXME: hex conversion inefficient, get BigInteger w/byte strings\n var xhex = x.toString(16);\n var eb = forge.util.createBuffer();\n var zeros = k - Math.ceil(xhex.length / 2);\n while(zeros > 0) {\n eb.putByte(0x00);\n --zeros;\n }\n eb.putBytes(forge.util.hexToBytes(xhex));\n\n if(ml !== false) {\n // legacy, default to PKCS#1 v1.5 padding\n return _decodePkcs1_v1_5(eb.getBytes(), key, pub);\n }\n\n // return message\n return eb.getBytes();\n};\n\n/**\n * Creates an RSA key-pair generation state object. It is used to allow\n * key-generation to be performed in steps. It also allows for a UI to\n * display progress updates.\n *\n * @param bits the size for the private key in bits, defaults to 2048.\n * @param e the public exponent to use, defaults to 65537 (0x10001).\n * @param [options] the options to use.\n * prng a custom crypto-secure pseudo-random number generator to use,\n * that must define \"getBytesSync\".\n * algorithm the algorithm to use (default: 'PRIMEINC').\n *\n * @return the state object to use to generate the key-pair.\n */\npki.rsa.createKeyPairGenerationState = function(bits, e, options) {\n // TODO: migrate step-based prime generation code to forge.prime\n\n // set default bits\n if(typeof(bits) === 'string') {\n bits = parseInt(bits, 10);\n }\n bits = bits || 2048;\n\n // create prng with api that matches BigInteger secure random\n options = options || {};\n var prng = options.prng || forge.random;\n var rng = {\n // x is an array to fill with bytes\n nextBytes: function(x) {\n var b = prng.getBytesSync(x.length);\n for(var i = 0; i < x.length; ++i) {\n x[i] = b.charCodeAt(i);\n }\n }\n };\n\n var algorithm = options.algorithm || 'PRIMEINC';\n\n // create PRIMEINC algorithm state\n var rval;\n if(algorithm === 'PRIMEINC') {\n rval = {\n algorithm: algorithm,\n state: 0,\n bits: bits,\n rng: rng,\n eInt: e || 65537,\n e: new BigInteger(null),\n p: null,\n q: null,\n qBits: bits >> 1,\n pBits: bits - (bits >> 1),\n pqState: 0,\n num: null,\n keys: null\n };\n rval.e.fromInt(rval.eInt);\n } else {\n throw new Error('Invalid key generation algorithm: ' + algorithm);\n }\n\n return rval;\n};\n\n/**\n * Attempts to runs the key-generation algorithm for at most n seconds\n * (approximately) using the given state. When key-generation has completed,\n * the keys will be stored in state.keys.\n *\n * To use this function to update a UI while generating a key or to prevent\n * causing browser lockups/warnings, set \"n\" to a value other than 0. A\n * simple pattern for generating a key and showing a progress indicator is:\n *\n * var state = pki.rsa.createKeyPairGenerationState(2048);\n * var step = function() {\n * // step key-generation, run algorithm for 100 ms, repeat\n * if(!forge.pki.rsa.stepKeyPairGenerationState(state, 100)) {\n * setTimeout(step, 1);\n * } else {\n * // key-generation complete\n * // TODO: turn off progress indicator here\n * // TODO: use the generated key-pair in \"state.keys\"\n * }\n * };\n * // TODO: turn on progress indicator here\n * setTimeout(step, 0);\n *\n * @param state the state to use.\n * @param n the maximum number of milliseconds to run the algorithm for, 0\n * to run the algorithm to completion.\n *\n * @return true if the key-generation completed, false if not.\n */\npki.rsa.stepKeyPairGenerationState = function(state, n) {\n // set default algorithm if not set\n if(!('algorithm' in state)) {\n state.algorithm = 'PRIMEINC';\n }\n\n // TODO: migrate step-based prime generation code to forge.prime\n // TODO: abstract as PRIMEINC algorithm\n\n // do key generation (based on Tom Wu's rsa.js, see jsbn.js license)\n // with some minor optimizations and designed to run in steps\n\n // local state vars\n var THIRTY = new BigInteger(null);\n THIRTY.fromInt(30);\n var deltaIdx = 0;\n var op_or = function(x, y) {return x | y;};\n\n // keep stepping until time limit is reached or done\n var t1 = +new Date();\n var t2;\n var total = 0;\n while(state.keys === null && (n <= 0 || total < n)) {\n // generate p or q\n if(state.state === 0) {\n /* Note: All primes are of the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1, where there are 8 values for i\n\n When we generate a random number, we always align it at 30k + 1. Each\n time the number is determined not to be prime we add to get to the\n next 'i', eg: if the number was at 30k + 1 we add 6. */\n var bits = (state.p === null) ? state.pBits : state.qBits;\n var bits1 = bits - 1;\n\n // get a random number\n if(state.pqState === 0) {\n state.num = new BigInteger(bits, state.rng);\n // force MSB set\n if(!state.num.testBit(bits1)) {\n state.num.bitwiseTo(\n BigInteger.ONE.shiftLeft(bits1), op_or, state.num);\n }\n // align number on 30k+1 boundary\n state.num.dAddOffset(31 - state.num.mod(THIRTY).byteValue(), 0);\n deltaIdx = 0;\n\n ++state.pqState;\n } else if(state.pqState === 1) {\n // try to make the number a prime\n if(state.num.bitLength() > bits) {\n // overflow, try again\n state.pqState = 0;\n // do primality test\n } else if(state.num.isProbablePrime(\n _getMillerRabinTests(state.num.bitLength()))) {\n ++state.pqState;\n } else {\n // get next potential prime\n state.num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0);\n }\n } else if(state.pqState === 2) {\n // ensure number is coprime with e\n state.pqState =\n (state.num.subtract(BigInteger.ONE).gcd(state.e)\n .compareTo(BigInteger.ONE) === 0) ? 3 : 0;\n } else if(state.pqState === 3) {\n // store p or q\n state.pqState = 0;\n if(state.p === null) {\n state.p = state.num;\n } else {\n state.q = state.num;\n }\n\n // advance state if both p and q are ready\n if(state.p !== null && state.q !== null) {\n ++state.state;\n }\n state.num = null;\n }\n } else if(state.state === 1) {\n // ensure p is larger than q (swap them if not)\n if(state.p.compareTo(state.q) < 0) {\n state.num = state.p;\n state.p = state.q;\n state.q = state.num;\n }\n ++state.state;\n } else if(state.state === 2) {\n // compute phi: (p - 1)(q - 1) (Euler's totient function)\n state.p1 = state.p.subtract(BigInteger.ONE);\n state.q1 = state.q.subtract(BigInteger.ONE);\n state.phi = state.p1.multiply(state.q1);\n ++state.state;\n } else if(state.state === 3) {\n // ensure e and phi are coprime\n if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) === 0) {\n // phi and e are coprime, advance\n ++state.state;\n } else {\n // phi and e aren't coprime, so generate a new p and q\n state.p = null;\n state.q = null;\n state.state = 0;\n }\n } else if(state.state === 4) {\n // create n, ensure n is has the right number of bits\n state.n = state.p.multiply(state.q);\n\n // ensure n is right number of bits\n if(state.n.bitLength() === state.bits) {\n // success, advance\n ++state.state;\n } else {\n // failed, get new q\n state.q = null;\n state.state = 0;\n }\n } else if(state.state === 5) {\n // set keys\n var d = state.e.modInverse(state.phi);\n state.keys = {\n privateKey: pki.rsa.setPrivateKey(\n state.n, state.e, d, state.p, state.q,\n d.mod(state.p1), d.mod(state.q1),\n state.q.modInverse(state.p)),\n publicKey: pki.rsa.setPublicKey(state.n, state.e)\n };\n }\n\n // update timing\n t2 = +new Date();\n total += t2 - t1;\n t1 = t2;\n }\n\n return state.keys !== null;\n};\n\n/**\n * Generates an RSA public-private key pair in a single call.\n *\n * To generate a key-pair in steps (to allow for progress updates and to\n * prevent blocking or warnings in slow browsers) then use the key-pair\n * generation state functions.\n *\n * To generate a key-pair asynchronously (either through web-workers, if\n * available, or by breaking up the work on the main thread), pass a\n * callback function.\n *\n * @param [bits] the size for the private key in bits, defaults to 2048.\n * @param [e] the public exponent to use, defaults to 65537.\n * @param [options] options for key-pair generation, if given then 'bits'\n * and 'e' must *not* be given:\n * bits the size for the private key in bits, (default: 2048).\n * e the public exponent to use, (default: 65537 (0x10001)).\n * workerScript the worker script URL.\n * workers the number of web workers (if supported) to use,\n * (default: 2).\n * workLoad the size of the work load, ie: number of possible prime\n * numbers for each web worker to check per work assignment,\n * (default: 100).\n * prng a custom crypto-secure pseudo-random number generator to use,\n * that must define \"getBytesSync\". Disables use of native APIs.\n * algorithm the algorithm to use (default: 'PRIMEINC').\n * @param [callback(err, keypair)] called once the operation completes.\n *\n * @return an object with privateKey and publicKey properties.\n */\npki.rsa.generateKeyPair = function(bits, e, options, callback) {\n // (bits), (options), (callback)\n if(arguments.length === 1) {\n if(typeof bits === 'object') {\n options = bits;\n bits = undefined;\n } else if(typeof bits === 'function') {\n callback = bits;\n bits = undefined;\n }\n } else if(arguments.length === 2) {\n // (bits, e), (bits, options), (bits, callback), (options, callback)\n if(typeof bits === 'number') {\n if(typeof e === 'function') {\n callback = e;\n e = undefined;\n } else if(typeof e !== 'number') {\n options = e;\n e = undefined;\n }\n } else {\n options = bits;\n callback = e;\n bits = undefined;\n e = undefined;\n }\n } else if(arguments.length === 3) {\n // (bits, e, options), (bits, e, callback), (bits, options, callback)\n if(typeof e === 'number') {\n if(typeof options === 'function') {\n callback = options;\n options = undefined;\n }\n } else {\n callback = options;\n options = e;\n e = undefined;\n }\n }\n options = options || {};\n if(bits === undefined) {\n bits = options.bits || 2048;\n }\n if(e === undefined) {\n e = options.e || 0x10001;\n }\n\n // use native code if permitted, available, and parameters are acceptable\n if(!forge.options.usePureJavaScript && !options.prng &&\n bits >= 256 && bits <= 16384 && (e === 0x10001 || e === 3)) {\n if(callback) {\n // try native async\n if(_detectNodeCrypto('generateKeyPair')) {\n return _crypto.generateKeyPair('rsa', {\n modulusLength: bits,\n publicExponent: e,\n publicKeyEncoding: {\n type: 'spki',\n format: 'pem'\n },\n privateKeyEncoding: {\n type: 'pkcs8',\n format: 'pem'\n }\n }, function(err, pub, priv) {\n if(err) {\n return callback(err);\n }\n callback(null, {\n privateKey: pki.privateKeyFromPem(priv),\n publicKey: pki.publicKeyFromPem(pub)\n });\n });\n }\n if(_detectSubtleCrypto('generateKey') &&\n _detectSubtleCrypto('exportKey')) {\n // use standard native generateKey\n return util.globalScope.crypto.subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: _intToUint8Array(e),\n hash: {name: 'SHA-256'}\n }, true /* key can be exported*/, ['sign', 'verify'])\n .then(function(pair) {\n return util.globalScope.crypto.subtle.exportKey(\n 'pkcs8', pair.privateKey);\n // avoiding catch(function(err) {...}) to support IE <= 8\n }).then(undefined, function(err) {\n callback(err);\n }).then(function(pkcs8) {\n if(pkcs8) {\n var privateKey = pki.privateKeyFromAsn1(\n asn1.fromDer(forge.util.createBuffer(pkcs8)));\n callback(null, {\n privateKey: privateKey,\n publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e)\n });\n }\n });\n }\n if(_detectSubtleMsCrypto('generateKey') &&\n _detectSubtleMsCrypto('exportKey')) {\n var genOp = util.globalScope.msCrypto.subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: _intToUint8Array(e),\n hash: {name: 'SHA-256'}\n }, true /* key can be exported*/, ['sign', 'verify']);\n genOp.oncomplete = function(e) {\n var pair = e.target.result;\n var exportOp = util.globalScope.msCrypto.subtle.exportKey(\n 'pkcs8', pair.privateKey);\n exportOp.oncomplete = function(e) {\n var pkcs8 = e.target.result;\n var privateKey = pki.privateKeyFromAsn1(\n asn1.fromDer(forge.util.createBuffer(pkcs8)));\n callback(null, {\n privateKey: privateKey,\n publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e)\n });\n };\n exportOp.onerror = function(err) {\n callback(err);\n };\n };\n genOp.onerror = function(err) {\n callback(err);\n };\n return;\n }\n } else {\n // try native sync\n if(_detectNodeCrypto('generateKeyPairSync')) {\n var keypair = _crypto.generateKeyPairSync('rsa', {\n modulusLength: bits,\n publicExponent: e,\n publicKeyEncoding: {\n type: 'spki',\n format: 'pem'\n },\n privateKeyEncoding: {\n type: 'pkcs8',\n format: 'pem'\n }\n });\n return {\n privateKey: pki.privateKeyFromPem(keypair.privateKey),\n publicKey: pki.publicKeyFromPem(keypair.publicKey)\n };\n }\n }\n }\n\n // use JavaScript implementation\n var state = pki.rsa.createKeyPairGenerationState(bits, e, options);\n if(!callback) {\n pki.rsa.stepKeyPairGenerationState(state, 0);\n return state.keys;\n }\n _generateKeyPair(state, options, callback);\n};\n\n/**\n * Sets an RSA public key from BigIntegers modulus and exponent.\n *\n * @param n the modulus.\n * @param e the exponent.\n *\n * @return the public key.\n */\npki.setRsaPublicKey = pki.rsa.setPublicKey = function(n, e) {\n var key = {\n n: n,\n e: e\n };\n\n /**\n * Encrypts the given data with this public key. Newer applications\n * should use the 'RSA-OAEP' decryption scheme, 'RSAES-PKCS1-V1_5' is for\n * legacy applications.\n *\n * @param data the byte string to encrypt.\n * @param scheme the encryption scheme to use:\n * 'RSAES-PKCS1-V1_5' (default),\n * 'RSA-OAEP',\n * 'RAW', 'NONE', or null to perform raw RSA encryption,\n * an object with an 'encode' property set to a function\n * with the signature 'function(data, key)' that returns\n * a binary-encoded string representing the encoded data.\n * @param schemeOptions any scheme-specific options.\n *\n * @return the encrypted byte string.\n */\n key.encrypt = function(data, scheme, schemeOptions) {\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n } else if(scheme === undefined) {\n scheme = 'RSAES-PKCS1-V1_5';\n }\n\n if(scheme === 'RSAES-PKCS1-V1_5') {\n scheme = {\n encode: function(m, key, pub) {\n return _encodePkcs1_v1_5(m, key, 0x02).getBytes();\n }\n };\n } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') {\n scheme = {\n encode: function(m, key) {\n return forge.pkcs1.encode_rsa_oaep(key, m, schemeOptions);\n }\n };\n } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) {\n scheme = {encode: function(e) {return e;}};\n } else if(typeof scheme === 'string') {\n throw new Error('Unsupported encryption scheme: \"' + scheme + '\".');\n }\n\n // do scheme-based encoding then rsa encryption\n var e = scheme.encode(data, key, true);\n return pki.rsa.encrypt(e, key, true);\n };\n\n /**\n * Verifies the given signature against the given digest.\n *\n * PKCS#1 supports multiple (currently two) signature schemes:\n * RSASSA-PKCS1-V1_5 and RSASSA-PSS.\n *\n * By default this implementation uses the \"old scheme\", i.e.\n * RSASSA-PKCS1-V1_5, in which case once RSA-decrypted, the\n * signature is an OCTET STRING that holds a DigestInfo.\n *\n * DigestInfo ::= SEQUENCE {\n * digestAlgorithm DigestAlgorithmIdentifier,\n * digest Digest\n * }\n * DigestAlgorithmIdentifier ::= AlgorithmIdentifier\n * Digest ::= OCTET STRING\n *\n * To perform PSS signature verification, provide an instance\n * of Forge PSS object as the scheme parameter.\n *\n * @param digest the message digest hash to compare against the signature,\n * as a binary-encoded string.\n * @param signature the signature to verify, as a binary-encoded string.\n * @param scheme signature verification scheme to use:\n * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5,\n * a Forge PSS object for RSASSA-PSS,\n * 'NONE' or null for none, DigestInfo will not be expected, but\n * PKCS#1 v1.5 padding will still be used.\n * @param options optional verify options\n * _parseAllDigestBytes testing flag to control parsing of all\n * digest bytes. Unsupported and not for general usage.\n * (default: true)\n *\n * @return true if the signature was verified, false if not.\n */\n key.verify = function(digest, signature, scheme, options) {\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n } else if(scheme === undefined) {\n scheme = 'RSASSA-PKCS1-V1_5';\n }\n if(options === undefined) {\n options = {\n _parseAllDigestBytes: true\n };\n }\n if(!('_parseAllDigestBytes' in options)) {\n options._parseAllDigestBytes = true;\n }\n\n if(scheme === 'RSASSA-PKCS1-V1_5') {\n scheme = {\n verify: function(digest, d) {\n // remove padding\n d = _decodePkcs1_v1_5(d, key, true);\n // d is ASN.1 BER-encoded DigestInfo\n var obj = asn1.fromDer(d, {\n parseAllBytes: options._parseAllDigestBytes\n });\n\n // validate DigestInfo\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, digestInfoValidator, capture, errors)) {\n var error = new Error(\n 'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' +\n 'DigestInfo value.');\n error.errors = errors;\n throw error;\n }\n // check hash algorithm identifier\n // see PKCS1-v1-5DigestAlgorithms in RFC 8017\n // FIXME: add support to vaidator for strict value choices\n var oid = asn1.derToOid(capture.algorithmIdentifier);\n if(!(oid === forge.oids.md2 ||\n oid === forge.oids.md5 ||\n oid === forge.oids.sha1 ||\n oid === forge.oids.sha224 ||\n oid === forge.oids.sha256 ||\n oid === forge.oids.sha384 ||\n oid === forge.oids.sha512 ||\n oid === forge.oids['sha512-224'] ||\n oid === forge.oids['sha512-256'])) {\n var error = new Error(\n 'Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.');\n error.oid = oid;\n throw error;\n }\n\n // special check for md2 and md5 that NULL parameters exist\n if(oid === forge.oids.md2 || oid === forge.oids.md5) {\n if(!('parameters' in capture)) {\n throw new Error(\n 'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' +\n 'DigestInfo value. ' +\n 'Missing algorithm identifer NULL parameters.');\n }\n }\n\n // compare the given digest to the decrypted one\n return digest === capture.digest;\n }\n };\n } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) {\n scheme = {\n verify: function(digest, d) {\n // remove padding\n d = _decodePkcs1_v1_5(d, key, true);\n return digest === d;\n }\n };\n }\n\n // do rsa decryption w/o any decoding, then verify -- which does decoding\n var d = pki.rsa.decrypt(signature, key, true, false);\n return scheme.verify(digest, d, key.n.bitLength());\n };\n\n return key;\n};\n\n/**\n * Sets an RSA private key from BigIntegers modulus, exponent, primes,\n * prime exponents, and modular multiplicative inverse.\n *\n * @param n the modulus.\n * @param e the public exponent.\n * @param d the private exponent ((inverse of e) mod n).\n * @param p the first prime.\n * @param q the second prime.\n * @param dP exponent1 (d mod (p-1)).\n * @param dQ exponent2 (d mod (q-1)).\n * @param qInv ((inverse of q) mod p)\n *\n * @return the private key.\n */\npki.setRsaPrivateKey = pki.rsa.setPrivateKey = function(\n n, e, d, p, q, dP, dQ, qInv) {\n var key = {\n n: n,\n e: e,\n d: d,\n p: p,\n q: q,\n dP: dP,\n dQ: dQ,\n qInv: qInv\n };\n\n /**\n * Decrypts the given data with this private key. The decryption scheme\n * must match the one used to encrypt the data.\n *\n * @param data the byte string to decrypt.\n * @param scheme the decryption scheme to use:\n * 'RSAES-PKCS1-V1_5' (default),\n * 'RSA-OAEP',\n * 'RAW', 'NONE', or null to perform raw RSA decryption.\n * @param schemeOptions any scheme-specific options.\n *\n * @return the decrypted byte string.\n */\n key.decrypt = function(data, scheme, schemeOptions) {\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n } else if(scheme === undefined) {\n scheme = 'RSAES-PKCS1-V1_5';\n }\n\n // do rsa decryption w/o any decoding\n var d = pki.rsa.decrypt(data, key, false, false);\n\n if(scheme === 'RSAES-PKCS1-V1_5') {\n scheme = {decode: _decodePkcs1_v1_5};\n } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') {\n scheme = {\n decode: function(d, key) {\n return forge.pkcs1.decode_rsa_oaep(key, d, schemeOptions);\n }\n };\n } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) {\n scheme = {decode: function(d) {return d;}};\n } else {\n throw new Error('Unsupported encryption scheme: \"' + scheme + '\".');\n }\n\n // decode according to scheme\n return scheme.decode(d, key, false);\n };\n\n /**\n * Signs the given digest, producing a signature.\n *\n * PKCS#1 supports multiple (currently two) signature schemes:\n * RSASSA-PKCS1-V1_5 and RSASSA-PSS.\n *\n * By default this implementation uses the \"old scheme\", i.e.\n * RSASSA-PKCS1-V1_5. In order to generate a PSS signature, provide\n * an instance of Forge PSS object as the scheme parameter.\n *\n * @param md the message digest object with the hash to sign.\n * @param scheme the signature scheme to use:\n * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5,\n * a Forge PSS object for RSASSA-PSS,\n * 'NONE' or null for none, DigestInfo will not be used but\n * PKCS#1 v1.5 padding will still be used.\n *\n * @return the signature as a byte string.\n */\n key.sign = function(md, scheme) {\n /* Note: The internal implementation of RSA operations is being\n transitioned away from a PKCS#1 v1.5 hard-coded scheme. Some legacy\n code like the use of an encoding block identifier 'bt' will eventually\n be removed. */\n\n // private key operation\n var bt = false;\n\n if(typeof scheme === 'string') {\n scheme = scheme.toUpperCase();\n }\n\n if(scheme === undefined || scheme === 'RSASSA-PKCS1-V1_5') {\n scheme = {encode: emsaPkcs1v15encode};\n bt = 0x01;\n } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) {\n scheme = {encode: function() {return md;}};\n bt = 0x01;\n }\n\n // encode and then encrypt\n var d = scheme.encode(md, key.n.bitLength());\n return pki.rsa.encrypt(d, key, bt);\n };\n\n return key;\n};\n\n/**\n * Wraps an RSAPrivateKey ASN.1 object in an ASN.1 PrivateKeyInfo object.\n *\n * @param rsaKey the ASN.1 RSAPrivateKey.\n *\n * @return the ASN.1 PrivateKeyInfo.\n */\npki.wrapRsaPrivateKey = function(rsaKey) {\n // PrivateKeyInfo\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // version (0)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(0).getBytes()),\n // privateKeyAlgorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids.rsaEncryption).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]),\n // PrivateKey\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false,\n asn1.toDer(rsaKey).getBytes())\n ]);\n};\n\n/**\n * Converts a private key from an ASN.1 object.\n *\n * @param obj the ASN.1 representation of a PrivateKeyInfo containing an\n * RSAPrivateKey or an RSAPrivateKey.\n *\n * @return the private key.\n */\npki.privateKeyFromAsn1 = function(obj) {\n // get PrivateKeyInfo\n var capture = {};\n var errors = [];\n if(asn1.validate(obj, privateKeyValidator, capture, errors)) {\n obj = asn1.fromDer(forge.util.createBuffer(capture.privateKey));\n }\n\n // get RSAPrivateKey\n capture = {};\n errors = [];\n if(!asn1.validate(obj, rsaPrivateKeyValidator, capture, errors)) {\n var error = new Error('Cannot read private key. ' +\n 'ASN.1 object does not contain an RSAPrivateKey.');\n error.errors = errors;\n throw error;\n }\n\n // Note: Version is currently ignored.\n // capture.privateKeyVersion\n // FIXME: inefficient, get a BigInteger that uses byte strings\n var n, e, d, p, q, dP, dQ, qInv;\n n = forge.util.createBuffer(capture.privateKeyModulus).toHex();\n e = forge.util.createBuffer(capture.privateKeyPublicExponent).toHex();\n d = forge.util.createBuffer(capture.privateKeyPrivateExponent).toHex();\n p = forge.util.createBuffer(capture.privateKeyPrime1).toHex();\n q = forge.util.createBuffer(capture.privateKeyPrime2).toHex();\n dP = forge.util.createBuffer(capture.privateKeyExponent1).toHex();\n dQ = forge.util.createBuffer(capture.privateKeyExponent2).toHex();\n qInv = forge.util.createBuffer(capture.privateKeyCoefficient).toHex();\n\n // set private key\n return pki.setRsaPrivateKey(\n new BigInteger(n, 16),\n new BigInteger(e, 16),\n new BigInteger(d, 16),\n new BigInteger(p, 16),\n new BigInteger(q, 16),\n new BigInteger(dP, 16),\n new BigInteger(dQ, 16),\n new BigInteger(qInv, 16));\n};\n\n/**\n * Converts a private key to an ASN.1 RSAPrivateKey.\n *\n * @param key the private key.\n *\n * @return the ASN.1 representation of an RSAPrivateKey.\n */\npki.privateKeyToAsn1 = pki.privateKeyToRSAPrivateKey = function(key) {\n // RSAPrivateKey\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // version (0 = only 2 primes, 1 multiple primes)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(0).getBytes()),\n // modulus (n)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.n)),\n // publicExponent (e)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.e)),\n // privateExponent (d)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.d)),\n // privateKeyPrime1 (p)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.p)),\n // privateKeyPrime2 (q)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.q)),\n // privateKeyExponent1 (dP)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.dP)),\n // privateKeyExponent2 (dQ)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.dQ)),\n // coefficient (qInv)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.qInv))\n ]);\n};\n\n/**\n * Converts a public key from an ASN.1 SubjectPublicKeyInfo or RSAPublicKey.\n *\n * @param obj the asn1 representation of a SubjectPublicKeyInfo or RSAPublicKey.\n *\n * @return the public key.\n */\npki.publicKeyFromAsn1 = function(obj) {\n // get SubjectPublicKeyInfo\n var capture = {};\n var errors = [];\n if(asn1.validate(obj, publicKeyValidator, capture, errors)) {\n // get oid\n var oid = asn1.derToOid(capture.publicKeyOid);\n if(oid !== pki.oids.rsaEncryption) {\n var error = new Error('Cannot read public key. Unknown OID.');\n error.oid = oid;\n throw error;\n }\n obj = capture.rsaPublicKey;\n }\n\n // get RSA params\n errors = [];\n if(!asn1.validate(obj, rsaPublicKeyValidator, capture, errors)) {\n var error = new Error('Cannot read public key. ' +\n 'ASN.1 object does not contain an RSAPublicKey.');\n error.errors = errors;\n throw error;\n }\n\n // FIXME: inefficient, get a BigInteger that uses byte strings\n var n = forge.util.createBuffer(capture.publicKeyModulus).toHex();\n var e = forge.util.createBuffer(capture.publicKeyExponent).toHex();\n\n // set public key\n return pki.setRsaPublicKey(\n new BigInteger(n, 16),\n new BigInteger(e, 16));\n};\n\n/**\n * Converts a public key to an ASN.1 SubjectPublicKeyInfo.\n *\n * @param key the public key.\n *\n * @return the asn1 representation of a SubjectPublicKeyInfo.\n */\npki.publicKeyToAsn1 = pki.publicKeyToSubjectPublicKeyInfo = function(key) {\n // SubjectPublicKeyInfo\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // AlgorithmIdentifier\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids.rsaEncryption).getBytes()),\n // parameters (null)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]),\n // subjectPublicKey\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [\n pki.publicKeyToRSAPublicKey(key)\n ])\n ]);\n};\n\n/**\n * Converts a public key to an ASN.1 RSAPublicKey.\n *\n * @param key the public key.\n *\n * @return the asn1 representation of a RSAPublicKey.\n */\npki.publicKeyToRSAPublicKey = function(key) {\n // RSAPublicKey\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // modulus (n)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.n)),\n // publicExponent (e)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n _bnToBytes(key.e))\n ]);\n};\n\n/**\n * Encodes a message using PKCS#1 v1.5 padding.\n *\n * @param m the message to encode.\n * @param key the RSA key to use.\n * @param bt the block type to use, i.e. either 0x01 (for signing) or 0x02\n * (for encryption).\n *\n * @return the padded byte buffer.\n */\nfunction _encodePkcs1_v1_5(m, key, bt) {\n var eb = forge.util.createBuffer();\n\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n /* use PKCS#1 v1.5 padding */\n if(m.length > (k - 11)) {\n var error = new Error('Message is too long for PKCS#1 v1.5 padding.');\n error.length = m.length;\n error.max = k - 11;\n throw error;\n }\n\n /* A block type BT, a padding string PS, and the data D shall be\n formatted into an octet string EB, the encryption block:\n\n EB = 00 || BT || PS || 00 || D\n\n The block type BT shall be a single octet indicating the structure of\n the encryption block. For this version of the document it shall have\n value 00, 01, or 02. For a private-key operation, the block type\n shall be 00 or 01. For a public-key operation, it shall be 02.\n\n The padding string PS shall consist of k-3-||D|| octets. For block\n type 00, the octets shall have value 00; for block type 01, they\n shall have value FF; and for block type 02, they shall be\n pseudorandomly generated and nonzero. This makes the length of the\n encryption block EB equal to k. */\n\n // build the encryption block\n eb.putByte(0x00);\n eb.putByte(bt);\n\n // create the padding\n var padNum = k - 3 - m.length;\n var padByte;\n // private key op\n if(bt === 0x00 || bt === 0x01) {\n padByte = (bt === 0x00) ? 0x00 : 0xFF;\n for(var i = 0; i < padNum; ++i) {\n eb.putByte(padByte);\n }\n } else {\n // public key op\n // pad with random non-zero values\n while(padNum > 0) {\n var numZeros = 0;\n var padBytes = forge.random.getBytes(padNum);\n for(var i = 0; i < padNum; ++i) {\n padByte = padBytes.charCodeAt(i);\n if(padByte === 0) {\n ++numZeros;\n } else {\n eb.putByte(padByte);\n }\n }\n padNum = numZeros;\n }\n }\n\n // zero followed by message\n eb.putByte(0x00);\n eb.putBytes(m);\n\n return eb;\n}\n\n/**\n * Decodes a message using PKCS#1 v1.5 padding.\n *\n * @param em the message to decode.\n * @param key the RSA key to use.\n * @param pub true if the key is a public key, false if it is private.\n * @param ml the message length, if specified.\n *\n * @return the decoded bytes.\n */\nfunction _decodePkcs1_v1_5(em, key, pub, ml) {\n // get the length of the modulus in bytes\n var k = Math.ceil(key.n.bitLength() / 8);\n\n /* It is an error if any of the following conditions occurs:\n\n 1. The encryption block EB cannot be parsed unambiguously.\n 2. The padding string PS consists of fewer than eight octets\n or is inconsisent with the block type BT.\n 3. The decryption process is a public-key operation and the block\n type BT is not 00 or 01, or the decryption process is a\n private-key operation and the block type is not 02.\n */\n\n // parse the encryption block\n var eb = forge.util.createBuffer(em);\n var first = eb.getByte();\n var bt = eb.getByte();\n if(first !== 0x00 ||\n (pub && bt !== 0x00 && bt !== 0x01) ||\n (!pub && bt != 0x02) ||\n (pub && bt === 0x00 && typeof(ml) === 'undefined')) {\n throw new Error('Encryption block is invalid.');\n }\n\n var padNum = 0;\n if(bt === 0x00) {\n // check all padding bytes for 0x00\n padNum = k - 3 - ml;\n for(var i = 0; i < padNum; ++i) {\n if(eb.getByte() !== 0x00) {\n throw new Error('Encryption block is invalid.');\n }\n }\n } else if(bt === 0x01) {\n // find the first byte that isn't 0xFF, should be after all padding\n padNum = 0;\n while(eb.length() > 1) {\n if(eb.getByte() !== 0xFF) {\n --eb.read;\n break;\n }\n ++padNum;\n }\n } else if(bt === 0x02) {\n // look for 0x00 byte\n padNum = 0;\n while(eb.length() > 1) {\n if(eb.getByte() === 0x00) {\n --eb.read;\n break;\n }\n ++padNum;\n }\n }\n\n // zero must be 0x00 and padNum must be (k - 3 - message length)\n var zero = eb.getByte();\n if(zero !== 0x00 || padNum !== (k - 3 - eb.length())) {\n throw new Error('Encryption block is invalid.');\n }\n\n return eb.getBytes();\n}\n\n/**\n * Runs the key-generation algorithm asynchronously, either in the background\n * via Web Workers, or using the main thread and setImmediate.\n *\n * @param state the key-pair generation state.\n * @param [options] options for key-pair generation:\n * workerScript the worker script URL.\n * workers the number of web workers (if supported) to use,\n * (default: 2, -1 to use estimated cores minus one).\n * workLoad the size of the work load, ie: number of possible prime\n * numbers for each web worker to check per work assignment,\n * (default: 100).\n * @param callback(err, keypair) called once the operation completes.\n */\nfunction _generateKeyPair(state, options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n var opts = {\n algorithm: {\n name: options.algorithm || 'PRIMEINC',\n options: {\n workers: options.workers || 2,\n workLoad: options.workLoad || 100,\n workerScript: options.workerScript\n }\n }\n };\n if('prng' in options) {\n opts.prng = options.prng;\n }\n\n generate();\n\n function generate() {\n // find p and then q (done in series to simplify)\n getPrime(state.pBits, function(err, num) {\n if(err) {\n return callback(err);\n }\n state.p = num;\n if(state.q !== null) {\n return finish(err, state.q);\n }\n getPrime(state.qBits, finish);\n });\n }\n\n function getPrime(bits, callback) {\n forge.prime.generateProbablePrime(bits, opts, callback);\n }\n\n function finish(err, num) {\n if(err) {\n return callback(err);\n }\n\n // set q\n state.q = num;\n\n // ensure p is larger than q (swap them if not)\n if(state.p.compareTo(state.q) < 0) {\n var tmp = state.p;\n state.p = state.q;\n state.q = tmp;\n }\n\n // ensure p is coprime with e\n if(state.p.subtract(BigInteger.ONE).gcd(state.e)\n .compareTo(BigInteger.ONE) !== 0) {\n state.p = null;\n generate();\n return;\n }\n\n // ensure q is coprime with e\n if(state.q.subtract(BigInteger.ONE).gcd(state.e)\n .compareTo(BigInteger.ONE) !== 0) {\n state.q = null;\n getPrime(state.qBits, finish);\n return;\n }\n\n // compute phi: (p - 1)(q - 1) (Euler's totient function)\n state.p1 = state.p.subtract(BigInteger.ONE);\n state.q1 = state.q.subtract(BigInteger.ONE);\n state.phi = state.p1.multiply(state.q1);\n\n // ensure e and phi are coprime\n if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) !== 0) {\n // phi and e aren't coprime, so generate a new p and q\n state.p = state.q = null;\n generate();\n return;\n }\n\n // create n, ensure n is has the right number of bits\n state.n = state.p.multiply(state.q);\n if(state.n.bitLength() !== state.bits) {\n // failed, get new q\n state.q = null;\n getPrime(state.qBits, finish);\n return;\n }\n\n // set keys\n var d = state.e.modInverse(state.phi);\n state.keys = {\n privateKey: pki.rsa.setPrivateKey(\n state.n, state.e, d, state.p, state.q,\n d.mod(state.p1), d.mod(state.q1),\n state.q.modInverse(state.p)),\n publicKey: pki.rsa.setPublicKey(state.n, state.e)\n };\n\n callback(null, state.keys);\n }\n}\n\n/**\n * Converts a positive BigInteger into 2's-complement big-endian bytes.\n *\n * @param b the big integer to convert.\n *\n * @return the bytes.\n */\nfunction _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}\n\n/**\n * Returns the required number of Miller-Rabin tests to generate a\n * prime with an error probability of (1/2)^80.\n *\n * See Handbook of Applied Cryptography Chapter 4, Table 4.4.\n *\n * @param bits the bit size.\n *\n * @return the required number of iterations.\n */\nfunction _getMillerRabinTests(bits) {\n if(bits <= 100) return 27;\n if(bits <= 150) return 18;\n if(bits <= 200) return 15;\n if(bits <= 250) return 12;\n if(bits <= 300) return 9;\n if(bits <= 350) return 8;\n if(bits <= 400) return 7;\n if(bits <= 500) return 6;\n if(bits <= 600) return 5;\n if(bits <= 800) return 4;\n if(bits <= 1250) return 3;\n return 2;\n}\n\n/**\n * Performs feature detection on the Node crypto interface.\n *\n * @param fn the feature (function) to detect.\n *\n * @return true if detected, false if not.\n */\nfunction _detectNodeCrypto(fn) {\n return forge.util.isNodejs && typeof _crypto[fn] === 'function';\n}\n\n/**\n * Performs feature detection on the SubtleCrypto interface.\n *\n * @param fn the feature (function) to detect.\n *\n * @return true if detected, false if not.\n */\nfunction _detectSubtleCrypto(fn) {\n return (typeof util.globalScope !== 'undefined' &&\n typeof util.globalScope.crypto === 'object' &&\n typeof util.globalScope.crypto.subtle === 'object' &&\n typeof util.globalScope.crypto.subtle[fn] === 'function');\n}\n\n/**\n * Performs feature detection on the deprecated Microsoft Internet Explorer\n * outdated SubtleCrypto interface. This function should only be used after\n * checking for the modern, standard SubtleCrypto interface.\n *\n * @param fn the feature (function) to detect.\n *\n * @return true if detected, false if not.\n */\nfunction _detectSubtleMsCrypto(fn) {\n return (typeof util.globalScope !== 'undefined' &&\n typeof util.globalScope.msCrypto === 'object' &&\n typeof util.globalScope.msCrypto.subtle === 'object' &&\n typeof util.globalScope.msCrypto.subtle[fn] === 'function');\n}\n\nfunction _intToUint8Array(x) {\n var bytes = forge.util.hexToBytes(x.toString(16));\n var buffer = new Uint8Array(bytes.length);\n for(var i = 0; i < bytes.length; ++i) {\n buffer[i] = bytes.charCodeAt(i);\n }\n return buffer;\n}\n\nfunction _privateKeyFromJwk(jwk) {\n if(jwk.kty !== 'RSA') {\n throw new Error(\n 'Unsupported key algorithm \"' + jwk.kty + '\"; algorithm must be \"RSA\".');\n }\n return pki.setRsaPrivateKey(\n _base64ToBigInt(jwk.n),\n _base64ToBigInt(jwk.e),\n _base64ToBigInt(jwk.d),\n _base64ToBigInt(jwk.p),\n _base64ToBigInt(jwk.q),\n _base64ToBigInt(jwk.dp),\n _base64ToBigInt(jwk.dq),\n _base64ToBigInt(jwk.qi));\n}\n\nfunction _publicKeyFromJwk(jwk) {\n if(jwk.kty !== 'RSA') {\n throw new Error('Key algorithm must be \"RSA\".');\n }\n return pki.setRsaPublicKey(\n _base64ToBigInt(jwk.n),\n _base64ToBigInt(jwk.e));\n}\n\nfunction _base64ToBigInt(b64) {\n return new BigInteger(forge.util.bytesToHex(forge.util.decode64(b64)), 16);\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/rsa.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/sha1.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/sha1.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Secure Hash Algorithm with 160-bit digest (SHA-1) implementation.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar sha1 = module.exports = forge.sha1 = forge.sha1 || {};\nforge.md.sha1 = forge.md.algorithms.sha1 = sha1;\n\n/**\n * Creates a SHA-1 message digest object.\n *\n * @return a message digest object.\n */\nsha1.create = function() {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n // SHA-1 state contains five 32-bit integers\n var _state = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for word storage\n var _w = new Array(80);\n\n // message digest object\n var md = {\n algorithm: 'sha1',\n blockLength: 64,\n digestLength: 20,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 8\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength64 for backwards-compatibility)\n md.fullMessageLength = md.messageLength64 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _state = {\n h0: 0x67452301,\n h1: 0xEFCDAB89,\n h2: 0x98BADCFE,\n h3: 0x10325476,\n h4: 0xC3D2E1F0\n };\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_state, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-1 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 448 mod 512. In other words,\n the data to be digested must be a multiple of 512 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 8 bytes (64\n bits), that means that the last segment of the data must have 56 bytes\n (448 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 448 mod 512 because\n 512 - 128 = 448.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 448 mod 512, then 512 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var s2 = {\n h0: _state.h0,\n h1: _state.h1,\n h2: _state.h2,\n h3: _state.h3,\n h4: _state.h4\n };\n _update(s2, _w, finalBlock);\n var rval = forge.util.createBuffer();\n rval.putInt32(s2.h0);\n rval.putInt32(s2.h1);\n rval.putInt32(s2.h2);\n rval.putInt32(s2.h3);\n rval.putInt32(s2.h4);\n return rval;\n };\n\n return md;\n};\n\n// sha-1 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 64);\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-1 state with the given byte buffer.\n *\n * @param s the SHA-1 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (64 byte) chunks\n var t, a, b, c, d, e, f, i;\n var len = bytes.length();\n while(len >= 64) {\n // the w array will be populated with sixteen 32-bit big-endian words\n // and then extended into 80 32-bit words according to SHA-1 algorithm\n // and for 32-79 using Max Locktyukhin's optimization\n\n // initialize hash value for this chunk\n a = s.h0;\n b = s.h1;\n c = s.h2;\n d = s.h3;\n e = s.h4;\n\n // round 1\n for(i = 0; i < 16; ++i) {\n t = bytes.getInt32();\n w[i] = t;\n f = d ^ (b & (c ^ d));\n t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n for(; i < 20; ++i) {\n t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]);\n t = (t << 1) | (t >>> 31);\n w[i] = t;\n f = d ^ (b & (c ^ d));\n t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n // round 2\n for(; i < 32; ++i) {\n t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]);\n t = (t << 1) | (t >>> 31);\n w[i] = t;\n f = b ^ c ^ d;\n t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n for(; i < 40; ++i) {\n t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]);\n t = (t << 2) | (t >>> 30);\n w[i] = t;\n f = b ^ c ^ d;\n t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n // round 3\n for(; i < 60; ++i) {\n t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]);\n t = (t << 2) | (t >>> 30);\n w[i] = t;\n f = (b & c) | (d & (b ^ c));\n t = ((a << 5) | (a >>> 27)) + f + e + 0x8F1BBCDC + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n // round 4\n for(; i < 80; ++i) {\n t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]);\n t = (t << 2) | (t >>> 30);\n w[i] = t;\n f = b ^ c ^ d;\n t = ((a << 5) | (a >>> 27)) + f + e + 0xCA62C1D6 + t;\n e = d;\n d = c;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n c = ((b << 30) | (b >>> 2)) >>> 0;\n b = a;\n a = t;\n }\n\n // update hash state\n s.h0 = (s.h0 + a) | 0;\n s.h1 = (s.h1 + b) | 0;\n s.h2 = (s.h2 + c) | 0;\n s.h3 = (s.h3 + d) | 0;\n s.h4 = (s.h4 + e) | 0;\n\n len -= 64;\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/sha1.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/sha256.js": +/*!***********************************************!*\ + !*** ./node_modules/node-forge/lib/sha256.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Secure Hash Algorithm with 256-bit digest (SHA-256) implementation.\n *\n * See FIPS 180-2 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar sha256 = module.exports = forge.sha256 = forge.sha256 || {};\nforge.md.sha256 = forge.md.algorithms.sha256 = sha256;\n\n/**\n * Creates a SHA-256 message digest object.\n *\n * @return a message digest object.\n */\nsha256.create = function() {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n // SHA-256 state contains eight 32-bit integers\n var _state = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for word storage\n var _w = new Array(64);\n\n // message digest object\n var md = {\n algorithm: 'sha256',\n blockLength: 64,\n digestLength: 32,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 8\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength64 for backwards-compatibility)\n md.fullMessageLength = md.messageLength64 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _state = {\n h0: 0x6A09E667,\n h1: 0xBB67AE85,\n h2: 0x3C6EF372,\n h3: 0xA54FF53A,\n h4: 0x510E527F,\n h5: 0x9B05688C,\n h6: 0x1F83D9AB,\n h7: 0x5BE0CD19\n };\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_state, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-256 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 448 mod 512. In other words,\n the data to be digested must be a multiple of 512 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 8 bytes (64\n bits), that means that the last segment of the data must have 56 bytes\n (448 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 448 mod 512 because\n 512 - 128 = 448.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 448 mod 512, then 512 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var s2 = {\n h0: _state.h0,\n h1: _state.h1,\n h2: _state.h2,\n h3: _state.h3,\n h4: _state.h4,\n h5: _state.h5,\n h6: _state.h6,\n h7: _state.h7\n };\n _update(s2, _w, finalBlock);\n var rval = forge.util.createBuffer();\n rval.putInt32(s2.h0);\n rval.putInt32(s2.h1);\n rval.putInt32(s2.h2);\n rval.putInt32(s2.h3);\n rval.putInt32(s2.h4);\n rval.putInt32(s2.h5);\n rval.putInt32(s2.h6);\n rval.putInt32(s2.h7);\n return rval;\n };\n\n return md;\n};\n\n// sha-256 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n// table of constants\nvar _k = null;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 64);\n\n // create K table for SHA-256\n _k = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-256 state with the given byte buffer.\n *\n * @param s the SHA-256 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (64 byte) chunks\n var t1, t2, s0, s1, ch, maj, i, a, b, c, d, e, f, g, h;\n var len = bytes.length();\n while(len >= 64) {\n // the w array will be populated with sixteen 32-bit big-endian words\n // and then extended into 64 32-bit words according to SHA-256\n for(i = 0; i < 16; ++i) {\n w[i] = bytes.getInt32();\n }\n for(; i < 64; ++i) {\n // XOR word 2 words ago rot right 17, rot right 19, shft right 10\n t1 = w[i - 2];\n t1 =\n ((t1 >>> 17) | (t1 << 15)) ^\n ((t1 >>> 19) | (t1 << 13)) ^\n (t1 >>> 10);\n // XOR word 15 words ago rot right 7, rot right 18, shft right 3\n t2 = w[i - 15];\n t2 =\n ((t2 >>> 7) | (t2 << 25)) ^\n ((t2 >>> 18) | (t2 << 14)) ^\n (t2 >>> 3);\n // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^32\n w[i] = (t1 + w[i - 7] + t2 + w[i - 16]) | 0;\n }\n\n // initialize hash value for this chunk\n a = s.h0;\n b = s.h1;\n c = s.h2;\n d = s.h3;\n e = s.h4;\n f = s.h5;\n g = s.h6;\n h = s.h7;\n\n // round function\n for(i = 0; i < 64; ++i) {\n // Sum1(e)\n s1 =\n ((e >>> 6) | (e << 26)) ^\n ((e >>> 11) | (e << 21)) ^\n ((e >>> 25) | (e << 7));\n // Ch(e, f, g) (optimized the same way as SHA-1)\n ch = g ^ (e & (f ^ g));\n // Sum0(a)\n s0 =\n ((a >>> 2) | (a << 30)) ^\n ((a >>> 13) | (a << 19)) ^\n ((a >>> 22) | (a << 10));\n // Maj(a, b, c) (optimized the same way as SHA-1)\n maj = (a & b) | (c & (a ^ b));\n\n // main algorithm\n t1 = h + s1 + ch + _k[i] + w[i];\n t2 = s0 + maj;\n h = g;\n g = f;\n f = e;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n // can't truncate with `| 0`\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n // can't truncate with `| 0`\n a = (t1 + t2) >>> 0;\n }\n\n // update hash state\n s.h0 = (s.h0 + a) | 0;\n s.h1 = (s.h1 + b) | 0;\n s.h2 = (s.h2 + c) | 0;\n s.h3 = (s.h3 + d) | 0;\n s.h4 = (s.h4 + e) | 0;\n s.h5 = (s.h5 + f) | 0;\n s.h6 = (s.h6 + g) | 0;\n s.h7 = (s.h7 + h) | 0;\n len -= 64;\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/sha256.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/sha512.js": +/*!***********************************************!*\ + !*** ./node_modules/node-forge/lib/sha512.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Secure Hash Algorithm with a 1024-bit block size implementation.\n *\n * This includes: SHA-512, SHA-384, SHA-512/224, and SHA-512/256. For\n * SHA-256 (block size 512 bits), see sha256.js.\n *\n * See FIPS 180-4 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2014-2015 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\n__webpack_require__(/*! ./md */ \"./node_modules/node-forge/lib/md.js\");\n__webpack_require__(/*! ./util */ \"./node_modules/node-forge/lib/util.js\");\n\nvar sha512 = module.exports = forge.sha512 = forge.sha512 || {};\n\n// SHA-512\nforge.md.sha512 = forge.md.algorithms.sha512 = sha512;\n\n// SHA-384\nvar sha384 = forge.sha384 = forge.sha512.sha384 = forge.sha512.sha384 || {};\nsha384.create = function() {\n return sha512.create('SHA-384');\n};\nforge.md.sha384 = forge.md.algorithms.sha384 = sha384;\n\n// SHA-512/256\nforge.sha512.sha256 = forge.sha512.sha256 || {\n create: function() {\n return sha512.create('SHA-512/256');\n }\n};\nforge.md['sha512/256'] = forge.md.algorithms['sha512/256'] =\n forge.sha512.sha256;\n\n// SHA-512/224\nforge.sha512.sha224 = forge.sha512.sha224 || {\n create: function() {\n return sha512.create('SHA-512/224');\n }\n};\nforge.md['sha512/224'] = forge.md.algorithms['sha512/224'] =\n forge.sha512.sha224;\n\n/**\n * Creates a SHA-2 message digest object.\n *\n * @param algorithm the algorithm to use (SHA-512, SHA-384, SHA-512/224,\n * SHA-512/256).\n *\n * @return a message digest object.\n */\nsha512.create = function(algorithm) {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n if(typeof algorithm === 'undefined') {\n algorithm = 'SHA-512';\n }\n\n if(!(algorithm in _states)) {\n throw new Error('Invalid SHA-512 algorithm: ' + algorithm);\n }\n\n // SHA-512 state contains eight 64-bit integers (each as two 32-bit ints)\n var _state = _states[algorithm];\n var _h = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for 64-bit word storage\n var _w = new Array(80);\n for(var wi = 0; wi < 80; ++wi) {\n _w[wi] = new Array(2);\n }\n\n // determine digest length by algorithm name (default)\n var digestLength = 64;\n switch(algorithm) {\n case 'SHA-384':\n digestLength = 48;\n break;\n case 'SHA-512/256':\n digestLength = 32;\n break;\n case 'SHA-512/224':\n digestLength = 28;\n break;\n }\n\n // message digest object\n var md = {\n // SHA-512 => sha512\n algorithm: algorithm.replace('-', '').toLowerCase(),\n blockLength: 128,\n digestLength: digestLength,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 16\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength128 for backwards-compatibility)\n md.fullMessageLength = md.messageLength128 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _h = new Array(_state.length);\n for(var i = 0; i < _state.length; ++i) {\n _h[i] = _state[i].slice(0);\n }\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_h, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-512 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 896 mod 1024. In other words,\n the data to be digested must be a multiple of 1024 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 16 bytes (128\n bits), that means that the last segment of the data must have 112 bytes\n (896 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 896 mod 1024 because\n 1024 - 128 = 896.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 896 mod 1024, then 1024 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var h = new Array(_h.length);\n for(var i = 0; i < _h.length; ++i) {\n h[i] = _h[i].slice(0);\n }\n _update(h, _w, finalBlock);\n var rval = forge.util.createBuffer();\n var hlen;\n if(algorithm === 'SHA-512') {\n hlen = h.length;\n } else if(algorithm === 'SHA-384') {\n hlen = h.length - 2;\n } else {\n hlen = h.length - 4;\n }\n for(var i = 0; i < hlen; ++i) {\n rval.putInt32(h[i][0]);\n if(i !== hlen - 1 || algorithm !== 'SHA-512/224') {\n rval.putInt32(h[i][1]);\n }\n }\n return rval;\n };\n\n return md;\n};\n\n// sha-512 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n// table of constants\nvar _k = null;\n\n// initial hash states\nvar _states = null;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 128);\n\n // create K table for SHA-512\n _k = [\n [0x428a2f98, 0xd728ae22], [0x71374491, 0x23ef65cd],\n [0xb5c0fbcf, 0xec4d3b2f], [0xe9b5dba5, 0x8189dbbc],\n [0x3956c25b, 0xf348b538], [0x59f111f1, 0xb605d019],\n [0x923f82a4, 0xaf194f9b], [0xab1c5ed5, 0xda6d8118],\n [0xd807aa98, 0xa3030242], [0x12835b01, 0x45706fbe],\n [0x243185be, 0x4ee4b28c], [0x550c7dc3, 0xd5ffb4e2],\n [0x72be5d74, 0xf27b896f], [0x80deb1fe, 0x3b1696b1],\n [0x9bdc06a7, 0x25c71235], [0xc19bf174, 0xcf692694],\n [0xe49b69c1, 0x9ef14ad2], [0xefbe4786, 0x384f25e3],\n [0x0fc19dc6, 0x8b8cd5b5], [0x240ca1cc, 0x77ac9c65],\n [0x2de92c6f, 0x592b0275], [0x4a7484aa, 0x6ea6e483],\n [0x5cb0a9dc, 0xbd41fbd4], [0x76f988da, 0x831153b5],\n [0x983e5152, 0xee66dfab], [0xa831c66d, 0x2db43210],\n [0xb00327c8, 0x98fb213f], [0xbf597fc7, 0xbeef0ee4],\n [0xc6e00bf3, 0x3da88fc2], [0xd5a79147, 0x930aa725],\n [0x06ca6351, 0xe003826f], [0x14292967, 0x0a0e6e70],\n [0x27b70a85, 0x46d22ffc], [0x2e1b2138, 0x5c26c926],\n [0x4d2c6dfc, 0x5ac42aed], [0x53380d13, 0x9d95b3df],\n [0x650a7354, 0x8baf63de], [0x766a0abb, 0x3c77b2a8],\n [0x81c2c92e, 0x47edaee6], [0x92722c85, 0x1482353b],\n [0xa2bfe8a1, 0x4cf10364], [0xa81a664b, 0xbc423001],\n [0xc24b8b70, 0xd0f89791], [0xc76c51a3, 0x0654be30],\n [0xd192e819, 0xd6ef5218], [0xd6990624, 0x5565a910],\n [0xf40e3585, 0x5771202a], [0x106aa070, 0x32bbd1b8],\n [0x19a4c116, 0xb8d2d0c8], [0x1e376c08, 0x5141ab53],\n [0x2748774c, 0xdf8eeb99], [0x34b0bcb5, 0xe19b48a8],\n [0x391c0cb3, 0xc5c95a63], [0x4ed8aa4a, 0xe3418acb],\n [0x5b9cca4f, 0x7763e373], [0x682e6ff3, 0xd6b2b8a3],\n [0x748f82ee, 0x5defb2fc], [0x78a5636f, 0x43172f60],\n [0x84c87814, 0xa1f0ab72], [0x8cc70208, 0x1a6439ec],\n [0x90befffa, 0x23631e28], [0xa4506ceb, 0xde82bde9],\n [0xbef9a3f7, 0xb2c67915], [0xc67178f2, 0xe372532b],\n [0xca273ece, 0xea26619c], [0xd186b8c7, 0x21c0c207],\n [0xeada7dd6, 0xcde0eb1e], [0xf57d4f7f, 0xee6ed178],\n [0x06f067aa, 0x72176fba], [0x0a637dc5, 0xa2c898a6],\n [0x113f9804, 0xbef90dae], [0x1b710b35, 0x131c471b],\n [0x28db77f5, 0x23047d84], [0x32caab7b, 0x40c72493],\n [0x3c9ebe0a, 0x15c9bebc], [0x431d67c4, 0x9c100d4c],\n [0x4cc5d4be, 0xcb3e42b6], [0x597f299c, 0xfc657e2a],\n [0x5fcb6fab, 0x3ad6faec], [0x6c44198c, 0x4a475817]\n ];\n\n // initial hash states\n _states = {};\n _states['SHA-512'] = [\n [0x6a09e667, 0xf3bcc908],\n [0xbb67ae85, 0x84caa73b],\n [0x3c6ef372, 0xfe94f82b],\n [0xa54ff53a, 0x5f1d36f1],\n [0x510e527f, 0xade682d1],\n [0x9b05688c, 0x2b3e6c1f],\n [0x1f83d9ab, 0xfb41bd6b],\n [0x5be0cd19, 0x137e2179]\n ];\n _states['SHA-384'] = [\n [0xcbbb9d5d, 0xc1059ed8],\n [0x629a292a, 0x367cd507],\n [0x9159015a, 0x3070dd17],\n [0x152fecd8, 0xf70e5939],\n [0x67332667, 0xffc00b31],\n [0x8eb44a87, 0x68581511],\n [0xdb0c2e0d, 0x64f98fa7],\n [0x47b5481d, 0xbefa4fa4]\n ];\n _states['SHA-512/256'] = [\n [0x22312194, 0xFC2BF72C],\n [0x9F555FA3, 0xC84C64C2],\n [0x2393B86B, 0x6F53B151],\n [0x96387719, 0x5940EABD],\n [0x96283EE2, 0xA88EFFE3],\n [0xBE5E1E25, 0x53863992],\n [0x2B0199FC, 0x2C85B8AA],\n [0x0EB72DDC, 0x81C52CA2]\n ];\n _states['SHA-512/224'] = [\n [0x8C3D37C8, 0x19544DA2],\n [0x73E19966, 0x89DCD4D6],\n [0x1DFAB7AE, 0x32FF9C82],\n [0x679DD514, 0x582F9FCF],\n [0x0F6D2B69, 0x7BD44DA8],\n [0x77E36F73, 0x04C48942],\n [0x3F9D85A8, 0x6A1D36C8],\n [0x1112E6AD, 0x91D692A1]\n ];\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-512 state with the given byte buffer.\n *\n * @param s the SHA-512 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (128 byte) chunks\n var t1_hi, t1_lo;\n var t2_hi, t2_lo;\n var s0_hi, s0_lo;\n var s1_hi, s1_lo;\n var ch_hi, ch_lo;\n var maj_hi, maj_lo;\n var a_hi, a_lo;\n var b_hi, b_lo;\n var c_hi, c_lo;\n var d_hi, d_lo;\n var e_hi, e_lo;\n var f_hi, f_lo;\n var g_hi, g_lo;\n var h_hi, h_lo;\n var i, hi, lo, w2, w7, w15, w16;\n var len = bytes.length();\n while(len >= 128) {\n // the w array will be populated with sixteen 64-bit big-endian words\n // and then extended into 64 64-bit words according to SHA-512\n for(i = 0; i < 16; ++i) {\n w[i][0] = bytes.getInt32() >>> 0;\n w[i][1] = bytes.getInt32() >>> 0;\n }\n for(; i < 80; ++i) {\n // for word 2 words ago: ROTR 19(x) ^ ROTR 61(x) ^ SHR 6(x)\n w2 = w[i - 2];\n hi = w2[0];\n lo = w2[1];\n\n // high bits\n t1_hi = (\n ((hi >>> 19) | (lo << 13)) ^ // ROTR 19\n ((lo >>> 29) | (hi << 3)) ^ // ROTR 61/(swap + ROTR 29)\n (hi >>> 6)) >>> 0; // SHR 6\n // low bits\n t1_lo = (\n ((hi << 13) | (lo >>> 19)) ^ // ROTR 19\n ((lo << 3) | (hi >>> 29)) ^ // ROTR 61/(swap + ROTR 29)\n ((hi << 26) | (lo >>> 6))) >>> 0; // SHR 6\n\n // for word 15 words ago: ROTR 1(x) ^ ROTR 8(x) ^ SHR 7(x)\n w15 = w[i - 15];\n hi = w15[0];\n lo = w15[1];\n\n // high bits\n t2_hi = (\n ((hi >>> 1) | (lo << 31)) ^ // ROTR 1\n ((hi >>> 8) | (lo << 24)) ^ // ROTR 8\n (hi >>> 7)) >>> 0; // SHR 7\n // low bits\n t2_lo = (\n ((hi << 31) | (lo >>> 1)) ^ // ROTR 1\n ((hi << 24) | (lo >>> 8)) ^ // ROTR 8\n ((hi << 25) | (lo >>> 7))) >>> 0; // SHR 7\n\n // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^64 (carry lo overflow)\n w7 = w[i - 7];\n w16 = w[i - 16];\n lo = (t1_lo + w7[1] + t2_lo + w16[1]);\n w[i][0] = (t1_hi + w7[0] + t2_hi + w16[0] +\n ((lo / 0x100000000) >>> 0)) >>> 0;\n w[i][1] = lo >>> 0;\n }\n\n // initialize hash value for this chunk\n a_hi = s[0][0];\n a_lo = s[0][1];\n b_hi = s[1][0];\n b_lo = s[1][1];\n c_hi = s[2][0];\n c_lo = s[2][1];\n d_hi = s[3][0];\n d_lo = s[3][1];\n e_hi = s[4][0];\n e_lo = s[4][1];\n f_hi = s[5][0];\n f_lo = s[5][1];\n g_hi = s[6][0];\n g_lo = s[6][1];\n h_hi = s[7][0];\n h_lo = s[7][1];\n\n // round function\n for(i = 0; i < 80; ++i) {\n // Sum1(e) = ROTR 14(e) ^ ROTR 18(e) ^ ROTR 41(e)\n s1_hi = (\n ((e_hi >>> 14) | (e_lo << 18)) ^ // ROTR 14\n ((e_hi >>> 18) | (e_lo << 14)) ^ // ROTR 18\n ((e_lo >>> 9) | (e_hi << 23))) >>> 0; // ROTR 41/(swap + ROTR 9)\n s1_lo = (\n ((e_hi << 18) | (e_lo >>> 14)) ^ // ROTR 14\n ((e_hi << 14) | (e_lo >>> 18)) ^ // ROTR 18\n ((e_lo << 23) | (e_hi >>> 9))) >>> 0; // ROTR 41/(swap + ROTR 9)\n\n // Ch(e, f, g) (optimized the same way as SHA-1)\n ch_hi = (g_hi ^ (e_hi & (f_hi ^ g_hi))) >>> 0;\n ch_lo = (g_lo ^ (e_lo & (f_lo ^ g_lo))) >>> 0;\n\n // Sum0(a) = ROTR 28(a) ^ ROTR 34(a) ^ ROTR 39(a)\n s0_hi = (\n ((a_hi >>> 28) | (a_lo << 4)) ^ // ROTR 28\n ((a_lo >>> 2) | (a_hi << 30)) ^ // ROTR 34/(swap + ROTR 2)\n ((a_lo >>> 7) | (a_hi << 25))) >>> 0; // ROTR 39/(swap + ROTR 7)\n s0_lo = (\n ((a_hi << 4) | (a_lo >>> 28)) ^ // ROTR 28\n ((a_lo << 30) | (a_hi >>> 2)) ^ // ROTR 34/(swap + ROTR 2)\n ((a_lo << 25) | (a_hi >>> 7))) >>> 0; // ROTR 39/(swap + ROTR 7)\n\n // Maj(a, b, c) (optimized the same way as SHA-1)\n maj_hi = ((a_hi & b_hi) | (c_hi & (a_hi ^ b_hi))) >>> 0;\n maj_lo = ((a_lo & b_lo) | (c_lo & (a_lo ^ b_lo))) >>> 0;\n\n // main algorithm\n // t1 = (h + s1 + ch + _k[i] + _w[i]) modulo 2^64 (carry lo overflow)\n lo = (h_lo + s1_lo + ch_lo + _k[i][1] + w[i][1]);\n t1_hi = (h_hi + s1_hi + ch_hi + _k[i][0] + w[i][0] +\n ((lo / 0x100000000) >>> 0)) >>> 0;\n t1_lo = lo >>> 0;\n\n // t2 = s0 + maj modulo 2^64 (carry lo overflow)\n lo = s0_lo + maj_lo;\n t2_hi = (s0_hi + maj_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n t2_lo = lo >>> 0;\n\n h_hi = g_hi;\n h_lo = g_lo;\n\n g_hi = f_hi;\n g_lo = f_lo;\n\n f_hi = e_hi;\n f_lo = e_lo;\n\n // e = (d + t1) modulo 2^64 (carry lo overflow)\n lo = d_lo + t1_lo;\n e_hi = (d_hi + t1_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n e_lo = lo >>> 0;\n\n d_hi = c_hi;\n d_lo = c_lo;\n\n c_hi = b_hi;\n c_lo = b_lo;\n\n b_hi = a_hi;\n b_lo = a_lo;\n\n // a = (t1 + t2) modulo 2^64 (carry lo overflow)\n lo = t1_lo + t2_lo;\n a_hi = (t1_hi + t2_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n a_lo = lo >>> 0;\n }\n\n // update hash state (additional modulo 2^64)\n lo = s[0][1] + a_lo;\n s[0][0] = (s[0][0] + a_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[0][1] = lo >>> 0;\n\n lo = s[1][1] + b_lo;\n s[1][0] = (s[1][0] + b_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[1][1] = lo >>> 0;\n\n lo = s[2][1] + c_lo;\n s[2][0] = (s[2][0] + c_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[2][1] = lo >>> 0;\n\n lo = s[3][1] + d_lo;\n s[3][0] = (s[3][0] + d_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[3][1] = lo >>> 0;\n\n lo = s[4][1] + e_lo;\n s[4][0] = (s[4][0] + e_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[4][1] = lo >>> 0;\n\n lo = s[5][1] + f_lo;\n s[5][0] = (s[5][0] + f_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[5][1] = lo >>> 0;\n\n lo = s[6][1] + g_lo;\n s[6][0] = (s[6][0] + g_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[6][1] = lo >>> 0;\n\n lo = s[7][1] + h_lo;\n s[7][0] = (s[7][0] + h_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[7][1] = lo >>> 0;\n\n len -= 128;\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/sha512.js?"); + +/***/ }), + +/***/ "./node_modules/node-forge/lib/util.js": +/*!*********************************************!*\ + !*** ./node_modules/node-forge/lib/util.js ***! + \*********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Utility functions for web applications.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2018 Digital Bazaar, Inc.\n */\nvar forge = __webpack_require__(/*! ./forge */ \"./node_modules/node-forge/lib/forge.js\");\nvar baseN = __webpack_require__(/*! ./baseN */ \"./node_modules/node-forge/lib/baseN.js\");\n\n/* Utilities API */\nvar util = module.exports = forge.util = forge.util || {};\n\n// define setImmediate and nextTick\n(function() {\n // use native nextTick (unless we're in webpack)\n // webpack (or better node-libs-browser polyfill) sets process.browser.\n // this way we can detect webpack properly\n if(typeof process !== 'undefined' && process.nextTick && !process.browser) {\n util.nextTick = process.nextTick;\n if(typeof setImmediate === 'function') {\n util.setImmediate = setImmediate;\n } else {\n // polyfill setImmediate with nextTick, older versions of node\n // (those w/o setImmediate) won't totally starve IO\n util.setImmediate = util.nextTick;\n }\n return;\n }\n\n // polyfill nextTick with native setImmediate\n if(typeof setImmediate === 'function') {\n util.setImmediate = function() { return setImmediate.apply(undefined, arguments); };\n util.nextTick = function(callback) {\n return setImmediate(callback);\n };\n return;\n }\n\n /* Note: A polyfill upgrade pattern is used here to allow combining\n polyfills. For example, MutationObserver is fast, but blocks UI updates,\n so it needs to allow UI updates periodically, so it falls back on\n postMessage or setTimeout. */\n\n // polyfill with setTimeout\n util.setImmediate = function(callback) {\n setTimeout(callback, 0);\n };\n\n // upgrade polyfill to use postMessage\n if(typeof window !== 'undefined' &&\n typeof window.postMessage === 'function') {\n var msg = 'forge.setImmediate';\n var callbacks = [];\n util.setImmediate = function(callback) {\n callbacks.push(callback);\n // only send message when one hasn't been sent in\n // the current turn of the event loop\n if(callbacks.length === 1) {\n window.postMessage(msg, '*');\n }\n };\n function handler(event) {\n if(event.source === window && event.data === msg) {\n event.stopPropagation();\n var copy = callbacks.slice();\n callbacks.length = 0;\n copy.forEach(function(callback) {\n callback();\n });\n }\n }\n window.addEventListener('message', handler, true);\n }\n\n // upgrade polyfill to use MutationObserver\n if(typeof MutationObserver !== 'undefined') {\n // polyfill with MutationObserver\n var now = Date.now();\n var attr = true;\n var div = document.createElement('div');\n var callbacks = [];\n new MutationObserver(function() {\n var copy = callbacks.slice();\n callbacks.length = 0;\n copy.forEach(function(callback) {\n callback();\n });\n }).observe(div, {attributes: true});\n var oldSetImmediate = util.setImmediate;\n util.setImmediate = function(callback) {\n if(Date.now() - now > 15) {\n now = Date.now();\n oldSetImmediate(callback);\n } else {\n callbacks.push(callback);\n // only trigger observer when it hasn't been triggered in\n // the current turn of the event loop\n if(callbacks.length === 1) {\n div.setAttribute('a', attr = !attr);\n }\n }\n };\n }\n\n util.nextTick = util.setImmediate;\n})();\n\n// check if running under Node.js\nutil.isNodejs =\n typeof process !== 'undefined' && process.versions && process.versions.node;\n\n\n// 'self' will also work in Web Workers (instance of WorkerGlobalScope) while\n// it will point to `window` in the main thread.\n// To remain compatible with older browsers, we fall back to 'window' if 'self'\n// is not available.\nutil.globalScope = (function() {\n if(util.isNodejs) {\n return __webpack_require__.g;\n }\n\n return typeof self === 'undefined' ? window : self;\n})();\n\n// define isArray\nutil.isArray = Array.isArray || function(x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n};\n\n// define isArrayBuffer\nutil.isArrayBuffer = function(x) {\n return typeof ArrayBuffer !== 'undefined' && x instanceof ArrayBuffer;\n};\n\n// define isArrayBufferView\nutil.isArrayBufferView = function(x) {\n return x && util.isArrayBuffer(x.buffer) && x.byteLength !== undefined;\n};\n\n/**\n * Ensure a bits param is 8, 16, 24, or 32. Used to validate input for\n * algorithms where bit manipulation, JavaScript limitations, and/or algorithm\n * design only allow for byte operations of a limited size.\n *\n * @param n number of bits.\n *\n * Throw Error if n invalid.\n */\nfunction _checkBitsParam(n) {\n if(!(n === 8 || n === 16 || n === 24 || n === 32)) {\n throw new Error('Only 8, 16, 24, or 32 bits supported: ' + n);\n }\n}\n\n// TODO: set ByteBuffer to best available backing\nutil.ByteBuffer = ByteStringBuffer;\n\n/** Buffer w/BinaryString backing */\n\n/**\n * Constructor for a binary string backed byte buffer.\n *\n * @param [b] the bytes to wrap (either encoded as string, one byte per\n * character, or as an ArrayBuffer or Typed Array).\n */\nfunction ByteStringBuffer(b) {\n // TODO: update to match DataBuffer API\n\n // the data in this buffer\n this.data = '';\n // the pointer for reading from this buffer\n this.read = 0;\n\n if(typeof b === 'string') {\n this.data = b;\n } else if(util.isArrayBuffer(b) || util.isArrayBufferView(b)) {\n if(typeof Buffer !== 'undefined' && b instanceof Buffer) {\n this.data = b.toString('binary');\n } else {\n // convert native buffer to forge buffer\n // FIXME: support native buffers internally instead\n var arr = new Uint8Array(b);\n try {\n this.data = String.fromCharCode.apply(null, arr);\n } catch(e) {\n for(var i = 0; i < arr.length; ++i) {\n this.putByte(arr[i]);\n }\n }\n }\n } else if(b instanceof ByteStringBuffer ||\n (typeof b === 'object' && typeof b.data === 'string' &&\n typeof b.read === 'number')) {\n // copy existing buffer\n this.data = b.data;\n this.read = b.read;\n }\n\n // used for v8 optimization\n this._constructedStringLength = 0;\n}\nutil.ByteStringBuffer = ByteStringBuffer;\n\n/* Note: This is an optimization for V8-based browsers. When V8 concatenates\n a string, the strings are only joined logically using a \"cons string\" or\n \"constructed/concatenated string\". These containers keep references to one\n another and can result in very large memory usage. For example, if a 2MB\n string is constructed by concatenating 4 bytes together at a time, the\n memory usage will be ~44MB; so ~22x increase. The strings are only joined\n together when an operation requiring their joining takes place, such as\n substr(). This function is called when adding data to this buffer to ensure\n these types of strings are periodically joined to reduce the memory\n footprint. */\nvar _MAX_CONSTRUCTED_STRING_LENGTH = 4096;\nutil.ByteStringBuffer.prototype._optimizeConstructedString = function(x) {\n this._constructedStringLength += x;\n if(this._constructedStringLength > _MAX_CONSTRUCTED_STRING_LENGTH) {\n // this substr() should cause the constructed string to join\n this.data.substr(0, 1);\n this._constructedStringLength = 0;\n }\n};\n\n/**\n * Gets the number of bytes in this buffer.\n *\n * @return the number of bytes in this buffer.\n */\nutil.ByteStringBuffer.prototype.length = function() {\n return this.data.length - this.read;\n};\n\n/**\n * Gets whether or not this buffer is empty.\n *\n * @return true if this buffer is empty, false if not.\n */\nutil.ByteStringBuffer.prototype.isEmpty = function() {\n return this.length() <= 0;\n};\n\n/**\n * Puts a byte in this buffer.\n *\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putByte = function(b) {\n return this.putBytes(String.fromCharCode(b));\n};\n\n/**\n * Puts a byte in this buffer N times.\n *\n * @param b the byte to put.\n * @param n the number of bytes of value b to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.fillWithByte = function(b, n) {\n b = String.fromCharCode(b);\n var d = this.data;\n while(n > 0) {\n if(n & 1) {\n d += b;\n }\n n >>>= 1;\n if(n > 0) {\n b += b;\n }\n }\n this.data = d;\n this._optimizeConstructedString(n);\n return this;\n};\n\n/**\n * Puts bytes in this buffer.\n *\n * @param bytes the bytes (as a binary encoded string) to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putBytes = function(bytes) {\n this.data += bytes;\n this._optimizeConstructedString(bytes.length);\n return this;\n};\n\n/**\n * Puts a UTF-16 encoded string into this buffer.\n *\n * @param str the string to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putString = function(str) {\n return this.putBytes(util.encodeUtf8(str));\n};\n\n/**\n * Puts a 16-bit integer in this buffer in big-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt16 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 24-bit integer in this buffer in big-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt24 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 32-bit integer in this buffer in big-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt32 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 24 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 16-bit integer in this buffer in little-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt16Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF));\n};\n\n/**\n * Puts a 24-bit integer in this buffer in little-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt24Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF));\n};\n\n/**\n * Puts a 32-bit integer in this buffer in little-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt32Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 24 & 0xFF));\n};\n\n/**\n * Puts an n-bit integer in this buffer in big-endian order.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt = function(i, n) {\n _checkBitsParam(n);\n var bytes = '';\n do {\n n -= 8;\n bytes += String.fromCharCode((i >> n) & 0xFF);\n } while(n > 0);\n return this.putBytes(bytes);\n};\n\n/**\n * Puts a signed n-bit integer in this buffer in big-endian order. Two's\n * complement representation is used.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putSignedInt = function(i, n) {\n // putInt checks n\n if(i < 0) {\n i += 2 << (n - 1);\n }\n return this.putInt(i, n);\n};\n\n/**\n * Puts the given buffer into this buffer.\n *\n * @param buffer the buffer to put into this one.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putBuffer = function(buffer) {\n return this.putBytes(buffer.getBytes());\n};\n\n/**\n * Gets a byte from this buffer and advances the read pointer by 1.\n *\n * @return the byte.\n */\nutil.ByteStringBuffer.prototype.getByte = function() {\n return this.data.charCodeAt(this.read++);\n};\n\n/**\n * Gets a uint16 from this buffer in big-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.ByteStringBuffer.prototype.getInt16 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 8 ^\n this.data.charCodeAt(this.read + 1));\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in big-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.ByteStringBuffer.prototype.getInt24 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 16 ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2));\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in big-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.ByteStringBuffer.prototype.getInt32 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 24 ^\n this.data.charCodeAt(this.read + 1) << 16 ^\n this.data.charCodeAt(this.read + 2) << 8 ^\n this.data.charCodeAt(this.read + 3));\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets a uint16 from this buffer in little-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.ByteStringBuffer.prototype.getInt16Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in little-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.ByteStringBuffer.prototype.getInt24Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2) << 16);\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in little-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.ByteStringBuffer.prototype.getInt32Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2) << 16 ^\n this.data.charCodeAt(this.read + 3) << 24);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets an n-bit integer from this buffer in big-endian order and advances the\n * read pointer by ceil(n/8).\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.ByteStringBuffer.prototype.getInt = function(n) {\n _checkBitsParam(n);\n var rval = 0;\n do {\n // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits.\n rval = (rval << 8) + this.data.charCodeAt(this.read++);\n n -= 8;\n } while(n > 0);\n return rval;\n};\n\n/**\n * Gets a signed n-bit integer from this buffer in big-endian order, using\n * two's complement, and advances the read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.ByteStringBuffer.prototype.getSignedInt = function(n) {\n // getInt checks n\n var x = this.getInt(n);\n var max = 2 << (n - 2);\n if(x >= max) {\n x -= max << 1;\n }\n return x;\n};\n\n/**\n * Reads bytes out as a binary encoded string and clears them from the\n * buffer. Note that the resulting string is binary encoded (in node.js this\n * encoding is referred to as `binary`, it is *not* `utf8`).\n *\n * @param count the number of bytes to read, undefined or null for all.\n *\n * @return a binary encoded string of bytes.\n */\nutil.ByteStringBuffer.prototype.getBytes = function(count) {\n var rval;\n if(count) {\n // read count bytes\n count = Math.min(this.length(), count);\n rval = this.data.slice(this.read, this.read + count);\n this.read += count;\n } else if(count === 0) {\n rval = '';\n } else {\n // read all bytes, optimize to only copy when needed\n rval = (this.read === 0) ? this.data : this.data.slice(this.read);\n this.clear();\n }\n return rval;\n};\n\n/**\n * Gets a binary encoded string of the bytes from this buffer without\n * modifying the read pointer.\n *\n * @param count the number of bytes to get, omit to get all.\n *\n * @return a string full of binary encoded characters.\n */\nutil.ByteStringBuffer.prototype.bytes = function(count) {\n return (typeof(count) === 'undefined' ?\n this.data.slice(this.read) :\n this.data.slice(this.read, this.read + count));\n};\n\n/**\n * Gets a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n *\n * @return the byte.\n */\nutil.ByteStringBuffer.prototype.at = function(i) {\n return this.data.charCodeAt(this.read + i);\n};\n\n/**\n * Puts a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.setAt = function(i, b) {\n this.data = this.data.substr(0, this.read + i) +\n String.fromCharCode(b) +\n this.data.substr(this.read + i + 1);\n return this;\n};\n\n/**\n * Gets the last byte without modifying the read pointer.\n *\n * @return the last byte.\n */\nutil.ByteStringBuffer.prototype.last = function() {\n return this.data.charCodeAt(this.data.length - 1);\n};\n\n/**\n * Creates a copy of this buffer.\n *\n * @return the copy.\n */\nutil.ByteStringBuffer.prototype.copy = function() {\n var c = util.createBuffer(this.data);\n c.read = this.read;\n return c;\n};\n\n/**\n * Compacts this buffer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.compact = function() {\n if(this.read > 0) {\n this.data = this.data.slice(this.read);\n this.read = 0;\n }\n return this;\n};\n\n/**\n * Clears this buffer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.clear = function() {\n this.data = '';\n this.read = 0;\n return this;\n};\n\n/**\n * Shortens this buffer by triming bytes off of the end of this buffer.\n *\n * @param count the number of bytes to trim off.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.truncate = function(count) {\n var len = Math.max(0, this.length() - count);\n this.data = this.data.substr(this.read, len);\n this.read = 0;\n return this;\n};\n\n/**\n * Converts this buffer to a hexadecimal string.\n *\n * @return a hexadecimal string.\n */\nutil.ByteStringBuffer.prototype.toHex = function() {\n var rval = '';\n for(var i = this.read; i < this.data.length; ++i) {\n var b = this.data.charCodeAt(i);\n if(b < 16) {\n rval += '0';\n }\n rval += b.toString(16);\n }\n return rval;\n};\n\n/**\n * Converts this buffer to a UTF-16 string (standard JavaScript string).\n *\n * @return a UTF-16 string.\n */\nutil.ByteStringBuffer.prototype.toString = function() {\n return util.decodeUtf8(this.bytes());\n};\n\n/** End Buffer w/BinaryString backing */\n\n/** Buffer w/UInt8Array backing */\n\n/**\n * FIXME: Experimental. Do not use yet.\n *\n * Constructor for an ArrayBuffer-backed byte buffer.\n *\n * The buffer may be constructed from a string, an ArrayBuffer, DataView, or a\n * TypedArray.\n *\n * If a string is given, its encoding should be provided as an option,\n * otherwise it will default to 'binary'. A 'binary' string is encoded such\n * that each character is one byte in length and size.\n *\n * If an ArrayBuffer, DataView, or TypedArray is given, it will be used\n * *directly* without any copying. Note that, if a write to the buffer requires\n * more space, the buffer will allocate a new backing ArrayBuffer to\n * accommodate. The starting read and write offsets for the buffer may be\n * given as options.\n *\n * @param [b] the initial bytes for this buffer.\n * @param options the options to use:\n * [readOffset] the starting read offset to use (default: 0).\n * [writeOffset] the starting write offset to use (default: the\n * length of the first parameter).\n * [growSize] the minimum amount, in bytes, to grow the buffer by to\n * accommodate writes (default: 1024).\n * [encoding] the encoding ('binary', 'utf8', 'utf16', 'hex') for the\n * first parameter, if it is a string (default: 'binary').\n */\nfunction DataBuffer(b, options) {\n // default options\n options = options || {};\n\n // pointers for read from/write to buffer\n this.read = options.readOffset || 0;\n this.growSize = options.growSize || 1024;\n\n var isArrayBuffer = util.isArrayBuffer(b);\n var isArrayBufferView = util.isArrayBufferView(b);\n if(isArrayBuffer || isArrayBufferView) {\n // use ArrayBuffer directly\n if(isArrayBuffer) {\n this.data = new DataView(b);\n } else {\n // TODO: adjust read/write offset based on the type of view\n // or specify that this must be done in the options ... that the\n // offsets are byte-based\n this.data = new DataView(b.buffer, b.byteOffset, b.byteLength);\n }\n this.write = ('writeOffset' in options ?\n options.writeOffset : this.data.byteLength);\n return;\n }\n\n // initialize to empty array buffer and add any given bytes using putBytes\n this.data = new DataView(new ArrayBuffer(0));\n this.write = 0;\n\n if(b !== null && b !== undefined) {\n this.putBytes(b);\n }\n\n if('writeOffset' in options) {\n this.write = options.writeOffset;\n }\n}\nutil.DataBuffer = DataBuffer;\n\n/**\n * Gets the number of bytes in this buffer.\n *\n * @return the number of bytes in this buffer.\n */\nutil.DataBuffer.prototype.length = function() {\n return this.write - this.read;\n};\n\n/**\n * Gets whether or not this buffer is empty.\n *\n * @return true if this buffer is empty, false if not.\n */\nutil.DataBuffer.prototype.isEmpty = function() {\n return this.length() <= 0;\n};\n\n/**\n * Ensures this buffer has enough empty space to accommodate the given number\n * of bytes. An optional parameter may be given that indicates a minimum\n * amount to grow the buffer if necessary. If the parameter is not given,\n * the buffer will be grown by some previously-specified default amount\n * or heuristic.\n *\n * @param amount the number of bytes to accommodate.\n * @param [growSize] the minimum amount, in bytes, to grow the buffer by if\n * necessary.\n */\nutil.DataBuffer.prototype.accommodate = function(amount, growSize) {\n if(this.length() >= amount) {\n return this;\n }\n growSize = Math.max(growSize || this.growSize, amount);\n\n // grow buffer\n var src = new Uint8Array(\n this.data.buffer, this.data.byteOffset, this.data.byteLength);\n var dst = new Uint8Array(this.length() + growSize);\n dst.set(src);\n this.data = new DataView(dst.buffer);\n\n return this;\n};\n\n/**\n * Puts a byte in this buffer.\n *\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putByte = function(b) {\n this.accommodate(1);\n this.data.setUint8(this.write++, b);\n return this;\n};\n\n/**\n * Puts a byte in this buffer N times.\n *\n * @param b the byte to put.\n * @param n the number of bytes of value b to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.fillWithByte = function(b, n) {\n this.accommodate(n);\n for(var i = 0; i < n; ++i) {\n this.data.setUint8(b);\n }\n return this;\n};\n\n/**\n * Puts bytes in this buffer. The bytes may be given as a string, an\n * ArrayBuffer, a DataView, or a TypedArray.\n *\n * @param bytes the bytes to put.\n * @param [encoding] the encoding for the first parameter ('binary', 'utf8',\n * 'utf16', 'hex'), if it is a string (default: 'binary').\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putBytes = function(bytes, encoding) {\n if(util.isArrayBufferView(bytes)) {\n var src = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n var len = src.byteLength - src.byteOffset;\n this.accommodate(len);\n var dst = new Uint8Array(this.data.buffer, this.write);\n dst.set(src);\n this.write += len;\n return this;\n }\n\n if(util.isArrayBuffer(bytes)) {\n var src = new Uint8Array(bytes);\n this.accommodate(src.byteLength);\n var dst = new Uint8Array(this.data.buffer);\n dst.set(src, this.write);\n this.write += src.byteLength;\n return this;\n }\n\n // bytes is a util.DataBuffer or equivalent\n if(bytes instanceof util.DataBuffer ||\n (typeof bytes === 'object' &&\n typeof bytes.read === 'number' && typeof bytes.write === 'number' &&\n util.isArrayBufferView(bytes.data))) {\n var src = new Uint8Array(bytes.data.byteLength, bytes.read, bytes.length());\n this.accommodate(src.byteLength);\n var dst = new Uint8Array(bytes.data.byteLength, this.write);\n dst.set(src);\n this.write += src.byteLength;\n return this;\n }\n\n if(bytes instanceof util.ByteStringBuffer) {\n // copy binary string and process as the same as a string parameter below\n bytes = bytes.data;\n encoding = 'binary';\n }\n\n // string conversion\n encoding = encoding || 'binary';\n if(typeof bytes === 'string') {\n var view;\n\n // decode from string\n if(encoding === 'hex') {\n this.accommodate(Math.ceil(bytes.length / 2));\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.hex.decode(bytes, view, this.write);\n return this;\n }\n if(encoding === 'base64') {\n this.accommodate(Math.ceil(bytes.length / 4) * 3);\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.base64.decode(bytes, view, this.write);\n return this;\n }\n\n // encode text as UTF-8 bytes\n if(encoding === 'utf8') {\n // encode as UTF-8 then decode string as raw binary\n bytes = util.encodeUtf8(bytes);\n encoding = 'binary';\n }\n\n // decode string as raw binary\n if(encoding === 'binary' || encoding === 'raw') {\n // one byte per character\n this.accommodate(bytes.length);\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.raw.decode(view);\n return this;\n }\n\n // encode text as UTF-16 bytes\n if(encoding === 'utf16') {\n // two bytes per character\n this.accommodate(bytes.length * 2);\n view = new Uint16Array(this.data.buffer, this.write);\n this.write += util.text.utf16.encode(view);\n return this;\n }\n\n throw new Error('Invalid encoding: ' + encoding);\n }\n\n throw Error('Invalid parameter: ' + bytes);\n};\n\n/**\n * Puts the given buffer into this buffer.\n *\n * @param buffer the buffer to put into this one.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putBuffer = function(buffer) {\n this.putBytes(buffer);\n buffer.clear();\n return this;\n};\n\n/**\n * Puts a string into this buffer.\n *\n * @param str the string to put.\n * @param [encoding] the encoding for the string (default: 'utf16').\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putString = function(str) {\n return this.putBytes(str, 'utf16');\n};\n\n/**\n * Puts a 16-bit integer in this buffer in big-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt16 = function(i) {\n this.accommodate(2);\n this.data.setInt16(this.write, i);\n this.write += 2;\n return this;\n};\n\n/**\n * Puts a 24-bit integer in this buffer in big-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt24 = function(i) {\n this.accommodate(3);\n this.data.setInt16(this.write, i >> 8 & 0xFFFF);\n this.data.setInt8(this.write, i >> 16 & 0xFF);\n this.write += 3;\n return this;\n};\n\n/**\n * Puts a 32-bit integer in this buffer in big-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt32 = function(i) {\n this.accommodate(4);\n this.data.setInt32(this.write, i);\n this.write += 4;\n return this;\n};\n\n/**\n * Puts a 16-bit integer in this buffer in little-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt16Le = function(i) {\n this.accommodate(2);\n this.data.setInt16(this.write, i, true);\n this.write += 2;\n return this;\n};\n\n/**\n * Puts a 24-bit integer in this buffer in little-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt24Le = function(i) {\n this.accommodate(3);\n this.data.setInt8(this.write, i >> 16 & 0xFF);\n this.data.setInt16(this.write, i >> 8 & 0xFFFF, true);\n this.write += 3;\n return this;\n};\n\n/**\n * Puts a 32-bit integer in this buffer in little-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt32Le = function(i) {\n this.accommodate(4);\n this.data.setInt32(this.write, i, true);\n this.write += 4;\n return this;\n};\n\n/**\n * Puts an n-bit integer in this buffer in big-endian order.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt = function(i, n) {\n _checkBitsParam(n);\n this.accommodate(n / 8);\n do {\n n -= 8;\n this.data.setInt8(this.write++, (i >> n) & 0xFF);\n } while(n > 0);\n return this;\n};\n\n/**\n * Puts a signed n-bit integer in this buffer in big-endian order. Two's\n * complement representation is used.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putSignedInt = function(i, n) {\n _checkBitsParam(n);\n this.accommodate(n / 8);\n if(i < 0) {\n i += 2 << (n - 1);\n }\n return this.putInt(i, n);\n};\n\n/**\n * Gets a byte from this buffer and advances the read pointer by 1.\n *\n * @return the byte.\n */\nutil.DataBuffer.prototype.getByte = function() {\n return this.data.getInt8(this.read++);\n};\n\n/**\n * Gets a uint16 from this buffer in big-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.DataBuffer.prototype.getInt16 = function() {\n var rval = this.data.getInt16(this.read);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in big-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.DataBuffer.prototype.getInt24 = function() {\n var rval = (\n this.data.getInt16(this.read) << 8 ^\n this.data.getInt8(this.read + 2));\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in big-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.DataBuffer.prototype.getInt32 = function() {\n var rval = this.data.getInt32(this.read);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets a uint16 from this buffer in little-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.DataBuffer.prototype.getInt16Le = function() {\n var rval = this.data.getInt16(this.read, true);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in little-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.DataBuffer.prototype.getInt24Le = function() {\n var rval = (\n this.data.getInt8(this.read) ^\n this.data.getInt16(this.read + 1, true) << 8);\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in little-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.DataBuffer.prototype.getInt32Le = function() {\n var rval = this.data.getInt32(this.read, true);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets an n-bit integer from this buffer in big-endian order and advances the\n * read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.DataBuffer.prototype.getInt = function(n) {\n _checkBitsParam(n);\n var rval = 0;\n do {\n // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits.\n rval = (rval << 8) + this.data.getInt8(this.read++);\n n -= 8;\n } while(n > 0);\n return rval;\n};\n\n/**\n * Gets a signed n-bit integer from this buffer in big-endian order, using\n * two's complement, and advances the read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.DataBuffer.prototype.getSignedInt = function(n) {\n // getInt checks n\n var x = this.getInt(n);\n var max = 2 << (n - 2);\n if(x >= max) {\n x -= max << 1;\n }\n return x;\n};\n\n/**\n * Reads bytes out as a binary encoded string and clears them from the\n * buffer.\n *\n * @param count the number of bytes to read, undefined or null for all.\n *\n * @return a binary encoded string of bytes.\n */\nutil.DataBuffer.prototype.getBytes = function(count) {\n // TODO: deprecate this method, it is poorly named and\n // this.toString('binary') replaces it\n // add a toTypedArray()/toArrayBuffer() function\n var rval;\n if(count) {\n // read count bytes\n count = Math.min(this.length(), count);\n rval = this.data.slice(this.read, this.read + count);\n this.read += count;\n } else if(count === 0) {\n rval = '';\n } else {\n // read all bytes, optimize to only copy when needed\n rval = (this.read === 0) ? this.data : this.data.slice(this.read);\n this.clear();\n }\n return rval;\n};\n\n/**\n * Gets a binary encoded string of the bytes from this buffer without\n * modifying the read pointer.\n *\n * @param count the number of bytes to get, omit to get all.\n *\n * @return a string full of binary encoded characters.\n */\nutil.DataBuffer.prototype.bytes = function(count) {\n // TODO: deprecate this method, it is poorly named, add \"getString()\"\n return (typeof(count) === 'undefined' ?\n this.data.slice(this.read) :\n this.data.slice(this.read, this.read + count));\n};\n\n/**\n * Gets a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n *\n * @return the byte.\n */\nutil.DataBuffer.prototype.at = function(i) {\n return this.data.getUint8(this.read + i);\n};\n\n/**\n * Puts a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.setAt = function(i, b) {\n this.data.setUint8(i, b);\n return this;\n};\n\n/**\n * Gets the last byte without modifying the read pointer.\n *\n * @return the last byte.\n */\nutil.DataBuffer.prototype.last = function() {\n return this.data.getUint8(this.write - 1);\n};\n\n/**\n * Creates a copy of this buffer.\n *\n * @return the copy.\n */\nutil.DataBuffer.prototype.copy = function() {\n return new util.DataBuffer(this);\n};\n\n/**\n * Compacts this buffer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.compact = function() {\n if(this.read > 0) {\n var src = new Uint8Array(this.data.buffer, this.read);\n var dst = new Uint8Array(src.byteLength);\n dst.set(src);\n this.data = new DataView(dst);\n this.write -= this.read;\n this.read = 0;\n }\n return this;\n};\n\n/**\n * Clears this buffer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.clear = function() {\n this.data = new DataView(new ArrayBuffer(0));\n this.read = this.write = 0;\n return this;\n};\n\n/**\n * Shortens this buffer by triming bytes off of the end of this buffer.\n *\n * @param count the number of bytes to trim off.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.truncate = function(count) {\n this.write = Math.max(0, this.length() - count);\n this.read = Math.min(this.read, this.write);\n return this;\n};\n\n/**\n * Converts this buffer to a hexadecimal string.\n *\n * @return a hexadecimal string.\n */\nutil.DataBuffer.prototype.toHex = function() {\n var rval = '';\n for(var i = this.read; i < this.data.byteLength; ++i) {\n var b = this.data.getUint8(i);\n if(b < 16) {\n rval += '0';\n }\n rval += b.toString(16);\n }\n return rval;\n};\n\n/**\n * Converts this buffer to a string, using the given encoding. If no\n * encoding is given, 'utf8' (UTF-8) is used.\n *\n * @param [encoding] the encoding to use: 'binary', 'utf8', 'utf16', 'hex',\n * 'base64' (default: 'utf8').\n *\n * @return a string representation of the bytes in this buffer.\n */\nutil.DataBuffer.prototype.toString = function(encoding) {\n var view = new Uint8Array(this.data, this.read, this.length());\n encoding = encoding || 'utf8';\n\n // encode to string\n if(encoding === 'binary' || encoding === 'raw') {\n return util.binary.raw.encode(view);\n }\n if(encoding === 'hex') {\n return util.binary.hex.encode(view);\n }\n if(encoding === 'base64') {\n return util.binary.base64.encode(view);\n }\n\n // decode to text\n if(encoding === 'utf8') {\n return util.text.utf8.decode(view);\n }\n if(encoding === 'utf16') {\n return util.text.utf16.decode(view);\n }\n\n throw new Error('Invalid encoding: ' + encoding);\n};\n\n/** End Buffer w/UInt8Array backing */\n\n/**\n * Creates a buffer that stores bytes. A value may be given to populate the\n * buffer with data. This value can either be string of encoded bytes or a\n * regular string of characters. When passing a string of binary encoded\n * bytes, the encoding `raw` should be given. This is also the default. When\n * passing a string of characters, the encoding `utf8` should be given.\n *\n * @param [input] a string with encoded bytes to store in the buffer.\n * @param [encoding] (default: 'raw', other: 'utf8').\n */\nutil.createBuffer = function(input, encoding) {\n // TODO: deprecate, use new ByteBuffer() instead\n encoding = encoding || 'raw';\n if(input !== undefined && encoding === 'utf8') {\n input = util.encodeUtf8(input);\n }\n return new util.ByteBuffer(input);\n};\n\n/**\n * Fills a string with a particular value. If you want the string to be a byte\n * string, pass in String.fromCharCode(theByte).\n *\n * @param c the character to fill the string with, use String.fromCharCode\n * to fill the string with a byte value.\n * @param n the number of characters of value c to fill with.\n *\n * @return the filled string.\n */\nutil.fillString = function(c, n) {\n var s = '';\n while(n > 0) {\n if(n & 1) {\n s += c;\n }\n n >>>= 1;\n if(n > 0) {\n c += c;\n }\n }\n return s;\n};\n\n/**\n * Performs a per byte XOR between two byte strings and returns the result as a\n * string of bytes.\n *\n * @param s1 first string of bytes.\n * @param s2 second string of bytes.\n * @param n the number of bytes to XOR.\n *\n * @return the XOR'd result.\n */\nutil.xorBytes = function(s1, s2, n) {\n var s3 = '';\n var b = '';\n var t = '';\n var i = 0;\n var c = 0;\n for(; n > 0; --n, ++i) {\n b = s1.charCodeAt(i) ^ s2.charCodeAt(i);\n if(c >= 10) {\n s3 += t;\n t = '';\n c = 0;\n }\n t += String.fromCharCode(b);\n ++c;\n }\n s3 += t;\n return s3;\n};\n\n/**\n * Converts a hex string into a 'binary' encoded string of bytes.\n *\n * @param hex the hexadecimal string to convert.\n *\n * @return the binary-encoded string of bytes.\n */\nutil.hexToBytes = function(hex) {\n // TODO: deprecate: \"Deprecated. Use util.binary.hex.decode instead.\"\n var rval = '';\n var i = 0;\n if(hex.length & 1 == 1) {\n // odd number of characters, convert first character alone\n i = 1;\n rval += String.fromCharCode(parseInt(hex[0], 16));\n }\n // convert 2 characters (1 byte) at a time\n for(; i < hex.length; i += 2) {\n rval += String.fromCharCode(parseInt(hex.substr(i, 2), 16));\n }\n return rval;\n};\n\n/**\n * Converts a 'binary' encoded string of bytes to hex.\n *\n * @param bytes the byte string to convert.\n *\n * @return the string of hexadecimal characters.\n */\nutil.bytesToHex = function(bytes) {\n // TODO: deprecate: \"Deprecated. Use util.binary.hex.encode instead.\"\n return util.createBuffer(bytes).toHex();\n};\n\n/**\n * Converts an 32-bit integer to 4-big-endian byte string.\n *\n * @param i the integer.\n *\n * @return the byte string.\n */\nutil.int32ToBytes = function(i) {\n return (\n String.fromCharCode(i >> 24 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n// base64 characters, reverse mapping\nvar _base64 =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\nvar _base64Idx = [\n/*43 -43 = 0*/\n/*'+', 1, 2, 3,'/' */\n 62, -1, -1, -1, 63,\n\n/*'0','1','2','3','4','5','6','7','8','9' */\n 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,\n\n/*15, 16, 17,'=', 19, 20, 21 */\n -1, -1, -1, 64, -1, -1, -1,\n\n/*65 - 43 = 22*/\n/*'A','B','C','D','E','F','G','H','I','J','K','L','M', */\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,\n\n/*'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' */\n 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\n\n/*91 - 43 = 48 */\n/*48, 49, 50, 51, 52, 53 */\n -1, -1, -1, -1, -1, -1,\n\n/*97 - 43 = 54*/\n/*'a','b','c','d','e','f','g','h','i','j','k','l','m' */\n 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,\n\n/*'n','o','p','q','r','s','t','u','v','w','x','y','z' */\n 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51\n];\n\n// base58 characters (Bitcoin alphabet)\nvar _base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n\n/**\n * Base64 encodes a 'binary' encoded string of bytes.\n *\n * @param input the binary encoded string of bytes to base64-encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the base64-encoded output.\n */\nutil.encode64 = function(input, maxline) {\n // TODO: deprecate: \"Deprecated. Use util.binary.base64.encode instead.\"\n var line = '';\n var output = '';\n var chr1, chr2, chr3;\n var i = 0;\n while(i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n\n // encode 4 character group\n line += _base64.charAt(chr1 >> 2);\n line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4));\n if(isNaN(chr2)) {\n line += '==';\n } else {\n line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6));\n line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63);\n }\n\n if(maxline && line.length > maxline) {\n output += line.substr(0, maxline) + '\\r\\n';\n line = line.substr(maxline);\n }\n }\n output += line;\n return output;\n};\n\n/**\n * Base64 decodes a string into a 'binary' encoded string of bytes.\n *\n * @param input the base64-encoded input.\n *\n * @return the binary encoded string.\n */\nutil.decode64 = function(input) {\n // TODO: deprecate: \"Deprecated. Use util.binary.base64.decode instead.\"\n\n // remove all non-base64 characters\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, '');\n\n var output = '';\n var enc1, enc2, enc3, enc4;\n var i = 0;\n\n while(i < input.length) {\n enc1 = _base64Idx[input.charCodeAt(i++) - 43];\n enc2 = _base64Idx[input.charCodeAt(i++) - 43];\n enc3 = _base64Idx[input.charCodeAt(i++) - 43];\n enc4 = _base64Idx[input.charCodeAt(i++) - 43];\n\n output += String.fromCharCode((enc1 << 2) | (enc2 >> 4));\n if(enc3 !== 64) {\n // decoded at least 2 bytes\n output += String.fromCharCode(((enc2 & 15) << 4) | (enc3 >> 2));\n if(enc4 !== 64) {\n // decoded 3 bytes\n output += String.fromCharCode(((enc3 & 3) << 6) | enc4);\n }\n }\n }\n\n return output;\n};\n\n/**\n * Encodes the given string of characters (a standard JavaScript\n * string) as a binary encoded string where the bytes represent\n * a UTF-8 encoded string of characters. Non-ASCII characters will be\n * encoded as multiple bytes according to UTF-8.\n *\n * @param str a standard string of characters to encode.\n *\n * @return the binary encoded string.\n */\nutil.encodeUtf8 = function(str) {\n return unescape(encodeURIComponent(str));\n};\n\n/**\n * Decodes a binary encoded string that contains bytes that\n * represent a UTF-8 encoded string of characters -- into a\n * string of characters (a standard JavaScript string).\n *\n * @param str the binary encoded string to decode.\n *\n * @return the resulting standard string of characters.\n */\nutil.decodeUtf8 = function(str) {\n return decodeURIComponent(escape(str));\n};\n\n// binary encoding/decoding tools\n// FIXME: Experimental. Do not use yet.\nutil.binary = {\n raw: {},\n hex: {},\n base64: {},\n base58: {},\n baseN : {\n encode: baseN.encode,\n decode: baseN.decode\n }\n};\n\n/**\n * Encodes a Uint8Array as a binary-encoded string. This encoding uses\n * a value between 0 and 255 for each character.\n *\n * @param bytes the Uint8Array to encode.\n *\n * @return the binary-encoded string.\n */\nutil.binary.raw.encode = function(bytes) {\n return String.fromCharCode.apply(null, bytes);\n};\n\n/**\n * Decodes a binary-encoded string to a Uint8Array. This encoding uses\n * a value between 0 and 255 for each character.\n *\n * @param str the binary-encoded string to decode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.raw.decode = function(str, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length);\n }\n offset = offset || 0;\n var j = offset;\n for(var i = 0; i < str.length; ++i) {\n out[j++] = str.charCodeAt(i);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Encodes a 'binary' string, ArrayBuffer, DataView, TypedArray, or\n * ByteBuffer as a string of hexadecimal characters.\n *\n * @param bytes the bytes to convert.\n *\n * @return the string of hexadecimal characters.\n */\nutil.binary.hex.encode = util.bytesToHex;\n\n/**\n * Decodes a hex-encoded string to a Uint8Array.\n *\n * @param hex the hexadecimal string to convert.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.hex.decode = function(hex, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(Math.ceil(hex.length / 2));\n }\n offset = offset || 0;\n var i = 0, j = offset;\n if(hex.length & 1) {\n // odd number of characters, convert first character alone\n i = 1;\n out[j++] = parseInt(hex[0], 16);\n }\n // convert 2 characters (1 byte) at a time\n for(; i < hex.length; i += 2) {\n out[j++] = parseInt(hex.substr(i, 2), 16);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Base64-encodes a Uint8Array.\n *\n * @param input the Uint8Array to encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the base64-encoded output string.\n */\nutil.binary.base64.encode = function(input, maxline) {\n var line = '';\n var output = '';\n var chr1, chr2, chr3;\n var i = 0;\n while(i < input.byteLength) {\n chr1 = input[i++];\n chr2 = input[i++];\n chr3 = input[i++];\n\n // encode 4 character group\n line += _base64.charAt(chr1 >> 2);\n line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4));\n if(isNaN(chr2)) {\n line += '==';\n } else {\n line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6));\n line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63);\n }\n\n if(maxline && line.length > maxline) {\n output += line.substr(0, maxline) + '\\r\\n';\n line = line.substr(maxline);\n }\n }\n output += line;\n return output;\n};\n\n/**\n * Decodes a base64-encoded string to a Uint8Array.\n *\n * @param input the base64-encoded input string.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.base64.decode = function(input, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(Math.ceil(input.length / 4) * 3);\n }\n\n // remove all non-base64 characters\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, '');\n\n offset = offset || 0;\n var enc1, enc2, enc3, enc4;\n var i = 0, j = offset;\n\n while(i < input.length) {\n enc1 = _base64Idx[input.charCodeAt(i++) - 43];\n enc2 = _base64Idx[input.charCodeAt(i++) - 43];\n enc3 = _base64Idx[input.charCodeAt(i++) - 43];\n enc4 = _base64Idx[input.charCodeAt(i++) - 43];\n\n out[j++] = (enc1 << 2) | (enc2 >> 4);\n if(enc3 !== 64) {\n // decoded at least 2 bytes\n out[j++] = ((enc2 & 15) << 4) | (enc3 >> 2);\n if(enc4 !== 64) {\n // decoded 3 bytes\n out[j++] = ((enc3 & 3) << 6) | enc4;\n }\n }\n }\n\n // make sure result is the exact decoded length\n return output ? (j - offset) : out.subarray(0, j);\n};\n\n// add support for base58 encoding/decoding with Bitcoin alphabet\nutil.binary.base58.encode = function(input, maxline) {\n return util.binary.baseN.encode(input, _base58, maxline);\n};\nutil.binary.base58.decode = function(input, maxline) {\n return util.binary.baseN.decode(input, _base58, maxline);\n};\n\n// text encoding/decoding tools\n// FIXME: Experimental. Do not use yet.\nutil.text = {\n utf8: {},\n utf16: {}\n};\n\n/**\n * Encodes the given string as UTF-8 in a Uint8Array.\n *\n * @param str the string to encode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.text.utf8.encode = function(str, output, offset) {\n str = util.encodeUtf8(str);\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length);\n }\n offset = offset || 0;\n var j = offset;\n for(var i = 0; i < str.length; ++i) {\n out[j++] = str.charCodeAt(i);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Decodes the UTF-8 contents from a Uint8Array.\n *\n * @param bytes the Uint8Array to decode.\n *\n * @return the resulting string.\n */\nutil.text.utf8.decode = function(bytes) {\n return util.decodeUtf8(String.fromCharCode.apply(null, bytes));\n};\n\n/**\n * Encodes the given string as UTF-16 in a Uint8Array.\n *\n * @param str the string to encode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.text.utf16.encode = function(str, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length * 2);\n }\n var view = new Uint16Array(out.buffer);\n offset = offset || 0;\n var j = offset;\n var k = offset;\n for(var i = 0; i < str.length; ++i) {\n view[k++] = str.charCodeAt(i);\n j += 2;\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Decodes the UTF-16 contents from a Uint8Array.\n *\n * @param bytes the Uint8Array to decode.\n *\n * @return the resulting string.\n */\nutil.text.utf16.decode = function(bytes) {\n return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer));\n};\n\n/**\n * Deflates the given data using a flash interface.\n *\n * @param api the flash interface.\n * @param bytes the data.\n * @param raw true to return only raw deflate data, false to include zlib\n * header and trailer.\n *\n * @return the deflated data as a string.\n */\nutil.deflate = function(api, bytes, raw) {\n bytes = util.decode64(api.deflate(util.encode64(bytes)).rval);\n\n // strip zlib header and trailer if necessary\n if(raw) {\n // zlib header is 2 bytes (CMF,FLG) where FLG indicates that\n // there is a 4-byte DICT (alder-32) block before the data if\n // its 5th bit is set\n var start = 2;\n var flg = bytes.charCodeAt(1);\n if(flg & 0x20) {\n start = 6;\n }\n // zlib trailer is 4 bytes of adler-32\n bytes = bytes.substring(start, bytes.length - 4);\n }\n\n return bytes;\n};\n\n/**\n * Inflates the given data using a flash interface.\n *\n * @param api the flash interface.\n * @param bytes the data.\n * @param raw true if the incoming data has no zlib header or trailer and is\n * raw DEFLATE data.\n *\n * @return the inflated data as a string, null on error.\n */\nutil.inflate = function(api, bytes, raw) {\n // TODO: add zlib header and trailer if necessary/possible\n var rval = api.inflate(util.encode64(bytes)).rval;\n return (rval === null) ? null : util.decode64(rval);\n};\n\n/**\n * Sets a storage object.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param obj the storage object, null to remove.\n */\nvar _setStorageObject = function(api, id, obj) {\n if(!api) {\n throw new Error('WebStorage not available.');\n }\n\n var rval;\n if(obj === null) {\n rval = api.removeItem(id);\n } else {\n // json-encode and base64-encode object\n obj = util.encode64(JSON.stringify(obj));\n rval = api.setItem(id, obj);\n }\n\n // handle potential flash error\n if(typeof(rval) !== 'undefined' && rval.rval !== true) {\n var error = new Error(rval.error.message);\n error.id = rval.error.id;\n error.name = rval.error.name;\n throw error;\n }\n};\n\n/**\n * Gets a storage object.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n *\n * @return the storage object entry or null if none exists.\n */\nvar _getStorageObject = function(api, id) {\n if(!api) {\n throw new Error('WebStorage not available.');\n }\n\n // get the existing entry\n var rval = api.getItem(id);\n\n /* Note: We check api.init because we can't do (api == localStorage)\n on IE because of \"Class doesn't support Automation\" exception. Only\n the flash api has an init method so this works too, but we need a\n better solution in the future. */\n\n // flash returns item wrapped in an object, handle special case\n if(api.init) {\n if(rval.rval === null) {\n if(rval.error) {\n var error = new Error(rval.error.message);\n error.id = rval.error.id;\n error.name = rval.error.name;\n throw error;\n }\n // no error, but also no item\n rval = null;\n } else {\n rval = rval.rval;\n }\n }\n\n // handle decoding\n if(rval !== null) {\n // base64-decode and json-decode data\n rval = JSON.parse(util.decode64(rval));\n }\n\n return rval;\n};\n\n/**\n * Stores an item in local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param data the data for the item (any javascript object/primitive).\n */\nvar _setItem = function(api, id, key, data) {\n // get storage object\n var obj = _getStorageObject(api, id);\n if(obj === null) {\n // create a new storage object\n obj = {};\n }\n // update key\n obj[key] = data;\n\n // set storage object\n _setStorageObject(api, id, obj);\n};\n\n/**\n * Gets an item from local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n *\n * @return the item.\n */\nvar _getItem = function(api, id, key) {\n // get storage object\n var rval = _getStorageObject(api, id);\n if(rval !== null) {\n // return data at key\n rval = (key in rval) ? rval[key] : null;\n }\n\n return rval;\n};\n\n/**\n * Removes an item from local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n */\nvar _removeItem = function(api, id, key) {\n // get storage object\n var obj = _getStorageObject(api, id);\n if(obj !== null && key in obj) {\n // remove key\n delete obj[key];\n\n // see if entry has no keys remaining\n var empty = true;\n for(var prop in obj) {\n empty = false;\n break;\n }\n if(empty) {\n // remove entry entirely if no keys are left\n obj = null;\n }\n\n // set storage object\n _setStorageObject(api, id, obj);\n }\n};\n\n/**\n * Clears the local disk storage identified by the given ID.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n */\nvar _clearItems = function(api, id) {\n _setStorageObject(api, id, null);\n};\n\n/**\n * Calls a storage function.\n *\n * @param func the function to call.\n * @param args the arguments for the function.\n * @param location the location argument.\n *\n * @return the return value from the function.\n */\nvar _callStorageFunction = function(func, args, location) {\n var rval = null;\n\n // default storage types\n if(typeof(location) === 'undefined') {\n location = ['web', 'flash'];\n }\n\n // apply storage types in order of preference\n var type;\n var done = false;\n var exception = null;\n for(var idx in location) {\n type = location[idx];\n try {\n if(type === 'flash' || type === 'both') {\n if(args[0] === null) {\n throw new Error('Flash local storage not available.');\n }\n rval = func.apply(this, args);\n done = (type === 'flash');\n }\n if(type === 'web' || type === 'both') {\n args[0] = localStorage;\n rval = func.apply(this, args);\n done = true;\n }\n } catch(ex) {\n exception = ex;\n }\n if(done) {\n break;\n }\n }\n\n if(!done) {\n throw exception;\n }\n\n return rval;\n};\n\n/**\n * Stores an item on local disk.\n *\n * The available types of local storage include 'flash', 'web', and 'both'.\n *\n * The type 'flash' refers to flash local storage (SharedObject). In order\n * to use flash local storage, the 'api' parameter must be valid. The type\n * 'web' refers to WebStorage, if supported by the browser. The type 'both'\n * refers to storing using both 'flash' and 'web', not just one or the\n * other.\n *\n * The location array should list the storage types to use in order of\n * preference:\n *\n * ['flash']: flash only storage\n * ['web']: web only storage\n * ['both']: try to store in both\n * ['flash','web']: store in flash first, but if not available, 'web'\n * ['web','flash']: store in web first, but if not available, 'flash'\n *\n * The location array defaults to: ['web', 'flash']\n *\n * @param api the flash interface, null to use only WebStorage.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param data the data for the item (any javascript object/primitive).\n * @param location an array with the preferred types of storage to use.\n */\nutil.setItem = function(api, id, key, data, location) {\n _callStorageFunction(_setItem, arguments, location);\n};\n\n/**\n * Gets an item on local disk.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface, null to use only WebStorage.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param location an array with the preferred types of storage to use.\n *\n * @return the item.\n */\nutil.getItem = function(api, id, key, location) {\n return _callStorageFunction(_getItem, arguments, location);\n};\n\n/**\n * Removes an item on local disk.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param location an array with the preferred types of storage to use.\n */\nutil.removeItem = function(api, id, key, location) {\n _callStorageFunction(_removeItem, arguments, location);\n};\n\n/**\n * Clears the local disk storage identified by the given ID.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface if flash is available.\n * @param id the storage ID to use.\n * @param location an array with the preferred types of storage to use.\n */\nutil.clearItems = function(api, id, location) {\n _callStorageFunction(_clearItems, arguments, location);\n};\n\n/**\n * Check if an object is empty.\n *\n * Taken from:\n * http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json/679937#679937\n *\n * @param object the object to check.\n */\nutil.isEmpty = function(obj) {\n for(var prop in obj) {\n if(obj.hasOwnProperty(prop)) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * Format with simple printf-style interpolation.\n *\n * %%: literal '%'\n * %s,%o: convert next argument into a string.\n *\n * @param format the string to format.\n * @param ... arguments to interpolate into the format string.\n */\nutil.format = function(format) {\n var re = /%./g;\n // current match\n var match;\n // current part\n var part;\n // current arg index\n var argi = 0;\n // collected parts to recombine later\n var parts = [];\n // last index found\n var last = 0;\n // loop while matches remain\n while((match = re.exec(format))) {\n part = format.substring(last, re.lastIndex - 2);\n // don't add empty strings (ie, parts between %s%s)\n if(part.length > 0) {\n parts.push(part);\n }\n last = re.lastIndex;\n // switch on % code\n var code = match[0][1];\n switch(code) {\n case 's':\n case 'o':\n // check if enough arguments were given\n if(argi < arguments.length) {\n parts.push(arguments[argi++ + 1]);\n } else {\n parts.push('');\n }\n break;\n // FIXME: do proper formating for numbers, etc\n //case 'f':\n //case 'd':\n case '%':\n parts.push('%');\n break;\n default:\n parts.push('<%' + code + '?>');\n }\n }\n // add trailing part of format string\n parts.push(format.substring(last));\n return parts.join('');\n};\n\n/**\n * Formats a number.\n *\n * http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/\n */\nutil.formatNumber = function(number, decimals, dec_point, thousands_sep) {\n // http://kevin.vanzonneveld.net\n // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)\n // + bugfix by: Michael White (http://crestidg.com)\n // + bugfix by: Benjamin Lupton\n // + bugfix by: Allan Jensen (http://www.winternet.no)\n // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // * example 1: number_format(1234.5678, 2, '.', '');\n // * returns 1: 1234.57\n\n var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;\n var d = dec_point === undefined ? ',' : dec_point;\n var t = thousands_sep === undefined ?\n '.' : thousands_sep, s = n < 0 ? '-' : '';\n var i = parseInt((n = Math.abs(+n || 0).toFixed(c)), 10) + '';\n var j = (i.length > 3) ? i.length % 3 : 0;\n return s + (j ? i.substr(0, j) + t : '') +\n i.substr(j).replace(/(\\d{3})(?=\\d)/g, '$1' + t) +\n (c ? d + Math.abs(n - i).toFixed(c).slice(2) : '');\n};\n\n/**\n * Formats a byte size.\n *\n * http://snipplr.com/view/5949/format-humanize-file-byte-size-presentation-in-javascript/\n */\nutil.formatSize = function(size) {\n if(size >= 1073741824) {\n size = util.formatNumber(size / 1073741824, 2, '.', '') + ' GiB';\n } else if(size >= 1048576) {\n size = util.formatNumber(size / 1048576, 2, '.', '') + ' MiB';\n } else if(size >= 1024) {\n size = util.formatNumber(size / 1024, 0) + ' KiB';\n } else {\n size = util.formatNumber(size, 0) + ' bytes';\n }\n return size;\n};\n\n/**\n * Converts an IPv4 or IPv6 string representation into bytes (in network order).\n *\n * @param ip the IPv4 or IPv6 address to convert.\n *\n * @return the 4-byte IPv6 or 16-byte IPv6 address or null if the address can't\n * be parsed.\n */\nutil.bytesFromIP = function(ip) {\n if(ip.indexOf('.') !== -1) {\n return util.bytesFromIPv4(ip);\n }\n if(ip.indexOf(':') !== -1) {\n return util.bytesFromIPv6(ip);\n }\n return null;\n};\n\n/**\n * Converts an IPv4 string representation into bytes (in network order).\n *\n * @param ip the IPv4 address to convert.\n *\n * @return the 4-byte address or null if the address can't be parsed.\n */\nutil.bytesFromIPv4 = function(ip) {\n ip = ip.split('.');\n if(ip.length !== 4) {\n return null;\n }\n var b = util.createBuffer();\n for(var i = 0; i < ip.length; ++i) {\n var num = parseInt(ip[i], 10);\n if(isNaN(num)) {\n return null;\n }\n b.putByte(num);\n }\n return b.getBytes();\n};\n\n/**\n * Converts an IPv6 string representation into bytes (in network order).\n *\n * @param ip the IPv6 address to convert.\n *\n * @return the 16-byte address or null if the address can't be parsed.\n */\nutil.bytesFromIPv6 = function(ip) {\n var blanks = 0;\n ip = ip.split(':').filter(function(e) {\n if(e.length === 0) ++blanks;\n return true;\n });\n var zeros = (8 - ip.length + blanks) * 2;\n var b = util.createBuffer();\n for(var i = 0; i < 8; ++i) {\n if(!ip[i] || ip[i].length === 0) {\n b.fillWithByte(0, zeros);\n zeros = 0;\n continue;\n }\n var bytes = util.hexToBytes(ip[i]);\n if(bytes.length < 2) {\n b.putByte(0);\n }\n b.putBytes(bytes);\n }\n return b.getBytes();\n};\n\n/**\n * Converts 4-bytes into an IPv4 string representation or 16-bytes into\n * an IPv6 string representation. The bytes must be in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv4 or IPv6 string representation if 4 or 16 bytes,\n * respectively, are given, otherwise null.\n */\nutil.bytesToIP = function(bytes) {\n if(bytes.length === 4) {\n return util.bytesToIPv4(bytes);\n }\n if(bytes.length === 16) {\n return util.bytesToIPv6(bytes);\n }\n return null;\n};\n\n/**\n * Converts 4-bytes into an IPv4 string representation. The bytes must be\n * in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv4 string representation or null for an invalid # of bytes.\n */\nutil.bytesToIPv4 = function(bytes) {\n if(bytes.length !== 4) {\n return null;\n }\n var ip = [];\n for(var i = 0; i < bytes.length; ++i) {\n ip.push(bytes.charCodeAt(i));\n }\n return ip.join('.');\n};\n\n/**\n * Converts 16-bytes into an IPv16 string representation. The bytes must be\n * in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv16 string representation or null for an invalid # of bytes.\n */\nutil.bytesToIPv6 = function(bytes) {\n if(bytes.length !== 16) {\n return null;\n }\n var ip = [];\n var zeroGroups = [];\n var zeroMaxGroup = 0;\n for(var i = 0; i < bytes.length; i += 2) {\n var hex = util.bytesToHex(bytes[i] + bytes[i + 1]);\n // canonicalize zero representation\n while(hex[0] === '0' && hex !== '0') {\n hex = hex.substr(1);\n }\n if(hex === '0') {\n var last = zeroGroups[zeroGroups.length - 1];\n var idx = ip.length;\n if(!last || idx !== last.end + 1) {\n zeroGroups.push({start: idx, end: idx});\n } else {\n last.end = idx;\n if((last.end - last.start) >\n (zeroGroups[zeroMaxGroup].end - zeroGroups[zeroMaxGroup].start)) {\n zeroMaxGroup = zeroGroups.length - 1;\n }\n }\n }\n ip.push(hex);\n }\n if(zeroGroups.length > 0) {\n var group = zeroGroups[zeroMaxGroup];\n // only shorten group of length > 0\n if(group.end - group.start > 0) {\n ip.splice(group.start, group.end - group.start + 1, '');\n if(group.start === 0) {\n ip.unshift('');\n }\n if(group.end === 7) {\n ip.push('');\n }\n }\n }\n return ip.join(':');\n};\n\n/**\n * Estimates the number of processes that can be run concurrently. If\n * creating Web Workers, keep in mind that the main JavaScript process needs\n * its own core.\n *\n * @param options the options to use:\n * update true to force an update (not use the cached value).\n * @param callback(err, max) called once the operation completes.\n */\nutil.estimateCores = function(options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n if('cores' in util && !options.update) {\n return callback(null, util.cores);\n }\n if(typeof navigator !== 'undefined' &&\n 'hardwareConcurrency' in navigator &&\n navigator.hardwareConcurrency > 0) {\n util.cores = navigator.hardwareConcurrency;\n return callback(null, util.cores);\n }\n if(typeof Worker === 'undefined') {\n // workers not available\n util.cores = 1;\n return callback(null, util.cores);\n }\n if(typeof Blob === 'undefined') {\n // can't estimate, default to 2\n util.cores = 2;\n return callback(null, util.cores);\n }\n\n // create worker concurrency estimation code as blob\n var blobUrl = URL.createObjectURL(new Blob(['(',\n function() {\n self.addEventListener('message', function(e) {\n // run worker for 4 ms\n var st = Date.now();\n var et = st + 4;\n while(Date.now() < et);\n self.postMessage({st: st, et: et});\n });\n }.toString(),\n ')()'], {type: 'application/javascript'}));\n\n // take 5 samples using 16 workers\n sample([], 5, 16);\n\n function sample(max, samples, numWorkers) {\n if(samples === 0) {\n // get overlap average\n var avg = Math.floor(max.reduce(function(avg, x) {\n return avg + x;\n }, 0) / max.length);\n util.cores = Math.max(1, avg);\n URL.revokeObjectURL(blobUrl);\n return callback(null, util.cores);\n }\n map(numWorkers, function(err, results) {\n max.push(reduce(numWorkers, results));\n sample(max, samples - 1, numWorkers);\n });\n }\n\n function map(numWorkers, callback) {\n var workers = [];\n var results = [];\n for(var i = 0; i < numWorkers; ++i) {\n var worker = new Worker(blobUrl);\n worker.addEventListener('message', function(e) {\n results.push(e.data);\n if(results.length === numWorkers) {\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].terminate();\n }\n callback(null, results);\n }\n });\n workers.push(worker);\n }\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].postMessage(i);\n }\n }\n\n function reduce(numWorkers, results) {\n // find overlapping time windows\n var overlaps = [];\n for(var n = 0; n < numWorkers; ++n) {\n var r1 = results[n];\n var overlap = overlaps[n] = [];\n for(var i = 0; i < numWorkers; ++i) {\n if(n === i) {\n continue;\n }\n var r2 = results[i];\n if((r1.st > r2.st && r1.st < r2.et) ||\n (r2.st > r1.st && r2.st < r1.et)) {\n overlap.push(i);\n }\n }\n }\n // get maximum overlaps ... don't include overlapping worker itself\n // as the main JS process was also being scheduled during the work and\n // would have to be subtracted from the estimate anyway\n return overlaps.reduce(function(max, overlap) {\n return Math.max(max, overlap.length);\n }, 0);\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/node-forge/lib/util.js?"); + +/***/ }), + +/***/ "./node_modules/protobufjs/src/reader.js": +/*!***********************************************!*\ + !*** ./node_modules/protobufjs/src/reader.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = Reader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n\n\n//# sourceURL=webpack://light/./node_modules/protobufjs/src/reader.js?"); + +/***/ }), + +/***/ "./node_modules/protobufjs/src/reader_buffer.js": +/*!******************************************************!*\ + !*** ./node_modules/protobufjs/src/reader_buffer.js ***! + \******************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = __webpack_require__(/*! ./reader */ \"./node_modules/protobufjs/src/reader.js\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n\n\n//# sourceURL=webpack://light/./node_modules/protobufjs/src/reader_buffer.js?"); + +/***/ }), + +/***/ "./node_modules/protobufjs/src/util/longbits.js": +/*!******************************************************!*\ + !*** ./node_modules/protobufjs/src/util/longbits.js ***! + \******************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = LongBits;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/protobufjs/src/util/longbits.js?"); + +/***/ }), + +/***/ "./node_modules/protobufjs/src/util/minimal.js": +/*!*****************************************************!*\ + !*** ./node_modules/protobufjs/src/util/minimal.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +eval("\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = __webpack_require__(/*! @protobufjs/aspromise */ \"./node_modules/@protobufjs/aspromise/index.js\");\n\n// converts to / from base64 encoded strings\nutil.base64 = __webpack_require__(/*! @protobufjs/base64 */ \"./node_modules/@protobufjs/base64/index.js\");\n\n// base class of rpc.Service\nutil.EventEmitter = __webpack_require__(/*! @protobufjs/eventemitter */ \"./node_modules/@protobufjs/eventemitter/index.js\");\n\n// float handling accross browsers\nutil.float = __webpack_require__(/*! @protobufjs/float */ \"./node_modules/@protobufjs/float/index.js\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = __webpack_require__(/*! @protobufjs/inquire */ \"./node_modules/@protobufjs/inquire/index.js\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = __webpack_require__(/*! @protobufjs/utf8 */ \"./node_modules/@protobufjs/utf8/index.js\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = __webpack_require__(/*! @protobufjs/pool */ \"./node_modules/@protobufjs/pool/index.js\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = __webpack_require__(/*! ./longbits */ \"./node_modules/protobufjs/src/util/longbits.js\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof __webpack_require__.g !== \"undefined\"\n && __webpack_require__.g\n && __webpack_require__.g.process\n && __webpack_require__.g.process.versions\n && __webpack_require__.g.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && __webpack_require__.g\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n CustomError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n enumerable: false,\n configurable: true,\n },\n name: {\n get: function get() { return name; },\n set: undefined,\n enumerable: false,\n // configurable: false would accurately preserve the behavior of\n // the original, but I'm guessing that was not intentional.\n // For an actual error subclass, this property would\n // be configurable.\n configurable: true,\n },\n toString: {\n value: function value() { return this.name + \": \" + this.message; },\n writable: true,\n enumerable: false,\n configurable: true,\n },\n });\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n\n\n//# sourceURL=webpack://light/./node_modules/protobufjs/src/util/minimal.js?"); + +/***/ }), + +/***/ "./node_modules/protobufjs/src/writer.js": +/*!***********************************************!*\ + !*** ./node_modules/protobufjs/src/writer.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = Writer;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n\n\n//# sourceURL=webpack://light/./node_modules/protobufjs/src/writer.js?"); + +/***/ }), + +/***/ "./node_modules/protobufjs/src/writer_buffer.js": +/*!******************************************************!*\ + !*** ./node_modules/protobufjs/src/writer_buffer.js ***! + \******************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = __webpack_require__(/*! ./writer */ \"./node_modules/protobufjs/src/writer.js\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n\n\n//# sourceURL=webpack://light/./node_modules/protobufjs/src/writer_buffer.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/index.js ***! + \*****************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterRedis = __webpack_require__(/*! ./lib/RateLimiterRedis */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRedis.js\");\nconst RateLimiterMongo = __webpack_require__(/*! ./lib/RateLimiterMongo */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterMongo.js\");\nconst RateLimiterMySQL = __webpack_require__(/*! ./lib/RateLimiterMySQL */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterMySQL.js\");\nconst RateLimiterPostgres = __webpack_require__(/*! ./lib/RateLimiterPostgres */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterPostgres.js\");\nconst {RateLimiterClusterMaster, RateLimiterClusterMasterPM2, RateLimiterCluster} = __webpack_require__(/*! ./lib/RateLimiterCluster */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterCluster.js\");\nconst RateLimiterMemory = __webpack_require__(/*! ./lib/RateLimiterMemory */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterMemory.js\");\nconst RateLimiterMemcache = __webpack_require__(/*! ./lib/RateLimiterMemcache */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterMemcache.js\");\nconst RLWrapperBlackAndWhite = __webpack_require__(/*! ./lib/RLWrapperBlackAndWhite */ \"./node_modules/rate-limiter-flexible/lib/RLWrapperBlackAndWhite.js\");\nconst RateLimiterUnion = __webpack_require__(/*! ./lib/RateLimiterUnion */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterUnion.js\");\nconst RateLimiterQueue = __webpack_require__(/*! ./lib/RateLimiterQueue */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterQueue.js\");\nconst BurstyRateLimiter = __webpack_require__(/*! ./lib/BurstyRateLimiter */ \"./node_modules/rate-limiter-flexible/lib/BurstyRateLimiter.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./lib/RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nmodule.exports = {\n RateLimiterRedis,\n RateLimiterMongo,\n RateLimiterMySQL,\n RateLimiterPostgres,\n RateLimiterMemory,\n RateLimiterMemcache,\n RateLimiterClusterMaster,\n RateLimiterClusterMasterPM2,\n RateLimiterCluster,\n RLWrapperBlackAndWhite,\n RateLimiterUnion,\n RateLimiterQueue,\n BurstyRateLimiter,\n RateLimiterRes,\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/index.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/BurstyRateLimiter.js": +/*!*********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/BurstyRateLimiter.js ***! + \*********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\n/**\n * Bursty rate limiter exposes only msBeforeNext time and doesn't expose points from bursty limiter by default\n * @type {BurstyRateLimiter}\n */\nmodule.exports = class BurstyRateLimiter {\n constructor(rateLimiter, burstLimiter) {\n this._rateLimiter = rateLimiter;\n this._burstLimiter = burstLimiter\n }\n\n /**\n * Merge rate limiter response objects. Responses can be null\n *\n * @param {RateLimiterRes} [rlRes] Rate limiter response\n * @param {RateLimiterRes} [blRes] Bursty limiter response\n */\n _combineRes(rlRes, blRes) {\n return new RateLimiterRes(\n rlRes.remainingPoints,\n Math.min(rlRes.msBeforeNext, blRes.msBeforeNext),\n rlRes.consumedPoints,\n rlRes.isFirstInDuration\n )\n }\n\n /**\n * @param key\n * @param pointsToConsume\n * @param options\n * @returns {Promise}\n */\n consume(key, pointsToConsume = 1, options = {}) {\n return this._rateLimiter.consume(key, pointsToConsume, options)\n .catch((rlRej) => {\n if (rlRej instanceof RateLimiterRes) {\n return this._burstLimiter.consume(key, pointsToConsume, options)\n .then((blRes) => {\n return Promise.resolve(this._combineRes(rlRej, blRes))\n })\n .catch((blRej) => {\n if (blRej instanceof RateLimiterRes) {\n return Promise.reject(this._combineRes(rlRej, blRej))\n } else {\n return Promise.reject(blRej)\n }\n }\n )\n } else {\n return Promise.reject(rlRej)\n }\n })\n }\n\n /**\n * It doesn't expose available points from burstLimiter\n *\n * @param key\n * @returns {Promise}\n */\n get(key) {\n return Promise.all([\n this._rateLimiter.get(key),\n this._burstLimiter.get(key),\n ]).then(([rlRes, blRes]) => {\n return this._combineRes(rlRes, blRes);\n });\n }\n\n get points() {\n return this._rateLimiter.points;\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/BurstyRateLimiter.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RLWrapperBlackAndWhite.js": +/*!**************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RLWrapperBlackAndWhite.js ***! + \**************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nmodule.exports = class RLWrapperBlackAndWhite {\n constructor(opts = {}) {\n this.limiter = opts.limiter;\n this.blackList = opts.blackList;\n this.whiteList = opts.whiteList;\n this.isBlackListed = opts.isBlackListed;\n this.isWhiteListed = opts.isWhiteListed;\n this.runActionAnyway = opts.runActionAnyway;\n }\n\n get limiter() {\n return this._limiter;\n }\n\n set limiter(value) {\n if (typeof value === 'undefined') {\n throw new Error('limiter is not set');\n }\n\n this._limiter = value;\n }\n\n get runActionAnyway() {\n return this._runActionAnyway;\n }\n\n set runActionAnyway(value) {\n this._runActionAnyway = typeof value === 'undefined' ? false : value;\n }\n\n get blackList() {\n return this._blackList;\n }\n\n set blackList(value) {\n this._blackList = Array.isArray(value) ? value : [];\n }\n\n get isBlackListed() {\n return this._isBlackListed;\n }\n\n set isBlackListed(func) {\n if (typeof func === 'undefined') {\n func = () => false;\n }\n if (typeof func !== 'function') {\n throw new Error('isBlackListed must be function');\n }\n this._isBlackListed = func;\n }\n\n get whiteList() {\n return this._whiteList;\n }\n\n set whiteList(value) {\n this._whiteList = Array.isArray(value) ? value : [];\n }\n\n get isWhiteListed() {\n return this._isWhiteListed;\n }\n\n set isWhiteListed(func) {\n if (typeof func === 'undefined') {\n func = () => false;\n }\n if (typeof func !== 'function') {\n throw new Error('isWhiteListed must be function');\n }\n this._isWhiteListed = func;\n }\n\n isBlackListedSomewhere(key) {\n return this.blackList.indexOf(key) >= 0 || this.isBlackListed(key);\n }\n\n isWhiteListedSomewhere(key) {\n return this.whiteList.indexOf(key) >= 0 || this.isWhiteListed(key);\n }\n\n getBlackRes() {\n return new RateLimiterRes(0, Number.MAX_SAFE_INTEGER, 0, false);\n }\n\n getWhiteRes() {\n return new RateLimiterRes(Number.MAX_SAFE_INTEGER, 0, 0, false);\n }\n\n rejectBlack() {\n return Promise.reject(this.getBlackRes());\n }\n\n resolveBlack() {\n return Promise.resolve(this.getBlackRes());\n }\n\n resolveWhite() {\n return Promise.resolve(this.getWhiteRes());\n }\n\n consume(key, pointsToConsume = 1) {\n let res;\n if (this.isWhiteListedSomewhere(key)) {\n res = this.resolveWhite();\n } else if (this.isBlackListedSomewhere(key)) {\n res = this.rejectBlack();\n }\n\n if (typeof res === 'undefined') {\n return this.limiter.consume(key, pointsToConsume);\n }\n\n if (this.runActionAnyway) {\n this.limiter.consume(key, pointsToConsume).catch(() => {});\n }\n return res;\n }\n\n block(key, secDuration) {\n let res;\n if (this.isWhiteListedSomewhere(key)) {\n res = this.resolveWhite();\n } else if (this.isBlackListedSomewhere(key)) {\n res = this.resolveBlack();\n }\n\n if (typeof res === 'undefined') {\n return this.limiter.block(key, secDuration);\n }\n\n if (this.runActionAnyway) {\n this.limiter.block(key, secDuration).catch(() => {});\n }\n return res;\n }\n\n penalty(key, points) {\n let res;\n if (this.isWhiteListedSomewhere(key)) {\n res = this.resolveWhite();\n } else if (this.isBlackListedSomewhere(key)) {\n res = this.resolveBlack();\n }\n\n if (typeof res === 'undefined') {\n return this.limiter.penalty(key, points);\n }\n\n if (this.runActionAnyway) {\n this.limiter.penalty(key, points).catch(() => {});\n }\n return res;\n }\n\n reward(key, points) {\n let res;\n if (this.isWhiteListedSomewhere(key)) {\n res = this.resolveWhite();\n } else if (this.isBlackListedSomewhere(key)) {\n res = this.resolveBlack();\n }\n\n if (typeof res === 'undefined') {\n return this.limiter.reward(key, points);\n }\n\n if (this.runActionAnyway) {\n this.limiter.reward(key, points).catch(() => {});\n }\n return res;\n }\n\n get(key) {\n let res;\n if (this.isWhiteListedSomewhere(key)) {\n res = this.resolveWhite();\n } else if (this.isBlackListedSomewhere(key)) {\n res = this.resolveBlack();\n }\n\n if (typeof res === 'undefined' || this.runActionAnyway) {\n return this.limiter.get(key);\n }\n\n return res;\n }\n\n delete(key) {\n return this.limiter.delete(key);\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RLWrapperBlackAndWhite.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js": +/*!***********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js ***! + \***********************************************************************/ +/***/ ((module) => { + +eval("module.exports = class RateLimiterAbstract {\n /**\n *\n * @param opts Object Defaults {\n * points: 4, // Number of points\n * duration: 1, // Per seconds\n * blockDuration: 0, // Block if consumed more than points in current duration for blockDuration seconds\n * execEvenly: false, // Execute allowed actions evenly over duration\n * execEvenlyMinDelayMs: duration * 1000 / points, // ms, works with execEvenly=true option\n * keyPrefix: 'rlflx',\n * }\n */\n constructor(opts = {}) {\n this.points = opts.points;\n this.duration = opts.duration;\n this.blockDuration = opts.blockDuration;\n this.execEvenly = opts.execEvenly;\n this.execEvenlyMinDelayMs = opts.execEvenlyMinDelayMs;\n this.keyPrefix = opts.keyPrefix;\n }\n\n get points() {\n return this._points;\n }\n\n set points(value) {\n this._points = value >= 0 ? value : 4;\n }\n\n get duration() {\n return this._duration;\n }\n\n set duration(value) {\n this._duration = typeof value === 'undefined' ? 1 : value;\n }\n\n get msDuration() {\n return this.duration * 1000;\n }\n\n get blockDuration() {\n return this._blockDuration;\n }\n\n set blockDuration(value) {\n this._blockDuration = typeof value === 'undefined' ? 0 : value;\n }\n\n get msBlockDuration() {\n return this.blockDuration * 1000;\n }\n\n get execEvenly() {\n return this._execEvenly;\n }\n\n set execEvenly(value) {\n this._execEvenly = typeof value === 'undefined' ? false : Boolean(value);\n }\n\n get execEvenlyMinDelayMs() {\n return this._execEvenlyMinDelayMs;\n }\n\n set execEvenlyMinDelayMs(value) {\n this._execEvenlyMinDelayMs = typeof value === 'undefined' ? Math.ceil(this.msDuration / this.points) : value;\n }\n\n get keyPrefix() {\n return this._keyPrefix;\n }\n\n set keyPrefix(value) {\n if (typeof value === 'undefined') {\n value = 'rlflx';\n }\n if (typeof value !== 'string') {\n throw new Error('keyPrefix must be string');\n }\n this._keyPrefix = value;\n }\n\n _getKeySecDuration(options = {}) {\n return options && options.customDuration >= 0\n ? options.customDuration\n : this.duration;\n }\n\n getKey(key) {\n return this.keyPrefix.length > 0 ? `${this.keyPrefix}:${key}` : key;\n }\n\n parseKey(rlKey) {\n return rlKey.substring(this.keyPrefix.length);\n }\n\n consume() {\n throw new Error(\"You have to implement the method 'consume'!\");\n }\n\n penalty() {\n throw new Error(\"You have to implement the method 'penalty'!\");\n }\n\n reward() {\n throw new Error(\"You have to implement the method 'reward'!\");\n }\n\n get() {\n throw new Error(\"You have to implement the method 'get'!\");\n }\n\n set() {\n throw new Error(\"You have to implement the method 'set'!\");\n }\n\n block() {\n throw new Error(\"You have to implement the method 'block'!\");\n }\n\n delete() {\n throw new Error(\"You have to implement the method 'delete'!\");\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterCluster.js": +/*!**********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterCluster.js ***! + \**********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/**\n * Implements rate limiting in cluster using built-in IPC\n *\n * Two classes are described here: master and worker\n * Master have to be create in the master process without any options.\n * Any number of rate limiters can be created in workers, but each rate limiter must be with unique keyPrefix\n *\n * Workflow:\n * 1. master rate limiter created in master process\n * 2. worker rate limiter sends 'init' message with necessary options during creating\n * 3. master receives options and adds new rate limiter by keyPrefix if it isn't created yet\n * 4. master sends 'init' back to worker's rate limiter\n * 5. worker can process requests immediately,\n * but they will be postponed by 'workerWaitInit' until master sends 'init' to worker\n * 6. every request to worker rate limiter creates a promise\n * 7. if master doesn't response for 'timeout', promise is rejected\n * 8. master sends 'resolve' or 'reject' command to worker\n * 9. worker resolves or rejects promise depending on message from master\n *\n */\n\nconst cluster = __webpack_require__(/*! cluster */ \"?76c6\");\nconst crypto = __webpack_require__(/*! crypto */ \"?4a7d\");\nconst RateLimiterAbstract = __webpack_require__(/*! ./RateLimiterAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js\");\nconst RateLimiterMemory = __webpack_require__(/*! ./RateLimiterMemory */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterMemory.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nconst channel = 'rate_limiter_flexible';\nlet masterInstance = null;\n\nconst masterSendToWorker = function (worker, msg, type, res) {\n let data;\n if (res === null || res === true || res === false) {\n data = res;\n } else {\n data = {\n remainingPoints: res.remainingPoints,\n msBeforeNext: res.msBeforeNext,\n consumedPoints: res.consumedPoints,\n isFirstInDuration: res.isFirstInDuration,\n };\n }\n worker.send({\n channel,\n keyPrefix: msg.keyPrefix, // which rate limiter exactly\n promiseId: msg.promiseId,\n type,\n data,\n });\n};\n\nconst workerWaitInit = function (payload) {\n setTimeout(() => {\n if (this._initiated) {\n process.send(payload);\n // Promise will be removed by timeout if too long\n } else if (typeof this._promises[payload.promiseId] !== 'undefined') {\n workerWaitInit.call(this, payload);\n }\n }, 30);\n};\n\nconst workerSendToMaster = function (func, promiseId, key, arg, opts) {\n const payload = {\n channel,\n keyPrefix: this.keyPrefix,\n func,\n promiseId,\n data: {\n key,\n arg,\n opts,\n },\n };\n\n if (!this._initiated) {\n // Wait init before sending messages to master\n workerWaitInit.call(this, payload);\n } else {\n process.send(payload);\n }\n};\n\nconst masterProcessMsg = function (worker, msg) {\n if (!msg || msg.channel !== channel || typeof this._rateLimiters[msg.keyPrefix] === 'undefined') {\n return false;\n }\n\n let promise;\n\n switch (msg.func) {\n case 'consume':\n promise = this._rateLimiters[msg.keyPrefix].consume(msg.data.key, msg.data.arg, msg.data.opts);\n break;\n case 'penalty':\n promise = this._rateLimiters[msg.keyPrefix].penalty(msg.data.key, msg.data.arg, msg.data.opts);\n break;\n case 'reward':\n promise = this._rateLimiters[msg.keyPrefix].reward(msg.data.key, msg.data.arg, msg.data.opts);\n break;\n case 'block':\n promise = this._rateLimiters[msg.keyPrefix].block(msg.data.key, msg.data.arg, msg.data.opts);\n break;\n case 'get':\n promise = this._rateLimiters[msg.keyPrefix].get(msg.data.key, msg.data.opts);\n break;\n case 'delete':\n promise = this._rateLimiters[msg.keyPrefix].delete(msg.data.key, msg.data.opts);\n break;\n default:\n return false;\n }\n\n if (promise) {\n promise\n .then((res) => {\n masterSendToWorker(worker, msg, 'resolve', res);\n })\n .catch((rejRes) => {\n masterSendToWorker(worker, msg, 'reject', rejRes);\n });\n }\n};\n\nconst workerProcessMsg = function (msg) {\n if (!msg || msg.channel !== channel || msg.keyPrefix !== this.keyPrefix) {\n return false;\n }\n\n if (this._promises[msg.promiseId]) {\n clearTimeout(this._promises[msg.promiseId].timeoutId);\n let res;\n if (msg.data === null || msg.data === true || msg.data === false) {\n res = msg.data;\n } else {\n res = new RateLimiterRes(\n msg.data.remainingPoints,\n msg.data.msBeforeNext,\n msg.data.consumedPoints,\n msg.data.isFirstInDuration // eslint-disable-line comma-dangle\n );\n }\n\n switch (msg.type) {\n case 'resolve':\n this._promises[msg.promiseId].resolve(res);\n break;\n case 'reject':\n this._promises[msg.promiseId].reject(res);\n break;\n default:\n throw new Error(`RateLimiterCluster: no such message type '${msg.type}'`);\n }\n\n delete this._promises[msg.promiseId];\n }\n};\n/**\n * Prepare options to send to master\n * Master will create rate limiter depending on options\n *\n * @returns {{points: *, duration: *, blockDuration: *, execEvenly: *, execEvenlyMinDelayMs: *, keyPrefix: *}}\n */\nconst getOpts = function () {\n return {\n points: this.points,\n duration: this.duration,\n blockDuration: this.blockDuration,\n execEvenly: this.execEvenly,\n execEvenlyMinDelayMs: this.execEvenlyMinDelayMs,\n keyPrefix: this.keyPrefix,\n };\n};\n\nconst savePromise = function (resolve, reject) {\n const hrtime = process.hrtime();\n let promiseId = hrtime[0].toString() + hrtime[1].toString();\n\n if (typeof this._promises[promiseId] !== 'undefined') {\n promiseId += crypto.randomBytes(12).toString('base64');\n }\n\n this._promises[promiseId] = {\n resolve,\n reject,\n timeoutId: setTimeout(() => {\n delete this._promises[promiseId];\n reject(new Error('RateLimiterCluster timeout: no answer from master in time'));\n }, this.timeoutMs),\n };\n\n return promiseId;\n};\n\nclass RateLimiterClusterMaster {\n constructor() {\n if (masterInstance) {\n return masterInstance;\n }\n\n this._rateLimiters = {};\n\n cluster.setMaxListeners(0);\n\n cluster.on('message', (worker, msg) => {\n if (msg && msg.channel === channel && msg.type === 'init') {\n // If init request, check or create rate limiter by key prefix and send 'init' back to worker\n if (typeof this._rateLimiters[msg.opts.keyPrefix] === 'undefined') {\n this._rateLimiters[msg.opts.keyPrefix] = new RateLimiterMemory(msg.opts);\n }\n\n worker.send({\n channel,\n type: 'init',\n keyPrefix: msg.opts.keyPrefix,\n });\n } else {\n masterProcessMsg.call(this, worker, msg);\n }\n });\n\n masterInstance = this;\n }\n}\n\nclass RateLimiterClusterMasterPM2 {\n constructor(pm2) {\n if (masterInstance) {\n return masterInstance;\n }\n\n this._rateLimiters = {};\n\n pm2.launchBus((err, pm2Bus) => {\n pm2Bus.on('process:msg', (packet) => {\n const msg = packet.raw;\n if (msg && msg.channel === channel && msg.type === 'init') {\n // If init request, check or create rate limiter by key prefix and send 'init' back to worker\n if (typeof this._rateLimiters[msg.opts.keyPrefix] === 'undefined') {\n this._rateLimiters[msg.opts.keyPrefix] = new RateLimiterMemory(msg.opts);\n }\n\n pm2.sendDataToProcessId(packet.process.pm_id, {\n data: {},\n topic: channel,\n channel,\n type: 'init',\n keyPrefix: msg.opts.keyPrefix,\n }, (sendErr, res) => {\n if (sendErr) {\n console.log(sendErr, res);\n }\n });\n } else {\n const worker = {\n send: (msgData) => {\n const pm2Message = msgData;\n pm2Message.topic = channel;\n if (typeof pm2Message.data === 'undefined') {\n pm2Message.data = {};\n }\n pm2.sendDataToProcessId(packet.process.pm_id, pm2Message, (sendErr, res) => {\n if (sendErr) {\n console.log(sendErr, res);\n }\n });\n },\n };\n masterProcessMsg.call(this, worker, msg);\n }\n });\n });\n\n masterInstance = this;\n }\n}\n\nclass RateLimiterClusterWorker extends RateLimiterAbstract {\n get timeoutMs() {\n return this._timeoutMs;\n }\n\n set timeoutMs(value) {\n this._timeoutMs = typeof value === 'undefined' ? 5000 : Math.abs(parseInt(value));\n }\n\n constructor(opts = {}) {\n super(opts);\n\n process.setMaxListeners(0);\n\n this.timeoutMs = opts.timeoutMs;\n\n this._initiated = false;\n\n process.on('message', (msg) => {\n if (msg && msg.channel === channel && msg.type === 'init' && msg.keyPrefix === this.keyPrefix) {\n this._initiated = true;\n } else {\n workerProcessMsg.call(this, msg);\n }\n });\n\n // Create limiter on master with specific options\n process.send({\n channel,\n type: 'init',\n opts: getOpts.call(this),\n });\n\n this._promises = {};\n }\n\n consume(key, pointsToConsume = 1, options = {}) {\n return new Promise((resolve, reject) => {\n const promiseId = savePromise.call(this, resolve, reject);\n\n workerSendToMaster.call(this, 'consume', promiseId, key, pointsToConsume, options);\n });\n }\n\n penalty(key, points = 1, options = {}) {\n return new Promise((resolve, reject) => {\n const promiseId = savePromise.call(this, resolve, reject);\n\n workerSendToMaster.call(this, 'penalty', promiseId, key, points, options);\n });\n }\n\n reward(key, points = 1, options = {}) {\n return new Promise((resolve, reject) => {\n const promiseId = savePromise.call(this, resolve, reject);\n\n workerSendToMaster.call(this, 'reward', promiseId, key, points, options);\n });\n }\n\n block(key, secDuration, options = {}) {\n return new Promise((resolve, reject) => {\n const promiseId = savePromise.call(this, resolve, reject);\n\n workerSendToMaster.call(this, 'block', promiseId, key, secDuration, options);\n });\n }\n\n get(key, options = {}) {\n return new Promise((resolve, reject) => {\n const promiseId = savePromise.call(this, resolve, reject);\n\n workerSendToMaster.call(this, 'get', promiseId, key, options);\n });\n }\n\n delete(key, options = {}) {\n return new Promise((resolve, reject) => {\n const promiseId = savePromise.call(this, resolve, reject);\n\n workerSendToMaster.call(this, 'delete', promiseId, key, options);\n });\n }\n}\n\nmodule.exports = {\n RateLimiterClusterMaster,\n RateLimiterClusterMasterPM2,\n RateLimiterCluster: RateLimiterClusterWorker,\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterCluster.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterMemcache.js": +/*!***********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterMemcache.js ***! + \***********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterStoreAbstract = __webpack_require__(/*! ./RateLimiterStoreAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nclass RateLimiterMemcache extends RateLimiterStoreAbstract {\n /**\n *\n * @param {Object} opts\n * Defaults {\n * ... see other in RateLimiterStoreAbstract\n *\n * storeClient: memcacheClient\n * }\n */\n constructor(opts) {\n super(opts);\n\n this.client = opts.storeClient;\n }\n\n _getRateLimiterRes(rlKey, changedPoints, result) {\n const res = new RateLimiterRes();\n res.consumedPoints = parseInt(result.consumedPoints);\n res.isFirstInDuration = result.consumedPoints === changedPoints;\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n res.msBeforeNext = result.msBeforeNext;\n\n return res;\n }\n\n _upsert(rlKey, points, msDuration, forceExpire = false, options = {}) {\n return new Promise((resolve, reject) => {\n const nowMs = Date.now();\n const secDuration = Math.floor(msDuration / 1000);\n\n if (forceExpire) {\n this.client.set(rlKey, points, secDuration, (err) => {\n if (!err) {\n this.client.set(\n `${rlKey}_expire`,\n secDuration > 0 ? nowMs + (secDuration * 1000) : -1,\n secDuration,\n () => {\n const res = {\n consumedPoints: points,\n msBeforeNext: secDuration > 0 ? secDuration * 1000 : -1,\n };\n resolve(res);\n }\n );\n } else {\n reject(err);\n }\n });\n } else {\n this.client.incr(rlKey, points, (err, consumedPoints) => {\n if (err || consumedPoints === false) {\n this.client.add(rlKey, points, secDuration, (errAddKey, createdNew) => {\n if (errAddKey || !createdNew) {\n // Try to upsert again in case of race condition\n if (typeof options.attemptNumber === 'undefined' || options.attemptNumber < 3) {\n const nextOptions = Object.assign({}, options);\n nextOptions.attemptNumber = nextOptions.attemptNumber ? (nextOptions.attemptNumber + 1) : 1;\n\n this._upsert(rlKey, points, msDuration, forceExpire, nextOptions)\n .then(resUpsert => resolve(resUpsert))\n .catch(errUpsert => reject(errUpsert));\n } else {\n reject(new Error('Can not add key'));\n }\n } else {\n this.client.add(\n `${rlKey}_expire`,\n secDuration > 0 ? nowMs + (secDuration * 1000) : -1,\n secDuration,\n () => {\n const res = {\n consumedPoints: points,\n msBeforeNext: secDuration > 0 ? secDuration * 1000 : -1,\n };\n resolve(res);\n }\n );\n }\n });\n } else {\n this.client.get(`${rlKey}_expire`, (errGetExpire, resGetExpireMs) => {\n if (errGetExpire) {\n reject(errGetExpire);\n } else {\n const expireMs = resGetExpireMs === false ? 0 : resGetExpireMs;\n const res = {\n consumedPoints,\n msBeforeNext: expireMs >= 0 ? Math.max(expireMs - nowMs, 0) : -1,\n };\n resolve(res);\n }\n });\n }\n });\n }\n });\n }\n\n _get(rlKey) {\n return new Promise((resolve, reject) => {\n const nowMs = Date.now();\n\n this.client.get(rlKey, (err, consumedPoints) => {\n if (!consumedPoints) {\n resolve(null);\n } else {\n this.client.get(`${rlKey}_expire`, (errGetExpire, resGetExpireMs) => {\n if (errGetExpire) {\n reject(errGetExpire);\n } else {\n const expireMs = resGetExpireMs === false ? 0 : resGetExpireMs;\n const res = {\n consumedPoints,\n msBeforeNext: expireMs >= 0 ? Math.max(expireMs - nowMs, 0) : -1,\n };\n resolve(res);\n }\n });\n }\n });\n });\n }\n\n _delete(rlKey) {\n return new Promise((resolve, reject) => {\n this.client.del(rlKey, (err, res) => {\n if (err) {\n reject(err);\n } else if (res === false) {\n resolve(res);\n } else {\n this.client.del(`${rlKey}_expire`, (errDelExpire) => {\n if (errDelExpire) {\n reject(errDelExpire);\n } else {\n resolve(res);\n }\n });\n }\n });\n });\n }\n}\n\nmodule.exports = RateLimiterMemcache;\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterMemcache.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterMemory.js": +/*!*********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterMemory.js ***! + \*********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterAbstract = __webpack_require__(/*! ./RateLimiterAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js\");\nconst MemoryStorage = __webpack_require__(/*! ./component/MemoryStorage/MemoryStorage */ \"./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/MemoryStorage.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nclass RateLimiterMemory extends RateLimiterAbstract {\n constructor(opts = {}) {\n super(opts);\n\n this._memoryStorage = new MemoryStorage();\n }\n /**\n *\n * @param key\n * @param pointsToConsume\n * @param {Object} options\n * @returns {Promise}\n */\n consume(key, pointsToConsume = 1, options = {}) {\n return new Promise((resolve, reject) => {\n const rlKey = this.getKey(key);\n const secDuration = this._getKeySecDuration(options);\n let res = this._memoryStorage.incrby(rlKey, pointsToConsume, secDuration);\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n\n if (res.consumedPoints > this.points) {\n // Block only first time when consumed more than points\n if (this.blockDuration > 0 && res.consumedPoints <= (this.points + pointsToConsume)) {\n // Block key\n res = this._memoryStorage.set(rlKey, res.consumedPoints, this.blockDuration);\n }\n reject(res);\n } else if (this.execEvenly && res.msBeforeNext > 0 && !res.isFirstInDuration) {\n // Execute evenly\n let delay = Math.ceil(res.msBeforeNext / (res.remainingPoints + 2));\n if (delay < this.execEvenlyMinDelayMs) {\n delay = res.consumedPoints * this.execEvenlyMinDelayMs;\n }\n\n setTimeout(resolve, delay, res);\n } else {\n resolve(res);\n }\n });\n }\n\n penalty(key, points = 1, options = {}) {\n const rlKey = this.getKey(key);\n return new Promise((resolve) => {\n const secDuration = this._getKeySecDuration(options);\n const res = this._memoryStorage.incrby(rlKey, points, secDuration);\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n resolve(res);\n });\n }\n\n reward(key, points = 1, options = {}) {\n const rlKey = this.getKey(key);\n return new Promise((resolve) => {\n const secDuration = this._getKeySecDuration(options);\n const res = this._memoryStorage.incrby(rlKey, -points, secDuration);\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n resolve(res);\n });\n }\n\n /**\n * Block any key for secDuration seconds\n *\n * @param key\n * @param secDuration\n */\n block(key, secDuration) {\n const msDuration = secDuration * 1000;\n const initPoints = this.points + 1;\n\n this._memoryStorage.set(this.getKey(key), initPoints, secDuration);\n return Promise.resolve(\n new RateLimiterRes(0, msDuration === 0 ? -1 : msDuration, initPoints)\n );\n }\n\n set(key, points, secDuration) {\n const msDuration = (secDuration >= 0 ? secDuration : this.duration) * 1000;\n\n this._memoryStorage.set(this.getKey(key), points, secDuration);\n return Promise.resolve(\n new RateLimiterRes(0, msDuration === 0 ? -1 : msDuration, points)\n );\n }\n\n get(key) {\n const res = this._memoryStorage.get(this.getKey(key));\n if (res !== null) {\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n }\n\n return Promise.resolve(res);\n }\n\n delete(key) {\n return Promise.resolve(this._memoryStorage.delete(this.getKey(key)));\n }\n}\n\nmodule.exports = RateLimiterMemory;\n\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterMemory.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterMongo.js": +/*!********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterMongo.js ***! + \********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterStoreAbstract = __webpack_require__(/*! ./RateLimiterStoreAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\n/**\n * Get MongoDB driver version as upsert options differ\n * @params {Object} Client instance\n * @returns {Object} Version Object containing major, feature & minor versions.\n */\nfunction getDriverVersion(client) {\n try {\n const _client = client.client ? client.client : client;\n\n const { version } = _client.topology.s.options.metadata.driver;\n const _v = version.split('.').map(v => parseInt(v));\n\n return {\n major: _v[0],\n feature: _v[1],\n patch: _v[2],\n };\n } catch (err) {\n return { major: 0, feature: 0, patch: 0 };\n }\n}\n\nclass RateLimiterMongo extends RateLimiterStoreAbstract {\n /**\n *\n * @param {Object} opts\n * Defaults {\n * indexKeyPrefix: {attr1: 1, attr2: 1}\n * ... see other in RateLimiterStoreAbstract\n *\n * mongo: MongoClient\n * }\n */\n constructor(opts) {\n super(opts);\n\n this.dbName = opts.dbName;\n this.tableName = opts.tableName;\n this.indexKeyPrefix = opts.indexKeyPrefix;\n\n if (opts.mongo) {\n this.client = opts.mongo;\n } else {\n this.client = opts.storeClient;\n }\n if (typeof this.client.then === 'function') {\n // If Promise\n this.client\n .then((conn) => {\n this.client = conn;\n this._initCollection();\n this._driverVersion = getDriverVersion(this.client);\n });\n } else {\n this._initCollection();\n this._driverVersion = getDriverVersion(this.client);\n }\n }\n\n get dbName() {\n return this._dbName;\n }\n\n set dbName(value) {\n this._dbName = typeof value === 'undefined' ? RateLimiterMongo.getDbName() : value;\n }\n\n static getDbName() {\n return 'node-rate-limiter-flexible';\n }\n\n get tableName() {\n return this._tableName;\n }\n\n set tableName(value) {\n this._tableName = typeof value === 'undefined' ? this.keyPrefix : value;\n }\n\n get client() {\n return this._client;\n }\n\n set client(value) {\n if (typeof value === 'undefined') {\n throw new Error('mongo is not set');\n }\n this._client = value;\n }\n\n get indexKeyPrefix() {\n return this._indexKeyPrefix;\n }\n\n set indexKeyPrefix(obj) {\n this._indexKeyPrefix = obj || {};\n }\n\n _initCollection() {\n const db = typeof this.client.db === 'function'\n ? this.client.db(this.dbName)\n : this.client;\n\n const collection = db.collection(this.tableName);\n collection.createIndex({ expire: -1 }, { expireAfterSeconds: 0 });\n collection.createIndex(Object.assign({}, this.indexKeyPrefix, { key: 1 }), { unique: true });\n\n this._collection = collection;\n }\n\n _getRateLimiterRes(rlKey, changedPoints, result) {\n const res = new RateLimiterRes();\n\n let doc;\n if (typeof result.value === 'undefined') {\n doc = result;\n } else {\n doc = result.value;\n }\n\n res.isFirstInDuration = doc.points === changedPoints;\n res.consumedPoints = doc.points;\n\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n res.msBeforeNext = doc.expire !== null\n ? Math.max(new Date(doc.expire).getTime() - Date.now(), 0)\n : -1;\n\n return res;\n }\n\n _upsert(key, points, msDuration, forceExpire = false, options = {}) {\n if (!this._collection) {\n return Promise.reject(Error('Mongo connection is not established'));\n }\n\n const docAttrs = options.attrs || {};\n\n let where;\n let upsertData;\n if (forceExpire) {\n where = { key };\n where = Object.assign(where, docAttrs);\n upsertData = {\n $set: {\n key,\n points,\n expire: msDuration > 0 ? new Date(Date.now() + msDuration) : null,\n },\n };\n upsertData.$set = Object.assign(upsertData.$set, docAttrs);\n } else {\n where = {\n $or: [\n { expire: { $gt: new Date() } },\n { expire: { $eq: null } },\n ],\n key,\n };\n where = Object.assign(where, docAttrs);\n upsertData = {\n $setOnInsert: {\n key,\n expire: msDuration > 0 ? new Date(Date.now() + msDuration) : null,\n },\n $inc: { points },\n };\n upsertData.$setOnInsert = Object.assign(upsertData.$setOnInsert, docAttrs);\n }\n\n // Options for collection updates differ between driver versions\n const upsertOptions = {\n upsert: true,\n };\n if ((this._driverVersion.major >= 4) ||\n (this._driverVersion.major === 3 &&\n (this._driverVersion.feature >=7) || \n (this._driverVersion.feature >= 6 && \n this._driverVersion.patch >= 7 ))) \n {\n upsertOptions.returnDocument = 'after';\n } else {\n upsertOptions.returnOriginal = false;\n }\n\n /*\n * 1. Find actual limit and increment points\n * 2. If limit expired, but Mongo doesn't clean doc by TTL yet, try to replace limit doc completely\n * 3. If 2 or more Mongo threads try to insert the new limit doc, only the first succeed\n * 4. Try to upsert from step 1. Actual limit is created now, points are incremented without problems\n */\n return new Promise((resolve, reject) => {\n this._collection.findOneAndUpdate(\n where,\n upsertData,\n upsertOptions\n ).then((res) => {\n resolve(res);\n }).catch((errUpsert) => {\n if (errUpsert && errUpsert.code === 11000) { // E11000 duplicate key error collection\n const replaceWhere = Object.assign({ // try to replace OLD limit doc\n $or: [\n { expire: { $lte: new Date() } },\n { expire: { $eq: null } },\n ],\n key,\n }, docAttrs);\n\n const replaceTo = {\n $set: Object.assign({\n key,\n points,\n expire: msDuration > 0 ? new Date(Date.now() + msDuration) : null,\n }, docAttrs)\n };\n\n this._collection.findOneAndUpdate(\n replaceWhere,\n replaceTo,\n upsertOptions\n ).then((res) => {\n resolve(res);\n }).catch((errReplace) => {\n if (errReplace && errReplace.code === 11000) { // E11000 duplicate key error collection\n this._upsert(key, points, msDuration, forceExpire)\n .then(res => resolve(res))\n .catch(err => reject(err));\n } else {\n reject(errReplace);\n }\n });\n } else {\n reject(errUpsert);\n }\n });\n });\n }\n\n _get(rlKey, options = {}) {\n if (!this._collection) {\n return Promise.reject(Error('Mongo connection is not established'));\n }\n\n const docAttrs = options.attrs || {};\n\n const where = Object.assign({\n key: rlKey,\n $or: [\n { expire: { $gt: new Date() } },\n { expire: { $eq: null } },\n ],\n }, docAttrs);\n\n return this._collection.findOne(where);\n }\n\n _delete(rlKey, options = {}) {\n if (!this._collection) {\n return Promise.reject(Error('Mongo connection is not established'));\n }\n\n const docAttrs = options.attrs || {};\n const where = Object.assign({ key: rlKey }, docAttrs);\n\n return this._collection.deleteOne(where)\n .then(res => res.deletedCount > 0);\n }\n}\n\nmodule.exports = RateLimiterMongo;\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterMongo.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterMySQL.js": +/*!********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterMySQL.js ***! + \********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterStoreAbstract = __webpack_require__(/*! ./RateLimiterStoreAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nclass RateLimiterMySQL extends RateLimiterStoreAbstract {\n /**\n * @callback callback\n * @param {Object} err\n *\n * @param {Object} opts\n * @param {callback} cb\n * Defaults {\n * ... see other in RateLimiterStoreAbstract\n *\n * storeClient: anySqlClient,\n * storeType: 'knex', // required only for Knex instance\n * dbName: 'string',\n * tableName: 'string',\n * }\n */\n constructor(opts, cb = null) {\n super(opts);\n\n this.client = opts.storeClient;\n this.clientType = opts.storeType;\n\n this.dbName = opts.dbName;\n this.tableName = opts.tableName;\n\n this.clearExpiredByTimeout = opts.clearExpiredByTimeout;\n\n this.tableCreated = opts.tableCreated;\n if (!this.tableCreated) {\n this._createDbAndTable()\n .then(() => {\n this.tableCreated = true;\n if (this.clearExpiredByTimeout) {\n this._clearExpiredHourAgo();\n }\n if (typeof cb === 'function') {\n cb();\n }\n })\n .catch((err) => {\n if (typeof cb === 'function') {\n cb(err);\n } else {\n throw err;\n }\n });\n } else {\n if (this.clearExpiredByTimeout) {\n this._clearExpiredHourAgo();\n }\n if (typeof cb === 'function') {\n cb();\n }\n }\n }\n\n clearExpired(expire) {\n return new Promise((resolve) => {\n this._getConnection()\n .then((conn) => {\n conn.query(`DELETE FROM ??.?? WHERE expire < ?`, [this.dbName, this.tableName, expire], () => {\n this._releaseConnection(conn);\n resolve();\n });\n })\n .catch(() => {\n resolve();\n });\n });\n }\n\n _clearExpiredHourAgo() {\n if (this._clearExpiredTimeoutId) {\n clearTimeout(this._clearExpiredTimeoutId);\n }\n this._clearExpiredTimeoutId = setTimeout(() => {\n this.clearExpired(Date.now() - 3600000) // Never rejected\n .then(() => {\n this._clearExpiredHourAgo();\n });\n }, 300000);\n this._clearExpiredTimeoutId.unref();\n }\n\n /**\n *\n * @return Promise\n * @private\n */\n _getConnection() {\n switch (this.clientType) {\n case 'pool':\n return new Promise((resolve, reject) => {\n this.client.getConnection((errConn, conn) => {\n if (errConn) {\n return reject(errConn);\n }\n\n resolve(conn);\n });\n });\n case 'sequelize':\n return this.client.connectionManager.getConnection();\n case 'knex':\n return this.client.client.acquireConnection();\n default:\n return Promise.resolve(this.client);\n }\n }\n\n _releaseConnection(conn) {\n switch (this.clientType) {\n case 'pool':\n return conn.release();\n case 'sequelize':\n return this.client.connectionManager.releaseConnection(conn);\n case 'knex':\n return this.client.client.releaseConnection(conn);\n default:\n return true;\n }\n }\n\n /**\n *\n * @returns {Promise}\n * @private\n */\n _createDbAndTable() {\n return new Promise((resolve, reject) => {\n this._getConnection()\n .then((conn) => {\n conn.query(`CREATE DATABASE IF NOT EXISTS \\`${this.dbName}\\`;`, (errDb) => {\n if (errDb) {\n this._releaseConnection(conn);\n return reject(errDb);\n }\n conn.query(this._getCreateTableStmt(), (err) => {\n if (err) {\n this._releaseConnection(conn);\n return reject(err);\n }\n this._releaseConnection(conn);\n resolve();\n });\n });\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n _getCreateTableStmt() {\n return `CREATE TABLE IF NOT EXISTS \\`${this.dbName}\\`.\\`${this.tableName}\\` (` +\n '`key` VARCHAR(255) CHARACTER SET utf8 NOT NULL,' +\n '`points` INT(9) NOT NULL default 0,' +\n '`expire` BIGINT UNSIGNED,' +\n 'PRIMARY KEY (`key`)' +\n ') ENGINE = INNODB;';\n }\n\n get clientType() {\n return this._clientType;\n }\n\n set clientType(value) {\n if (typeof value === 'undefined') {\n if (this.client.constructor.name === 'Connection') {\n value = 'connection';\n } else if (this.client.constructor.name === 'Pool') {\n value = 'pool';\n } else if (this.client.constructor.name === 'Sequelize') {\n value = 'sequelize';\n } else {\n throw new Error('storeType is not defined');\n }\n }\n this._clientType = value.toLowerCase();\n }\n\n get dbName() {\n return this._dbName;\n }\n\n set dbName(value) {\n this._dbName = typeof value === 'undefined' ? 'rtlmtrflx' : value;\n }\n\n get tableName() {\n return this._tableName;\n }\n\n set tableName(value) {\n this._tableName = typeof value === 'undefined' ? this.keyPrefix : value;\n }\n\n get tableCreated() {\n return this._tableCreated\n }\n\n set tableCreated(value) {\n this._tableCreated = typeof value === 'undefined' ? false : !!value;\n }\n\n get clearExpiredByTimeout() {\n return this._clearExpiredByTimeout;\n }\n\n set clearExpiredByTimeout(value) {\n this._clearExpiredByTimeout = typeof value === 'undefined' ? true : Boolean(value);\n }\n\n _getRateLimiterRes(rlKey, changedPoints, result) {\n const res = new RateLimiterRes();\n const [row] = result;\n\n res.isFirstInDuration = changedPoints === row.points;\n res.consumedPoints = res.isFirstInDuration ? changedPoints : row.points;\n\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n res.msBeforeNext = row.expire\n ? Math.max(row.expire - Date.now(), 0)\n : -1;\n\n return res;\n }\n\n _upsertTransaction(conn, key, points, msDuration, forceExpire) {\n return new Promise((resolve, reject) => {\n conn.query('BEGIN', (errBegin) => {\n if (errBegin) {\n conn.rollback();\n\n return reject(errBegin);\n }\n\n const dateNow = Date.now();\n const newExpire = msDuration > 0 ? dateNow + msDuration : null;\n\n let q;\n let values;\n if (forceExpire) {\n q = `INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = ?, \n expire = ?;`;\n values = [\n this.dbName, this.tableName, key, points, newExpire,\n points,\n newExpire,\n ];\n } else {\n q = `INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = IF(expire <= ?, ?, points + (?)), \n expire = IF(expire <= ?, ?, expire);`;\n values = [\n this.dbName, this.tableName, key, points, newExpire,\n dateNow, points, points,\n dateNow, newExpire,\n ];\n }\n\n conn.query(q, values, (errUpsert) => {\n if (errUpsert) {\n conn.rollback();\n\n return reject(errUpsert);\n }\n conn.query('SELECT points, expire FROM ??.?? WHERE `key` = ?;', [this.dbName, this.tableName, key], (errSelect, res) => {\n if (errSelect) {\n conn.rollback();\n\n return reject(errSelect);\n }\n\n conn.query('COMMIT', (err) => {\n if (err) {\n conn.rollback();\n\n return reject(err);\n }\n\n resolve(res);\n });\n });\n });\n });\n });\n }\n\n _upsert(key, points, msDuration, forceExpire = false) {\n if (!this.tableCreated) {\n return Promise.reject(Error('Table is not created yet'));\n }\n\n return new Promise((resolve, reject) => {\n this._getConnection()\n .then((conn) => {\n this._upsertTransaction(conn, key, points, msDuration, forceExpire)\n .then((res) => {\n resolve(res);\n this._releaseConnection(conn);\n })\n .catch((err) => {\n reject(err);\n this._releaseConnection(conn);\n });\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n _get(rlKey) {\n if (!this.tableCreated) {\n return Promise.reject(Error('Table is not created yet'));\n }\n\n return new Promise((resolve, reject) => {\n this._getConnection()\n .then((conn) => {\n conn.query(\n 'SELECT points, expire FROM ??.?? WHERE `key` = ? AND (`expire` > ? OR `expire` IS NULL)',\n [this.dbName, this.tableName, rlKey, Date.now()],\n (err, res) => {\n if (err) {\n reject(err);\n } else if (res.length === 0) {\n resolve(null);\n } else {\n resolve(res);\n }\n\n this._releaseConnection(conn);\n } // eslint-disable-line\n );\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n _delete(rlKey) {\n if (!this.tableCreated) {\n return Promise.reject(Error('Table is not created yet'));\n }\n\n return new Promise((resolve, reject) => {\n this._getConnection()\n .then((conn) => {\n conn.query(\n 'DELETE FROM ??.?? WHERE `key` = ?',\n [this.dbName, this.tableName, rlKey],\n (err, res) => {\n if (err) {\n reject(err);\n } else {\n resolve(res.affectedRows > 0);\n }\n\n this._releaseConnection(conn);\n } // eslint-disable-line\n );\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n}\n\nmodule.exports = RateLimiterMySQL;\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterMySQL.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterPostgres.js": +/*!***********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterPostgres.js ***! + \***********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterStoreAbstract = __webpack_require__(/*! ./RateLimiterStoreAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nclass RateLimiterPostgres extends RateLimiterStoreAbstract {\n /**\n * @callback callback\n * @param {Object} err\n *\n * @param {Object} opts\n * @param {callback} cb\n * Defaults {\n * ... see other in RateLimiterStoreAbstract\n *\n * storeClient: postgresClient,\n * storeType: 'knex', // required only for Knex instance\n * tableName: 'string',\n * }\n */\n constructor(opts, cb = null) {\n super(opts);\n\n this.client = opts.storeClient;\n this.clientType = opts.storeType;\n\n this.tableName = opts.tableName;\n\n this.clearExpiredByTimeout = opts.clearExpiredByTimeout;\n\n this.tableCreated = opts.tableCreated;\n if (!this.tableCreated) {\n this._createTable()\n .then(() => {\n this.tableCreated = true;\n if (this.clearExpiredByTimeout) {\n this._clearExpiredHourAgo();\n }\n if (typeof cb === 'function') {\n cb();\n }\n })\n .catch((err) => {\n if (typeof cb === 'function') {\n cb(err);\n } else {\n throw err;\n }\n });\n } else {\n if (typeof cb === 'function') {\n cb();\n }\n }\n }\n\n clearExpired(expire) {\n return new Promise((resolve) => {\n const q = {\n name: 'rlflx-clear-expired',\n text: `DELETE FROM ${this.tableName} WHERE expire < $1`,\n values: [expire],\n };\n this._query(q)\n .then(() => {\n resolve();\n })\n .catch(() => {\n // Deleting expired query is not critical\n resolve();\n });\n });\n }\n\n /**\n * Delete all rows expired 1 hour ago once per 5 minutes\n *\n * @private\n */\n _clearExpiredHourAgo() {\n if (this._clearExpiredTimeoutId) {\n clearTimeout(this._clearExpiredTimeoutId);\n }\n this._clearExpiredTimeoutId = setTimeout(() => {\n this.clearExpired(Date.now() - 3600000) // Never rejected\n .then(() => {\n this._clearExpiredHourAgo();\n });\n }, 300000);\n this._clearExpiredTimeoutId.unref();\n }\n\n /**\n *\n * @return Promise\n * @private\n */\n _getConnection() {\n switch (this.clientType) {\n case 'pool':\n return Promise.resolve(this.client);\n case 'sequelize':\n return this.client.connectionManager.getConnection();\n case 'knex':\n return this.client.client.acquireConnection();\n case 'typeorm':\n return Promise.resolve(this.client.driver.master);\n default:\n return Promise.resolve(this.client);\n }\n }\n\n _releaseConnection(conn) {\n switch (this.clientType) {\n case 'pool':\n return true;\n case 'sequelize':\n return this.client.connectionManager.releaseConnection(conn);\n case 'knex':\n return this.client.client.releaseConnection(conn);\n case 'typeorm':\n return true;\n default:\n return true;\n }\n }\n\n /**\n *\n * @returns {Promise}\n * @private\n */\n _createTable() {\n return new Promise((resolve, reject) => {\n this._query({\n text: this._getCreateTableStmt(),\n })\n .then(() => {\n resolve();\n })\n .catch((err) => {\n if (err.code === '23505') {\n // Error: duplicate key value violates unique constraint \"pg_type_typname_nsp_index\"\n // Postgres doesn't handle concurrent table creation\n // It is supposed, that table is created by another worker\n resolve();\n } else {\n reject(err);\n }\n });\n });\n }\n\n _getCreateTableStmt() {\n return `CREATE TABLE IF NOT EXISTS ${this.tableName} ( \n key varchar(255) PRIMARY KEY,\n points integer NOT NULL DEFAULT 0,\n expire bigint\n );`;\n }\n\n get clientType() {\n return this._clientType;\n }\n\n set clientType(value) {\n const constructorName = this.client.constructor.name;\n\n if (typeof value === 'undefined') {\n if (constructorName === 'Client') {\n value = 'client';\n } else if (\n constructorName === 'Pool' ||\n constructorName === 'BoundPool'\n ) {\n value = 'pool';\n } else if (constructorName === 'Sequelize') {\n value = 'sequelize';\n } else {\n throw new Error('storeType is not defined');\n }\n }\n\n this._clientType = value.toLowerCase();\n }\n\n get tableName() {\n return this._tableName;\n }\n\n set tableName(value) {\n this._tableName = typeof value === 'undefined' ? this.keyPrefix : value;\n }\n\n get tableCreated() {\n return this._tableCreated\n }\n\n set tableCreated(value) {\n this._tableCreated = typeof value === 'undefined' ? false : !!value;\n }\n\n get clearExpiredByTimeout() {\n return this._clearExpiredByTimeout;\n }\n\n set clearExpiredByTimeout(value) {\n this._clearExpiredByTimeout = typeof value === 'undefined' ? true : Boolean(value);\n }\n\n _getRateLimiterRes(rlKey, changedPoints, result) {\n const res = new RateLimiterRes();\n const row = result.rows[0];\n\n res.isFirstInDuration = changedPoints === row.points;\n res.consumedPoints = res.isFirstInDuration ? changedPoints : row.points;\n\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n res.msBeforeNext = row.expire\n ? Math.max(row.expire - Date.now(), 0)\n : -1;\n\n return res;\n }\n\n _query(q) {\n const prefix = this.tableName.toLowerCase();\n const queryObj = { name: `${prefix}:${q.name}`, text: q.text, values: q.values };\n return new Promise((resolve, reject) => {\n this._getConnection()\n .then((conn) => {\n conn.query(queryObj)\n .then((res) => {\n resolve(res);\n this._releaseConnection(conn);\n })\n .catch((err) => {\n reject(err);\n this._releaseConnection(conn);\n });\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n _upsert(key, points, msDuration, forceExpire = false) {\n if (!this.tableCreated) {\n return Promise.reject(Error('Table is not created yet'));\n }\n\n const newExpire = msDuration > 0 ? Date.now() + msDuration : null;\n const expireQ = forceExpire\n ? ' $3 '\n : ` CASE\n WHEN ${this.tableName}.expire <= $4 THEN $3\n ELSE ${this.tableName}.expire\n END `;\n\n return this._query({\n name: forceExpire ? 'rlflx-upsert-force' : 'rlflx-upsert',\n text: `\n INSERT INTO ${this.tableName} VALUES ($1, $2, $3)\n ON CONFLICT(key) DO UPDATE SET\n points = CASE\n WHEN (${this.tableName}.expire <= $4 OR 1=${forceExpire ? 1 : 0}) THEN $2\n ELSE ${this.tableName}.points + ($2)\n END,\n expire = ${expireQ}\n RETURNING points, expire;`,\n values: [key, points, newExpire, Date.now()],\n });\n }\n\n _get(rlKey) {\n if (!this.tableCreated) {\n return Promise.reject(Error('Table is not created yet'));\n }\n\n return new Promise((resolve, reject) => {\n this._query({\n name: 'rlflx-get',\n text: `\n SELECT points, expire FROM ${this.tableName} WHERE key = $1 AND (expire > $2 OR expire IS NULL);`,\n values: [rlKey, Date.now()],\n })\n .then((res) => {\n if (res.rowCount === 0) {\n res = null;\n }\n resolve(res);\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n _delete(rlKey) {\n if (!this.tableCreated) {\n return Promise.reject(Error('Table is not created yet'));\n }\n\n return this._query({\n name: 'rlflx-delete',\n text: `DELETE FROM ${this.tableName} WHERE key = $1`,\n values: [rlKey],\n })\n .then(res => res.rowCount > 0);\n }\n}\n\nmodule.exports = RateLimiterPostgres;\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterPostgres.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterQueue.js": +/*!********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterQueue.js ***! + \********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterQueueError = __webpack_require__(/*! ./component/RateLimiterQueueError */ \"./node_modules/rate-limiter-flexible/lib/component/RateLimiterQueueError.js\")\nconst MAX_QUEUE_SIZE = 4294967295;\nconst KEY_DEFAULT = 'limiter';\n\nmodule.exports = class RateLimiterQueue {\n constructor(limiterFlexible, opts = {\n maxQueueSize: MAX_QUEUE_SIZE,\n }) {\n this._queueLimiters = {\n KEY_DEFAULT: new RateLimiterQueueInternal(limiterFlexible, opts)\n };\n this._limiterFlexible = limiterFlexible;\n this._maxQueueSize = opts.maxQueueSize\n }\n\n getTokensRemaining(key = KEY_DEFAULT) {\n if (this._queueLimiters[key]) {\n return this._queueLimiters[key].getTokensRemaining()\n } else {\n return Promise.resolve(this._limiterFlexible.points)\n }\n }\n\n removeTokens(tokens, key = KEY_DEFAULT) {\n if (!this._queueLimiters[key]) {\n this._queueLimiters[key] = new RateLimiterQueueInternal(\n this._limiterFlexible, {\n key,\n maxQueueSize: this._maxQueueSize,\n })\n }\n\n return this._queueLimiters[key].removeTokens(tokens)\n }\n};\n\nclass RateLimiterQueueInternal {\n\n constructor(limiterFlexible, opts = {\n maxQueueSize: MAX_QUEUE_SIZE,\n key: KEY_DEFAULT,\n }) {\n this._key = opts.key;\n this._waitTimeout = null;\n this._queue = [];\n this._limiterFlexible = limiterFlexible;\n\n this._maxQueueSize = opts.maxQueueSize\n }\n\n getTokensRemaining() {\n return this._limiterFlexible.get(this._key)\n .then((rlRes) => {\n return rlRes !== null ? rlRes.remainingPoints : this._limiterFlexible.points;\n })\n }\n\n removeTokens(tokens) {\n const _this = this;\n\n return new Promise((resolve, reject) => {\n if (tokens > _this._limiterFlexible.points) {\n reject(new RateLimiterQueueError(`Requested tokens ${tokens} exceeds maximum ${_this._limiterFlexible.points} tokens per interval`));\n return\n }\n\n if (_this._queue.length > 0) {\n _this._queueRequest.call(_this, resolve, reject, tokens);\n } else {\n _this._limiterFlexible.consume(_this._key, tokens)\n .then((res) => {\n resolve(res.remainingPoints);\n })\n .catch((rej) => {\n if (rej instanceof Error) {\n reject(rej);\n } else {\n _this._queueRequest.call(_this, resolve, reject, tokens);\n if (_this._waitTimeout === null) {\n _this._waitTimeout = setTimeout(_this._processFIFO.bind(_this), rej.msBeforeNext);\n }\n }\n });\n }\n })\n }\n\n _queueRequest(resolve, reject, tokens) {\n const _this = this;\n if (_this._queue.length < _this._maxQueueSize) {\n _this._queue.push({resolve, reject, tokens});\n } else {\n reject(new RateLimiterQueueError(`Number of requests reached it's maximum ${_this._maxQueueSize}`))\n }\n }\n\n _processFIFO() {\n const _this = this;\n\n if (_this._waitTimeout !== null) {\n clearTimeout(_this._waitTimeout);\n _this._waitTimeout = null;\n }\n\n if (_this._queue.length === 0) {\n return;\n }\n\n const item = _this._queue.shift();\n _this._limiterFlexible.consume(_this._key, item.tokens)\n .then((res) => {\n item.resolve(res.remainingPoints);\n _this._processFIFO.call(_this);\n })\n .catch((rej) => {\n if (rej instanceof Error) {\n item.reject(rej);\n _this._processFIFO.call(_this);\n } else {\n _this._queue.unshift(item);\n if (_this._waitTimeout === null) {\n _this._waitTimeout = setTimeout(_this._processFIFO.bind(_this), rej.msBeforeNext);\n }\n }\n });\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterQueue.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterRedis.js": +/*!********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterRedis.js ***! + \********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterStoreAbstract = __webpack_require__(/*! ./RateLimiterStoreAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nconst incrTtlLuaScript = `redis.call('set', KEYS[1], 0, 'EX', ARGV[2], 'NX') \\\nlocal consumed = redis.call('incrby', KEYS[1], ARGV[1]) \\\nlocal ttl = redis.call('pttl', KEYS[1]) \\\nif ttl == -1 then \\\n redis.call('expire', KEYS[1], ARGV[2]) \\\n ttl = 1000 * ARGV[2] \\\nend \\\nreturn {consumed, ttl} \\\n`;\n\nclass RateLimiterRedis extends RateLimiterStoreAbstract {\n /**\n *\n * @param {Object} opts\n * Defaults {\n * ... see other in RateLimiterStoreAbstract\n *\n * redis: RedisClient\n * rejectIfRedisNotReady: boolean = false - reject / invoke insuranceLimiter immediately when redis connection is not \"ready\"\n * }\n */\n constructor(opts) {\n super(opts);\n if (opts.redis) {\n this.client = opts.redis;\n } else {\n this.client = opts.storeClient;\n }\n\n this._rejectIfRedisNotReady = !!opts.rejectIfRedisNotReady;\n\n if (typeof this.client.defineCommand === 'function') {\n this.client.defineCommand(\"rlflxIncr\", {\n numberOfKeys: 1,\n lua: incrTtlLuaScript,\n });\n }\n }\n\n /**\n * Prevent actual redis call if redis connection is not ready\n * Because of different connection state checks for ioredis and node-redis, only this clients would be actually checked.\n * For any other clients all the requests would be passed directly to redis client\n * @return {boolean}\n * @private\n */\n _isRedisReady() {\n if (!this._rejectIfRedisNotReady) {\n return true;\n }\n // ioredis client\n if (this.client.status && this.client.status !== 'ready') {\n return false;\n }\n // node-redis client\n if (typeof this.client.isReady === 'function' && !this.client.isReady()) {\n return false;\n }\n return true;\n }\n\n _getRateLimiterRes(rlKey, changedPoints, result) {\n let [consumed, resTtlMs] = result;\n // Support ioredis results format\n if (Array.isArray(consumed)) {\n [, consumed] = consumed;\n [, resTtlMs] = resTtlMs;\n }\n\n const res = new RateLimiterRes();\n res.consumedPoints = parseInt(consumed);\n res.isFirstInDuration = res.consumedPoints === changedPoints;\n res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);\n res.msBeforeNext = resTtlMs;\n\n return res;\n }\n\n _upsert(rlKey, points, msDuration, forceExpire = false) {\n return new Promise((resolve, reject) => {\n if (!this._isRedisReady()) {\n return reject(new Error('Redis connection is not ready'));\n }\n\n const secDuration = Math.floor(msDuration / 1000);\n const multi = this.client.multi();\n if (forceExpire) {\n if (secDuration > 0) {\n multi.set(rlKey, points, 'EX', secDuration);\n } else {\n multi.set(rlKey, points);\n }\n\n multi.pttl(rlKey)\n .exec((err, res) => {\n if (err) {\n return reject(err);\n }\n\n return resolve(res);\n });\n } else {\n if (secDuration > 0) {\n const incrCallback = function(err, result) {\n if (err) {\n return reject(err);\n }\n\n return resolve(result);\n };\n\n if (typeof this.client.rlflxIncr === 'function') {\n this.client.rlflxIncr(rlKey, points, secDuration, incrCallback);\n } else {\n this.client.eval(incrTtlLuaScript, 1, rlKey, points, secDuration, incrCallback);\n }\n } else {\n multi.incrby(rlKey, points)\n .pttl(rlKey)\n .exec((err, res) => {\n if (err) {\n return reject(err);\n }\n\n return resolve(res);\n });\n }\n }\n });\n }\n\n _get(rlKey) {\n return new Promise((resolve, reject) => {\n if (!this._isRedisReady()) {\n return reject(new Error('Redis connection is not ready'));\n }\n\n this.client\n .multi()\n .get(rlKey)\n .pttl(rlKey)\n .exec((err, res) => {\n if (err) {\n reject(err);\n } else {\n const [points] = res;\n if (points === null) {\n return resolve(null)\n }\n\n resolve(res);\n }\n });\n });\n }\n\n _delete(rlKey) {\n return new Promise((resolve, reject) => {\n this.client.del(rlKey, (err, res) => {\n if (err) {\n reject(err);\n } else {\n resolve(res > 0);\n }\n });\n });\n }\n}\n\nmodule.exports = RateLimiterRedis;\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterRedis.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js": +/*!******************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js ***! + \******************************************************************/ +/***/ ((module) => { + +eval("module.exports = class RateLimiterRes {\n constructor(remainingPoints, msBeforeNext, consumedPoints, isFirstInDuration) {\n this.remainingPoints = typeof remainingPoints === 'undefined' ? 0 : remainingPoints; // Remaining points in current duration\n this.msBeforeNext = typeof msBeforeNext === 'undefined' ? 0 : msBeforeNext; // Milliseconds before next action\n this.consumedPoints = typeof consumedPoints === 'undefined' ? 0 : consumedPoints; // Consumed points in current duration\n this.isFirstInDuration = typeof isFirstInDuration === 'undefined' ? false : isFirstInDuration;\n }\n\n get msBeforeNext() {\n return this._msBeforeNext;\n }\n\n set msBeforeNext(ms) {\n this._msBeforeNext = ms;\n return this;\n }\n\n get remainingPoints() {\n return this._remainingPoints;\n }\n\n set remainingPoints(p) {\n this._remainingPoints = p;\n return this;\n }\n\n get consumedPoints() {\n return this._consumedPoints;\n }\n\n set consumedPoints(p) {\n this._consumedPoints = p;\n return this;\n }\n\n get isFirstInDuration() {\n return this._isFirstInDuration;\n }\n\n set isFirstInDuration(value) {\n this._isFirstInDuration = Boolean(value);\n }\n\n _getDecoratedProperties() {\n return {\n remainingPoints: this.remainingPoints,\n msBeforeNext: this.msBeforeNext,\n consumedPoints: this.consumedPoints,\n isFirstInDuration: this.isFirstInDuration,\n };\n }\n\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this._getDecoratedProperties();\n }\n\n toString() {\n return JSON.stringify(this._getDecoratedProperties());\n }\n\n toJSON() {\n return this._getDecoratedProperties();\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js": +/*!****************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js ***! + \****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterAbstract = __webpack_require__(/*! ./RateLimiterAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js\");\nconst BlockedKeys = __webpack_require__(/*! ./component/BlockedKeys */ \"./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/index.js\");\nconst RateLimiterRes = __webpack_require__(/*! ./RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nmodule.exports = class RateLimiterStoreAbstract extends RateLimiterAbstract {\n /**\n *\n * @param opts Object Defaults {\n * ... see other in RateLimiterAbstract\n *\n * inMemoryBlockOnConsumed: 40, // Number of points when key is blocked\n * inMemoryBlockDuration: 10, // Block duration in seconds\n * insuranceLimiter: RateLimiterAbstract\n * }\n */\n constructor(opts = {}) {\n super(opts);\n\n this.inMemoryBlockOnConsumed = opts.inMemoryBlockOnConsumed || opts.inmemoryBlockOnConsumed;\n this.inMemoryBlockDuration = opts.inMemoryBlockDuration || opts.inmemoryBlockDuration;\n this.insuranceLimiter = opts.insuranceLimiter;\n this._inMemoryBlockedKeys = new BlockedKeys();\n }\n\n get client() {\n return this._client;\n }\n\n set client(value) {\n if (typeof value === 'undefined') {\n throw new Error('storeClient is not set');\n }\n this._client = value;\n }\n\n /**\n * Have to be launched after consume\n * It blocks key and execute evenly depending on result from store\n *\n * It uses _getRateLimiterRes function to prepare RateLimiterRes from store result\n *\n * @param resolve\n * @param reject\n * @param rlKey\n * @param changedPoints\n * @param storeResult\n * @param {Object} options\n * @private\n */\n _afterConsume(resolve, reject, rlKey, changedPoints, storeResult, options = {}) {\n const res = this._getRateLimiterRes(rlKey, changedPoints, storeResult);\n\n if (this.inMemoryBlockOnConsumed > 0 && !(this.inMemoryBlockDuration > 0)\n && res.consumedPoints >= this.inMemoryBlockOnConsumed\n ) {\n this._inMemoryBlockedKeys.addMs(rlKey, res.msBeforeNext);\n if (res.consumedPoints > this.points) {\n return reject(res);\n } else {\n return resolve(res)\n }\n } else if (res.consumedPoints > this.points) {\n let blockPromise = Promise.resolve();\n // Block only first time when consumed more than points\n if (this.blockDuration > 0 && res.consumedPoints <= (this.points + changedPoints)) {\n res.msBeforeNext = this.msBlockDuration;\n blockPromise = this._block(rlKey, res.consumedPoints, this.msBlockDuration, options);\n }\n\n if (this.inMemoryBlockOnConsumed > 0 && res.consumedPoints >= this.inMemoryBlockOnConsumed) {\n // Block key for this.inMemoryBlockDuration seconds\n this._inMemoryBlockedKeys.add(rlKey, this.inMemoryBlockDuration);\n res.msBeforeNext = this.msInMemoryBlockDuration;\n }\n\n blockPromise\n .then(() => {\n reject(res);\n })\n .catch((err) => {\n reject(err);\n });\n } else if (this.execEvenly && res.msBeforeNext > 0 && !res.isFirstInDuration) {\n let delay = Math.ceil(res.msBeforeNext / (res.remainingPoints + 2));\n if (delay < this.execEvenlyMinDelayMs) {\n delay = res.consumedPoints * this.execEvenlyMinDelayMs;\n }\n\n setTimeout(resolve, delay, res);\n } else {\n resolve(res);\n }\n }\n\n _handleError(err, funcName, resolve, reject, key, data = false, options = {}) {\n if (!(this.insuranceLimiter instanceof RateLimiterAbstract)) {\n reject(err);\n } else {\n this.insuranceLimiter[funcName](key, data, options)\n .then((res) => {\n resolve(res);\n })\n .catch((res) => {\n reject(res);\n });\n }\n }\n\n /**\n * @deprecated Use camelCase version\n * @returns {BlockedKeys}\n * @private\n */\n get _inmemoryBlockedKeys() {\n return this._inMemoryBlockedKeys\n }\n\n /**\n * @deprecated Use camelCase version\n * @param rlKey\n * @returns {number}\n */\n getInmemoryBlockMsBeforeExpire(rlKey) {\n return this.getInMemoryBlockMsBeforeExpire(rlKey)\n }\n\n /**\n * @deprecated Use camelCase version\n * @returns {number|number}\n */\n get inmemoryBlockOnConsumed() {\n return this.inMemoryBlockOnConsumed;\n }\n\n /**\n * @deprecated Use camelCase version\n * @param value\n */\n set inmemoryBlockOnConsumed(value) {\n this.inMemoryBlockOnConsumed = value;\n }\n\n /**\n * @deprecated Use camelCase version\n * @returns {number|number}\n */\n get inmemoryBlockDuration() {\n return this.inMemoryBlockDuration;\n }\n\n /**\n * @deprecated Use camelCase version\n * @param value\n */\n set inmemoryBlockDuration(value) {\n this.inMemoryBlockDuration = value\n }\n\n /**\n * @deprecated Use camelCase version\n * @returns {number}\n */\n get msInmemoryBlockDuration() {\n return this.inMemoryBlockDuration * 1000;\n }\n\n getInMemoryBlockMsBeforeExpire(rlKey) {\n if (this.inMemoryBlockOnConsumed > 0) {\n return this._inMemoryBlockedKeys.msBeforeExpire(rlKey);\n }\n\n return 0;\n }\n\n get inMemoryBlockOnConsumed() {\n return this._inMemoryBlockOnConsumed;\n }\n\n set inMemoryBlockOnConsumed(value) {\n this._inMemoryBlockOnConsumed = value ? parseInt(value) : 0;\n if (this.inMemoryBlockOnConsumed > 0 && this.points > this.inMemoryBlockOnConsumed) {\n throw new Error('inMemoryBlockOnConsumed option must be greater or equal \"points\" option');\n }\n }\n\n get inMemoryBlockDuration() {\n return this._inMemoryBlockDuration;\n }\n\n set inMemoryBlockDuration(value) {\n this._inMemoryBlockDuration = value ? parseInt(value) : 0;\n if (this.inMemoryBlockDuration > 0 && this.inMemoryBlockOnConsumed === 0) {\n throw new Error('inMemoryBlockOnConsumed option must be set up');\n }\n }\n\n get msInMemoryBlockDuration() {\n return this._inMemoryBlockDuration * 1000;\n }\n\n get insuranceLimiter() {\n return this._insuranceLimiter;\n }\n\n set insuranceLimiter(value) {\n if (typeof value !== 'undefined' && !(value instanceof RateLimiterAbstract)) {\n throw new Error('insuranceLimiter must be instance of RateLimiterAbstract');\n }\n this._insuranceLimiter = value;\n if (this._insuranceLimiter) {\n this._insuranceLimiter.blockDuration = this.blockDuration;\n this._insuranceLimiter.execEvenly = this.execEvenly;\n }\n }\n\n /**\n * Block any key for secDuration seconds\n *\n * @param key\n * @param secDuration\n * @param {Object} options\n *\n * @return Promise\n */\n block(key, secDuration, options = {}) {\n const msDuration = secDuration * 1000;\n return this._block(this.getKey(key), this.points + 1, msDuration, options);\n }\n\n /**\n * Set points by key for any duration\n *\n * @param key\n * @param points\n * @param secDuration\n * @param {Object} options\n *\n * @return Promise\n */\n set(key, points, secDuration, options = {}) {\n const msDuration = (secDuration >= 0 ? secDuration : this.duration) * 1000;\n return this._block(this.getKey(key), points, msDuration, options);\n }\n\n /**\n *\n * @param key\n * @param pointsToConsume\n * @param {Object} options\n * @returns Promise\n */\n consume(key, pointsToConsume = 1, options = {}) {\n return new Promise((resolve, reject) => {\n const rlKey = this.getKey(key);\n\n const inMemoryBlockMsBeforeExpire = this.getInMemoryBlockMsBeforeExpire(rlKey);\n if (inMemoryBlockMsBeforeExpire > 0) {\n return reject(new RateLimiterRes(0, inMemoryBlockMsBeforeExpire));\n }\n\n this._upsert(rlKey, pointsToConsume, this._getKeySecDuration(options) * 1000, false, options)\n .then((res) => {\n this._afterConsume(resolve, reject, rlKey, pointsToConsume, res);\n })\n .catch((err) => {\n this._handleError(err, 'consume', resolve, reject, key, pointsToConsume, options);\n });\n });\n }\n\n /**\n *\n * @param key\n * @param points\n * @param {Object} options\n * @returns Promise\n */\n penalty(key, points = 1, options = {}) {\n const rlKey = this.getKey(key);\n return new Promise((resolve, reject) => {\n this._upsert(rlKey, points, this._getKeySecDuration(options) * 1000, false, options)\n .then((res) => {\n resolve(this._getRateLimiterRes(rlKey, points, res));\n })\n .catch((err) => {\n this._handleError(err, 'penalty', resolve, reject, key, points, options);\n });\n });\n }\n\n /**\n *\n * @param key\n * @param points\n * @param {Object} options\n * @returns Promise\n */\n reward(key, points = 1, options = {}) {\n const rlKey = this.getKey(key);\n return new Promise((resolve, reject) => {\n this._upsert(rlKey, -points, this._getKeySecDuration(options) * 1000, false, options)\n .then((res) => {\n resolve(this._getRateLimiterRes(rlKey, -points, res));\n })\n .catch((err) => {\n this._handleError(err, 'reward', resolve, reject, key, points, options);\n });\n });\n }\n\n /**\n *\n * @param key\n * @param {Object} options\n * @returns Promise|null\n */\n get(key, options = {}) {\n const rlKey = this.getKey(key);\n return new Promise((resolve, reject) => {\n this._get(rlKey, options)\n .then((res) => {\n if (res === null || typeof res === 'undefined') {\n resolve(null);\n } else {\n resolve(this._getRateLimiterRes(rlKey, 0, res));\n }\n })\n .catch((err) => {\n this._handleError(err, 'get', resolve, reject, key, options);\n });\n });\n }\n\n /**\n *\n * @param key\n * @param {Object} options\n * @returns Promise\n */\n delete(key, options = {}) {\n const rlKey = this.getKey(key);\n return new Promise((resolve, reject) => {\n this._delete(rlKey, options)\n .then((res) => {\n this._inMemoryBlockedKeys.delete(rlKey);\n resolve(res);\n })\n .catch((err) => {\n this._handleError(err, 'delete', resolve, reject, key, options);\n });\n });\n }\n\n /**\n * Cleanup keys no-matter expired or not.\n */\n deleteInMemoryBlockedAll() {\n this._inMemoryBlockedKeys.delete();\n }\n\n /**\n * Get RateLimiterRes object filled depending on storeResult, which specific for exact store\n *\n * @param rlKey\n * @param changedPoints\n * @param storeResult\n * @private\n */\n _getRateLimiterRes(rlKey, changedPoints, storeResult) { // eslint-disable-line no-unused-vars\n throw new Error(\"You have to implement the method '_getRateLimiterRes'!\");\n }\n\n /**\n * Block key for this.msBlockDuration milliseconds\n * Usually, it just prolongs lifetime of key\n *\n * @param rlKey\n * @param initPoints\n * @param msDuration\n * @param {Object} options\n *\n * @return Promise\n */\n _block(rlKey, initPoints, msDuration, options = {}) {\n return new Promise((resolve, reject) => {\n this._upsert(rlKey, initPoints, msDuration, true, options)\n .then(() => {\n resolve(new RateLimiterRes(0, msDuration > 0 ? msDuration : -1, initPoints));\n })\n .catch((err) => {\n this._handleError(err, 'block', resolve, reject, this.parseKey(rlKey), msDuration / 1000, options);\n });\n });\n }\n\n /**\n * Have to be implemented in every limiter\n * Resolve with raw result from Store OR null if rlKey is not set\n * or Reject with error\n *\n * @param rlKey\n * @param {Object} options\n * @private\n *\n * @return Promise\n */\n _get(rlKey, options = {}) { // eslint-disable-line no-unused-vars\n throw new Error(\"You have to implement the method '_get'!\");\n }\n\n /**\n * Have to be implemented\n * Resolve with true OR false if rlKey doesn't exist\n * or Reject with error\n *\n * @param rlKey\n * @param {Object} options\n * @private\n *\n * @return Promise\n */\n _delete(rlKey, options = {}) { // eslint-disable-line no-unused-vars\n throw new Error(\"You have to implement the method '_delete'!\");\n }\n\n /**\n * Have to be implemented\n * Resolve with object used for {@link _getRateLimiterRes} to generate {@link RateLimiterRes}\n *\n * @param {string} rlKey\n * @param {number} points\n * @param {number} msDuration\n * @param {boolean} forceExpire\n * @param {Object} options\n * @abstract\n *\n * @return Promise\n */\n _upsert(rlKey, points, msDuration, forceExpire = false, options = {}) {\n throw new Error(\"You have to implement the method '_upsert'!\");\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterStoreAbstract.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/RateLimiterUnion.js": +/*!********************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/RateLimiterUnion.js ***! + \********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const RateLimiterAbstract = __webpack_require__(/*! ./RateLimiterAbstract */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterAbstract.js\");\n\nmodule.exports = class RateLimiterUnion {\n constructor(...limiters) {\n if (limiters.length < 1) {\n throw new Error('RateLimiterUnion: at least one limiter have to be passed');\n }\n limiters.forEach((limiter) => {\n if (!(limiter instanceof RateLimiterAbstract)) {\n throw new Error('RateLimiterUnion: all limiters have to be instance of RateLimiterAbstract');\n }\n });\n\n this._limiters = limiters;\n }\n\n consume(key, points = 1) {\n return new Promise((resolve, reject) => {\n const promises = [];\n this._limiters.forEach((limiter) => {\n promises.push(limiter.consume(key, points).catch(rej => ({ rejected: true, rej })));\n });\n\n Promise.all(promises)\n .then((res) => {\n const resObj = {};\n let rejected = false;\n\n res.forEach((item) => {\n if (item.rejected === true) {\n rejected = true;\n }\n });\n\n for (let i = 0; i < res.length; i++) {\n if (rejected && res[i].rejected === true) {\n resObj[this._limiters[i].keyPrefix] = res[i].rej;\n } else if (!rejected) {\n resObj[this._limiters[i].keyPrefix] = res[i];\n }\n }\n\n if (rejected) {\n reject(resObj);\n } else {\n resolve(resObj);\n }\n });\n });\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/RateLimiterUnion.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/BlockedKeys.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/BlockedKeys.js ***! + \*************************************************************************************/ +/***/ ((module) => { + +eval("module.exports = class BlockedKeys {\n constructor() {\n this._keys = {}; // {'key': 1526279430331}\n this._addedKeysAmount = 0;\n }\n\n collectExpired() {\n const now = Date.now();\n\n Object.keys(this._keys).forEach((key) => {\n if (this._keys[key] <= now) {\n delete this._keys[key];\n }\n });\n\n this._addedKeysAmount = Object.keys(this._keys).length;\n }\n\n /**\n * Add new blocked key\n *\n * @param key String\n * @param sec Number\n */\n add(key, sec) {\n this.addMs(key, sec * 1000);\n }\n\n /**\n * Add new blocked key for ms\n *\n * @param key String\n * @param ms Number\n */\n addMs(key, ms) {\n this._keys[key] = Date.now() + ms;\n this._addedKeysAmount++;\n if (this._addedKeysAmount > 999) {\n this.collectExpired();\n }\n }\n\n /**\n * 0 means not blocked\n *\n * @param key\n * @returns {number}\n */\n msBeforeExpire(key) {\n const expire = this._keys[key];\n\n if (expire && expire >= Date.now()) {\n this.collectExpired();\n const now = Date.now();\n return expire >= now ? expire - now : 0;\n }\n\n return 0;\n }\n\n /**\n * If key is not given, delete all data in memory\n * \n * @param {string|undefined} key\n */\n delete(key) {\n if (key) {\n delete this._keys[key];\n } else {\n Object.keys(this._keys).forEach((key) => {\n delete this._keys[key];\n });\n }\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/BlockedKeys.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/index.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/index.js ***! + \*******************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const BlockedKeys = __webpack_require__(/*! ./BlockedKeys */ \"./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/BlockedKeys.js\");\n\nmodule.exports = BlockedKeys;\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/component/BlockedKeys/index.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/MemoryStorage.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/MemoryStorage.js ***! + \*****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("const Record = __webpack_require__(/*! ./Record */ \"./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/Record.js\");\nconst RateLimiterRes = __webpack_require__(/*! ../../RateLimiterRes */ \"./node_modules/rate-limiter-flexible/lib/RateLimiterRes.js\");\n\nmodule.exports = class MemoryStorage {\n constructor() {\n /**\n * @type {Object.}\n * @private\n */\n this._storage = {};\n }\n\n incrby(key, value, durationSec) {\n if (this._storage[key]) {\n const msBeforeExpires = this._storage[key].expiresAt\n ? this._storage[key].expiresAt.getTime() - new Date().getTime()\n : -1;\n if (msBeforeExpires !== 0) {\n // Change value\n this._storage[key].value = this._storage[key].value + value;\n\n return new RateLimiterRes(0, msBeforeExpires, this._storage[key].value, false);\n }\n\n return this.set(key, value, durationSec);\n }\n return this.set(key, value, durationSec);\n }\n\n set(key, value, durationSec) {\n const durationMs = durationSec * 1000;\n\n if (this._storage[key] && this._storage[key].timeoutId) {\n clearTimeout(this._storage[key].timeoutId);\n }\n\n this._storage[key] = new Record(\n value,\n durationMs > 0 ? new Date(Date.now() + durationMs) : null\n );\n if (durationMs > 0) {\n this._storage[key].timeoutId = setTimeout(() => {\n delete this._storage[key];\n }, durationMs);\n if (this._storage[key].timeoutId.unref) {\n this._storage[key].timeoutId.unref();\n }\n }\n\n return new RateLimiterRes(0, durationMs === 0 ? -1 : durationMs, this._storage[key].value, true);\n }\n\n /**\n *\n * @param key\n * @returns {*}\n */\n get(key) {\n if (this._storage[key]) {\n const msBeforeExpires = this._storage[key].expiresAt\n ? this._storage[key].expiresAt.getTime() - new Date().getTime()\n : -1;\n return new RateLimiterRes(0, msBeforeExpires, this._storage[key].value, false);\n }\n return null;\n }\n\n /**\n *\n * @param key\n * @returns {boolean}\n */\n delete(key) {\n if (this._storage[key]) {\n if (this._storage[key].timeoutId) {\n clearTimeout(this._storage[key].timeoutId);\n }\n delete this._storage[key];\n return true;\n }\n return false;\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/MemoryStorage.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/Record.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/Record.js ***! + \**********************************************************************************/ +/***/ ((module) => { + +eval("module.exports = class Record {\n /**\n *\n * @param value int\n * @param expiresAt Date|int\n * @param timeoutId\n */\n constructor(value, expiresAt, timeoutId = null) {\n this.value = value;\n this.expiresAt = expiresAt;\n this.timeoutId = timeoutId;\n }\n\n get value() {\n return this._value;\n }\n\n set value(value) {\n this._value = parseInt(value);\n }\n\n get expiresAt() {\n return this._expiresAt;\n }\n\n set expiresAt(value) {\n if (!(value instanceof Date) && Number.isInteger(value)) {\n value = new Date(value);\n }\n this._expiresAt = value;\n }\n\n get timeoutId() {\n return this._timeoutId;\n }\n\n set timeoutId(value) {\n this._timeoutId = value;\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/component/MemoryStorage/Record.js?"); + +/***/ }), + +/***/ "./node_modules/rate-limiter-flexible/lib/component/RateLimiterQueueError.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/rate-limiter-flexible/lib/component/RateLimiterQueueError.js ***! + \***********************************************************************************/ +/***/ ((module) => { + +eval("module.exports = class RateLimiterQueueError extends Error {\n constructor(message, extra) {\n super();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n this.name = 'CustomError';\n this.message = message;\n if (extra) {\n this.extra = extra;\n }\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/rate-limiter-flexible/lib/component/RateLimiterQueueError.js?"); + +/***/ }), + +/***/ "./node_modules/receptacle/index.js": +/*!******************************************!*\ + !*** ./node_modules/receptacle/index.js ***! + \******************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\n\nmodule.exports = Receptacle\nvar toMS = __webpack_require__(/*! ms */ \"./node_modules/ms/index.js\")\nvar cache = Receptacle.prototype\nvar counter = new Date() % 1e9\n\nfunction getUID () { return (Math.random() * 1e9 >>> 0) + (counter++) }\n\n/**\n * Creates a cache with a maximum key size.\n *\n * @constructor\n * @param {Object} options\n * @param {Number} [options.max=Infinity] the maximum number of keys allowed in the cache (lru).\n * @param {Array} [options.items=[]] the default items in the cache.\n */\nfunction Receptacle (options) {\n options = options || {}\n this.id = options.id || getUID()\n this.max = options.max || Infinity\n this.items = options.items || []\n this._lookup = {}\n this.size = this.items.length\n this.lastModified = new Date(options.lastModified || new Date())\n\n // Setup initial timers and indexes for the cache.\n for (var item, ttl, i = this.items.length; i--;) {\n item = this.items[i]\n ttl = new Date(item.expires) - new Date()\n this._lookup[item.key] = item\n if (ttl > 0) this.expire(item.key, ttl)\n else if (ttl <= 0) this.delete(item.key)\n }\n}\n\n/**\n * Tests if a key is currently in the cache.\n * Does not check if slot is empty.\n *\n * @param {String} key - the key to retrieve from the cache.\n * @return {Boolean}\n */\ncache.has = function (key) {\n return key in this._lookup\n}\n\n/**\n * Retrieves a key from the cache and marks it as recently used.\n *\n * @param {String} key - the key to retrieve from the cache.\n * @return {*}\n */\ncache.get = function (key) {\n if (!this.has(key)) return null\n var record = this._lookup[key]\n // Update expiry for \"refresh\" keys\n if (record.refresh) this.expire(key, record.refresh)\n // Move to front of the line.\n this.items.splice(this.items.indexOf(record), 1)\n this.items.push(record)\n return record.value\n}\n\n/**\n * Retrieves user meta data for a cached item.\n *\n * @param {String} key - the key to retrieve meta data from the cache.\n * @return {*}\n */\ncache.meta = function (key) {\n if (!this.has(key)) return null\n var record = this._lookup[key]\n if (!('meta' in record)) return null\n return record.meta\n}\n\n/**\n * Puts a key into the cache with an optional expiry time.\n *\n * @param {String} key - the key for the value in the cache.\n * @param {*} value - the value to place at the key.\n * @param {Number} [options.ttl] - a time after which the key will be removed.\n * @return {Receptacle}\n */\ncache.set = function (key, value, options) {\n var oldRecord = this._lookup[key]\n var record = this._lookup[key] = { key: key, value: value }\n // Mark cache as modified.\n this.lastModified = new Date()\n\n if (oldRecord) {\n // Replace an old key.\n clearTimeout(oldRecord.timeout)\n this.items.splice(this.items.indexOf(oldRecord), 1, record)\n } else {\n // Remove least used item if needed.\n if (this.size >= this.max) this.delete(this.items[0].key)\n // Add a new key.\n this.items.push(record)\n this.size++\n }\n\n if (options) {\n // Setup key expiry.\n if ('ttl' in options) this.expire(key, options.ttl)\n // Store user options in the record.\n if ('meta' in options) record.meta = options.meta\n // Mark a auto refresh key.\n if (options.refresh) record.refresh = options.ttl\n }\n\n return this\n}\n\n/**\n * Deletes an item from the cache.\n *\n * @param {String} key - the key to remove.\n * @return {Receptacle}\n */\ncache.delete = function (key) {\n var record = this._lookup[key]\n if (!record) return false\n this.lastModified = new Date()\n this.items.splice(this.items.indexOf(record), 1)\n clearTimeout(record.timeout)\n delete this._lookup[key]\n this.size--\n return this\n}\n\n/**\n * Utility to register a key that will be removed after some time.\n *\n * @param {String} key - the key to remove.\n * @param {Number} [ms] - the timeout before removal.\n * @return {Receptacle}\n */\ncache.expire = function (key, ttl) {\n var ms = ttl || 0\n var record = this._lookup[key]\n if (!record) return this\n if (typeof ms === 'string') ms = toMS(ttl)\n if (typeof ms !== 'number') throw new TypeError('Expiration time must be a string or number.')\n clearTimeout(record.timeout)\n record.timeout = setTimeout(this.delete.bind(this, record.key), ms)\n record.expires = Number(new Date()) + ms\n return this\n}\n\n/**\n * Deletes all items from the cache.\n * @return {Receptacle}\n */\ncache.clear = function () {\n for (var i = this.items.length; i--;) this.delete(this.items[i].key)\n return this\n}\n\n/**\n * Fixes serialization issues in polyfilled environments.\n * Ensures non-cyclical serialized object.\n */\ncache.toJSON = function () {\n var items = new Array(this.items.length)\n var item\n for (var i = items.length; i--;) {\n item = this.items[i]\n items[i] = {\n key: item.key,\n meta: item.meta,\n value: item.value,\n expires: item.expires,\n refresh: item.refresh\n }\n }\n\n return {\n id: this.id,\n max: isFinite(this.max) ? this.max : undefined,\n lastModified: this.lastModified,\n items: items\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/receptacle/index.js?"); + +/***/ }), + +/***/ "./node_modules/retry/index.js": +/*!*************************************!*\ + !*** ./node_modules/retry/index.js ***! + \*************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("module.exports = __webpack_require__(/*! ./lib/retry */ \"./node_modules/retry/lib/retry.js\");\n\n//# sourceURL=webpack://light/./node_modules/retry/index.js?"); + +/***/ }), + +/***/ "./node_modules/retry/lib/retry.js": +/*!*****************************************!*\ + !*** ./node_modules/retry/lib/retry.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +eval("var RetryOperation = __webpack_require__(/*! ./retry_operation */ \"./node_modules/retry/lib/retry_operation.js\");\n\nexports.operation = function(options) {\n var timeouts = exports.timeouts(options);\n return new RetryOperation(timeouts, {\n forever: options && (options.forever || options.retries === Infinity),\n unref: options && options.unref,\n maxRetryTime: options && options.maxRetryTime\n });\n};\n\nexports.timeouts = function(options) {\n if (options instanceof Array) {\n return [].concat(options);\n }\n\n var opts = {\n retries: 10,\n factor: 2,\n minTimeout: 1 * 1000,\n maxTimeout: Infinity,\n randomize: false\n };\n for (var key in options) {\n opts[key] = options[key];\n }\n\n if (opts.minTimeout > opts.maxTimeout) {\n throw new Error('minTimeout is greater than maxTimeout');\n }\n\n var timeouts = [];\n for (var i = 0; i < opts.retries; i++) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n if (options && options.forever && !timeouts.length) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n // sort the array numerically ascending\n timeouts.sort(function(a,b) {\n return a - b;\n });\n\n return timeouts;\n};\n\nexports.createTimeout = function(attempt, opts) {\n var random = (opts.randomize)\n ? (Math.random() + 1)\n : 1;\n\n var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));\n timeout = Math.min(timeout, opts.maxTimeout);\n\n return timeout;\n};\n\nexports.wrap = function(obj, options, methods) {\n if (options instanceof Array) {\n methods = options;\n options = null;\n }\n\n if (!methods) {\n methods = [];\n for (var key in obj) {\n if (typeof obj[key] === 'function') {\n methods.push(key);\n }\n }\n }\n\n for (var i = 0; i < methods.length; i++) {\n var method = methods[i];\n var original = obj[method];\n\n obj[method] = function retryWrapper(original) {\n var op = exports.operation(options);\n var args = Array.prototype.slice.call(arguments, 1);\n var callback = args.pop();\n\n args.push(function(err) {\n if (op.retry(err)) {\n return;\n }\n if (err) {\n arguments[0] = op.mainError();\n }\n callback.apply(this, arguments);\n });\n\n op.attempt(function() {\n original.apply(obj, args);\n });\n }.bind(obj, original);\n obj[method].options = options;\n }\n};\n\n\n//# sourceURL=webpack://light/./node_modules/retry/lib/retry.js?"); + +/***/ }), + +/***/ "./node_modules/retry/lib/retry_operation.js": +/*!***************************************************!*\ + !*** ./node_modules/retry/lib/retry_operation.js ***! + \***************************************************/ +/***/ ((module) => { + +eval("function RetryOperation(timeouts, options) {\n // Compatibility for the old (timeouts, retryForever) signature\n if (typeof options === 'boolean') {\n options = { forever: options };\n }\n\n this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));\n this._timeouts = timeouts;\n this._options = options || {};\n this._maxRetryTime = options && options.maxRetryTime || Infinity;\n this._fn = null;\n this._errors = [];\n this._attempts = 1;\n this._operationTimeout = null;\n this._operationTimeoutCb = null;\n this._timeout = null;\n this._operationStart = null;\n this._timer = null;\n\n if (this._options.forever) {\n this._cachedTimeouts = this._timeouts.slice(0);\n }\n}\nmodule.exports = RetryOperation;\n\nRetryOperation.prototype.reset = function() {\n this._attempts = 1;\n this._timeouts = this._originalTimeouts.slice(0);\n}\n\nRetryOperation.prototype.stop = function() {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._timeouts = [];\n this._cachedTimeouts = null;\n};\n\nRetryOperation.prototype.retry = function(err) {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n\n if (!err) {\n return false;\n }\n var currentTime = new Date().getTime();\n if (err && currentTime - this._operationStart >= this._maxRetryTime) {\n this._errors.push(err);\n this._errors.unshift(new Error('RetryOperation timeout occurred'));\n return false;\n }\n\n this._errors.push(err);\n\n var timeout = this._timeouts.shift();\n if (timeout === undefined) {\n if (this._cachedTimeouts) {\n // retry forever, only keep last error\n this._errors.splice(0, this._errors.length - 1);\n timeout = this._cachedTimeouts.slice(-1);\n } else {\n return false;\n }\n }\n\n var self = this;\n this._timer = setTimeout(function() {\n self._attempts++;\n\n if (self._operationTimeoutCb) {\n self._timeout = setTimeout(function() {\n self._operationTimeoutCb(self._attempts);\n }, self._operationTimeout);\n\n if (self._options.unref) {\n self._timeout.unref();\n }\n }\n\n self._fn(self._attempts);\n }, timeout);\n\n if (this._options.unref) {\n this._timer.unref();\n }\n\n return true;\n};\n\nRetryOperation.prototype.attempt = function(fn, timeoutOps) {\n this._fn = fn;\n\n if (timeoutOps) {\n if (timeoutOps.timeout) {\n this._operationTimeout = timeoutOps.timeout;\n }\n if (timeoutOps.cb) {\n this._operationTimeoutCb = timeoutOps.cb;\n }\n }\n\n var self = this;\n if (this._operationTimeoutCb) {\n this._timeout = setTimeout(function() {\n self._operationTimeoutCb();\n }, self._operationTimeout);\n }\n\n this._operationStart = new Date().getTime();\n\n this._fn(this._attempts);\n};\n\nRetryOperation.prototype.try = function(fn) {\n console.log('Using RetryOperation.try() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = function(fn) {\n console.log('Using RetryOperation.start() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = RetryOperation.prototype.try;\n\nRetryOperation.prototype.errors = function() {\n return this._errors;\n};\n\nRetryOperation.prototype.attempts = function() {\n return this._attempts;\n};\n\nRetryOperation.prototype.mainError = function() {\n if (this._errors.length === 0) {\n return null;\n }\n\n var counts = {};\n var mainError = null;\n var mainErrorCount = 0;\n\n for (var i = 0; i < this._errors.length; i++) {\n var error = this._errors[i];\n var message = error.message;\n var count = (counts[message] || 0) + 1;\n\n counts[message] = count;\n\n if (count >= mainErrorCount) {\n mainError = error;\n mainErrorCount = count;\n }\n }\n\n return mainError;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/retry/lib/retry_operation.js?"); + +/***/ }), + +/***/ "./node_modules/sanitize-filename/index.js": +/*!*************************************************!*\ + !*** ./node_modules/sanitize-filename/index.js ***! + \*************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("/*jshint node:true*/\n\n\n/**\n * Replaces characters in strings that are illegal/unsafe for filenames.\n * Unsafe characters are either removed or replaced by a substitute set\n * in the optional `options` object.\n *\n * Illegal Characters on Various Operating Systems\n * / ? < > \\ : * | \"\n * https://kb.acronis.com/content/39790\n *\n * Unicode Control codes\n * C0 0x00-0x1f & C1 (0x80-0x9f)\n * http://en.wikipedia.org/wiki/C0_and_C1_control_codes\n *\n * Reserved filenames on Unix-based systems (\".\", \"..\")\n * Reserved filenames in Windows (\"CON\", \"PRN\", \"AUX\", \"NUL\", \"COM1\",\n * \"COM2\", \"COM3\", \"COM4\", \"COM5\", \"COM6\", \"COM7\", \"COM8\", \"COM9\",\n * \"LPT1\", \"LPT2\", \"LPT3\", \"LPT4\", \"LPT5\", \"LPT6\", \"LPT7\", \"LPT8\", and\n * \"LPT9\") case-insesitively and with or without filename extensions.\n *\n * Capped at 255 characters in length.\n * http://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs\n *\n * @param {String} input Original filename\n * @param {Object} options {replacement: String | Function }\n * @return {String} Sanitized filename\n */\n\nvar truncate = __webpack_require__(/*! truncate-utf8-bytes */ \"./node_modules/truncate-utf8-bytes/browser.js\");\n\nvar illegalRe = /[\\/\\?<>\\\\:\\*\\|\"]/g;\nvar controlRe = /[\\x00-\\x1f\\x80-\\x9f]/g;\nvar reservedRe = /^\\.+$/;\nvar windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\\..*)?$/i;\nvar windowsTrailingRe = /[\\. ]+$/;\n\nfunction sanitize(input, replacement) {\n if (typeof input !== 'string') {\n throw new Error('Input must be string');\n }\n var sanitized = input\n .replace(illegalRe, replacement)\n .replace(controlRe, replacement)\n .replace(reservedRe, replacement)\n .replace(windowsReservedRe, replacement)\n .replace(windowsTrailingRe, replacement);\n return truncate(sanitized, 255);\n}\n\nmodule.exports = function (input, options) {\n var replacement = (options && options.replacement) || '';\n var output = sanitize(input, replacement);\n if (replacement === '') {\n return output;\n }\n return sanitize(output, '');\n};\n\n\n//# sourceURL=webpack://light/./node_modules/sanitize-filename/index.js?"); + +/***/ }), + +/***/ "./node_modules/truncate-utf8-bytes/browser.js": +/*!*****************************************************!*\ + !*** ./node_modules/truncate-utf8-bytes/browser.js ***! + \*****************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +eval("\n\nvar truncate = __webpack_require__(/*! ./lib/truncate */ \"./node_modules/truncate-utf8-bytes/lib/truncate.js\");\nvar getLength = __webpack_require__(/*! utf8-byte-length/browser */ \"./node_modules/utf8-byte-length/browser.js\");\nmodule.exports = truncate.bind(null, getLength);\n\n\n//# sourceURL=webpack://light/./node_modules/truncate-utf8-bytes/browser.js?"); + +/***/ }), + +/***/ "./node_modules/truncate-utf8-bytes/lib/truncate.js": +/*!**********************************************************!*\ + !*** ./node_modules/truncate-utf8-bytes/lib/truncate.js ***! + \**********************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\nfunction isHighSurrogate(codePoint) {\n return codePoint >= 0xd800 && codePoint <= 0xdbff;\n}\n\nfunction isLowSurrogate(codePoint) {\n return codePoint >= 0xdc00 && codePoint <= 0xdfff;\n}\n\n// Truncate string by size in bytes\nmodule.exports = function truncate(getLength, string, byteLength) {\n if (typeof string !== \"string\") {\n throw new Error(\"Input must be string\");\n }\n\n var charLength = string.length;\n var curByteLength = 0;\n var codePoint;\n var segment;\n\n for (var i = 0; i < charLength; i += 1) {\n codePoint = string.charCodeAt(i);\n segment = string[i];\n\n if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {\n i += 1;\n segment += string[i];\n }\n\n curByteLength += getLength(segment);\n\n if (curByteLength === byteLength) {\n return string.slice(0, i + 1);\n }\n else if (curByteLength > byteLength) {\n return string.slice(0, i - segment.length + 1);\n }\n }\n\n return string;\n};\n\n\n\n//# sourceURL=webpack://light/./node_modules/truncate-utf8-bytes/lib/truncate.js?"); + +/***/ }), + +/***/ "./node_modules/utf8-byte-length/browser.js": +/*!**************************************************!*\ + !*** ./node_modules/utf8-byte-length/browser.js ***! + \**************************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n\nfunction isHighSurrogate(codePoint) {\n return codePoint >= 0xd800 && codePoint <= 0xdbff;\n}\n\nfunction isLowSurrogate(codePoint) {\n return codePoint >= 0xdc00 && codePoint <= 0xdfff;\n}\n\n// Truncate string by size in bytes\nmodule.exports = function getByteLength(string) {\n if (typeof string !== \"string\") {\n throw new Error(\"Input must be string\");\n }\n\n var charLength = string.length;\n var byteLength = 0;\n var codePoint = null;\n var prevCodePoint = null;\n for (var i = 0; i < charLength; i++) {\n codePoint = string.charCodeAt(i);\n // handle 4-byte non-BMP chars\n // low surrogate\n if (isLowSurrogate(codePoint)) {\n // when parsing previous hi-surrogate, 3 is added to byteLength\n if (prevCodePoint != null && isHighSurrogate(prevCodePoint)) {\n byteLength += 1;\n }\n else {\n byteLength += 3;\n }\n }\n else if (codePoint <= 0x7f ) {\n byteLength += 1;\n }\n else if (codePoint >= 0x80 && codePoint <= 0x7ff) {\n byteLength += 2;\n }\n else if (codePoint >= 0x800 && codePoint <= 0xffff) {\n byteLength += 3;\n }\n prevCodePoint = codePoint;\n }\n\n return byteLength;\n};\n\n\n//# sourceURL=webpack://light/./node_modules/utf8-byte-length/browser.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/native.js": +/*!******************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/native.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n randomUUID\n});\n\n//# sourceURL=webpack://light/./node_modules/uuid/dist/esm-browser/native.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/regex.js": +/*!*****************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/regex.js ***! + \*****************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);\n\n//# sourceURL=webpack://light/./node_modules/uuid/dist/esm-browser/regex.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/rng.js": +/*!***************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/rng.js ***! + \***************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ rng)\n/* harmony export */ });\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}\n\n//# sourceURL=webpack://light/./node_modules/uuid/dist/esm-browser/rng.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/stringify.js": +/*!*********************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***! + \*********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)\n/* harmony export */ });\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);\n\n//# sourceURL=webpack://light/./node_modules/uuid/dist/esm-browser/stringify.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/v4.js": +/*!**************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/v4.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ \"./node_modules/uuid/dist/esm-browser/native.js\");\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n\n\n\n\nfunction v4(options, buf, offset) {\n if (_native_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].randomUUID && !buf && !options) {\n return _native_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);\n\n//# sourceURL=webpack://light/./node_modules/uuid/dist/esm-browser/v4.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/validate.js": +/*!********************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/validate.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ \"./node_modules/uuid/dist/esm-browser/regex.js\");\n\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].test(uuid);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);\n\n//# sourceURL=webpack://light/./node_modules/uuid/dist/esm-browser/validate.js?"); + +/***/ }), + +/***/ "./node_modules/varint/decode.js": +/*!***************************************!*\ + !*** ./node_modules/varint/decode.js ***! + \***************************************/ +/***/ ((module) => { + +eval("module.exports = read\n\nvar MSB = 0x80\n , REST = 0x7F\n\nfunction read(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length\n\n do {\n if (counter >= l || shift > 49) {\n read.bytes = 0\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++]\n res += shift < 28\n ? (b & REST) << shift\n : (b & REST) * Math.pow(2, shift)\n shift += 7\n } while (b >= MSB)\n\n read.bytes = counter - offset\n\n return res\n}\n\n\n//# sourceURL=webpack://light/./node_modules/varint/decode.js?"); + +/***/ }), + +/***/ "./node_modules/varint/encode.js": +/*!***************************************!*\ + !*** ./node_modules/varint/encode.js ***! + \***************************************/ +/***/ ((module) => { + +eval("module.exports = encode\n\nvar MSB = 0x80\n , REST = 0x7F\n , MSBALL = ~REST\n , INT = Math.pow(2, 31)\n\nfunction encode(num, out, offset) {\n if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {\n encode.bytes = 0\n throw new RangeError('Could not encode varint')\n }\n out = out || []\n offset = offset || 0\n var oldOffset = offset\n\n while(num >= INT) {\n out[offset++] = (num & 0xFF) | MSB\n num /= 128\n }\n while(num & MSBALL) {\n out[offset++] = (num & 0xFF) | MSB\n num >>>= 7\n }\n out[offset] = num | 0\n \n encode.bytes = offset - oldOffset + 1\n \n return out\n}\n\n\n//# sourceURL=webpack://light/./node_modules/varint/encode.js?"); + +/***/ }), + +/***/ "./node_modules/varint/index.js": +/*!**************************************!*\ + !*** ./node_modules/varint/index.js ***! + \**************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("module.exports = {\n encode: __webpack_require__(/*! ./encode.js */ \"./node_modules/varint/encode.js\")\n , decode: __webpack_require__(/*! ./decode.js */ \"./node_modules/varint/decode.js\")\n , encodingLength: __webpack_require__(/*! ./length.js */ \"./node_modules/varint/length.js\")\n}\n\n\n//# sourceURL=webpack://light/./node_modules/varint/index.js?"); + +/***/ }), + +/***/ "./node_modules/varint/length.js": +/*!***************************************!*\ + !*** ./node_modules/varint/length.js ***! + \***************************************/ +/***/ ((module) => { + +eval("\nvar N1 = Math.pow(2, 7)\nvar N2 = Math.pow(2, 14)\nvar N3 = Math.pow(2, 21)\nvar N4 = Math.pow(2, 28)\nvar N5 = Math.pow(2, 35)\nvar N6 = Math.pow(2, 42)\nvar N7 = Math.pow(2, 49)\nvar N8 = Math.pow(2, 56)\nvar N9 = Math.pow(2, 63)\n\nmodule.exports = function (value) {\n return (\n value < N1 ? 1\n : value < N2 ? 2\n : value < N3 ? 3\n : value < N4 ? 4\n : value < N5 ? 5\n : value < N6 ? 6\n : value < N7 ? 7\n : value < N8 ? 8\n : value < N9 ? 9\n : 10\n )\n}\n\n\n//# sourceURL=webpack://light/./node_modules/varint/length.js?"); + +/***/ }), + +/***/ "?51ea": +/*!************************!*\ + !*** crypto (ignored) ***! + \************************/ +/***/ (() => { + +eval("/* (ignored) */\n\n//# sourceURL=webpack://light/crypto_(ignored)?"); + +/***/ }), + +/***/ "?ce41": +/*!************************!*\ + !*** crypto (ignored) ***! + \************************/ +/***/ (() => { + +eval("/* (ignored) */\n\n//# sourceURL=webpack://light/crypto_(ignored)?"); + +/***/ }), + +/***/ "?b254": +/*!************************!*\ + !*** crypto (ignored) ***! + \************************/ +/***/ (() => { + +eval("/* (ignored) */\n\n//# sourceURL=webpack://light/crypto_(ignored)?"); + +/***/ }), + +/***/ "?76c6": +/*!*************************!*\ + !*** cluster (ignored) ***! + \*************************/ +/***/ (() => { + +eval("/* (ignored) */\n\n//# sourceURL=webpack://light/cluster_(ignored)?"); + +/***/ }), + +/***/ "?4a7d": +/*!************************!*\ + !*** crypto (ignored) ***! + \************************/ +/***/ (() => { + +eval("/* (ignored) */\n\n//# sourceURL=webpack://light/crypto_(ignored)?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.cjs": +/*!***************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.cjs ***! + \***************************************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// @ts-nocheck\n/*eslint-disable*/\n(function(global, factory) { /* global define, require, module */\n\n /* AMD */ if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! protobufjs/minimal */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/minimal.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n /* CommonJS */ else {}\n\n})(this, function($protobuf) {\n \"use strict\";\n\n // Common aliases\n var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;\n\n // Exported root namespace\n var $root = $protobuf.roots[\"default\"] || ($protobuf.roots[\"default\"] = {});\n\n $root.RPC = (function() {\n\n /**\n * Properties of a RPC.\n * @exports IRPC\n * @interface IRPC\n * @property {Array.|null} [subscriptions] RPC subscriptions\n * @property {Array.|null} [messages] RPC messages\n * @property {RPC.IControlMessage|null} [control] RPC control\n */\n\n /**\n * Constructs a new RPC.\n * @exports RPC\n * @classdesc Represents a RPC.\n * @implements IRPC\n * @constructor\n * @param {IRPC=} [p] Properties to set\n */\n function RPC(p) {\n this.subscriptions = [];\n this.messages = [];\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * RPC subscriptions.\n * @member {Array.} subscriptions\n * @memberof RPC\n * @instance\n */\n RPC.prototype.subscriptions = $util.emptyArray;\n\n /**\n * RPC messages.\n * @member {Array.} messages\n * @memberof RPC\n * @instance\n */\n RPC.prototype.messages = $util.emptyArray;\n\n /**\n * RPC control.\n * @member {RPC.IControlMessage|null|undefined} control\n * @memberof RPC\n * @instance\n */\n RPC.prototype.control = null;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * RPC _control.\n * @member {\"control\"|undefined} _control\n * @memberof RPC\n * @instance\n */\n Object.defineProperty(RPC.prototype, \"_control\", {\n get: $util.oneOfGetter($oneOfFields = [\"control\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified RPC message. Does not implicitly {@link RPC.verify|verify} messages.\n * @function encode\n * @memberof RPC\n * @static\n * @param {IRPC} m RPC message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n RPC.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.subscriptions != null && m.subscriptions.length) {\n for (var i = 0; i < m.subscriptions.length; ++i)\n $root.RPC.SubOpts.encode(m.subscriptions[i], w.uint32(10).fork()).ldelim();\n }\n if (m.messages != null && m.messages.length) {\n for (var i = 0; i < m.messages.length; ++i)\n $root.RPC.Message.encode(m.messages[i], w.uint32(18).fork()).ldelim();\n }\n if (m.control != null && Object.hasOwnProperty.call(m, \"control\"))\n $root.RPC.ControlMessage.encode(m.control, w.uint32(26).fork()).ldelim();\n return w;\n };\n\n /**\n * Decodes a RPC message from the specified reader or buffer.\n * @function decode\n * @memberof RPC\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC} RPC\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n RPC.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n if (!(m.subscriptions && m.subscriptions.length))\n m.subscriptions = [];\n m.subscriptions.push($root.RPC.SubOpts.decode(r, r.uint32()));\n break;\n case 2:\n if (!(m.messages && m.messages.length))\n m.messages = [];\n m.messages.push($root.RPC.Message.decode(r, r.uint32()));\n break;\n case 3:\n m.control = $root.RPC.ControlMessage.decode(r, r.uint32());\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a RPC message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC} RPC\n */\n RPC.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC)\n return d;\n var m = new $root.RPC();\n if (d.subscriptions) {\n if (!Array.isArray(d.subscriptions))\n throw TypeError(\".RPC.subscriptions: array expected\");\n m.subscriptions = [];\n for (var i = 0; i < d.subscriptions.length; ++i) {\n if (typeof d.subscriptions[i] !== \"object\")\n throw TypeError(\".RPC.subscriptions: object expected\");\n m.subscriptions[i] = $root.RPC.SubOpts.fromObject(d.subscriptions[i]);\n }\n }\n if (d.messages) {\n if (!Array.isArray(d.messages))\n throw TypeError(\".RPC.messages: array expected\");\n m.messages = [];\n for (var i = 0; i < d.messages.length; ++i) {\n if (typeof d.messages[i] !== \"object\")\n throw TypeError(\".RPC.messages: object expected\");\n m.messages[i] = $root.RPC.Message.fromObject(d.messages[i]);\n }\n }\n if (d.control != null) {\n if (typeof d.control !== \"object\")\n throw TypeError(\".RPC.control: object expected\");\n m.control = $root.RPC.ControlMessage.fromObject(d.control);\n }\n return m;\n };\n\n /**\n * Creates a plain object from a RPC message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC\n * @static\n * @param {RPC} m RPC\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n RPC.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (o.arrays || o.defaults) {\n d.subscriptions = [];\n d.messages = [];\n }\n if (m.subscriptions && m.subscriptions.length) {\n d.subscriptions = [];\n for (var j = 0; j < m.subscriptions.length; ++j) {\n d.subscriptions[j] = $root.RPC.SubOpts.toObject(m.subscriptions[j], o);\n }\n }\n if (m.messages && m.messages.length) {\n d.messages = [];\n for (var j = 0; j < m.messages.length; ++j) {\n d.messages[j] = $root.RPC.Message.toObject(m.messages[j], o);\n }\n }\n if (m.control != null && m.hasOwnProperty(\"control\")) {\n d.control = $root.RPC.ControlMessage.toObject(m.control, o);\n if (o.oneofs)\n d._control = \"control\";\n }\n return d;\n };\n\n /**\n * Converts this RPC to JSON.\n * @function toJSON\n * @memberof RPC\n * @instance\n * @returns {Object.} JSON object\n */\n RPC.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n RPC.SubOpts = (function() {\n\n /**\n * Properties of a SubOpts.\n * @memberof RPC\n * @interface ISubOpts\n * @property {boolean|null} [subscribe] SubOpts subscribe\n * @property {string|null} [topic] SubOpts topic\n */\n\n /**\n * Constructs a new SubOpts.\n * @memberof RPC\n * @classdesc Represents a SubOpts.\n * @implements ISubOpts\n * @constructor\n * @param {RPC.ISubOpts=} [p] Properties to set\n */\n function SubOpts(p) {\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * SubOpts subscribe.\n * @member {boolean|null|undefined} subscribe\n * @memberof RPC.SubOpts\n * @instance\n */\n SubOpts.prototype.subscribe = null;\n\n /**\n * SubOpts topic.\n * @member {string|null|undefined} topic\n * @memberof RPC.SubOpts\n * @instance\n */\n SubOpts.prototype.topic = null;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * SubOpts _subscribe.\n * @member {\"subscribe\"|undefined} _subscribe\n * @memberof RPC.SubOpts\n * @instance\n */\n Object.defineProperty(SubOpts.prototype, \"_subscribe\", {\n get: $util.oneOfGetter($oneOfFields = [\"subscribe\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * SubOpts _topic.\n * @member {\"topic\"|undefined} _topic\n * @memberof RPC.SubOpts\n * @instance\n */\n Object.defineProperty(SubOpts.prototype, \"_topic\", {\n get: $util.oneOfGetter($oneOfFields = [\"topic\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified SubOpts message. Does not implicitly {@link RPC.SubOpts.verify|verify} messages.\n * @function encode\n * @memberof RPC.SubOpts\n * @static\n * @param {RPC.ISubOpts} m SubOpts message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n SubOpts.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.subscribe != null && Object.hasOwnProperty.call(m, \"subscribe\"))\n w.uint32(8).bool(m.subscribe);\n if (m.topic != null && Object.hasOwnProperty.call(m, \"topic\"))\n w.uint32(18).string(m.topic);\n return w;\n };\n\n /**\n * Decodes a SubOpts message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.SubOpts\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.SubOpts} SubOpts\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n SubOpts.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.SubOpts();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.subscribe = r.bool();\n break;\n case 2:\n m.topic = r.string();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a SubOpts message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.SubOpts\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.SubOpts} SubOpts\n */\n SubOpts.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.SubOpts)\n return d;\n var m = new $root.RPC.SubOpts();\n if (d.subscribe != null) {\n m.subscribe = Boolean(d.subscribe);\n }\n if (d.topic != null) {\n m.topic = String(d.topic);\n }\n return m;\n };\n\n /**\n * Creates a plain object from a SubOpts message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.SubOpts\n * @static\n * @param {RPC.SubOpts} m SubOpts\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n SubOpts.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (m.subscribe != null && m.hasOwnProperty(\"subscribe\")) {\n d.subscribe = m.subscribe;\n if (o.oneofs)\n d._subscribe = \"subscribe\";\n }\n if (m.topic != null && m.hasOwnProperty(\"topic\")) {\n d.topic = m.topic;\n if (o.oneofs)\n d._topic = \"topic\";\n }\n return d;\n };\n\n /**\n * Converts this SubOpts to JSON.\n * @function toJSON\n * @memberof RPC.SubOpts\n * @instance\n * @returns {Object.} JSON object\n */\n SubOpts.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return SubOpts;\n })();\n\n RPC.Message = (function() {\n\n /**\n * Properties of a Message.\n * @memberof RPC\n * @interface IMessage\n * @property {Uint8Array|null} [from] Message from\n * @property {Uint8Array|null} [data] Message data\n * @property {Uint8Array|null} [seqno] Message seqno\n * @property {string} topic Message topic\n * @property {Uint8Array|null} [signature] Message signature\n * @property {Uint8Array|null} [key] Message key\n */\n\n /**\n * Constructs a new Message.\n * @memberof RPC\n * @classdesc Represents a Message.\n * @implements IMessage\n * @constructor\n * @param {RPC.IMessage=} [p] Properties to set\n */\n function Message(p) {\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * Message from.\n * @member {Uint8Array|null|undefined} from\n * @memberof RPC.Message\n * @instance\n */\n Message.prototype.from = null;\n\n /**\n * Message data.\n * @member {Uint8Array|null|undefined} data\n * @memberof RPC.Message\n * @instance\n */\n Message.prototype.data = null;\n\n /**\n * Message seqno.\n * @member {Uint8Array|null|undefined} seqno\n * @memberof RPC.Message\n * @instance\n */\n Message.prototype.seqno = null;\n\n /**\n * Message topic.\n * @member {string} topic\n * @memberof RPC.Message\n * @instance\n */\n Message.prototype.topic = \"\";\n\n /**\n * Message signature.\n * @member {Uint8Array|null|undefined} signature\n * @memberof RPC.Message\n * @instance\n */\n Message.prototype.signature = null;\n\n /**\n * Message key.\n * @member {Uint8Array|null|undefined} key\n * @memberof RPC.Message\n * @instance\n */\n Message.prototype.key = null;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * Message _from.\n * @member {\"from\"|undefined} _from\n * @memberof RPC.Message\n * @instance\n */\n Object.defineProperty(Message.prototype, \"_from\", {\n get: $util.oneOfGetter($oneOfFields = [\"from\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Message _data.\n * @member {\"data\"|undefined} _data\n * @memberof RPC.Message\n * @instance\n */\n Object.defineProperty(Message.prototype, \"_data\", {\n get: $util.oneOfGetter($oneOfFields = [\"data\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Message _seqno.\n * @member {\"seqno\"|undefined} _seqno\n * @memberof RPC.Message\n * @instance\n */\n Object.defineProperty(Message.prototype, \"_seqno\", {\n get: $util.oneOfGetter($oneOfFields = [\"seqno\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Message _signature.\n * @member {\"signature\"|undefined} _signature\n * @memberof RPC.Message\n * @instance\n */\n Object.defineProperty(Message.prototype, \"_signature\", {\n get: $util.oneOfGetter($oneOfFields = [\"signature\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Message _key.\n * @member {\"key\"|undefined} _key\n * @memberof RPC.Message\n * @instance\n */\n Object.defineProperty(Message.prototype, \"_key\", {\n get: $util.oneOfGetter($oneOfFields = [\"key\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified Message message. Does not implicitly {@link RPC.Message.verify|verify} messages.\n * @function encode\n * @memberof RPC.Message\n * @static\n * @param {RPC.IMessage} m Message message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Message.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.from != null && Object.hasOwnProperty.call(m, \"from\"))\n w.uint32(10).bytes(m.from);\n if (m.data != null && Object.hasOwnProperty.call(m, \"data\"))\n w.uint32(18).bytes(m.data);\n if (m.seqno != null && Object.hasOwnProperty.call(m, \"seqno\"))\n w.uint32(26).bytes(m.seqno);\n w.uint32(34).string(m.topic);\n if (m.signature != null && Object.hasOwnProperty.call(m, \"signature\"))\n w.uint32(42).bytes(m.signature);\n if (m.key != null && Object.hasOwnProperty.call(m, \"key\"))\n w.uint32(50).bytes(m.key);\n return w;\n };\n\n /**\n * Decodes a Message message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.Message\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.Message} Message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Message.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.Message();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.from = r.bytes();\n break;\n case 2:\n m.data = r.bytes();\n break;\n case 3:\n m.seqno = r.bytes();\n break;\n case 4:\n m.topic = r.string();\n break;\n case 5:\n m.signature = r.bytes();\n break;\n case 6:\n m.key = r.bytes();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n if (!m.hasOwnProperty(\"topic\"))\n throw $util.ProtocolError(\"missing required 'topic'\", { instance: m });\n return m;\n };\n\n /**\n * Creates a Message message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.Message\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.Message} Message\n */\n Message.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.Message)\n return d;\n var m = new $root.RPC.Message();\n if (d.from != null) {\n if (typeof d.from === \"string\")\n $util.base64.decode(d.from, m.from = $util.newBuffer($util.base64.length(d.from)), 0);\n else if (d.from.length)\n m.from = d.from;\n }\n if (d.data != null) {\n if (typeof d.data === \"string\")\n $util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);\n else if (d.data.length)\n m.data = d.data;\n }\n if (d.seqno != null) {\n if (typeof d.seqno === \"string\")\n $util.base64.decode(d.seqno, m.seqno = $util.newBuffer($util.base64.length(d.seqno)), 0);\n else if (d.seqno.length)\n m.seqno = d.seqno;\n }\n if (d.topic != null) {\n m.topic = String(d.topic);\n }\n if (d.signature != null) {\n if (typeof d.signature === \"string\")\n $util.base64.decode(d.signature, m.signature = $util.newBuffer($util.base64.length(d.signature)), 0);\n else if (d.signature.length)\n m.signature = d.signature;\n }\n if (d.key != null) {\n if (typeof d.key === \"string\")\n $util.base64.decode(d.key, m.key = $util.newBuffer($util.base64.length(d.key)), 0);\n else if (d.key.length)\n m.key = d.key;\n }\n return m;\n };\n\n /**\n * Creates a plain object from a Message message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.Message\n * @static\n * @param {RPC.Message} m Message\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n Message.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (o.defaults) {\n d.topic = \"\";\n }\n if (m.from != null && m.hasOwnProperty(\"from\")) {\n d.from = o.bytes === String ? $util.base64.encode(m.from, 0, m.from.length) : o.bytes === Array ? Array.prototype.slice.call(m.from) : m.from;\n if (o.oneofs)\n d._from = \"from\";\n }\n if (m.data != null && m.hasOwnProperty(\"data\")) {\n d.data = o.bytes === String ? $util.base64.encode(m.data, 0, m.data.length) : o.bytes === Array ? Array.prototype.slice.call(m.data) : m.data;\n if (o.oneofs)\n d._data = \"data\";\n }\n if (m.seqno != null && m.hasOwnProperty(\"seqno\")) {\n d.seqno = o.bytes === String ? $util.base64.encode(m.seqno, 0, m.seqno.length) : o.bytes === Array ? Array.prototype.slice.call(m.seqno) : m.seqno;\n if (o.oneofs)\n d._seqno = \"seqno\";\n }\n if (m.topic != null && m.hasOwnProperty(\"topic\")) {\n d.topic = m.topic;\n }\n if (m.signature != null && m.hasOwnProperty(\"signature\")) {\n d.signature = o.bytes === String ? $util.base64.encode(m.signature, 0, m.signature.length) : o.bytes === Array ? Array.prototype.slice.call(m.signature) : m.signature;\n if (o.oneofs)\n d._signature = \"signature\";\n }\n if (m.key != null && m.hasOwnProperty(\"key\")) {\n d.key = o.bytes === String ? $util.base64.encode(m.key, 0, m.key.length) : o.bytes === Array ? Array.prototype.slice.call(m.key) : m.key;\n if (o.oneofs)\n d._key = \"key\";\n }\n return d;\n };\n\n /**\n * Converts this Message to JSON.\n * @function toJSON\n * @memberof RPC.Message\n * @instance\n * @returns {Object.} JSON object\n */\n Message.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return Message;\n })();\n\n RPC.ControlMessage = (function() {\n\n /**\n * Properties of a ControlMessage.\n * @memberof RPC\n * @interface IControlMessage\n * @property {Array.|null} [ihave] ControlMessage ihave\n * @property {Array.|null} [iwant] ControlMessage iwant\n * @property {Array.|null} [graft] ControlMessage graft\n * @property {Array.|null} [prune] ControlMessage prune\n */\n\n /**\n * Constructs a new ControlMessage.\n * @memberof RPC\n * @classdesc Represents a ControlMessage.\n * @implements IControlMessage\n * @constructor\n * @param {RPC.IControlMessage=} [p] Properties to set\n */\n function ControlMessage(p) {\n this.ihave = [];\n this.iwant = [];\n this.graft = [];\n this.prune = [];\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * ControlMessage ihave.\n * @member {Array.} ihave\n * @memberof RPC.ControlMessage\n * @instance\n */\n ControlMessage.prototype.ihave = $util.emptyArray;\n\n /**\n * ControlMessage iwant.\n * @member {Array.} iwant\n * @memberof RPC.ControlMessage\n * @instance\n */\n ControlMessage.prototype.iwant = $util.emptyArray;\n\n /**\n * ControlMessage graft.\n * @member {Array.} graft\n * @memberof RPC.ControlMessage\n * @instance\n */\n ControlMessage.prototype.graft = $util.emptyArray;\n\n /**\n * ControlMessage prune.\n * @member {Array.} prune\n * @memberof RPC.ControlMessage\n * @instance\n */\n ControlMessage.prototype.prune = $util.emptyArray;\n\n /**\n * Encodes the specified ControlMessage message. Does not implicitly {@link RPC.ControlMessage.verify|verify} messages.\n * @function encode\n * @memberof RPC.ControlMessage\n * @static\n * @param {RPC.IControlMessage} m ControlMessage message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ControlMessage.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.ihave != null && m.ihave.length) {\n for (var i = 0; i < m.ihave.length; ++i)\n $root.RPC.ControlIHave.encode(m.ihave[i], w.uint32(10).fork()).ldelim();\n }\n if (m.iwant != null && m.iwant.length) {\n for (var i = 0; i < m.iwant.length; ++i)\n $root.RPC.ControlIWant.encode(m.iwant[i], w.uint32(18).fork()).ldelim();\n }\n if (m.graft != null && m.graft.length) {\n for (var i = 0; i < m.graft.length; ++i)\n $root.RPC.ControlGraft.encode(m.graft[i], w.uint32(26).fork()).ldelim();\n }\n if (m.prune != null && m.prune.length) {\n for (var i = 0; i < m.prune.length; ++i)\n $root.RPC.ControlPrune.encode(m.prune[i], w.uint32(34).fork()).ldelim();\n }\n return w;\n };\n\n /**\n * Decodes a ControlMessage message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.ControlMessage\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.ControlMessage} ControlMessage\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ControlMessage.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.ControlMessage();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n if (!(m.ihave && m.ihave.length))\n m.ihave = [];\n m.ihave.push($root.RPC.ControlIHave.decode(r, r.uint32()));\n break;\n case 2:\n if (!(m.iwant && m.iwant.length))\n m.iwant = [];\n m.iwant.push($root.RPC.ControlIWant.decode(r, r.uint32()));\n break;\n case 3:\n if (!(m.graft && m.graft.length))\n m.graft = [];\n m.graft.push($root.RPC.ControlGraft.decode(r, r.uint32()));\n break;\n case 4:\n if (!(m.prune && m.prune.length))\n m.prune = [];\n m.prune.push($root.RPC.ControlPrune.decode(r, r.uint32()));\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a ControlMessage message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.ControlMessage\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.ControlMessage} ControlMessage\n */\n ControlMessage.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.ControlMessage)\n return d;\n var m = new $root.RPC.ControlMessage();\n if (d.ihave) {\n if (!Array.isArray(d.ihave))\n throw TypeError(\".RPC.ControlMessage.ihave: array expected\");\n m.ihave = [];\n for (var i = 0; i < d.ihave.length; ++i) {\n if (typeof d.ihave[i] !== \"object\")\n throw TypeError(\".RPC.ControlMessage.ihave: object expected\");\n m.ihave[i] = $root.RPC.ControlIHave.fromObject(d.ihave[i]);\n }\n }\n if (d.iwant) {\n if (!Array.isArray(d.iwant))\n throw TypeError(\".RPC.ControlMessage.iwant: array expected\");\n m.iwant = [];\n for (var i = 0; i < d.iwant.length; ++i) {\n if (typeof d.iwant[i] !== \"object\")\n throw TypeError(\".RPC.ControlMessage.iwant: object expected\");\n m.iwant[i] = $root.RPC.ControlIWant.fromObject(d.iwant[i]);\n }\n }\n if (d.graft) {\n if (!Array.isArray(d.graft))\n throw TypeError(\".RPC.ControlMessage.graft: array expected\");\n m.graft = [];\n for (var i = 0; i < d.graft.length; ++i) {\n if (typeof d.graft[i] !== \"object\")\n throw TypeError(\".RPC.ControlMessage.graft: object expected\");\n m.graft[i] = $root.RPC.ControlGraft.fromObject(d.graft[i]);\n }\n }\n if (d.prune) {\n if (!Array.isArray(d.prune))\n throw TypeError(\".RPC.ControlMessage.prune: array expected\");\n m.prune = [];\n for (var i = 0; i < d.prune.length; ++i) {\n if (typeof d.prune[i] !== \"object\")\n throw TypeError(\".RPC.ControlMessage.prune: object expected\");\n m.prune[i] = $root.RPC.ControlPrune.fromObject(d.prune[i]);\n }\n }\n return m;\n };\n\n /**\n * Creates a plain object from a ControlMessage message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.ControlMessage\n * @static\n * @param {RPC.ControlMessage} m ControlMessage\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n ControlMessage.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (o.arrays || o.defaults) {\n d.ihave = [];\n d.iwant = [];\n d.graft = [];\n d.prune = [];\n }\n if (m.ihave && m.ihave.length) {\n d.ihave = [];\n for (var j = 0; j < m.ihave.length; ++j) {\n d.ihave[j] = $root.RPC.ControlIHave.toObject(m.ihave[j], o);\n }\n }\n if (m.iwant && m.iwant.length) {\n d.iwant = [];\n for (var j = 0; j < m.iwant.length; ++j) {\n d.iwant[j] = $root.RPC.ControlIWant.toObject(m.iwant[j], o);\n }\n }\n if (m.graft && m.graft.length) {\n d.graft = [];\n for (var j = 0; j < m.graft.length; ++j) {\n d.graft[j] = $root.RPC.ControlGraft.toObject(m.graft[j], o);\n }\n }\n if (m.prune && m.prune.length) {\n d.prune = [];\n for (var j = 0; j < m.prune.length; ++j) {\n d.prune[j] = $root.RPC.ControlPrune.toObject(m.prune[j], o);\n }\n }\n return d;\n };\n\n /**\n * Converts this ControlMessage to JSON.\n * @function toJSON\n * @memberof RPC.ControlMessage\n * @instance\n * @returns {Object.} JSON object\n */\n ControlMessage.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return ControlMessage;\n })();\n\n RPC.ControlIHave = (function() {\n\n /**\n * Properties of a ControlIHave.\n * @memberof RPC\n * @interface IControlIHave\n * @property {string|null} [topicID] ControlIHave topicID\n * @property {Array.|null} [messageIDs] ControlIHave messageIDs\n */\n\n /**\n * Constructs a new ControlIHave.\n * @memberof RPC\n * @classdesc Represents a ControlIHave.\n * @implements IControlIHave\n * @constructor\n * @param {RPC.IControlIHave=} [p] Properties to set\n */\n function ControlIHave(p) {\n this.messageIDs = [];\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * ControlIHave topicID.\n * @member {string|null|undefined} topicID\n * @memberof RPC.ControlIHave\n * @instance\n */\n ControlIHave.prototype.topicID = null;\n\n /**\n * ControlIHave messageIDs.\n * @member {Array.} messageIDs\n * @memberof RPC.ControlIHave\n * @instance\n */\n ControlIHave.prototype.messageIDs = $util.emptyArray;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * ControlIHave _topicID.\n * @member {\"topicID\"|undefined} _topicID\n * @memberof RPC.ControlIHave\n * @instance\n */\n Object.defineProperty(ControlIHave.prototype, \"_topicID\", {\n get: $util.oneOfGetter($oneOfFields = [\"topicID\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified ControlIHave message. Does not implicitly {@link RPC.ControlIHave.verify|verify} messages.\n * @function encode\n * @memberof RPC.ControlIHave\n * @static\n * @param {RPC.IControlIHave} m ControlIHave message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ControlIHave.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.topicID != null && Object.hasOwnProperty.call(m, \"topicID\"))\n w.uint32(10).string(m.topicID);\n if (m.messageIDs != null && m.messageIDs.length) {\n for (var i = 0; i < m.messageIDs.length; ++i)\n w.uint32(18).bytes(m.messageIDs[i]);\n }\n return w;\n };\n\n /**\n * Decodes a ControlIHave message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.ControlIHave\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.ControlIHave} ControlIHave\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ControlIHave.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.ControlIHave();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.topicID = r.string();\n break;\n case 2:\n if (!(m.messageIDs && m.messageIDs.length))\n m.messageIDs = [];\n m.messageIDs.push(r.bytes());\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a ControlIHave message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.ControlIHave\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.ControlIHave} ControlIHave\n */\n ControlIHave.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.ControlIHave)\n return d;\n var m = new $root.RPC.ControlIHave();\n if (d.topicID != null) {\n m.topicID = String(d.topicID);\n }\n if (d.messageIDs) {\n if (!Array.isArray(d.messageIDs))\n throw TypeError(\".RPC.ControlIHave.messageIDs: array expected\");\n m.messageIDs = [];\n for (var i = 0; i < d.messageIDs.length; ++i) {\n if (typeof d.messageIDs[i] === \"string\")\n $util.base64.decode(d.messageIDs[i], m.messageIDs[i] = $util.newBuffer($util.base64.length(d.messageIDs[i])), 0);\n else if (d.messageIDs[i].length)\n m.messageIDs[i] = d.messageIDs[i];\n }\n }\n return m;\n };\n\n /**\n * Creates a plain object from a ControlIHave message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.ControlIHave\n * @static\n * @param {RPC.ControlIHave} m ControlIHave\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n ControlIHave.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (o.arrays || o.defaults) {\n d.messageIDs = [];\n }\n if (m.topicID != null && m.hasOwnProperty(\"topicID\")) {\n d.topicID = m.topicID;\n if (o.oneofs)\n d._topicID = \"topicID\";\n }\n if (m.messageIDs && m.messageIDs.length) {\n d.messageIDs = [];\n for (var j = 0; j < m.messageIDs.length; ++j) {\n d.messageIDs[j] = o.bytes === String ? $util.base64.encode(m.messageIDs[j], 0, m.messageIDs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.messageIDs[j]) : m.messageIDs[j];\n }\n }\n return d;\n };\n\n /**\n * Converts this ControlIHave to JSON.\n * @function toJSON\n * @memberof RPC.ControlIHave\n * @instance\n * @returns {Object.} JSON object\n */\n ControlIHave.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return ControlIHave;\n })();\n\n RPC.ControlIWant = (function() {\n\n /**\n * Properties of a ControlIWant.\n * @memberof RPC\n * @interface IControlIWant\n * @property {Array.|null} [messageIDs] ControlIWant messageIDs\n */\n\n /**\n * Constructs a new ControlIWant.\n * @memberof RPC\n * @classdesc Represents a ControlIWant.\n * @implements IControlIWant\n * @constructor\n * @param {RPC.IControlIWant=} [p] Properties to set\n */\n function ControlIWant(p) {\n this.messageIDs = [];\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * ControlIWant messageIDs.\n * @member {Array.} messageIDs\n * @memberof RPC.ControlIWant\n * @instance\n */\n ControlIWant.prototype.messageIDs = $util.emptyArray;\n\n /**\n * Encodes the specified ControlIWant message. Does not implicitly {@link RPC.ControlIWant.verify|verify} messages.\n * @function encode\n * @memberof RPC.ControlIWant\n * @static\n * @param {RPC.IControlIWant} m ControlIWant message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ControlIWant.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.messageIDs != null && m.messageIDs.length) {\n for (var i = 0; i < m.messageIDs.length; ++i)\n w.uint32(10).bytes(m.messageIDs[i]);\n }\n return w;\n };\n\n /**\n * Decodes a ControlIWant message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.ControlIWant\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.ControlIWant} ControlIWant\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ControlIWant.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.ControlIWant();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n if (!(m.messageIDs && m.messageIDs.length))\n m.messageIDs = [];\n m.messageIDs.push(r.bytes());\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a ControlIWant message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.ControlIWant\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.ControlIWant} ControlIWant\n */\n ControlIWant.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.ControlIWant)\n return d;\n var m = new $root.RPC.ControlIWant();\n if (d.messageIDs) {\n if (!Array.isArray(d.messageIDs))\n throw TypeError(\".RPC.ControlIWant.messageIDs: array expected\");\n m.messageIDs = [];\n for (var i = 0; i < d.messageIDs.length; ++i) {\n if (typeof d.messageIDs[i] === \"string\")\n $util.base64.decode(d.messageIDs[i], m.messageIDs[i] = $util.newBuffer($util.base64.length(d.messageIDs[i])), 0);\n else if (d.messageIDs[i].length)\n m.messageIDs[i] = d.messageIDs[i];\n }\n }\n return m;\n };\n\n /**\n * Creates a plain object from a ControlIWant message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.ControlIWant\n * @static\n * @param {RPC.ControlIWant} m ControlIWant\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n ControlIWant.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (o.arrays || o.defaults) {\n d.messageIDs = [];\n }\n if (m.messageIDs && m.messageIDs.length) {\n d.messageIDs = [];\n for (var j = 0; j < m.messageIDs.length; ++j) {\n d.messageIDs[j] = o.bytes === String ? $util.base64.encode(m.messageIDs[j], 0, m.messageIDs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.messageIDs[j]) : m.messageIDs[j];\n }\n }\n return d;\n };\n\n /**\n * Converts this ControlIWant to JSON.\n * @function toJSON\n * @memberof RPC.ControlIWant\n * @instance\n * @returns {Object.} JSON object\n */\n ControlIWant.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return ControlIWant;\n })();\n\n RPC.ControlGraft = (function() {\n\n /**\n * Properties of a ControlGraft.\n * @memberof RPC\n * @interface IControlGraft\n * @property {string|null} [topicID] ControlGraft topicID\n */\n\n /**\n * Constructs a new ControlGraft.\n * @memberof RPC\n * @classdesc Represents a ControlGraft.\n * @implements IControlGraft\n * @constructor\n * @param {RPC.IControlGraft=} [p] Properties to set\n */\n function ControlGraft(p) {\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * ControlGraft topicID.\n * @member {string|null|undefined} topicID\n * @memberof RPC.ControlGraft\n * @instance\n */\n ControlGraft.prototype.topicID = null;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * ControlGraft _topicID.\n * @member {\"topicID\"|undefined} _topicID\n * @memberof RPC.ControlGraft\n * @instance\n */\n Object.defineProperty(ControlGraft.prototype, \"_topicID\", {\n get: $util.oneOfGetter($oneOfFields = [\"topicID\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified ControlGraft message. Does not implicitly {@link RPC.ControlGraft.verify|verify} messages.\n * @function encode\n * @memberof RPC.ControlGraft\n * @static\n * @param {RPC.IControlGraft} m ControlGraft message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ControlGraft.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.topicID != null && Object.hasOwnProperty.call(m, \"topicID\"))\n w.uint32(10).string(m.topicID);\n return w;\n };\n\n /**\n * Decodes a ControlGraft message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.ControlGraft\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.ControlGraft} ControlGraft\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ControlGraft.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.ControlGraft();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.topicID = r.string();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a ControlGraft message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.ControlGraft\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.ControlGraft} ControlGraft\n */\n ControlGraft.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.ControlGraft)\n return d;\n var m = new $root.RPC.ControlGraft();\n if (d.topicID != null) {\n m.topicID = String(d.topicID);\n }\n return m;\n };\n\n /**\n * Creates a plain object from a ControlGraft message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.ControlGraft\n * @static\n * @param {RPC.ControlGraft} m ControlGraft\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n ControlGraft.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (m.topicID != null && m.hasOwnProperty(\"topicID\")) {\n d.topicID = m.topicID;\n if (o.oneofs)\n d._topicID = \"topicID\";\n }\n return d;\n };\n\n /**\n * Converts this ControlGraft to JSON.\n * @function toJSON\n * @memberof RPC.ControlGraft\n * @instance\n * @returns {Object.} JSON object\n */\n ControlGraft.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return ControlGraft;\n })();\n\n RPC.ControlPrune = (function() {\n\n /**\n * Properties of a ControlPrune.\n * @memberof RPC\n * @interface IControlPrune\n * @property {string|null} [topicID] ControlPrune topicID\n * @property {Array.|null} [peers] ControlPrune peers\n * @property {number|null} [backoff] ControlPrune backoff\n */\n\n /**\n * Constructs a new ControlPrune.\n * @memberof RPC\n * @classdesc Represents a ControlPrune.\n * @implements IControlPrune\n * @constructor\n * @param {RPC.IControlPrune=} [p] Properties to set\n */\n function ControlPrune(p) {\n this.peers = [];\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * ControlPrune topicID.\n * @member {string|null|undefined} topicID\n * @memberof RPC.ControlPrune\n * @instance\n */\n ControlPrune.prototype.topicID = null;\n\n /**\n * ControlPrune peers.\n * @member {Array.} peers\n * @memberof RPC.ControlPrune\n * @instance\n */\n ControlPrune.prototype.peers = $util.emptyArray;\n\n /**\n * ControlPrune backoff.\n * @member {number|null|undefined} backoff\n * @memberof RPC.ControlPrune\n * @instance\n */\n ControlPrune.prototype.backoff = null;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * ControlPrune _topicID.\n * @member {\"topicID\"|undefined} _topicID\n * @memberof RPC.ControlPrune\n * @instance\n */\n Object.defineProperty(ControlPrune.prototype, \"_topicID\", {\n get: $util.oneOfGetter($oneOfFields = [\"topicID\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * ControlPrune _backoff.\n * @member {\"backoff\"|undefined} _backoff\n * @memberof RPC.ControlPrune\n * @instance\n */\n Object.defineProperty(ControlPrune.prototype, \"_backoff\", {\n get: $util.oneOfGetter($oneOfFields = [\"backoff\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified ControlPrune message. Does not implicitly {@link RPC.ControlPrune.verify|verify} messages.\n * @function encode\n * @memberof RPC.ControlPrune\n * @static\n * @param {RPC.IControlPrune} m ControlPrune message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ControlPrune.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.topicID != null && Object.hasOwnProperty.call(m, \"topicID\"))\n w.uint32(10).string(m.topicID);\n if (m.peers != null && m.peers.length) {\n for (var i = 0; i < m.peers.length; ++i)\n $root.RPC.PeerInfo.encode(m.peers[i], w.uint32(18).fork()).ldelim();\n }\n if (m.backoff != null && Object.hasOwnProperty.call(m, \"backoff\"))\n w.uint32(24).uint64(m.backoff);\n return w;\n };\n\n /**\n * Decodes a ControlPrune message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.ControlPrune\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.ControlPrune} ControlPrune\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ControlPrune.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.ControlPrune();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.topicID = r.string();\n break;\n case 2:\n if (!(m.peers && m.peers.length))\n m.peers = [];\n m.peers.push($root.RPC.PeerInfo.decode(r, r.uint32()));\n break;\n case 3:\n m.backoff = r.uint64();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a ControlPrune message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.ControlPrune\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.ControlPrune} ControlPrune\n */\n ControlPrune.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.ControlPrune)\n return d;\n var m = new $root.RPC.ControlPrune();\n if (d.topicID != null) {\n m.topicID = String(d.topicID);\n }\n if (d.peers) {\n if (!Array.isArray(d.peers))\n throw TypeError(\".RPC.ControlPrune.peers: array expected\");\n m.peers = [];\n for (var i = 0; i < d.peers.length; ++i) {\n if (typeof d.peers[i] !== \"object\")\n throw TypeError(\".RPC.ControlPrune.peers: object expected\");\n m.peers[i] = $root.RPC.PeerInfo.fromObject(d.peers[i]);\n }\n }\n if (d.backoff != null) {\n if ($util.Long)\n (m.backoff = $util.Long.fromValue(d.backoff)).unsigned = true;\n else if (typeof d.backoff === \"string\")\n m.backoff = parseInt(d.backoff, 10);\n else if (typeof d.backoff === \"number\")\n m.backoff = d.backoff;\n else if (typeof d.backoff === \"object\")\n m.backoff = new $util.LongBits(d.backoff.low >>> 0, d.backoff.high >>> 0).toNumber(true);\n }\n return m;\n };\n\n /**\n * Creates a plain object from a ControlPrune message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.ControlPrune\n * @static\n * @param {RPC.ControlPrune} m ControlPrune\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n ControlPrune.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (o.arrays || o.defaults) {\n d.peers = [];\n }\n if (m.topicID != null && m.hasOwnProperty(\"topicID\")) {\n d.topicID = m.topicID;\n if (o.oneofs)\n d._topicID = \"topicID\";\n }\n if (m.peers && m.peers.length) {\n d.peers = [];\n for (var j = 0; j < m.peers.length; ++j) {\n d.peers[j] = $root.RPC.PeerInfo.toObject(m.peers[j], o);\n }\n }\n if (m.backoff != null && m.hasOwnProperty(\"backoff\")) {\n if (typeof m.backoff === \"number\")\n d.backoff = o.longs === String ? String(m.backoff) : m.backoff;\n else\n d.backoff = o.longs === String ? $util.Long.prototype.toString.call(m.backoff) : o.longs === Number ? new $util.LongBits(m.backoff.low >>> 0, m.backoff.high >>> 0).toNumber(true) : m.backoff;\n if (o.oneofs)\n d._backoff = \"backoff\";\n }\n return d;\n };\n\n /**\n * Converts this ControlPrune to JSON.\n * @function toJSON\n * @memberof RPC.ControlPrune\n * @instance\n * @returns {Object.} JSON object\n */\n ControlPrune.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return ControlPrune;\n })();\n\n RPC.PeerInfo = (function() {\n\n /**\n * Properties of a PeerInfo.\n * @memberof RPC\n * @interface IPeerInfo\n * @property {Uint8Array|null} [peerID] PeerInfo peerID\n * @property {Uint8Array|null} [signedPeerRecord] PeerInfo signedPeerRecord\n */\n\n /**\n * Constructs a new PeerInfo.\n * @memberof RPC\n * @classdesc Represents a PeerInfo.\n * @implements IPeerInfo\n * @constructor\n * @param {RPC.IPeerInfo=} [p] Properties to set\n */\n function PeerInfo(p) {\n if (p)\n for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)\n if (p[ks[i]] != null)\n this[ks[i]] = p[ks[i]];\n }\n\n /**\n * PeerInfo peerID.\n * @member {Uint8Array|null|undefined} peerID\n * @memberof RPC.PeerInfo\n * @instance\n */\n PeerInfo.prototype.peerID = null;\n\n /**\n * PeerInfo signedPeerRecord.\n * @member {Uint8Array|null|undefined} signedPeerRecord\n * @memberof RPC.PeerInfo\n * @instance\n */\n PeerInfo.prototype.signedPeerRecord = null;\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * PeerInfo _peerID.\n * @member {\"peerID\"|undefined} _peerID\n * @memberof RPC.PeerInfo\n * @instance\n */\n Object.defineProperty(PeerInfo.prototype, \"_peerID\", {\n get: $util.oneOfGetter($oneOfFields = [\"peerID\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * PeerInfo _signedPeerRecord.\n * @member {\"signedPeerRecord\"|undefined} _signedPeerRecord\n * @memberof RPC.PeerInfo\n * @instance\n */\n Object.defineProperty(PeerInfo.prototype, \"_signedPeerRecord\", {\n get: $util.oneOfGetter($oneOfFields = [\"signedPeerRecord\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Encodes the specified PeerInfo message. Does not implicitly {@link RPC.PeerInfo.verify|verify} messages.\n * @function encode\n * @memberof RPC.PeerInfo\n * @static\n * @param {RPC.IPeerInfo} m PeerInfo message or plain object to encode\n * @param {$protobuf.Writer} [w] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n PeerInfo.encode = function encode(m, w) {\n if (!w)\n w = $Writer.create();\n if (m.peerID != null && Object.hasOwnProperty.call(m, \"peerID\"))\n w.uint32(10).bytes(m.peerID);\n if (m.signedPeerRecord != null && Object.hasOwnProperty.call(m, \"signedPeerRecord\"))\n w.uint32(18).bytes(m.signedPeerRecord);\n return w;\n };\n\n /**\n * Decodes a PeerInfo message from the specified reader or buffer.\n * @function decode\n * @memberof RPC.PeerInfo\n * @static\n * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from\n * @param {number} [l] Message length if known beforehand\n * @returns {RPC.PeerInfo} PeerInfo\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n PeerInfo.decode = function decode(r, l) {\n if (!(r instanceof $Reader))\n r = $Reader.create(r);\n var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.PeerInfo();\n while (r.pos < c) {\n var t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.peerID = r.bytes();\n break;\n case 2:\n m.signedPeerRecord = r.bytes();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n };\n\n /**\n * Creates a PeerInfo message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof RPC.PeerInfo\n * @static\n * @param {Object.} d Plain object\n * @returns {RPC.PeerInfo} PeerInfo\n */\n PeerInfo.fromObject = function fromObject(d) {\n if (d instanceof $root.RPC.PeerInfo)\n return d;\n var m = new $root.RPC.PeerInfo();\n if (d.peerID != null) {\n if (typeof d.peerID === \"string\")\n $util.base64.decode(d.peerID, m.peerID = $util.newBuffer($util.base64.length(d.peerID)), 0);\n else if (d.peerID.length)\n m.peerID = d.peerID;\n }\n if (d.signedPeerRecord != null) {\n if (typeof d.signedPeerRecord === \"string\")\n $util.base64.decode(d.signedPeerRecord, m.signedPeerRecord = $util.newBuffer($util.base64.length(d.signedPeerRecord)), 0);\n else if (d.signedPeerRecord.length)\n m.signedPeerRecord = d.signedPeerRecord;\n }\n return m;\n };\n\n /**\n * Creates a plain object from a PeerInfo message. Also converts values to other types if specified.\n * @function toObject\n * @memberof RPC.PeerInfo\n * @static\n * @param {RPC.PeerInfo} m PeerInfo\n * @param {$protobuf.IConversionOptions} [o] Conversion options\n * @returns {Object.} Plain object\n */\n PeerInfo.toObject = function toObject(m, o) {\n if (!o)\n o = {};\n var d = {};\n if (m.peerID != null && m.hasOwnProperty(\"peerID\")) {\n d.peerID = o.bytes === String ? $util.base64.encode(m.peerID, 0, m.peerID.length) : o.bytes === Array ? Array.prototype.slice.call(m.peerID) : m.peerID;\n if (o.oneofs)\n d._peerID = \"peerID\";\n }\n if (m.signedPeerRecord != null && m.hasOwnProperty(\"signedPeerRecord\")) {\n d.signedPeerRecord = o.bytes === String ? $util.base64.encode(m.signedPeerRecord, 0, m.signedPeerRecord.length) : o.bytes === Array ? Array.prototype.slice.call(m.signedPeerRecord) : m.signedPeerRecord;\n if (o.oneofs)\n d._signedPeerRecord = \"signedPeerRecord\";\n }\n return d;\n };\n\n /**\n * Converts this PeerInfo to JSON.\n * @function toJSON\n * @memberof RPC.PeerInfo\n * @instance\n * @returns {Object.} JSON object\n */\n PeerInfo.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n return PeerInfo;\n })();\n\n return RPC;\n })();\n\n return $root;\n});\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.cjs?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/is-ip/lib/is-ip.js": +/*!****************************************************!*\ + !*** ./node_modules/@chainsafe/is-ip/lib/is-ip.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ipVersion: () => (/* binding */ ipVersion),\n/* harmony export */ isIP: () => (/* binding */ isIP),\n/* harmony export */ isIPv4: () => (/* binding */ isIPv4),\n/* harmony export */ isIPv6: () => (/* binding */ isIPv6)\n/* harmony export */ });\n/* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parse.js */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n\n/** Check if `input` is IPv4. */\nfunction isIPv4(input) {\n return Boolean((0,_parse_js__WEBPACK_IMPORTED_MODULE_0__.parseIPv4)(input));\n}\n/** Check if `input` is IPv6. */\nfunction isIPv6(input) {\n return Boolean((0,_parse_js__WEBPACK_IMPORTED_MODULE_0__.parseIPv6)(input));\n}\n/** Check if `input` is IPv4 or IPv6. */\nfunction isIP(input) {\n return Boolean((0,_parse_js__WEBPACK_IMPORTED_MODULE_0__.parseIP)(input));\n}\n/**\n * @returns `6` if `input` is IPv6, `4` if `input` is IPv4, or `undefined` if `input` is neither.\n */\nfunction ipVersion(input) {\n if (isIPv4(input)) {\n return 4;\n }\n else if (isIPv6(input)) {\n return 6;\n }\n else {\n return undefined;\n }\n}\n//# sourceMappingURL=is-ip.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/is-ip/lib/is-ip.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/is-ip/lib/parse.js": +/*!****************************************************!*\ + !*** ./node_modules/@chainsafe/is-ip/lib/parse.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseIP: () => (/* binding */ parseIP),\n/* harmony export */ parseIPv4: () => (/* binding */ parseIPv4),\n/* harmony export */ parseIPv6: () => (/* binding */ parseIPv6)\n/* harmony export */ });\n/* harmony import */ var _parser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parser.js */ \"./node_modules/@chainsafe/is-ip/lib/parser.js\");\n\n// See https://stackoverflow.com/questions/166132/maximum-length-of-the-textual-representation-of-an-ipv6-address\nconst MAX_IPV6_LENGTH = 45;\nconst MAX_IPV4_LENGTH = 15;\nconst parser = new _parser_js__WEBPACK_IMPORTED_MODULE_0__.Parser();\n/** Parse `input` into IPv4 bytes. */\nfunction parseIPv4(input) {\n if (input.length > MAX_IPV4_LENGTH) {\n return undefined;\n }\n return parser.new(input).parseWith(() => parser.readIPv4Addr());\n}\n/** Parse `input` into IPv6 bytes. */\nfunction parseIPv6(input) {\n if (input.length > MAX_IPV6_LENGTH) {\n return undefined;\n }\n return parser.new(input).parseWith(() => parser.readIPv6Addr());\n}\n/** Parse `input` into IPv4 or IPv6 bytes. */\nfunction parseIP(input) {\n if (input.length > MAX_IPV6_LENGTH) {\n return undefined;\n }\n return parser.new(input).parseWith(() => parser.readIPAddr());\n}\n//# sourceMappingURL=parse.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/is-ip/lib/parse.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/is-ip/lib/parser.js": +/*!*****************************************************!*\ + !*** ./node_modules/@chainsafe/is-ip/lib/parser.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Parser: () => (/* binding */ Parser)\n/* harmony export */ });\n/* eslint-disable @typescript-eslint/no-unsafe-return */\nclass Parser {\n index = 0;\n input = \"\";\n new(input) {\n this.index = 0;\n this.input = input;\n return this;\n }\n /** Run a parser, and restore the pre-parse state if it fails. */\n readAtomically(fn) {\n const index = this.index;\n const result = fn();\n if (result === undefined) {\n this.index = index;\n }\n return result;\n }\n /** Run a parser, but fail if the entire input wasn't consumed. Doesn't run atomically. */\n parseWith(fn) {\n const result = fn();\n if (this.index !== this.input.length) {\n return undefined;\n }\n return result;\n }\n /** Peek the next character from the input */\n peekChar() {\n if (this.index >= this.input.length) {\n return undefined;\n }\n return this.input[this.index];\n }\n /** Read the next character from the input */\n readChar() {\n if (this.index >= this.input.length) {\n return undefined;\n }\n return this.input[this.index++];\n }\n /** Read the next character from the input if it matches the target. */\n readGivenChar(target) {\n return this.readAtomically(() => {\n const char = this.readChar();\n if (char !== target) {\n return undefined;\n }\n return char;\n });\n }\n /**\n * Helper for reading separators in an indexed loop. Reads the separator\n * character iff index > 0, then runs the parser. When used in a loop,\n * the separator character will only be read on index > 0 (see\n * readIPv4Addr for an example)\n */\n readSeparator(sep, index, inner) {\n return this.readAtomically(() => {\n if (index > 0) {\n if (this.readGivenChar(sep) === undefined) {\n return undefined;\n }\n }\n return inner();\n });\n }\n /**\n * Read a number off the front of the input in the given radix, stopping\n * at the first non-digit character or eof. Fails if the number has more\n * digits than max_digits or if there is no number.\n */\n readNumber(radix, maxDigits, allowZeroPrefix, maxBytes) {\n return this.readAtomically(() => {\n let result = 0;\n let digitCount = 0;\n const leadingChar = this.peekChar();\n if (leadingChar === undefined) {\n return undefined;\n }\n const hasLeadingZero = leadingChar === \"0\";\n const maxValue = 2 ** (8 * maxBytes) - 1;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const digit = this.readAtomically(() => {\n const char = this.readChar();\n if (char === undefined) {\n return undefined;\n }\n const num = Number.parseInt(char, radix);\n if (Number.isNaN(num)) {\n return undefined;\n }\n return num;\n });\n if (digit === undefined) {\n break;\n }\n result *= radix;\n result += digit;\n if (result > maxValue) {\n return undefined;\n }\n digitCount += 1;\n if (maxDigits !== undefined) {\n if (digitCount > maxDigits) {\n return undefined;\n }\n }\n }\n if (digitCount === 0) {\n return undefined;\n }\n else if (!allowZeroPrefix && hasLeadingZero && digitCount > 1) {\n return undefined;\n }\n else {\n return result;\n }\n });\n }\n /** Read an IPv4 address. */\n readIPv4Addr() {\n return this.readAtomically(() => {\n const out = new Uint8Array(4);\n for (let i = 0; i < out.length; i++) {\n const ix = this.readSeparator(\".\", i, () => this.readNumber(10, 3, false, 1));\n if (ix === undefined) {\n return undefined;\n }\n out[i] = ix;\n }\n return out;\n });\n }\n /** Read an IPv6 Address. */\n readIPv6Addr() {\n /**\n * Read a chunk of an IPv6 address into `groups`. Returns the number\n * of groups read, along with a bool indicating if an embedded\n * trailing IPv4 address was read. Specifically, read a series of\n * colon-separated IPv6 groups (0x0000 - 0xFFFF), with an optional\n * trailing embedded IPv4 address.\n */\n const readGroups = (groups) => {\n for (let i = 0; i < groups.length / 2; i++) {\n const ix = i * 2;\n // Try to read a trailing embedded IPv4 address. There must be at least 4 groups left.\n if (i < groups.length - 3) {\n const ipv4 = this.readSeparator(\":\", i, () => this.readIPv4Addr());\n if (ipv4 !== undefined) {\n groups[ix] = ipv4[0];\n groups[ix + 1] = ipv4[1];\n groups[ix + 2] = ipv4[2];\n groups[ix + 3] = ipv4[3];\n return [ix + 4, true];\n }\n }\n const group = this.readSeparator(\":\", i, () => this.readNumber(16, 4, true, 2));\n if (group === undefined) {\n return [ix, false];\n }\n groups[ix] = group >> 8;\n groups[ix + 1] = group & 255;\n }\n return [groups.length, false];\n };\n return this.readAtomically(() => {\n // Read the front part of the address; either the whole thing, or up to the first ::\n const head = new Uint8Array(16);\n const [headSize, headIp4] = readGroups(head);\n if (headSize === 16) {\n return head;\n }\n // IPv4 part is not allowed before `::`\n if (headIp4) {\n return undefined;\n }\n // Read `::` if previous code parsed less than 8 groups.\n // `::` indicates one or more groups of 16 bits of zeros.\n if (this.readGivenChar(\":\") === undefined) {\n return undefined;\n }\n if (this.readGivenChar(\":\") === undefined) {\n return undefined;\n }\n // Read the back part of the address. The :: must contain at least one\n // set of zeroes, so our max length is 7.\n const tail = new Uint8Array(14);\n const limit = 16 - (headSize + 2);\n const [tailSize] = readGroups(tail.subarray(0, limit));\n // Concat the head and tail of the IP address\n head.set(tail.subarray(0, tailSize), 16 - tailSize);\n return head;\n });\n }\n /** Read an IP Address, either IPv4 or IPv6. */\n readIPAddr() {\n return this.readIPv4Addr() ?? this.readIPv6Addr();\n }\n}\n//# sourceMappingURL=parser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/is-ip/lib/parser.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js": +/*!************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACCEPT_FROM_WHITELIST_DURATION_MS: () => (/* binding */ ACCEPT_FROM_WHITELIST_DURATION_MS),\n/* harmony export */ ACCEPT_FROM_WHITELIST_MAX_MESSAGES: () => (/* binding */ ACCEPT_FROM_WHITELIST_MAX_MESSAGES),\n/* harmony export */ ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE: () => (/* binding */ ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE),\n/* harmony export */ BACKOFF_SLACK: () => (/* binding */ BACKOFF_SLACK),\n/* harmony export */ DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS: () => (/* binding */ DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS),\n/* harmony export */ ERR_TOPIC_VALIDATOR_IGNORE: () => (/* binding */ ERR_TOPIC_VALIDATOR_IGNORE),\n/* harmony export */ ERR_TOPIC_VALIDATOR_REJECT: () => (/* binding */ ERR_TOPIC_VALIDATOR_REJECT),\n/* harmony export */ FloodsubID: () => (/* binding */ FloodsubID),\n/* harmony export */ GossipsubConnectionTimeout: () => (/* binding */ GossipsubConnectionTimeout),\n/* harmony export */ GossipsubConnectors: () => (/* binding */ GossipsubConnectors),\n/* harmony export */ GossipsubD: () => (/* binding */ GossipsubD),\n/* harmony export */ GossipsubDhi: () => (/* binding */ GossipsubDhi),\n/* harmony export */ GossipsubDirectConnectInitialDelay: () => (/* binding */ GossipsubDirectConnectInitialDelay),\n/* harmony export */ GossipsubDirectConnectTicks: () => (/* binding */ GossipsubDirectConnectTicks),\n/* harmony export */ GossipsubDlazy: () => (/* binding */ GossipsubDlazy),\n/* harmony export */ GossipsubDlo: () => (/* binding */ GossipsubDlo),\n/* harmony export */ GossipsubDout: () => (/* binding */ GossipsubDout),\n/* harmony export */ GossipsubDscore: () => (/* binding */ GossipsubDscore),\n/* harmony export */ GossipsubFanoutTTL: () => (/* binding */ GossipsubFanoutTTL),\n/* harmony export */ GossipsubGossipFactor: () => (/* binding */ GossipsubGossipFactor),\n/* harmony export */ GossipsubGossipRetransmission: () => (/* binding */ GossipsubGossipRetransmission),\n/* harmony export */ GossipsubGraftFloodThreshold: () => (/* binding */ GossipsubGraftFloodThreshold),\n/* harmony export */ GossipsubHeartbeatInitialDelay: () => (/* binding */ GossipsubHeartbeatInitialDelay),\n/* harmony export */ GossipsubHeartbeatInterval: () => (/* binding */ GossipsubHeartbeatInterval),\n/* harmony export */ GossipsubHistoryGossip: () => (/* binding */ GossipsubHistoryGossip),\n/* harmony export */ GossipsubHistoryLength: () => (/* binding */ GossipsubHistoryLength),\n/* harmony export */ GossipsubIDv10: () => (/* binding */ GossipsubIDv10),\n/* harmony export */ GossipsubIDv11: () => (/* binding */ GossipsubIDv11),\n/* harmony export */ GossipsubIWantFollowupTime: () => (/* binding */ GossipsubIWantFollowupTime),\n/* harmony export */ GossipsubMaxIHaveLength: () => (/* binding */ GossipsubMaxIHaveLength),\n/* harmony export */ GossipsubMaxIHaveMessages: () => (/* binding */ GossipsubMaxIHaveMessages),\n/* harmony export */ GossipsubMaxPendingConnections: () => (/* binding */ GossipsubMaxPendingConnections),\n/* harmony export */ GossipsubOpportunisticGraftPeers: () => (/* binding */ GossipsubOpportunisticGraftPeers),\n/* harmony export */ GossipsubOpportunisticGraftTicks: () => (/* binding */ GossipsubOpportunisticGraftTicks),\n/* harmony export */ GossipsubPruneBackoff: () => (/* binding */ GossipsubPruneBackoff),\n/* harmony export */ GossipsubPruneBackoffTicks: () => (/* binding */ GossipsubPruneBackoffTicks),\n/* harmony export */ GossipsubPrunePeers: () => (/* binding */ GossipsubPrunePeers),\n/* harmony export */ GossipsubSeenTTL: () => (/* binding */ GossipsubSeenTTL),\n/* harmony export */ GossipsubUnsubscribeBackoff: () => (/* binding */ GossipsubUnsubscribeBackoff),\n/* harmony export */ TimeCacheDuration: () => (/* binding */ TimeCacheDuration),\n/* harmony export */ minute: () => (/* binding */ minute),\n/* harmony export */ second: () => (/* binding */ second)\n/* harmony export */ });\nconst second = 1000;\nconst minute = 60 * second;\n// Protocol identifiers\nconst FloodsubID = '/floodsub/1.0.0';\n/**\n * The protocol ID for version 1.0.0 of the Gossipsub protocol\n * It is advertised along with GossipsubIDv11 for backwards compatability\n */\nconst GossipsubIDv10 = '/meshsub/1.0.0';\n/**\n * The protocol ID for version 1.1.0 of the Gossipsub protocol\n * See the spec for details about how v1.1.0 compares to v1.0.0:\n * https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md\n */\nconst GossipsubIDv11 = '/meshsub/1.1.0';\n// Overlay parameters\n/**\n * GossipsubD sets the optimal degree for a Gossipsub topic mesh. For example, if GossipsubD == 6,\n * each peer will want to have about six peers in their mesh for each topic they're subscribed to.\n * GossipsubD should be set somewhere between GossipsubDlo and GossipsubDhi.\n */\nconst GossipsubD = 6;\n/**\n * GossipsubDlo sets the lower bound on the number of peers we keep in a Gossipsub topic mesh.\n * If we have fewer than GossipsubDlo peers, we will attempt to graft some more into the mesh at\n * the next heartbeat.\n */\nconst GossipsubDlo = 4;\n/**\n * GossipsubDhi sets the upper bound on the number of peers we keep in a Gossipsub topic mesh.\n * If we have more than GossipsubDhi peers, we will select some to prune from the mesh at the next heartbeat.\n */\nconst GossipsubDhi = 12;\n/**\n * GossipsubDscore affects how peers are selected when pruning a mesh due to over subscription.\n * At least GossipsubDscore of the retained peers will be high-scoring, while the remainder are\n * chosen randomly.\n */\nconst GossipsubDscore = 4;\n/**\n * GossipsubDout sets the quota for the number of outbound connections to maintain in a topic mesh.\n * When the mesh is pruned due to over subscription, we make sure that we have outbound connections\n * to at least GossipsubDout of the survivor peers. This prevents sybil attackers from overwhelming\n * our mesh with incoming connections.\n *\n * GossipsubDout must be set below GossipsubDlo, and must not exceed GossipsubD / 2.\n */\nconst GossipsubDout = 2;\n// Gossip parameters\n/**\n * GossipsubHistoryLength controls the size of the message cache used for gossip.\n * The message cache will remember messages for GossipsubHistoryLength heartbeats.\n */\nconst GossipsubHistoryLength = 5;\n/**\n * GossipsubHistoryGossip controls how many cached message ids we will advertise in\n * IHAVE gossip messages. When asked for our seen message IDs, we will return\n * only those from the most recent GossipsubHistoryGossip heartbeats. The slack between\n * GossipsubHistoryGossip and GossipsubHistoryLength allows us to avoid advertising messages\n * that will be expired by the time they're requested.\n *\n * GossipsubHistoryGossip must be less than or equal to GossipsubHistoryLength to\n * avoid a runtime panic.\n */\nconst GossipsubHistoryGossip = 3;\n/**\n * GossipsubDlazy affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to at least GossipsubDlazy peers outside our mesh. The actual\n * number may be more, depending on GossipsubGossipFactor and how many peers we're\n * connected to.\n */\nconst GossipsubDlazy = 6;\n/**\n * GossipsubGossipFactor affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to GossipsubGossipFactor * (total number of non-mesh peers), or\n * GossipsubDlazy, whichever is greater.\n */\nconst GossipsubGossipFactor = 0.25;\n/**\n * GossipsubGossipRetransmission controls how many times we will allow a peer to request\n * the same message id through IWANT gossip before we start ignoring them. This is designed\n * to prevent peers from spamming us with requests and wasting our resources.\n */\nconst GossipsubGossipRetransmission = 3;\n// Heartbeat interval\n/**\n * GossipsubHeartbeatInitialDelay is the short delay before the heartbeat timer begins\n * after the router is initialized.\n */\nconst GossipsubHeartbeatInitialDelay = 100;\n/**\n * GossipsubHeartbeatInterval controls the time between heartbeats.\n */\nconst GossipsubHeartbeatInterval = second;\n/**\n * GossipsubFanoutTTL controls how long we keep track of the fanout state. If it's been\n * GossipsubFanoutTTL since we've published to a topic that we're not subscribed to,\n * we'll delete the fanout map for that topic.\n */\nconst GossipsubFanoutTTL = minute;\n/**\n * GossipsubPrunePeers controls the number of peers to include in prune Peer eXchange.\n * When we prune a peer that's eligible for PX (has a good score, etc), we will try to\n * send them signed peer records for up to GossipsubPrunePeers other peers that we\n * know of.\n */\nconst GossipsubPrunePeers = 16;\n/**\n * GossipsubPruneBackoff controls the backoff time for pruned peers. This is how long\n * a peer must wait before attempting to graft into our mesh again after being pruned.\n * When pruning a peer, we send them our value of GossipsubPruneBackoff so they know\n * the minimum time to wait. Peers running older versions may not send a backoff time,\n * so if we receive a prune message without one, we will wait at least GossipsubPruneBackoff\n * before attempting to re-graft.\n */\nconst GossipsubPruneBackoff = minute;\n/**\n * Backoff to use when unsuscribing from a topic. Should not resubscribe to this topic before it expired.\n */\nconst GossipsubUnsubscribeBackoff = 10 * second;\n/**\n * GossipsubPruneBackoffTicks is the number of heartbeat ticks for attempting to prune expired\n * backoff timers.\n */\nconst GossipsubPruneBackoffTicks = 15;\n/**\n * GossipsubConnectors controls the number of active connection attempts for peers obtained through PX.\n */\nconst GossipsubConnectors = 8;\n/**\n * GossipsubMaxPendingConnections sets the maximum number of pending connections for peers attempted through px.\n */\nconst GossipsubMaxPendingConnections = 128;\n/**\n * GossipsubConnectionTimeout controls the timeout for connection attempts.\n */\nconst GossipsubConnectionTimeout = 30 * second;\n/**\n * GossipsubDirectConnectTicks is the number of heartbeat ticks for attempting to reconnect direct peers\n * that are not currently connected.\n */\nconst GossipsubDirectConnectTicks = 300;\n/**\n * GossipsubDirectConnectInitialDelay is the initial delay before opening connections to direct peers\n */\nconst GossipsubDirectConnectInitialDelay = second;\n/**\n * GossipsubOpportunisticGraftTicks is the number of heartbeat ticks for attempting to improve the mesh\n * with opportunistic grafting. Every GossipsubOpportunisticGraftTicks we will attempt to select some\n * high-scoring mesh peers to replace lower-scoring ones, if the median score of our mesh peers falls\n * below a threshold\n */\nconst GossipsubOpportunisticGraftTicks = 60;\n/**\n * GossipsubOpportunisticGraftPeers is the number of peers to opportunistically graft.\n */\nconst GossipsubOpportunisticGraftPeers = 2;\n/**\n * If a GRAFT comes before GossipsubGraftFloodThreshold has elapsed since the last PRUNE,\n * then there is an extra score penalty applied to the peer through P7.\n */\nconst GossipsubGraftFloodThreshold = 10 * second;\n/**\n * GossipsubMaxIHaveLength is the maximum number of messages to include in an IHAVE message.\n * Also controls the maximum number of IHAVE ids we will accept and request with IWANT from a\n * peer within a heartbeat, to protect from IHAVE floods. You should adjust this value from the\n * default if your system is pushing more than 5000 messages in GossipsubHistoryGossip heartbeats;\n * with the defaults this is 1666 messages/s.\n */\nconst GossipsubMaxIHaveLength = 5000;\n/**\n * GossipsubMaxIHaveMessages is the maximum number of IHAVE messages to accept from a peer within a heartbeat.\n */\nconst GossipsubMaxIHaveMessages = 10;\n/**\n * Time to wait for a message requested through IWANT following an IHAVE advertisement.\n * If the message is not received within this window, a broken promise is declared and\n * the router may apply bahavioural penalties.\n */\nconst GossipsubIWantFollowupTime = 3 * second;\n/**\n * Time in milliseconds to keep message ids in the seen cache\n */\nconst GossipsubSeenTTL = 2 * minute;\nconst TimeCacheDuration = 120 * 1000;\nconst ERR_TOPIC_VALIDATOR_REJECT = 'ERR_TOPIC_VALIDATOR_REJECT';\nconst ERR_TOPIC_VALIDATOR_IGNORE = 'ERR_TOPIC_VALIDATOR_IGNORE';\n/**\n * If peer score is better than this, we accept messages from this peer\n * within ACCEPT_FROM_WHITELIST_DURATION_MS from the last time computing score.\n **/\nconst ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE = 0;\n/**\n * If peer score >= ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, accept up to this\n * number of messages from that peer.\n */\nconst ACCEPT_FROM_WHITELIST_MAX_MESSAGES = 128;\n/**\n * If peer score >= ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, accept messages from\n * this peer up to this time duration.\n */\nconst ACCEPT_FROM_WHITELIST_DURATION_MS = 1000;\n/**\n * The default MeshMessageDeliveriesWindow to be used in metrics.\n */\nconst DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS = 1000;\n/** Wait for 1 more heartbeats before clearing a backoff */\nconst BACKOFF_SLACK = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js": +/*!********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GossipSub: () => (/* binding */ GossipSub),\n/* harmony export */ gossipsub: () => (/* binding */ gossipsub),\n/* harmony export */ multicodec: () => (/* binding */ multicodec)\n/* harmony export */ });\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_topology__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/topology */ \"./node_modules/@libp2p/topology/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _message_cache_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./message-cache.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js\");\n/* harmony import */ var _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./message/rpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js\");\n/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/index.js\");\n/* harmony import */ var _score_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./score/index.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/index.js\");\n/* harmony import */ var _tracer_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./tracer.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js\");\n/* harmony import */ var _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/time-cache.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js\");\n/* harmony import */ var _metrics_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./metrics.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _utils_buildRawMessage_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils/buildRawMessage.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js\");\n/* harmony import */ var _utils_msgIdFn_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils/msgIdFn.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js\");\n/* harmony import */ var _score_scoreMetrics_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./score/scoreMetrics.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js\");\n/* harmony import */ var _utils_publishConfig_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./utils/publishConfig.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js\");\n/* harmony import */ var _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @libp2p/interface-pubsub */ \"./node_modules/@libp2p/interface-pubsub/dist/src/index.js\");\n/* harmony import */ var _utils_set_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./utils/set.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./stream.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js\");\n/* harmony import */ var _message_decodeRpc_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./message/decodeRpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js\");\n/* harmony import */ var _utils_multiaddr_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./utils/multiaddr.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst multicodec = _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubIDv11;\nvar GossipStatusCode;\n(function (GossipStatusCode) {\n GossipStatusCode[GossipStatusCode[\"started\"] = 0] = \"started\";\n GossipStatusCode[GossipStatusCode[\"stopped\"] = 1] = \"stopped\";\n})(GossipStatusCode || (GossipStatusCode = {}));\nclass GossipSub extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.EventEmitter {\n constructor(components, options = {}) {\n super();\n this.multicodecs = [_constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubIDv11, _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubIDv10];\n // State\n this.peers = new Set();\n this.streamsInbound = new Map();\n this.streamsOutbound = new Map();\n /** Ensures outbound streams are created sequentially */\n this.outboundInflightQueue = (0,it_pushable__WEBPACK_IMPORTED_MODULE_20__.pushable)({ objectMode: true });\n /** Direct peers */\n this.direct = new Set();\n /** Floodsub peers */\n this.floodsubPeers = new Set();\n /**\n * Map of peer id and AcceptRequestWhileListEntry\n */\n this.acceptFromWhitelist = new Map();\n /**\n * Map of topics to which peers are subscribed to\n */\n this.topics = new Map();\n /**\n * List of our subscriptions\n */\n this.subscriptions = new Set();\n /**\n * Map of topic meshes\n * topic => peer id set\n */\n this.mesh = new Map();\n /**\n * Map of topics to set of peers. These mesh peers are the ones to which we are publishing without a topic membership\n * topic => peer id set\n */\n this.fanout = new Map();\n /**\n * Map of last publish time for fanout topics\n * topic => last publish time\n */\n this.fanoutLastpub = new Map();\n /**\n * Map of pending messages to gossip\n * peer id => control messages\n */\n this.gossip = new Map();\n /**\n * Map of control messages\n * peer id => control message\n */\n this.control = new Map();\n /**\n * Number of IHAVEs received from peer in the last heartbeat\n */\n this.peerhave = new Map();\n /** Number of messages we have asked from peer in the last heartbeat */\n this.iasked = new Map();\n /** Prune backoff map */\n this.backoff = new Map();\n /**\n * Connection direction cache, marks peers with outbound connections\n * peer id => direction\n */\n this.outbound = new Map();\n /**\n * Custom validator function per topic.\n * Must return or resolve quickly (< 100ms) to prevent causing penalties for late messages.\n * If you need to apply validation that may require longer times use `asyncValidation` option and callback the\n * validation result through `Gossipsub.reportValidationResult`\n */\n this.topicValidators = new Map();\n /**\n * Number of heartbeats since the beginning of time\n * This allows us to amortize some resource cleanup -- eg: backoff cleanup\n */\n this.heartbeatTicks = 0;\n this.directPeerInitial = null;\n this.status = { code: GossipStatusCode.stopped };\n this.heartbeatTimer = null;\n this.runHeartbeat = () => {\n const timer = this.metrics?.heartbeatDuration.startTimer();\n this.heartbeat()\n .catch((err) => {\n this.log('Error running heartbeat', err);\n })\n .finally(() => {\n if (timer != null) {\n timer();\n }\n // Schedule the next run if still in started status\n if (this.status.code === GossipStatusCode.started) {\n // Clear previous timeout before overwriting `status.heartbeatTimeout`, it should be completed tho.\n clearTimeout(this.status.heartbeatTimeout);\n // NodeJS setInterval function is innexact, calls drift by a few miliseconds on each call.\n // To run the heartbeat precisely setTimeout() must be used recomputing the delay on every loop.\n let msToNextHeartbeat = this.opts.heartbeatInterval - ((Date.now() - this.status.hearbeatStartMs) % this.opts.heartbeatInterval);\n // If too close to next heartbeat, skip one\n if (msToNextHeartbeat < this.opts.heartbeatInterval * 0.25) {\n msToNextHeartbeat += this.opts.heartbeatInterval;\n this.metrics?.heartbeatSkipped.inc();\n }\n this.status.heartbeatTimeout = setTimeout(this.runHeartbeat, msToNextHeartbeat);\n }\n });\n };\n const opts = {\n fallbackToFloodsub: true,\n floodPublish: true,\n doPX: false,\n directPeers: [],\n D: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubD,\n Dlo: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDlo,\n Dhi: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDhi,\n Dscore: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDscore,\n Dout: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDout,\n Dlazy: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDlazy,\n heartbeatInterval: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubHeartbeatInterval,\n fanoutTTL: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubFanoutTTL,\n mcacheLength: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubHistoryLength,\n mcacheGossip: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubHistoryGossip,\n seenTTL: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubSeenTTL,\n gossipsubIWantFollowupMs: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubIWantFollowupTime,\n prunePeers: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubPrunePeers,\n pruneBackoff: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubPruneBackoff,\n unsubcribeBackoff: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubUnsubscribeBackoff,\n graftFloodThreshold: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubGraftFloodThreshold,\n opportunisticGraftPeers: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubOpportunisticGraftPeers,\n opportunisticGraftTicks: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubOpportunisticGraftTicks,\n directConnectTicks: _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDirectConnectTicks,\n ...options,\n scoreParams: (0,_score_index_js__WEBPACK_IMPORTED_MODULE_9__.createPeerScoreParams)(options.scoreParams),\n scoreThresholds: (0,_score_index_js__WEBPACK_IMPORTED_MODULE_9__.createPeerScoreThresholds)(options.scoreThresholds)\n };\n this.components = components;\n this.decodeRpcLimits = opts.decodeRpcLimits ?? _message_decodeRpc_js__WEBPACK_IMPORTED_MODULE_22__.defaultDecodeRpcLimits;\n this.globalSignaturePolicy = opts.globalSignaturePolicy ?? _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.StrictSign;\n // Also wants to get notified of peers connected using floodsub\n if (opts.fallbackToFloodsub) {\n this.multicodecs.push(_constants_js__WEBPACK_IMPORTED_MODULE_7__.FloodsubID);\n }\n // From pubsub\n this.log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)(opts.debugName ?? 'libp2p:gossipsub');\n // Gossipsub\n this.opts = opts;\n this.direct = new Set(opts.directPeers.map((p) => p.id.toString()));\n this.seenCache = new _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_11__.SimpleTimeCache({ validityMs: opts.seenTTL });\n this.publishedMessageIds = new _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_11__.SimpleTimeCache({ validityMs: opts.seenTTL });\n if (options.msgIdFn) {\n // Use custom function\n this.msgIdFn = options.msgIdFn;\n }\n else {\n switch (this.globalSignaturePolicy) {\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.StrictSign:\n this.msgIdFn = _utils_msgIdFn_js__WEBPACK_IMPORTED_MODULE_15__.msgIdFnStrictSign;\n break;\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.StrictNoSign:\n this.msgIdFn = _utils_msgIdFn_js__WEBPACK_IMPORTED_MODULE_15__.msgIdFnStrictNoSign;\n break;\n }\n }\n if (options.fastMsgIdFn) {\n this.fastMsgIdFn = options.fastMsgIdFn;\n this.fastMsgIdCache = new _utils_time_cache_js__WEBPACK_IMPORTED_MODULE_11__.SimpleTimeCache({ validityMs: opts.seenTTL });\n }\n // By default, gossipsub only provide a browser friendly function to convert Uint8Array message id to string.\n this.msgIdToStrFn = options.msgIdToStrFn ?? _utils_index_js__WEBPACK_IMPORTED_MODULE_8__.messageIdToString;\n this.mcache = options.messageCache || new _message_cache_js__WEBPACK_IMPORTED_MODULE_5__.MessageCache(opts.mcacheGossip, opts.mcacheLength, this.msgIdToStrFn);\n if (options.dataTransform) {\n this.dataTransform = options.dataTransform;\n }\n if (options.metricsRegister) {\n if (!options.metricsTopicStrToLabel) {\n throw Error('Must set metricsTopicStrToLabel with metrics');\n }\n // in theory, each topic has its own meshMessageDeliveriesWindow param\n // however in lodestar, we configure it mostly the same so just pick the max of positive ones\n // (some topics have meshMessageDeliveriesWindow as 0)\n const maxMeshMessageDeliveriesWindowMs = Math.max(...Object.values(opts.scoreParams.topics).map((topicParam) => topicParam.meshMessageDeliveriesWindow), _constants_js__WEBPACK_IMPORTED_MODULE_7__.DEFAULT_METRIC_MESH_MESSAGE_DELIVERIES_WINDOWS);\n const metrics = (0,_metrics_js__WEBPACK_IMPORTED_MODULE_12__.getMetrics)(options.metricsRegister, options.metricsTopicStrToLabel, {\n gossipPromiseExpireSec: this.opts.gossipsubIWantFollowupMs / 1000,\n behaviourPenaltyThreshold: opts.scoreParams.behaviourPenaltyThreshold,\n maxMeshMessageDeliveriesWindowSec: maxMeshMessageDeliveriesWindowMs / 1000\n });\n metrics.mcacheSize.addCollect(() => this.onScrapeMetrics(metrics));\n for (const protocol of this.multicodecs) {\n metrics.protocolsEnabled.set({ protocol }, 1);\n }\n this.metrics = metrics;\n }\n else {\n this.metrics = null;\n }\n this.gossipTracer = new _tracer_js__WEBPACK_IMPORTED_MODULE_10__.IWantTracer(this.opts.gossipsubIWantFollowupMs, this.msgIdToStrFn, this.metrics);\n /**\n * libp2p\n */\n this.score = new _score_index_js__WEBPACK_IMPORTED_MODULE_9__.PeerScore(this.opts.scoreParams, this.metrics, {\n scoreCacheValidityMs: opts.heartbeatInterval\n });\n this.maxInboundStreams = options.maxInboundStreams;\n this.maxOutboundStreams = options.maxOutboundStreams;\n this.allowedTopics = opts.allowedTopics ? new Set(opts.allowedTopics) : null;\n }\n getPeers() {\n return [...this.peers.keys()].map((str) => (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(str));\n }\n isStarted() {\n return this.status.code === GossipStatusCode.started;\n }\n // LIFECYCLE METHODS\n /**\n * Mounts the gossipsub protocol onto the libp2p node and sends our\n * our subscriptions to every peer connected\n */\n async start() {\n // From pubsub\n if (this.isStarted()) {\n return;\n }\n this.log('starting');\n this.publishConfig = await (0,_utils_publishConfig_js__WEBPACK_IMPORTED_MODULE_17__.getPublishConfigFromPeerId)(this.globalSignaturePolicy, this.components.peerId);\n // Create the outbound inflight queue\n // This ensures that outbound stream creation happens sequentially\n this.outboundInflightQueue = (0,it_pushable__WEBPACK_IMPORTED_MODULE_20__.pushable)({ objectMode: true });\n (0,it_pipe__WEBPACK_IMPORTED_MODULE_0__.pipe)(this.outboundInflightQueue, async (source) => {\n for await (const { peerId, connection } of source) {\n await this.createOutboundStream(peerId, connection);\n }\n }).catch((e) => this.log.error('outbound inflight queue error', e));\n // set direct peer addresses in the address book\n await Promise.all(this.opts.directPeers.map(async (p) => {\n await this.components.peerStore.merge(p.id, {\n multiaddrs: p.addrs\n });\n }));\n const registrar = this.components.registrar;\n // Incoming streams\n // Called after a peer dials us\n await Promise.all(this.multicodecs.map((multicodec) => registrar.handle(multicodec, this.onIncomingStream.bind(this), {\n maxInboundStreams: this.maxInboundStreams,\n maxOutboundStreams: this.maxOutboundStreams\n })));\n // # How does Gossipsub interact with libp2p? Rough guide from Mar 2022\n //\n // ## Setup:\n // Gossipsub requests libp2p to callback, TBD\n //\n // `this.libp2p.handle()` registers a handler for `/meshsub/1.1.0` and other Gossipsub protocols\n // The handler callback is registered in libp2p Upgrader.protocols map.\n //\n // Upgrader receives an inbound connection from some transport and (`Upgrader.upgradeInbound`):\n // - Adds encryption (NOISE in our case)\n // - Multiplex stream\n // - Create a muxer and register that for each new stream call Upgrader.protocols handler\n //\n // ## Topology\n // - new instance of Topology (unlinked to libp2p) with handlers\n // - registar.register(topology)\n // register protocol with topology\n // Topology callbacks called on connection manager changes\n const topology = (0,_libp2p_topology__WEBPACK_IMPORTED_MODULE_3__.createTopology)({\n onConnect: this.onPeerConnected.bind(this),\n onDisconnect: this.onPeerDisconnected.bind(this)\n });\n const registrarTopologyIds = await Promise.all(this.multicodecs.map((multicodec) => registrar.register(multicodec, topology)));\n // Schedule to start heartbeat after `GossipsubHeartbeatInitialDelay`\n const heartbeatTimeout = setTimeout(this.runHeartbeat, _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubHeartbeatInitialDelay);\n // Then, run heartbeat every `heartbeatInterval` offset by `GossipsubHeartbeatInitialDelay`\n this.status = {\n code: GossipStatusCode.started,\n registrarTopologyIds,\n heartbeatTimeout: heartbeatTimeout,\n hearbeatStartMs: Date.now() + _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubHeartbeatInitialDelay\n };\n this.score.start();\n // connect to direct peers\n this.directPeerInitial = setTimeout(() => {\n Promise.resolve()\n .then(async () => {\n await Promise.all(Array.from(this.direct).map(async (id) => await this.connect(id)));\n })\n .catch((err) => {\n this.log(err);\n });\n }, _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubDirectConnectInitialDelay);\n this.log('started');\n }\n /**\n * Unmounts the gossipsub protocol and shuts down every connection\n */\n async stop() {\n this.log('stopping');\n // From pubsub\n if (this.status.code !== GossipStatusCode.started) {\n return;\n }\n const { registrarTopologyIds } = this.status;\n this.status = { code: GossipStatusCode.stopped };\n // unregister protocol and handlers\n const registrar = this.components.registrar;\n await Promise.all(this.multicodecs.map((multicodec) => registrar.unhandle(multicodec)));\n registrarTopologyIds.forEach((id) => registrar.unregister(id));\n this.outboundInflightQueue.end();\n for (const outboundStream of this.streamsOutbound.values()) {\n outboundStream.close();\n }\n this.streamsOutbound.clear();\n for (const inboundStream of this.streamsInbound.values()) {\n inboundStream.close();\n }\n this.streamsInbound.clear();\n this.peers.clear();\n this.subscriptions.clear();\n // Gossipsub\n if (this.heartbeatTimer) {\n this.heartbeatTimer.cancel();\n this.heartbeatTimer = null;\n }\n this.score.stop();\n this.mesh.clear();\n this.fanout.clear();\n this.fanoutLastpub.clear();\n this.gossip.clear();\n this.control.clear();\n this.peerhave.clear();\n this.iasked.clear();\n this.backoff.clear();\n this.outbound.clear();\n this.gossipTracer.clear();\n this.seenCache.clear();\n if (this.fastMsgIdCache)\n this.fastMsgIdCache.clear();\n if (this.directPeerInitial)\n clearTimeout(this.directPeerInitial);\n this.log('stopped');\n }\n /** FOR DEBUG ONLY - Dump peer stats for all peers. Data is cloned, safe to mutate */\n dumpPeerScoreStats() {\n return this.score.dumpPeerScoreStats();\n }\n /**\n * On an inbound stream opened\n */\n onIncomingStream({ stream, connection }) {\n if (!this.isStarted()) {\n return;\n }\n const peerId = connection.remotePeer;\n // add peer to router\n this.addPeer(peerId, connection.stat.direction, connection.remoteAddr);\n // create inbound stream\n this.createInboundStream(peerId, stream);\n // attempt to create outbound stream\n this.outboundInflightQueue.push({ peerId, connection });\n }\n /**\n * Registrar notifies an established connection with pubsub protocol\n */\n onPeerConnected(peerId, connection) {\n this.metrics?.newConnectionCount.inc({ status: connection.stat.status });\n // libp2p may emit a closed connection and never issue peer:disconnect event\n // see https://github.com/ChainSafe/js-libp2p-gossipsub/issues/398\n if (!this.isStarted() || connection.stat.status !== 'OPEN') {\n return;\n }\n this.addPeer(peerId, connection.stat.direction, connection.remoteAddr);\n this.outboundInflightQueue.push({ peerId, connection });\n }\n /**\n * Registrar notifies a closing connection with pubsub protocol\n */\n onPeerDisconnected(peerId) {\n this.log('connection ended %p', peerId);\n this.removePeer(peerId);\n }\n async createOutboundStream(peerId, connection) {\n if (!this.isStarted()) {\n return;\n }\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n return;\n }\n // TODO make this behavior more robust\n // This behavior is different than for inbound streams\n // If an outbound stream already exists, don't create a new stream\n if (this.streamsOutbound.has(id)) {\n return;\n }\n try {\n const stream = new _stream_js__WEBPACK_IMPORTED_MODULE_21__.OutboundStream(await connection.newStream(this.multicodecs), (e) => this.log.error('outbound pipe error', e), { maxBufferSize: this.opts.maxOutboundBufferSize });\n this.log('create outbound stream %p', peerId);\n this.streamsOutbound.set(id, stream);\n const protocol = stream.protocol;\n if (protocol === _constants_js__WEBPACK_IMPORTED_MODULE_7__.FloodsubID) {\n this.floodsubPeers.add(id);\n }\n this.metrics?.peersPerProtocol.inc({ protocol }, 1);\n // Immediately send own subscriptions via the newly attached stream\n if (this.subscriptions.size > 0) {\n this.log('send subscriptions to', id);\n this.sendSubscriptions(id, Array.from(this.subscriptions), true);\n }\n }\n catch (e) {\n this.log.error('createOutboundStream error', e);\n }\n }\n async createInboundStream(peerId, stream) {\n if (!this.isStarted()) {\n return;\n }\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n return;\n }\n // TODO make this behavior more robust\n // This behavior is different than for outbound streams\n // If a peer initiates a new inbound connection\n // we assume that one is the new canonical inbound stream\n const priorInboundStream = this.streamsInbound.get(id);\n if (priorInboundStream !== undefined) {\n this.log('replacing existing inbound steam %s', id);\n priorInboundStream.close();\n }\n this.log('create inbound stream %s', id);\n const inboundStream = new _stream_js__WEBPACK_IMPORTED_MODULE_21__.InboundStream(stream, { maxDataLength: this.opts.maxInboundDataLength });\n this.streamsInbound.set(id, inboundStream);\n this.pipePeerReadStream(peerId, inboundStream.source).catch((err) => this.log(err));\n }\n /**\n * Add a peer to the router\n */\n addPeer(peerId, direction, addr) {\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n this.log('new peer %p', peerId);\n this.peers.add(id);\n // Add to peer scoring\n this.score.addPeer(id);\n const currentIP = (0,_utils_multiaddr_js__WEBPACK_IMPORTED_MODULE_23__.multiaddrToIPStr)(addr);\n if (currentIP !== null) {\n this.score.addIP(id, currentIP);\n }\n else {\n this.log('Added peer has no IP in current address %s %s', id, addr.toString());\n }\n // track the connection direction. Don't allow to unset outbound\n if (!this.outbound.has(id)) {\n this.outbound.set(id, direction === 'outbound');\n }\n }\n }\n /**\n * Removes a peer from the router\n */\n removePeer(peerId) {\n const id = peerId.toString();\n if (!this.peers.has(id)) {\n return;\n }\n // delete peer\n this.log('delete peer %p', peerId);\n this.peers.delete(id);\n const outboundStream = this.streamsOutbound.get(id);\n const inboundStream = this.streamsInbound.get(id);\n if (outboundStream) {\n this.metrics?.peersPerProtocol.inc({ protocol: outboundStream.protocol }, -1);\n }\n // close streams\n outboundStream?.close();\n inboundStream?.close();\n // remove streams\n this.streamsOutbound.delete(id);\n this.streamsInbound.delete(id);\n // remove peer from topics map\n for (const peers of this.topics.values()) {\n peers.delete(id);\n }\n // Remove this peer from the mesh\n for (const [topicStr, peers] of this.mesh) {\n if (peers.delete(id) === true) {\n this.metrics?.onRemoveFromMesh(topicStr, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ChurnReason.Dc, 1);\n }\n }\n // Remove this peer from the fanout\n for (const peers of this.fanout.values()) {\n peers.delete(id);\n }\n // Remove from floodsubPeers\n this.floodsubPeers.delete(id);\n // Remove from gossip mapping\n this.gossip.delete(id);\n // Remove from control mapping\n this.control.delete(id);\n // Remove from backoff mapping\n this.outbound.delete(id);\n // Remove from peer scoring\n this.score.removePeer(id);\n this.acceptFromWhitelist.delete(id);\n }\n // API METHODS\n get started() {\n return this.status.code === GossipStatusCode.started;\n }\n /**\n * Get a the peer-ids in a topic mesh\n */\n getMeshPeers(topic) {\n const peersInTopic = this.mesh.get(topic);\n return peersInTopic ? Array.from(peersInTopic) : [];\n }\n /**\n * Get a list of the peer-ids that are subscribed to one topic.\n */\n getSubscribers(topic) {\n const peersInTopic = this.topics.get(topic);\n return (peersInTopic ? Array.from(peersInTopic) : []).map((str) => (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(str));\n }\n /**\n * Get the list of topics which the peer is subscribed to.\n */\n getTopics() {\n return Array.from(this.subscriptions);\n }\n // TODO: Reviewing Pubsub API\n // MESSAGE METHODS\n /**\n * Responsible for processing each RPC message received by other peers.\n */\n async pipePeerReadStream(peerId, stream) {\n try {\n await (0,it_pipe__WEBPACK_IMPORTED_MODULE_0__.pipe)(stream, async (source) => {\n for await (const data of source) {\n try {\n // TODO: Check max gossip message size, before decodeRpc()\n const rpcBytes = data.subarray();\n // Note: This function may throw, it must be wrapped in a try {} catch {} to prevent closing the stream.\n // TODO: What should we do if the entire RPC is invalid?\n const rpc = (0,_message_decodeRpc_js__WEBPACK_IMPORTED_MODULE_22__.decodeRpc)(rpcBytes, this.decodeRpcLimits);\n this.metrics?.onRpcRecv(rpc, rpcBytes.length);\n // Since processRpc may be overridden entirely in unsafe ways,\n // the simplest/safest option here is to wrap in a function and capture all errors\n // to prevent a top-level unhandled exception\n // This processing of rpc messages should happen without awaiting full validation/execution of prior messages\n if (this.opts.awaitRpcHandler) {\n try {\n await this.handleReceivedRpc(peerId, rpc);\n }\n catch (err) {\n this.metrics?.onRpcRecvError();\n this.log(err);\n }\n }\n else {\n this.handleReceivedRpc(peerId, rpc).catch((err) => {\n this.metrics?.onRpcRecvError();\n this.log(err);\n });\n }\n }\n catch (e) {\n this.metrics?.onRpcDataError();\n this.log(e);\n }\n }\n });\n }\n catch (err) {\n this.metrics?.onPeerReadStreamError();\n this.handlePeerReadStreamError(err, peerId);\n }\n }\n /**\n * Handle error when read stream pipe throws, less of the functional use but more\n * to for testing purposes to spy on the error handling\n * */\n handlePeerReadStreamError(err, peerId) {\n this.log.error(err);\n this.onPeerDisconnected(peerId);\n }\n /**\n * Handles an rpc request from a peer\n */\n async handleReceivedRpc(from, rpc) {\n // Check if peer is graylisted in which case we ignore the event\n if (!this.acceptFrom(from.toString())) {\n this.log('received message from unacceptable peer %p', from);\n this.metrics?.rpcRecvNotAccepted.inc();\n return;\n }\n const subscriptions = rpc.subscriptions ? rpc.subscriptions.length : 0;\n const messages = rpc.messages ? rpc.messages.length : 0;\n let ihave = 0;\n let iwant = 0;\n let graft = 0;\n let prune = 0;\n if (rpc.control) {\n if (rpc.control.ihave)\n ihave = rpc.control.ihave.length;\n if (rpc.control.iwant)\n iwant = rpc.control.iwant.length;\n if (rpc.control.graft)\n graft = rpc.control.graft.length;\n if (rpc.control.prune)\n prune = rpc.control.prune.length;\n }\n this.log(`rpc.from ${from.toString()} subscriptions ${subscriptions} messages ${messages} ihave ${ihave} iwant ${iwant} graft ${graft} prune ${prune}`);\n // Handle received subscriptions\n if (rpc.subscriptions && rpc.subscriptions.length > 0) {\n // update peer subscriptions\n const subscriptions = [];\n rpc.subscriptions.forEach((subOpt) => {\n const topic = subOpt.topic;\n const subscribe = subOpt.subscribe === true;\n if (topic != null) {\n if (this.allowedTopics && !this.allowedTopics.has(topic)) {\n // Not allowed: subscription data-structures are not bounded by topic count\n // TODO: Should apply behaviour penalties?\n return;\n }\n this.handleReceivedSubscription(from, topic, subscribe);\n subscriptions.push({ topic, subscribe });\n }\n });\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('subscription-change', {\n detail: { peerId: from, subscriptions }\n }));\n }\n // Handle messages\n // TODO: (up to limit)\n if (rpc.messages) {\n for (const message of rpc.messages) {\n if (this.allowedTopics && !this.allowedTopics.has(message.topic)) {\n // Not allowed: message cache data-structures are not bounded by topic count\n // TODO: Should apply behaviour penalties?\n continue;\n }\n const handleReceivedMessagePromise = this.handleReceivedMessage(from, message)\n // Should never throw, but handle just in case\n .catch((err) => {\n this.metrics?.onMsgRecvError(message.topic);\n this.log(err);\n });\n if (this.opts.awaitRpcMessageHandler) {\n await handleReceivedMessagePromise;\n }\n }\n }\n // Handle control messages\n if (rpc.control) {\n await this.handleControlMessage(from.toString(), rpc.control);\n }\n }\n /**\n * Handles a subscription change from a peer\n */\n handleReceivedSubscription(from, topic, subscribe) {\n this.log('subscription update from %p topic %s', from, topic);\n let topicSet = this.topics.get(topic);\n if (topicSet == null) {\n topicSet = new Set();\n this.topics.set(topic, topicSet);\n }\n if (subscribe) {\n // subscribe peer to new topic\n topicSet.add(from.toString());\n }\n else {\n // unsubscribe from existing topic\n topicSet.delete(from.toString());\n }\n // TODO: rust-libp2p has A LOT more logic here\n }\n /**\n * Handles a newly received message from an RPC.\n * May forward to all peers in the mesh.\n */\n async handleReceivedMessage(from, rpcMsg) {\n this.metrics?.onMsgRecvPreValidation(rpcMsg.topic);\n const validationResult = await this.validateReceivedMessage(from, rpcMsg);\n this.metrics?.onMsgRecvResult(rpcMsg.topic, validationResult.code);\n switch (validationResult.code) {\n case _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.duplicate:\n // Report the duplicate\n this.score.duplicateMessage(from.toString(), validationResult.msgIdStr, rpcMsg.topic);\n // due to the collision of fastMsgIdFn, 2 different messages may end up the same fastMsgId\n // so we need to also mark the duplicate message as delivered or the promise is not resolved\n // and peer gets penalized. See https://github.com/ChainSafe/js-libp2p-gossipsub/pull/385\n this.gossipTracer.deliverMessage(validationResult.msgIdStr, true);\n this.mcache.observeDuplicate(validationResult.msgIdStr, from.toString());\n return;\n case _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.invalid:\n // invalid messages received\n // metrics.register_invalid_message(&raw_message.topic)\n // Tell peer_score about reject\n // Reject the original source, and any duplicates we've seen from other peers.\n if (validationResult.msgIdStr) {\n const msgIdStr = validationResult.msgIdStr;\n this.score.rejectMessage(from.toString(), msgIdStr, rpcMsg.topic, validationResult.reason);\n this.gossipTracer.rejectMessage(msgIdStr, validationResult.reason);\n }\n else {\n this.score.rejectInvalidMessage(from.toString(), rpcMsg.topic);\n }\n this.metrics?.onMsgRecvInvalid(rpcMsg.topic, validationResult);\n return;\n case _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.valid:\n // Tells score that message arrived (but is maybe not fully validated yet).\n // Consider the message as delivered for gossip promises.\n this.score.validateMessage(validationResult.messageId.msgIdStr);\n this.gossipTracer.deliverMessage(validationResult.messageId.msgIdStr);\n // Add the message to our memcache\n // if no validation is required, mark the message as validated\n this.mcache.put(validationResult.messageId, rpcMsg, !this.opts.asyncValidation);\n // Dispatch the message to the user if we are subscribed to the topic\n if (this.subscriptions.has(rpcMsg.topic)) {\n const isFromSelf = this.components.peerId.equals(from);\n if (!isFromSelf || this.opts.emitSelf) {\n super.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('gossipsub:message', {\n detail: {\n propagationSource: from,\n msgId: validationResult.messageId.msgIdStr,\n msg: validationResult.msg\n }\n }));\n // TODO: Add option to switch between emit per topic or all messages in one\n super.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('message', { detail: validationResult.msg }));\n }\n }\n // Forward the message to mesh peers, if no validation is required\n // If asyncValidation is ON, expect the app layer to call reportMessageValidationResult(), then forward\n if (!this.opts.asyncValidation) {\n // TODO: in rust-libp2p\n // .forward_msg(&msg_id, raw_message, Some(propagation_source))\n this.forwardMessage(validationResult.messageId.msgIdStr, rpcMsg, from.toString());\n }\n }\n }\n /**\n * Handles a newly received message from an RPC.\n * May forward to all peers in the mesh.\n */\n async validateReceivedMessage(propagationSource, rpcMsg) {\n // Fast message ID stuff\n const fastMsgIdStr = this.fastMsgIdFn?.(rpcMsg);\n const msgIdCached = fastMsgIdStr !== undefined ? this.fastMsgIdCache?.get(fastMsgIdStr) : undefined;\n if (msgIdCached) {\n // This message has been seen previously. Ignore it\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.duplicate, msgIdStr: msgIdCached };\n }\n // Perform basic validation on message and convert to RawGossipsubMessage for fastMsgIdFn()\n const validationResult = await (0,_utils_buildRawMessage_js__WEBPACK_IMPORTED_MODULE_14__.validateToRawMessage)(this.globalSignaturePolicy, rpcMsg);\n if (!validationResult.valid) {\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.invalid, reason: _types_js__WEBPACK_IMPORTED_MODULE_13__.RejectReason.Error, error: validationResult.error };\n }\n const msg = validationResult.message;\n // Try and perform the data transform to the message. If it fails, consider it invalid.\n try {\n if (this.dataTransform) {\n msg.data = this.dataTransform.inboundTransform(rpcMsg.topic, msg.data);\n }\n }\n catch (e) {\n this.log('Invalid message, transform failed', e);\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.invalid, reason: _types_js__WEBPACK_IMPORTED_MODULE_13__.RejectReason.Error, error: _types_js__WEBPACK_IMPORTED_MODULE_13__.ValidateError.TransformFailed };\n }\n // TODO: Check if message is from a blacklisted source or propagation origin\n // - Reject any message from a blacklisted peer\n // - Also reject any message that originated from a blacklisted peer\n // - reject messages claiming to be from ourselves but not locally published\n // Calculate the message id on the transformed data.\n const msgId = await this.msgIdFn(msg);\n const msgIdStr = this.msgIdToStrFn(msgId);\n const messageId = { msgId, msgIdStr };\n // Add the message to the duplicate caches\n if (fastMsgIdStr !== undefined && this.fastMsgIdCache) {\n const collision = this.fastMsgIdCache.put(fastMsgIdStr, msgIdStr);\n if (collision) {\n this.metrics?.fastMsgIdCacheCollision.inc();\n }\n }\n if (this.seenCache.has(msgIdStr)) {\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.duplicate, msgIdStr };\n }\n else {\n this.seenCache.put(msgIdStr);\n }\n // (Optional) Provide custom validation here with dynamic validators per topic\n // NOTE: This custom topicValidator() must resolve fast (< 100ms) to allow scores\n // to not penalize peers for long validation times.\n const topicValidator = this.topicValidators.get(rpcMsg.topic);\n if (topicValidator != null) {\n let acceptance;\n // Use try {} catch {} in case topicValidator() is synchronous\n try {\n acceptance = await topicValidator(propagationSource, msg);\n }\n catch (e) {\n const errCode = e.code;\n if (errCode === _constants_js__WEBPACK_IMPORTED_MODULE_7__.ERR_TOPIC_VALIDATOR_IGNORE)\n acceptance = _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.TopicValidatorResult.Ignore;\n if (errCode === _constants_js__WEBPACK_IMPORTED_MODULE_7__.ERR_TOPIC_VALIDATOR_REJECT)\n acceptance = _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.TopicValidatorResult.Reject;\n else\n acceptance = _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.TopicValidatorResult.Ignore;\n }\n if (acceptance !== _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.TopicValidatorResult.Accept) {\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.invalid, reason: (0,_types_js__WEBPACK_IMPORTED_MODULE_13__.rejectReasonFromAcceptance)(acceptance), msgIdStr };\n }\n }\n return { code: _types_js__WEBPACK_IMPORTED_MODULE_13__.MessageStatus.valid, messageId, msg };\n }\n /**\n * Return score of a peer.\n */\n getScore(peerId) {\n return this.score.score(peerId);\n }\n /**\n * Send an rpc object to a peer with subscriptions\n */\n sendSubscriptions(toPeer, topics, subscribe) {\n this.sendRpc(toPeer, {\n subscriptions: topics.map((topic) => ({ topic, subscribe }))\n });\n }\n /**\n * Handles an rpc control message from a peer\n */\n async handleControlMessage(id, controlMsg) {\n if (controlMsg === undefined) {\n return;\n }\n const iwant = controlMsg.ihave ? this.handleIHave(id, controlMsg.ihave) : [];\n const ihave = controlMsg.iwant ? this.handleIWant(id, controlMsg.iwant) : [];\n const prune = controlMsg.graft ? await this.handleGraft(id, controlMsg.graft) : [];\n controlMsg.prune && (await this.handlePrune(id, controlMsg.prune));\n if (!iwant.length && !ihave.length && !prune.length) {\n return;\n }\n const sent = this.sendRpc(id, { messages: ihave, control: { iwant, prune } });\n const iwantMessageIds = iwant[0]?.messageIDs;\n if (iwantMessageIds) {\n if (sent) {\n this.gossipTracer.addPromise(id, iwantMessageIds);\n }\n else {\n this.metrics?.iwantPromiseUntracked.inc(1);\n }\n }\n }\n /**\n * Whether to accept a message from a peer\n */\n acceptFrom(id) {\n if (this.direct.has(id)) {\n return true;\n }\n const now = Date.now();\n const entry = this.acceptFromWhitelist.get(id);\n if (entry && entry.messagesAccepted < _constants_js__WEBPACK_IMPORTED_MODULE_7__.ACCEPT_FROM_WHITELIST_MAX_MESSAGES && entry.acceptUntil >= now) {\n entry.messagesAccepted += 1;\n return true;\n }\n const score = this.score.score(id);\n if (score >= _constants_js__WEBPACK_IMPORTED_MODULE_7__.ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE) {\n // peer is unlikely to be able to drop its score to `graylistThreshold`\n // after 128 messages or 1s\n this.acceptFromWhitelist.set(id, {\n messagesAccepted: 0,\n acceptUntil: now + _constants_js__WEBPACK_IMPORTED_MODULE_7__.ACCEPT_FROM_WHITELIST_DURATION_MS\n });\n }\n else {\n this.acceptFromWhitelist.delete(id);\n }\n return score >= this.opts.scoreThresholds.graylistThreshold;\n }\n /**\n * Handles IHAVE messages\n */\n handleIHave(id, ihave) {\n if (!ihave.length) {\n return [];\n }\n // we ignore IHAVE gossip from any peer whose score is below the gossips threshold\n const score = this.score.score(id);\n if (score < this.opts.scoreThresholds.gossipThreshold) {\n this.log('IHAVE: ignoring peer %s with score below threshold [ score = %d ]', id, score);\n this.metrics?.ihaveRcvIgnored.inc({ reason: _metrics_js__WEBPACK_IMPORTED_MODULE_12__.IHaveIgnoreReason.LowScore });\n return [];\n }\n // IHAVE flood protection\n const peerhave = (this.peerhave.get(id) ?? 0) + 1;\n this.peerhave.set(id, peerhave);\n if (peerhave > _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveMessages) {\n this.log('IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring', id, peerhave);\n this.metrics?.ihaveRcvIgnored.inc({ reason: _metrics_js__WEBPACK_IMPORTED_MODULE_12__.IHaveIgnoreReason.MaxIhave });\n return [];\n }\n const iasked = this.iasked.get(id) ?? 0;\n if (iasked >= _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveLength) {\n this.log('IHAVE: peer %s has already advertised too many messages (%d); ignoring', id, iasked);\n this.metrics?.ihaveRcvIgnored.inc({ reason: _metrics_js__WEBPACK_IMPORTED_MODULE_12__.IHaveIgnoreReason.MaxIasked });\n return [];\n }\n // string msgId => msgId\n const iwant = new Map();\n ihave.forEach(({ topicID, messageIDs }) => {\n if (!topicID || !messageIDs || !this.mesh.has(topicID)) {\n return;\n }\n let idonthave = 0;\n messageIDs.forEach((msgId) => {\n const msgIdStr = this.msgIdToStrFn(msgId);\n if (!this.seenCache.has(msgIdStr)) {\n iwant.set(msgIdStr, msgId);\n idonthave++;\n }\n });\n this.metrics?.onIhaveRcv(topicID, messageIDs.length, idonthave);\n });\n if (!iwant.size) {\n return [];\n }\n let iask = iwant.size;\n if (iask + iasked > _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveLength) {\n iask = _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveLength - iasked;\n }\n this.log('IHAVE: Asking for %d out of %d messages from %s', iask, iwant.size, id);\n let iwantList = Array.from(iwant.values());\n // ask in random order\n (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(iwantList);\n // truncate to the messages we are actually asking for and update the iasked counter\n iwantList = iwantList.slice(0, iask);\n this.iasked.set(id, iasked + iask);\n // do not add gossipTracer promise here until a successful sendRpc()\n return [\n {\n messageIDs: iwantList\n }\n ];\n }\n /**\n * Handles IWANT messages\n * Returns messages to send back to peer\n */\n handleIWant(id, iwant) {\n if (!iwant.length) {\n return [];\n }\n // we don't respond to IWANT requests from any per whose score is below the gossip threshold\n const score = this.score.score(id);\n if (score < this.opts.scoreThresholds.gossipThreshold) {\n this.log('IWANT: ignoring peer %s with score below threshold [score = %d]', id, score);\n return [];\n }\n const ihave = new Map();\n const iwantByTopic = new Map();\n let iwantDonthave = 0;\n iwant.forEach(({ messageIDs }) => {\n messageIDs &&\n messageIDs.forEach((msgId) => {\n const msgIdStr = this.msgIdToStrFn(msgId);\n const entry = this.mcache.getWithIWantCount(msgIdStr, id);\n if (entry == null) {\n iwantDonthave++;\n return;\n }\n iwantByTopic.set(entry.msg.topic, 1 + (iwantByTopic.get(entry.msg.topic) ?? 0));\n if (entry.count > _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubGossipRetransmission) {\n this.log('IWANT: Peer %s has asked for message %s too many times: ignoring request', id, msgId);\n return;\n }\n ihave.set(msgIdStr, entry.msg);\n });\n });\n this.metrics?.onIwantRcv(iwantByTopic, iwantDonthave);\n if (!ihave.size) {\n this.log('IWANT: Could not provide any wanted messages to %s', id);\n return [];\n }\n this.log('IWANT: Sending %d messages to %s', ihave.size, id);\n return Array.from(ihave.values());\n }\n /**\n * Handles Graft messages\n */\n async handleGraft(id, graft) {\n const prune = [];\n const score = this.score.score(id);\n const now = Date.now();\n let doPX = this.opts.doPX;\n graft.forEach(({ topicID }) => {\n if (!topicID) {\n return;\n }\n const peersInMesh = this.mesh.get(topicID);\n if (!peersInMesh) {\n // don't do PX when there is an unknown topic to avoid leaking our peers\n doPX = false;\n // spam hardening: ignore GRAFTs for unknown topics\n return;\n }\n // check if peer is already in the mesh; if so do nothing\n if (peersInMesh.has(id)) {\n return;\n }\n // we don't GRAFT to/from direct peers; complain loudly if this happens\n if (this.direct.has(id)) {\n this.log('GRAFT: ignoring request from direct peer %s', id);\n // this is possibly a bug from a non-reciprical configuration; send a PRUNE\n prune.push(topicID);\n // but don't px\n doPX = false;\n return;\n }\n // make sure we are not backing off that peer\n const expire = this.backoff.get(topicID)?.get(id);\n if (typeof expire === 'number' && now < expire) {\n this.log('GRAFT: ignoring backed off peer %s', id);\n // add behavioral penalty\n this.score.addPenalty(id, 1, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ScorePenalty.GraftBackoff);\n // no PX\n doPX = false;\n // check the flood cutoff -- is the GRAFT coming too fast?\n const floodCutoff = expire + this.opts.graftFloodThreshold - this.opts.pruneBackoff;\n if (now < floodCutoff) {\n // extra penalty\n this.score.addPenalty(id, 1, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ScorePenalty.GraftBackoff);\n }\n // refresh the backoff\n this.addBackoff(id, topicID);\n prune.push(topicID);\n return;\n }\n // check the score\n if (score < 0) {\n // we don't GRAFT peers with negative score\n this.log('GRAFT: ignoring peer %s with negative score: score=%d, topic=%s', id, score, topicID);\n // we do send them PRUNE however, because it's a matter of protocol correctness\n prune.push(topicID);\n // but we won't PX to them\n doPX = false;\n // add/refresh backoff so that we don't reGRAFT too early even if the score decays\n this.addBackoff(id, topicID);\n return;\n }\n // check the number of mesh peers; if it is at (or over) Dhi, we only accept grafts\n // from peers with outbound connections; this is a defensive check to restrict potential\n // mesh takeover attacks combined with love bombing\n if (peersInMesh.size >= this.opts.Dhi && !this.outbound.get(id)) {\n prune.push(topicID);\n this.addBackoff(id, topicID);\n return;\n }\n this.log('GRAFT: Add mesh link from %s in %s', id, topicID);\n this.score.graft(id, topicID);\n peersInMesh.add(id);\n this.metrics?.onAddToMesh(topicID, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.InclusionReason.Subscribed, 1);\n });\n if (!prune.length) {\n return [];\n }\n const onUnsubscribe = false;\n return await Promise.all(prune.map((topic) => this.makePrune(id, topic, doPX, onUnsubscribe)));\n }\n /**\n * Handles Prune messages\n */\n async handlePrune(id, prune) {\n const score = this.score.score(id);\n for (const { topicID, backoff, peers } of prune) {\n if (topicID == null) {\n continue;\n }\n const peersInMesh = this.mesh.get(topicID);\n if (!peersInMesh) {\n return;\n }\n this.log('PRUNE: Remove mesh link to %s in %s', id, topicID);\n this.score.prune(id, topicID);\n if (peersInMesh.has(id)) {\n peersInMesh.delete(id);\n this.metrics?.onRemoveFromMesh(topicID, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ChurnReason.Prune, 1);\n }\n // is there a backoff specified by the peer? if so obey it\n if (typeof backoff === 'number' && backoff > 0) {\n this.doAddBackoff(id, topicID, backoff * 1000);\n }\n else {\n this.addBackoff(id, topicID);\n }\n // PX\n if (peers && peers.length) {\n // we ignore PX from peers with insufficient scores\n if (score < this.opts.scoreThresholds.acceptPXThreshold) {\n this.log('PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]', id, score, topicID);\n continue;\n }\n await this.pxConnect(peers);\n }\n }\n }\n /**\n * Add standard backoff log for a peer in a topic\n */\n addBackoff(id, topic) {\n this.doAddBackoff(id, topic, this.opts.pruneBackoff);\n }\n /**\n * Add backoff expiry interval for a peer in a topic\n *\n * @param id\n * @param topic\n * @param intervalMs - backoff duration in milliseconds\n */\n doAddBackoff(id, topic, intervalMs) {\n let backoff = this.backoff.get(topic);\n if (!backoff) {\n backoff = new Map();\n this.backoff.set(topic, backoff);\n }\n const expire = Date.now() + intervalMs;\n const existingExpire = backoff.get(id) ?? 0;\n if (existingExpire < expire) {\n backoff.set(id, expire);\n }\n }\n /**\n * Apply penalties from broken IHAVE/IWANT promises\n */\n applyIwantPenalties() {\n this.gossipTracer.getBrokenPromises().forEach((count, p) => {\n this.log(\"peer %s didn't follow up in %d IWANT requests; adding penalty\", p, count);\n this.score.addPenalty(p, count, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ScorePenalty.BrokenPromise);\n });\n }\n /**\n * Clear expired backoff expiries\n */\n clearBackoff() {\n // we only clear once every GossipsubPruneBackoffTicks ticks to avoid iterating over the maps too much\n if (this.heartbeatTicks % _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubPruneBackoffTicks !== 0) {\n return;\n }\n const now = Date.now();\n this.backoff.forEach((backoff, topic) => {\n backoff.forEach((expire, id) => {\n // add some slack time to the expiration, see https://github.com/libp2p/specs/pull/289\n if (expire + _constants_js__WEBPACK_IMPORTED_MODULE_7__.BACKOFF_SLACK * this.opts.heartbeatInterval < now) {\n backoff.delete(id);\n }\n });\n if (backoff.size === 0) {\n this.backoff.delete(topic);\n }\n });\n }\n /**\n * Maybe reconnect to direct peers\n */\n async directConnect() {\n const toconnect = [];\n this.direct.forEach((id) => {\n if (!this.streamsOutbound.has(id)) {\n toconnect.push(id);\n }\n });\n await Promise.all(toconnect.map(async (id) => await this.connect(id)));\n }\n /**\n * Maybe attempt connection given signed peer records\n */\n async pxConnect(peers) {\n if (peers.length > this.opts.prunePeers) {\n (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(peers);\n peers = peers.slice(0, this.opts.prunePeers);\n }\n const toconnect = [];\n await Promise.all(peers.map(async (pi) => {\n if (!pi.peerID) {\n return;\n }\n const peer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromBytes)(pi.peerID);\n const p = peer.toString();\n if (this.peers.has(p)) {\n return;\n }\n if (!pi.signedPeerRecord) {\n toconnect.push(p);\n return;\n }\n // The peer sent us a signed record\n // This is not a record from the peer who sent the record, but another peer who is connected with it\n // Ensure that it is valid\n try {\n if (!(await this.components.peerStore.consumePeerRecord(pi.signedPeerRecord, peer))) {\n this.log('bogus peer record obtained through px: could not add peer record to address book');\n return;\n }\n toconnect.push(p);\n }\n catch (e) {\n this.log('bogus peer record obtained through px: invalid signature or not a peer record');\n }\n }));\n if (!toconnect.length) {\n return;\n }\n await Promise.all(toconnect.map(async (id) => await this.connect(id)));\n }\n /**\n * Connect to a peer using the gossipsub protocol\n */\n async connect(id) {\n this.log('Initiating connection with %s', id);\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(id);\n const connection = await this.components.connectionManager.openConnection(peerId);\n for (const multicodec of this.multicodecs) {\n for (const topology of this.components.registrar.getTopologies(multicodec)) {\n topology.onConnect(peerId, connection);\n }\n }\n }\n /**\n * Subscribes to a topic\n */\n subscribe(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Pubsub has not started');\n }\n if (!this.subscriptions.has(topic)) {\n this.subscriptions.add(topic);\n for (const peerId of this.peers.keys()) {\n this.sendSubscriptions(peerId, [topic], true);\n }\n }\n this.join(topic);\n }\n /**\n * Unsubscribe to a topic\n */\n unsubscribe(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Pubsub is not started');\n }\n const wasSubscribed = this.subscriptions.delete(topic);\n this.log('unsubscribe from %s - am subscribed %s', topic, wasSubscribed);\n if (wasSubscribed) {\n for (const peerId of this.peers.keys()) {\n this.sendSubscriptions(peerId, [topic], false);\n }\n }\n this.leave(topic);\n }\n /**\n * Join topic\n */\n join(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Gossipsub has not started');\n }\n // if we are already in the mesh, return\n if (this.mesh.has(topic)) {\n return;\n }\n this.log('JOIN %s', topic);\n this.metrics?.onJoin(topic);\n const toAdd = new Set();\n const backoff = this.backoff.get(topic);\n // check if we have mesh_n peers in fanout[topic] and add them to the mesh if we do,\n // removing the fanout entry.\n const fanoutPeers = this.fanout.get(topic);\n if (fanoutPeers) {\n // Remove fanout entry and the last published time\n this.fanout.delete(topic);\n this.fanoutLastpub.delete(topic);\n // remove explicit peers, peers with negative scores, and backoffed peers\n fanoutPeers.forEach((id) => {\n if (!this.direct.has(id) && this.score.score(id) >= 0 && (!backoff || !backoff.has(id))) {\n toAdd.add(id);\n }\n });\n this.metrics?.onAddToMesh(topic, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.InclusionReason.Fanout, toAdd.size);\n }\n // check if we need to get more peers, which we randomly select\n if (toAdd.size < this.opts.D) {\n const fanoutCount = toAdd.size;\n const newPeers = this.getRandomGossipPeers(topic, this.opts.D, (id) => \n // filter direct peers and peers with negative score\n !toAdd.has(id) && !this.direct.has(id) && this.score.score(id) >= 0 && (!backoff || !backoff.has(id)));\n newPeers.forEach((peer) => {\n toAdd.add(peer);\n });\n this.metrics?.onAddToMesh(topic, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.InclusionReason.Random, toAdd.size - fanoutCount);\n }\n this.mesh.set(topic, toAdd);\n toAdd.forEach((id) => {\n this.log('JOIN: Add mesh link to %s in %s', id, topic);\n this.sendGraft(id, topic);\n // rust-libp2p\n // - peer_score.graft()\n // - Self::control_pool_add()\n // - peer_added_to_mesh()\n });\n }\n /**\n * Leave topic\n */\n leave(topic) {\n if (this.status.code !== GossipStatusCode.started) {\n throw new Error('Gossipsub has not started');\n }\n this.log('LEAVE %s', topic);\n this.metrics?.onLeave(topic);\n // Send PRUNE to mesh peers\n const meshPeers = this.mesh.get(topic);\n if (meshPeers) {\n Promise.all(Array.from(meshPeers).map(async (id) => {\n this.log('LEAVE: Remove mesh link to %s in %s', id, topic);\n return await this.sendPrune(id, topic);\n })).catch((err) => {\n this.log('Error sending prunes to mesh peers', err);\n });\n this.mesh.delete(topic);\n }\n }\n selectPeersToForward(topic, propagationSource, excludePeers) {\n const tosend = new Set();\n // Add explicit peers\n const peersInTopic = this.topics.get(topic);\n if (peersInTopic) {\n this.direct.forEach((peer) => {\n if (peersInTopic.has(peer) && propagationSource !== peer && !excludePeers?.has(peer)) {\n tosend.add(peer);\n }\n });\n // As of Mar 2022, spec + golang-libp2p include this while rust-libp2p does not\n // rust-libp2p: https://github.com/libp2p/rust-libp2p/blob/6cc3b4ec52c922bfcf562a29b5805c3150e37c75/protocols/gossipsub/src/behaviour.rs#L2693\n // spec: https://github.com/libp2p/specs/blob/10712c55ab309086a52eec7d25f294df4fa96528/pubsub/gossipsub/gossipsub-v1.0.md?plain=1#L361\n this.floodsubPeers.forEach((peer) => {\n if (peersInTopic.has(peer) &&\n propagationSource !== peer &&\n !excludePeers?.has(peer) &&\n this.score.score(peer) >= this.opts.scoreThresholds.publishThreshold) {\n tosend.add(peer);\n }\n });\n }\n // add mesh peers\n const meshPeers = this.mesh.get(topic);\n if (meshPeers && meshPeers.size > 0) {\n meshPeers.forEach((peer) => {\n if (propagationSource !== peer && !excludePeers?.has(peer)) {\n tosend.add(peer);\n }\n });\n }\n return tosend;\n }\n selectPeersToPublish(topic) {\n const tosend = new Set();\n const tosendCount = {\n direct: 0,\n floodsub: 0,\n mesh: 0,\n fanout: 0\n };\n const peersInTopic = this.topics.get(topic);\n if (peersInTopic) {\n // flood-publish behavior\n // send to direct peers and _all_ peers meeting the publishThreshold\n if (this.opts.floodPublish) {\n peersInTopic.forEach((id) => {\n if (this.direct.has(id)) {\n tosend.add(id);\n tosendCount.direct++;\n }\n else if (this.score.score(id) >= this.opts.scoreThresholds.publishThreshold) {\n tosend.add(id);\n tosendCount.floodsub++;\n }\n });\n }\n else {\n // non-flood-publish behavior\n // send to direct peers, subscribed floodsub peers\n // and some mesh peers above publishThreshold\n // direct peers (if subscribed)\n this.direct.forEach((id) => {\n if (peersInTopic.has(id)) {\n tosend.add(id);\n tosendCount.direct++;\n }\n });\n // floodsub peers\n // Note: if there are no floodsub peers, we save a loop through peersInTopic Map\n this.floodsubPeers.forEach((id) => {\n if (peersInTopic.has(id) && this.score.score(id) >= this.opts.scoreThresholds.publishThreshold) {\n tosend.add(id);\n tosendCount.floodsub++;\n }\n });\n // Gossipsub peers handling\n const meshPeers = this.mesh.get(topic);\n if (meshPeers && meshPeers.size > 0) {\n meshPeers.forEach((peer) => {\n tosend.add(peer);\n tosendCount.mesh++;\n });\n }\n // We are not in the mesh for topic, use fanout peers\n else {\n const fanoutPeers = this.fanout.get(topic);\n if (fanoutPeers && fanoutPeers.size > 0) {\n fanoutPeers.forEach((peer) => {\n tosend.add(peer);\n tosendCount.fanout++;\n });\n }\n // We have no fanout peers, select mesh_n of them and add them to the fanout\n else {\n // If we are not in the fanout, then pick peers in topic above the publishThreshold\n const newFanoutPeers = this.getRandomGossipPeers(topic, this.opts.D, (id) => {\n return this.score.score(id) >= this.opts.scoreThresholds.publishThreshold;\n });\n if (newFanoutPeers.size > 0) {\n // eslint-disable-line max-depth\n this.fanout.set(topic, newFanoutPeers);\n newFanoutPeers.forEach((peer) => {\n // eslint-disable-line max-depth\n tosend.add(peer);\n tosendCount.fanout++;\n });\n }\n }\n // We are publishing to fanout peers - update the time we published\n this.fanoutLastpub.set(topic, Date.now());\n }\n }\n }\n return { tosend, tosendCount };\n }\n /**\n * Forwards a message from our peers.\n *\n * For messages published by us (the app layer), this class uses `publish`\n */\n forwardMessage(msgIdStr, rawMsg, propagationSource, excludePeers) {\n // message is fully validated inform peer_score\n if (propagationSource) {\n this.score.deliverMessage(propagationSource, msgIdStr, rawMsg.topic);\n }\n const tosend = this.selectPeersToForward(rawMsg.topic, propagationSource, excludePeers);\n // Note: Don't throw if tosend is empty, we can have a mesh with a single peer\n // forward the message to peers\n tosend.forEach((id) => {\n // sendRpc may mutate RPC message on piggyback, create a new message for each peer\n this.sendRpc(id, { messages: [rawMsg] });\n });\n this.metrics?.onForwardMsg(rawMsg.topic, tosend.size);\n }\n /**\n * App layer publishes a message to peers, return number of peers this message is published to\n * Note: `async` due to crypto only if `StrictSign`, otherwise it's a sync fn.\n *\n * For messages not from us, this class uses `forwardMessage`.\n */\n async publish(topic, data, opts) {\n const transformedData = this.dataTransform ? this.dataTransform.outboundTransform(topic, data) : data;\n if (this.publishConfig == null) {\n throw Error('PublishError.Uninitialized');\n }\n // Prepare raw message with user's publishConfig\n const { raw: rawMsg, msg } = await (0,_utils_buildRawMessage_js__WEBPACK_IMPORTED_MODULE_14__.buildRawMessage)(this.publishConfig, topic, data, transformedData);\n // calculate the message id from the un-transformed data\n const msgId = await this.msgIdFn(msg);\n const msgIdStr = this.msgIdToStrFn(msgId);\n // Current publish opt takes precedence global opts, while preserving false value\n const ignoreDuplicatePublishError = opts?.ignoreDuplicatePublishError ?? this.opts.ignoreDuplicatePublishError;\n if (this.seenCache.has(msgIdStr)) {\n // This message has already been seen. We don't re-publish messages that have already\n // been published on the network.\n if (ignoreDuplicatePublishError) {\n this.metrics?.onPublishDuplicateMsg(topic);\n return { recipients: [] };\n }\n throw Error('PublishError.Duplicate');\n }\n const { tosend, tosendCount } = this.selectPeersToPublish(topic);\n const willSendToSelf = this.opts.emitSelf === true && this.subscriptions.has(topic);\n // Current publish opt takes precedence global opts, while preserving false value\n const allowPublishToZeroPeers = opts?.allowPublishToZeroPeers ?? this.opts.allowPublishToZeroPeers;\n if (tosend.size === 0 && !allowPublishToZeroPeers && !willSendToSelf) {\n throw Error('PublishError.InsufficientPeers');\n }\n // If the message isn't a duplicate and we have sent it to some peers add it to the\n // duplicate cache and memcache.\n this.seenCache.put(msgIdStr);\n // all published messages are valid\n this.mcache.put({ msgId, msgIdStr }, rawMsg, true);\n // If the message is anonymous or has a random author add it to the published message ids cache.\n this.publishedMessageIds.put(msgIdStr);\n // Send to set of peers aggregated from direct, mesh, fanout\n for (const id of tosend) {\n // sendRpc may mutate RPC message on piggyback, create a new message for each peer\n const sent = this.sendRpc(id, { messages: [rawMsg] });\n // did not actually send the message\n if (!sent) {\n tosend.delete(id);\n }\n }\n this.metrics?.onPublishMsg(topic, tosendCount, tosend.size, rawMsg.data != null ? rawMsg.data.length : 0);\n // Dispatch the message to the user if we are subscribed to the topic\n if (willSendToSelf) {\n tosend.add(this.components.peerId.toString());\n super.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('gossipsub:message', {\n detail: {\n propagationSource: this.components.peerId,\n msgId: msgIdStr,\n msg\n }\n }));\n // TODO: Add option to switch between emit per topic or all messages in one\n super.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('message', { detail: msg }));\n }\n return {\n recipients: Array.from(tosend.values()).map((str) => (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(str))\n };\n }\n /**\n * This function should be called when `asyncValidation` is `true` after\n * the message got validated by the caller. Messages are stored in the `mcache` and\n * validation is expected to be fast enough that the messages should still exist in the cache.\n * There are three possible validation outcomes and the outcome is given in acceptance.\n *\n * If acceptance = `MessageAcceptance.Accept` the message will get propagated to the\n * network. The `propagation_source` parameter indicates who the message was received by and\n * will not be forwarded back to that peer.\n *\n * If acceptance = `MessageAcceptance.Reject` the message will be deleted from the memcache\n * and the P₄ penalty will be applied to the `propagationSource`.\n *\n * If acceptance = `MessageAcceptance.Ignore` the message will be deleted from the memcache\n * but no P₄ penalty will be applied.\n *\n * This function will return true if the message was found in the cache and false if was not\n * in the cache anymore.\n *\n * This should only be called once per message.\n */\n reportMessageValidationResult(msgId, propagationSource, acceptance) {\n let cacheEntry;\n if (acceptance === _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_18__.TopicValidatorResult.Accept) {\n cacheEntry = this.mcache.validate(msgId);\n if (cacheEntry != null) {\n const { message: rawMsg, originatingPeers } = cacheEntry;\n // message is fully validated inform peer_score\n this.score.deliverMessage(propagationSource, msgId, rawMsg.topic);\n this.forwardMessage(msgId, cacheEntry.message, propagationSource, originatingPeers);\n }\n // else, Message not in cache. Ignoring forwarding\n }\n // Not valid\n else {\n cacheEntry = this.mcache.remove(msgId);\n if (cacheEntry) {\n const rejectReason = (0,_types_js__WEBPACK_IMPORTED_MODULE_13__.rejectReasonFromAcceptance)(acceptance);\n const { message: rawMsg, originatingPeers } = cacheEntry;\n // Tell peer_score about reject\n // Reject the original source, and any duplicates we've seen from other peers.\n this.score.rejectMessage(propagationSource, msgId, rawMsg.topic, rejectReason);\n for (const peer of originatingPeers) {\n this.score.rejectMessage(peer, msgId, rawMsg.topic, rejectReason);\n }\n }\n // else, Message not in cache. Ignoring forwarding\n }\n const firstSeenTimestampMs = this.score.messageFirstSeenTimestampMs(msgId);\n this.metrics?.onReportValidation(cacheEntry, acceptance, firstSeenTimestampMs);\n }\n /**\n * Sends a GRAFT message to a peer\n */\n sendGraft(id, topic) {\n const graft = [\n {\n topicID: topic\n }\n ];\n this.sendRpc(id, { control: { graft } });\n }\n /**\n * Sends a PRUNE message to a peer\n */\n async sendPrune(id, topic) {\n // this is only called from leave() function\n const onUnsubscribe = true;\n const prune = [await this.makePrune(id, topic, this.opts.doPX, onUnsubscribe)];\n this.sendRpc(id, { control: { prune } });\n }\n /**\n * Send an rpc object to a peer\n */\n sendRpc(id, rpc) {\n const outboundStream = this.streamsOutbound.get(id);\n if (!outboundStream) {\n this.log(`Cannot send RPC to ${id} as there is no open stream to it available`);\n return false;\n }\n // piggyback control message retries\n const ctrl = this.control.get(id);\n if (ctrl) {\n this.piggybackControl(id, rpc, ctrl);\n this.control.delete(id);\n }\n // piggyback gossip\n const ihave = this.gossip.get(id);\n if (ihave) {\n this.piggybackGossip(id, rpc, ihave);\n this.gossip.delete(id);\n }\n const rpcBytes = _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__.RPC.encode(rpc).finish();\n try {\n outboundStream.push(rpcBytes);\n }\n catch (e) {\n this.log.error(`Cannot send rpc to ${id}`, e);\n // if the peer had control messages or gossip, re-attach\n if (ctrl) {\n this.control.set(id, ctrl);\n }\n if (ihave) {\n this.gossip.set(id, ihave);\n }\n return false;\n }\n this.metrics?.onRpcSent(rpc, rpcBytes.length);\n return true;\n }\n /** Mutates `outRpc` adding graft and prune control messages */\n piggybackControl(id, outRpc, ctrl) {\n if (ctrl.graft) {\n if (!outRpc.control)\n outRpc.control = {};\n if (!outRpc.control.graft)\n outRpc.control.graft = [];\n for (const graft of ctrl.graft) {\n if (graft.topicID && this.mesh.get(graft.topicID)?.has(id)) {\n outRpc.control.graft.push(graft);\n }\n }\n }\n if (ctrl.prune) {\n if (!outRpc.control)\n outRpc.control = {};\n if (!outRpc.control.prune)\n outRpc.control.prune = [];\n for (const prune of ctrl.prune) {\n if (prune.topicID && !this.mesh.get(prune.topicID)?.has(id)) {\n outRpc.control.prune.push(prune);\n }\n }\n }\n }\n /** Mutates `outRpc` adding ihave control messages */\n piggybackGossip(id, outRpc, ihave) {\n if (!outRpc.control)\n outRpc.control = {};\n outRpc.control.ihave = ihave;\n }\n /**\n * Send graft and prune messages\n *\n * @param tograft - peer id => topic[]\n * @param toprune - peer id => topic[]\n */\n async sendGraftPrune(tograft, toprune, noPX) {\n const doPX = this.opts.doPX;\n const onUnsubscribe = false;\n for (const [id, topics] of tograft) {\n const graft = topics.map((topicID) => ({ topicID }));\n let prune = [];\n // If a peer also has prunes, process them now\n const pruning = toprune.get(id);\n if (pruning) {\n prune = await Promise.all(pruning.map(async (topicID) => await this.makePrune(id, topicID, doPX && !(noPX.get(id) ?? false), onUnsubscribe)));\n toprune.delete(id);\n }\n this.sendRpc(id, { control: { graft, prune } });\n }\n for (const [id, topics] of toprune) {\n const prune = await Promise.all(topics.map(async (topicID) => await this.makePrune(id, topicID, doPX && !(noPX.get(id) ?? false), onUnsubscribe)));\n this.sendRpc(id, { control: { prune } });\n }\n }\n /**\n * Emits gossip - Send IHAVE messages to a random set of gossip peers\n */\n emitGossip(peersToGossipByTopic) {\n const gossipIDsByTopic = this.mcache.getGossipIDs(new Set(peersToGossipByTopic.keys()));\n for (const [topic, peersToGossip] of peersToGossipByTopic) {\n this.doEmitGossip(topic, peersToGossip, gossipIDsByTopic.get(topic) ?? []);\n }\n }\n /**\n * Send gossip messages to GossipFactor peers above threshold with a minimum of D_lazy\n * Peers are randomly selected from the heartbeat which exclude mesh + fanout peers\n * We also exclude direct peers, as there is no reason to emit gossip to them\n * @param topic\n * @param candidateToGossip - peers to gossip\n * @param messageIDs - message ids to gossip\n */\n doEmitGossip(topic, candidateToGossip, messageIDs) {\n if (!messageIDs.length) {\n return;\n }\n // shuffle to emit in random order\n (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(messageIDs);\n // if we are emitting more than GossipsubMaxIHaveLength ids, truncate the list\n if (messageIDs.length > _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveLength) {\n // we do the truncation (with shuffling) per peer below\n this.log('too many messages for gossip; will truncate IHAVE list (%d messages)', messageIDs.length);\n }\n if (!candidateToGossip.size)\n return;\n let target = this.opts.Dlazy;\n const factor = _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubGossipFactor * candidateToGossip.size;\n let peersToGossip = candidateToGossip;\n if (factor > target) {\n target = factor;\n }\n if (target > peersToGossip.size) {\n target = peersToGossip.size;\n }\n else {\n // only shuffle if needed\n peersToGossip = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(Array.from(peersToGossip)).slice(0, target);\n }\n // Emit the IHAVE gossip to the selected peers up to the target\n peersToGossip.forEach((id) => {\n let peerMessageIDs = messageIDs;\n if (messageIDs.length > _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveLength) {\n // shuffle and slice message IDs per peer so that we emit a different set for each peer\n // we have enough reduncancy in the system that this will significantly increase the message\n // coverage when we do truncate\n peerMessageIDs = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(peerMessageIDs.slice()).slice(0, _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubMaxIHaveLength);\n }\n this.pushGossip(id, {\n topicID: topic,\n messageIDs: peerMessageIDs\n });\n });\n }\n /**\n * Flush gossip and control messages\n */\n flush() {\n // send gossip first, which will also piggyback control\n for (const [peer, ihave] of this.gossip.entries()) {\n this.gossip.delete(peer);\n this.sendRpc(peer, { control: { ihave } });\n }\n // send the remaining control messages\n for (const [peer, control] of this.control.entries()) {\n this.control.delete(peer);\n this.sendRpc(peer, { control: { graft: control.graft, prune: control.prune } });\n }\n }\n /**\n * Adds new IHAVE messages to pending gossip\n */\n pushGossip(id, controlIHaveMsgs) {\n this.log('Add gossip to %s', id);\n const gossip = this.gossip.get(id) || [];\n this.gossip.set(id, gossip.concat(controlIHaveMsgs));\n }\n /**\n * Make a PRUNE control message for a peer in a topic\n */\n async makePrune(id, topic, doPX, onUnsubscribe) {\n this.score.prune(id, topic);\n if (this.streamsOutbound.get(id).protocol === _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubIDv10) {\n // Gossipsub v1.0 -- no backoff, the peer won't be able to parse it anyway\n return {\n topicID: topic,\n peers: []\n };\n }\n // backoff is measured in seconds\n // GossipsubPruneBackoff and GossipsubUnsubscribeBackoff are measured in milliseconds\n // The protobuf has it as a uint64\n const backoffMs = onUnsubscribe ? this.opts.unsubcribeBackoff : this.opts.pruneBackoff;\n const backoff = backoffMs / 1000;\n this.doAddBackoff(id, topic, backoffMs);\n if (!doPX) {\n return {\n topicID: topic,\n peers: [],\n backoff: backoff\n };\n }\n // select peers for Peer eXchange\n const peers = this.getRandomGossipPeers(topic, this.opts.prunePeers, (xid) => {\n return xid !== id && this.score.score(xid) >= 0;\n });\n const px = await Promise.all(Array.from(peers).map(async (peerId) => {\n // see if we have a signed record to send back; if we don't, just send\n // the peer ID and let the pruned peer find them in the DHT -- we can't trust\n // unsigned address records through PX anyways\n // Finding signed records in the DHT is not supported at the time of writing in js-libp2p\n const id = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(peerId);\n let peerInfo;\n try {\n peerInfo = await this.components.peerStore.get(id);\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n return {\n peerID: id.toBytes(),\n signedPeerRecord: peerInfo?.peerRecordEnvelope\n };\n }));\n return {\n topicID: topic,\n peers: px,\n backoff: backoff\n };\n }\n /**\n * Maintains the mesh and fanout maps in gossipsub.\n */\n async heartbeat() {\n const { D, Dlo, Dhi, Dscore, Dout, fanoutTTL } = this.opts;\n this.heartbeatTicks++;\n // cache scores throught the heartbeat\n const scores = new Map();\n const getScore = (id) => {\n let s = scores.get(id);\n if (s === undefined) {\n s = this.score.score(id);\n scores.set(id, s);\n }\n return s;\n };\n // peer id => topic[]\n const tograft = new Map();\n // peer id => topic[]\n const toprune = new Map();\n // peer id => don't px\n const noPX = new Map();\n // clean up expired backoffs\n this.clearBackoff();\n // clean up peerhave/iasked counters\n this.peerhave.clear();\n this.metrics?.cacheSize.set({ cache: 'iasked' }, this.iasked.size);\n this.iasked.clear();\n // apply IWANT request penalties\n this.applyIwantPenalties();\n // ensure direct peers are connected\n if (this.heartbeatTicks % this.opts.directConnectTicks === 0) {\n // we only do this every few ticks to allow pending connections to complete and account for restarts/downtime\n await this.directConnect();\n }\n // EXTRA: Prune caches\n this.fastMsgIdCache?.prune();\n this.seenCache.prune();\n this.gossipTracer.prune();\n this.publishedMessageIds.prune();\n /**\n * Instead of calling getRandomGossipPeers multiple times to:\n * + get more mesh peers\n * + more outbound peers\n * + oppportunistic grafting\n * + emitGossip\n *\n * We want to loop through the topic peers only a single time and prepare gossip peers for all topics to improve the performance\n */\n const peersToGossipByTopic = new Map();\n // maintain the mesh for topics we have joined\n this.mesh.forEach((peers, topic) => {\n const peersInTopic = this.topics.get(topic);\n const candidateMeshPeers = new Set();\n const peersToGossip = new Set();\n peersToGossipByTopic.set(topic, peersToGossip);\n if (peersInTopic) {\n const shuffledPeers = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(Array.from(peersInTopic));\n const backoff = this.backoff.get(topic);\n for (const id of shuffledPeers) {\n const peerStreams = this.streamsOutbound.get(id);\n if (peerStreams &&\n this.multicodecs.includes(peerStreams.protocol) &&\n !peers.has(id) &&\n !this.direct.has(id)) {\n const score = getScore(id);\n if ((!backoff || !backoff.has(id)) && score >= 0)\n candidateMeshPeers.add(id);\n // instead of having to find gossip peers after heartbeat which require another loop\n // we prepare peers to gossip in a topic within heartbeat to improve performance\n if (score >= this.opts.scoreThresholds.gossipThreshold)\n peersToGossip.add(id);\n }\n }\n }\n // prune/graft helper functions (defined per topic)\n const prunePeer = (id, reason) => {\n this.log('HEARTBEAT: Remove mesh link to %s in %s', id, topic);\n // no need to update peer score here as we do it in makePrune\n // add prune backoff record\n this.addBackoff(id, topic);\n // remove peer from mesh\n peers.delete(id);\n // after pruning a peer from mesh, we want to gossip topic to it if its score meet the gossip threshold\n if (getScore(id) >= this.opts.scoreThresholds.gossipThreshold)\n peersToGossip.add(id);\n this.metrics?.onRemoveFromMesh(topic, reason, 1);\n // add to toprune\n const topics = toprune.get(id);\n if (!topics) {\n toprune.set(id, [topic]);\n }\n else {\n topics.push(topic);\n }\n };\n const graftPeer = (id, reason) => {\n this.log('HEARTBEAT: Add mesh link to %s in %s', id, topic);\n // update peer score\n this.score.graft(id, topic);\n // add peer to mesh\n peers.add(id);\n // when we add a new mesh peer, we don't want to gossip messages to it\n peersToGossip.delete(id);\n this.metrics?.onAddToMesh(topic, reason, 1);\n // add to tograft\n const topics = tograft.get(id);\n if (!topics) {\n tograft.set(id, [topic]);\n }\n else {\n topics.push(topic);\n }\n };\n // drop all peers with negative score, without PX\n peers.forEach((id) => {\n const score = getScore(id);\n // Record the score\n if (score < 0) {\n this.log('HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s', id, score, topic);\n prunePeer(id, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ChurnReason.BadScore);\n noPX.set(id, true);\n }\n });\n // do we have enough peers?\n if (peers.size < Dlo) {\n const ineed = D - peers.size;\n // slice up to first `ineed` items and remove them from candidateMeshPeers\n // same to `const newMeshPeers = candidateMeshPeers.slice(0, ineed)`\n const newMeshPeers = (0,_utils_set_js__WEBPACK_IMPORTED_MODULE_19__.removeFirstNItemsFromSet)(candidateMeshPeers, ineed);\n newMeshPeers.forEach((p) => {\n graftPeer(p, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.InclusionReason.NotEnough);\n });\n }\n // do we have to many peers?\n if (peers.size > Dhi) {\n let peersArray = Array.from(peers);\n // sort by score\n peersArray.sort((a, b) => getScore(b) - getScore(a));\n // We keep the first D_score peers by score and the remaining up to D randomly\n // under the constraint that we keep D_out peers in the mesh (if we have that many)\n peersArray = peersArray.slice(0, Dscore).concat((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(peersArray.slice(Dscore)));\n // count the outbound peers we are keeping\n let outbound = 0;\n peersArray.slice(0, D).forEach((p) => {\n if (this.outbound.get(p)) {\n outbound++;\n }\n });\n // if it's less than D_out, bubble up some outbound peers from the random selection\n if (outbound < Dout) {\n const rotate = (i) => {\n // rotate the peersArray to the right and put the ith peer in the front\n const p = peersArray[i];\n for (let j = i; j > 0; j--) {\n peersArray[j] = peersArray[j - 1];\n }\n peersArray[0] = p;\n };\n // first bubble up all outbound peers already in the selection to the front\n if (outbound > 0) {\n let ihave = outbound;\n for (let i = 1; i < D && ihave > 0; i++) {\n if (this.outbound.get(peersArray[i])) {\n rotate(i);\n ihave--;\n }\n }\n }\n // now bubble up enough outbound peers outside the selection to the front\n let ineed = D - outbound;\n for (let i = D; i < peersArray.length && ineed > 0; i++) {\n if (this.outbound.get(peersArray[i])) {\n rotate(i);\n ineed--;\n }\n }\n }\n // prune the excess peers\n peersArray.slice(D).forEach((p) => {\n prunePeer(p, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.ChurnReason.Excess);\n });\n }\n // do we have enough outbound peers?\n if (peers.size >= Dlo) {\n // count the outbound peers we have\n let outbound = 0;\n peers.forEach((p) => {\n if (this.outbound.get(p)) {\n outbound++;\n }\n });\n // if it's less than D_out, select some peers with outbound connections and graft them\n if (outbound < Dout) {\n const ineed = Dout - outbound;\n const newMeshPeers = (0,_utils_set_js__WEBPACK_IMPORTED_MODULE_19__.removeItemsFromSet)(candidateMeshPeers, ineed, (id) => this.outbound.get(id) === true);\n newMeshPeers.forEach((p) => {\n graftPeer(p, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.InclusionReason.Outbound);\n });\n }\n }\n // should we try to improve the mesh with opportunistic grafting?\n if (this.heartbeatTicks % this.opts.opportunisticGraftTicks === 0 && peers.size > 1) {\n // Opportunistic grafting works as follows: we check the median score of peers in the\n // mesh; if this score is below the opportunisticGraftThreshold, we select a few peers at\n // random with score over the median.\n // The intention is to (slowly) improve an underperforming mesh by introducing good\n // scoring peers that may have been gossiping at us. This allows us to get out of sticky\n // situations where we are stuck with poor peers and also recover from churn of good peers.\n // now compute the median peer score in the mesh\n const peersList = Array.from(peers).sort((a, b) => getScore(a) - getScore(b));\n const medianIndex = Math.floor(peers.size / 2);\n const medianScore = getScore(peersList[medianIndex]);\n // if the median score is below the threshold, select a better peer (if any) and GRAFT\n if (medianScore < this.opts.scoreThresholds.opportunisticGraftThreshold) {\n const ineed = this.opts.opportunisticGraftPeers;\n const newMeshPeers = (0,_utils_set_js__WEBPACK_IMPORTED_MODULE_19__.removeItemsFromSet)(candidateMeshPeers, ineed, (id) => getScore(id) > medianScore);\n for (const id of newMeshPeers) {\n this.log('HEARTBEAT: Opportunistically graft peer %s on topic %s', id, topic);\n graftPeer(id, _metrics_js__WEBPACK_IMPORTED_MODULE_12__.InclusionReason.Opportunistic);\n }\n }\n }\n });\n // expire fanout for topics we haven't published to in a while\n const now = Date.now();\n this.fanoutLastpub.forEach((lastpb, topic) => {\n if (lastpb + fanoutTTL < now) {\n this.fanout.delete(topic);\n this.fanoutLastpub.delete(topic);\n }\n });\n // maintain our fanout for topics we are publishing but we have not joined\n this.fanout.forEach((fanoutPeers, topic) => {\n // checks whether our peers are still in the topic and have a score above the publish threshold\n const topicPeers = this.topics.get(topic);\n fanoutPeers.forEach((id) => {\n if (!topicPeers.has(id) || getScore(id) < this.opts.scoreThresholds.publishThreshold) {\n fanoutPeers.delete(id);\n }\n });\n const peersInTopic = this.topics.get(topic);\n const candidateFanoutPeers = [];\n // the fanout map contains topics to which we are not subscribed.\n const peersToGossip = new Set();\n peersToGossipByTopic.set(topic, peersToGossip);\n if (peersInTopic) {\n const shuffledPeers = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(Array.from(peersInTopic));\n for (const id of shuffledPeers) {\n const peerStreams = this.streamsOutbound.get(id);\n if (peerStreams &&\n this.multicodecs.includes(peerStreams.protocol) &&\n !fanoutPeers.has(id) &&\n !this.direct.has(id)) {\n const score = getScore(id);\n if (score >= this.opts.scoreThresholds.publishThreshold)\n candidateFanoutPeers.push(id);\n // instead of having to find gossip peers after heartbeat which require another loop\n // we prepare peers to gossip in a topic within heartbeat to improve performance\n if (score >= this.opts.scoreThresholds.gossipThreshold)\n peersToGossip.add(id);\n }\n }\n }\n // do we need more peers?\n if (fanoutPeers.size < D) {\n const ineed = D - fanoutPeers.size;\n candidateFanoutPeers.slice(0, ineed).forEach((id) => {\n fanoutPeers.add(id);\n peersToGossip?.delete(id);\n });\n }\n });\n this.emitGossip(peersToGossipByTopic);\n // send coalesced GRAFT/PRUNE messages (will piggyback gossip)\n await this.sendGraftPrune(tograft, toprune, noPX);\n // flush pending gossip that wasn't piggybacked above\n this.flush();\n // advance the message history window\n this.mcache.shift();\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_4__.CustomEvent('gossipsub:heartbeat'));\n }\n /**\n * Given a topic, returns up to count peers subscribed to that topic\n * that pass an optional filter function\n *\n * @param topic\n * @param count\n * @param filter - a function to filter acceptable peers\n */\n getRandomGossipPeers(topic, count, filter = () => true) {\n const peersInTopic = this.topics.get(topic);\n if (!peersInTopic) {\n return new Set();\n }\n // Adds all peers using our protocol\n // that also pass the filter function\n let peers = [];\n peersInTopic.forEach((id) => {\n const peerStreams = this.streamsOutbound.get(id);\n if (!peerStreams) {\n return;\n }\n if (this.multicodecs.includes(peerStreams.protocol) && filter(id)) {\n peers.push(id);\n }\n });\n // Pseudo-randomly shuffles peers\n peers = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__.shuffle)(peers);\n if (count > 0 && peers.length > count) {\n peers = peers.slice(0, count);\n }\n return new Set(peers);\n }\n onScrapeMetrics(metrics) {\n /* Data structure sizes */\n metrics.mcacheSize.set(this.mcache.size);\n metrics.mcacheNotValidatedCount.set(this.mcache.notValidatedCount);\n // Arbitrary size\n metrics.cacheSize.set({ cache: 'direct' }, this.direct.size);\n metrics.cacheSize.set({ cache: 'seenCache' }, this.seenCache.size);\n metrics.cacheSize.set({ cache: 'fastMsgIdCache' }, this.fastMsgIdCache?.size ?? 0);\n metrics.cacheSize.set({ cache: 'publishedMessageIds' }, this.publishedMessageIds.size);\n metrics.cacheSize.set({ cache: 'mcache' }, this.mcache.size);\n metrics.cacheSize.set({ cache: 'score' }, this.score.size);\n metrics.cacheSize.set({ cache: 'gossipTracer.promises' }, this.gossipTracer.size);\n metrics.cacheSize.set({ cache: 'gossipTracer.requests' }, this.gossipTracer.requestMsByMsgSize);\n // Bounded by topic\n metrics.cacheSize.set({ cache: 'topics' }, this.topics.size);\n metrics.cacheSize.set({ cache: 'subscriptions' }, this.subscriptions.size);\n metrics.cacheSize.set({ cache: 'mesh' }, this.mesh.size);\n metrics.cacheSize.set({ cache: 'fanout' }, this.fanout.size);\n // Bounded by peer\n metrics.cacheSize.set({ cache: 'peers' }, this.peers.size);\n metrics.cacheSize.set({ cache: 'streamsOutbound' }, this.streamsOutbound.size);\n metrics.cacheSize.set({ cache: 'streamsInbound' }, this.streamsInbound.size);\n metrics.cacheSize.set({ cache: 'acceptFromWhitelist' }, this.acceptFromWhitelist.size);\n metrics.cacheSize.set({ cache: 'gossip' }, this.gossip.size);\n metrics.cacheSize.set({ cache: 'control' }, this.control.size);\n metrics.cacheSize.set({ cache: 'peerhave' }, this.peerhave.size);\n metrics.cacheSize.set({ cache: 'outbound' }, this.outbound.size);\n // 2D nested data structure\n let backoffSize = 0;\n const now = Date.now();\n metrics.connectedPeersBackoffSec.reset();\n for (const backoff of this.backoff.values()) {\n backoffSize += backoff.size;\n for (const [peer, expiredMs] of backoff.entries()) {\n if (this.peers.has(peer)) {\n metrics.connectedPeersBackoffSec.observe(Math.max(0, expiredMs - now) / 1000);\n }\n }\n }\n metrics.cacheSize.set({ cache: 'backoff' }, backoffSize);\n // Peer counts\n for (const [topicStr, peers] of this.topics) {\n metrics.topicPeersCount.set({ topicStr }, peers.size);\n }\n for (const [topicStr, peers] of this.mesh) {\n metrics.meshPeerCounts.set({ topicStr }, peers.size);\n }\n // Peer scores\n const scores = [];\n const scoreByPeer = new Map();\n metrics.behaviourPenalty.reset();\n for (const peerIdStr of this.peers.keys()) {\n const score = this.score.score(peerIdStr);\n scores.push(score);\n scoreByPeer.set(peerIdStr, score);\n metrics.behaviourPenalty.observe(this.score.peerStats.get(peerIdStr)?.behaviourPenalty ?? 0);\n }\n metrics.registerScores(scores, this.opts.scoreThresholds);\n // Breakdown score per mesh topicLabel\n metrics.registerScorePerMesh(this.mesh, scoreByPeer);\n // Breakdown on each score weight\n const sw = (0,_score_scoreMetrics_js__WEBPACK_IMPORTED_MODULE_16__.computeAllPeersScoreWeights)(this.peers.keys(), this.score.peerStats, this.score.params, this.score.peerIPs, metrics.topicStrToLabel);\n metrics.registerScoreWeights(sw);\n }\n}\nGossipSub.multicodec = _constants_js__WEBPACK_IMPORTED_MODULE_7__.GossipsubIDv11;\nfunction gossipsub(init = {}) {\n return (components) => new GossipSub(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MessageCache: () => (/* binding */ MessageCache)\n/* harmony export */ });\nclass MessageCache {\n /**\n * Holds history of messages in timebounded history arrays\n */\n constructor(\n /**\n * The number of indices in the cache history used for gossiping. That means that a message\n * won't get gossiped anymore when shift got called `gossip` many times after inserting the\n * message in the cache.\n */\n gossip, historyCapacity, msgIdToStrFn) {\n this.gossip = gossip;\n this.msgs = new Map();\n this.history = [];\n /** Track with accounting of messages in the mcache that are not yet validated */\n this.notValidatedCount = 0;\n this.msgIdToStrFn = msgIdToStrFn;\n for (let i = 0; i < historyCapacity; i++) {\n this.history[i] = [];\n }\n }\n get size() {\n return this.msgs.size;\n }\n /**\n * Adds a message to the current window and the cache\n * Returns true if the message is not known and is inserted in the cache\n */\n put(messageId, msg, validated = false) {\n const { msgIdStr } = messageId;\n // Don't add duplicate entries to the cache.\n if (this.msgs.has(msgIdStr)) {\n return false;\n }\n this.msgs.set(msgIdStr, {\n message: msg,\n validated,\n originatingPeers: new Set(),\n iwantCounts: new Map()\n });\n this.history[0].push({ ...messageId, topic: msg.topic });\n if (!validated) {\n this.notValidatedCount++;\n }\n return true;\n }\n observeDuplicate(msgId, fromPeerIdStr) {\n const entry = this.msgs.get(msgId);\n if (entry &&\n // if the message is already validated, we don't need to store extra peers sending us\n // duplicates as the message has already been forwarded\n !entry.validated) {\n entry.originatingPeers.add(fromPeerIdStr);\n }\n }\n /**\n * Retrieves a message from the cache by its ID, if it is still present\n */\n get(msgId) {\n return this.msgs.get(this.msgIdToStrFn(msgId))?.message;\n }\n /**\n * Increases the iwant count for the given message by one and returns the message together\n * with the iwant if the message exists.\n */\n getWithIWantCount(msgIdStr, p) {\n const msg = this.msgs.get(msgIdStr);\n if (!msg) {\n return null;\n }\n const count = (msg.iwantCounts.get(p) ?? 0) + 1;\n msg.iwantCounts.set(p, count);\n return { msg: msg.message, count };\n }\n /**\n * Retrieves a list of message IDs for a set of topics\n */\n getGossipIDs(topics) {\n const msgIdsByTopic = new Map();\n for (let i = 0; i < this.gossip; i++) {\n this.history[i].forEach((entry) => {\n const msg = this.msgs.get(entry.msgIdStr);\n if (msg && msg.validated && topics.has(entry.topic)) {\n let msgIds = msgIdsByTopic.get(entry.topic);\n if (!msgIds) {\n msgIds = [];\n msgIdsByTopic.set(entry.topic, msgIds);\n }\n msgIds.push(entry.msgId);\n }\n });\n }\n return msgIdsByTopic;\n }\n /**\n * Gets a message with msgId and tags it as validated.\n * This function also returns the known peers that have sent us this message. This is used to\n * prevent us sending redundant messages to peers who have already propagated it.\n */\n validate(msgId) {\n const entry = this.msgs.get(msgId);\n if (!entry) {\n return null;\n }\n if (!entry.validated) {\n this.notValidatedCount--;\n }\n const { message, originatingPeers } = entry;\n entry.validated = true;\n // Clear the known peers list (after a message is validated, it is forwarded and we no\n // longer need to store the originating peers).\n entry.originatingPeers = new Set();\n return { message, originatingPeers };\n }\n /**\n * Shifts the current window, discarding messages older than this.history.length of the cache\n */\n shift() {\n const lastCacheEntries = this.history[this.history.length - 1];\n lastCacheEntries.forEach((cacheEntry) => {\n const entry = this.msgs.get(cacheEntry.msgIdStr);\n if (entry) {\n this.msgs.delete(cacheEntry.msgIdStr);\n if (!entry.validated) {\n this.notValidatedCount--;\n }\n }\n });\n this.history.pop();\n this.history.unshift([]);\n }\n remove(msgId) {\n const entry = this.msgs.get(msgId);\n if (!entry) {\n return null;\n }\n // Keep the message on the history vector, it will be dropped on a shift()\n this.msgs.delete(msgId);\n return entry;\n }\n}\n//# sourceMappingURL=message-cache.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message-cache.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeRpc: () => (/* binding */ decodeRpc),\n/* harmony export */ defaultDecodeRpcLimits: () => (/* binding */ defaultDecodeRpcLimits)\n/* harmony export */ });\n/* harmony import */ var protobufjs_minimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protobufjs/minimal.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/node_modules/protobufjs/minimal.js\");\n\nconst defaultDecodeRpcLimits = {\n maxSubscriptions: Infinity,\n maxMessages: Infinity,\n maxIhaveMessageIDs: Infinity,\n maxIwantMessageIDs: Infinity,\n maxControlMessages: Infinity,\n maxPeerInfos: Infinity\n};\n/**\n * Copied code from src/message/rpc.cjs but with decode limits to prevent OOM attacks\n */\nfunction decodeRpc(bytes, opts) {\n // Mutate to use the option as stateful counter. Must limit the total count of messageIDs across all IWANT, IHAVE\n // else one count put 100 messageIDs into each 100 IWANT and \"get around\" the limit\n opts = { ...opts };\n const r = protobufjs_minimal_js__WEBPACK_IMPORTED_MODULE_0__.Reader.create(bytes);\n const l = bytes.length;\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n if (!(m.subscriptions && m.subscriptions.length))\n m.subscriptions = [];\n if (m.subscriptions.length < opts.maxSubscriptions)\n m.subscriptions.push(decodeSubOpts(r, r.uint32()));\n else\n r.skipType(t & 7);\n break;\n case 2:\n if (!(m.messages && m.messages.length))\n m.messages = [];\n if (m.messages.length < opts.maxMessages)\n m.messages.push(decodeMessage(r, r.uint32()));\n else\n r.skipType(t & 7);\n break;\n case 3:\n m.control = decodeControlMessage(r, r.uint32(), opts);\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodeSubOpts(r, l) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.subscribe = r.bool();\n break;\n case 2:\n m.topic = r.string();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodeMessage(r, l) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.from = r.bytes();\n break;\n case 2:\n m.data = r.bytes();\n break;\n case 3:\n m.seqno = r.bytes();\n break;\n case 4:\n m.topic = r.string();\n break;\n case 5:\n m.signature = r.bytes();\n break;\n case 6:\n m.key = r.bytes();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n if (!m.topic)\n throw Error(\"missing required 'topic'\");\n return m;\n}\nfunction decodeControlMessage(r, l, opts) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n if (!(m.ihave && m.ihave.length))\n m.ihave = [];\n if (m.ihave.length < opts.maxControlMessages)\n m.ihave.push(decodeControlIHave(r, r.uint32(), opts));\n else\n r.skipType(t & 7);\n break;\n case 2:\n if (!(m.iwant && m.iwant.length))\n m.iwant = [];\n if (m.iwant.length < opts.maxControlMessages)\n m.iwant.push(decodeControlIWant(r, r.uint32(), opts));\n else\n r.skipType(t & 7);\n break;\n case 3:\n if (!(m.graft && m.graft.length))\n m.graft = [];\n if (m.graft.length < opts.maxControlMessages)\n m.graft.push(decodeControlGraft(r, r.uint32()));\n else\n r.skipType(t & 7);\n break;\n case 4:\n if (!(m.prune && m.prune.length))\n m.prune = [];\n if (m.prune.length < opts.maxControlMessages)\n m.prune.push(decodeControlPrune(r, r.uint32(), opts));\n else\n r.skipType(t & 7);\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodeControlIHave(r, l, opts) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.topicID = r.string();\n break;\n case 2:\n if (!(m.messageIDs && m.messageIDs.length))\n m.messageIDs = [];\n if (opts.maxIhaveMessageIDs-- > 0)\n m.messageIDs.push(r.bytes());\n else\n r.skipType(t & 7);\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodeControlIWant(r, l, opts) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n if (!(m.messageIDs && m.messageIDs.length))\n m.messageIDs = [];\n if (opts.maxIwantMessageIDs-- > 0)\n m.messageIDs.push(r.bytes());\n else\n r.skipType(t & 7);\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodeControlGraft(r, l) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.topicID = r.string();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodeControlPrune(r, l, opts) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.topicID = r.string();\n break;\n case 2:\n if (!(m.peers && m.peers.length))\n m.peers = [];\n if (opts.maxPeerInfos-- > 0)\n m.peers.push(decodePeerInfo(r, r.uint32()));\n else\n r.skipType(t & 7);\n break;\n case 3:\n m.backoff = r.uint64();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\nfunction decodePeerInfo(r, l) {\n const c = l === undefined ? r.len : r.pos + l;\n const m = {};\n while (r.pos < c) {\n const t = r.uint32();\n switch (t >>> 3) {\n case 1:\n m.peerID = r.bytes();\n break;\n case 2:\n m.signedPeerRecord = r.bytes();\n break;\n default:\n r.skipType(t & 7);\n break;\n }\n }\n return m;\n}\n//# sourceMappingURL=decodeRpc.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RPC: () => (/* binding */ RPC)\n/* harmony export */ });\n/* harmony import */ var _rpc_cjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rpc.cjs */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.cjs\");\n\n\nconst {RPC} = _rpc_cjs__WEBPACK_IMPORTED_MODULE_0__\n\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ChurnReason: () => (/* binding */ ChurnReason),\n/* harmony export */ IHaveIgnoreReason: () => (/* binding */ IHaveIgnoreReason),\n/* harmony export */ InclusionReason: () => (/* binding */ InclusionReason),\n/* harmony export */ MessageSource: () => (/* binding */ MessageSource),\n/* harmony export */ ScorePenalty: () => (/* binding */ ScorePenalty),\n/* harmony export */ ScoreThreshold: () => (/* binding */ ScoreThreshold),\n/* harmony export */ getMetrics: () => (/* binding */ getMetrics)\n/* harmony export */ });\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\nvar MessageSource;\n(function (MessageSource) {\n MessageSource[\"forward\"] = \"forward\";\n MessageSource[\"publish\"] = \"publish\";\n})(MessageSource || (MessageSource = {}));\nvar InclusionReason;\n(function (InclusionReason) {\n /** Peer was a fanaout peer. */\n InclusionReason[\"Fanout\"] = \"fanout\";\n /** Included from random selection. */\n InclusionReason[\"Random\"] = \"random\";\n /** Peer subscribed. */\n InclusionReason[\"Subscribed\"] = \"subscribed\";\n /** On heartbeat, peer was included to fill the outbound quota. */\n InclusionReason[\"Outbound\"] = \"outbound\";\n /** On heartbeat, not enough peers in mesh */\n InclusionReason[\"NotEnough\"] = \"not_enough\";\n /** On heartbeat opportunistic grafting due to low mesh score */\n InclusionReason[\"Opportunistic\"] = \"opportunistic\";\n})(InclusionReason || (InclusionReason = {}));\n/// Reasons why a peer was removed from the mesh.\nvar ChurnReason;\n(function (ChurnReason) {\n /// Peer disconnected.\n ChurnReason[\"Dc\"] = \"disconnected\";\n /// Peer had a bad score.\n ChurnReason[\"BadScore\"] = \"bad_score\";\n /// Peer sent a PRUNE.\n ChurnReason[\"Prune\"] = \"prune\";\n /// Too many peers.\n ChurnReason[\"Excess\"] = \"excess\";\n})(ChurnReason || (ChurnReason = {}));\n/// Kinds of reasons a peer's score has been penalized\nvar ScorePenalty;\n(function (ScorePenalty) {\n /// A peer grafted before waiting the back-off time.\n ScorePenalty[\"GraftBackoff\"] = \"graft_backoff\";\n /// A Peer did not respond to an IWANT request in time.\n ScorePenalty[\"BrokenPromise\"] = \"broken_promise\";\n /// A Peer did not send enough messages as expected.\n ScorePenalty[\"MessageDeficit\"] = \"message_deficit\";\n /// Too many peers under one IP address.\n ScorePenalty[\"IPColocation\"] = \"IP_colocation\";\n})(ScorePenalty || (ScorePenalty = {}));\nvar IHaveIgnoreReason;\n(function (IHaveIgnoreReason) {\n IHaveIgnoreReason[\"LowScore\"] = \"low_score\";\n IHaveIgnoreReason[\"MaxIhave\"] = \"max_ihave\";\n IHaveIgnoreReason[\"MaxIasked\"] = \"max_iasked\";\n})(IHaveIgnoreReason || (IHaveIgnoreReason = {}));\nvar ScoreThreshold;\n(function (ScoreThreshold) {\n ScoreThreshold[\"graylist\"] = \"graylist\";\n ScoreThreshold[\"publish\"] = \"publish\";\n ScoreThreshold[\"gossip\"] = \"gossip\";\n ScoreThreshold[\"mesh\"] = \"mesh\";\n})(ScoreThreshold || (ScoreThreshold = {}));\n/**\n * A collection of metrics used throughout the Gossipsub behaviour.\n * NOTE: except for special reasons, do not add more than 1 label for frequent metrics,\n * there's a performance penalty as of June 2023.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction getMetrics(register, topicStrToLabel, opts) {\n // Using function style instead of class to prevent having to re-declare all MetricsPrometheus types.\n return {\n /* Metrics for static config */\n protocolsEnabled: register.gauge({\n name: 'gossipsub_protocol',\n help: 'Status of enabled protocols',\n labelNames: ['protocol']\n }),\n /* Metrics per known topic */\n /** Status of our subscription to this topic. This metric allows analyzing other topic metrics\n * filtered by our current subscription status.\n * = rust-libp2p `topic_subscription_status` */\n topicSubscriptionStatus: register.gauge({\n name: 'gossipsub_topic_subscription_status',\n help: 'Status of our subscription to this topic',\n labelNames: ['topicStr']\n }),\n /** Number of peers subscribed to each topic. This allows us to analyze a topic's behaviour\n * regardless of our subscription status. */\n topicPeersCount: register.gauge({\n name: 'gossipsub_topic_peer_count',\n help: 'Number of peers subscribed to each topic',\n labelNames: ['topicStr']\n }),\n /* Metrics regarding mesh state */\n /** Number of peers in our mesh. This metric should be updated with the count of peers for a\n * topic in the mesh regardless of inclusion and churn events.\n * = rust-libp2p `mesh_peer_counts` */\n meshPeerCounts: register.gauge({\n name: 'gossipsub_mesh_peer_count',\n help: 'Number of peers in our mesh',\n labelNames: ['topicStr']\n }),\n /** Number of times we include peers in a topic mesh for different reasons.\n * = rust-libp2p `mesh_peer_inclusion_events` */\n meshPeerInclusionEvents: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_total',\n help: 'Number of times we include peers in a topic mesh for different reasons',\n labelNames: ['reason']\n }),\n meshPeerInclusionEventsByTopic: register.gauge({\n name: 'gossipsub_mesh_peer_inclusion_events_by_topic_total',\n help: 'Number of times we include peers in a topic',\n labelNames: ['topic']\n }),\n /** Number of times we remove peers in a topic mesh for different reasons.\n * = rust-libp2p `mesh_peer_churn_events` */\n meshPeerChurnEvents: register.gauge({\n name: 'gossipsub_peer_churn_events_total',\n help: 'Number of times we remove peers in a topic mesh for different reasons',\n labelNames: ['reason']\n }),\n meshPeerChurnEventsByTopic: register.gauge({\n name: 'gossipsub_peer_churn_events_by_topic_total',\n help: 'Number of times we remove peers in a topic',\n labelNames: ['topic']\n }),\n /* General Metrics */\n /** Gossipsub supports floodsub, gossipsub v1.0 and gossipsub v1.1. Peers are classified based\n * on which protocol they support. This metric keeps track of the number of peers that are\n * connected of each type. */\n peersPerProtocol: register.gauge({\n name: 'gossipsub_peers_per_protocol_count',\n help: 'Peers connected for each topic',\n labelNames: ['protocol']\n }),\n /** The time it takes to complete one iteration of the heartbeat. */\n heartbeatDuration: register.histogram({\n name: 'gossipsub_heartbeat_duration_seconds',\n help: 'The time it takes to complete one iteration of the heartbeat',\n // Should take <10ms, over 1s it's a huge issue that needs debugging, since a heartbeat will be cancelled\n buckets: [0.01, 0.1, 1]\n }),\n /** Heartbeat run took longer than heartbeat interval so next is skipped */\n heartbeatSkipped: register.gauge({\n name: 'gossipsub_heartbeat_skipped',\n help: 'Heartbeat run took longer than heartbeat interval so next is skipped'\n }),\n /** Message validation results for each topic.\n * Invalid == Reject?\n * = rust-libp2p `invalid_messages`, `accepted_messages`, `ignored_messages`, `rejected_messages` */\n asyncValidationResult: register.gauge({\n name: 'gossipsub_async_validation_result_total',\n help: 'Message validation result',\n labelNames: ['acceptance']\n }),\n asyncValidationResultByTopic: register.gauge({\n name: 'gossipsub_async_validation_result_by_topic_total',\n help: 'Message validation result for each topic',\n labelNames: ['topic']\n }),\n /** When the user validates a message, it tries to re propagate it to its mesh peers. If the\n * message expires from the memcache before it can be validated, we count this a cache miss\n * and it is an indicator that the memcache size should be increased.\n * = rust-libp2p `mcache_misses` */\n asyncValidationMcacheHit: register.gauge({\n name: 'gossipsub_async_validation_mcache_hit_total',\n help: 'Async validation result reported by the user layer',\n labelNames: ['hit']\n }),\n asyncValidationDelayFromFirstSeenSec: register.histogram({\n name: 'gossipsub_async_validation_delay_from_first_seen',\n help: 'Async validation report delay from first seen in second',\n labelNames: ['topic'],\n buckets: [0.01, 0.03, 0.1, 0.3, 1, 3, 10]\n }),\n asyncValidationUnknownFirstSeen: register.gauge({\n name: 'gossipsub_async_validation_unknown_first_seen_count_total',\n help: 'Async validation report unknown first seen value for message'\n }),\n // peer stream\n peerReadStreamError: register.gauge({\n name: 'gossipsub_peer_read_stream_err_count_total',\n help: 'Peer read stream error'\n }),\n // RPC outgoing. Track byte length + data structure sizes\n rpcRecvBytes: register.gauge({ name: 'gossipsub_rpc_recv_bytes_total', help: 'RPC recv' }),\n rpcRecvCount: register.gauge({ name: 'gossipsub_rpc_recv_count_total', help: 'RPC recv' }),\n rpcRecvSubscription: register.gauge({ name: 'gossipsub_rpc_recv_subscription_total', help: 'RPC recv' }),\n rpcRecvMessage: register.gauge({ name: 'gossipsub_rpc_recv_message_total', help: 'RPC recv' }),\n rpcRecvControl: register.gauge({ name: 'gossipsub_rpc_recv_control_total', help: 'RPC recv' }),\n rpcRecvIHave: register.gauge({ name: 'gossipsub_rpc_recv_ihave_total', help: 'RPC recv' }),\n rpcRecvIWant: register.gauge({ name: 'gossipsub_rpc_recv_iwant_total', help: 'RPC recv' }),\n rpcRecvGraft: register.gauge({ name: 'gossipsub_rpc_recv_graft_total', help: 'RPC recv' }),\n rpcRecvPrune: register.gauge({ name: 'gossipsub_rpc_recv_prune_total', help: 'RPC recv' }),\n rpcDataError: register.gauge({ name: 'gossipsub_rpc_data_err_count_total', help: 'RPC data error' }),\n rpcRecvError: register.gauge({ name: 'gossipsub_rpc_recv_err_count_total', help: 'RPC recv error' }),\n /** Total count of RPC dropped because acceptFrom() == false */\n rpcRecvNotAccepted: register.gauge({\n name: 'gossipsub_rpc_rcv_not_accepted_total',\n help: 'Total count of RPC dropped because acceptFrom() == false'\n }),\n // RPC incoming. Track byte length + data structure sizes\n rpcSentBytes: register.gauge({ name: 'gossipsub_rpc_sent_bytes_total', help: 'RPC sent' }),\n rpcSentCount: register.gauge({ name: 'gossipsub_rpc_sent_count_total', help: 'RPC sent' }),\n rpcSentSubscription: register.gauge({ name: 'gossipsub_rpc_sent_subscription_total', help: 'RPC sent' }),\n rpcSentMessage: register.gauge({ name: 'gossipsub_rpc_sent_message_total', help: 'RPC sent' }),\n rpcSentControl: register.gauge({ name: 'gossipsub_rpc_sent_control_total', help: 'RPC sent' }),\n rpcSentIHave: register.gauge({ name: 'gossipsub_rpc_sent_ihave_total', help: 'RPC sent' }),\n rpcSentIWant: register.gauge({ name: 'gossipsub_rpc_sent_iwant_total', help: 'RPC sent' }),\n rpcSentGraft: register.gauge({ name: 'gossipsub_rpc_sent_graft_total', help: 'RPC sent' }),\n rpcSentPrune: register.gauge({ name: 'gossipsub_rpc_sent_prune_total', help: 'RPC sent' }),\n // publish message. Track peers sent to and bytes\n /** Total count of msg published by topic */\n msgPublishCount: register.gauge({\n name: 'gossipsub_msg_publish_count_total',\n help: 'Total count of msg published by topic',\n labelNames: ['topic']\n }),\n /** Total count of peers that we publish a msg to */\n msgPublishPeersByTopic: register.gauge({\n name: 'gossipsub_msg_publish_peers_total',\n help: 'Total count of peers that we publish a msg to',\n labelNames: ['topic']\n }),\n /** Total count of peers (by group) that we publish a msg to */\n // NOTE: Do not use 'group' label since it's a generic already used by Prometheus to group instances\n msgPublishPeersByGroup: register.gauge({\n name: 'gossipsub_msg_publish_peers_by_group',\n help: 'Total count of peers (by group) that we publish a msg to',\n labelNames: ['peerGroup']\n }),\n /** Total count of msg publish data.length bytes */\n msgPublishBytes: register.gauge({\n name: 'gossipsub_msg_publish_bytes_total',\n help: 'Total count of msg publish data.length bytes',\n labelNames: ['topic']\n }),\n /** Total count of msg forwarded by topic */\n msgForwardCount: register.gauge({\n name: 'gossipsub_msg_forward_count_total',\n help: 'Total count of msg forwarded by topic',\n labelNames: ['topic']\n }),\n /** Total count of peers that we forward a msg to */\n msgForwardPeers: register.gauge({\n name: 'gossipsub_msg_forward_peers_total',\n help: 'Total count of peers that we forward a msg to',\n labelNames: ['topic']\n }),\n /** Total count of recv msgs before any validation */\n msgReceivedPreValidation: register.gauge({\n name: 'gossipsub_msg_received_prevalidation_total',\n help: 'Total count of recv msgs before any validation',\n labelNames: ['topic']\n }),\n /** Total count of recv msgs error */\n msgReceivedError: register.gauge({\n name: 'gossipsub_msg_received_error_total',\n help: 'Total count of recv msgs error',\n labelNames: ['topic']\n }),\n /** Tracks distribution of recv msgs by duplicate, invalid, valid */\n msgReceivedStatus: register.gauge({\n name: 'gossipsub_msg_received_status_total',\n help: 'Tracks distribution of recv msgs by duplicate, invalid, valid',\n labelNames: ['status']\n }),\n msgReceivedTopic: register.gauge({\n name: 'gossipsub_msg_received_topic_total',\n help: 'Tracks distribution of recv msgs by topic label',\n labelNames: ['topic']\n }),\n /** Tracks specific reason of invalid */\n msgReceivedInvalid: register.gauge({\n name: 'gossipsub_msg_received_invalid_total',\n help: 'Tracks specific reason of invalid',\n labelNames: ['error']\n }),\n msgReceivedInvalidByTopic: register.gauge({\n name: 'gossipsub_msg_received_invalid_by_topic_total',\n help: 'Tracks specific invalid message by topic',\n labelNames: ['topic']\n }),\n /** Track duplicate message delivery time */\n duplicateMsgDeliveryDelay: register.histogram({\n name: 'gossisub_duplicate_msg_delivery_delay_seconds',\n help: 'Time since the 1st duplicated message validated',\n labelNames: ['topic'],\n buckets: [\n 0.25 * opts.maxMeshMessageDeliveriesWindowSec,\n 0.5 * opts.maxMeshMessageDeliveriesWindowSec,\n 1 * opts.maxMeshMessageDeliveriesWindowSec,\n 2 * opts.maxMeshMessageDeliveriesWindowSec,\n 4 * opts.maxMeshMessageDeliveriesWindowSec\n ]\n }),\n /** Total count of late msg delivery total by topic */\n duplicateMsgLateDelivery: register.gauge({\n name: 'gossisub_duplicate_msg_late_delivery_total',\n help: 'Total count of late duplicate message delivery by topic, which triggers P3 penalty',\n labelNames: ['topic']\n }),\n duplicateMsgIgnored: register.gauge({\n name: 'gossisub_ignored_published_duplicate_msgs_total',\n help: 'Total count of published duplicate message ignored by topic',\n labelNames: ['topic']\n }),\n /* Metrics related to scoring */\n /** Total times score() is called */\n scoreFnCalls: register.gauge({\n name: 'gossipsub_score_fn_calls_total',\n help: 'Total times score() is called'\n }),\n /** Total times score() call actually computed computeScore(), no cache */\n scoreFnRuns: register.gauge({\n name: 'gossipsub_score_fn_runs_total',\n help: 'Total times score() call actually computed computeScore(), no cache'\n }),\n scoreCachedDelta: register.histogram({\n name: 'gossipsub_score_cache_delta',\n help: 'Delta of score between cached values that expired',\n buckets: [10, 100, 1000]\n }),\n /** Current count of peers by score threshold */\n peersByScoreThreshold: register.gauge({\n name: 'gossipsub_peers_by_score_threshold_count',\n help: 'Current count of peers by score threshold',\n labelNames: ['threshold']\n }),\n score: register.avgMinMax({\n name: 'gossipsub_score',\n help: 'Avg min max of gossip scores'\n }),\n /**\n * Separate score weights\n * Need to use 2-label metrics in this case to debug the score weights\n **/\n scoreWeights: register.avgMinMax({\n name: 'gossipsub_score_weights',\n help: 'Separate score weights',\n labelNames: ['topic', 'p']\n }),\n /** Histogram of the scores for each mesh topic. */\n // TODO: Not implemented\n scorePerMesh: register.avgMinMax({\n name: 'gossipsub_score_per_mesh',\n help: 'Histogram of the scores for each mesh topic',\n labelNames: ['topic']\n }),\n /** A counter of the kind of penalties being applied to peers. */\n // TODO: Not fully implemented\n scoringPenalties: register.gauge({\n name: 'gossipsub_scoring_penalties_total',\n help: 'A counter of the kind of penalties being applied to peers',\n labelNames: ['penalty']\n }),\n behaviourPenalty: register.histogram({\n name: 'gossipsub_peer_stat_behaviour_penalty',\n help: 'Current peer stat behaviour_penalty at each scrape',\n buckets: [\n 0.25 * opts.behaviourPenaltyThreshold,\n 0.5 * opts.behaviourPenaltyThreshold,\n 1 * opts.behaviourPenaltyThreshold,\n 2 * opts.behaviourPenaltyThreshold,\n 4 * opts.behaviourPenaltyThreshold\n ]\n }),\n // TODO:\n // - iasked per peer (on heartbeat)\n // - when promise is resolved, track messages from promises\n /** Total received IHAVE messages that we ignore for some reason */\n ihaveRcvIgnored: register.gauge({\n name: 'gossipsub_ihave_rcv_ignored_total',\n help: 'Total received IHAVE messages that we ignore for some reason',\n labelNames: ['reason']\n }),\n /** Total received IHAVE messages by topic */\n ihaveRcvMsgids: register.gauge({\n name: 'gossipsub_ihave_rcv_msgids_total',\n help: 'Total received IHAVE messages by topic',\n labelNames: ['topic']\n }),\n /** Total messages per topic we don't have. Not actual requests.\n * The number of times we have decided that an IWANT control message is required for this\n * topic. A very high metric might indicate an underperforming network.\n * = rust-libp2p `topic_iwant_msgs` */\n ihaveRcvNotSeenMsgids: register.gauge({\n name: 'gossipsub_ihave_rcv_not_seen_msgids_total',\n help: 'Total messages per topic we do not have, not actual requests',\n labelNames: ['topic']\n }),\n /** Total received IWANT messages by topic */\n iwantRcvMsgids: register.gauge({\n name: 'gossipsub_iwant_rcv_msgids_total',\n help: 'Total received IWANT messages by topic',\n labelNames: ['topic']\n }),\n /** Total requested messageIDs that we don't have */\n iwantRcvDonthaveMsgids: register.gauge({\n name: 'gossipsub_iwant_rcv_dont_have_msgids_total',\n help: 'Total requested messageIDs that we do not have'\n }),\n iwantPromiseStarted: register.gauge({\n name: 'gossipsub_iwant_promise_sent_total',\n help: 'Total count of started IWANT promises'\n }),\n /** Total count of resolved IWANT promises */\n iwantPromiseResolved: register.gauge({\n name: 'gossipsub_iwant_promise_resolved_total',\n help: 'Total count of resolved IWANT promises'\n }),\n /** Total count of resolved IWANT promises from duplicate messages */\n iwantPromiseResolvedFromDuplicate: register.gauge({\n name: 'gossipsub_iwant_promise_resolved_from_duplicate_total',\n help: 'Total count of resolved IWANT promises from duplicate messages'\n }),\n /** Total count of peers we have asked IWANT promises that are resolved */\n iwantPromiseResolvedPeers: register.gauge({\n name: 'gossipsub_iwant_promise_resolved_peers',\n help: 'Total count of peers we have asked IWANT promises that are resolved'\n }),\n iwantPromiseBroken: register.gauge({\n name: 'gossipsub_iwant_promise_broken',\n help: 'Total count of broken IWANT promises'\n }),\n iwantMessagePruned: register.gauge({\n name: 'gossipsub_iwant_message_pruned',\n help: 'Total count of pruned IWANT messages'\n }),\n /** Histogram of delivery time of resolved IWANT promises */\n iwantPromiseDeliveryTime: register.histogram({\n name: 'gossipsub_iwant_promise_delivery_seconds',\n help: 'Histogram of delivery time of resolved IWANT promises',\n buckets: [\n 0.5 * opts.gossipPromiseExpireSec,\n 1 * opts.gossipPromiseExpireSec,\n 2 * opts.gossipPromiseExpireSec,\n 4 * opts.gossipPromiseExpireSec\n ]\n }),\n iwantPromiseUntracked: register.gauge({\n name: 'gossip_iwant_promise_untracked',\n help: 'Total count of untracked IWANT promise'\n }),\n /** Backoff time */\n connectedPeersBackoffSec: register.histogram({\n name: 'gossipsub_connected_peers_backoff_seconds',\n help: 'Backoff time in seconds',\n // Using 1 seconds as minimum as that's close to the heartbeat duration, no need for more resolution.\n // As per spec, backoff times are 10 seconds for UnsubscribeBackoff and 60 seconds for PruneBackoff.\n // Higher values of 60 seconds should not occur, but we add 120 seconds just in case\n // https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#overview-of-new-parameters\n buckets: [1, 2, 4, 10, 20, 60, 120]\n }),\n /* Data structure sizes */\n /** Unbounded cache sizes */\n cacheSize: register.gauge({\n name: 'gossipsub_cache_size',\n help: 'Unbounded cache sizes',\n labelNames: ['cache']\n }),\n /** Current mcache msg count */\n mcacheSize: register.gauge({\n name: 'gossipsub_mcache_size',\n help: 'Current mcache msg count'\n }),\n mcacheNotValidatedCount: register.gauge({\n name: 'gossipsub_mcache_not_validated_count',\n help: 'Current mcache msg count not validated'\n }),\n fastMsgIdCacheCollision: register.gauge({\n name: 'gossipsub_fastmsgid_cache_collision_total',\n help: 'Total count of key collisions on fastmsgid cache put'\n }),\n newConnectionCount: register.gauge({\n name: 'gossipsub_new_connection_total',\n help: 'Total new connection by status',\n labelNames: ['status']\n }),\n topicStrToLabel: topicStrToLabel,\n toTopic(topicStr) {\n return this.topicStrToLabel.get(topicStr) ?? topicStr;\n },\n /** We joined a topic */\n onJoin(topicStr) {\n this.topicSubscriptionStatus.set({ topicStr }, 1);\n this.meshPeerCounts.set({ topicStr }, 0); // Reset count\n },\n /** We left a topic */\n onLeave(topicStr) {\n this.topicSubscriptionStatus.set({ topicStr }, 0);\n this.meshPeerCounts.set({ topicStr }, 0); // Reset count\n },\n /** Register the inclusion of peers in our mesh due to some reason. */\n onAddToMesh(topicStr, reason, count) {\n const topic = this.toTopic(topicStr);\n this.meshPeerInclusionEvents.inc({ reason }, count);\n this.meshPeerInclusionEventsByTopic.inc({ topic }, count);\n },\n /** Register the removal of peers in our mesh due to some reason */\n // - remove_peer_from_mesh()\n // - heartbeat() Churn::BadScore\n // - heartbeat() Churn::Excess\n // - on_disconnect() Churn::Ds\n onRemoveFromMesh(topicStr, reason, count) {\n const topic = this.toTopic(topicStr);\n this.meshPeerChurnEvents.inc({ reason }, count);\n this.meshPeerChurnEventsByTopic.inc({ topic }, count);\n },\n /**\n * Update validation result to metrics\n * @param messageRecord null means the message's mcache record was not known at the time of acceptance report\n */\n onReportValidation(messageRecord, acceptance, firstSeenTimestampMs) {\n this.asyncValidationMcacheHit.inc({ hit: messageRecord != null ? 'hit' : 'miss' });\n if (messageRecord != null) {\n const topic = this.toTopic(messageRecord.message.topic);\n this.asyncValidationResult.inc({ acceptance });\n this.asyncValidationResultByTopic.inc({ topic });\n }\n if (firstSeenTimestampMs != null) {\n this.asyncValidationDelayFromFirstSeenSec.observe((Date.now() - firstSeenTimestampMs) / 1000);\n }\n else {\n this.asyncValidationUnknownFirstSeen.inc();\n }\n },\n /**\n * - in handle_graft() Penalty::GraftBackoff\n * - in apply_iwant_penalties() Penalty::BrokenPromise\n * - in metric_score() P3 Penalty::MessageDeficit\n * - in metric_score() P6 Penalty::IPColocation\n */\n onScorePenalty(penalty) {\n // Can this be labeled by topic too?\n this.scoringPenalties.inc({ penalty }, 1);\n },\n onIhaveRcv(topicStr, ihave, idonthave) {\n const topic = this.toTopic(topicStr);\n this.ihaveRcvMsgids.inc({ topic }, ihave);\n this.ihaveRcvNotSeenMsgids.inc({ topic }, idonthave);\n },\n onIwantRcv(iwantByTopic, iwantDonthave) {\n for (const [topicStr, iwant] of iwantByTopic) {\n const topic = this.toTopic(topicStr);\n this.iwantRcvMsgids.inc({ topic }, iwant);\n }\n this.iwantRcvDonthaveMsgids.inc(iwantDonthave);\n },\n onForwardMsg(topicStr, tosendCount) {\n const topic = this.toTopic(topicStr);\n this.msgForwardCount.inc({ topic }, 1);\n this.msgForwardPeers.inc({ topic }, tosendCount);\n },\n onPublishMsg(topicStr, tosendGroupCount, tosendCount, dataLen) {\n const topic = this.toTopic(topicStr);\n this.msgPublishCount.inc({ topic }, 1);\n this.msgPublishBytes.inc({ topic }, tosendCount * dataLen);\n this.msgPublishPeersByTopic.inc({ topic }, tosendCount);\n this.msgPublishPeersByGroup.inc({ peerGroup: 'direct' }, tosendGroupCount.direct);\n this.msgPublishPeersByGroup.inc({ peerGroup: 'floodsub' }, tosendGroupCount.floodsub);\n this.msgPublishPeersByGroup.inc({ peerGroup: 'mesh' }, tosendGroupCount.mesh);\n this.msgPublishPeersByGroup.inc({ peerGroup: 'fanout' }, tosendGroupCount.fanout);\n },\n onMsgRecvPreValidation(topicStr) {\n const topic = this.toTopic(topicStr);\n this.msgReceivedPreValidation.inc({ topic }, 1);\n },\n onMsgRecvError(topicStr) {\n const topic = this.toTopic(topicStr);\n this.msgReceivedError.inc({ topic }, 1);\n },\n onMsgRecvResult(topicStr, status) {\n const topic = this.toTopic(topicStr);\n this.msgReceivedTopic.inc({ topic });\n this.msgReceivedStatus.inc({ status });\n },\n onMsgRecvInvalid(topicStr, reason) {\n const topic = this.toTopic(topicStr);\n const error = reason.reason === _types_js__WEBPACK_IMPORTED_MODULE_0__.RejectReason.Error ? reason.error : reason.reason;\n this.msgReceivedInvalid.inc({ error }, 1);\n this.msgReceivedInvalidByTopic.inc({ topic }, 1);\n },\n onDuplicateMsgDelivery(topicStr, deliveryDelayMs, isLateDelivery) {\n this.duplicateMsgDeliveryDelay.observe(deliveryDelayMs / 1000);\n if (isLateDelivery) {\n const topic = this.toTopic(topicStr);\n this.duplicateMsgLateDelivery.inc({ topic }, 1);\n }\n },\n onPublishDuplicateMsg(topicStr) {\n const topic = this.toTopic(topicStr);\n this.duplicateMsgIgnored.inc({ topic }, 1);\n },\n onPeerReadStreamError() {\n this.peerReadStreamError.inc(1);\n },\n onRpcRecvError() {\n this.rpcRecvError.inc(1);\n },\n onRpcDataError() {\n this.rpcDataError.inc(1);\n },\n onRpcRecv(rpc, rpcBytes) {\n this.rpcRecvBytes.inc(rpcBytes);\n this.rpcRecvCount.inc(1);\n if (rpc.subscriptions)\n this.rpcRecvSubscription.inc(rpc.subscriptions.length);\n if (rpc.messages)\n this.rpcRecvMessage.inc(rpc.messages.length);\n if (rpc.control) {\n this.rpcRecvControl.inc(1);\n if (rpc.control.ihave)\n this.rpcRecvIHave.inc(rpc.control.ihave.length);\n if (rpc.control.iwant)\n this.rpcRecvIWant.inc(rpc.control.iwant.length);\n if (rpc.control.graft)\n this.rpcRecvGraft.inc(rpc.control.graft.length);\n if (rpc.control.prune)\n this.rpcRecvPrune.inc(rpc.control.prune.length);\n }\n },\n onRpcSent(rpc, rpcBytes) {\n this.rpcSentBytes.inc(rpcBytes);\n this.rpcSentCount.inc(1);\n if (rpc.subscriptions)\n this.rpcSentSubscription.inc(rpc.subscriptions.length);\n if (rpc.messages)\n this.rpcSentMessage.inc(rpc.messages.length);\n if (rpc.control) {\n const ihave = rpc.control.ihave?.length ?? 0;\n const iwant = rpc.control.iwant?.length ?? 0;\n const graft = rpc.control.graft?.length ?? 0;\n const prune = rpc.control.prune?.length ?? 0;\n if (ihave > 0)\n this.rpcSentIHave.inc(ihave);\n if (iwant > 0)\n this.rpcSentIWant.inc(iwant);\n if (graft > 0)\n this.rpcSentGraft.inc(graft);\n if (prune > 0)\n this.rpcSentPrune.inc(prune);\n if (ihave > 0 || iwant > 0 || graft > 0 || prune > 0)\n this.rpcSentControl.inc(1);\n }\n },\n registerScores(scores, scoreThresholds) {\n let graylist = 0;\n let publish = 0;\n let gossip = 0;\n let mesh = 0;\n for (const score of scores) {\n if (score >= scoreThresholds.graylistThreshold)\n graylist++;\n if (score >= scoreThresholds.publishThreshold)\n publish++;\n if (score >= scoreThresholds.gossipThreshold)\n gossip++;\n if (score >= 0)\n mesh++;\n }\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.graylist }, graylist);\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.publish }, publish);\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.gossip }, gossip);\n this.peersByScoreThreshold.set({ threshold: ScoreThreshold.mesh }, mesh);\n // Register full score too\n this.score.set(scores);\n },\n registerScoreWeights(sw) {\n for (const [topic, wsTopic] of sw.byTopic) {\n this.scoreWeights.set({ topic, p: 'p1' }, wsTopic.p1w);\n this.scoreWeights.set({ topic, p: 'p2' }, wsTopic.p2w);\n this.scoreWeights.set({ topic, p: 'p3' }, wsTopic.p3w);\n this.scoreWeights.set({ topic, p: 'p3b' }, wsTopic.p3bw);\n this.scoreWeights.set({ topic, p: 'p4' }, wsTopic.p4w);\n }\n this.scoreWeights.set({ p: 'p5' }, sw.p5w);\n this.scoreWeights.set({ p: 'p6' }, sw.p6w);\n this.scoreWeights.set({ p: 'p7' }, sw.p7w);\n },\n registerScorePerMesh(mesh, scoreByPeer) {\n const peersPerTopicLabel = new Map();\n mesh.forEach((peers, topicStr) => {\n // Aggregate by known topicLabel or throw to 'unknown'. This prevent too high cardinality\n const topicLabel = this.topicStrToLabel.get(topicStr) ?? 'unknown';\n let peersInMesh = peersPerTopicLabel.get(topicLabel);\n if (!peersInMesh) {\n peersInMesh = new Set();\n peersPerTopicLabel.set(topicLabel, peersInMesh);\n }\n peers.forEach((p) => peersInMesh?.add(p));\n });\n for (const [topic, peers] of peersPerTopicLabel) {\n const meshScores = [];\n peers.forEach((peer) => {\n meshScores.push(scoreByPeer.get(peer) ?? 0);\n });\n this.scorePerMesh.set({ topic }, meshScores);\n }\n }\n };\n}\n//# sourceMappingURL=metrics.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/metrics.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ computeScore: () => (/* binding */ computeScore)\n/* harmony export */ });\nfunction computeScore(peer, pstats, params, peerIPs) {\n let score = 0;\n // topic stores\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n // the topic parameters\n const topicParams = params.topics[topic];\n if (topicParams === undefined) {\n // we are not scoring this topic\n return;\n }\n let topicScore = 0;\n // P1: time in Mesh\n if (tstats.inMesh) {\n let p1 = tstats.meshTime / topicParams.timeInMeshQuantum;\n if (p1 > topicParams.timeInMeshCap) {\n p1 = topicParams.timeInMeshCap;\n }\n topicScore += p1 * topicParams.timeInMeshWeight;\n }\n // P2: first message deliveries\n let p2 = tstats.firstMessageDeliveries;\n if (p2 > topicParams.firstMessageDeliveriesCap) {\n p2 = topicParams.firstMessageDeliveriesCap;\n }\n topicScore += p2 * topicParams.firstMessageDeliveriesWeight;\n // P3: mesh message deliveries\n if (tstats.meshMessageDeliveriesActive &&\n tstats.meshMessageDeliveries < topicParams.meshMessageDeliveriesThreshold) {\n const deficit = topicParams.meshMessageDeliveriesThreshold - tstats.meshMessageDeliveries;\n const p3 = deficit * deficit;\n topicScore += p3 * topicParams.meshMessageDeliveriesWeight;\n }\n // P3b:\n // NOTE: the weight of P3b is negative (validated in validateTopicScoreParams) so this detracts\n const p3b = tstats.meshFailurePenalty;\n topicScore += p3b * topicParams.meshFailurePenaltyWeight;\n // P4: invalid messages\n // NOTE: the weight of P4 is negative (validated in validateTopicScoreParams) so this detracts\n const p4 = tstats.invalidMessageDeliveries * tstats.invalidMessageDeliveries;\n topicScore += p4 * topicParams.invalidMessageDeliveriesWeight;\n // update score, mixing with topic weight\n score += topicScore * topicParams.topicWeight;\n });\n // apply the topic score cap, if any\n if (params.topicScoreCap > 0 && score > params.topicScoreCap) {\n score = params.topicScoreCap;\n }\n // P5: application-specific score\n const p5 = params.appSpecificScore(peer);\n score += p5 * params.appSpecificWeight;\n // P6: IP colocation factor\n pstats.knownIPs.forEach((ip) => {\n if (params.IPColocationFactorWhitelist.has(ip)) {\n return;\n }\n // P6 has a cliff (IPColocationFactorThreshold)\n // It's only applied if at least that many peers are connected to us from that source IP addr.\n // It is quadratic, and the weight is negative (validated in validatePeerScoreParams)\n const peersInIP = peerIPs.get(ip);\n const numPeersInIP = peersInIP ? peersInIP.size : 0;\n if (numPeersInIP > params.IPColocationFactorThreshold) {\n const surplus = numPeersInIP - params.IPColocationFactorThreshold;\n const p6 = surplus * surplus;\n score += p6 * params.IPColocationFactorWeight;\n }\n });\n // P7: behavioural pattern penalty\n if (pstats.behaviourPenalty > params.behaviourPenaltyThreshold) {\n const excess = pstats.behaviourPenalty - params.behaviourPenaltyThreshold;\n const p7 = excess * excess;\n score += p7 * params.behaviourPenaltyWeight;\n }\n return score;\n}\n//# sourceMappingURL=compute-score.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ERR_INVALID_PEER_SCORE_PARAMS: () => (/* binding */ ERR_INVALID_PEER_SCORE_PARAMS),\n/* harmony export */ ERR_INVALID_PEER_SCORE_THRESHOLDS: () => (/* binding */ ERR_INVALID_PEER_SCORE_THRESHOLDS)\n/* harmony export */ });\nconst ERR_INVALID_PEER_SCORE_PARAMS = 'ERR_INVALID_PEER_SCORE_PARAMS';\nconst ERR_INVALID_PEER_SCORE_THRESHOLDS = 'ERR_INVALID_PEER_SCORE_THRESHOLDS';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/index.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/index.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerScore: () => (/* reexport safe */ _peer_score_js__WEBPACK_IMPORTED_MODULE_2__.PeerScore),\n/* harmony export */ createPeerScoreParams: () => (/* reexport safe */ _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.createPeerScoreParams),\n/* harmony export */ createPeerScoreThresholds: () => (/* reexport safe */ _peer_score_thresholds_js__WEBPACK_IMPORTED_MODULE_1__.createPeerScoreThresholds),\n/* harmony export */ createTopicScoreParams: () => (/* reexport safe */ _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.createTopicScoreParams),\n/* harmony export */ defaultPeerScoreParams: () => (/* reexport safe */ _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.defaultPeerScoreParams),\n/* harmony export */ defaultPeerScoreThresholds: () => (/* reexport safe */ _peer_score_thresholds_js__WEBPACK_IMPORTED_MODULE_1__.defaultPeerScoreThresholds),\n/* harmony export */ defaultTopicScoreParams: () => (/* reexport safe */ _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.defaultTopicScoreParams),\n/* harmony export */ validatePeerScoreParams: () => (/* reexport safe */ _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.validatePeerScoreParams),\n/* harmony export */ validatePeerScoreThresholds: () => (/* reexport safe */ _peer_score_thresholds_js__WEBPACK_IMPORTED_MODULE_1__.validatePeerScoreThresholds),\n/* harmony export */ validateTopicScoreParams: () => (/* reexport safe */ _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.validateTopicScoreParams)\n/* harmony export */ });\n/* harmony import */ var _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./peer-score-params.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js\");\n/* harmony import */ var _peer_score_thresholds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./peer-score-thresholds.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js\");\n/* harmony import */ var _peer_score_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./peer-score.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js\");\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/index.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DeliveryRecordStatus: () => (/* binding */ DeliveryRecordStatus),\n/* harmony export */ MessageDeliveries: () => (/* binding */ MessageDeliveries)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/constants.js\");\n/* harmony import */ var denque__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! denque */ \"./node_modules/denque/index.js\");\n\n\nvar DeliveryRecordStatus;\n(function (DeliveryRecordStatus) {\n /**\n * we don't know (yet) if the message is valid\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"unknown\"] = 0] = \"unknown\";\n /**\n * we know the message is valid\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"valid\"] = 1] = \"valid\";\n /**\n * we know the message is invalid\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"invalid\"] = 2] = \"invalid\";\n /**\n * we were instructed by the validator to ignore the message\n */\n DeliveryRecordStatus[DeliveryRecordStatus[\"ignored\"] = 3] = \"ignored\";\n})(DeliveryRecordStatus || (DeliveryRecordStatus = {}));\n/**\n * Map of canonical message ID to DeliveryRecord\n *\n * Maintains an internal queue for efficient gc of old messages\n */\nclass MessageDeliveries {\n constructor() {\n this.records = new Map();\n this.queue = new denque__WEBPACK_IMPORTED_MODULE_1__();\n }\n getRecord(msgIdStr) {\n return this.records.get(msgIdStr);\n }\n ensureRecord(msgIdStr) {\n let drec = this.records.get(msgIdStr);\n if (drec) {\n return drec;\n }\n // record doesn't exist yet\n // create record\n drec = {\n status: DeliveryRecordStatus.unknown,\n firstSeenTsMs: Date.now(),\n validated: 0,\n peers: new Set()\n };\n this.records.set(msgIdStr, drec);\n // and add msgId to the queue\n const entry = {\n msgId: msgIdStr,\n expire: Date.now() + _constants_js__WEBPACK_IMPORTED_MODULE_0__.TimeCacheDuration\n };\n this.queue.push(entry);\n return drec;\n }\n gc() {\n const now = Date.now();\n // queue is sorted by expiry time\n // remove expired messages, remove from queue until first un-expired message found\n let head = this.queue.peekFront();\n while (head && head.expire < now) {\n this.records.delete(head.msgId);\n this.queue.shift();\n head = this.queue.peekFront();\n }\n }\n clear() {\n this.records.clear();\n this.queue.clear();\n }\n}\n//# sourceMappingURL=message-deliveries.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerScoreParams: () => (/* binding */ createPeerScoreParams),\n/* harmony export */ createTopicScoreParams: () => (/* binding */ createTopicScoreParams),\n/* harmony export */ defaultPeerScoreParams: () => (/* binding */ defaultPeerScoreParams),\n/* harmony export */ defaultTopicScoreParams: () => (/* binding */ defaultTopicScoreParams),\n/* harmony export */ validatePeerScoreParams: () => (/* binding */ validatePeerScoreParams),\n/* harmony export */ validateTopicScoreParams: () => (/* binding */ validateTopicScoreParams)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n\n\nconst defaultPeerScoreParams = {\n topics: {},\n topicScoreCap: 10.0,\n appSpecificScore: () => 0.0,\n appSpecificWeight: 10.0,\n IPColocationFactorWeight: -5.0,\n IPColocationFactorThreshold: 10.0,\n IPColocationFactorWhitelist: new Set(),\n behaviourPenaltyWeight: -10.0,\n behaviourPenaltyThreshold: 0.0,\n behaviourPenaltyDecay: 0.2,\n decayInterval: 1000.0,\n decayToZero: 0.1,\n retainScore: 3600 * 1000\n};\nconst defaultTopicScoreParams = {\n topicWeight: 0.5,\n timeInMeshWeight: 1,\n timeInMeshQuantum: 1,\n timeInMeshCap: 3600,\n firstMessageDeliveriesWeight: 1,\n firstMessageDeliveriesDecay: 0.5,\n firstMessageDeliveriesCap: 2000,\n meshMessageDeliveriesWeight: -1,\n meshMessageDeliveriesDecay: 0.5,\n meshMessageDeliveriesCap: 100,\n meshMessageDeliveriesThreshold: 20,\n meshMessageDeliveriesWindow: 10,\n meshMessageDeliveriesActivation: 5000,\n meshFailurePenaltyWeight: -1,\n meshFailurePenaltyDecay: 0.5,\n invalidMessageDeliveriesWeight: -1,\n invalidMessageDeliveriesDecay: 0.3\n};\nfunction createPeerScoreParams(p = {}) {\n return {\n ...defaultPeerScoreParams,\n ...p,\n topics: p.topics\n ? Object.entries(p.topics).reduce((topics, [topic, topicScoreParams]) => {\n topics[topic] = createTopicScoreParams(topicScoreParams);\n return topics;\n }, {})\n : {}\n };\n}\nfunction createTopicScoreParams(p = {}) {\n return {\n ...defaultTopicScoreParams,\n ...p\n };\n}\n// peer score parameter validation\nfunction validatePeerScoreParams(p) {\n for (const [topic, params] of Object.entries(p.topics)) {\n try {\n validateTopicScoreParams(params);\n }\n catch (e) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`invalid score parameters for topic ${topic}: ${e.message}`, _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n }\n // check that the topic score is 0 or something positive\n if (p.topicScoreCap < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid topic score cap; must be positive (or 0 for no cap)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check that we have an app specific score; the weight can be anything (but expected positive)\n if (p.appSpecificScore === null || p.appSpecificScore === undefined) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('missing application specific score function', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check the IP colocation factor\n if (p.IPColocationFactorWeight > 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid IPColocationFactorWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.IPColocationFactorWeight !== 0 && p.IPColocationFactorThreshold < 1) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid IPColocationFactorThreshold; must be at least 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check the behaviour penalty\n if (p.behaviourPenaltyWeight > 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.behaviourPenaltyWeight !== 0 && (p.behaviourPenaltyDecay <= 0 || p.behaviourPenaltyDecay >= 1)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid BehaviourPenaltyDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check the decay parameters\n if (p.decayInterval < 1000) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid DecayInterval; must be at least 1s', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.decayToZero <= 0 || p.decayToZero >= 1) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid DecayToZero; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // no need to check the score retention; a value of 0 means that we don't retain scores\n}\nfunction validateTopicScoreParams(p) {\n // make sure we have a sane topic weight\n if (p.topicWeight < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid topic weight; must be >= 0', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P1\n if (p.timeInMeshQuantum === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid TimeInMeshQuantum; must be non zero', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.timeInMeshWeight < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid TimeInMeshWeight; must be positive (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.timeInMeshWeight !== 0 && p.timeInMeshQuantum <= 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid TimeInMeshQuantum; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.timeInMeshWeight !== 0 && p.timeInMeshCap <= 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid TimeInMeshCap; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P2\n if (p.firstMessageDeliveriesWeight < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.firstMessageDeliveriesWeight !== 0 &&\n (p.firstMessageDeliveriesDecay <= 0 || p.firstMessageDeliveriesDecay >= 1)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid FirstMessageDeliveriesDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.firstMessageDeliveriesWeight !== 0 && p.firstMessageDeliveriesCap <= 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid FirstMessageDeliveriesCap; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P3\n if (p.meshMessageDeliveriesWeight > 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && (p.meshMessageDeliveriesDecay <= 0 || p.meshMessageDeliveriesDecay >= 1)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshMessageDeliveriesDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && p.meshMessageDeliveriesCap <= 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshMessageDeliveriesCap; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && p.meshMessageDeliveriesThreshold <= 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshMessageDeliveriesThreshold; must be positive', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWindow < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshMessageDeliveriesWindow; must be non-negative', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshMessageDeliveriesWeight !== 0 && p.meshMessageDeliveriesActivation < 1000) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshMessageDeliveriesActivation; must be at least 1s', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P3b\n if (p.meshFailurePenaltyWeight > 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.meshFailurePenaltyWeight !== 0 && (p.meshFailurePenaltyDecay <= 0 || p.meshFailurePenaltyDecay >= 1)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid MeshFailurePenaltyDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n // check P4\n if (p.invalidMessageDeliveriesWeight > 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n if (p.invalidMessageDeliveriesDecay <= 0 || p.invalidMessageDeliveriesDecay >= 1) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid InvalidMessageDeliveriesDecay; must be between 0 and 1', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_PARAMS);\n }\n}\n//# sourceMappingURL=peer-score-params.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerScoreThresholds: () => (/* binding */ createPeerScoreThresholds),\n/* harmony export */ defaultPeerScoreThresholds: () => (/* binding */ defaultPeerScoreThresholds),\n/* harmony export */ validatePeerScoreThresholds: () => (/* binding */ validatePeerScoreThresholds)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/constants.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n\n\nconst defaultPeerScoreThresholds = {\n gossipThreshold: -10,\n publishThreshold: -50,\n graylistThreshold: -80,\n acceptPXThreshold: 10,\n opportunisticGraftThreshold: 20\n};\nfunction createPeerScoreThresholds(p = {}) {\n return {\n ...defaultPeerScoreThresholds,\n ...p\n };\n}\nfunction validatePeerScoreThresholds(p) {\n if (p.gossipThreshold > 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid gossip threshold; it must be <= 0', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.publishThreshold > 0 || p.publishThreshold > p.gossipThreshold) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid publish threshold; it must be <= 0 and <= gossip threshold', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.graylistThreshold > 0 || p.graylistThreshold > p.publishThreshold) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid graylist threshold; it must be <= 0 and <= publish threshold', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.acceptPXThreshold < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid accept PX threshold; it must be >= 0', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n if (p.opportunisticGraftThreshold < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid opportunistic grafting threshold; it must be >= 0', _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_PEER_SCORE_THRESHOLDS);\n }\n}\n//# sourceMappingURL=peer-score-thresholds.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-thresholds.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerScore: () => (/* binding */ PeerScore)\n/* harmony export */ });\n/* harmony import */ var _peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./peer-score-params.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score-params.js\");\n/* harmony import */ var _compute_score_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./compute-score.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/compute-score.js\");\n/* harmony import */ var _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./message-deliveries.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/message-deliveries.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _utils_set_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/set.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_3__.logger)('libp2p:gossipsub:score');\nclass PeerScore {\n constructor(params, metrics, opts) {\n this.params = params;\n this.metrics = metrics;\n /**\n * Per-peer stats for score calculation\n */\n this.peerStats = new Map();\n /**\n * IP colocation tracking; maps IP => set of peers.\n */\n this.peerIPs = new _utils_set_js__WEBPACK_IMPORTED_MODULE_5__.MapDef(() => new Set());\n /**\n * Cache score up to decayInterval if topic stats are unchanged.\n */\n this.scoreCache = new Map();\n /**\n * Recent message delivery timing/participants\n */\n this.deliveryRecords = new _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.MessageDeliveries();\n (0,_peer_score_params_js__WEBPACK_IMPORTED_MODULE_0__.validatePeerScoreParams)(params);\n this.scoreCacheValidityMs = opts.scoreCacheValidityMs;\n this.computeScore = opts.computeScore ?? _compute_score_js__WEBPACK_IMPORTED_MODULE_1__.computeScore;\n }\n get size() {\n return this.peerStats.size;\n }\n /**\n * Start PeerScore instance\n */\n start() {\n if (this._backgroundInterval) {\n log('Peer score already running');\n return;\n }\n this._backgroundInterval = setInterval(() => this.background(), this.params.decayInterval);\n log('started');\n }\n /**\n * Stop PeerScore instance\n */\n stop() {\n if (!this._backgroundInterval) {\n log('Peer score already stopped');\n return;\n }\n clearInterval(this._backgroundInterval);\n delete this._backgroundInterval;\n this.peerIPs.clear();\n this.peerStats.clear();\n this.deliveryRecords.clear();\n log('stopped');\n }\n /**\n * Periodic maintenance\n */\n background() {\n this.refreshScores();\n this.deliveryRecords.gc();\n }\n dumpPeerScoreStats() {\n return Object.fromEntries(Array.from(this.peerStats.entries()).map(([peer, stats]) => [peer, stats]));\n }\n messageFirstSeenTimestampMs(msgIdStr) {\n const drec = this.deliveryRecords.getRecord(msgIdStr);\n return drec ? drec.firstSeenTsMs : null;\n }\n /**\n * Decays scores, and purges score records for disconnected peers once their expiry has elapsed.\n */\n refreshScores() {\n const now = Date.now();\n const decayToZero = this.params.decayToZero;\n this.peerStats.forEach((pstats, id) => {\n if (!pstats.connected) {\n // has the retention period expired?\n if (now > pstats.expire) {\n // yes, throw it away (but clean up the IP tracking first)\n this.removeIPsForPeer(id, pstats.knownIPs);\n this.peerStats.delete(id);\n this.scoreCache.delete(id);\n }\n // we don't decay retained scores, as the peer is not active.\n // this way the peer cannot reset a negative score by simply disconnecting and reconnecting,\n // unless the retention period has elapsed.\n // similarly, a well behaved peer does not lose its score by getting disconnected.\n return;\n }\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n const tparams = this.params.topics[topic];\n if (tparams === undefined) {\n // we are not scoring this topic\n // should be unreachable, we only add scored topics to pstats\n return;\n }\n // decay counters\n tstats.firstMessageDeliveries *= tparams.firstMessageDeliveriesDecay;\n if (tstats.firstMessageDeliveries < decayToZero) {\n tstats.firstMessageDeliveries = 0;\n }\n tstats.meshMessageDeliveries *= tparams.meshMessageDeliveriesDecay;\n if (tstats.meshMessageDeliveries < decayToZero) {\n tstats.meshMessageDeliveries = 0;\n }\n tstats.meshFailurePenalty *= tparams.meshFailurePenaltyDecay;\n if (tstats.meshFailurePenalty < decayToZero) {\n tstats.meshFailurePenalty = 0;\n }\n tstats.invalidMessageDeliveries *= tparams.invalidMessageDeliveriesDecay;\n if (tstats.invalidMessageDeliveries < decayToZero) {\n tstats.invalidMessageDeliveries = 0;\n }\n // update mesh time and activate mesh message delivery parameter if need be\n if (tstats.inMesh) {\n tstats.meshTime = now - tstats.graftTime;\n if (tstats.meshTime > tparams.meshMessageDeliveriesActivation) {\n tstats.meshMessageDeliveriesActive = true;\n }\n }\n });\n // decay P7 counter\n pstats.behaviourPenalty *= this.params.behaviourPenaltyDecay;\n if (pstats.behaviourPenalty < decayToZero) {\n pstats.behaviourPenalty = 0;\n }\n });\n }\n /**\n * Return the score for a peer\n */\n score(id) {\n this.metrics?.scoreFnCalls.inc();\n const pstats = this.peerStats.get(id);\n if (!pstats) {\n return 0;\n }\n const now = Date.now();\n const cacheEntry = this.scoreCache.get(id);\n // Found cached score within validity period\n if (cacheEntry && cacheEntry.cacheUntil > now) {\n return cacheEntry.score;\n }\n this.metrics?.scoreFnRuns.inc();\n const score = this.computeScore(id, pstats, this.params, this.peerIPs);\n const cacheUntil = now + this.scoreCacheValidityMs;\n if (cacheEntry) {\n this.metrics?.scoreCachedDelta.observe(Math.abs(score - cacheEntry.score));\n cacheEntry.score = score;\n cacheEntry.cacheUntil = cacheUntil;\n }\n else {\n this.scoreCache.set(id, { score, cacheUntil });\n }\n return score;\n }\n /**\n * Apply a behavioural penalty to a peer\n */\n addPenalty(id, penalty, penaltyLabel) {\n const pstats = this.peerStats.get(id);\n if (pstats) {\n pstats.behaviourPenalty += penalty;\n this.metrics?.onScorePenalty(penaltyLabel);\n }\n }\n addPeer(id) {\n // create peer stats (not including topic stats for each topic to be scored)\n // topic stats will be added as needed\n const pstats = {\n connected: true,\n expire: 0,\n topics: {},\n knownIPs: new Set(),\n behaviourPenalty: 0\n };\n this.peerStats.set(id, pstats);\n }\n /** Adds a new IP to a peer, if the peer is not known the update is ignored */\n addIP(id, ip) {\n const pstats = this.peerStats.get(id);\n if (pstats) {\n pstats.knownIPs.add(ip);\n }\n this.peerIPs.getOrDefault(ip).add(id);\n }\n /** Remove peer association with IP */\n removeIP(id, ip) {\n const pstats = this.peerStats.get(id);\n if (pstats) {\n pstats.knownIPs.delete(ip);\n }\n const peersWithIP = this.peerIPs.get(ip);\n if (peersWithIP) {\n peersWithIP.delete(id);\n if (peersWithIP.size === 0) {\n this.peerIPs.delete(ip);\n }\n }\n }\n removePeer(id) {\n const pstats = this.peerStats.get(id);\n if (!pstats) {\n return;\n }\n // decide whether to retain the score; this currently only retains non-positive scores\n // to dissuade attacks on the score function.\n if (this.score(id) > 0) {\n this.removeIPsForPeer(id, pstats.knownIPs);\n this.peerStats.delete(id);\n return;\n }\n // furthermore, when we decide to retain the score, the firstMessageDelivery counters are\n // reset to 0 and mesh delivery penalties applied.\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n tstats.firstMessageDeliveries = 0;\n const threshold = this.params.topics[topic].meshMessageDeliveriesThreshold;\n if (tstats.inMesh && tstats.meshMessageDeliveriesActive && tstats.meshMessageDeliveries < threshold) {\n const deficit = threshold - tstats.meshMessageDeliveries;\n tstats.meshFailurePenalty += deficit * deficit;\n }\n tstats.inMesh = false;\n tstats.meshMessageDeliveriesActive = false;\n });\n pstats.connected = false;\n pstats.expire = Date.now() + this.params.retainScore;\n }\n /** Handles scoring functionality as a peer GRAFTs to a topic. */\n graft(id, topic) {\n const pstats = this.peerStats.get(id);\n if (pstats) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats) {\n // if we are scoring the topic, update the mesh status.\n tstats.inMesh = true;\n tstats.graftTime = Date.now();\n tstats.meshTime = 0;\n tstats.meshMessageDeliveriesActive = false;\n }\n }\n }\n /** Handles scoring functionality as a peer PRUNEs from a topic. */\n prune(id, topic) {\n const pstats = this.peerStats.get(id);\n if (pstats) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats) {\n // sticky mesh delivery rate failure penalty\n const threshold = this.params.topics[topic].meshMessageDeliveriesThreshold;\n if (tstats.meshMessageDeliveriesActive && tstats.meshMessageDeliveries < threshold) {\n const deficit = threshold - tstats.meshMessageDeliveries;\n tstats.meshFailurePenalty += deficit * deficit;\n }\n tstats.meshMessageDeliveriesActive = false;\n tstats.inMesh = false;\n // TODO: Consider clearing score cache on important penalties\n // this.scoreCache.delete(id)\n }\n }\n }\n validateMessage(msgIdStr) {\n this.deliveryRecords.ensureRecord(msgIdStr);\n }\n deliverMessage(from, msgIdStr, topic) {\n this.markFirstMessageDelivery(from, topic);\n const drec = this.deliveryRecords.ensureRecord(msgIdStr);\n const now = Date.now();\n // defensive check that this is the first delivery trace -- delivery status should be unknown\n if (drec.status !== _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.unknown) {\n log('unexpected delivery: message from %s was first seen %s ago and has delivery status %s', from, now - drec.firstSeenTsMs, _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus[drec.status]);\n return;\n }\n // mark the message as valid and reward mesh peers that have already forwarded it to us\n drec.status = _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.valid;\n drec.validated = now;\n drec.peers.forEach((p) => {\n // this check is to make sure a peer can't send us a message twice and get a double count\n // if it is a first delivery.\n if (p !== from.toString()) {\n this.markDuplicateMessageDelivery(p, topic);\n }\n });\n }\n /**\n * Similar to `rejectMessage` except does not require the message id or reason for an invalid message.\n */\n rejectInvalidMessage(from, topic) {\n this.markInvalidMessageDelivery(from, topic);\n }\n rejectMessage(from, msgIdStr, topic, reason) {\n switch (reason) {\n // these messages are not tracked, but the peer is penalized as they are invalid\n case _types_js__WEBPACK_IMPORTED_MODULE_4__.RejectReason.Error:\n this.markInvalidMessageDelivery(from, topic);\n return;\n // we ignore those messages, so do nothing.\n case _types_js__WEBPACK_IMPORTED_MODULE_4__.RejectReason.Blacklisted:\n return;\n // the rest are handled after record creation\n }\n const drec = this.deliveryRecords.ensureRecord(msgIdStr);\n // defensive check that this is the first rejection -- delivery status should be unknown\n if (drec.status !== _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.unknown) {\n log('unexpected rejection: message from %s was first seen %s ago and has delivery status %d', from, Date.now() - drec.firstSeenTsMs, _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus[drec.status]);\n return;\n }\n if (reason === _types_js__WEBPACK_IMPORTED_MODULE_4__.RejectReason.Ignore) {\n // we were explicitly instructed by the validator to ignore the message but not penalize the peer\n drec.status = _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.ignored;\n drec.peers.clear();\n return;\n }\n // mark the message as invalid and penalize peers that have already forwarded it.\n drec.status = _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.invalid;\n this.markInvalidMessageDelivery(from, topic);\n drec.peers.forEach((p) => {\n this.markInvalidMessageDelivery(p, topic);\n });\n // release the delivery time tracking map to free some memory early\n drec.peers.clear();\n }\n duplicateMessage(from, msgIdStr, topic) {\n const drec = this.deliveryRecords.ensureRecord(msgIdStr);\n if (drec.peers.has(from)) {\n // we have already seen this duplicate\n return;\n }\n switch (drec.status) {\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.unknown:\n // the message is being validated; track the peer delivery and wait for\n // the Deliver/Reject/Ignore notification.\n drec.peers.add(from);\n break;\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.valid:\n // mark the peer delivery time to only count a duplicate delivery once.\n drec.peers.add(from);\n this.markDuplicateMessageDelivery(from, topic, drec.validated);\n break;\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.invalid:\n // we no longer track delivery time\n this.markInvalidMessageDelivery(from, topic);\n break;\n case _message_deliveries_js__WEBPACK_IMPORTED_MODULE_2__.DeliveryRecordStatus.ignored:\n // the message was ignored; do nothing (we don't know if it was valid)\n break;\n }\n }\n /**\n * Increments the \"invalid message deliveries\" counter for all scored topics the message is published in.\n */\n markInvalidMessageDelivery(from, topic) {\n const pstats = this.peerStats.get(from);\n if (pstats) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats) {\n tstats.invalidMessageDeliveries += 1;\n }\n }\n }\n /**\n * Increments the \"first message deliveries\" counter for all scored topics the message is published in,\n * as well as the \"mesh message deliveries\" counter, if the peer is in the mesh for the topic.\n * Messages already known (with the seenCache) are counted with markDuplicateMessageDelivery()\n */\n markFirstMessageDelivery(from, topic) {\n const pstats = this.peerStats.get(from);\n if (pstats) {\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats) {\n let cap = this.params.topics[topic].firstMessageDeliveriesCap;\n tstats.firstMessageDeliveries = Math.min(cap, tstats.firstMessageDeliveries + 1);\n if (tstats.inMesh) {\n cap = this.params.topics[topic].meshMessageDeliveriesCap;\n tstats.meshMessageDeliveries = Math.min(cap, tstats.meshMessageDeliveries + 1);\n }\n }\n }\n }\n /**\n * Increments the \"mesh message deliveries\" counter for messages we've seen before,\n * as long the message was received within the P3 window.\n */\n markDuplicateMessageDelivery(from, topic, validatedTime) {\n const pstats = this.peerStats.get(from);\n if (pstats) {\n const now = validatedTime !== undefined ? Date.now() : 0;\n const tstats = this.getPtopicStats(pstats, topic);\n if (tstats && tstats.inMesh) {\n const tparams = this.params.topics[topic];\n // check against the mesh delivery window -- if the validated time is passed as 0, then\n // the message was received before we finished validation and thus falls within the mesh\n // delivery window.\n if (validatedTime !== undefined) {\n const deliveryDelayMs = now - validatedTime;\n const isLateDelivery = deliveryDelayMs > tparams.meshMessageDeliveriesWindow;\n this.metrics?.onDuplicateMsgDelivery(topic, deliveryDelayMs, isLateDelivery);\n if (isLateDelivery) {\n return;\n }\n }\n const cap = tparams.meshMessageDeliveriesCap;\n tstats.meshMessageDeliveries = Math.min(cap, tstats.meshMessageDeliveries + 1);\n }\n }\n }\n /**\n * Removes an IP list from the tracking list for a peer.\n */\n removeIPsForPeer(id, ipsToRemove) {\n for (const ipToRemove of ipsToRemove) {\n const peerSet = this.peerIPs.get(ipToRemove);\n if (peerSet) {\n peerSet.delete(id);\n if (peerSet.size === 0) {\n this.peerIPs.delete(ipToRemove);\n }\n }\n }\n }\n /**\n * Returns topic stats if they exist, otherwise if the supplied parameters score the\n * topic, inserts the default stats and returns a reference to those. If neither apply, returns None.\n */\n getPtopicStats(pstats, topic) {\n let topicStats = pstats.topics[topic];\n if (topicStats !== undefined) {\n return topicStats;\n }\n if (this.params.topics[topic] !== undefined) {\n topicStats = {\n inMesh: false,\n graftTime: 0,\n meshTime: 0,\n firstMessageDeliveries: 0,\n meshMessageDeliveries: 0,\n meshMessageDeliveriesActive: false,\n meshFailurePenalty: 0,\n invalidMessageDeliveries: 0\n };\n pstats.topics[topic] = topicStats;\n return topicStats;\n }\n return null;\n }\n}\n//# sourceMappingURL=peer-score.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ computeAllPeersScoreWeights: () => (/* binding */ computeAllPeersScoreWeights),\n/* harmony export */ computeScoreWeights: () => (/* binding */ computeScoreWeights)\n/* harmony export */ });\nfunction computeScoreWeights(peer, pstats, params, peerIPs, topicStrToLabel) {\n let score = 0;\n const byTopic = new Map();\n // topic stores\n Object.entries(pstats.topics).forEach(([topic, tstats]) => {\n // the topic parameters\n // Aggregate by known topicLabel or throw to 'unknown'. This prevent too high cardinality\n const topicLabel = topicStrToLabel.get(topic) ?? 'unknown';\n const topicParams = params.topics[topic];\n if (topicParams === undefined) {\n // we are not scoring this topic\n return;\n }\n let topicScores = byTopic.get(topicLabel);\n if (!topicScores) {\n topicScores = {\n p1w: 0,\n p2w: 0,\n p3w: 0,\n p3bw: 0,\n p4w: 0\n };\n byTopic.set(topicLabel, topicScores);\n }\n let p1w = 0;\n let p2w = 0;\n let p3w = 0;\n let p3bw = 0;\n let p4w = 0;\n // P1: time in Mesh\n if (tstats.inMesh) {\n const p1 = Math.max(tstats.meshTime / topicParams.timeInMeshQuantum, topicParams.timeInMeshCap);\n p1w += p1 * topicParams.timeInMeshWeight;\n }\n // P2: first message deliveries\n let p2 = tstats.firstMessageDeliveries;\n if (p2 > topicParams.firstMessageDeliveriesCap) {\n p2 = topicParams.firstMessageDeliveriesCap;\n }\n p2w += p2 * topicParams.firstMessageDeliveriesWeight;\n // P3: mesh message deliveries\n if (tstats.meshMessageDeliveriesActive &&\n tstats.meshMessageDeliveries < topicParams.meshMessageDeliveriesThreshold) {\n const deficit = topicParams.meshMessageDeliveriesThreshold - tstats.meshMessageDeliveries;\n const p3 = deficit * deficit;\n p3w += p3 * topicParams.meshMessageDeliveriesWeight;\n }\n // P3b:\n // NOTE: the weight of P3b is negative (validated in validateTopicScoreParams) so this detracts\n const p3b = tstats.meshFailurePenalty;\n p3bw += p3b * topicParams.meshFailurePenaltyWeight;\n // P4: invalid messages\n // NOTE: the weight of P4 is negative (validated in validateTopicScoreParams) so this detracts\n const p4 = tstats.invalidMessageDeliveries * tstats.invalidMessageDeliveries;\n p4w += p4 * topicParams.invalidMessageDeliveriesWeight;\n // update score, mixing with topic weight\n score += (p1w + p2w + p3w + p3bw + p4w) * topicParams.topicWeight;\n topicScores.p1w += p1w;\n topicScores.p2w += p2w;\n topicScores.p3w += p3w;\n topicScores.p3bw += p3bw;\n topicScores.p4w += p4w;\n });\n // apply the topic score cap, if any\n if (params.topicScoreCap > 0 && score > params.topicScoreCap) {\n score = params.topicScoreCap;\n // Proportionally apply cap to all individual contributions\n const capF = params.topicScoreCap / score;\n for (const ws of byTopic.values()) {\n ws.p1w *= capF;\n ws.p2w *= capF;\n ws.p3w *= capF;\n ws.p3bw *= capF;\n ws.p4w *= capF;\n }\n }\n let p5w = 0;\n let p6w = 0;\n let p7w = 0;\n // P5: application-specific score\n const p5 = params.appSpecificScore(peer);\n p5w += p5 * params.appSpecificWeight;\n // P6: IP colocation factor\n pstats.knownIPs.forEach((ip) => {\n if (params.IPColocationFactorWhitelist.has(ip)) {\n return;\n }\n // P6 has a cliff (IPColocationFactorThreshold)\n // It's only applied if at least that many peers are connected to us from that source IP addr.\n // It is quadratic, and the weight is negative (validated in validatePeerScoreParams)\n const peersInIP = peerIPs.get(ip);\n const numPeersInIP = peersInIP ? peersInIP.size : 0;\n if (numPeersInIP > params.IPColocationFactorThreshold) {\n const surplus = numPeersInIP - params.IPColocationFactorThreshold;\n const p6 = surplus * surplus;\n p6w += p6 * params.IPColocationFactorWeight;\n }\n });\n // P7: behavioural pattern penalty\n const p7 = pstats.behaviourPenalty * pstats.behaviourPenalty;\n p7w += p7 * params.behaviourPenaltyWeight;\n score += p5w + p6w + p7w;\n return {\n byTopic,\n p5w,\n p6w,\n p7w,\n score\n };\n}\nfunction computeAllPeersScoreWeights(peerIdStrs, peerStats, params, peerIPs, topicStrToLabel) {\n const sw = {\n byTopic: new Map(),\n p5w: [],\n p6w: [],\n p7w: [],\n score: []\n };\n for (const peerIdStr of peerIdStrs) {\n const pstats = peerStats.get(peerIdStr);\n if (pstats) {\n const swPeer = computeScoreWeights(peerIdStr, pstats, params, peerIPs, topicStrToLabel);\n for (const [topic, swPeerTopic] of swPeer.byTopic) {\n let swTopic = sw.byTopic.get(topic);\n if (!swTopic) {\n swTopic = {\n p1w: [],\n p2w: [],\n p3w: [],\n p3bw: [],\n p4w: []\n };\n sw.byTopic.set(topic, swTopic);\n }\n swTopic.p1w.push(swPeerTopic.p1w);\n swTopic.p2w.push(swPeerTopic.p2w);\n swTopic.p3w.push(swPeerTopic.p3w);\n swTopic.p3bw.push(swPeerTopic.p3bw);\n swTopic.p4w.push(swPeerTopic.p4w);\n }\n sw.p5w.push(swPeer.p5w);\n sw.p6w.push(swPeer.p6w);\n sw.p7w.push(swPeer.p7w);\n sw.score.push(swPeer.score);\n }\n else {\n sw.p5w.push(0);\n sw.p6w.push(0);\n sw.p7w.push(0);\n sw.score.push(0);\n }\n }\n return sw;\n}\n//# sourceMappingURL=scoreMetrics.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/score/scoreMetrics.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InboundStream: () => (/* binding */ InboundStream),\n/* harmony export */ OutboundStream: () => (/* binding */ OutboundStream)\n/* harmony export */ });\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n\n\n\n\nclass OutboundStream {\n constructor(rawStream, errCallback, opts) {\n this.rawStream = rawStream;\n this.pushable = (0,it_pushable__WEBPACK_IMPORTED_MODULE_2__.pushable)({ objectMode: false });\n this.closeController = new AbortController();\n this.maxBufferSize = opts.maxBufferSize ?? Infinity;\n (0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)((0,abortable_iterator__WEBPACK_IMPORTED_MODULE_0__.abortableSource)(this.pushable, this.closeController.signal, { returnOnAbort: true }), (source) => (0,it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode)(source), this.rawStream).catch(errCallback);\n }\n get protocol() {\n // TODO remove this non-nullish assertion after https://github.com/libp2p/js-libp2p-interfaces/pull/265 is incorporated\n return this.rawStream.stat.protocol;\n }\n push(data) {\n if (this.pushable.readableLength > this.maxBufferSize) {\n throw Error(`OutboundStream buffer full, size > ${this.maxBufferSize}`);\n }\n this.pushable.push(data);\n }\n close() {\n this.closeController.abort();\n // similar to pushable.end() but clear the internal buffer\n this.pushable.return();\n this.rawStream.close();\n }\n}\nclass InboundStream {\n constructor(rawStream, opts = {}) {\n this.rawStream = rawStream;\n this.closeController = new AbortController();\n this.source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_0__.abortableSource)((0,it_pipe__WEBPACK_IMPORTED_MODULE_1__.pipe)(this.rawStream, (source) => (0,it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode)(source, opts)), this.closeController.signal, {\n returnOnAbort: true\n });\n }\n close() {\n this.closeController.abort();\n this.rawStream.close();\n }\n}\n//# sourceMappingURL=stream.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/stream.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IWantTracer: () => (/* binding */ IWantTracer)\n/* harmony export */ });\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\n/**\n * IWantTracer is an internal tracer that tracks IWANT requests in order to penalize\n * peers who don't follow up on IWANT requests after an IHAVE advertisement.\n * The tracking of promises is probabilistic to avoid using too much memory.\n *\n * Note: Do not confuse these 'promises' with JS Promise objects.\n * These 'promises' are merely expectations of a peer's behavior.\n */\nclass IWantTracer {\n constructor(gossipsubIWantFollowupMs, msgIdToStrFn, metrics) {\n this.gossipsubIWantFollowupMs = gossipsubIWantFollowupMs;\n this.msgIdToStrFn = msgIdToStrFn;\n this.metrics = metrics;\n /**\n * Promises to deliver a message\n * Map per message id, per peer, promise expiration time\n */\n this.promises = new Map();\n /**\n * First request time by msgId. Used for metrics to track expire times.\n * Necessary to know if peers are actually breaking promises or simply sending them a bit later\n */\n this.requestMsByMsg = new Map();\n this.requestMsByMsgExpire = 10 * gossipsubIWantFollowupMs;\n }\n get size() {\n return this.promises.size;\n }\n get requestMsByMsgSize() {\n return this.requestMsByMsg.size;\n }\n /**\n * Track a promise to deliver a message from a list of msgIds we are requesting\n */\n addPromise(from, msgIds) {\n // pick msgId randomly from the list\n const ix = Math.floor(Math.random() * msgIds.length);\n const msgId = msgIds[ix];\n const msgIdStr = this.msgIdToStrFn(msgId);\n let expireByPeer = this.promises.get(msgIdStr);\n if (!expireByPeer) {\n expireByPeer = new Map();\n this.promises.set(msgIdStr, expireByPeer);\n }\n const now = Date.now();\n // If a promise for this message id and peer already exists we don't update the expiry\n if (!expireByPeer.has(from)) {\n expireByPeer.set(from, now + this.gossipsubIWantFollowupMs);\n if (this.metrics) {\n this.metrics.iwantPromiseStarted.inc(1);\n if (!this.requestMsByMsg.has(msgIdStr)) {\n this.requestMsByMsg.set(msgIdStr, now);\n }\n }\n }\n }\n /**\n * Returns the number of broken promises for each peer who didn't follow up on an IWANT request.\n *\n * This should be called not too often relative to the expire times, since it iterates over the whole data.\n */\n getBrokenPromises() {\n const now = Date.now();\n const result = new Map();\n let brokenPromises = 0;\n this.promises.forEach((expireByPeer, msgId) => {\n expireByPeer.forEach((expire, p) => {\n // the promise has been broken\n if (expire < now) {\n // add 1 to result\n result.set(p, (result.get(p) ?? 0) + 1);\n // delete from tracked promises\n expireByPeer.delete(p);\n // for metrics\n brokenPromises++;\n }\n });\n // clean up empty promises for a msgId\n if (!expireByPeer.size) {\n this.promises.delete(msgId);\n }\n });\n this.metrics?.iwantPromiseBroken.inc(brokenPromises);\n return result;\n }\n /**\n * Someone delivered a message, stop tracking promises for it\n */\n deliverMessage(msgIdStr, isDuplicate = false) {\n this.trackMessage(msgIdStr);\n const expireByPeer = this.promises.get(msgIdStr);\n // Expired promise, check requestMsByMsg\n if (expireByPeer) {\n this.promises.delete(msgIdStr);\n if (this.metrics) {\n this.metrics.iwantPromiseResolved.inc(1);\n if (isDuplicate)\n this.metrics.iwantPromiseResolvedFromDuplicate.inc(1);\n this.metrics.iwantPromiseResolvedPeers.inc(expireByPeer.size);\n }\n }\n }\n /**\n * A message got rejected, so we can stop tracking promises and let the score penalty apply from invalid message delivery,\n * unless its an obviously invalid message.\n */\n rejectMessage(msgIdStr, reason) {\n this.trackMessage(msgIdStr);\n // A message got rejected, so we can stop tracking promises and let the score penalty apply.\n // With the expection of obvious invalid messages\n switch (reason) {\n case _types_js__WEBPACK_IMPORTED_MODULE_0__.RejectReason.Error:\n return;\n }\n this.promises.delete(msgIdStr);\n }\n clear() {\n this.promises.clear();\n }\n prune() {\n const maxMs = Date.now() - this.requestMsByMsgExpire;\n let count = 0;\n for (const [k, v] of this.requestMsByMsg.entries()) {\n if (v < maxMs) {\n // messages that stay too long in the requestMsByMsg map, delete\n this.requestMsByMsg.delete(k);\n count++;\n }\n else {\n // recent messages, keep them\n // sort by insertion order\n break;\n }\n }\n this.metrics?.iwantMessagePruned.inc(count);\n }\n trackMessage(msgIdStr) {\n if (this.metrics) {\n const requestMs = this.requestMsByMsg.get(msgIdStr);\n if (requestMs !== undefined) {\n this.metrics.iwantPromiseDeliveryTime.observe((Date.now() - requestMs) / 1000);\n this.requestMsByMsg.delete(msgIdStr);\n }\n }\n }\n}\n//# sourceMappingURL=tracer.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/tracer.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js": +/*!********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MessageStatus: () => (/* binding */ MessageStatus),\n/* harmony export */ PublishConfigType: () => (/* binding */ PublishConfigType),\n/* harmony export */ RejectReason: () => (/* binding */ RejectReason),\n/* harmony export */ SignaturePolicy: () => (/* binding */ SignaturePolicy),\n/* harmony export */ ValidateError: () => (/* binding */ ValidateError),\n/* harmony export */ rejectReasonFromAcceptance: () => (/* binding */ rejectReasonFromAcceptance)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-pubsub */ \"./node_modules/@libp2p/interface-pubsub/dist/src/index.js\");\n\nvar SignaturePolicy;\n(function (SignaturePolicy) {\n /**\n * On the producing side:\n * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.\n *\n * On the consuming side:\n * - Enforce the fields to be present, reject otherwise.\n * - Propagate only if the fields are valid and signature can be verified, reject otherwise.\n */\n SignaturePolicy[\"StrictSign\"] = \"StrictSign\";\n /**\n * On the producing side:\n * - Build messages without the signature, key, from and seqno fields.\n * - The corresponding protobuf key-value pairs are absent from the marshalled message, not just empty.\n *\n * On the consuming side:\n * - Enforce the fields to be absent, reject otherwise.\n * - Propagate only if the fields are absent, reject otherwise.\n * - A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.\n */\n SignaturePolicy[\"StrictNoSign\"] = \"StrictNoSign\";\n})(SignaturePolicy || (SignaturePolicy = {}));\nvar PublishConfigType;\n(function (PublishConfigType) {\n PublishConfigType[PublishConfigType[\"Signing\"] = 0] = \"Signing\";\n PublishConfigType[PublishConfigType[\"Anonymous\"] = 1] = \"Anonymous\";\n})(PublishConfigType || (PublishConfigType = {}));\nvar RejectReason;\n(function (RejectReason) {\n /**\n * The message failed the configured validation during decoding.\n * SelfOrigin is considered a ValidationError\n */\n RejectReason[\"Error\"] = \"error\";\n /**\n * Custom validator fn reported status IGNORE.\n */\n RejectReason[\"Ignore\"] = \"ignore\";\n /**\n * Custom validator fn reported status REJECT.\n */\n RejectReason[\"Reject\"] = \"reject\";\n /**\n * The peer that sent the message OR the source from field is blacklisted.\n * Causes messages to be ignored, not penalized, neither do score record creation.\n */\n RejectReason[\"Blacklisted\"] = \"blacklisted\";\n})(RejectReason || (RejectReason = {}));\nvar ValidateError;\n(function (ValidateError) {\n /// The message has an invalid signature,\n ValidateError[\"InvalidSignature\"] = \"invalid_signature\";\n /// The sequence number was the incorrect size\n ValidateError[\"InvalidSeqno\"] = \"invalid_seqno\";\n /// The PeerId was invalid\n ValidateError[\"InvalidPeerId\"] = \"invalid_peerid\";\n /// Signature existed when validation has been sent to\n /// [`crate::behaviour::MessageAuthenticity::Anonymous`].\n ValidateError[\"SignaturePresent\"] = \"signature_present\";\n /// Sequence number existed when validation has been sent to\n /// [`crate::behaviour::MessageAuthenticity::Anonymous`].\n ValidateError[\"SeqnoPresent\"] = \"seqno_present\";\n /// Message source existed when validation has been sent to\n /// [`crate::behaviour::MessageAuthenticity::Anonymous`].\n ValidateError[\"FromPresent\"] = \"from_present\";\n /// The data transformation failed.\n ValidateError[\"TransformFailed\"] = \"transform_failed\";\n})(ValidateError || (ValidateError = {}));\nvar MessageStatus;\n(function (MessageStatus) {\n MessageStatus[\"duplicate\"] = \"duplicate\";\n MessageStatus[\"invalid\"] = \"invalid\";\n MessageStatus[\"valid\"] = \"valid\";\n})(MessageStatus || (MessageStatus = {}));\n/**\n * Typesafe conversion of MessageAcceptance -> RejectReason. TS ensures all values covered\n */\nfunction rejectReasonFromAcceptance(acceptance) {\n switch (acceptance) {\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Ignore:\n return RejectReason.Ignore;\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Reject:\n return RejectReason.Reject;\n }\n}\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SignPrefix: () => (/* binding */ SignPrefix),\n/* harmony export */ buildRawMessage: () => (/* binding */ buildRawMessage),\n/* harmony export */ validateToRawMessage: () => (/* binding */ validateToRawMessage)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../message/rpc.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/rpc.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/interface-pubsub */ \"./node_modules/@libp2p/interface-pubsub/dist/src/index.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n\n\n\n\n\n\n\n\nconst SignPrefix = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)('libp2p-pubsub:');\nasync function buildRawMessage(publishConfig, topic, originalData, transformedData) {\n switch (publishConfig.type) {\n case _types_js__WEBPACK_IMPORTED_MODULE_7__.PublishConfigType.Signing: {\n const rpcMsg = {\n from: publishConfig.author.toBytes(),\n data: transformedData,\n seqno: (0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_3__.randomBytes)(8),\n topic,\n signature: undefined,\n key: undefined // Exclude key field for signing\n };\n // Get the message in bytes, and prepend with the pubsub prefix\n // the signature is over the bytes \"libp2p-pubsub:\"\n const bytes = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([SignPrefix, _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__.RPC.Message.encode(rpcMsg).finish()]);\n rpcMsg.signature = await publishConfig.privateKey.sign(bytes);\n rpcMsg.key = publishConfig.key;\n const msg = {\n type: 'signed',\n from: publishConfig.author,\n data: originalData,\n sequenceNumber: BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(rpcMsg.seqno, 'base16')}`),\n topic,\n signature: rpcMsg.signature,\n key: rpcMsg.key\n };\n return {\n raw: rpcMsg,\n msg: msg\n };\n }\n case _types_js__WEBPACK_IMPORTED_MODULE_7__.PublishConfigType.Anonymous: {\n return {\n raw: {\n from: undefined,\n data: transformedData,\n seqno: undefined,\n topic,\n signature: undefined,\n key: undefined\n },\n msg: {\n type: 'unsigned',\n data: originalData,\n topic\n }\n };\n }\n }\n}\nasync function validateToRawMessage(signaturePolicy, msg) {\n // If strict-sign, verify all\n // If anonymous (no-sign), ensure no preven\n switch (signaturePolicy) {\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_8__.StrictNoSign:\n if (msg.signature != null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.SignaturePresent };\n if (msg.seqno != null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.SeqnoPresent };\n if (msg.key != null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.FromPresent };\n return { valid: true, message: { type: 'unsigned', topic: msg.topic, data: msg.data ?? new Uint8Array(0) } };\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_8__.StrictSign: {\n // Verify seqno\n if (msg.seqno == null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidSeqno };\n if (msg.seqno.length !== 8) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidSeqno };\n }\n if (msg.signature == null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidSignature };\n if (msg.from == null)\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidPeerId };\n let fromPeerId;\n try {\n // TODO: Fix PeerId types\n fromPeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromBytes)(msg.from);\n }\n catch (e) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidPeerId };\n }\n // - check from defined\n // - transform source to PeerId\n // - parse signature\n // - get .key, else from source\n // - check key == source if present\n // - verify sig\n let publicKey;\n if (msg.key) {\n publicKey = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_2__.unmarshalPublicKey)(msg.key);\n // TODO: Should `fromPeerId.pubKey` be optional?\n if (fromPeerId.publicKey !== undefined && !(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__.equals)(publicKey.bytes, fromPeerId.publicKey)) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidPeerId };\n }\n }\n else {\n if (fromPeerId.publicKey == null) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidPeerId };\n }\n publicKey = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_2__.unmarshalPublicKey)(fromPeerId.publicKey);\n }\n const rpcMsgPreSign = {\n from: msg.from,\n data: msg.data,\n seqno: msg.seqno,\n topic: msg.topic,\n signature: undefined,\n key: undefined // Exclude key field for signing\n };\n // Get the message in bytes, and prepend with the pubsub prefix\n // the signature is over the bytes \"libp2p-pubsub:\"\n const bytes = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([SignPrefix, _message_rpc_js__WEBPACK_IMPORTED_MODULE_6__.RPC.Message.encode(rpcMsgPreSign).finish()]);\n if (!(await publicKey.verify(bytes, msg.signature))) {\n return { valid: false, error: _types_js__WEBPACK_IMPORTED_MODULE_7__.ValidateError.InvalidSignature };\n }\n return {\n valid: true,\n message: {\n type: 'signed',\n from: fromPeerId,\n data: msg.data ?? new Uint8Array(0),\n sequenceNumber: BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(msg.seqno, 'base16')}`),\n topic: msg.topic,\n signature: msg.signature,\n key: msg.key ?? (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_2__.marshalPublicKey)(publicKey)\n }\n };\n }\n }\n}\n//# sourceMappingURL=buildRawMessage.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/buildRawMessage.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/index.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/index.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPublishConfigFromPeerId: () => (/* reexport safe */ _publishConfig_js__WEBPACK_IMPORTED_MODULE_2__.getPublishConfigFromPeerId),\n/* harmony export */ messageIdToString: () => (/* reexport safe */ _messageIdToString_js__WEBPACK_IMPORTED_MODULE_1__.messageIdToString),\n/* harmony export */ shuffle: () => (/* reexport safe */ _shuffle_js__WEBPACK_IMPORTED_MODULE_0__.shuffle)\n/* harmony export */ });\n/* harmony import */ var _shuffle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shuffle.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js\");\n/* harmony import */ var _messageIdToString_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./messageIdToString.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js\");\n/* harmony import */ var _publishConfig_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./publishConfig.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js\");\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/index.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ messageIdToString: () => (/* binding */ messageIdToString)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n/**\n * Browser friendly function to convert Uint8Array message id to base64 string.\n */\nfunction messageIdToString(msgId) {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_0__.toString)(msgId, 'base64');\n}\n//# sourceMappingURL=messageIdToString.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/messageIdToString.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ msgIdFnStrictNoSign: () => (/* binding */ msgIdFnStrictNoSign),\n/* harmony export */ msgIdFnStrictSign: () => (/* binding */ msgIdFnStrictSign)\n/* harmony export */ });\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var _libp2p_pubsub_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/pubsub/utils */ \"./node_modules/@libp2p/pubsub/dist/src/utils.js\");\n\n\n/**\n * Generate a message id, based on the `key` and `seqno`\n */\nfunction msgIdFnStrictSign(msg) {\n if (msg.type !== 'signed') {\n throw new Error('expected signed message type');\n }\n // Should never happen\n if (msg.sequenceNumber == null)\n throw Error('missing seqno field');\n // TODO: Should use .from here or key?\n return (0,_libp2p_pubsub_utils__WEBPACK_IMPORTED_MODULE_1__.msgId)(msg.from.toBytes(), msg.sequenceNumber);\n}\n/**\n * Generate a message id, based on message `data`\n */\nasync function msgIdFnStrictNoSign(msg) {\n return await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256.encode(msg.data);\n}\n//# sourceMappingURL=msgIdFn.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/msgIdFn.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiaddrToIPStr: () => (/* binding */ multiaddrToIPStr)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr/convert */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n\n// Protocols https://github.com/multiformats/multiaddr/blob/master/protocols.csv\n// code size name\n// 4 32 ip4\n// 41 128 ip6\nvar Protocol;\n(function (Protocol) {\n Protocol[Protocol[\"ip4\"] = 4] = \"ip4\";\n Protocol[Protocol[\"ip6\"] = 41] = \"ip6\";\n})(Protocol || (Protocol = {}));\nfunction multiaddrToIPStr(multiaddr) {\n for (const tuple of multiaddr.tuples()) {\n switch (tuple[0]) {\n case Protocol.ip4:\n case Protocol.ip6:\n return (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToString)(tuple[0], tuple[1]);\n }\n }\n return null;\n}\n//# sourceMappingURL=multiaddr.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/multiaddr.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPublishConfigFromPeerId: () => (/* binding */ getPublishConfigFromPeerId)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface-pubsub */ \"./node_modules/@libp2p/interface-pubsub/dist/src/index.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../types.js */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n\n\n\n/**\n * Prepare a PublishConfig object from a PeerId.\n */\nasync function getPublishConfigFromPeerId(signaturePolicy, peerId) {\n switch (signaturePolicy) {\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_1__.StrictSign: {\n if (!peerId) {\n throw Error('Must provide PeerId');\n }\n if (peerId.privateKey == null) {\n throw Error('Cannot sign message, no private key present');\n }\n if (peerId.publicKey == null) {\n throw Error('Cannot sign message, no public key present');\n }\n // Transform privateKey once at initialization time instead of once per message\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(peerId.privateKey);\n return {\n type: _types_js__WEBPACK_IMPORTED_MODULE_2__.PublishConfigType.Signing,\n author: peerId,\n key: peerId.publicKey,\n privateKey\n };\n }\n case _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_1__.StrictNoSign:\n return {\n type: _types_js__WEBPACK_IMPORTED_MODULE_2__.PublishConfigType.Anonymous\n };\n default:\n throw new Error(`Unknown signature policy \"${signaturePolicy}\"`);\n }\n}\n//# sourceMappingURL=publishConfig.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/publishConfig.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js": +/*!************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MapDef: () => (/* binding */ MapDef),\n/* harmony export */ removeFirstNItemsFromSet: () => (/* binding */ removeFirstNItemsFromSet),\n/* harmony export */ removeItemsFromSet: () => (/* binding */ removeItemsFromSet)\n/* harmony export */ });\n/**\n * Exclude up to `ineed` items from a set if item meets condition `cond`\n */\nfunction removeItemsFromSet(superSet, ineed, cond = () => true) {\n const subset = new Set();\n if (ineed <= 0)\n return subset;\n for (const id of superSet) {\n if (subset.size >= ineed)\n break;\n if (cond(id)) {\n subset.add(id);\n superSet.delete(id);\n }\n }\n return subset;\n}\n/**\n * Exclude up to `ineed` items from a set\n */\nfunction removeFirstNItemsFromSet(superSet, ineed) {\n return removeItemsFromSet(superSet, ineed, () => true);\n}\nclass MapDef extends Map {\n constructor(getDefault) {\n super();\n this.getDefault = getDefault;\n }\n getOrDefault(key) {\n let value = super.get(key);\n if (value === undefined) {\n value = this.getDefault();\n this.set(key, value);\n }\n return value;\n }\n}\n//# sourceMappingURL=set.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/set.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ shuffle: () => (/* binding */ shuffle)\n/* harmony export */ });\n/**\n * Pseudo-randomly shuffles an array\n *\n * Mutates the input array\n */\nfunction shuffle(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const randInt = () => {\n return Math.floor(Math.random() * Math.floor(arr.length));\n };\n for (let i = 0; i < arr.length; i++) {\n const j = randInt();\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr;\n}\n//# sourceMappingURL=shuffle.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/shuffle.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SimpleTimeCache: () => (/* binding */ SimpleTimeCache)\n/* harmony export */ });\n/**\n * This is similar to https://github.com/daviddias/time-cache/blob/master/src/index.js\n * for our own need, we don't use lodash throttle to improve performance.\n * This gives 4x - 5x performance gain compared to npm TimeCache\n */\nclass SimpleTimeCache {\n constructor(opts) {\n this.entries = new Map();\n this.validityMs = opts.validityMs;\n // allow negative validityMs so that this does not cache anything, spec test compliance.spec.js\n // sends duplicate messages and expect peer to receive all. Application likely uses positive validityMs\n }\n get size() {\n return this.entries.size;\n }\n /** Returns true if there was a key collision and the entry is dropped */\n put(key, value) {\n if (this.entries.has(key)) {\n // Key collisions break insertion order in the entries cache, which break prune logic.\n // prune relies on each iterated entry to have strictly ascending validUntilMs, else it\n // won't prune expired entries and SimpleTimeCache will grow unexpectedly.\n // As of Oct 2022 NodeJS v16, inserting the same key twice with different value does not\n // change the key position in the iterator stream. A unit test asserts this behaviour.\n return true;\n }\n this.entries.set(key, { value, validUntilMs: Date.now() + this.validityMs });\n return false;\n }\n prune() {\n const now = Date.now();\n for (const [k, v] of this.entries.entries()) {\n if (v.validUntilMs < now) {\n this.entries.delete(k);\n }\n else {\n // Entries are inserted with strictly ascending validUntilMs.\n // Stop early to save iterations\n break;\n }\n }\n }\n has(key) {\n return this.entries.has(key);\n }\n get(key) {\n const value = this.entries.get(key);\n return value && value.validUntilMs >= Date.now() ? value.value : undefined;\n }\n clear() {\n this.entries.clear();\n }\n}\n//# sourceMappingURL=time-cache.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-gossipsub/dist/src/utils/time-cache.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js": +/*!********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DUMP_SESSION_KEYS: () => (/* binding */ DUMP_SESSION_KEYS),\n/* harmony export */ NOISE_MSG_MAX_LENGTH_BYTES: () => (/* binding */ NOISE_MSG_MAX_LENGTH_BYTES),\n/* harmony export */ NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG: () => (/* binding */ NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG)\n/* harmony export */ });\nconst NOISE_MSG_MAX_LENGTH_BYTES = 65535;\nconst NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG = NOISE_MSG_MAX_LENGTH_BYTES - 16;\nconst DUMP_SESSION_KEYS = Boolean(globalThis.process?.env?.DUMP_SESSION_KEYS);\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js": +/*!********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pureJsCrypto: () => (/* binding */ pureJsCrypto)\n/* harmony export */ });\n/* harmony import */ var _noble_ciphers_chacha__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/ciphers/chacha */ \"./node_modules/@noble/ciphers/esm/chacha.js\");\n/* harmony import */ var _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/curves/ed25519 */ \"./node_modules/@noble/curves/esm/ed25519.js\");\n/* harmony import */ var _noble_hashes_hkdf__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/hkdf */ \"./node_modules/@noble/hashes/esm/hkdf.js\");\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n\n\n\n\nconst pureJsCrypto = {\n hashSHA256(data) {\n return (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_3__.sha256)(data);\n },\n getHKDF(ck, ikm) {\n const prk = (0,_noble_hashes_hkdf__WEBPACK_IMPORTED_MODULE_2__.extract)(_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_3__.sha256, ikm, ck);\n const okmU8Array = (0,_noble_hashes_hkdf__WEBPACK_IMPORTED_MODULE_2__.expand)(_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_3__.sha256, prk, undefined, 96);\n const okm = okmU8Array;\n const k1 = okm.subarray(0, 32);\n const k2 = okm.subarray(32, 64);\n const k3 = okm.subarray(64, 96);\n return [k1, k2, k3];\n },\n generateX25519KeyPair() {\n const secretKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.x25519.utils.randomPrivateKey();\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.x25519.getPublicKey(secretKey);\n return {\n publicKey,\n privateKey: secretKey\n };\n },\n generateX25519KeyPairFromSeed(seed) {\n const publicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.x25519.getPublicKey(seed);\n return {\n publicKey,\n privateKey: seed\n };\n },\n generateX25519SharedKey(privateKey, publicKey) {\n return _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.x25519.getSharedSecret(privateKey, publicKey);\n },\n chaCha20Poly1305Encrypt(plaintext, nonce, ad, k) {\n return (0,_noble_ciphers_chacha__WEBPACK_IMPORTED_MODULE_0__.chacha20_poly1305)(k, nonce, ad).encrypt(plaintext);\n },\n chaCha20Poly1305Decrypt(ciphertext, nonce, ad, k, dst) {\n const result = (0,_noble_ciphers_chacha__WEBPACK_IMPORTED_MODULE_0__.chacha20_poly1305)(k, nonce, ad).decrypt(ciphertext);\n if (dst) {\n dst.set(result);\n return result;\n }\n return result;\n }\n};\n//# sourceMappingURL=js.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decryptStream: () => (/* binding */ decryptStream),\n/* harmony export */ encryptStream: () => (/* binding */ encryptStream)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js\");\n/* harmony import */ var _encoder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoder.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js\");\n\n\nconst CHACHA_TAG_LENGTH = 16;\n// Returns generator that encrypts payload from the user\nfunction encryptStream(handshake, metrics) {\n return async function* (source) {\n for await (const chunk of source) {\n for (let i = 0; i < chunk.length; i += _constants_js__WEBPACK_IMPORTED_MODULE_0__.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG) {\n let end = i + _constants_js__WEBPACK_IMPORTED_MODULE_0__.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;\n if (end > chunk.length) {\n end = chunk.length;\n }\n const data = handshake.encrypt(chunk.subarray(i, end), handshake.session);\n metrics?.encryptedPackets.increment();\n yield (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.uint16BEEncode)(data.byteLength);\n yield data;\n }\n }\n };\n}\n// Decrypt received payload to the user\nfunction decryptStream(handshake, metrics) {\n return async function* (source) {\n for await (const chunk of source) {\n for (let i = 0; i < chunk.length; i += _constants_js__WEBPACK_IMPORTED_MODULE_0__.NOISE_MSG_MAX_LENGTH_BYTES) {\n let end = i + _constants_js__WEBPACK_IMPORTED_MODULE_0__.NOISE_MSG_MAX_LENGTH_BYTES;\n if (end > chunk.length) {\n end = chunk.length;\n }\n if (end - CHACHA_TAG_LENGTH < i) {\n throw new Error('Invalid chunk');\n }\n const encrypted = chunk.subarray(i, end);\n // memory allocation is not cheap so reuse the encrypted Uint8Array\n // see https://github.com/ChainSafe/js-libp2p-noise/pull/242#issue-1422126164\n // this is ok because chacha20 reads bytes one by one and don't reread after that\n // it's also tested in https://github.com/ChainSafe/as-chacha20poly1305/pull/1/files#diff-25252846b58979dcaf4e41d47b3eadd7e4f335e7fb98da6c049b1f9cd011f381R48\n const dst = chunk.subarray(i, end - CHACHA_TAG_LENGTH);\n const { plaintext: decrypted, valid } = handshake.decrypt(encrypted, handshake.session, dst);\n if (!valid) {\n metrics?.decryptErrors.increment();\n throw new Error('Failed to validate decrypted chunk');\n }\n metrics?.decryptedPackets.increment();\n yield decrypted;\n }\n }\n };\n}\n//# sourceMappingURL=streaming.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js": +/*!******************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode0: () => (/* binding */ decode0),\n/* harmony export */ decode1: () => (/* binding */ decode1),\n/* harmony export */ decode2: () => (/* binding */ decode2),\n/* harmony export */ encode0: () => (/* binding */ encode0),\n/* harmony export */ encode1: () => (/* binding */ encode1),\n/* harmony export */ encode2: () => (/* binding */ encode2),\n/* harmony export */ uint16BEDecode: () => (/* binding */ uint16BEDecode),\n/* harmony export */ uint16BEEncode: () => (/* binding */ uint16BEEncode)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n\nconst allocUnsafe = (len) => {\n if (globalThis.Buffer) {\n return globalThis.Buffer.allocUnsafe(len);\n }\n return new Uint8Array(len);\n};\nconst uint16BEEncode = (value) => {\n const target = allocUnsafe(2);\n new DataView(target.buffer, target.byteOffset, target.byteLength).setUint16(0, value, false);\n return target;\n};\nuint16BEEncode.bytes = 2;\nconst uint16BEDecode = (data) => {\n if (data.length < 2)\n throw RangeError('Could not decode int16BE');\n if (data instanceof Uint8Array) {\n return new DataView(data.buffer, data.byteOffset, data.byteLength).getUint16(0, false);\n }\n return data.getUint16(0);\n};\nuint16BEDecode.bytes = 2;\n// Note: IK and XX encoder usage is opposite (XX uses in stages encode0 where IK uses encode1)\nfunction encode0(message) {\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([message.ne, message.ciphertext], message.ne.length + message.ciphertext.length);\n}\nfunction encode1(message) {\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([message.ne, message.ns, message.ciphertext], message.ne.length + message.ns.length + message.ciphertext.length);\n}\nfunction encode2(message) {\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([message.ns, message.ciphertext], message.ns.length + message.ciphertext.length);\n}\nfunction decode0(input) {\n if (input.length < 32) {\n throw new Error('Cannot decode stage 0 MessageBuffer: length less than 32 bytes.');\n }\n return {\n ne: input.subarray(0, 32),\n ciphertext: input.subarray(32, input.length),\n ns: new Uint8Array(0)\n };\n}\nfunction decode1(input) {\n if (input.length < 80) {\n throw new Error('Cannot decode stage 1 MessageBuffer: length less than 80 bytes.');\n }\n return {\n ne: input.subarray(0, 32),\n ns: input.subarray(32, 80),\n ciphertext: input.subarray(80, input.length)\n };\n}\nfunction decode2(input) {\n if (input.length < 48) {\n throw new Error('Cannot decode stage 2 MessageBuffer: length less than 48 bytes.');\n }\n return {\n ne: new Uint8Array(0),\n ns: input.subarray(0, 48),\n ciphertext: input.subarray(48, input.length)\n };\n}\n//# sourceMappingURL=encoder.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ XXHandshake: () => (/* binding */ XXHandshake)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-connection-encrypter/errors */ \"./node_modules/@libp2p/interface-connection-encrypter/dist/src/errors.js\");\n/* harmony import */ var _encoder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encoder.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js\");\n/* harmony import */ var _handshakes_xx_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./handshakes/xx.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js\");\n/* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js\");\n\n\n\n\n\nclass XXHandshake {\n isInitiator;\n session;\n remotePeer;\n remoteExtensions = { webtransportCerthashes: [] };\n payload;\n connection;\n xx;\n staticKeypair;\n prologue;\n constructor(isInitiator, payload, prologue, crypto, staticKeypair, connection, remotePeer, handshake) {\n this.isInitiator = isInitiator;\n this.payload = payload;\n this.prologue = prologue;\n this.staticKeypair = staticKeypair;\n this.connection = connection;\n if (remotePeer) {\n this.remotePeer = remotePeer;\n }\n this.xx = handshake ?? new _handshakes_xx_js__WEBPACK_IMPORTED_MODULE_2__.XX(crypto);\n this.session = this.xx.initSession(this.isInitiator, this.prologue, this.staticKeypair);\n }\n // stage 0\n async propose() {\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logLocalStaticKeys)(this.session.hs.s);\n if (this.isInitiator) {\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 0 - Initiator starting to send first message.');\n const messageBuffer = this.xx.sendMessage(this.session, new Uint8Array(0));\n this.connection.writeLP((0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.encode0)(messageBuffer));\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 0 - Initiator finished sending first message.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logLocalEphemeralKeys)(this.session.hs.e);\n }\n else {\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 0 - Responder waiting to receive first message...');\n const receivedMessageBuffer = (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.decode0)((await this.connection.readLP()).subarray());\n const { valid } = this.xx.recvMessage(this.session, receivedMessageBuffer);\n if (!valid) {\n throw new _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__.InvalidCryptoExchangeError('xx handshake stage 0 validation fail');\n }\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 0 - Responder received first message.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logRemoteEphemeralKey)(this.session.hs.re);\n }\n }\n // stage 1\n async exchange() {\n if (this.isInitiator) {\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 1 - Initiator waiting to receive first message from responder...');\n const receivedMessageBuffer = (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.decode1)((await this.connection.readLP()).subarray());\n const { plaintext, valid } = this.xx.recvMessage(this.session, receivedMessageBuffer);\n if (!valid) {\n throw new _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__.InvalidCryptoExchangeError('xx handshake stage 1 validation fail');\n }\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 1 - Initiator received the message.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logRemoteEphemeralKey)(this.session.hs.re);\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logRemoteStaticKey)(this.session.hs.rs);\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace(\"Initiator going to check remote's signature...\");\n try {\n const decodedPayload = (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.decodePayload)(plaintext);\n this.remotePeer = this.remotePeer || await (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.getPeerIdFromPayload)(decodedPayload);\n await (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.verifySignedPayload)(this.session.hs.rs, decodedPayload, this.remotePeer);\n this.setRemoteNoiseExtension(decodedPayload.extensions);\n }\n catch (e) {\n const err = e;\n throw new _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__.UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`);\n }\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('All good with the signature!');\n }\n else {\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 1 - Responder sending out first message with signed payload and static key.');\n const messageBuffer = this.xx.sendMessage(this.session, this.payload);\n this.connection.writeLP((0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.encode1)(messageBuffer));\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 1 - Responder sent the second handshake message with signed payload.');\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logLocalEphemeralKeys)(this.session.hs.e);\n }\n }\n // stage 2\n async finish() {\n if (this.isInitiator) {\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 2 - Initiator sending third handshake message.');\n const messageBuffer = this.xx.sendMessage(this.session, this.payload);\n this.connection.writeLP((0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.encode2)(messageBuffer));\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 2 - Initiator sent message with signed payload.');\n }\n else {\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 2 - Responder waiting for third handshake message...');\n const receivedMessageBuffer = (0,_encoder_js__WEBPACK_IMPORTED_MODULE_1__.decode2)((await this.connection.readLP()).subarray());\n const { plaintext, valid } = this.xx.recvMessage(this.session, receivedMessageBuffer);\n if (!valid) {\n throw new _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__.InvalidCryptoExchangeError('xx handshake stage 2 validation fail');\n }\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.trace('Stage 2 - Responder received the message, finished handshake.');\n try {\n const decodedPayload = (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.decodePayload)(plaintext);\n this.remotePeer = this.remotePeer || await (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.getPeerIdFromPayload)(decodedPayload);\n await (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.verifySignedPayload)(this.session.hs.rs, decodedPayload, this.remotePeer);\n this.setRemoteNoiseExtension(decodedPayload.extensions);\n }\n catch (e) {\n const err = e;\n throw new _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__.UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`);\n }\n }\n (0,_logger_js__WEBPACK_IMPORTED_MODULE_3__.logCipherState)(this.session);\n }\n encrypt(plaintext, session) {\n const cs = this.getCS(session);\n return this.xx.encryptWithAd(cs, new Uint8Array(0), plaintext);\n }\n decrypt(ciphertext, session, dst) {\n const cs = this.getCS(session, false);\n return this.xx.decryptWithAd(cs, new Uint8Array(0), ciphertext, dst);\n }\n getRemoteStaticKey() {\n return this.session.hs.rs;\n }\n getCS(session, encryption = true) {\n if (!session.cs1 || !session.cs2) {\n throw new _libp2p_interface_connection_encrypter_errors__WEBPACK_IMPORTED_MODULE_0__.InvalidCryptoExchangeError('Handshake not completed properly, cipher state does not exist.');\n }\n if (this.isInitiator) {\n return encryption ? session.cs1 : session.cs2;\n }\n else {\n return encryption ? session.cs2 : session.cs1;\n }\n }\n setRemoteNoiseExtension(e) {\n if (e) {\n this.remoteExtensions = e;\n }\n }\n}\n//# sourceMappingURL=handshake-xx.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbstractHandshake: () => (/* binding */ AbstractHandshake)\n/* harmony export */ });\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/uint8arrays/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../logger.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js\");\n/* harmony import */ var _nonce_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../nonce.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js\");\n\n\n\n\n\nclass AbstractHandshake {\n crypto;\n constructor(crypto) {\n this.crypto = crypto;\n }\n encryptWithAd(cs, ad, plaintext) {\n const e = this.encrypt(cs.k, cs.n, ad, plaintext);\n cs.n.increment();\n return e;\n }\n decryptWithAd(cs, ad, ciphertext, dst) {\n const { plaintext, valid } = this.decrypt(cs.k, cs.n, ad, ciphertext, dst);\n if (valid)\n cs.n.increment();\n return { plaintext, valid };\n }\n // Cipher state related\n hasKey(cs) {\n return !this.isEmptyKey(cs.k);\n }\n createEmptyKey() {\n return new Uint8Array(32);\n }\n isEmptyKey(k) {\n const emptyKey = this.createEmptyKey();\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(emptyKey, k);\n }\n encrypt(k, n, ad, plaintext) {\n n.assertValue();\n return this.crypto.chaCha20Poly1305Encrypt(plaintext, n.getBytes(), ad, k);\n }\n encryptAndHash(ss, plaintext) {\n let ciphertext;\n if (this.hasKey(ss.cs)) {\n ciphertext = this.encryptWithAd(ss.cs, ss.h, plaintext);\n }\n else {\n ciphertext = plaintext;\n }\n this.mixHash(ss, ciphertext);\n return ciphertext;\n }\n decrypt(k, n, ad, ciphertext, dst) {\n n.assertValue();\n const encryptedMessage = this.crypto.chaCha20Poly1305Decrypt(ciphertext, n.getBytes(), ad, k, dst);\n if (encryptedMessage) {\n return {\n plaintext: encryptedMessage,\n valid: true\n };\n }\n else {\n return {\n plaintext: new Uint8Array(0),\n valid: false\n };\n }\n }\n decryptAndHash(ss, ciphertext) {\n let plaintext;\n let valid = true;\n if (this.hasKey(ss.cs)) {\n ({ plaintext, valid } = this.decryptWithAd(ss.cs, ss.h, ciphertext));\n }\n else {\n plaintext = ciphertext;\n }\n this.mixHash(ss, ciphertext);\n return { plaintext, valid };\n }\n dh(privateKey, publicKey) {\n try {\n const derivedU8 = this.crypto.generateX25519SharedKey(privateKey, publicKey);\n if (derivedU8.length === 32) {\n return derivedU8;\n }\n return derivedU8.subarray(0, 32);\n }\n catch (e) {\n const err = e;\n _logger_js__WEBPACK_IMPORTED_MODULE_3__.logger.error(err);\n return new Uint8Array(32);\n }\n }\n mixHash(ss, data) {\n ss.h = this.getHash(ss.h, data);\n }\n getHash(a, b) {\n const u = this.crypto.hashSHA256((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([a, b], a.length + b.length));\n return u;\n }\n mixKey(ss, ikm) {\n const [ck, tempK] = this.crypto.getHKDF(ss.ck, ikm);\n ss.cs = this.initializeKey(tempK);\n ss.ck = ck;\n }\n initializeKey(k) {\n return { k, n: new _nonce_js__WEBPACK_IMPORTED_MODULE_4__.Nonce() };\n }\n // Symmetric state related\n initializeSymmetric(protocolName) {\n const protocolNameBytes = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_0__.fromString)(protocolName, 'utf-8');\n const h = this.hashProtocolName(protocolNameBytes);\n const ck = h;\n const key = this.createEmptyKey();\n const cs = this.initializeKey(key);\n return { cs, ck, h };\n }\n hashProtocolName(protocolName) {\n if (protocolName.length <= 32) {\n const h = new Uint8Array(32);\n h.set(protocolName);\n return h;\n }\n else {\n return this.getHash(protocolName, new Uint8Array(0));\n }\n }\n split(ss) {\n const [tempk1, tempk2] = this.crypto.getHKDF(ss.ck, new Uint8Array(0));\n const cs1 = this.initializeKey(tempk1);\n const cs2 = this.initializeKey(tempk2);\n return { cs1, cs2 };\n }\n writeMessageRegular(cs, payload) {\n const ciphertext = this.encryptWithAd(cs, new Uint8Array(0), payload);\n const ne = this.createEmptyKey();\n const ns = new Uint8Array(0);\n return { ne, ns, ciphertext };\n }\n readMessageRegular(cs, message) {\n return this.decryptWithAd(cs, new Uint8Array(0), message.ciphertext);\n }\n}\n//# sourceMappingURL=abstract-handshake.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js": +/*!************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ XX: () => (/* binding */ XX)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js\");\n/* harmony import */ var _abstract_handshake_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abstract-handshake.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/abstract-handshake.js\");\n\n\nclass XX extends _abstract_handshake_js__WEBPACK_IMPORTED_MODULE_1__.AbstractHandshake {\n initializeInitiator(prologue, s, rs, psk) {\n const name = 'Noise_XX_25519_ChaChaPoly_SHA256';\n const ss = this.initializeSymmetric(name);\n this.mixHash(ss, prologue);\n const re = new Uint8Array(32);\n return { ss, s, rs, psk, re };\n }\n initializeResponder(prologue, s, rs, psk) {\n const name = 'Noise_XX_25519_ChaChaPoly_SHA256';\n const ss = this.initializeSymmetric(name);\n this.mixHash(ss, prologue);\n const re = new Uint8Array(32);\n return { ss, s, rs, psk, re };\n }\n writeMessageA(hs, payload, e) {\n const ns = new Uint8Array(0);\n if (e !== undefined) {\n hs.e = e;\n }\n else {\n hs.e = this.crypto.generateX25519KeyPair();\n }\n const ne = hs.e.publicKey;\n this.mixHash(hs.ss, ne);\n const ciphertext = this.encryptAndHash(hs.ss, payload);\n return { ne, ns, ciphertext };\n }\n writeMessageB(hs, payload) {\n hs.e = this.crypto.generateX25519KeyPair();\n const ne = hs.e.publicKey;\n this.mixHash(hs.ss, ne);\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.re));\n const spk = hs.s.publicKey;\n const ns = this.encryptAndHash(hs.ss, spk);\n this.mixKey(hs.ss, this.dh(hs.s.privateKey, hs.re));\n const ciphertext = this.encryptAndHash(hs.ss, payload);\n return { ne, ns, ciphertext };\n }\n writeMessageC(hs, payload) {\n const spk = hs.s.publicKey;\n const ns = this.encryptAndHash(hs.ss, spk);\n this.mixKey(hs.ss, this.dh(hs.s.privateKey, hs.re));\n const ciphertext = this.encryptAndHash(hs.ss, payload);\n const ne = this.createEmptyKey();\n const messageBuffer = { ne, ns, ciphertext };\n const { cs1, cs2 } = this.split(hs.ss);\n return { h: hs.ss.h, messageBuffer, cs1, cs2 };\n }\n readMessageA(hs, message) {\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidPublicKey)(message.ne)) {\n hs.re = message.ne;\n }\n this.mixHash(hs.ss, hs.re);\n return this.decryptAndHash(hs.ss, message.ciphertext);\n }\n readMessageB(hs, message) {\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidPublicKey)(message.ne)) {\n hs.re = message.ne;\n }\n this.mixHash(hs.ss, hs.re);\n if (!hs.e) {\n throw new Error('Handshake state `e` param is missing.');\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.re));\n const { plaintext: ns, valid: valid1 } = this.decryptAndHash(hs.ss, message.ns);\n if (valid1 && (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidPublicKey)(ns)) {\n hs.rs = ns;\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.rs));\n const { plaintext, valid: valid2 } = this.decryptAndHash(hs.ss, message.ciphertext);\n return { plaintext, valid: (valid1 && valid2) };\n }\n readMessageC(hs, message) {\n const { plaintext: ns, valid: valid1 } = this.decryptAndHash(hs.ss, message.ns);\n if (valid1 && (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidPublicKey)(ns)) {\n hs.rs = ns;\n }\n if (!hs.e) {\n throw new Error('Handshake state `e` param is missing.');\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.rs));\n const { plaintext, valid: valid2 } = this.decryptAndHash(hs.ss, message.ciphertext);\n const { cs1, cs2 } = this.split(hs.ss);\n return { h: hs.ss.h, plaintext, valid: (valid1 && valid2), cs1, cs2 };\n }\n initSession(initiator, prologue, s) {\n const psk = this.createEmptyKey();\n const rs = new Uint8Array(32); // no static key yet\n let hs;\n if (initiator) {\n hs = this.initializeInitiator(prologue, s, rs, psk);\n }\n else {\n hs = this.initializeResponder(prologue, s, rs, psk);\n }\n return {\n hs,\n i: initiator,\n mc: 0\n };\n }\n sendMessage(session, message, ephemeral) {\n let messageBuffer;\n if (session.mc === 0) {\n messageBuffer = this.writeMessageA(session.hs, message, ephemeral);\n }\n else if (session.mc === 1) {\n messageBuffer = this.writeMessageB(session.hs, message);\n }\n else if (session.mc === 2) {\n const { h, messageBuffer: resultingBuffer, cs1, cs2 } = this.writeMessageC(session.hs, message);\n messageBuffer = resultingBuffer;\n session.h = h;\n session.cs1 = cs1;\n session.cs2 = cs2;\n }\n else if (session.mc > 2) {\n if (session.i) {\n if (!session.cs1) {\n throw new Error('CS1 (cipher state) is not defined');\n }\n messageBuffer = this.writeMessageRegular(session.cs1, message);\n }\n else {\n if (!session.cs2) {\n throw new Error('CS2 (cipher state) is not defined');\n }\n messageBuffer = this.writeMessageRegular(session.cs2, message);\n }\n }\n else {\n throw new Error('Session invalid.');\n }\n session.mc++;\n return messageBuffer;\n }\n recvMessage(session, message) {\n let plaintext = new Uint8Array(0);\n let valid = false;\n if (session.mc === 0) {\n ({ plaintext, valid } = this.readMessageA(session.hs, message));\n }\n else if (session.mc === 1) {\n ({ plaintext, valid } = this.readMessageB(session.hs, message));\n }\n else if (session.mc === 2) {\n const { h, plaintext: resultingPlaintext, valid: resultingValid, cs1, cs2 } = this.readMessageC(session.hs, message);\n plaintext = resultingPlaintext;\n valid = resultingValid;\n session.h = h;\n session.cs1 = cs1;\n session.cs2 = cs2;\n }\n session.mc++;\n return { plaintext, valid };\n }\n}\n//# sourceMappingURL=xx.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/index.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ noise: () => (/* binding */ noise),\n/* harmony export */ pureJsCrypto: () => (/* reexport safe */ _crypto_js_js__WEBPACK_IMPORTED_MODULE_1__.pureJsCrypto)\n/* harmony export */ });\n/* harmony import */ var _noise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./noise.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js\");\n/* harmony import */ var _crypto_js_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crypto/js.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js\");\n\n\nfunction noise(init = {}) {\n return () => new _noise_js__WEBPACK_IMPORTED_MODULE_0__.Noise(init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ logCipherState: () => (/* binding */ logCipherState),\n/* harmony export */ logLocalEphemeralKeys: () => (/* binding */ logLocalEphemeralKeys),\n/* harmony export */ logLocalStaticKeys: () => (/* binding */ logLocalStaticKeys),\n/* harmony export */ logRemoteEphemeralKey: () => (/* binding */ logRemoteEphemeralKey),\n/* harmony export */ logRemoteStaticKey: () => (/* binding */ logRemoteStaticKey),\n/* harmony export */ logger: () => (/* binding */ log)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js\");\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:noise');\n\nlet keyLogger;\nif (_constants_js__WEBPACK_IMPORTED_MODULE_2__.DUMP_SESSION_KEYS) {\n keyLogger = log;\n}\nelse {\n keyLogger = Object.assign(() => { }, {\n enabled: false,\n trace: () => { },\n error: () => { }\n });\n}\nfunction logLocalStaticKeys(s) {\n keyLogger(`LOCAL_STATIC_PUBLIC_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(s.publicKey, 'hex')}`);\n keyLogger(`LOCAL_STATIC_PRIVATE_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(s.privateKey, 'hex')}`);\n}\nfunction logLocalEphemeralKeys(e) {\n if (e) {\n keyLogger(`LOCAL_PUBLIC_EPHEMERAL_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(e.publicKey, 'hex')}`);\n keyLogger(`LOCAL_PRIVATE_EPHEMERAL_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(e.privateKey, 'hex')}`);\n }\n else {\n keyLogger('Missing local ephemeral keys.');\n }\n}\nfunction logRemoteStaticKey(rs) {\n keyLogger(`REMOTE_STATIC_PUBLIC_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(rs, 'hex')}`);\n}\nfunction logRemoteEphemeralKey(re) {\n keyLogger(`REMOTE_EPHEMERAL_PUBLIC_KEY ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(re, 'hex')}`);\n}\nfunction logCipherState(session) {\n if (session.cs1 && session.cs2) {\n keyLogger(`CIPHER_STATE_1 ${session.cs1.n.getUint64()} ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(session.cs1.k, 'hex')}`);\n keyLogger(`CIPHER_STATE_2 ${session.cs2.n.getUint64()} ${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(session.cs2.k, 'hex')}`);\n }\n else {\n keyLogger('Missing cipher state.');\n }\n}\n//# sourceMappingURL=logger.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/logger.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js": +/*!******************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ registerMetrics: () => (/* binding */ registerMetrics)\n/* harmony export */ });\nfunction registerMetrics(metrics) {\n return {\n xxHandshakeSuccesses: metrics.registerCounter('libp2p_noise_xxhandshake_successes_total', {\n help: 'Total count of noise xxHandshakes successes_'\n }),\n xxHandshakeErrors: metrics.registerCounter('libp2p_noise_xxhandshake_error_total', {\n help: 'Total count of noise xxHandshakes errors'\n }),\n encryptedPackets: metrics.registerCounter('libp2p_noise_encrypted_packets_total', {\n help: 'Total count of noise encrypted packets successfully'\n }),\n decryptedPackets: metrics.registerCounter('libp2p_noise_decrypted_packets_total', {\n help: 'Total count of noise decrypted packets'\n }),\n decryptErrors: metrics.registerCounter('libp2p_noise_decrypt_errors_total', {\n help: 'Total count of noise decrypt errors'\n })\n };\n}\n//# sourceMappingURL=metrics.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js": +/*!****************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Noise: () => (/* binding */ Noise)\n/* harmony export */ });\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pair_duplex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pair/duplex */ \"./node_modules/it-pair/dist/src/duplex.js\");\n/* harmony import */ var it_pb_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pb-stream */ \"./node_modules/it-pb-stream/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/constants.js\");\n/* harmony import */ var _crypto_js_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./crypto/js.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/js.js\");\n/* harmony import */ var _crypto_streaming_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crypto/streaming.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/crypto/streaming.js\");\n/* harmony import */ var _encoder_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./encoder.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/encoder.js\");\n/* harmony import */ var _handshake_xx_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./handshake-xx.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/handshake-xx.js\");\n/* harmony import */ var _metrics_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./metrics.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/metrics.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js\");\n\n\n\n\n\n\n\n\n\n\n\nclass Noise {\n protocol = '/noise';\n crypto;\n prologue;\n staticKeys;\n extensions;\n metrics;\n constructor(init = {}) {\n const { staticNoiseKey, extensions, crypto, prologueBytes, metrics } = init;\n this.crypto = crypto ?? _crypto_js_js__WEBPACK_IMPORTED_MODULE_5__.pureJsCrypto;\n this.extensions = extensions;\n this.metrics = metrics ? (0,_metrics_js__WEBPACK_IMPORTED_MODULE_9__.registerMetrics)(metrics) : undefined;\n if (staticNoiseKey) {\n // accepts x25519 private key of length 32\n this.staticKeys = this.crypto.generateX25519KeyPairFromSeed(staticNoiseKey);\n }\n else {\n this.staticKeys = this.crypto.generateX25519KeyPair();\n }\n this.prologue = prologueBytes ?? new Uint8Array(0);\n }\n /**\n * Encrypt outgoing data to the remote party (handshake as initiator)\n *\n * @param {PeerId} localPeer - PeerId of the receiving peer\n * @param {Duplex, AsyncIterable, Promise>} connection - streaming iterable duplex that will be encrypted\n * @param {PeerId} remotePeer - PeerId of the remote peer. Used to validate the integrity of the remote peer.\n * @returns {Promise}\n */\n async secureOutbound(localPeer, connection, remotePeer) {\n const wrappedConnection = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)(connection, {\n lengthEncoder: _encoder_js__WEBPACK_IMPORTED_MODULE_7__.uint16BEEncode,\n lengthDecoder: _encoder_js__WEBPACK_IMPORTED_MODULE_7__.uint16BEDecode,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_4__.NOISE_MSG_MAX_LENGTH_BYTES\n });\n const handshake = await this.performHandshake({\n connection: wrappedConnection,\n isInitiator: true,\n localPeer,\n remotePeer\n });\n const conn = await this.createSecureConnection(wrappedConnection, handshake);\n return {\n conn,\n remoteExtensions: handshake.remoteExtensions,\n remotePeer: handshake.remotePeer\n };\n }\n /**\n * Decrypt incoming data (handshake as responder).\n *\n * @param {PeerId} localPeer - PeerId of the receiving peer.\n * @param {Duplex, AsyncIterable, Promise>} connection - streaming iterable duplex that will be encryption.\n * @param {PeerId} remotePeer - optional PeerId of the initiating peer, if known. This may only exist during transport upgrades.\n * @returns {Promise}\n */\n async secureInbound(localPeer, connection, remotePeer) {\n const wrappedConnection = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)(connection, {\n lengthEncoder: _encoder_js__WEBPACK_IMPORTED_MODULE_7__.uint16BEEncode,\n lengthDecoder: _encoder_js__WEBPACK_IMPORTED_MODULE_7__.uint16BEDecode,\n maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_4__.NOISE_MSG_MAX_LENGTH_BYTES\n });\n const handshake = await this.performHandshake({\n connection: wrappedConnection,\n isInitiator: false,\n localPeer,\n remotePeer\n });\n const conn = await this.createSecureConnection(wrappedConnection, handshake);\n return {\n conn,\n remotePeer: handshake.remotePeer,\n remoteExtensions: handshake.remoteExtensions\n };\n }\n /**\n * If Noise pipes supported, tries IK handshake first with XX as fallback if it fails.\n * If noise pipes disabled or remote peer static key is unknown, use XX.\n *\n * @param {HandshakeParams} params\n */\n async performHandshake(params) {\n const payload = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_10__.getPayload)(params.localPeer, this.staticKeys.publicKey, this.extensions);\n // run XX handshake\n return this.performXXHandshake(params, payload);\n }\n async performXXHandshake(params, payload) {\n const { isInitiator, remotePeer, connection } = params;\n const handshake = new _handshake_xx_js__WEBPACK_IMPORTED_MODULE_8__.XXHandshake(isInitiator, payload, this.prologue, this.crypto, this.staticKeys, connection, remotePeer);\n try {\n await handshake.propose();\n await handshake.exchange();\n await handshake.finish();\n this.metrics?.xxHandshakeSuccesses.increment();\n }\n catch (e) {\n this.metrics?.xxHandshakeErrors.increment();\n if (e instanceof Error) {\n e.message = `Error occurred during XX handshake: ${e.message}`;\n throw e;\n }\n }\n return handshake;\n }\n async createSecureConnection(connection, handshake) {\n // Create encryption box/unbox wrapper\n const [secure, user] = (0,it_pair_duplex__WEBPACK_IMPORTED_MODULE_1__.duplexPair)();\n const network = connection.unwrap();\n await (0,it_pipe__WEBPACK_IMPORTED_MODULE_3__.pipe)(secure, // write to wrapper\n (0,_crypto_streaming_js__WEBPACK_IMPORTED_MODULE_6__.encryptStream)(handshake, this.metrics), // encrypt data + prefix with message length\n network, // send to the remote peer\n (source) => (0,it_length_prefixed__WEBPACK_IMPORTED_MODULE_0__.decode)(source, { lengthDecoder: _encoder_js__WEBPACK_IMPORTED_MODULE_7__.uint16BEDecode }), // read message length prefix\n (0,_crypto_streaming_js__WEBPACK_IMPORTED_MODULE_6__.decryptStream)(handshake, this.metrics), // decrypt the incoming data\n secure // pipe to the wrapper\n );\n return user;\n }\n}\n//# sourceMappingURL=noise.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/noise.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js": +/*!****************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_NONCE: () => (/* binding */ MAX_NONCE),\n/* harmony export */ MIN_NONCE: () => (/* binding */ MIN_NONCE),\n/* harmony export */ Nonce: () => (/* binding */ Nonce)\n/* harmony export */ });\nconst MIN_NONCE = 0;\n// For performance reasons, the nonce is represented as a JS `number`\n// Although JS `number` can safely represent integers up to 2 ** 53 - 1, we choose to only use\n// 4 bytes to store the data for performance reason.\n// This is a slight deviation from the noise spec, which describes the max nonce as 2 ** 64 - 2\n// The effect is that this implementation will need a new handshake to be performed after fewer messages are exchanged than other implementations with full uint64 nonces.\n// this MAX_NONCE is still a large number of messages, so the practical effect of this is negligible.\nconst MAX_NONCE = 0xffffffff;\nconst ERR_MAX_NONCE = 'Cipherstate has reached maximum n, a new handshake must be performed';\n/**\n * The nonce is an uint that's increased over time.\n * Maintaining different representations help improve performance.\n */\nclass Nonce {\n n;\n bytes;\n view;\n constructor(n = MIN_NONCE) {\n this.n = n;\n this.bytes = new Uint8Array(12);\n this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength);\n this.view.setUint32(4, n, true);\n }\n increment() {\n this.n++;\n // Even though we're treating the nonce as 8 bytes, RFC7539 specifies 12 bytes for a nonce.\n this.view.setUint32(4, this.n, true);\n }\n getBytes() {\n return this.bytes;\n }\n getUint64() {\n return this.n;\n }\n assertValue() {\n if (this.n > MAX_NONCE) {\n throw new Error(ERR_MAX_NONCE);\n }\n }\n}\n//# sourceMappingURL=nonce.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/nonce.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js": +/*!************************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NoiseExtensions: () => (/* binding */ NoiseExtensions),\n/* harmony export */ NoiseHandshakePayload: () => (/* binding */ NoiseHandshakePayload)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar NoiseExtensions;\n(function (NoiseExtensions) {\n let _codec;\n NoiseExtensions.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.webtransportCerthashes != null) {\n for (const value of obj.webtransportCerthashes) {\n w.uint32(10);\n w.bytes(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n webtransportCerthashes: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.webtransportCerthashes.push(reader.bytes());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n NoiseExtensions.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, NoiseExtensions.codec());\n };\n NoiseExtensions.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, NoiseExtensions.codec());\n };\n})(NoiseExtensions || (NoiseExtensions = {}));\nvar NoiseHandshakePayload;\n(function (NoiseHandshakePayload) {\n let _codec;\n NoiseHandshakePayload.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (opts.writeDefaults === true || (obj.identityKey != null && obj.identityKey.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.identityKey ?? new Uint8Array(0));\n }\n if (opts.writeDefaults === true || (obj.identitySig != null && obj.identitySig.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.identitySig ?? new Uint8Array(0));\n }\n if (obj.extensions != null) {\n w.uint32(34);\n NoiseExtensions.codec().encode(obj.extensions, w, {\n writeDefaults: false\n });\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n identityKey: new Uint8Array(0),\n identitySig: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.identityKey = reader.bytes();\n break;\n case 2:\n obj.identitySig = reader.bytes();\n break;\n case 4:\n obj.extensions = NoiseExtensions.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n NoiseHandshakePayload.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, NoiseHandshakePayload.codec());\n };\n NoiseHandshakePayload.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, NoiseHandshakePayload.codec());\n };\n})(NoiseHandshakePayload || (NoiseHandshakePayload = {}));\n//# sourceMappingURL=payload.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js": +/*!****************************************************************!*\ + !*** ./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createHandshakePayload: () => (/* binding */ createHandshakePayload),\n/* harmony export */ decodePayload: () => (/* binding */ decodePayload),\n/* harmony export */ getHandshakePayload: () => (/* binding */ getHandshakePayload),\n/* harmony export */ getPayload: () => (/* binding */ getPayload),\n/* harmony export */ getPeerIdFromPayload: () => (/* binding */ getPeerIdFromPayload),\n/* harmony export */ isValidPublicKey: () => (/* binding */ isValidPublicKey),\n/* harmony export */ signPayload: () => (/* binding */ signPayload),\n/* harmony export */ verifySignedPayload: () => (/* binding */ verifySignedPayload)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _proto_payload_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proto/payload.js */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/proto/payload.js\");\n\n\n\n\n\nasync function getPayload(localPeer, staticPublicKey, extensions) {\n const signedPayload = await signPayload(localPeer, getHandshakePayload(staticPublicKey));\n if (localPeer.publicKey == null) {\n throw new Error('PublicKey was missing from local PeerId');\n }\n return createHandshakePayload(localPeer.publicKey, signedPayload, extensions);\n}\nfunction createHandshakePayload(libp2pPublicKey, signedPayload, extensions) {\n return _proto_payload_js__WEBPACK_IMPORTED_MODULE_4__.NoiseHandshakePayload.encode({\n identityKey: libp2pPublicKey,\n identitySig: signedPayload,\n extensions: extensions ?? { webtransportCerthashes: [] }\n }).subarray();\n}\nasync function signPayload(peerId, payload) {\n if (peerId.privateKey == null) {\n throw new Error('PrivateKey was missing from PeerId');\n }\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(peerId.privateKey);\n return privateKey.sign(payload);\n}\nasync function getPeerIdFromPayload(payload) {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromKeys)(payload.identityKey);\n}\nfunction decodePayload(payload) {\n return _proto_payload_js__WEBPACK_IMPORTED_MODULE_4__.NoiseHandshakePayload.decode(payload);\n}\nfunction getHandshakePayload(publicKey) {\n const prefix = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)('noise-libp2p-static-key:');\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_2__.concat)([prefix, publicKey], prefix.length + publicKey.length);\n}\n/**\n * Verifies signed payload, throws on any irregularities.\n *\n * @param {bytes} noiseStaticKey - owner's noise static key\n * @param {bytes} payload - decoded payload\n * @param {PeerId} remotePeer - owner's libp2p peer ID\n * @returns {Promise} - peer ID of payload owner\n */\nasync function verifySignedPayload(noiseStaticKey, payload, remotePeer) {\n // Unmarshaling from PublicKey protobuf\n const payloadPeerId = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromKeys)(payload.identityKey);\n if (!payloadPeerId.equals(remotePeer)) {\n throw new Error(`Payload identity key ${payloadPeerId.toString()} does not match expected remote peer ${remotePeer.toString()}`);\n }\n const generatedPayload = getHandshakePayload(noiseStaticKey);\n if (payloadPeerId.publicKey == null) {\n throw new Error('PublicKey was missing from PeerId');\n }\n if (payload.identitySig == null) {\n throw new Error('Signature was missing from message');\n }\n const publicKey = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPublicKey)(payloadPeerId.publicKey);\n const valid = await publicKey.verify(generatedPayload, payload.identitySig);\n if (!valid) {\n throw new Error(\"Static key doesn't match to peer that signed payload!\");\n }\n return payloadPeerId;\n}\nfunction isValidPublicKey(pk) {\n if (!(pk instanceof Uint8Array)) {\n return false;\n }\n if (pk.length !== 32) {\n return false;\n }\n return true;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/libp2p-noise/dist/src/utils.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/netmask/dist/src/cidr.js": +/*!**********************************************************!*\ + !*** ./node_modules/@chainsafe/netmask/dist/src/cidr.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cidrMask: () => (/* binding */ cidrMask),\n/* harmony export */ parseCidr: () => (/* binding */ parseCidr)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip/parse */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n\n\nfunction parseCidr(s) {\n const [address, maskString] = s.split(\"/\");\n if (!address || !maskString)\n throw new Error(\"Failed to parse given CIDR: \" + s);\n let ipLength = _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv4Len;\n let ip = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIPv4)(address);\n if (ip == null) {\n ipLength = _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv6Len;\n ip = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIPv6)(address);\n if (ip == null)\n throw new Error(\"Failed to parse given CIDR: \" + s);\n }\n const m = parseInt(maskString, 10);\n if (Number.isNaN(m) ||\n String(m).length !== maskString.length ||\n m < 0 ||\n m > ipLength * 8) {\n throw new Error(\"Failed to parse given CIDR: \" + s);\n }\n const mask = cidrMask(m, 8 * ipLength);\n return {\n network: (0,_ip_js__WEBPACK_IMPORTED_MODULE_1__.maskIp)(ip, mask),\n mask,\n };\n}\nfunction cidrMask(ones, bits) {\n if (bits !== 8 * _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv4Len && bits !== 8 * _ip_js__WEBPACK_IMPORTED_MODULE_1__.IPv6Len)\n throw new Error(\"Invalid CIDR mask\");\n if (ones < 0 || ones > bits)\n throw new Error(\"Invalid CIDR mask\");\n const l = bits / 8;\n const m = new Uint8Array(l);\n for (let i = 0; i < l; i++) {\n if (ones >= 8) {\n m[i] = 0xff;\n ones -= 8;\n continue;\n }\n m[i] = 255 - (0xff >> ones);\n ones = 0;\n }\n return m;\n}\n//# sourceMappingURL=cidr.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/netmask/dist/src/cidr.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/netmask/dist/src/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@chainsafe/netmask/dist/src/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IpNet: () => (/* reexport safe */ _ipnet_js__WEBPACK_IMPORTED_MODULE_0__.IpNet),\n/* harmony export */ cidrContains: () => (/* binding */ cidrContains),\n/* harmony export */ iPv4FromIPv6: () => (/* reexport safe */ _ip_js__WEBPACK_IMPORTED_MODULE_2__.iPv4FromIPv6),\n/* harmony export */ ipToString: () => (/* reexport safe */ _util_js__WEBPACK_IMPORTED_MODULE_1__.ipToString),\n/* harmony export */ isIPv4mappedIPv6: () => (/* reexport safe */ _ip_js__WEBPACK_IMPORTED_MODULE_2__.isIPv4mappedIPv6),\n/* harmony export */ maskIp: () => (/* reexport safe */ _ip_js__WEBPACK_IMPORTED_MODULE_2__.maskIp),\n/* harmony export */ parseCidr: () => (/* reexport safe */ _cidr_js__WEBPACK_IMPORTED_MODULE_3__.parseCidr)\n/* harmony export */ });\n/* harmony import */ var _ipnet_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ipnet.js */ \"./node_modules/@chainsafe/netmask/dist/src/ipnet.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@chainsafe/netmask/dist/src/util.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n/* harmony import */ var _cidr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./cidr.js */ \"./node_modules/@chainsafe/netmask/dist/src/cidr.js\");\n\n\n\n\n\n/**\n * Checks if cidr block contains ip address\n * @param cidr ipv4 or ipv6 formatted cidr . Example 198.51.100.14/24 or 2001:db8::/48\n * @param ip ipv4 or ipv6 address Example 198.51.100.14 or 2001:db8::\n *\n */\nfunction cidrContains(cidr, ip) {\n const ipnet = new _ipnet_js__WEBPACK_IMPORTED_MODULE_0__.IpNet(cidr);\n return ipnet.contains(ip);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/netmask/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/netmask/dist/src/ip.js": +/*!********************************************************!*\ + !*** ./node_modules/@chainsafe/netmask/dist/src/ip.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IPv4Len: () => (/* binding */ IPv4Len),\n/* harmony export */ IPv6Len: () => (/* binding */ IPv6Len),\n/* harmony export */ containsIp: () => (/* binding */ containsIp),\n/* harmony export */ iPv4FromIPv6: () => (/* binding */ iPv4FromIPv6),\n/* harmony export */ ipv4Prefix: () => (/* binding */ ipv4Prefix),\n/* harmony export */ isIPv4mappedIPv6: () => (/* binding */ isIPv4mappedIPv6),\n/* harmony export */ maskIp: () => (/* binding */ maskIp),\n/* harmony export */ maxIPv6Octet: () => (/* binding */ maxIPv6Octet)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip/parse */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@chainsafe/netmask/dist/src/util.js\");\n\n\nconst IPv4Len = 4;\nconst IPv6Len = 16;\nconst maxIPv6Octet = parseInt(\"0xFFFF\", 16);\nconst ipv4Prefix = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255,\n]);\nfunction maskIp(ip, mask) {\n if (mask.length === IPv6Len && ip.length === IPv4Len && (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.allFF)(mask, 0, 11)) {\n mask = mask.slice(12);\n }\n if (mask.length === IPv4Len &&\n ip.length === IPv6Len &&\n (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.deepEqual)(ip, ipv4Prefix, 0, 11)) {\n ip = ip.slice(12);\n }\n const n = ip.length;\n if (n != mask.length) {\n throw new Error(\"Failed to mask ip\");\n }\n const out = new Uint8Array(n);\n for (let i = 0; i < n; i++) {\n out[i] = ip[i] & mask[i];\n }\n return out;\n}\nfunction containsIp(net, ip) {\n if (typeof ip === \"string\") {\n ip = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIP)(ip);\n }\n if (ip == null)\n throw new Error(\"Invalid ip\");\n if (ip.length !== net.network.length) {\n return false;\n }\n for (let i = 0; i < ip.length; i++) {\n if ((net.network[i] & net.mask[i]) !== (ip[i] & net.mask[i])) {\n return false;\n }\n }\n return true;\n}\nfunction iPv4FromIPv6(ip) {\n if (!isIPv4mappedIPv6(ip)) {\n throw new Error(\"Must have 0xffff prefix\");\n }\n return ip.slice(12);\n}\nfunction isIPv4mappedIPv6(ip) {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.deepEqual)(ip, ipv4Prefix, 0, 11);\n}\n//# sourceMappingURL=ip.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/netmask/dist/src/ip.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/netmask/dist/src/ipnet.js": +/*!***********************************************************!*\ + !*** ./node_modules/@chainsafe/netmask/dist/src/ipnet.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IpNet: () => (/* binding */ IpNet)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip/parse */ \"./node_modules/@chainsafe/is-ip/lib/parse.js\");\n/* harmony import */ var _cidr_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cidr.js */ \"./node_modules/@chainsafe/netmask/dist/src/cidr.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@chainsafe/netmask/dist/src/util.js\");\n\n\n\n\nclass IpNet {\n /**\n *\n * @param ipOrCidr either network ip or full cidr address\n * @param mask in case ipOrCidr is network this can be either mask in decimal format or as ip address\n */\n constructor(ipOrCidr, mask) {\n if (mask == null) {\n ({ network: this.network, mask: this.mask } = (0,_cidr_js__WEBPACK_IMPORTED_MODULE_1__.parseCidr)(ipOrCidr));\n }\n else {\n const ipResult = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIP)(ipOrCidr);\n if (ipResult == null) {\n throw new Error(\"Failed to parse network\");\n }\n mask = String(mask);\n const m = parseInt(mask, 10);\n if (Number.isNaN(m) ||\n String(m).length !== mask.length ||\n m < 0 ||\n m > ipResult.length * 8) {\n const maskResult = (0,_chainsafe_is_ip_parse__WEBPACK_IMPORTED_MODULE_0__.parseIP)(mask);\n if (maskResult == null) {\n throw new Error(\"Failed to parse mask\");\n }\n this.mask = maskResult;\n }\n else {\n this.mask = (0,_cidr_js__WEBPACK_IMPORTED_MODULE_1__.cidrMask)(m, 8 * ipResult.length);\n }\n this.network = (0,_ip_js__WEBPACK_IMPORTED_MODULE_2__.maskIp)(ipResult, this.mask);\n }\n }\n /**\n * Checks if netmask contains ip address\n * @param ip\n * @returns\n */\n contains(ip) {\n return (0,_ip_js__WEBPACK_IMPORTED_MODULE_2__.containsIp)({ network: this.network, mask: this.mask }, ip);\n }\n /**Serializes back to string format */\n toString() {\n const l = (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.simpleMaskLength)(this.mask);\n const mask = l !== -1 ? String(l) : (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.maskToHex)(this.mask);\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.ipToString)(this.network) + \"/\" + mask;\n }\n}\n//# sourceMappingURL=ipnet.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/netmask/dist/src/ipnet.js?"); + +/***/ }), + +/***/ "./node_modules/@chainsafe/netmask/dist/src/util.js": +/*!**********************************************************!*\ + !*** ./node_modules/@chainsafe/netmask/dist/src/util.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ allFF: () => (/* binding */ allFF),\n/* harmony export */ deepEqual: () => (/* binding */ deepEqual),\n/* harmony export */ ipToString: () => (/* binding */ ipToString),\n/* harmony export */ maskToHex: () => (/* binding */ maskToHex),\n/* harmony export */ simpleMaskLength: () => (/* binding */ simpleMaskLength)\n/* harmony export */ });\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@chainsafe/netmask/dist/src/ip.js\");\n\nfunction allFF(a, from, to) {\n let i = 0;\n for (const e of a) {\n if (i < from)\n continue;\n if (i > to)\n break;\n if (e !== 0xff)\n return false;\n i++;\n }\n return true;\n}\nfunction deepEqual(a, b, from, to) {\n let i = 0;\n for (const e of a) {\n if (i < from)\n continue;\n if (i > to)\n break;\n if (e !== b[i])\n return false;\n i++;\n }\n return true;\n}\n/***\n * Returns long ip format\n */\nfunction ipToString(ip) {\n switch (ip.length) {\n case _ip_js__WEBPACK_IMPORTED_MODULE_0__.IPv4Len: {\n return ip.join(\".\");\n }\n case _ip_js__WEBPACK_IMPORTED_MODULE_0__.IPv6Len: {\n const result = [];\n for (let i = 0; i < ip.length; i++) {\n if (i % 2 === 0) {\n result.push(ip[i].toString(16).padStart(2, \"0\") +\n ip[i + 1].toString(16).padStart(2, \"0\"));\n }\n }\n return result.join(\":\");\n }\n default: {\n throw new Error(\"Invalid ip length\");\n }\n }\n}\n/**\n * If mask is a sequence of 1 bits followed by 0 bits, return number of 1 bits else -1\n */\nfunction simpleMaskLength(mask) {\n let ones = 0;\n // eslint-disable-next-line prefer-const\n for (let [index, byte] of mask.entries()) {\n if (byte === 0xff) {\n ones += 8;\n continue;\n }\n while ((byte & 0x80) != 0) {\n ones++;\n byte = byte << 1;\n }\n if ((byte & 0x80) != 0) {\n return -1;\n }\n for (let i = index + 1; i < mask.length; i++) {\n if (mask[i] != 0) {\n return -1;\n }\n }\n break;\n }\n return ones;\n}\nfunction maskToHex(mask) {\n let hex = \"0x\";\n for (const byte of mask) {\n hex += (byte >> 4).toString(16) + (byte & 0x0f).toString(16);\n }\n return hex;\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://light/./node_modules/@chainsafe/netmask/dist/src/util.js?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/base64-codec/index.mjs": +/*!************************************************************!*\ + !*** ./node_modules/@leichtgewicht/base64-codec/index.mjs ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PREFERS_NO_PADDING: () => (/* binding */ PREFERS_NO_PADDING),\n/* harmony export */ PREFERS_PADDING: () => (/* binding */ PREFERS_PADDING),\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64URL: () => (/* binding */ base64URL),\n/* harmony export */ make: () => (/* binding */ make)\n/* harmony export */ });\nconst PREFERS_PADDING = 1\nconst PREFERS_NO_PADDING = 2\n\nfunction make (name, charset, padding, paddingMode) {\n if (charset.length !== 64) {\n throw new Error(`Charset needs to be 64 characters long! (${charset.length})`)\n }\n const byCharCode = new Uint8Array(256)\n const byNum = new Uint8Array(64)\n for (let i = 0; i < 64; i += 1) {\n const code = charset.charCodeAt(i)\n if (code > 255) {\n throw new Error(`Character #${i} in charset [code=${code}, char=${charset.charAt(i)}] is too high! (max=255)`)\n }\n if (byCharCode[code] !== 0) {\n throw new Error(`Character [code=${code}, char=${charset.charAt(i)}] is more than once in the charset!`)\n }\n byCharCode[code] = i\n byNum[i] = code\n }\n const padCode = padding.charCodeAt(0)\n const codec = {\n name,\n encodingLength (str) {\n const strLen = str.length\n const len = strLen * 0.75 | 0\n if (str.charCodeAt(strLen - 1) === padCode) {\n if (str.charCodeAt(strLen - 2) === padCode) {\n return len - 2\n }\n return len - 1\n }\n return len\n },\n encode (str, buffer, offset) {\n if (buffer === null || buffer === undefined) {\n buffer = new Uint8Array(codec.encodingLength(str))\n }\n if (offset === null || offset === undefined) {\n offset = 0\n }\n\n let strLen = str.length\n if (str.charCodeAt(strLen - 1) === padCode) {\n if (str.charCodeAt(strLen - 2) === padCode) {\n strLen -= 2\n } else {\n strLen -= 1\n }\n }\n\n const padding = strLen % 4\n const safeLen = strLen - padding\n\n let off = offset\n let i = 0\n while (i < safeLen) {\n const code =\n (byCharCode[str.charCodeAt(i)] << 18) |\n (byCharCode[str.charCodeAt(i + 1)] << 12) |\n (byCharCode[str.charCodeAt(i + 2)] << 6) |\n byCharCode[str.charCodeAt(i + 3)]\n buffer[off++] = code >> 16\n buffer[off++] = code >> 8\n buffer[off++] = code\n i += 4\n }\n\n if (padding === 3) {\n const code =\n (byCharCode[str.charCodeAt(i)] << 10) |\n (byCharCode[str.charCodeAt(i + 1)] << 4) |\n (byCharCode[str.charCodeAt(i + 2)] >> 2)\n buffer[off++] = code >> 8\n buffer[off++] = code\n } else if (padding === 2) {\n buffer[off++] = (byCharCode[str.charCodeAt(i)] << 2) |\n (byCharCode[str.charCodeAt(i + 1)] >> 4)\n }\n\n codec.encode.bytes = off - offset\n return buffer\n },\n decode (buffer, start, end) {\n if (start === null || start === undefined) {\n start = 0\n }\n if (end === null || end === undefined) {\n end = buffer.length\n }\n\n const length = end - start\n const pad = length % 3\n const safeEnd = start + length - pad\n const codes = []\n for (let off = start; off < safeEnd; off += 3) {\n const num = (buffer[off] << 16) | ((buffer[off + 1] << 8)) | buffer[off + 2]\n codes.push(\n byNum[num >> 18 & 0x3F],\n byNum[num >> 12 & 0x3F],\n byNum[num >> 6 & 0x3F],\n byNum[num & 0x3F]\n )\n }\n\n if (pad === 2) {\n const num = (buffer[end - 2] << 8) + buffer[end - 1]\n codes.push(\n byNum[num >> 10],\n byNum[(num >> 4) & 0x3F],\n byNum[(num << 2) & 0x3F]\n )\n if (paddingMode === PREFERS_PADDING) {\n codes.push(padCode)\n }\n } else if (pad === 1) {\n const num = buffer[end - 1]\n codes.push(\n byNum[num >> 2],\n byNum[(num << 4) & 0x3F]\n )\n if (paddingMode === PREFERS_PADDING) {\n codes.push(padCode, padCode)\n }\n }\n\n codec.decode.bytes = length\n return String.fromCharCode.apply(String, codes)\n }\n }\n return codec\n}\n\nconst base64 = make('base64', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', '=', PREFERS_PADDING)\n// https://datatracker.ietf.org/doc/html/rfc4648#section-5\nconst base64URL = make('base64-url', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', '=', PREFERS_NO_PADDING)\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/base64-codec/index.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs": +/*!*****************************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytelength: () => (/* binding */ bytelength),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ isU8Arr: () => (/* binding */ isU8Arr),\n/* harmony export */ readUInt16BE: () => (/* binding */ readUInt16BE),\n/* harmony export */ readUInt32BE: () => (/* binding */ readUInt32BE),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ write: () => (/* binding */ write),\n/* harmony export */ writeUInt16BE: () => (/* binding */ writeUInt16BE),\n/* harmony export */ writeUInt32BE: () => (/* binding */ writeUInt32BE)\n/* harmony export */ });\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n\n\nconst isU8Arr = input => input instanceof Uint8Array\n\nfunction bytelength (input) {\n return typeof input === 'string' ? utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encodingLength(input) : input.byteLength\n}\n\nfunction from (input) {\n if (input instanceof Uint8Array) {\n return input\n }\n if (Array.isArray(input)) {\n return new Uint8Array(input)\n }\n return utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode(input)\n}\n\nfunction write (arr, str, start) {\n if (typeof str !== 'string') {\n throw new Error('unknown input type')\n }\n utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode(str, arr, start)\n return utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode.bytes\n}\n\nfunction toHex (buf, start, end) {\n let result = ''\n for (let offset = start; offset < end;) {\n const num = buf[offset++]\n const str = num.toString(16)\n result += (str.length === 1) ? '0' + str : str\n }\n return result\n}\n\nconst P_24 = Math.pow(2, 24)\nconst P_16 = Math.pow(2, 16)\nconst P_8 = Math.pow(2, 8)\nconst readUInt32BE = (buf, offset) => buf[offset] * P_24 +\n buf[offset + 1] * P_16 +\n buf[offset + 2] * P_8 +\n buf[offset + 3]\n\nconst readUInt16BE = (buf, offset) => (buf[offset] << 8) | buf[offset + 1]\nconst writeUInt32BE = (buf, value, offset) => {\n value = +value\n buf[offset + 3] = value\n value = value >>> 8\n buf[offset + 2] = value\n value = value >>> 8\n buf[offset + 1] = value\n value = value >>> 8\n buf[offset] = value\n return offset + 4\n}\nconst writeUInt16BE = (buf, value, offset) => {\n buf[offset] = value >> 8\n buf[offset + 1] = value & 0xFF\n return offset + 2\n}\n\nfunction copy (source, target, targetStart, sourceStart, sourceEnd) {\n if (targetStart < 0) {\n sourceStart -= targetStart\n targetStart = 0\n }\n\n if (sourceStart < 0) {\n sourceStart = 0\n }\n\n if (sourceEnd < 0) {\n return new Uint8Array(0)\n }\n\n if (targetStart >= target.length || sourceStart >= sourceEnd) {\n return 0\n }\n\n return _copyActual(source, target, targetStart, sourceStart, sourceEnd)\n}\n\nfunction _copyActual (source, target, targetStart, sourceStart, sourceEnd) {\n if (sourceEnd - sourceStart > target.length - targetStart) {\n sourceEnd = sourceStart + target.length - targetStart\n }\n\n let nb = sourceEnd - sourceStart\n const sourceLen = source.length - sourceStart\n if (nb > sourceLen) {\n nb = sourceLen\n }\n\n if (sourceStart !== 0 || sourceEnd < source.length) {\n source = new Uint8Array(source.buffer, source.byteOffset + sourceStart, nb)\n }\n\n target.set(source, targetStart)\n\n return nb\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/classes.mjs": +/*!************************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/classes.mjs ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toClass: () => (/* binding */ toClass),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nfunction toString (klass) {\n switch (klass) {\n case 1: return 'IN'\n case 2: return 'CS'\n case 3: return 'CH'\n case 4: return 'HS'\n case 255: return 'ANY'\n }\n return 'UNKNOWN_' + klass\n}\n\nfunction toClass (name) {\n switch (name.toUpperCase()) {\n case 'IN': return 1\n case 'CS': return 2\n case 'CH': return 3\n case 'HS': return 4\n case 'ANY': return 255\n }\n return 0\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/classes.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/index.mjs": +/*!**********************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/index.mjs ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AUTHENTIC_DATA: () => (/* binding */ AUTHENTIC_DATA),\n/* harmony export */ AUTHORITATIVE_ANSWER: () => (/* binding */ AUTHORITATIVE_ANSWER),\n/* harmony export */ CHECKING_DISABLED: () => (/* binding */ CHECKING_DISABLED),\n/* harmony export */ DNSSEC_OK: () => (/* binding */ DNSSEC_OK),\n/* harmony export */ RECURSION_AVAILABLE: () => (/* binding */ RECURSION_AVAILABLE),\n/* harmony export */ RECURSION_DESIRED: () => (/* binding */ RECURSION_DESIRED),\n/* harmony export */ TRUNCATED_RESPONSE: () => (/* binding */ TRUNCATED_RESPONSE),\n/* harmony export */ a: () => (/* binding */ ra),\n/* harmony export */ aaaa: () => (/* binding */ raaaa),\n/* harmony export */ answer: () => (/* binding */ answer),\n/* harmony export */ caa: () => (/* binding */ rcaa),\n/* harmony export */ cname: () => (/* binding */ rptr),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ decodeList: () => (/* binding */ decodeList),\n/* harmony export */ dname: () => (/* binding */ rptr),\n/* harmony export */ dnskey: () => (/* binding */ rdnskey),\n/* harmony export */ ds: () => (/* binding */ rds),\n/* harmony export */ enc: () => (/* binding */ renc),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ encodeList: () => (/* binding */ encodeList),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength),\n/* harmony export */ encodingLengthList: () => (/* binding */ encodingLengthList),\n/* harmony export */ hinfo: () => (/* binding */ rhinfo),\n/* harmony export */ mx: () => (/* binding */ rmx),\n/* harmony export */ name: () => (/* binding */ name),\n/* harmony export */ ns: () => (/* binding */ rns),\n/* harmony export */ nsec: () => (/* binding */ rnsec),\n/* harmony export */ nsec3: () => (/* binding */ rnsec3),\n/* harmony export */ \"null\": () => (/* binding */ rnull),\n/* harmony export */ opt: () => (/* binding */ ropt),\n/* harmony export */ option: () => (/* binding */ roption),\n/* harmony export */ packet: () => (/* binding */ packet),\n/* harmony export */ ptr: () => (/* binding */ rptr),\n/* harmony export */ query: () => (/* binding */ query),\n/* harmony export */ question: () => (/* binding */ question),\n/* harmony export */ response: () => (/* binding */ response),\n/* harmony export */ rp: () => (/* binding */ rrp),\n/* harmony export */ rrsig: () => (/* binding */ rrrsig),\n/* harmony export */ soa: () => (/* binding */ rsoa),\n/* harmony export */ srv: () => (/* binding */ rsrv),\n/* harmony export */ streamDecode: () => (/* binding */ streamDecode),\n/* harmony export */ streamEncode: () => (/* binding */ streamEncode),\n/* harmony export */ txt: () => (/* binding */ rtxt),\n/* harmony export */ unknown: () => (/* binding */ runknown)\n/* harmony export */ });\n/* harmony import */ var _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @leichtgewicht/ip-codec */ \"./node_modules/@leichtgewicht/ip-codec/index.mjs\");\n/* harmony import */ var _types_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types.mjs */ \"./node_modules/@leichtgewicht/dns-packet/types.mjs\");\n/* harmony import */ var _rcodes_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./rcodes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/rcodes.mjs\");\n/* harmony import */ var _opcodes_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./opcodes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/opcodes.mjs\");\n/* harmony import */ var _classes_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/classes.mjs\");\n/* harmony import */ var _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./optioncodes.mjs */ \"./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs\");\n/* harmony import */ var _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./buffer_utils.mjs */ \"./node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs\");\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n\n\n\n\n\n\n\n\n\nconst QUERY_FLAG = 0\nconst RESPONSE_FLAG = 1 << 15\nconst FLUSH_MASK = 1 << 15\nconst NOT_FLUSH_MASK = ~FLUSH_MASK\nconst QU_MASK = 1 << 15\nconst NOT_QU_MASK = ~QU_MASK\n\nfunction codec ({ bytes = 0, encode, decode, encodingLength }) {\n encode.bytes = bytes\n decode.bytes = bytes\n return {\n encode,\n decode,\n encodingLength: encodingLength || (() => bytes)\n }\n}\n\nconst name = codec({\n encode (str, buf, offset) {\n if (!buf) buf = new Uint8Array(name.encodingLength(str))\n if (!offset) offset = 0\n const oldOffset = offset\n\n // strip leading and trailing .\n const n = str.replace(/^\\.|\\.$/gm, '')\n if (n.length) {\n const list = n.split('.')\n\n for (let i = 0; i < list.length; i++) {\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.write(buf, list[i], offset + 1)\n buf[offset] = len\n offset += len + 1\n }\n }\n\n buf[offset++] = 0\n\n name.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const list = []\n let oldOffset = offset\n let totalLength = 0\n let consumedBytes = 0\n let jumped = false\n\n while (true) {\n if (offset >= buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n const len = buf[offset++]\n consumedBytes += jumped ? 0 : 1\n\n if (len === 0) {\n break\n } else if ((len & 0xc0) === 0) {\n if (offset + len > buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n totalLength += len + 1\n if (totalLength > 254) {\n throw new Error('Cannot decode name (name too long)')\n }\n list.push((0,utf8_codec__WEBPACK_IMPORTED_MODULE_7__.decode)(buf, offset, offset + len))\n offset += len\n consumedBytes += jumped ? 0 : len\n } else if ((len & 0xc0) === 0xc0) {\n if (offset + 1 > buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n const jumpOffset = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset - 1) - 0xc000\n if (jumpOffset >= oldOffset) {\n // Allow only pointers to prior data. RFC 1035, section 4.1.4 states:\n // \"[...] an entire domain name or a list of labels at the end of a domain name\n // is replaced with a pointer to a prior occurance (sic) of the same name.\"\n throw new Error('Cannot decode name (bad pointer)')\n }\n offset = jumpOffset\n oldOffset = jumpOffset\n consumedBytes += jumped ? 0 : 1\n jumped = true\n } else {\n throw new Error('Cannot decode name (bad label)')\n }\n }\n\n name.decode.bytes = consumedBytes\n return list.length === 0 ? '.' : list.join('.')\n },\n encodingLength (n) {\n if (n === '.' || n === '..') return 1\n return _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(n.replace(/^\\.|\\.$/gm, '')) + 2\n }\n})\n\nconst string = codec({\n encode (s, buf, offset) {\n if (!buf) buf = new Uint8Array(string.encodingLength(s))\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.write(buf, s, offset + 1)\n buf[offset] = len\n string.encode.bytes = len + 1\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf[offset]\n const s = (0,utf8_codec__WEBPACK_IMPORTED_MODULE_7__.decode)(buf, offset + 1, offset + 1 + len)\n string.decode.bytes = len + 1\n return s\n },\n encodingLength (s) {\n return _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(s) + 1\n }\n})\n\nconst header = codec({\n bytes: 12,\n encode (h, buf, offset) {\n if (!buf) buf = new Uint8Array(header.encodingLength(h))\n if (!offset) offset = 0\n\n const flags = (h.flags || 0) & 32767\n const type = h.type === 'response' ? RESPONSE_FLAG : QUERY_FLAG\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.id || 0, offset)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, flags | type, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.questions.length, offset + 4)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.answers.length, offset + 6)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.authorities.length, offset + 8)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, h.additionals.length, offset + 10)\n\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n if (buf.length < 12) throw new Error('Header must be 12 bytes')\n const flags = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n\n return {\n id: _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset),\n type: flags & RESPONSE_FLAG ? 'response' : 'query',\n flags: flags & 32767,\n flag_qr: ((flags >> 15) & 0x1) === 1,\n opcode: _opcodes_mjs__WEBPACK_IMPORTED_MODULE_3__.toString((flags >> 11) & 0xf),\n flag_aa: ((flags >> 10) & 0x1) === 1,\n flag_tc: ((flags >> 9) & 0x1) === 1,\n flag_rd: ((flags >> 8) & 0x1) === 1,\n flag_ra: ((flags >> 7) & 0x1) === 1,\n flag_z: ((flags >> 6) & 0x1) === 1,\n flag_ad: ((flags >> 5) & 0x1) === 1,\n flag_cd: ((flags >> 4) & 0x1) === 1,\n rcode: _rcodes_mjs__WEBPACK_IMPORTED_MODULE_2__.toString(flags & 0xf),\n questions: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 4)),\n answers: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 6)),\n authorities: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 8)),\n additionals: new Array(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 10))\n }\n },\n encodingLength () {\n return 12\n }\n})\n\nconst runknown = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(runknown.encodingLength(data))\n if (!offset) offset = 0\n\n const dLen = data.length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, dLen, offset)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(data, buf, offset + 2, 0, dLen)\n\n runknown.encode.bytes = dLen + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n const data = buf.slice(offset + 2, offset + 2 + len)\n runknown.decode.bytes = len + 2\n return data\n },\n encodingLength (data) {\n return data.length + 2\n }\n})\n\nconst rns = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rns.encodingLength(data))\n if (!offset) offset = 0\n\n name.encode(data, buf, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, name.encode.bytes, offset)\n rns.encode.bytes = name.encode.bytes + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n const dd = name.decode(buf, offset + 2)\n\n rns.decode.bytes = len + 2\n return dd\n },\n encodingLength (data) {\n return name.encodingLength(data) + 2\n }\n})\n\nconst rsoa = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rsoa.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n name.encode(data.mname, buf, offset)\n offset += name.encode.bytes\n name.encode(data.rname, buf, offset)\n offset += name.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.serial || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.refresh || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.retry || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.expire || 0, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, data.minimum || 0, offset)\n offset += 4\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rsoa.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.mname = name.decode(buf, offset)\n offset += name.decode.bytes\n data.rname = name.decode(buf, offset)\n offset += name.decode.bytes\n data.serial = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.refresh = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.retry = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.expire = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n data.minimum = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n\n rsoa.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return 22 + name.encodingLength(data.mname) + name.encodingLength(data.rname)\n }\n})\n\nconst rtxt = codec({\n encode (data, buf, offset) {\n if (!Array.isArray(data)) data = [data]\n for (let i = 0; i < data.length; i++) {\n if (typeof data[i] === 'string') {\n data[i] = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.from(data[i])\n }\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(data[i])) {\n throw new Error('Must be a Buffer')\n }\n }\n\n if (!buf) buf = new Uint8Array(rtxt.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n\n data.forEach(function (d) {\n buf[offset++] = d.length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(d, buf, offset, 0, d.length)\n offset += d.length\n })\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rtxt.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n let remaining = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n\n const data = []\n while (remaining > 0) {\n const len = buf[offset++]\n --remaining\n if (remaining < len) {\n throw new Error('Buffer overflow')\n }\n data.push(buf.slice(offset, offset + len))\n offset += len\n remaining -= len\n }\n\n rtxt.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n if (!Array.isArray(data)) data = [data]\n let length = 2\n data.forEach(function (buf) {\n if (typeof buf === 'string') {\n length += _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(buf) + 1\n } else {\n length += buf.length + 1\n }\n })\n return length\n }\n})\n\nconst rnull = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rnull.encodingLength(data))\n if (!offset) offset = 0\n\n if (typeof data === 'string') data = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.from(data)\n if (!data) data = new Uint8Array(0)\n\n const oldOffset = offset\n offset += 2\n\n const len = data.length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(data, buf, offset, 0, len)\n offset += len\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rnull.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n\n offset += 2\n\n const data = buf.slice(offset, offset + len)\n offset += len\n\n rnull.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n if (!data) return 2\n return (_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(data) ? data.length : _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(data)) + 2\n }\n})\n\nconst rhinfo = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rhinfo.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n string.encode(data.cpu, buf, offset)\n offset += string.encode.bytes\n string.encode(data.os, buf, offset)\n offset += string.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rhinfo.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.cpu = string.decode(buf, offset)\n offset += string.decode.bytes\n data.os = string.decode(buf, offset)\n offset += string.decode.bytes\n rhinfo.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return string.encodingLength(data.cpu) + string.encodingLength(data.os) + 2\n }\n})\n\nconst rptr = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rptr.encodingLength(data))\n if (!offset) offset = 0\n\n name.encode(data, buf, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, name.encode.bytes, offset)\n rptr.encode.bytes = name.encode.bytes + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const data = name.decode(buf, offset + 2)\n rptr.decode.bytes = name.decode.bytes + 2\n return data\n },\n encodingLength (data) {\n return name.encodingLength(data) + 2\n }\n})\n\nconst rsrv = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rsrv.encodingLength(data))\n if (!offset) offset = 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.priority || 0, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.weight || 0, offset + 4)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.port || 0, offset + 6)\n name.encode(data.target, buf, offset + 8)\n\n const len = name.encode.bytes + 6\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, len, offset)\n\n rsrv.encode.bytes = len + 2\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n\n const data = {}\n data.priority = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n data.weight = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 4)\n data.port = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 6)\n data.target = name.decode(buf, offset + 8)\n\n rsrv.decode.bytes = len + 2\n return data\n },\n encodingLength (data) {\n return 8 + name.encodingLength(data.target)\n }\n})\n\nconst rcaa = codec({\n encode (data, buf, offset) {\n const len = rcaa.encodingLength(data)\n\n if (!buf) buf = new Uint8Array(rcaa.encodingLength(data))\n if (!offset) offset = 0\n\n if (data.issuerCritical) {\n data.flags = rcaa.ISSUER_CRITICAL\n }\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, len - 2, offset)\n offset += 2\n buf[offset] = data.flags || 0\n offset += 1\n string.encode(data.tag, buf, offset)\n offset += string.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.write(buf, data.value, offset)\n offset += _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(data.value)\n\n rcaa.encode.bytes = len\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n\n const oldOffset = offset\n const data = {}\n data.flags = buf[offset]\n offset += 1\n data.tag = string.decode(buf, offset)\n offset += string.decode.bytes\n data.value = (0,utf8_codec__WEBPACK_IMPORTED_MODULE_7__.decode)(buf, offset, oldOffset + len)\n\n data.issuerCritical = !!(data.flags & rcaa.ISSUER_CRITICAL)\n\n rcaa.decode.bytes = len + 2\n\n return data\n },\n encodingLength (data) {\n return string.encodingLength(data.tag) + string.encodingLength(data.value) + 2\n }\n})\n\nrcaa.ISSUER_CRITICAL = 1 << 7\n\nconst rmx = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rmx.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, data.preference || 0, offset)\n offset += 2\n name.encode(data.exchange, buf, offset)\n offset += name.encode.bytes\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, offset - oldOffset - 2, oldOffset)\n rmx.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.preference = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n data.exchange = name.decode(buf, offset)\n offset += name.decode.bytes\n\n rmx.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return 4 + name.encodingLength(data.exchange)\n }\n})\n\nconst ra = codec({\n encode (host, buf, offset) {\n if (!buf) buf = new Uint8Array(ra.encodingLength(host))\n if (!offset) offset = 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 4, offset)\n offset += 2\n _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v4.encode(host, buf, offset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n offset += 2\n const host = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v4.decode(buf, offset)\n return host\n },\n bytes: 6\n})\n\nconst raaaa = codec({\n encode (host, buf, offset) {\n if (!buf) buf = new Uint8Array(raaaa.encodingLength(host))\n if (!offset) offset = 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 16, offset)\n offset += 2\n _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v6.encode(host, buf, offset)\n raaaa.encode.bytes = 18\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n offset += 2\n const host = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.v6.decode(buf, offset)\n raaaa.decode.bytes = 18\n return host\n },\n bytes: 18\n})\n\nconst alloc = size => new Uint8Array(size)\n\nconst roption = codec({\n encode (option, buf, offset) {\n if (!buf) buf = new Uint8Array(roption.encodingLength(option))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const code = _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__.toCode(option.code)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, code, offset)\n offset += 2\n if (option.data) {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, option.data.length, offset)\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(option.data, buf, offset)\n offset += option.data.length\n } else {\n switch (code) {\n // case 3: NSID. No encode makes sense.\n // case 5,6,7: Not implementable\n case 8: // ECS\n {\n // note: do IP math before calling\n const spl = option.sourcePrefixLength || 0\n const fam = option.family || _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.familyOf(option.ip, alloc)\n const ipBuf = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.encode(option.ip, alloc)\n const ipLen = Math.ceil(spl / 8)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, ipLen + 4, offset)\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, fam, offset)\n offset += 2\n buf[offset++] = spl\n buf[offset++] = option.scopePrefixLength || 0\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(ipBuf, buf, offset, 0, ipLen)\n offset += ipLen\n }\n break\n // case 9: EXPIRE (experimental)\n // case 10: COOKIE. No encode makes sense.\n case 11: // KEEP-ALIVE\n if (option.timeout) {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 2, offset)\n offset += 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, option.timeout, offset)\n offset += 2\n } else {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, 0, offset)\n offset += 2\n }\n break\n case 12: // PADDING\n {\n const len = option.length || 0\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, len, offset)\n offset += 2\n buf.fill(0, offset, offset + len)\n offset += len\n }\n break\n // case 13: CHAIN. Experimental.\n case 14: // KEY-TAG\n {\n const tagsLen = option.tags.length * 2\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, tagsLen, offset)\n offset += 2\n for (const tag of option.tags) {\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, tag, offset)\n offset += 2\n }\n }\n break\n default:\n throw new Error(`Unknown roption code: ${option.code}`)\n }\n }\n\n roption.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const option = {}\n option.code = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n option.type = _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__.toString(option.code)\n offset += 2\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n option.data = buf.slice(offset, offset + len)\n switch (option.code) {\n // case 3: NSID. No decode makes sense.\n case 8: // ECS\n option.family = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n option.sourcePrefixLength = buf[offset++]\n option.scopePrefixLength = buf[offset++]\n {\n const padded = new Uint8Array((option.family === 1) ? 4 : 16)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(buf, padded, 0, offset, offset + len - 4)\n option.ip = _leichtgewicht_ip_codec__WEBPACK_IMPORTED_MODULE_0__.decode(padded)\n }\n break\n // case 12: Padding. No decode makes sense.\n case 11: // KEEP-ALIVE\n if (len > 0) {\n option.timeout = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n }\n break\n case 14:\n option.tags = []\n for (let i = 0; i < len; i += 2) {\n option.tags.push(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n }\n // don't worry about default. caller will use data if desired\n }\n\n roption.decode.bytes = len + 4\n return option\n },\n encodingLength (option) {\n if (option.data) {\n return option.data.length + 4\n }\n const code = _optioncodes_mjs__WEBPACK_IMPORTED_MODULE_5__.toCode(option.code)\n switch (code) {\n case 8: // ECS\n {\n const spl = option.sourcePrefixLength || 0\n return Math.ceil(spl / 8) + 8\n }\n case 11: // KEEP-ALIVE\n return (typeof option.timeout === 'number') ? 6 : 4\n case 12: // PADDING\n return option.length + 4\n case 14: // KEY-TAG\n return 4 + (option.tags.length * 2)\n }\n throw new Error(`Unknown roption code: ${option.code}`)\n }\n})\n\nconst ropt = codec({\n encode (options, buf, offset) {\n if (!buf) buf = new Uint8Array(ropt.encodingLength(options))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const rdlen = encodingLengthList(options, roption)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rdlen, offset)\n offset = encodeList(options, roption, buf, offset + 2)\n\n ropt.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const options = []\n let rdlen = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n let o = 0\n while (rdlen > 0) {\n options[o++] = roption.decode(buf, offset)\n offset += roption.decode.bytes\n rdlen -= roption.decode.bytes\n }\n ropt.decode.bytes = offset - oldOffset\n return options\n },\n encodingLength (options) {\n return 2 + encodingLengthList(options || [], roption)\n }\n})\n\nconst rdnskey = codec({\n encode (key, buf, offset) {\n if (!buf) buf = new Uint8Array(rdnskey.encodingLength(key))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const keydata = key.key\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(keydata)) {\n throw new Error('Key must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, key.flags, offset)\n offset += 2\n buf[offset] = rdnskey.PROTOCOL_DNSSEC\n offset += 1\n buf[offset] = key.algorithm\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(keydata, buf, offset, 0, keydata.length)\n offset += keydata.length\n\n rdnskey.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rdnskey.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const key = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n key.flags = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n if (buf[offset] !== rdnskey.PROTOCOL_DNSSEC) {\n throw new Error('Protocol must be 3')\n }\n offset += 1\n key.algorithm = buf[offset]\n offset += 1\n key.key = buf.slice(offset, oldOffset + length + 2)\n offset += key.key.length\n rdnskey.decode.bytes = offset - oldOffset\n return key\n },\n encodingLength (key) {\n return 6 + _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(key.key)\n }\n})\n\nrdnskey.PROTOCOL_DNSSEC = 3\nrdnskey.ZONE_KEY = 0x80\nrdnskey.SECURE_ENTRYPOINT = 0x8000\n\nconst rrrsig = codec({\n encode (sig, buf, offset) {\n if (!buf) buf = new Uint8Array(rrrsig.encodingLength(sig))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const signature = sig.signature\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(signature)) {\n throw new Error('Signature must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(sig.typeCovered), offset)\n offset += 2\n buf[offset] = sig.algorithm\n offset += 1\n buf[offset] = sig.labels\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, sig.originalTTL, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, sig.expiration, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, sig.inception, offset)\n offset += 4\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, sig.keyTag, offset)\n offset += 2\n name.encode(sig.signersName, buf, offset)\n offset += name.encode.bytes\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(signature, buf, offset, 0, signature.length)\n offset += signature.length\n\n rrrsig.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rrrsig.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const sig = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n sig.typeCovered = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n sig.algorithm = buf[offset]\n offset += 1\n sig.labels = buf[offset]\n offset += 1\n sig.originalTTL = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n sig.expiration = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n sig.inception = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset)\n offset += 4\n sig.keyTag = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n sig.signersName = name.decode(buf, offset)\n offset += name.decode.bytes\n sig.signature = buf.slice(offset, oldOffset + length + 2)\n offset += sig.signature.length\n rrrsig.decode.bytes = offset - oldOffset\n return sig\n },\n encodingLength (sig) {\n return 20 +\n name.encodingLength(sig.signersName) +\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(sig.signature)\n }\n})\nconst rrp = codec({\n encode (data, buf, offset) {\n if (!buf) buf = new Uint8Array(rrp.encodingLength(data))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // Leave space for length\n name.encode(data.mbox || '.', buf, offset)\n offset += name.encode.bytes\n name.encode(data.txt || '.', buf, offset)\n offset += name.encode.bytes\n rrp.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rrp.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.mbox = name.decode(buf, offset) || '.'\n offset += name.decode.bytes\n data.txt = name.decode(buf, offset) || '.'\n offset += name.decode.bytes\n rrp.decode.bytes = offset - oldOffset\n return data\n },\n encodingLength (data) {\n return 2 + name.encodingLength(data.mbox || '.') + name.encodingLength(data.txt || '.')\n }\n})\n\nconst typebitmap = codec({\n encode (typelist, buf, offset) {\n if (!buf) buf = new Uint8Array(typebitmap.encodingLength(typelist))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const typesByWindow = []\n for (let i = 0; i < typelist.length; i++) {\n const typeid = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(typelist[i])\n if (typesByWindow[typeid >> 8] === undefined) {\n typesByWindow[typeid >> 8] = []\n }\n typesByWindow[typeid >> 8][(typeid >> 3) & 0x1F] |= 1 << (7 - (typeid & 0x7))\n }\n\n for (let i = 0; i < typesByWindow.length; i++) {\n if (typesByWindow[i] !== undefined) {\n const windowBuf = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.from(typesByWindow[i])\n buf[offset] = i\n offset += 1\n buf[offset] = windowBuf.length\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(windowBuf, buf, offset, 0, windowBuf.length)\n offset += windowBuf.length\n }\n }\n\n typebitmap.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset, length) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const typelist = []\n while (offset - oldOffset < length) {\n const window = buf[offset]\n offset += 1\n const windowLength = buf[offset]\n offset += 1\n for (let i = 0; i < windowLength; i++) {\n const b = buf[offset + i]\n for (let j = 0; j < 8; j++) {\n if (b & (1 << (7 - j))) {\n const typeid = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString((window << 8) | (i << 3) | j)\n typelist.push(typeid)\n }\n }\n }\n offset += windowLength\n }\n\n typebitmap.decode.bytes = offset - oldOffset\n return typelist\n },\n encodingLength (typelist) {\n const extents = []\n for (let i = 0; i < typelist.length; i++) {\n const typeid = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(typelist[i])\n extents[typeid >> 8] = Math.max(extents[typeid >> 8] || 0, typeid & 0xFF)\n }\n\n let len = 0\n for (let i = 0; i < extents.length; i++) {\n if (extents[i] !== undefined) {\n len += 2 + Math.ceil((extents[i] + 1) / 8)\n }\n }\n\n return len\n }\n})\n\nconst rnsec = codec({\n encode (record, buf, offset) {\n if (!buf) buf = new Uint8Array(rnsec.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // Leave space for length\n name.encode(record.nextDomain, buf, offset)\n offset += name.encode.bytes\n typebitmap.encode(record.rrtypes, buf, offset)\n offset += typebitmap.encode.bytes\n\n rnsec.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rnsec.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const record = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n record.nextDomain = name.decode(buf, offset)\n offset += name.decode.bytes\n record.rrtypes = typebitmap.decode(buf, offset, length - (offset - oldOffset))\n offset += typebitmap.decode.bytes\n\n rnsec.decode.bytes = offset - oldOffset\n return record\n },\n encodingLength (record) {\n return 2 +\n name.encodingLength(record.nextDomain) +\n typebitmap.encodingLength(record.rrtypes)\n }\n})\n\nconst rnsec3 = codec({\n encode (record, buf, offset) {\n if (!buf) buf = new Uint8Array(rnsec3.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const salt = record.salt\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(salt)) {\n throw new Error('salt must be a Buffer')\n }\n\n const nextDomain = record.nextDomain\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(nextDomain)) {\n throw new Error('nextDomain must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf[offset] = record.algorithm\n offset += 1\n buf[offset] = record.flags\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, record.iterations, offset)\n offset += 2\n buf[offset] = salt.length\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(salt, buf, offset, 0, salt.length)\n offset += salt.length\n buf[offset] = nextDomain.length\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(nextDomain, buf, offset, 0, nextDomain.length)\n offset += nextDomain.length\n typebitmap.encode(record.rrtypes, buf, offset)\n offset += typebitmap.encode.bytes\n\n rnsec3.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rnsec3.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const record = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n record.algorithm = buf[offset]\n offset += 1\n record.flags = buf[offset]\n offset += 1\n record.iterations = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n const saltLength = buf[offset]\n offset += 1\n record.salt = buf.slice(offset, offset + saltLength)\n offset += saltLength\n const hashLength = buf[offset]\n offset += 1\n record.nextDomain = buf.slice(offset, offset + hashLength)\n offset += hashLength\n record.rrtypes = typebitmap.decode(buf, offset, length - (offset - oldOffset))\n offset += typebitmap.decode.bytes\n\n rnsec3.decode.bytes = offset - oldOffset\n return record\n },\n encodingLength (record) {\n return 8 +\n record.salt.length +\n record.nextDomain.length +\n typebitmap.encodingLength(record.rrtypes)\n }\n})\n\nconst rds = codec({\n encode (digest, buf, offset) {\n if (!buf) buf = new Uint8Array(rds.encodingLength(digest))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const digestdata = digest.digest\n if (!_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.isU8Arr(digestdata)) {\n throw new Error('Digest must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, digest.keyTag, offset)\n offset += 2\n buf[offset] = digest.algorithm\n offset += 1\n buf[offset] = digest.digestType\n offset += 1\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(digestdata, buf, offset, 0, digestdata.length)\n offset += digestdata.length\n\n rds.encode.bytes = offset - oldOffset\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, rds.encode.bytes - 2, oldOffset)\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const digest = {}\n const length = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n digest.keyTag = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset)\n offset += 2\n digest.algorithm = buf[offset]\n offset += 1\n digest.digestType = buf[offset]\n offset += 1\n digest.digest = buf.slice(offset, oldOffset + length + 2)\n offset += digest.digest.length\n rds.decode.bytes = offset - oldOffset\n return digest\n },\n encodingLength (digest) {\n return 6 + _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.bytelength(digest.digest)\n }\n})\n\nfunction renc (type) {\n switch (type.toUpperCase()) {\n case 'A': return ra\n case 'PTR': return rptr\n case 'CNAME': return rptr\n case 'DNAME': return rptr\n case 'TXT': return rtxt\n case 'NULL': return rnull\n case 'AAAA': return raaaa\n case 'SRV': return rsrv\n case 'HINFO': return rhinfo\n case 'CAA': return rcaa\n case 'NS': return rns\n case 'SOA': return rsoa\n case 'MX': return rmx\n case 'OPT': return ropt\n case 'DNSKEY': return rdnskey\n case 'RRSIG': return rrrsig\n case 'RP': return rrp\n case 'NSEC': return rnsec\n case 'NSEC3': return rnsec3\n case 'DS': return rds\n }\n return runknown\n}\n\nconst answer = codec({\n encode (a, buf, offset) {\n if (!buf) buf = new Uint8Array(answer.encodingLength(a))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n name.encode(a.name, buf, offset)\n offset += name.encode.bytes\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(a.type), offset)\n\n if (a.type.toUpperCase() === 'OPT') {\n if (a.name !== '.') {\n throw new Error('OPT name must be root.')\n }\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, a.udpPayloadSize || 4096, offset + 2)\n buf[offset + 4] = a.extendedRcode || 0\n buf[offset + 5] = a.ednsVersion || 0\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, a.flags || 0, offset + 6)\n\n offset += 8\n ropt.encode(a.options || [], buf, offset)\n offset += ropt.encode.bytes\n } else {\n let klass = _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toClass(a.class === undefined ? 'IN' : a.class)\n if (a.flush) klass |= FLUSH_MASK // the 1st bit of the class is the flush bit\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, klass, offset + 2)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt32BE(buf, a.ttl || 0, offset + 4)\n\n offset += 8\n const enc = renc(a.type)\n enc.encode(a.data, buf, offset)\n offset += enc.encode.bytes\n }\n\n answer.encode.bytes = offset - oldOffset\n return buf\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const a = {}\n const oldOffset = offset\n\n a.name = name.decode(buf, offset)\n offset += name.decode.bytes\n a.type = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n if (a.type === 'OPT') {\n a.udpPayloadSize = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n a.extendedRcode = buf[offset + 4]\n a.ednsVersion = buf[offset + 5]\n a.flags = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 6)\n a.flag_do = ((a.flags >> 15) & 0x1) === 1\n a.options = ropt.decode(buf, offset + 8)\n offset += 8 + ropt.decode.bytes\n } else {\n const klass = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset + 2)\n a.ttl = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt32BE(buf, offset + 4)\n\n a.class = _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toString(klass & NOT_FLUSH_MASK)\n a.flush = !!(klass & FLUSH_MASK)\n\n const enc = renc(a.type)\n a.data = enc.decode(buf, offset + 8)\n offset += 8 + enc.decode.bytes\n }\n\n answer.decode.bytes = offset - oldOffset\n return a\n },\n encodingLength (a) {\n const data = (a.data !== null && a.data !== undefined) ? a.data : a.options\n return name.encodingLength(a.name) + 8 + renc(a.type).encodingLength(data)\n }\n})\n\nconst question = codec({\n encode (q, buf, offset) {\n if (!buf) buf = new Uint8Array(question.encodingLength(q))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n name.encode(q.name, buf, offset)\n offset += name.encode.bytes\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toType(q.type), offset)\n offset += 2\n\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(buf, _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toClass(q.class === undefined ? 'IN' : q.class), offset)\n offset += 2\n\n question.encode.bytes = offset - oldOffset\n return q\n },\n decode (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n const q = {}\n\n q.name = name.decode(buf, offset)\n offset += name.decode.bytes\n\n q.type = _types_mjs__WEBPACK_IMPORTED_MODULE_1__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n\n q.class = _classes_mjs__WEBPACK_IMPORTED_MODULE_4__.toString(_buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(buf, offset))\n offset += 2\n\n const qu = !!(q.class & QU_MASK)\n if (qu) q.class &= NOT_QU_MASK\n\n question.decode.bytes = offset - oldOffset\n return q\n },\n encodingLength (q) {\n return name.encodingLength(q.name) + 4\n }\n})\n\n\n\nconst AUTHORITATIVE_ANSWER = 1 << 10\nconst TRUNCATED_RESPONSE = 1 << 9\nconst RECURSION_DESIRED = 1 << 8\nconst RECURSION_AVAILABLE = 1 << 7\nconst AUTHENTIC_DATA = 1 << 5\nconst CHECKING_DISABLED = 1 << 4\nconst DNSSEC_OK = 1 << 15\n\nconst packet = {\n encode: function (result, buf, offset) {\n const allocing = !buf\n\n if (allocing) buf = new Uint8Array(encodingLength(result))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n if (!result.questions) result.questions = []\n if (!result.answers) result.answers = []\n if (!result.authorities) result.authorities = []\n if (!result.additionals) result.additionals = []\n\n header.encode(result, buf, offset)\n offset += header.encode.bytes\n\n offset = encodeList(result.questions, question, buf, offset)\n offset = encodeList(result.answers, answer, buf, offset)\n offset = encodeList(result.authorities, answer, buf, offset)\n offset = encodeList(result.additionals, answer, buf, offset)\n\n packet.encode.bytes = offset - oldOffset\n\n // just a quick sanity check\n if (allocing && encode.bytes !== buf.length) {\n return buf.slice(0, encode.bytes)\n }\n\n return buf\n },\n decode: function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n const result = header.decode(buf, offset)\n offset += header.decode.bytes\n\n offset = decodeList(result.questions, question, buf, offset)\n offset = decodeList(result.answers, answer, buf, offset)\n offset = decodeList(result.authorities, answer, buf, offset)\n offset = decodeList(result.additionals, answer, buf, offset)\n\n packet.decode.bytes = offset - oldOffset\n\n return result\n },\n encodingLength: function (result) {\n return header.encodingLength(result) +\n encodingLengthList(result.questions || [], question) +\n encodingLengthList(result.answers || [], answer) +\n encodingLengthList(result.authorities || [], answer) +\n encodingLengthList(result.additionals || [], answer)\n }\n}\npacket.encode.bytes = 0\npacket.decode.bytes = 0\n\nfunction sanitizeSingle (input, type) {\n if (input.questions) {\n throw new Error('Only one .question object expected instead of a .questions array!')\n }\n const sanitized = Object.assign({\n type\n }, input)\n if (sanitized.question) {\n sanitized.questions = [sanitized.question]\n delete sanitized.question\n }\n return sanitized\n}\n\nconst query = {\n encode: function (result, buf, offset) {\n buf = packet.encode(sanitizeSingle(result, 'query'), buf, offset)\n query.encode.bytes = packet.encode.bytes\n return buf\n },\n decode: function (buf, offset) {\n const res = packet.decode(buf, offset)\n query.decode.bytes = packet.decode.bytes\n if (res.questions) {\n res.question = res.questions[0]\n delete res.questions\n }\n return res\n },\n encodingLength: function (result) {\n return packet.encodingLength(sanitizeSingle(result, 'query'))\n }\n}\nquery.encode.bytes = 0\nquery.decode.bytes = 0\n\nconst response = {\n encode: function (result, buf, offset) {\n buf = packet.encode(sanitizeSingle(result, 'response'), buf, offset)\n response.encode.bytes = packet.encode.bytes\n return buf\n },\n decode: function (buf, offset) {\n const res = packet.decode(buf, offset)\n response.decode.bytes = packet.decode.bytes\n if (res.questions) {\n res.question = res.questions[0]\n delete res.questions\n }\n return res\n },\n encodingLength: function (result) {\n return packet.encodingLength(sanitizeSingle(result, 'response'))\n }\n}\nresponse.encode.bytes = 0\nresponse.decode.bytes = 0\n\nconst encode = packet.encode\nconst decode = packet.decode\nconst encodingLength = packet.encodingLength\n\nfunction streamEncode (result) {\n const buf = encode(result)\n const combine = new Uint8Array(2 + buf.byteLength)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.writeUInt16BE(combine, buf.byteLength)\n _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.copy(buf, combine, 2, 0, buf.length)\n streamEncode.bytes = combine.byteLength\n return combine\n}\nstreamEncode.bytes = 0\n\nfunction streamDecode (sbuf) {\n const len = _buffer_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.readUInt16BE(sbuf, 0)\n if (sbuf.byteLength < len + 2) {\n // not enough data\n return null\n }\n const result = decode(sbuf.slice(2))\n streamDecode.bytes = decode.bytes\n return result\n}\nstreamDecode.bytes = 0\n\nfunction encodingLengthList (list, enc) {\n let len = 0\n for (let i = 0; i < list.length; i++) len += enc.encodingLength(list[i])\n return len\n}\n\nfunction encodeList (list, enc, buf, offset) {\n for (let i = 0; i < list.length; i++) {\n enc.encode(list[i], buf, offset)\n offset += enc.encode.bytes\n }\n return offset\n}\n\nfunction decodeList (list, enc, buf, offset) {\n for (let i = 0; i < list.length; i++) {\n list[i] = enc.decode(buf, offset)\n offset += enc.decode.bytes\n }\n return offset\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/index.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/opcodes.mjs": +/*!************************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/opcodes.mjs ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toOpcode: () => (/* binding */ toOpcode),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/*\n * Traditional DNS header OPCODEs (4-bits) defined by IANA in\n * https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5\n */\n\nfunction toString (opcode) {\n switch (opcode) {\n case 0: return 'QUERY'\n case 1: return 'IQUERY'\n case 2: return 'STATUS'\n case 3: return 'OPCODE_3'\n case 4: return 'NOTIFY'\n case 5: return 'UPDATE'\n case 6: return 'OPCODE_6'\n case 7: return 'OPCODE_7'\n case 8: return 'OPCODE_8'\n case 9: return 'OPCODE_9'\n case 10: return 'OPCODE_10'\n case 11: return 'OPCODE_11'\n case 12: return 'OPCODE_12'\n case 13: return 'OPCODE_13'\n case 14: return 'OPCODE_14'\n case 15: return 'OPCODE_15'\n }\n return 'OPCODE_' + opcode\n}\n\nfunction toOpcode (code) {\n switch (code.toUpperCase()) {\n case 'QUERY': return 0\n case 'IQUERY': return 1\n case 'STATUS': return 2\n case 'OPCODE_3': return 3\n case 'NOTIFY': return 4\n case 'UPDATE': return 5\n case 'OPCODE_6': return 6\n case 'OPCODE_7': return 7\n case 'OPCODE_8': return 8\n case 'OPCODE_9': return 9\n case 'OPCODE_10': return 10\n case 'OPCODE_11': return 11\n case 'OPCODE_12': return 12\n case 'OPCODE_13': return 13\n case 'OPCODE_14': return 14\n case 'OPCODE_15': return 15\n }\n return 0\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/opcodes.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs": +/*!****************************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toCode: () => (/* binding */ toCode),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nfunction toString (type) {\n switch (type) {\n // list at\n // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11\n case 1: return 'LLQ'\n case 2: return 'UL'\n case 3: return 'NSID'\n case 5: return 'DAU'\n case 6: return 'DHU'\n case 7: return 'N3U'\n case 8: return 'CLIENT_SUBNET'\n case 9: return 'EXPIRE'\n case 10: return 'COOKIE'\n case 11: return 'TCP_KEEPALIVE'\n case 12: return 'PADDING'\n case 13: return 'CHAIN'\n case 14: return 'KEY_TAG'\n case 26946: return 'DEVICEID'\n }\n if (type < 0) {\n return null\n }\n return `OPTION_${type}`\n}\n\nfunction toCode (name) {\n if (typeof name === 'number') {\n return name\n }\n if (!name) {\n return -1\n }\n switch (name.toUpperCase()) {\n case 'OPTION_0': return 0\n case 'LLQ': return 1\n case 'UL': return 2\n case 'NSID': return 3\n case 'OPTION_4': return 4\n case 'DAU': return 5\n case 'DHU': return 6\n case 'N3U': return 7\n case 'CLIENT_SUBNET': return 8\n case 'EXPIRE': return 9\n case 'COOKIE': return 10\n case 'TCP_KEEPALIVE': return 11\n case 'PADDING': return 12\n case 'CHAIN': return 13\n case 'KEY_TAG': return 14\n case 'DEVICEID': return 26946\n case 'OPTION_65535': return 65535\n }\n const m = name.match(/_(\\d+)$/)\n if (m) {\n return parseInt(m[1], 10)\n }\n return -1\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/optioncodes.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/rcodes.mjs": +/*!***********************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/rcodes.mjs ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toRcode: () => (/* binding */ toRcode),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/*\n * Traditional DNS header RCODEs (4-bits) defined by IANA in\n * https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml\n */\n\nfunction toString (rcode) {\n switch (rcode) {\n case 0: return 'NOERROR'\n case 1: return 'FORMERR'\n case 2: return 'SERVFAIL'\n case 3: return 'NXDOMAIN'\n case 4: return 'NOTIMP'\n case 5: return 'REFUSED'\n case 6: return 'YXDOMAIN'\n case 7: return 'YXRRSET'\n case 8: return 'NXRRSET'\n case 9: return 'NOTAUTH'\n case 10: return 'NOTZONE'\n case 11: return 'RCODE_11'\n case 12: return 'RCODE_12'\n case 13: return 'RCODE_13'\n case 14: return 'RCODE_14'\n case 15: return 'RCODE_15'\n }\n return 'RCODE_' + rcode\n}\n\nfunction toRcode (code) {\n switch (code.toUpperCase()) {\n case 'NOERROR': return 0\n case 'FORMERR': return 1\n case 'SERVFAIL': return 2\n case 'NXDOMAIN': return 3\n case 'NOTIMP': return 4\n case 'REFUSED': return 5\n case 'YXDOMAIN': return 6\n case 'YXRRSET': return 7\n case 'NXRRSET': return 8\n case 'NOTAUTH': return 9\n case 'NOTZONE': return 10\n case 'RCODE_11': return 11\n case 'RCODE_12': return 12\n case 'RCODE_13': return 13\n case 'RCODE_14': return 14\n case 'RCODE_15': return 15\n }\n return 0\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/rcodes.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/dns-packet/types.mjs": +/*!**********************************************************!*\ + !*** ./node_modules/@leichtgewicht/dns-packet/types.mjs ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString),\n/* harmony export */ toType: () => (/* binding */ toType)\n/* harmony export */ });\nfunction toString (type) {\n switch (type) {\n case 1: return 'A'\n case 10: return 'NULL'\n case 28: return 'AAAA'\n case 18: return 'AFSDB'\n case 42: return 'APL'\n case 257: return 'CAA'\n case 60: return 'CDNSKEY'\n case 59: return 'CDS'\n case 37: return 'CERT'\n case 5: return 'CNAME'\n case 49: return 'DHCID'\n case 32769: return 'DLV'\n case 39: return 'DNAME'\n case 48: return 'DNSKEY'\n case 43: return 'DS'\n case 55: return 'HIP'\n case 13: return 'HINFO'\n case 45: return 'IPSECKEY'\n case 25: return 'KEY'\n case 36: return 'KX'\n case 29: return 'LOC'\n case 15: return 'MX'\n case 35: return 'NAPTR'\n case 2: return 'NS'\n case 47: return 'NSEC'\n case 50: return 'NSEC3'\n case 51: return 'NSEC3PARAM'\n case 12: return 'PTR'\n case 46: return 'RRSIG'\n case 17: return 'RP'\n case 24: return 'SIG'\n case 6: return 'SOA'\n case 99: return 'SPF'\n case 33: return 'SRV'\n case 44: return 'SSHFP'\n case 32768: return 'TA'\n case 249: return 'TKEY'\n case 52: return 'TLSA'\n case 250: return 'TSIG'\n case 16: return 'TXT'\n case 252: return 'AXFR'\n case 251: return 'IXFR'\n case 41: return 'OPT'\n case 255: return 'ANY'\n }\n return 'UNKNOWN_' + type\n}\n\nfunction toType (name) {\n switch (name.toUpperCase()) {\n case 'A': return 1\n case 'NULL': return 10\n case 'AAAA': return 28\n case 'AFSDB': return 18\n case 'APL': return 42\n case 'CAA': return 257\n case 'CDNSKEY': return 60\n case 'CDS': return 59\n case 'CERT': return 37\n case 'CNAME': return 5\n case 'DHCID': return 49\n case 'DLV': return 32769\n case 'DNAME': return 39\n case 'DNSKEY': return 48\n case 'DS': return 43\n case 'HIP': return 55\n case 'HINFO': return 13\n case 'IPSECKEY': return 45\n case 'KEY': return 25\n case 'KX': return 36\n case 'LOC': return 29\n case 'MX': return 15\n case 'NAPTR': return 35\n case 'NS': return 2\n case 'NSEC': return 47\n case 'NSEC3': return 50\n case 'NSEC3PARAM': return 51\n case 'PTR': return 12\n case 'RRSIG': return 46\n case 'RP': return 17\n case 'SIG': return 24\n case 'SOA': return 6\n case 'SPF': return 99\n case 'SRV': return 33\n case 'SSHFP': return 44\n case 'TA': return 32768\n case 'TKEY': return 249\n case 'TLSA': return 52\n case 'TSIG': return 250\n case 'TXT': return 16\n case 'AXFR': return 252\n case 'IXFR': return 251\n case 'OPT': return 41\n case 'ANY': return 255\n case '*': return 255\n }\n if (name.toUpperCase().startsWith('UNKNOWN_')) return parseInt(name.slice(8))\n return 0\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/dns-packet/types.mjs?"); + +/***/ }), + +/***/ "./node_modules/@leichtgewicht/ip-codec/index.mjs": +/*!********************************************************!*\ + !*** ./node_modules/@leichtgewicht/ip-codec/index.mjs ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ familyOf: () => (/* binding */ familyOf),\n/* harmony export */ name: () => (/* binding */ name),\n/* harmony export */ sizeOf: () => (/* binding */ sizeOf),\n/* harmony export */ v4: () => (/* binding */ v4),\n/* harmony export */ v6: () => (/* binding */ v6)\n/* harmony export */ });\nconst v4Regex = /^(\\d{1,3}\\.){3,3}\\d{1,3}$/\nconst v4Size = 4\nconst v6Regex = /^(::)?(((\\d{1,3}\\.){3}(\\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i\nconst v6Size = 16\n\nconst v4 = {\n name: 'v4',\n size: v4Size,\n isFormat: ip => v4Regex.test(ip),\n encode (ip, buff, offset) {\n offset = ~~offset\n buff = buff || new Uint8Array(offset + v4Size)\n const max = ip.length\n let n = 0\n for (let i = 0; i < max;) {\n const c = ip.charCodeAt(i++)\n if (c === 46) { // \".\"\n buff[offset++] = n\n n = 0\n } else {\n n = n * 10 + (c - 48)\n }\n }\n buff[offset] = n\n return buff\n },\n decode (buff, offset) {\n offset = ~~offset\n return `${buff[offset++]}.${buff[offset++]}.${buff[offset++]}.${buff[offset]}`\n }\n}\n\nconst v6 = {\n name: 'v6',\n size: v6Size,\n isFormat: ip => ip.length > 0 && v6Regex.test(ip),\n encode (ip, buff, offset) {\n offset = ~~offset\n let end = offset + v6Size\n let fill = -1\n let hexN = 0\n let decN = 0\n let prevColon = true\n let useDec = false\n buff = buff || new Uint8Array(offset + v6Size)\n // Note: This algorithm needs to check if the offset\n // could exceed the buffer boundaries as it supports\n // non-standard compliant encodings that may go beyond\n // the boundary limits. if (offset < end) checks should\n // not be necessary...\n for (let i = 0; i < ip.length; i++) {\n let c = ip.charCodeAt(i)\n if (c === 58) { // :\n if (prevColon) {\n if (fill !== -1) {\n // Not Standard! (standard doesn't allow multiple ::)\n // We need to treat\n if (offset < end) buff[offset] = 0\n if (offset < end - 1) buff[offset + 1] = 0\n offset += 2\n } else if (offset < end) {\n // :: in the middle\n fill = offset\n }\n } else {\n // : ends the previous number\n if (useDec === true) {\n // Non-standard! (ipv4 should be at end only)\n // A ipv4 address should not be found anywhere else but at\n // the end. This codec also support putting characters\n // after the ipv4 address..\n if (offset < end) buff[offset] = decN\n offset++\n } else {\n if (offset < end) buff[offset] = hexN >> 8\n if (offset < end - 1) buff[offset + 1] = hexN & 0xff\n offset += 2\n }\n hexN = 0\n decN = 0\n }\n prevColon = true\n useDec = false\n } else if (c === 46) { // . indicates IPV4 notation\n if (offset < end) buff[offset] = decN\n offset++\n decN = 0\n hexN = 0\n prevColon = false\n useDec = true\n } else {\n prevColon = false\n if (c >= 97) {\n c -= 87 // a-f ... 97~102 -87 => 10~15\n } else if (c >= 65) {\n c -= 55 // A-F ... 65~70 -55 => 10~15\n } else {\n c -= 48 // 0-9 ... starting from charCode 48\n decN = decN * 10 + c\n }\n // We don't know yet if its a dec or hex number\n hexN = (hexN << 4) + c\n }\n }\n if (prevColon === false) {\n // Commiting last number\n if (useDec === true) {\n if (offset < end) buff[offset] = decN\n offset++\n } else {\n if (offset < end) buff[offset] = hexN >> 8\n if (offset < end - 1) buff[offset + 1] = hexN & 0xff\n offset += 2\n }\n } else if (fill === 0) {\n // Not Standard! (standard doesn't allow multiple ::)\n // This means that a : was found at the start AND end which means the\n // end needs to be treated as 0 entry...\n if (offset < end) buff[offset] = 0\n if (offset < end - 1) buff[offset + 1] = 0\n offset += 2\n } else if (fill !== -1) {\n // Non-standard! (standard doens't allow multiple ::)\n // Here we find that there has been a :: somewhere in the middle\n // and the end. To treat the end with priority we need to move all\n // written data two bytes to the right.\n offset += 2\n for (let i = Math.min(offset - 1, end - 1); i >= fill + 2; i--) {\n buff[i] = buff[i - 2]\n }\n buff[fill] = 0\n buff[fill + 1] = 0\n fill = offset\n }\n if (fill !== offset && fill !== -1) {\n // Move the written numbers to the end while filling the everything\n // \"fill\" to the bytes with zeros.\n if (offset > end - 2) {\n // Non Standard support, when the cursor exceeds bounds.\n offset = end - 2\n }\n while (end > fill) {\n buff[--end] = offset < end && offset > fill ? buff[--offset] : 0\n }\n } else {\n // Fill the rest with zeros\n while (offset < end) {\n buff[offset++] = 0\n }\n }\n return buff\n },\n decode (buff, offset) {\n offset = ~~offset\n let result = ''\n for (let i = 0; i < v6Size; i += 2) {\n if (i !== 0) {\n result += ':'\n }\n result += (buff[offset + i] << 8 | buff[offset + i + 1]).toString(16)\n }\n return result\n .replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')\n .replace(/:{3,4}/, '::')\n }\n}\n\nconst name = 'ip'\nfunction sizeOf (ip) {\n if (v4.isFormat(ip)) return v4.size\n if (v6.isFormat(ip)) return v6.size\n throw Error(`Invalid ip address: ${ip}`)\n}\n\nfunction familyOf (string) {\n return sizeOf(string) === v4.size ? 1 : 2\n}\n\nfunction encode (ip, buff, offset) {\n offset = ~~offset\n const size = sizeOf(ip)\n if (typeof buff === 'function') {\n buff = buff(offset + size)\n }\n if (size === v4.size) {\n return v4.encode(ip, buff, offset)\n }\n return v6.encode(ip, buff, offset)\n}\n\nfunction decode (buff, offset, length) {\n offset = ~~offset\n length = length || (buff.length - offset)\n if (length === v4.size) {\n return v4.decode(buff, offset, length)\n }\n if (length === v6.size) {\n return v6.decode(buff, offset, length)\n }\n throw Error(`Invalid buffer size needs to be ${v4.size} for v4 or ${v6.size} for v6.`)\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@leichtgewicht/ip-codec/index.mjs?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/aes/cipher-mode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/aes/cipher-mode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cipherMode: () => (/* binding */ cipherMode)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n\nconst CIPHER_MODES = {\n 16: 'aes-128-ctr',\n 32: 'aes-256-ctr'\n};\nfunction cipherMode(key) {\n if (key.length === 16 || key.length === 32) {\n return CIPHER_MODES[key.length];\n }\n const modes = Object.entries(CIPHER_MODES).map(([k, v]) => `${k} (${v})`).join(' / ');\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`Invalid key length ${key.length} bytes. Must be ${modes}`, 'ERR_INVALID_KEY_LENGTH');\n}\n//# sourceMappingURL=cipher-mode.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/aes/cipher-mode.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/aes/ciphers-browser.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/aes/ciphers-browser.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCipheriv: () => (/* binding */ createCipheriv),\n/* harmony export */ createDecipheriv: () => (/* binding */ createDecipheriv)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_aes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/aes.js */ \"./node_modules/node-forge/lib/aes.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n// @ts-expect-error types are missing\n\n\n\nfunction createCipheriv(mode, key, iv) {\n const cipher2 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.cipher.createCipher('AES-CTR', (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(key, 'ascii'));\n cipher2.start({ iv: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(iv, 'ascii') });\n return {\n update: (data) => {\n cipher2.update(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.util.createBuffer((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(data, 'ascii')));\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(cipher2.output.getBytes(), 'ascii');\n }\n };\n}\nfunction createDecipheriv(mode, key, iv) {\n const cipher2 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.cipher.createDecipher('AES-CTR', (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(key, 'ascii'));\n cipher2.start({ iv: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(iv, 'ascii') });\n return {\n update: (data) => {\n cipher2.update(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.util.createBuffer((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(data, 'ascii')));\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(cipher2.output.getBytes(), 'ascii');\n }\n };\n}\n//# sourceMappingURL=ciphers-browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/aes/ciphers-browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/aes/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/aes/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create)\n/* harmony export */ });\n/* harmony import */ var _cipher_mode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-mode.js */ \"./node_modules/@libp2p/crypto/dist/src/aes/cipher-mode.js\");\n/* harmony import */ var _ciphers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ciphers.js */ \"./node_modules/@libp2p/crypto/dist/src/aes/ciphers-browser.js\");\n\n\nasync function create(key, iv) {\n const mode = (0,_cipher_mode_js__WEBPACK_IMPORTED_MODULE_0__.cipherMode)(key);\n const cipher = _ciphers_js__WEBPACK_IMPORTED_MODULE_1__.createCipheriv(mode, key, iv);\n const decipher = _ciphers_js__WEBPACK_IMPORTED_MODULE_1__.createDecipheriv(mode, key, iv);\n const res = {\n async encrypt(data) {\n return cipher.update(data);\n },\n async decrypt(data) {\n return decipher.update(data);\n }\n };\n return res;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/aes/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ derivedEmptyPasswordKey: () => (/* binding */ derivedEmptyPasswordKey)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n\n\n\n// WebKit on Linux does not support deriving a key from an empty PBKDF2 key.\n// So, as a workaround, we provide the generated key as a constant. We test that\n// this generated key is accurate in test/workaround.spec.ts\n// Generated via:\n// await crypto.subtle.exportKey('jwk',\n// await crypto.subtle.deriveKey(\n// { name: 'PBKDF2', salt: new Uint8Array(16), iterations: 32767, hash: { name: 'SHA-256' } },\n// await crypto.subtle.importKey('raw', new Uint8Array(0), { name: 'PBKDF2' }, false, ['deriveKey']),\n// { name: 'AES-GCM', length: 128 }, true, ['encrypt', 'decrypt'])\n// )\nconst derivedEmptyPasswordKey = { alg: 'A128GCM', ext: true, k: 'scm9jmO_4BJAgdwWGVulLg', key_ops: ['encrypt', 'decrypt'], kty: 'oct' };\n// Based off of code from https://github.com/luke-park/SecureCompatibleEncryptionExamples\nfunction create(opts) {\n const algorithm = opts?.algorithm ?? 'AES-GCM';\n let keyLength = opts?.keyLength ?? 16;\n const nonceLength = opts?.nonceLength ?? 12;\n const digest = opts?.digest ?? 'SHA-256';\n const saltLength = opts?.saltLength ?? 16;\n const iterations = opts?.iterations ?? 32767;\n const crypto = _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].get();\n keyLength *= 8; // Browser crypto uses bits instead of bytes\n /**\n * Uses the provided password to derive a pbkdf2 key. The key\n * will then be used to encrypt the data.\n */\n async function encrypt(data, password) {\n const salt = crypto.getRandomValues(new Uint8Array(saltLength));\n const nonce = crypto.getRandomValues(new Uint8Array(nonceLength));\n const aesGcm = { name: algorithm, iv: nonce };\n if (typeof password === 'string') {\n password = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(password);\n }\n let cryptoKey;\n if (password.length === 0) {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['encrypt']);\n try {\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['encrypt']);\n }\n catch {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['encrypt']);\n }\n }\n else {\n // Derive a key using PBKDF2.\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['encrypt']);\n }\n // Encrypt the string.\n const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, data);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([salt, aesGcm.iv, new Uint8Array(ciphertext)]);\n }\n /**\n * Uses the provided password to derive a pbkdf2 key. The key\n * will then be used to decrypt the data. The options used to create\n * this decryption cipher must be the same as those used to create\n * the encryption cipher.\n */\n async function decrypt(data, password) {\n const salt = data.subarray(0, saltLength);\n const nonce = data.subarray(saltLength, saltLength + nonceLength);\n const ciphertext = data.subarray(saltLength + nonceLength);\n const aesGcm = { name: algorithm, iv: nonce };\n if (typeof password === 'string') {\n password = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(password);\n }\n let cryptoKey;\n if (password.length === 0) {\n try {\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['decrypt']);\n }\n catch {\n cryptoKey = await crypto.subtle.importKey('jwk', derivedEmptyPasswordKey, { name: 'AES-GCM' }, true, ['decrypt']);\n }\n }\n else {\n // Derive the key using PBKDF2.\n const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };\n const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);\n cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['decrypt']);\n }\n // Decrypt the string.\n const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, ciphertext);\n return new Uint8Array(plaintext);\n }\n const cipher = {\n encrypt,\n decrypt\n };\n return cipher;\n}\n//# sourceMappingURL=aes-gcm.browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ create: () => (/* binding */ create)\n/* harmony export */ });\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n/* harmony import */ var _lengths_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lengths.js */ \"./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js\");\n\n\nconst hashTypes = {\n SHA1: 'SHA-1',\n SHA256: 'SHA-256',\n SHA512: 'SHA-512'\n};\nconst sign = async (key, data) => {\n const buf = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().subtle.sign({ name: 'HMAC' }, key, data);\n return new Uint8Array(buf, 0, buf.byteLength);\n};\nasync function create(hashType, secret) {\n const hash = hashTypes[hashType];\n const key = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().subtle.importKey('raw', secret, {\n name: 'HMAC',\n hash: { name: hash }\n }, false, ['sign']);\n return {\n async digest(data) {\n return sign(key, data);\n },\n length: _lengths_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"][hashType]\n };\n}\n//# sourceMappingURL=index-browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js": +/*!**************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n SHA1: 20,\n SHA256: 32,\n SHA512: 64\n});\n//# sourceMappingURL=lengths.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/hmac/lengths.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/index.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ aes: () => (/* reexport module object */ _aes_index_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ hmac: () => (/* reexport module object */ _hmac_index_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ keys: () => (/* reexport module object */ _keys_index_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ pbkdf2: () => (/* reexport safe */ _pbkdf2_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]),\n/* harmony export */ randomBytes: () => (/* reexport safe */ _random_bytes_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])\n/* harmony export */ });\n/* harmony import */ var _aes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./aes/index.js */ \"./node_modules/@libp2p/crypto/dist/src/aes/index.js\");\n/* harmony import */ var _hmac_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hmac/index.js */ \"./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js\");\n/* harmony import */ var _keys_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keys/index.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _pbkdf2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pbkdf2.js */ \"./node_modules/@libp2p/crypto/dist/src/pbkdf2.js\");\n/* harmony import */ var _random_bytes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./random-bytes.js */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateEphmeralKeyPair: () => (/* binding */ generateEphmeralKeyPair)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n\n\n\n\n\n\nconst bits = {\n 'P-256': 256,\n 'P-384': 384,\n 'P-521': 521\n};\nconst curveTypes = Object.keys(bits);\nconst names = curveTypes.join(' / ');\nasync function generateEphmeralKeyPair(curve) {\n if (curve !== 'P-256' && curve !== 'P-384' && curve !== 'P-521') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`Unknown curve: ${curve}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const pair = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].get().subtle.generateKey({\n name: 'ECDH',\n namedCurve: curve\n }, true, ['deriveBits']);\n // forcePrivate is used for testing only\n const genSharedKey = async (theirPub, forcePrivate) => {\n let privateKey;\n if (forcePrivate != null) {\n privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].get().subtle.importKey('jwk', unmarshalPrivateKey(curve, forcePrivate), {\n name: 'ECDH',\n namedCurve: curve\n }, false, ['deriveBits']);\n }\n else {\n privateKey = pair.privateKey;\n }\n const key = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].get().subtle.importKey('jwk', unmarshalPublicKey(curve, theirPub), {\n name: 'ECDH',\n namedCurve: curve\n }, false, []);\n const buffer = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].get().subtle.deriveBits({\n name: 'ECDH',\n // @ts-expect-error namedCurve is missing from the types\n namedCurve: curve,\n public: key\n }, privateKey, bits[curve]);\n return new Uint8Array(buffer, 0, buffer.byteLength);\n };\n const publicKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].get().subtle.exportKey('jwk', pair.publicKey);\n const ecdhKey = {\n key: marshalPublicKey(publicKey),\n genSharedKey\n };\n return ecdhKey;\n}\nconst curveLengths = {\n 'P-256': 32,\n 'P-384': 48,\n 'P-521': 66\n};\n// Marshal converts a jwk encoded ECDH public key into the\n// form specified in section 4.3.6 of ANSI X9.62. (This is the format\n// go-ipfs uses)\nfunction marshalPublicKey(jwk) {\n if (jwk.crv == null || jwk.x == null || jwk.y == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n if (jwk.crv !== 'P-256' && jwk.crv !== 'P-384' && jwk.crv !== 'P-521') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`Unknown curve: ${jwk.crv}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const byteLen = curveLengths[jwk.crv];\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([\n Uint8Array.from([4]),\n (0,_util_js__WEBPACK_IMPORTED_MODULE_4__.base64urlToBuffer)(jwk.x, byteLen),\n (0,_util_js__WEBPACK_IMPORTED_MODULE_4__.base64urlToBuffer)(jwk.y, byteLen)\n ], 1 + byteLen * 2);\n}\n// Unmarshal converts a point, serialized by Marshal, into an jwk encoded key\nfunction unmarshalPublicKey(curve, key) {\n if (curve !== 'P-256' && curve !== 'P-384' && curve !== 'P-521') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`Unknown curve: ${curve}. Must be ${names}`, 'ERR_INVALID_CURVE');\n }\n const byteLen = curveLengths[curve];\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(key.subarray(0, 1), Uint8Array.from([4]))) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Cannot unmarshal public key - invalid key format', 'ERR_INVALID_KEY_FORMAT');\n }\n return {\n kty: 'EC',\n crv: curve,\n x: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(key.subarray(1, byteLen + 1), 'base64url'),\n y: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(key.subarray(1 + byteLen), 'base64url'),\n ext: true\n };\n}\nconst unmarshalPrivateKey = (curve, key) => ({\n ...unmarshalPublicKey(curve, key.public),\n d: (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(key.private, 'base64url')\n});\n//# sourceMappingURL=ecdh-browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ generateKeyFromSeed: () => (/* binding */ generateKeyFromSeed),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ privateKeyLength: () => (/* binding */ PRIVATE_KEY_BYTE_LENGTH),\n/* harmony export */ publicKeyLength: () => (/* binding */ PUBLIC_KEY_BYTE_LENGTH)\n/* harmony export */ });\n/* harmony import */ var _noble_ed25519__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/ed25519 */ \"./node_modules/@noble/ed25519/lib/esm/index.js\");\n\nconst PUBLIC_KEY_BYTE_LENGTH = 32;\nconst PRIVATE_KEY_BYTE_LENGTH = 64; // private key is actually 32 bytes but for historical reasons we concat private and public keys\nconst KEYS_BYTE_LENGTH = 32;\n\n\nasync function generateKey() {\n // the actual private key (32 bytes)\n const privateKeyRaw = _noble_ed25519__WEBPACK_IMPORTED_MODULE_0__.utils.randomPrivateKey();\n const publicKey = await _noble_ed25519__WEBPACK_IMPORTED_MODULE_0__.getPublicKey(privateKeyRaw);\n // concatenated the public key to the private key\n const privateKey = concatKeys(privateKeyRaw, publicKey);\n return {\n privateKey,\n publicKey\n };\n}\n/**\n * Generate keypair from a 32 byte uint8array\n */\nasync function generateKeyFromSeed(seed) {\n if (seed.length !== KEYS_BYTE_LENGTH) {\n throw new TypeError('\"seed\" must be 32 bytes in length.');\n }\n else if (!(seed instanceof Uint8Array)) {\n throw new TypeError('\"seed\" must be a node.js Buffer, or Uint8Array.');\n }\n // based on node forges algorithm, the seed is used directly as private key\n const privateKeyRaw = seed;\n const publicKey = await _noble_ed25519__WEBPACK_IMPORTED_MODULE_0__.getPublicKey(privateKeyRaw);\n const privateKey = concatKeys(privateKeyRaw, publicKey);\n return {\n privateKey,\n publicKey\n };\n}\nasync function hashAndSign(privateKey, msg) {\n const privateKeyRaw = privateKey.subarray(0, KEYS_BYTE_LENGTH);\n return _noble_ed25519__WEBPACK_IMPORTED_MODULE_0__.sign(msg, privateKeyRaw);\n}\nasync function hashAndVerify(publicKey, sig, msg) {\n return _noble_ed25519__WEBPACK_IMPORTED_MODULE_0__.verify(sig, msg, publicKey);\n}\nfunction concatKeys(privateKeyRaw, publicKey) {\n const privateKey = new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);\n for (let i = 0; i < KEYS_BYTE_LENGTH; i++) {\n privateKey[i] = privateKeyRaw[i];\n privateKey[KEYS_BYTE_LENGTH + i] = publicKey[i];\n }\n return privateKey;\n}\n//# sourceMappingURL=ed25519-browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Ed25519PrivateKey: () => (/* binding */ Ed25519PrivateKey),\n/* harmony export */ Ed25519PublicKey: () => (/* binding */ Ed25519PublicKey),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ generateKeyPairFromSeed: () => (/* binding */ generateKeyPairFromSeed),\n/* harmony export */ unmarshalEd25519PrivateKey: () => (/* binding */ unmarshalEd25519PrivateKey),\n/* harmony export */ unmarshalEd25519PublicKey: () => (/* binding */ unmarshalEd25519PublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/hashes/identity */ \"./node_modules/multiformats/src/hashes/identity.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _ed25519_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ed25519.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ed25519-browser.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n\n\n\n\n\n\n\n\nclass Ed25519PublicKey {\n _key;\n constructor(key) {\n this._key = ensureKey(key, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n }\n async verify(data, sig) {\n return _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.Ed25519,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_4__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const { bytes } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_3__.sha256.digest(this.bytes);\n return bytes;\n }\n}\nclass Ed25519PrivateKey {\n _key;\n _publicKey;\n // key - 64 byte Uint8Array containing private key\n // publicKey - 32 byte Uint8Array containing public key\n constructor(key, publicKey) {\n this._key = ensureKey(key, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n this._publicKey = ensureKey(publicKey, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n }\n async sign(message) {\n return _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.hashAndSign(this._key, message);\n }\n get public() {\n return new Ed25519PublicKey(this._publicKey);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.Ed25519,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_4__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const { bytes } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_3__.sha256.digest(this.bytes);\n return bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the identity multihash containing its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n *\n * @returns {Promise}\n */\n async id() {\n const encoding = multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_2__.identity.digest(this.public.bytes);\n return multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_1__.base58btc.encode(encoding.bytes).substring(1);\n }\n /**\n * Exports the key into a password protected `format`\n */\n async export(password, format = 'libp2p-key') {\n if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_6__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nfunction unmarshalEd25519PrivateKey(bytes) {\n // Try the old, redundant public key version\n if (bytes.length > _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength) {\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength + _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n const privateKeyBytes = bytes.subarray(0, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n const publicKeyBytes = bytes.subarray(_ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength, bytes.length);\n return new Ed25519PrivateKey(privateKeyBytes, publicKeyBytes);\n }\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n const privateKeyBytes = bytes.subarray(0, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.privateKeyLength);\n const publicKeyBytes = bytes.subarray(_ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n return new Ed25519PrivateKey(privateKeyBytes, publicKeyBytes);\n}\nfunction unmarshalEd25519PublicKey(bytes) {\n bytes = ensureKey(bytes, _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.publicKeyLength);\n return new Ed25519PublicKey(bytes);\n}\nasync function generateKeyPair() {\n const { privateKey, publicKey } = await _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.generateKey();\n return new Ed25519PrivateKey(privateKey, publicKey);\n}\nasync function generateKeyPairFromSeed(seed) {\n const { privateKey, publicKey } = await _ed25519_js__WEBPACK_IMPORTED_MODULE_5__.generateKeyFromSeed(seed);\n return new Ed25519PrivateKey(privateKey, publicKey);\n}\nfunction ensureKey(key, length) {\n key = Uint8Array.from(key ?? []);\n if (key.length !== length) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`Key must be a Uint8Array of length ${length}, got ${key.length}`, 'ERR_INVALID_KEY_TYPE');\n }\n return key;\n}\n//# sourceMappingURL=ed25519-class.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ecdh_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ecdh.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ecdh-browser.js\");\n\n/**\n * Generates an ephemeral public key and returns a function that will compute\n * the shared secret key.\n *\n * Focuses only on ECDH now, but can be made more general in the future.\n */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_ecdh_js__WEBPACK_IMPORTED_MODULE_0__.generateEphmeralKeyPair);\n//# sourceMappingURL=ephemeral-keys.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/exporter.js": +/*!***************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/exporter.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ exporter: () => (/* binding */ exporter)\n/* harmony export */ });\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/src/bases/base64.js\");\n/* harmony import */ var _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ciphers/aes-gcm.js */ \"./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js\");\n\n\n/**\n * Exports the given PrivateKey as a base64 encoded string.\n * The PrivateKey is encrypted via a password derived PBKDF2 key\n * leveraging the aes-gcm cipher algorithm.\n */\nasync function exporter(privateKey, password) {\n const cipher = _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__.create();\n const encryptedKey = await cipher.encrypt(privateKey, password);\n return multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__.base64.encode(encryptedKey);\n}\n//# sourceMappingURL=exporter.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/exporter.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/importer.js": +/*!***************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/importer.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ importer: () => (/* binding */ importer)\n/* harmony export */ });\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/src/bases/base64.js\");\n/* harmony import */ var _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ciphers/aes-gcm.js */ \"./node_modules/@libp2p/crypto/dist/src/ciphers/aes-gcm.browser.js\");\n\n\n/**\n * Attempts to decrypt a base64 encoded PrivateKey string\n * with the given password. The privateKey must have been exported\n * using the same password and underlying cipher (aes-gcm)\n */\nasync function importer(privateKey, password) {\n const encryptedKey = multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_0__.base64.decode(privateKey);\n const cipher = _ciphers_aes_gcm_js__WEBPACK_IMPORTED_MODULE_1__.create();\n return cipher.decrypt(encryptedKey, password);\n}\n//# sourceMappingURL=importer.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/importer.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateEphemeralKeyPair: () => (/* reexport safe */ _ephemeral_keys_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ generateKeyPairFromSeed: () => (/* binding */ generateKeyPairFromSeed),\n/* harmony export */ importKey: () => (/* binding */ importKey),\n/* harmony export */ keyStretcher: () => (/* reexport safe */ _key_stretcher_js__WEBPACK_IMPORTED_MODULE_8__.keyStretcher),\n/* harmony export */ keysPBM: () => (/* reexport module object */ _keys_js__WEBPACK_IMPORTED_MODULE_9__),\n/* harmony export */ marshalPrivateKey: () => (/* binding */ marshalPrivateKey),\n/* harmony export */ marshalPublicKey: () => (/* binding */ marshalPublicKey),\n/* harmony export */ supportedKeys: () => (/* binding */ supportedKeys),\n/* harmony export */ unmarshalPrivateKey: () => (/* binding */ unmarshalPrivateKey),\n/* harmony export */ unmarshalPublicKey: () => (/* binding */ unmarshalPublicKey)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_asn1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/asn1.js */ \"./node_modules/node-forge/lib/asn1.js\");\n/* harmony import */ var node_forge_lib_pbe_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/pbe.js */ \"./node_modules/node-forge/lib/pbe.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _ed25519_class_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ed25519-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.js\");\n/* harmony import */ var _ephemeral_keys_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ephemeral-keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.js\");\n/* harmony import */ var _importer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./importer.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/importer.js\");\n/* harmony import */ var _key_stretcher_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./key-stretcher.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _rsa_class_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./rsa-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js\");\n/* harmony import */ var _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./secp256k1-class.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js\");\n\n\n\n// @ts-expect-error types are missing\n\n\n\n\n\n\n\n\n\n\n\n\nconst supportedKeys = {\n rsa: _rsa_class_js__WEBPACK_IMPORTED_MODULE_10__,\n ed25519: _ed25519_class_js__WEBPACK_IMPORTED_MODULE_5__,\n secp256k1: _secp256k1_class_js__WEBPACK_IMPORTED_MODULE_11__\n};\nfunction unsupportedKey(type) {\n const supported = Object.keys(supportedKeys).join(' / ');\n return new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`invalid or unsupported key type ${type}. Must be ${supported}`, 'ERR_UNSUPPORTED_KEY_TYPE');\n}\nfunction typeToKey(type) {\n type = type.toLowerCase();\n if (type === 'rsa' || type === 'ed25519' || type === 'secp256k1') {\n return supportedKeys[type];\n }\n throw unsupportedKey(type);\n}\n// Generates a keypair of the given type and bitsize\nasync function generateKeyPair(type, bits) {\n return typeToKey(type).generateKeyPair(bits ?? 2048);\n}\n// Generates a keypair of the given type and bitsize\n// seed is a 32 byte uint8array\nasync function generateKeyPairFromSeed(type, seed, bits) {\n if (type.toLowerCase() !== 'ed25519') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Seed key derivation is unimplemented for RSA or secp256k1', 'ERR_UNSUPPORTED_KEY_DERIVATION_TYPE');\n }\n return _ed25519_class_js__WEBPACK_IMPORTED_MODULE_5__.generateKeyPairFromSeed(seed);\n}\n// Converts a protobuf serialized public key into its\n// representative object\nfunction unmarshalPublicKey(buf) {\n const decoded = _keys_js__WEBPACK_IMPORTED_MODULE_9__.PublicKey.decode(buf);\n const data = decoded.Data ?? new Uint8Array();\n switch (decoded.Type) {\n case _keys_js__WEBPACK_IMPORTED_MODULE_9__.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPublicKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_9__.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PublicKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_9__.KeyType.Secp256k1:\n return supportedKeys.secp256k1.unmarshalSecp256k1PublicKey(data);\n default:\n throw unsupportedKey(decoded.Type ?? 'RSA');\n }\n}\n// Converts a public key object into a protobuf serialized public key\nfunction marshalPublicKey(key, type) {\n type = (type ?? 'rsa').toLowerCase();\n typeToKey(type); // check type\n return key.bytes;\n}\n// Converts a protobuf serialized private key into its\n// representative object\nasync function unmarshalPrivateKey(buf) {\n const decoded = _keys_js__WEBPACK_IMPORTED_MODULE_9__.PrivateKey.decode(buf);\n const data = decoded.Data ?? new Uint8Array();\n switch (decoded.Type) {\n case _keys_js__WEBPACK_IMPORTED_MODULE_9__.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPrivateKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_9__.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PrivateKey(data);\n case _keys_js__WEBPACK_IMPORTED_MODULE_9__.KeyType.Secp256k1:\n return supportedKeys.secp256k1.unmarshalSecp256k1PrivateKey(data);\n default:\n throw unsupportedKey(decoded.Type ?? 'RSA');\n }\n}\n// Converts a private key object into a protobuf serialized private key\nfunction marshalPrivateKey(key, type) {\n type = (type ?? 'rsa').toLowerCase();\n typeToKey(type); // check type\n return key.bytes;\n}\n/**\n *\n * @param {string} encryptedKey\n * @param {string} password\n */\nasync function importKey(encryptedKey, password) {\n try {\n const key = await (0,_importer_js__WEBPACK_IMPORTED_MODULE_7__.importer)(encryptedKey, password);\n return await unmarshalPrivateKey(key);\n }\n catch (_) {\n // Ignore and try the old pem decrypt\n }\n // Only rsa supports pem right now\n const key = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.pki.decryptRsaPrivateKey(encryptedKey, password);\n if (key === null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Cannot read the key, most likely the password is wrong or not a RSA key', 'ERR_CANNOT_DECRYPT_PEM');\n }\n let der = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.asn1.toDer(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.pki.privateKeyToAsn1(key));\n der = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(der.getBytes(), 'ascii');\n return supportedKeys.rsa.unmarshalRsaPrivateKey(der);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js": +/*!**************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ jwk2priv: () => (/* binding */ jwk2priv),\n/* harmony export */ jwk2pub: () => (/* binding */ jwk2pub)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_rsa_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/rsa.js */ \"./node_modules/node-forge/lib/rsa.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n\n// @ts-expect-error types are missing\n\n\nfunction convert(key, types) {\n return types.map(t => (0,_util_js__WEBPACK_IMPORTED_MODULE_2__.base64urlToBigInteger)(key[t]));\n}\nfunction jwk2priv(key) {\n return node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.pki.setRsaPrivateKey(...convert(key, ['n', 'e', 'd', 'p', 'q', 'dp', 'dq', 'qi']));\n}\nfunction jwk2pub(key) {\n return node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_1__.pki.setRsaPublicKey(...convert(key, ['n', 'e']));\n}\n//# sourceMappingURL=jwk2pem.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keyStretcher: () => (/* binding */ keyStretcher)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _hmac_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hmac/index.js */ \"./node_modules/@libp2p/crypto/dist/src/hmac/index-browser.js\");\n\n\n\n\nconst cipherMap = {\n 'AES-128': {\n ivSize: 16,\n keySize: 16\n },\n 'AES-256': {\n ivSize: 16,\n keySize: 32\n },\n Blowfish: {\n ivSize: 8,\n keySize: 32\n }\n};\n/**\n * Generates a set of keys for each party by stretching the shared key.\n * (myIV, theirIV, myCipherKey, theirCipherKey, myMACKey, theirMACKey)\n */\nasync function keyStretcher(cipherType, hash, secret) {\n const cipher = cipherMap[cipherType];\n if (cipher == null) {\n const allowed = Object.keys(cipherMap).join(' / ');\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`unknown cipher type '${cipherType}'. Must be ${allowed}`, 'ERR_INVALID_CIPHER_TYPE');\n }\n if (hash == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('missing hash type', 'ERR_MISSING_HASH_TYPE');\n }\n const cipherKeySize = cipher.keySize;\n const ivSize = cipher.ivSize;\n const hmacKeySize = 20;\n const seed = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)('key expansion');\n const resultLength = 2 * (ivSize + cipherKeySize + hmacKeySize);\n const m = await _hmac_index_js__WEBPACK_IMPORTED_MODULE_3__.create(hash, secret);\n let a = await m.digest(seed);\n const result = [];\n let j = 0;\n while (j < resultLength) {\n const b = await m.digest((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)([a, seed]));\n let todo = b.length;\n if (j + todo > resultLength) {\n todo = resultLength - j;\n }\n result.push(b);\n j += todo;\n a = await m.digest(a);\n }\n const half = resultLength / 2;\n const resultBuffer = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_1__.concat)(result);\n const r1 = resultBuffer.subarray(0, half);\n const r2 = resultBuffer.subarray(half, resultLength);\n const createKey = (res) => ({\n iv: res.subarray(0, ivSize),\n cipherKey: res.subarray(ivSize, ivSize + cipherKeySize),\n macKey: res.subarray(ivSize + cipherKeySize)\n });\n return {\n k1: createKey(r1),\n k2: createKey(r2)\n };\n}\n//# sourceMappingURL=key-stretcher.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/keys.js": +/*!***********************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/keys.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KeyType: () => (/* binding */ KeyType),\n/* harmony export */ PrivateKey: () => (/* binding */ PrivateKey),\n/* harmony export */ PublicKey: () => (/* binding */ PublicKey)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar KeyType;\n(function (KeyType) {\n KeyType[\"RSA\"] = \"RSA\";\n KeyType[\"Ed25519\"] = \"Ed25519\";\n KeyType[\"Secp256k1\"] = \"Secp256k1\";\n})(KeyType || (KeyType = {}));\nvar __KeyTypeValues;\n(function (__KeyTypeValues) {\n __KeyTypeValues[__KeyTypeValues[\"RSA\"] = 0] = \"RSA\";\n __KeyTypeValues[__KeyTypeValues[\"Ed25519\"] = 1] = \"Ed25519\";\n __KeyTypeValues[__KeyTypeValues[\"Secp256k1\"] = 2] = \"Secp256k1\";\n})(__KeyTypeValues || (__KeyTypeValues = {}));\n(function (KeyType) {\n KeyType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__KeyTypeValues);\n };\n})(KeyType || (KeyType = {}));\nvar PublicKey;\n(function (PublicKey) {\n let _codec;\n PublicKey.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.Type != null) {\n w.uint32(8);\n KeyType.codec().encode(obj.Type, w);\n }\n if (obj.Data != null) {\n w.uint32(18);\n w.bytes(obj.Data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.Type = KeyType.codec().decode(reader);\n break;\n case 2:\n obj.Data = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PublicKey.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PublicKey.codec());\n };\n PublicKey.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PublicKey.codec());\n };\n})(PublicKey || (PublicKey = {}));\nvar PrivateKey;\n(function (PrivateKey) {\n let _codec;\n PrivateKey.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.Type != null) {\n w.uint32(8);\n KeyType.codec().encode(obj.Type, w);\n }\n if (obj.Data != null) {\n w.uint32(18);\n w.bytes(obj.Data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.Type = KeyType.codec().decode(reader);\n break;\n case 2:\n obj.Data = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PrivateKey.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PrivateKey.codec());\n };\n PrivateKey.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PrivateKey.codec());\n };\n})(PrivateKey || (PrivateKey = {}));\n//# sourceMappingURL=keys.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/keys.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js": +/*!******************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decrypt: () => (/* binding */ decrypt),\n/* harmony export */ encrypt: () => (/* binding */ encrypt),\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ getRandomValues: () => (/* reexport safe */ _random_bytes_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ unmarshalPrivateKey: () => (/* binding */ unmarshalPrivateKey),\n/* harmony export */ utils: () => (/* reexport module object */ _rsa_utils_js__WEBPACK_IMPORTED_MODULE_6__)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _random_bytes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../random-bytes.js */ \"./node_modules/@libp2p/crypto/dist/src/random-bytes.js\");\n/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../webcrypto.js */ \"./node_modules/@libp2p/crypto/dist/src/webcrypto.js\");\n/* harmony import */ var _jwk2pem_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./jwk2pem.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/jwk2pem.js\");\n/* harmony import */ var _rsa_utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./rsa-utils.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js\");\n\n\n\n\n\n\n\n\nasync function generateKey(bits) {\n const pair = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.generateKey({\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: { name: 'SHA-256' }\n }, true, ['sign', 'verify']);\n const keys = await exportKey(pair);\n return {\n privateKey: keys[0],\n publicKey: keys[1]\n };\n}\n// Takes a jwk key\nasync function unmarshalPrivateKey(key) {\n const privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, true, ['sign']);\n const pair = [\n privateKey,\n await derivePublicFromPrivate(key)\n ];\n const keys = await exportKey({\n privateKey: pair[0],\n publicKey: pair[1]\n });\n return {\n privateKey: keys[0],\n publicKey: keys[1]\n };\n}\n\nasync function hashAndSign(key, msg) {\n const privateKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, false, ['sign']);\n const sig = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, privateKey, Uint8Array.from(msg));\n return new Uint8Array(sig, 0, sig.byteLength);\n}\nasync function hashAndVerify(key, sig, msg) {\n const publicKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', key, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, false, ['verify']);\n return _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.verify({ name: 'RSASSA-PKCS1-v1_5' }, publicKey, sig, msg);\n}\nasync function exportKey(pair) {\n if (pair.privateKey == null || pair.publicKey == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Private and public key are required', 'ERR_INVALID_PARAMETERS');\n }\n return Promise.all([\n _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.exportKey('jwk', pair.privateKey),\n _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.exportKey('jwk', pair.publicKey)\n ]);\n}\nasync function derivePublicFromPrivate(jwKey) {\n return _webcrypto_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].get().subtle.importKey('jwk', {\n kty: jwKey.kty,\n n: jwKey.n,\n e: jwKey.e\n }, {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n }, true, ['verify']);\n}\n/*\n\nRSA encryption/decryption for the browser with webcrypto workaround\n\"bloody dark magic. webcrypto's why.\"\n\nExplanation:\n - Convert JWK to nodeForge\n - Convert msg Uint8Array to nodeForge buffer: ByteBuffer is a \"binary-string backed buffer\", so let's make our Uint8Array a binary string\n - Convert resulting nodeForge buffer to Uint8Array: it returns a binary string, turn that into a Uint8Array\n\n*/\nfunction convertKey(key, pub, msg, handle) {\n const fkey = pub ? (0,_jwk2pem_js__WEBPACK_IMPORTED_MODULE_5__.jwk2pub)(key) : (0,_jwk2pem_js__WEBPACK_IMPORTED_MODULE_5__.jwk2priv)(key);\n const fmsg = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_2__.toString)(Uint8Array.from(msg), 'ascii');\n const fomsg = handle(fmsg, fkey);\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(fomsg, 'ascii');\n}\nfunction encrypt(key, msg) {\n return convertKey(key, true, msg, (msg, key) => key.encrypt(msg));\n}\nfunction decrypt(key, msg) {\n return convertKey(key, false, msg, (msg, key) => key.decrypt(msg));\n}\n//# sourceMappingURL=rsa-browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RsaPrivateKey: () => (/* binding */ RsaPrivateKey),\n/* harmony export */ RsaPublicKey: () => (/* binding */ RsaPublicKey),\n/* harmony export */ fromJwk: () => (/* binding */ fromJwk),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ unmarshalRsaPrivateKey: () => (/* binding */ unmarshalRsaPrivateKey),\n/* harmony export */ unmarshalRsaPublicKey: () => (/* binding */ unmarshalRsaPublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var node_forge_lib_sha512_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! node-forge/lib/sha512.js */ \"./node_modules/node-forge/lib/sha512.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _rsa_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rsa.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/rsa-browser.js\");\n\n\n// @ts-expect-error types are missing\n\n\n\n\n\n\n\nclass RsaPublicKey {\n _key;\n constructor(key) {\n this._key = key;\n }\n async verify(data, sig) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.jwkToPkix(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.RSA,\n Data: this.marshal()\n }).subarray();\n }\n encrypt(bytes) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.encrypt(this._key, bytes);\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const { bytes } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_1__.sha256.digest(this.bytes);\n return bytes;\n }\n}\nclass RsaPrivateKey {\n _key;\n _publicKey;\n constructor(key, publicKey) {\n this._key = key;\n this._publicKey = publicKey;\n }\n genSecret() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.getRandomValues(16);\n }\n async sign(message) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.hashAndSign(this._key, message);\n }\n get public() {\n if (this._publicKey == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('public key not provided', 'ERR_PUBKEY_NOT_PROVIDED');\n }\n return new RsaPublicKey(this._publicKey);\n }\n decrypt(bytes) {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.decrypt(this._key, bytes);\n }\n marshal() {\n return _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.jwkToPkcs1(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_7__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_7__.KeyType.RSA,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const { bytes } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_1__.sha256.digest(this.bytes);\n return bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the SHA-256 multihash of its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n */\n async id() {\n const hash = await this.public.hash();\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(hash, 'base58btc');\n }\n /**\n * Exports the key into a password protected PEM format\n */\n async export(password, format = 'pkcs-8') {\n if (format === 'pkcs-8') {\n const buffer = new node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.util.ByteBuffer(this.marshal());\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.asn1.fromDer(buffer);\n const privateKey = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.privateKeyFromAsn1(asn1);\n const options = {\n algorithm: 'aes256',\n count: 10000,\n saltSize: 128 / 8,\n prfAlgorithm: 'sha512'\n };\n return node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.pki.encryptRsaPrivateKey(privateKey, password, options);\n }\n else if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_6__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nasync function unmarshalRsaPrivateKey(bytes) {\n const jwk = _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.pkcs1ToJwk(bytes);\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_8__.unmarshalPrivateKey(jwk);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\nfunction unmarshalRsaPublicKey(bytes) {\n const jwk = _rsa_js__WEBPACK_IMPORTED_MODULE_8__.utils.pkixToJwk(bytes);\n return new RsaPublicKey(jwk);\n}\nasync function fromJwk(jwk) {\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_8__.unmarshalPrivateKey(jwk);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\nasync function generateKeyPair(bits) {\n const keys = await _rsa_js__WEBPACK_IMPORTED_MODULE_8__.generateKey(bits);\n return new RsaPrivateKey(keys.privateKey, keys.publicKey);\n}\n//# sourceMappingURL=rsa-class.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/rsa-class.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ jwkToPkcs1: () => (/* binding */ jwkToPkcs1),\n/* harmony export */ jwkToPkix: () => (/* binding */ jwkToPkix),\n/* harmony export */ pkcs1ToJwk: () => (/* binding */ pkcs1ToJwk),\n/* harmony export */ pkixToJwk: () => (/* binding */ pkixToJwk)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_asn1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/asn1.js */ \"./node_modules/node-forge/lib/asn1.js\");\n/* harmony import */ var node_forge_lib_rsa_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/rsa.js */ \"./node_modules/node-forge/lib/rsa.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../util.js */ \"./node_modules/@libp2p/crypto/dist/src/util.js\");\n\n\n\n// @ts-expect-error types are missing\n\n\n\n\n// Convert a PKCS#1 in ASN1 DER format to a JWK key\nfunction pkcs1ToJwk(bytes) {\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.asn1.fromDer((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(bytes, 'ascii'));\n const privateKey = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.pki.privateKeyFromAsn1(asn1);\n // https://tools.ietf.org/html/rfc7518#section-6.3.1\n return {\n kty: 'RSA',\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.e),\n d: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.d),\n p: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.p),\n q: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.q),\n dp: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.dP),\n dq: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.dQ),\n qi: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(privateKey.qInv),\n alg: 'RS256'\n };\n}\n// Convert a JWK key into PKCS#1 in ASN1 DER format\nfunction jwkToPkcs1(jwk) {\n if (jwk.n == null || jwk.e == null || jwk.d == null || jwk.p == null || jwk.q == null || jwk.dp == null || jwk.dq == null || jwk.qi == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.pki.privateKeyToAsn1({\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.e),\n d: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.d),\n p: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.p),\n q: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.q),\n dP: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.dp),\n dQ: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.dq),\n qInv: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.qi)\n });\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.asn1.toDer(asn1).getBytes(), 'ascii');\n}\n// Convert a PKCIX in ASN1 DER format to a JWK key\nfunction pkixToJwk(bytes) {\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.asn1.fromDer((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(bytes, 'ascii'));\n const publicKey = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.pki.publicKeyFromAsn1(asn1);\n return {\n kty: 'RSA',\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(publicKey.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.bigIntegerToUintBase64url)(publicKey.e)\n };\n}\n// Convert a JWK key to PKCIX in ASN1 DER format\nfunction jwkToPkix(jwk) {\n if (jwk.n == null || jwk.e == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('JWK was missing components', 'ERR_INVALID_PARAMETERS');\n }\n const asn1 = node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.pki.publicKeyToAsn1({\n n: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.n),\n e: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.base64urlToBigInteger)(jwk.e)\n });\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_3__.asn1.toDer(asn1).getBytes(), 'ascii');\n}\n//# sourceMappingURL=rsa-utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/rsa-utils.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Secp256k1PrivateKey: () => (/* binding */ Secp256k1PrivateKey),\n/* harmony export */ Secp256k1PublicKey: () => (/* binding */ Secp256k1PublicKey),\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ unmarshalSecp256k1PrivateKey: () => (/* binding */ unmarshalSecp256k1PrivateKey),\n/* harmony export */ unmarshalSecp256k1PublicKey: () => (/* binding */ unmarshalSecp256k1PublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _exporter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./exporter.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/exporter.js\");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/keys.js\");\n/* harmony import */ var _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./secp256k1.js */ \"./node_modules/@libp2p/crypto/dist/src/keys/secp256k1.js\");\n\n\n\n\n\n\n\nclass Secp256k1PublicKey {\n _key;\n constructor(key) {\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.validatePublicKey(key);\n this._key = key;\n }\n async verify(data, sig) {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.hashAndVerify(this._key, sig, data);\n }\n marshal() {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.compressPublicKey(this._key);\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PublicKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.Secp256k1,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const { bytes } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_1__.sha256.digest(this.bytes);\n return bytes;\n }\n}\nclass Secp256k1PrivateKey {\n _key;\n _publicKey;\n constructor(key, publicKey) {\n this._key = key;\n this._publicKey = publicKey ?? _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.computePublicKey(key);\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.validatePrivateKey(this._key);\n _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.validatePublicKey(this._publicKey);\n }\n async sign(message) {\n return _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.hashAndSign(this._key, message);\n }\n get public() {\n return new Secp256k1PublicKey(this._publicKey);\n }\n marshal() {\n return this._key;\n }\n get bytes() {\n return _keys_js__WEBPACK_IMPORTED_MODULE_5__.PrivateKey.encode({\n Type: _keys_js__WEBPACK_IMPORTED_MODULE_5__.KeyType.Secp256k1,\n Data: this.marshal()\n }).subarray();\n }\n equals(key) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_2__.equals)(this.bytes, key.bytes);\n }\n async hash() {\n const { bytes } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_1__.sha256.digest(this.bytes);\n return bytes;\n }\n /**\n * Gets the ID of the key.\n *\n * The key id is the base58 encoding of the SHA-256 multihash of its public key.\n * The public key is a protobuf encoding containing a type and the DER encoding\n * of the PKCS SubjectPublicKeyInfo.\n */\n async id() {\n const hash = await this.public.hash();\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_3__.toString)(hash, 'base58btc');\n }\n /**\n * Exports the key into a password protected `format`\n */\n async export(password, format = 'libp2p-key') {\n if (format === 'libp2p-key') {\n return (0,_exporter_js__WEBPACK_IMPORTED_MODULE_4__.exporter)(this.bytes, password);\n }\n else {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`export format '${format}' is not supported`, 'ERR_INVALID_EXPORT_FORMAT');\n }\n }\n}\nfunction unmarshalSecp256k1PrivateKey(bytes) {\n return new Secp256k1PrivateKey(bytes);\n}\nfunction unmarshalSecp256k1PublicKey(bytes) {\n return new Secp256k1PublicKey(bytes);\n}\nasync function generateKeyPair() {\n const privateKeyBytes = _secp256k1_js__WEBPACK_IMPORTED_MODULE_6__.generateKey();\n return new Secp256k1PrivateKey(privateKeyBytes);\n}\n//# sourceMappingURL=secp256k1-class.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/keys/secp256k1.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/keys/secp256k1.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compressPublicKey: () => (/* binding */ compressPublicKey),\n/* harmony export */ computePublicKey: () => (/* binding */ computePublicKey),\n/* harmony export */ decompressPublicKey: () => (/* binding */ decompressPublicKey),\n/* harmony export */ generateKey: () => (/* binding */ generateKey),\n/* harmony export */ hashAndSign: () => (/* binding */ hashAndSign),\n/* harmony export */ hashAndVerify: () => (/* binding */ hashAndVerify),\n/* harmony export */ privateKeyLength: () => (/* binding */ PRIVATE_KEY_BYTE_LENGTH),\n/* harmony export */ validatePrivateKey: () => (/* binding */ validatePrivateKey),\n/* harmony export */ validatePublicKey: () => (/* binding */ validatePublicKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/secp256k1 */ \"./node_modules/@noble/secp256k1/lib/esm/index.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n\n\n\nconst PRIVATE_KEY_BYTE_LENGTH = 32;\n\nfunction generateKey() {\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.utils.randomPrivateKey();\n}\n/**\n * Hash and sign message with private key\n */\nasync function hashAndSign(key, msg) {\n const { digest } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256.digest(msg);\n try {\n return await _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.sign(digest, key);\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(String(err), 'ERR_INVALID_INPUT');\n }\n}\n/**\n * Hash message and verify signature with public key\n */\nasync function hashAndVerify(key, sig, msg) {\n try {\n const { digest } = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256.digest(msg);\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.verify(sig, digest, key);\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(String(err), 'ERR_INVALID_INPUT');\n }\n}\nfunction compressPublicKey(key) {\n const point = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.Point.fromHex(key).toRawBytes(true);\n return point;\n}\nfunction decompressPublicKey(key) {\n const point = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.Point.fromHex(key).toRawBytes(false);\n return point;\n}\nfunction validatePrivateKey(key) {\n try {\n _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.getPublicKey(key, true);\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(String(err), 'ERR_INVALID_PRIVATE_KEY');\n }\n}\nfunction validatePublicKey(key) {\n try {\n _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.Point.fromHex(key);\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(String(err), 'ERR_INVALID_PUBLIC_KEY');\n }\n}\nfunction computePublicKey(privateKey) {\n try {\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.getPublicKey(privateKey, true);\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(String(err), 'ERR_INVALID_PRIVATE_KEY');\n }\n}\n//# sourceMappingURL=secp256k1.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/keys/secp256k1.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/pbkdf2.js": +/*!********************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/pbkdf2.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ pbkdf2)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var node_forge_lib_pbkdf2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/pbkdf2.js */ \"./node_modules/node-forge/lib/pbkdf2.js\");\n/* harmony import */ var node_forge_lib_util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-forge/lib/util.js */ \"./node_modules/node-forge/lib/util.js\");\n\n// @ts-expect-error types are missing\n\n// @ts-expect-error types are missing\n\n/**\n * Maps an IPFS hash name to its node-forge equivalent.\n *\n * See https://github.com/multiformats/multihash/blob/master/hashtable.csv\n *\n * @private\n */\nconst hashName = {\n sha1: 'sha1',\n 'sha2-256': 'sha256',\n 'sha2-512': 'sha512'\n};\n/**\n * Computes the Password-Based Key Derivation Function 2.\n */\nfunction pbkdf2(password, salt, iterations, keySize, hash) {\n if (hash !== 'sha1' && hash !== 'sha2-256' && hash !== 'sha2-512') {\n const types = Object.keys(hashName).join(' / ');\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`Hash '${hash}' is unknown or not supported. Must be ${types}`, 'ERR_UNSUPPORTED_HASH_TYPE');\n }\n const hasher = hashName[hash];\n const dek = node_forge_lib_pbkdf2_js__WEBPACK_IMPORTED_MODULE_1__(password, salt, iterations, keySize, hasher);\n return node_forge_lib_util_js__WEBPACK_IMPORTED_MODULE_2__.encode64(dek, null);\n}\n//# sourceMappingURL=pbkdf2.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/pbkdf2.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/random-bytes.js": +/*!**************************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/random-bytes.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ randomBytes)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/secp256k1 */ \"./node_modules/@noble/secp256k1/lib/esm/index.js\");\n\n\nfunction randomBytes(length) {\n if (isNaN(length) || length <= 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('random bytes length must be a Number bigger than 0', 'ERR_INVALID_LENGTH');\n }\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_1__.utils.randomBytes(length);\n}\n//# sourceMappingURL=random-bytes.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/random-bytes.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/util.js": +/*!******************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/util.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64urlToBigInteger: () => (/* binding */ base64urlToBigInteger),\n/* harmony export */ base64urlToBuffer: () => (/* binding */ base64urlToBuffer),\n/* harmony export */ bigIntegerToUintBase64url: () => (/* binding */ bigIntegerToUintBase64url)\n/* harmony export */ });\n/* harmony import */ var node_forge_lib_util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-forge/lib/util.js */ \"./node_modules/node-forge/lib/util.js\");\n/* harmony import */ var node_forge_lib_jsbn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! node-forge/lib/jsbn.js */ \"./node_modules/node-forge/lib/jsbn.js\");\n/* harmony import */ var node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-forge/lib/forge.js */ \"./node_modules/node-forge/lib/forge.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n// @ts-expect-error types are missing\n\n\n\n\nfunction bigIntegerToUintBase64url(num, len) {\n // Call `.abs()` to convert to unsigned\n let buf = Uint8Array.from(num.abs().toByteArray()); // toByteArray converts to big endian\n // toByteArray() gives us back a signed array, which will include a leading 0\n // byte if the most significant bit of the number is 1:\n // https://docs.microsoft.com/en-us/windows/win32/seccertenroll/about-integer\n // Our number will always be positive so we should remove the leading padding.\n buf = buf[0] === 0 ? buf.subarray(1) : buf;\n if (len != null) {\n if (buf.length > len)\n throw new Error('byte array longer than desired length');\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_3__.concat)([new Uint8Array(len - buf.length), buf]);\n }\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(buf, 'base64url');\n}\n// Convert a base64url encoded string to a BigInteger\nfunction base64urlToBigInteger(str) {\n const buf = base64urlToBuffer(str);\n return new node_forge_lib_forge_js__WEBPACK_IMPORTED_MODULE_2__.jsbn.BigInteger((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(buf, 'base16'), 16);\n}\nfunction base64urlToBuffer(str, len) {\n let buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(str, 'base64urlpad');\n if (len != null) {\n if (buf.length > len)\n throw new Error('byte array longer than desired length');\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_3__.concat)([new Uint8Array(len - buf.length), buf]);\n }\n return buf;\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/util.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/crypto/dist/src/webcrypto.js": +/*!***********************************************************!*\ + !*** ./node_modules/@libp2p/crypto/dist/src/webcrypto.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-env browser */\n// Check native crypto exists and is enabled (In insecure context `self.crypto`\n// exists but `self.crypto.subtle` does not).\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n get(win = globalThis) {\n const nativeCrypto = win.crypto;\n if (nativeCrypto == null || nativeCrypto.subtle == null) {\n throw Object.assign(new Error('Missing Web Crypto API. ' +\n 'The most likely cause of this error is that this page is being accessed ' +\n 'from an insecure context (i.e. not HTTPS). For more information and ' +\n 'possible resolutions see ' +\n 'https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api'), { code: 'ERR_MISSING_WEB_CRYPTO' });\n }\n return nativeCrypto;\n }\n});\n//# sourceMappingURL=webcrypto.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/crypto/dist/src/webcrypto.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-connection-encrypter/dist/src/errors.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@libp2p/interface-connection-encrypter/dist/src/errors.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InvalidCryptoExchangeError: () => (/* binding */ InvalidCryptoExchangeError),\n/* harmony export */ InvalidCryptoTransmissionError: () => (/* binding */ InvalidCryptoTransmissionError),\n/* harmony export */ UnexpectedPeerError: () => (/* binding */ UnexpectedPeerError)\n/* harmony export */ });\nclass UnexpectedPeerError extends Error {\n code;\n constructor(message = 'Unexpected Peer') {\n super(message);\n this.code = UnexpectedPeerError.code;\n }\n static code = 'ERR_UNEXPECTED_PEER';\n}\nclass InvalidCryptoExchangeError extends Error {\n code;\n constructor(message = 'Invalid crypto exchange') {\n super(message);\n this.code = InvalidCryptoExchangeError.code;\n }\n static code = 'ERR_INVALID_CRYPTO_EXCHANGE';\n}\nclass InvalidCryptoTransmissionError extends Error {\n code;\n constructor(message = 'Invalid crypto transmission') {\n super(message);\n this.code = InvalidCryptoTransmissionError.code;\n }\n static code = 'ERR_INVALID_CRYPTO_TRANSMISSION';\n}\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-connection-encrypter/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-connection/dist/src/index.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@libp2p/interface-connection/dist/src/index.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isConnection: () => (/* binding */ isConnection),\n/* harmony export */ symbol: () => (/* binding */ symbol)\n/* harmony export */ });\nconst symbol = Symbol.for('@libp2p/connection');\nfunction isConnection(other) {\n return other != null && Boolean(other[symbol]);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-connection/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-connection/dist/src/status.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@libp2p/interface-connection/dist/src/status.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CLOSED: () => (/* binding */ CLOSED),\n/* harmony export */ CLOSING: () => (/* binding */ CLOSING),\n/* harmony export */ OPEN: () => (/* binding */ OPEN)\n/* harmony export */ });\nconst OPEN = 'OPEN';\nconst CLOSING = 'CLOSING';\nconst CLOSED = 'CLOSED';\n//# sourceMappingURL=status.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-connection/dist/src/status.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-content-routing/dist/src/index.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@libp2p/interface-content-routing/dist/src/index.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ contentRouting: () => (/* binding */ contentRouting)\n/* harmony export */ });\n/**\n * Any object that implements this Symbol as a property should return a\n * ContentRouting instance as the property value, similar to how\n * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.\n *\n * @example\n *\n * ```js\n * import { contentRouting, ContentRouting } from '@libp2p/content-routing'\n *\n * class MyContentRouter implements ContentRouting {\n * get [contentRouting] () {\n * return this\n * }\n *\n * // ...other methods\n * }\n * ```\n */\nconst contentRouting = Symbol.for('@libp2p/content-routing');\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-content-routing/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-peer-discovery/dist/src/index.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@libp2p/interface-peer-discovery/dist/src/index.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ peerDiscovery: () => (/* binding */ peerDiscovery)\n/* harmony export */ });\n/**\n * Any object that implements this Symbol as a property should return a\n * PeerDiscovery instance as the property value, similar to how\n * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.\n *\n * @example\n *\n * ```js\n * import { peerDiscovery, PeerDiscovery } from '@libp2p/peer-discovery'\n *\n * class MyPeerDiscoverer implements PeerDiscovery {\n * get [peerDiscovery] () {\n * return this\n * }\n *\n * // ...other methods\n * }\n * ```\n */\nconst peerDiscovery = Symbol.for('@libp2p/peer-discovery');\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-peer-discovery/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-peer-id/dist/src/index.js": +/*!******************************************************************!*\ + !*** ./node_modules/@libp2p/interface-peer-id/dist/src/index.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPeerId: () => (/* binding */ isPeerId),\n/* harmony export */ symbol: () => (/* binding */ symbol)\n/* harmony export */ });\nconst symbol = Symbol.for('@libp2p/peer-id');\nfunction isPeerId(other) {\n return other != null && Boolean(other[symbol]);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-peer-id/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-peer-routing/dist/src/index.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@libp2p/interface-peer-routing/dist/src/index.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ peerRouting: () => (/* binding */ peerRouting)\n/* harmony export */ });\n/**\n * Any object that implements this Symbol as a property should return a\n * PeerRouting instance as the property value, similar to how\n * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.\n *\n * @example\n *\n * ```js\n * import { peerRouting, PeerRouting } from '@libp2p/peer-routing'\n *\n * class MyPeerRouter implements PeerRouting {\n * get [peerRouting] () {\n * return this\n * }\n *\n * // ...other methods\n * }\n * ```\n */\nconst peerRouting = Symbol.for('@libp2p/peer-routing');\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-peer-routing/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-peer-store/dist/src/tags.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/interface-peer-store/dist/src/tags.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KEEP_ALIVE: () => (/* binding */ KEEP_ALIVE)\n/* harmony export */ });\nconst KEEP_ALIVE = 'keep-alive';\n//# sourceMappingURL=tags.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-peer-store/dist/src/tags.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-pubsub/dist/src/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@libp2p/interface-pubsub/dist/src/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StrictNoSign: () => (/* binding */ StrictNoSign),\n/* harmony export */ StrictSign: () => (/* binding */ StrictSign),\n/* harmony export */ TopicValidatorResult: () => (/* binding */ TopicValidatorResult)\n/* harmony export */ });\n/**\n * On the producing side:\n * * Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.\n *\n * On the consuming side:\n * * Enforce the fields to be present, reject otherwise.\n * * Propagate only if the fields are valid and signature can be verified, reject otherwise.\n */\nconst StrictSign = 'StrictSign';\n/**\n * On the producing side:\n * * Build messages without the signature, key, from and seqno fields.\n * * The corresponding protobuf key-value pairs are absent from the marshalled message, not just empty.\n *\n * On the consuming side:\n * * Enforce the fields to be absent, reject otherwise.\n * * Propagate only if the fields are absent, reject otherwise.\n * * A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.\n */\nconst StrictNoSign = 'StrictNoSign';\nvar TopicValidatorResult;\n(function (TopicValidatorResult) {\n /**\n * The message is considered valid, and it should be delivered and forwarded to the network\n */\n TopicValidatorResult[\"Accept\"] = \"accept\";\n /**\n * The message is neither delivered nor forwarded to the network\n */\n TopicValidatorResult[\"Ignore\"] = \"ignore\";\n /**\n * The message is considered invalid, and it should be rejected\n */\n TopicValidatorResult[\"Reject\"] = \"reject\";\n})(TopicValidatorResult || (TopicValidatorResult = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-pubsub/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-registrar/dist/src/index.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/interface-registrar/dist/src/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isTopology: () => (/* binding */ isTopology),\n/* harmony export */ topologySymbol: () => (/* binding */ topologySymbol)\n/* harmony export */ });\nconst topologySymbol = Symbol.for('@libp2p/topology');\nfunction isTopology(other) {\n return other != null && Boolean(other[topologySymbol]);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-registrar/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-stream-muxer/dist/src/stream.js": +/*!************************************************************************!*\ + !*** ./node_modules/@libp2p/interface-stream-muxer/dist/src/stream.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbstractStream: () => (/* binding */ AbstractStream)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:stream');\nconst ERR_STREAM_RESET = 'ERR_STREAM_RESET';\nconst ERR_STREAM_ABORT = 'ERR_STREAM_ABORT';\nconst ERR_SINK_ENDED = 'ERR_SINK_ENDED';\nconst ERR_DOUBLE_SINK = 'ERR_DOUBLE_SINK';\nfunction isPromise(res) {\n return res != null && typeof res.then === 'function';\n}\nclass AbstractStream {\n id;\n stat;\n metadata;\n source;\n abortController;\n resetController;\n closeController;\n sourceEnded;\n sinkEnded;\n sinkSunk;\n endErr;\n streamSource;\n onEnd;\n maxDataSize;\n constructor(init) {\n this.abortController = new AbortController();\n this.resetController = new AbortController();\n this.closeController = new AbortController();\n this.sourceEnded = false;\n this.sinkEnded = false;\n this.sinkSunk = false;\n this.id = init.id;\n this.metadata = init.metadata ?? {};\n this.stat = {\n direction: init.direction,\n timeline: {\n open: Date.now()\n }\n };\n this.maxDataSize = init.maxDataSize;\n this.onEnd = init.onEnd;\n this.source = this.streamSource = (0,it_pushable__WEBPACK_IMPORTED_MODULE_4__.pushable)({\n onEnd: () => {\n // already sent a reset message\n if (this.stat.timeline.reset !== null) {\n const res = this.sendCloseRead();\n if (isPromise(res)) {\n res.catch(err => {\n log.error('error while sending close read', err);\n });\n }\n }\n this.onSourceEnd();\n }\n });\n // necessary because the libp2p upgrader wraps the sink function\n this.sink = this.sink.bind(this);\n }\n onSourceEnd(err) {\n if (this.sourceEnded) {\n return;\n }\n this.stat.timeline.closeRead = Date.now();\n this.sourceEnded = true;\n log.trace('%s stream %s source end - err: %o', this.stat.direction, this.id, err);\n if (err != null && this.endErr == null) {\n this.endErr = err;\n }\n if (this.sinkEnded) {\n this.stat.timeline.close = Date.now();\n if (this.onEnd != null) {\n this.onEnd(this.endErr);\n }\n }\n }\n onSinkEnd(err) {\n if (this.sinkEnded) {\n return;\n }\n this.stat.timeline.closeWrite = Date.now();\n this.sinkEnded = true;\n log.trace('%s stream %s sink end - err: %o', this.stat.direction, this.id, err);\n if (err != null && this.endErr == null) {\n this.endErr = err;\n }\n if (this.sourceEnded) {\n this.stat.timeline.close = Date.now();\n if (this.onEnd != null) {\n this.onEnd(this.endErr);\n }\n }\n }\n // Close for both Reading and Writing\n close() {\n log.trace('%s stream %s close', this.stat.direction, this.id);\n this.closeRead();\n this.closeWrite();\n }\n // Close for reading\n closeRead() {\n log.trace('%s stream %s closeRead', this.stat.direction, this.id);\n if (this.sourceEnded) {\n return;\n }\n this.streamSource.end();\n }\n // Close for writing\n closeWrite() {\n log.trace('%s stream %s closeWrite', this.stat.direction, this.id);\n if (this.sinkEnded) {\n return;\n }\n this.closeController.abort();\n try {\n // need to call this here as the sink method returns in the catch block\n // when the close controller is aborted\n const res = this.sendCloseWrite();\n if (isPromise(res)) {\n res.catch(err => {\n log.error('error while sending close write', err);\n });\n }\n }\n catch (err) {\n log.trace('%s stream %s error sending close', this.stat.direction, this.id, err);\n }\n this.onSinkEnd();\n }\n // Close for reading and writing (local error)\n abort(err) {\n log.trace('%s stream %s abort', this.stat.direction, this.id, err);\n // End the source with the passed error\n this.streamSource.end(err);\n this.abortController.abort();\n this.onSinkEnd(err);\n }\n // Close immediately for reading and writing (remote error)\n reset() {\n const err = new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('stream reset', ERR_STREAM_RESET);\n this.resetController.abort();\n this.streamSource.end(err);\n this.onSinkEnd(err);\n }\n async sink(source) {\n if (this.sinkSunk) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('sink already called on stream', ERR_DOUBLE_SINK);\n }\n this.sinkSunk = true;\n if (this.sinkEnded) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('stream closed for writing', ERR_SINK_ENDED);\n }\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_3__.anySignal)([\n this.abortController.signal,\n this.resetController.signal,\n this.closeController.signal\n ]);\n try {\n source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_2__.abortableSource)(source, signal);\n if (this.stat.direction === 'outbound') { // If initiator, open a new stream\n const res = this.sendNewStream();\n if (isPromise(res)) {\n await res;\n }\n }\n for await (let data of source) {\n while (data.length > 0) {\n if (data.length <= this.maxDataSize) {\n const res = this.sendData(data instanceof Uint8Array ? new uint8arraylist__WEBPACK_IMPORTED_MODULE_5__.Uint8ArrayList(data) : data);\n if (isPromise(res)) { // eslint-disable-line max-depth\n await res;\n }\n break;\n }\n data = data instanceof Uint8Array ? new uint8arraylist__WEBPACK_IMPORTED_MODULE_5__.Uint8ArrayList(data) : data;\n const res = this.sendData(data.sublist(0, this.maxDataSize));\n if (isPromise(res)) {\n await res;\n }\n data.consume(this.maxDataSize);\n }\n }\n }\n catch (err) {\n if (err.type === 'aborted' && err.message === 'The operation was aborted') {\n if (this.closeController.signal.aborted) {\n return;\n }\n if (this.resetController.signal.aborted) {\n err.message = 'stream reset';\n err.code = ERR_STREAM_RESET;\n }\n if (this.abortController.signal.aborted) {\n err.message = 'stream aborted';\n err.code = ERR_STREAM_ABORT;\n }\n }\n // Send no more data if this stream was remotely reset\n if (err.code === ERR_STREAM_RESET) {\n log.trace('%s stream %s reset', this.stat.direction, this.id);\n }\n else {\n log.trace('%s stream %s error', this.stat.direction, this.id, err);\n try {\n const res = this.sendReset();\n if (isPromise(res)) {\n await res;\n }\n this.stat.timeline.reset = Date.now();\n }\n catch (err) {\n log.trace('%s stream %s error sending reset', this.stat.direction, this.id, err);\n }\n }\n this.streamSource.end(err);\n this.onSinkEnd(err);\n throw err;\n }\n finally {\n signal.clear();\n }\n try {\n const res = this.sendCloseWrite();\n if (isPromise(res)) {\n await res;\n }\n }\n catch (err) {\n log.trace('%s stream %s error sending close', this.stat.direction, this.id, err);\n }\n this.onSinkEnd();\n }\n /**\n * When an extending class reads data from it's implementation-specific source,\n * call this method to allow the stream consumer to read the data.\n */\n sourcePush(data) {\n this.streamSource.push(data);\n }\n /**\n * Returns the amount of unread data - can be used to prevent large amounts of\n * data building up when the stream consumer is too slow.\n */\n sourceReadableLength() {\n return this.streamSource.readableLength;\n }\n}\n//# sourceMappingURL=stream.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-stream-muxer/dist/src/stream.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interface-transport/dist/src/index.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/interface-transport/dist/src/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FaultTolerance: () => (/* binding */ FaultTolerance),\n/* harmony export */ isTransport: () => (/* binding */ isTransport),\n/* harmony export */ symbol: () => (/* binding */ symbol)\n/* harmony export */ });\nconst symbol = Symbol.for('@libp2p/transport');\nfunction isTransport(other) {\n return other != null && Boolean(other[symbol]);\n}\n/**\n * Enum Transport Manager Fault Tolerance values\n */\nvar FaultTolerance;\n(function (FaultTolerance) {\n /**\n * should be used for failing in any listen circumstance\n */\n FaultTolerance[FaultTolerance[\"FATAL_ALL\"] = 0] = \"FATAL_ALL\";\n /**\n * should be used for not failing when not listening\n */\n FaultTolerance[FaultTolerance[\"NO_FATAL\"] = 1] = \"NO_FATAL\";\n})(FaultTolerance || (FaultTolerance = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interface-transport/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interfaces/dist/src/errors.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/interfaces/dist/src/errors.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ CodeError: () => (/* binding */ CodeError)\n/* harmony export */ });\n/**\n * When this error is thrown it means an operation was aborted,\n * usually in response to the `abort` event being emitted by an\n * AbortSignal.\n */\nclass AbortError extends Error {\n code;\n type;\n constructor(message = 'The operation was aborted') {\n super(message);\n this.code = AbortError.code;\n this.type = AbortError.type;\n }\n static code = 'ABORT_ERR';\n static type = 'aborted';\n}\nclass CodeError extends Error {\n code;\n props;\n constructor(message, code, props) {\n super(message);\n this.code = code;\n this.name = props?.name ?? 'CodeError';\n this.props = props ?? {}; // eslint-disable-line @typescript-eslint/consistent-type-assertions\n }\n}\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interfaces/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interfaces/dist/src/events.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/interfaces/dist/src/events.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CustomEvent: () => (/* binding */ CustomEvent),\n/* harmony export */ EventEmitter: () => (/* binding */ EventEmitter)\n/* harmony export */ });\n/**\n * Adds types to the EventTarget class. Hopefully this won't be necessary forever.\n *\n * https://github.com/microsoft/TypeScript/issues/28357\n * https://github.com/microsoft/TypeScript/issues/43477\n * https://github.com/microsoft/TypeScript/issues/299\n * etc\n */\nclass EventEmitter extends EventTarget {\n #listeners = new Map();\n listenerCount(type) {\n const listeners = this.#listeners.get(type);\n if (listeners == null) {\n return 0;\n }\n return listeners.length;\n }\n addEventListener(type, listener, options) {\n super.addEventListener(type, listener, options);\n let list = this.#listeners.get(type);\n if (list == null) {\n list = [];\n this.#listeners.set(type, list);\n }\n list.push({\n callback: listener,\n once: (options !== true && options !== false && options?.once) ?? false\n });\n }\n removeEventListener(type, listener, options) {\n super.removeEventListener(type.toString(), listener ?? null, options);\n let list = this.#listeners.get(type);\n if (list == null) {\n return;\n }\n list = list.filter(({ callback }) => callback !== listener);\n this.#listeners.set(type, list);\n }\n dispatchEvent(event) {\n const result = super.dispatchEvent(event);\n let list = this.#listeners.get(event.type);\n if (list == null) {\n return result;\n }\n list = list.filter(({ once }) => !once);\n this.#listeners.set(event.type, list);\n return result;\n }\n safeDispatchEvent(type, detail) {\n return this.dispatchEvent(new CustomEvent(type, detail));\n }\n}\n/**\n * CustomEvent is a standard event but it's not supported by node.\n *\n * Remove this when https://github.com/nodejs/node/issues/40678 is closed.\n *\n * Ref: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent\n */\nclass CustomEventPolyfill extends Event {\n /** Returns any custom data event was created with. Typically used for synthetic events. */\n detail;\n constructor(message, data) {\n super(message, data);\n // @ts-expect-error could be undefined\n this.detail = data?.detail;\n }\n}\nconst CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill;\n//# sourceMappingURL=events.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interfaces/dist/src/events.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/interfaces/dist/src/startable.js": +/*!***************************************************************!*\ + !*** ./node_modules/@libp2p/interfaces/dist/src/startable.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isStartable: () => (/* binding */ isStartable),\n/* harmony export */ start: () => (/* binding */ start),\n/* harmony export */ stop: () => (/* binding */ stop)\n/* harmony export */ });\nfunction isStartable(obj) {\n return obj != null && typeof obj.start === 'function' && typeof obj.stop === 'function';\n}\nasync function start(...objs) {\n const startables = [];\n for (const obj of objs) {\n if (isStartable(obj)) {\n startables.push(obj);\n }\n }\n await Promise.all(startables.map(async (s) => {\n if (s.beforeStart != null) {\n await s.beforeStart();\n }\n }));\n await Promise.all(startables.map(async (s) => {\n await s.start();\n }));\n await Promise.all(startables.map(async (s) => {\n if (s.afterStart != null) {\n await s.afterStart();\n }\n }));\n}\nasync function stop(...objs) {\n const startables = [];\n for (const obj of objs) {\n if (isStartable(obj)) {\n startables.push(obj);\n }\n }\n await Promise.all(startables.map(async (s) => {\n if (s.beforeStop != null) {\n await s.beforeStop();\n }\n }));\n await Promise.all(startables.map(async (s) => {\n await s.stop();\n }));\n await Promise.all(startables.map(async (s) => {\n if (s.afterStop != null) {\n await s.afterStop();\n }\n }));\n}\n//# sourceMappingURL=startable.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/interfaces/dist/src/startable.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/keychain/dist/src/errors.js": +/*!**********************************************************!*\ + !*** ./node_modules/@libp2p/keychain/dist/src/errors.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nvar codes;\n(function (codes) {\n codes[\"ERR_INVALID_PARAMETERS\"] = \"ERR_INVALID_PARAMETERS\";\n codes[\"ERR_INVALID_KEY_NAME\"] = \"ERR_INVALID_KEY_NAME\";\n codes[\"ERR_INVALID_KEY_TYPE\"] = \"ERR_INVALID_KEY_TYPE\";\n codes[\"ERR_KEY_ALREADY_EXISTS\"] = \"ERR_KEY_ALREADY_EXISTS\";\n codes[\"ERR_INVALID_KEY_SIZE\"] = \"ERR_INVALID_KEY_SIZE\";\n codes[\"ERR_KEY_NOT_FOUND\"] = \"ERR_KEY_NOT_FOUND\";\n codes[\"ERR_OLD_KEY_NAME_INVALID\"] = \"ERR_OLD_KEY_NAME_INVALID\";\n codes[\"ERR_NEW_KEY_NAME_INVALID\"] = \"ERR_NEW_KEY_NAME_INVALID\";\n codes[\"ERR_PASSWORD_REQUIRED\"] = \"ERR_PASSWORD_REQUIRED\";\n codes[\"ERR_PEM_REQUIRED\"] = \"ERR_PEM_REQUIRED\";\n codes[\"ERR_CANNOT_READ_KEY\"] = \"ERR_CANNOT_READ_KEY\";\n codes[\"ERR_MISSING_PRIVATE_KEY\"] = \"ERR_MISSING_PRIVATE_KEY\";\n codes[\"ERR_INVALID_OLD_PASS_TYPE\"] = \"ERR_INVALID_OLD_PASS_TYPE\";\n codes[\"ERR_INVALID_NEW_PASS_TYPE\"] = \"ERR_INVALID_NEW_PASS_TYPE\";\n codes[\"ERR_INVALID_PASS_LENGTH\"] = \"ERR_INVALID_PASS_LENGTH\";\n})(codes || (codes = {}));\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/keychain/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/keychain/dist/src/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/@libp2p/keychain/dist/src/index.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultKeyChain: () => (/* binding */ DefaultKeyChain)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/index.js\");\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var interface_datastore_key__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! interface-datastore/key */ \"./node_modules/interface-datastore/dist/src/key.js\");\n/* harmony import */ var merge_options__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! merge-options */ \"./node_modules/merge-options/index.mjs\");\n/* harmony import */ var sanitize_filename__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! sanitize-filename */ \"./node_modules/sanitize-filename/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/@libp2p/keychain/dist/src/errors.js\");\n/* eslint max-nested-callbacks: [\"error\", 5] */\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_3__.logger)('libp2p:keychain');\nconst keyPrefix = '/pkcs8/';\nconst infoPrefix = '/info/';\nconst privates = new WeakMap();\n// NIST SP 800-132\nconst NIST = {\n minKeyLength: 112 / 8,\n minSaltLength: 128 / 8,\n minIterationCount: 1000\n};\nconst defaultOptions = {\n // See https://cryptosense.com/parametesr-choice-for-pbkdf2/\n dek: {\n keyLength: 512 / 8,\n iterationCount: 10000,\n salt: 'you should override this value with a crypto secure random number',\n hash: 'sha2-512'\n }\n};\nfunction validateKeyName(name) {\n if (name == null) {\n return false;\n }\n if (typeof name !== 'string') {\n return false;\n }\n return name === sanitize_filename__WEBPACK_IMPORTED_MODULE_7__(name.trim()) && name.length > 0;\n}\n/**\n * Throws an error after a delay\n *\n * This assumes than an error indicates that the keychain is under attack. Delay returning an\n * error to make brute force attacks harder.\n */\nasync function randomDelay() {\n const min = 200;\n const max = 1000;\n const delay = Math.random() * (max - min) + min;\n await new Promise(resolve => setTimeout(resolve, delay));\n}\n/**\n * Converts a key name into a datastore name\n */\nfunction DsName(name) {\n return new interface_datastore_key__WEBPACK_IMPORTED_MODULE_5__.Key(keyPrefix + name);\n}\n/**\n * Converts a key name into a datastore info name\n */\nfunction DsInfoName(name) {\n return new interface_datastore_key__WEBPACK_IMPORTED_MODULE_5__.Key(infoPrefix + name);\n}\n/**\n * Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.\n *\n * A key in the store has two entries\n * - '/info/*key-name*', contains the KeyInfo for the key\n * - '/pkcs8/*key-name*', contains the PKCS #8 for the key\n *\n */\nclass DefaultKeyChain {\n components;\n init;\n /**\n * Creates a new instance of a key chain\n */\n constructor(components, init) {\n this.components = components;\n this.init = (0,merge_options__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(defaultOptions, init);\n // Enforce NIST SP 800-132\n if (this.init.pass != null && this.init.pass?.length < 20) {\n throw new Error('pass must be least 20 characters');\n }\n if (this.init.dek?.keyLength != null && this.init.dek.keyLength < NIST.minKeyLength) {\n throw new Error(`dek.keyLength must be least ${NIST.minKeyLength} bytes`);\n }\n if (this.init.dek?.salt?.length != null && this.init.dek.salt.length < NIST.minSaltLength) {\n throw new Error(`dek.saltLength must be least ${NIST.minSaltLength} bytes`);\n }\n if (this.init.dek?.iterationCount != null && this.init.dek.iterationCount < NIST.minIterationCount) {\n throw new Error(`dek.iterationCount must be least ${NIST.minIterationCount}`);\n }\n const dek = this.init.pass != null && this.init.dek?.salt != null\n ? (0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_0__.pbkdf2)(this.init.pass, this.init.dek?.salt, this.init.dek?.iterationCount, this.init.dek?.keyLength, this.init.dek?.hash)\n : '';\n privates.set(this, { dek });\n }\n /**\n * Generates the options for a keychain. A random salt is produced.\n *\n * @returns {object}\n */\n static generateOptions() {\n const options = Object.assign({}, defaultOptions);\n const saltLength = Math.ceil(NIST.minSaltLength / 3) * 3; // no base64 padding\n options.dek.salt = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)((0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_0__.randomBytes)(saltLength), 'base64');\n return options;\n }\n /**\n * Gets an object that can encrypt/decrypt protected data.\n * The default options for a keychain.\n *\n * @returns {object}\n */\n static get options() {\n return defaultOptions;\n }\n /**\n * Create a new key.\n *\n * @param {string} name - The local key name; cannot already exist.\n * @param {string} type - One of the key types; 'rsa'.\n * @param {number} [size = 2048] - The key size in bits. Used for rsa keys only\n */\n async createKey(name, type, size = 2048) {\n if (!validateKeyName(name) || name === 'self') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Invalid key name', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n if (typeof type !== 'string') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Invalid key type', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_TYPE);\n }\n const dsname = DsName(name);\n const exists = await this.components.datastore.has(dsname);\n if (exists) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Key name already exists', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_ALREADY_EXISTS);\n }\n switch (type.toLowerCase()) {\n case 'rsa':\n if (!Number.isSafeInteger(size) || size < 2048) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Invalid RSA key size', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_SIZE);\n }\n break;\n default:\n break;\n }\n let keyInfo;\n try {\n const keypair = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.generateKeyPair)(type, size);\n const kid = await keypair.id();\n const cached = privates.get(this);\n if (cached == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('dek missing', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_PARAMETERS);\n }\n const dek = cached.dek;\n const pem = await keypair.export(dek);\n keyInfo = {\n name,\n id: kid\n };\n const batch = this.components.datastore.batch();\n batch.put(dsname, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(pem));\n batch.put(DsInfoName(name), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(JSON.stringify(keyInfo)));\n await batch.commit();\n }\n catch (err) {\n await randomDelay();\n throw err;\n }\n return keyInfo;\n }\n /**\n * List all the keys.\n *\n * @returns {Promise}\n */\n async listKeys() {\n const query = {\n prefix: infoPrefix\n };\n const info = [];\n for await (const value of this.components.datastore.query(query)) {\n info.push(JSON.parse((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(value.value)));\n }\n return info;\n }\n /**\n * Find a key by it's id\n */\n async findKeyById(id) {\n try {\n const keys = await this.listKeys();\n const key = keys.find((k) => k.id === id);\n if (key == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Key with id '${id}' does not exist.`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_NOT_FOUND);\n }\n return key;\n }\n catch (err) {\n await randomDelay();\n throw err;\n }\n }\n /**\n * Find a key by it's name.\n *\n * @param {string} name - The local key name.\n * @returns {Promise}\n */\n async findKeyByName(name) {\n if (!validateKeyName(name)) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid key name '${name}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n const dsname = DsInfoName(name);\n try {\n const res = await this.components.datastore.get(dsname);\n return JSON.parse((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(res));\n }\n catch (err) {\n await randomDelay();\n log.error(err);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Key '${name}' does not exist.`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_NOT_FOUND);\n }\n }\n /**\n * Remove an existing key.\n *\n * @param {string} name - The local key name; must already exist.\n * @returns {Promise}\n */\n async removeKey(name) {\n if (!validateKeyName(name) || name === 'self') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid key name '${name}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n const dsname = DsName(name);\n const keyInfo = await this.findKeyByName(name);\n const batch = this.components.datastore.batch();\n batch.delete(dsname);\n batch.delete(DsInfoName(name));\n await batch.commit();\n return keyInfo;\n }\n /**\n * Rename a key\n *\n * @param {string} oldName - The old local key name; must already exist.\n * @param {string} newName - The new local key name; must not already exist.\n * @returns {Promise}\n */\n async renameKey(oldName, newName) {\n if (!validateKeyName(oldName) || oldName === 'self') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid old key name '${oldName}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_OLD_KEY_NAME_INVALID);\n }\n if (!validateKeyName(newName) || newName === 'self') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid new key name '${newName}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_NEW_KEY_NAME_INVALID);\n }\n const oldDsname = DsName(oldName);\n const newDsname = DsName(newName);\n const oldInfoName = DsInfoName(oldName);\n const newInfoName = DsInfoName(newName);\n const exists = await this.components.datastore.has(newDsname);\n if (exists) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Key '${newName}' already exists`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_ALREADY_EXISTS);\n }\n try {\n const pem = await this.components.datastore.get(oldDsname);\n const res = await this.components.datastore.get(oldInfoName);\n const keyInfo = JSON.parse((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(res));\n keyInfo.name = newName;\n const batch = this.components.datastore.batch();\n batch.put(newDsname, pem);\n batch.put(newInfoName, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(JSON.stringify(keyInfo)));\n batch.delete(oldDsname);\n batch.delete(oldInfoName);\n await batch.commit();\n return keyInfo;\n }\n catch (err) {\n await randomDelay();\n throw err;\n }\n }\n /**\n * Export an existing key as a PEM encrypted PKCS #8 string\n */\n async exportKey(name, password) {\n if (!validateKeyName(name)) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid key name '${name}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n if (password == null) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Password is required', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_PASSWORD_REQUIRED);\n }\n const dsname = DsName(name);\n try {\n const res = await this.components.datastore.get(dsname);\n const pem = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(res);\n const cached = privates.get(this);\n if (cached == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('dek missing', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_PARAMETERS);\n }\n const dek = cached.dek;\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.importKey)(pem, dek);\n return await privateKey.export(password);\n }\n catch (err) {\n await randomDelay();\n throw err;\n }\n }\n /**\n * Export an existing key as a PeerId\n */\n async exportPeerId(name) {\n const password = 'temporary-password';\n const pem = await this.exportKey(name, password);\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.importKey)(pem, password);\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromKeys)(privateKey.public.bytes, privateKey.bytes);\n }\n /**\n * Import a new key from a PEM encoded PKCS #8 string\n *\n * @param {string} name - The local key name; must not already exist.\n * @param {string} pem - The PEM encoded PKCS #8 string\n * @param {string} password - The password.\n * @returns {Promise}\n */\n async importKey(name, pem, password) {\n if (!validateKeyName(name) || name === 'self') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid key name '${name}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n if (pem == null) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('PEM encoded key is required', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_PEM_REQUIRED);\n }\n const dsname = DsName(name);\n const exists = await this.components.datastore.has(dsname);\n if (exists) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Key '${name}' already exists`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_ALREADY_EXISTS);\n }\n let privateKey;\n try {\n privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.importKey)(pem, password);\n }\n catch (err) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Cannot read the key, most likely the password is wrong', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_CANNOT_READ_KEY);\n }\n let kid;\n try {\n kid = await privateKey.id();\n const cached = privates.get(this);\n if (cached == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('dek missing', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_PARAMETERS);\n }\n const dek = cached.dek;\n pem = await privateKey.export(dek);\n }\n catch (err) {\n await randomDelay();\n throw err;\n }\n const keyInfo = {\n name,\n id: kid\n };\n const batch = this.components.datastore.batch();\n batch.put(dsname, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(pem));\n batch.put(DsInfoName(name), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(JSON.stringify(keyInfo)));\n await batch.commit();\n return keyInfo;\n }\n /**\n * Import a peer key\n */\n async importPeer(name, peer) {\n try {\n if (!validateKeyName(name)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid key name '${name}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n if (peer == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('PeerId is required', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_MISSING_PRIVATE_KEY);\n }\n if (peer.privateKey == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('PeerId.privKey is required', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_MISSING_PRIVATE_KEY);\n }\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.unmarshalPrivateKey)(peer.privateKey);\n const dsname = DsName(name);\n const exists = await this.components.datastore.has(dsname);\n if (exists) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Key '${name}' already exists`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_ALREADY_EXISTS);\n }\n const cached = privates.get(this);\n if (cached == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('dek missing', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_PARAMETERS);\n }\n const dek = cached.dek;\n const pem = await privateKey.export(dek);\n const keyInfo = {\n name,\n id: peer.toString()\n };\n const batch = this.components.datastore.batch();\n batch.put(dsname, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(pem));\n batch.put(DsInfoName(name), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(JSON.stringify(keyInfo)));\n await batch.commit();\n return keyInfo;\n }\n catch (err) {\n await randomDelay();\n throw err;\n }\n }\n /**\n * Gets the private key as PEM encoded PKCS #8 string\n */\n async getPrivateKey(name) {\n if (!validateKeyName(name)) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid key name '${name}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_KEY_NAME);\n }\n try {\n const dsname = DsName(name);\n const res = await this.components.datastore.get(dsname);\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(res);\n }\n catch (err) {\n await randomDelay();\n log.error(err);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Key '${name}' does not exist.`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_KEY_NOT_FOUND);\n }\n }\n /**\n * Rotate keychain password and re-encrypt all associated keys\n */\n async rotateKeychainPass(oldPass, newPass) {\n if (typeof oldPass !== 'string') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid old pass type '${typeof oldPass}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_OLD_PASS_TYPE);\n }\n if (typeof newPass !== 'string') {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid new pass type '${typeof newPass}'`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_NEW_PASS_TYPE);\n }\n if (newPass.length < 20) {\n await randomDelay();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError(`Invalid pass length ${newPass.length}`, _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_PASS_LENGTH);\n }\n log('recreating keychain');\n const cached = privates.get(this);\n if (cached == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('dek missing', _errors_js__WEBPACK_IMPORTED_MODULE_10__.codes.ERR_INVALID_PARAMETERS);\n }\n const oldDek = cached.dek;\n this.init.pass = newPass;\n const newDek = newPass != null && this.init.dek?.salt != null\n ? (0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_0__.pbkdf2)(newPass, this.init.dek.salt, this.init.dek?.iterationCount, this.init.dek?.keyLength, this.init.dek?.hash)\n : '';\n privates.set(this, { dek: newDek });\n const keys = await this.listKeys();\n for (const key of keys) {\n const res = await this.components.datastore.get(DsName(key.name));\n const pem = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_9__.toString)(res);\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.importKey)(pem, oldDek);\n const password = newDek.toString();\n const keyAsPEM = await privateKey.export(password);\n // Update stored key\n const batch = this.components.datastore.batch();\n const keyInfo = {\n name: key.name,\n id: key.id\n };\n batch.put(DsName(key.name), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(keyAsPEM));\n batch.put(DsInfoName(key.name), (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_8__.fromString)(JSON.stringify(keyInfo)));\n await batch.commit();\n }\n log('keychain reconstructed');\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/keychain/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/logger/dist/src/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/logger/dist/src/index.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ disable: () => (/* binding */ disable),\n/* harmony export */ enable: () => (/* binding */ enable),\n/* harmony export */ enabled: () => (/* binding */ enabled),\n/* harmony export */ logger: () => (/* binding */ logger)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/bases/base32 */ \"./node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/bases/base64 */ \"./node_modules/multiformats/src/bases/base64.js\");\n\n\n\n\n// Add a formatter for converting to a base58 string\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.b = (v) => {\n return v == null ? 'undefined' : multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_1__.base58btc.baseEncode(v);\n};\n// Add a formatter for converting to a base32 string\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.t = (v) => {\n return v == null ? 'undefined' : multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_2__.base32.baseEncode(v);\n};\n// Add a formatter for converting to a base64 string\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.m = (v) => {\n return v == null ? 'undefined' : multiformats_bases_base64__WEBPACK_IMPORTED_MODULE_3__.base64.baseEncode(v);\n};\n// Add a formatter for stringifying peer ids\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.p = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\n// Add a formatter for stringifying CIDs\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.c = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\n// Add a formatter for stringifying Datastore keys\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.k = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\n// Add a formatter for stringifying Multiaddrs\ndebug__WEBPACK_IMPORTED_MODULE_0__.formatters.a = (v) => {\n return v == null ? 'undefined' : v.toString();\n};\nfunction createDisabledLogger(namespace) {\n const logger = () => { };\n logger.enabled = false;\n logger.color = '';\n logger.diff = 0;\n logger.log = () => { };\n logger.namespace = namespace;\n logger.destroy = () => true;\n logger.extend = () => logger;\n return logger;\n}\nfunction logger(name) {\n // trace logging is a no-op by default\n let trace = createDisabledLogger(`${name}:trace`);\n // look at all the debug names and see if trace logging has explicitly been enabled\n if (debug__WEBPACK_IMPORTED_MODULE_0__.enabled(`${name}:trace`) && debug__WEBPACK_IMPORTED_MODULE_0__.names.map(r => r.toString()).find(n => n.includes(':trace')) != null) {\n trace = debug__WEBPACK_IMPORTED_MODULE_0__(`${name}:trace`);\n }\n return Object.assign(debug__WEBPACK_IMPORTED_MODULE_0__(name), {\n error: debug__WEBPACK_IMPORTED_MODULE_0__(`${name}:error`),\n trace\n });\n}\nfunction disable() {\n debug__WEBPACK_IMPORTED_MODULE_0__.disable();\n}\nfunction enable(namespaces) {\n debug__WEBPACK_IMPORTED_MODULE_0__.enable(namespaces);\n}\nfunction enabled(namespaces) {\n return debug__WEBPACK_IMPORTED_MODULE_0__.enabled(namespaces);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/logger/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/alloc-unsafe-browser.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/alloc-unsafe-browser.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\nfunction allocUnsafe(size) {\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc-unsafe-browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/alloc-unsafe-browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/decode.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/decode.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Decoder: () => (/* binding */ Decoder),\n/* harmony export */ MAX_MSG_QUEUE_SIZE: () => (/* binding */ MAX_MSG_QUEUE_SIZE),\n/* harmony export */ MAX_MSG_SIZE: () => (/* binding */ MAX_MSG_SIZE)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n\n\nconst MAX_MSG_SIZE = 1 << 20; // 1MB\nconst MAX_MSG_QUEUE_SIZE = 4 << 20; // 4MB\nclass Decoder {\n _buffer;\n _headerInfo;\n _maxMessageSize;\n _maxUnprocessedMessageQueueSize;\n constructor(maxMessageSize = MAX_MSG_SIZE, maxUnprocessedMessageQueueSize = MAX_MSG_QUEUE_SIZE) {\n this._buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n this._headerInfo = null;\n this._maxMessageSize = maxMessageSize;\n this._maxUnprocessedMessageQueueSize = maxUnprocessedMessageQueueSize;\n }\n write(chunk) {\n if (chunk == null || chunk.length === 0) {\n return [];\n }\n this._buffer.append(chunk);\n if (this._buffer.byteLength > this._maxUnprocessedMessageQueueSize) {\n throw Object.assign(new Error('unprocessed message queue size too large!'), { code: 'ERR_MSG_QUEUE_TOO_BIG' });\n }\n const msgs = [];\n while (this._buffer.length !== 0) {\n if (this._headerInfo == null) {\n try {\n this._headerInfo = this._decodeHeader(this._buffer);\n }\n catch (err) {\n if (err.code === 'ERR_MSG_TOO_BIG') {\n throw err;\n }\n break; // We haven't received enough data yet\n }\n }\n const { id, type, length, offset } = this._headerInfo;\n const bufferedDataLength = this._buffer.length - offset;\n if (bufferedDataLength < length) {\n break; // not enough data yet\n }\n const msg = {\n id,\n type\n };\n if (type === _message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypes.NEW_STREAM || type === _message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypes.MESSAGE_INITIATOR || type === _message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypes.MESSAGE_RECEIVER) {\n msg.data = this._buffer.sublist(offset, offset + length);\n }\n msgs.push(msg);\n this._buffer.consume(offset + length);\n this._headerInfo = null;\n }\n return msgs;\n }\n /**\n * Attempts to decode the message header from the buffer\n */\n _decodeHeader(data) {\n const { value: h, offset } = readVarInt(data);\n const { value: length, offset: end } = readVarInt(data, offset);\n const type = h & 7;\n // @ts-expect-error h is a number not a CODE\n if (_message_types_js__WEBPACK_IMPORTED_MODULE_1__.MessageTypeNames[type] == null) {\n throw new Error(`Invalid type received: ${type}`);\n }\n // test message type varint + data length\n if (length > this._maxMessageSize) {\n throw Object.assign(new Error('message size too large!'), { code: 'ERR_MSG_TOO_BIG' });\n }\n // @ts-expect-error h is a number not a CODE\n return { id: h >> 3, type, offset: offset + end, length };\n }\n}\nconst MSB = 0x80;\nconst REST = 0x7F;\nfunction readVarInt(buf, offset = 0) {\n let res = 0;\n let shift = 0;\n let counter = offset;\n let b;\n const l = buf.length;\n do {\n if (counter >= l || shift > 49) {\n offset = 0;\n throw new RangeError('Could not decode varint');\n }\n b = buf.get(counter++);\n res += shift < 28\n ? (b & REST) << shift\n : (b & REST) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB);\n offset = counter - offset;\n return {\n value: res,\n offset\n };\n}\n//# sourceMappingURL=decode.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/decode.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/encode.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/encode.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var it_batched_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-batched-bytes */ \"./node_modules/it-batched-bytes/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var varint__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! varint */ \"./node_modules/varint/index.js\");\n/* harmony import */ var _alloc_unsafe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./alloc-unsafe.js */ \"./node_modules/@libp2p/mplex/dist/src/alloc-unsafe-browser.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n\n\n\n\n\nconst POOL_SIZE = 10 * 1024;\nclass Encoder {\n _pool;\n _poolOffset;\n constructor() {\n this._pool = (0,_alloc_unsafe_js__WEBPACK_IMPORTED_MODULE_3__.allocUnsafe)(POOL_SIZE);\n this._poolOffset = 0;\n }\n /**\n * Encodes the given message and adds it to the passed list\n */\n write(msg, list) {\n const pool = this._pool;\n let offset = this._poolOffset;\n varint__WEBPACK_IMPORTED_MODULE_2__.encode(msg.id << 3 | msg.type, pool, offset);\n offset += varint__WEBPACK_IMPORTED_MODULE_2__.encode.bytes ?? 0;\n if ((msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_4__.MessageTypes.NEW_STREAM || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_4__.MessageTypes.MESSAGE_INITIATOR || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_4__.MessageTypes.MESSAGE_RECEIVER) && msg.data != null) {\n varint__WEBPACK_IMPORTED_MODULE_2__.encode(msg.data.length, pool, offset);\n }\n else {\n varint__WEBPACK_IMPORTED_MODULE_2__.encode(0, pool, offset);\n }\n offset += varint__WEBPACK_IMPORTED_MODULE_2__.encode.bytes ?? 0;\n const header = pool.subarray(this._poolOffset, offset);\n if (POOL_SIZE - offset < 100) {\n this._pool = (0,_alloc_unsafe_js__WEBPACK_IMPORTED_MODULE_3__.allocUnsafe)(POOL_SIZE);\n this._poolOffset = 0;\n }\n else {\n this._poolOffset = offset;\n }\n list.append(header);\n if ((msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_4__.MessageTypes.NEW_STREAM || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_4__.MessageTypes.MESSAGE_INITIATOR || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_4__.MessageTypes.MESSAGE_RECEIVER) && msg.data != null) {\n list.append(msg.data);\n }\n }\n}\nconst encoder = new Encoder();\n/**\n * Encode and yield one or more messages\n */\nasync function* encode(source, minSendBytes = 0) {\n if (minSendBytes == null || minSendBytes === 0) {\n // just send the messages\n for await (const messages of source) {\n const list = new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList();\n for (const msg of messages) {\n encoder.write(msg, list);\n }\n yield list.subarray();\n }\n return;\n }\n // batch messages up for sending\n yield* (0,it_batched_bytes__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source, {\n size: minSendBytes,\n serialize: (obj, list) => {\n for (const m of obj) {\n encoder.write(m, list);\n }\n }\n });\n}\n//# sourceMappingURL=encode.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/encode.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/index.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mplex: () => (/* binding */ mplex)\n/* harmony export */ });\n/* harmony import */ var _mplex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mplex.js */ \"./node_modules/@libp2p/mplex/dist/src/mplex.js\");\n\nclass Mplex {\n protocol = '/mplex/6.7.0';\n _init;\n constructor(init = {}) {\n this._init = init;\n }\n createStreamMuxer(init = {}) {\n return new _mplex_js__WEBPACK_IMPORTED_MODULE_0__.MplexStreamMuxer({\n ...init,\n ...this._init\n });\n }\n}\nfunction mplex(init = {}) {\n return () => new Mplex(init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/message-types.js": +/*!**************************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/message-types.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InitiatorMessageTypes: () => (/* binding */ InitiatorMessageTypes),\n/* harmony export */ MessageTypeNames: () => (/* binding */ MessageTypeNames),\n/* harmony export */ MessageTypes: () => (/* binding */ MessageTypes),\n/* harmony export */ ReceiverMessageTypes: () => (/* binding */ ReceiverMessageTypes)\n/* harmony export */ });\nvar MessageTypes;\n(function (MessageTypes) {\n MessageTypes[MessageTypes[\"NEW_STREAM\"] = 0] = \"NEW_STREAM\";\n MessageTypes[MessageTypes[\"MESSAGE_RECEIVER\"] = 1] = \"MESSAGE_RECEIVER\";\n MessageTypes[MessageTypes[\"MESSAGE_INITIATOR\"] = 2] = \"MESSAGE_INITIATOR\";\n MessageTypes[MessageTypes[\"CLOSE_RECEIVER\"] = 3] = \"CLOSE_RECEIVER\";\n MessageTypes[MessageTypes[\"CLOSE_INITIATOR\"] = 4] = \"CLOSE_INITIATOR\";\n MessageTypes[MessageTypes[\"RESET_RECEIVER\"] = 5] = \"RESET_RECEIVER\";\n MessageTypes[MessageTypes[\"RESET_INITIATOR\"] = 6] = \"RESET_INITIATOR\";\n})(MessageTypes || (MessageTypes = {}));\nconst MessageTypeNames = Object.freeze({\n 0: 'NEW_STREAM',\n 1: 'MESSAGE_RECEIVER',\n 2: 'MESSAGE_INITIATOR',\n 3: 'CLOSE_RECEIVER',\n 4: 'CLOSE_INITIATOR',\n 5: 'RESET_RECEIVER',\n 6: 'RESET_INITIATOR'\n});\nconst InitiatorMessageTypes = Object.freeze({\n NEW_STREAM: MessageTypes.NEW_STREAM,\n MESSAGE: MessageTypes.MESSAGE_INITIATOR,\n CLOSE: MessageTypes.CLOSE_INITIATOR,\n RESET: MessageTypes.RESET_INITIATOR\n});\nconst ReceiverMessageTypes = Object.freeze({\n MESSAGE: MessageTypes.MESSAGE_RECEIVER,\n CLOSE: MessageTypes.CLOSE_RECEIVER,\n RESET: MessageTypes.RESET_RECEIVER\n});\n//# sourceMappingURL=message-types.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/message-types.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/mplex.js": +/*!******************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/mplex.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MplexStreamMuxer: () => (/* binding */ MplexStreamMuxer)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var rate_limiter_flexible__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rate-limiter-flexible */ \"./node_modules/rate-limiter-flexible/index.js\");\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/uint8arrays/dist/src/index.js\");\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/@libp2p/mplex/dist/src/decode.js\");\n/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./encode.js */ \"./node_modules/@libp2p/mplex/dist/src/encode.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n/* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./stream.js */ \"./node_modules/@libp2p/mplex/dist/src/stream.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:mplex');\nconst MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION = 1024;\nconst MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION = 1024;\nconst MAX_STREAM_BUFFER_SIZE = 1024 * 1024 * 4; // 4MB\nconst DISCONNECT_THRESHOLD = 5;\nfunction printMessage(msg) {\n const output = {\n ...msg,\n type: `${_message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypeNames[msg.type]} (${msg.type})`\n };\n if (msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.NEW_STREAM) {\n output.data = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_6__.toString)(msg.data instanceof Uint8Array ? msg.data : msg.data.subarray());\n }\n if (msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.MESSAGE_INITIATOR || msg.type === _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.MESSAGE_RECEIVER) {\n output.data = (0,uint8arrays__WEBPACK_IMPORTED_MODULE_6__.toString)(msg.data instanceof Uint8Array ? msg.data : msg.data.subarray(), 'base16');\n }\n return output;\n}\nclass MplexStreamMuxer {\n protocol = '/mplex/6.7.0';\n sink;\n source;\n _streamId;\n _streams;\n _init;\n _source;\n closeController;\n rateLimiter;\n constructor(init) {\n init = init ?? {};\n this._streamId = 0;\n this._streams = {\n /**\n * Stream to ids map\n */\n initiators: new Map(),\n /**\n * Stream to ids map\n */\n receivers: new Map()\n };\n this._init = init;\n /**\n * An iterable sink\n */\n this.sink = this._createSink();\n /**\n * An iterable source\n */\n const source = this._createSource();\n this._source = source;\n this.source = source;\n /**\n * Close controller\n */\n this.closeController = new AbortController();\n this.rateLimiter = new rate_limiter_flexible__WEBPACK_IMPORTED_MODULE_5__.RateLimiterMemory({\n points: init.disconnectThreshold ?? DISCONNECT_THRESHOLD,\n duration: 1\n });\n }\n /**\n * Returns a Map of streams and their ids\n */\n get streams() {\n // Inbound and Outbound streams may have the same ids, so we need to make those unique\n const streams = [];\n for (const stream of this._streams.initiators.values()) {\n streams.push(stream);\n }\n for (const stream of this._streams.receivers.values()) {\n streams.push(stream);\n }\n return streams;\n }\n /**\n * Initiate a new stream with the given name. If no name is\n * provided, the id of the stream will be used.\n */\n newStream(name) {\n if (this.closeController.signal.aborted) {\n throw new Error('Muxer already closed');\n }\n const id = this._streamId++;\n name = name == null ? id.toString() : name.toString();\n const registry = this._streams.initiators;\n return this._newStream({ id, name, type: 'initiator', registry });\n }\n /**\n * Close or abort all tracked streams and stop the muxer\n */\n close(err) {\n if (this.closeController.signal.aborted)\n return;\n if (err != null) {\n this.streams.forEach(s => { s.abort(err); });\n }\n else {\n this.streams.forEach(s => { s.close(); });\n }\n this.closeController.abort();\n }\n /**\n * Called whenever an inbound stream is created\n */\n _newReceiverStream(options) {\n const { id, name } = options;\n const registry = this._streams.receivers;\n return this._newStream({ id, name, type: 'receiver', registry });\n }\n _newStream(options) {\n const { id, name, type, registry } = options;\n log('new %s stream %s', type, id);\n if (type === 'initiator' && this._streams.initiators.size === (this._init.maxOutboundStreams ?? MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Too many outbound streams open', 'ERR_TOO_MANY_OUTBOUND_STREAMS');\n }\n if (registry.has(id)) {\n throw new Error(`${type} stream ${id} already exists!`);\n }\n const send = (msg) => {\n if (log.enabled) {\n log.trace('%s stream %s send', type, id, printMessage(msg));\n }\n this._source.push(msg);\n };\n const onEnd = () => {\n log('%s stream with id %s and protocol %s ended', type, id, stream.stat.protocol);\n registry.delete(id);\n if (this._init.onStreamEnd != null) {\n this._init.onStreamEnd(stream);\n }\n };\n const stream = (0,_stream_js__WEBPACK_IMPORTED_MODULE_10__.createStream)({ id, name, send, type, onEnd, maxMsgSize: this._init.maxMsgSize });\n registry.set(id, stream);\n return stream;\n }\n /**\n * Creates a sink with an abortable source. Incoming messages will\n * also have their size restricted. All messages will be varint decoded.\n */\n _createSink() {\n const sink = async (source) => {\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_3__.anySignal)([this.closeController.signal, this._init.signal]);\n try {\n source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_2__.abortableSource)(source, signal);\n const decoder = new _decode_js__WEBPACK_IMPORTED_MODULE_7__.Decoder(this._init.maxMsgSize, this._init.maxUnprocessedMessageQueueSize);\n for await (const chunk of source) {\n for (const msg of decoder.write(chunk)) {\n await this._handleIncoming(msg);\n }\n }\n this._source.end();\n }\n catch (err) {\n log('error in sink', err);\n this._source.end(err); // End the source with an error\n }\n finally {\n signal.clear();\n }\n };\n return sink;\n }\n /**\n * Creates a source that restricts outgoing message sizes\n * and varint encodes them\n */\n _createSource() {\n const onEnd = (err) => {\n this.close(err);\n };\n const source = (0,it_pushable__WEBPACK_IMPORTED_MODULE_4__.pushableV)({\n objectMode: true,\n onEnd\n });\n return Object.assign((0,_encode_js__WEBPACK_IMPORTED_MODULE_8__.encode)(source, this._init.minSendBytes), {\n push: source.push,\n end: source.end,\n return: source.return\n });\n }\n async _handleIncoming(message) {\n const { id, type } = message;\n if (log.enabled) {\n log.trace('incoming message', printMessage(message));\n }\n // Create a new stream?\n if (message.type === _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.NEW_STREAM) {\n if (this._streams.receivers.size === (this._init.maxInboundStreams ?? MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)) {\n log('too many inbound streams open');\n // not going to allow this stream, send the reset message manually\n // instead of setting it up just to tear it down\n this._source.push({\n id,\n type: _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.RESET_RECEIVER\n });\n // if we've hit our stream limit, and the remote keeps trying to open\n // more new streams, if they are doing this very quickly maybe they\n // are attacking us and we should close the connection\n try {\n await this.rateLimiter.consume('new-stream', 1);\n }\n catch {\n log('rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection');\n // since there's no backpressure in mplex, the only thing we can really do to protect ourselves is close the connection\n this._source.end(new Error('Too many open streams'));\n return;\n }\n return;\n }\n const stream = this._newReceiverStream({ id, name: (0,uint8arrays__WEBPACK_IMPORTED_MODULE_6__.toString)(message.data instanceof Uint8Array ? message.data : message.data.subarray()) });\n if (this._init.onIncomingStream != null) {\n this._init.onIncomingStream(stream);\n }\n return;\n }\n const list = (type & 1) === 1 ? this._streams.initiators : this._streams.receivers;\n const stream = list.get(id);\n if (stream == null) {\n log('missing stream %s for message type %s', id, _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypeNames[type]);\n return;\n }\n const maxBufferSize = this._init.maxStreamBufferSize ?? MAX_STREAM_BUFFER_SIZE;\n switch (type) {\n case _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.MESSAGE_INITIATOR:\n case _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.MESSAGE_RECEIVER:\n if (stream.sourceReadableLength() > maxBufferSize) {\n // Stream buffer has got too large, reset the stream\n this._source.push({\n id: message.id,\n type: type === _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.MESSAGE_INITIATOR ? _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.RESET_RECEIVER : _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.RESET_INITIATOR\n });\n // Inform the stream consumer they are not fast enough\n const error = new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers', 'ERR_STREAM_INPUT_BUFFER_FULL');\n stream.abort(error);\n return;\n }\n // We got data from the remote, push it into our local stream\n stream.sourcePush(message.data);\n break;\n case _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.CLOSE_INITIATOR:\n case _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.CLOSE_RECEIVER:\n // We should expect no more data from the remote, stop reading\n stream.closeRead();\n break;\n case _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.RESET_INITIATOR:\n case _message_types_js__WEBPACK_IMPORTED_MODULE_9__.MessageTypes.RESET_RECEIVER:\n // Stop reading and writing to the stream immediately\n stream.reset();\n break;\n default:\n log('unknown message type %s', type);\n }\n }\n}\n//# sourceMappingURL=mplex.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/mplex.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/mplex/dist/src/stream.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/mplex/dist/src/stream.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createStream: () => (/* binding */ createStream)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_stream_muxer_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-stream-muxer/stream */ \"./node_modules/@libp2p/interface-stream-muxer/dist/src/stream.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/@libp2p/mplex/dist/src/decode.js\");\n/* harmony import */ var _message_types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./message-types.js */ \"./node_modules/@libp2p/mplex/dist/src/message-types.js\");\n\n\n\n\n\nclass MplexStream extends _libp2p_interface_stream_muxer_stream__WEBPACK_IMPORTED_MODULE_0__.AbstractStream {\n name;\n streamId;\n send;\n types;\n constructor(init) {\n super(init);\n this.types = init.direction === 'outbound' ? _message_types_js__WEBPACK_IMPORTED_MODULE_4__.InitiatorMessageTypes : _message_types_js__WEBPACK_IMPORTED_MODULE_4__.ReceiverMessageTypes;\n this.send = init.send;\n this.name = init.name;\n this.streamId = init.streamId;\n }\n sendNewStream() {\n this.send({ id: this.streamId, type: _message_types_js__WEBPACK_IMPORTED_MODULE_4__.InitiatorMessageTypes.NEW_STREAM, data: new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(this.name)) });\n }\n sendData(data) {\n this.send({ id: this.streamId, type: this.types.MESSAGE, data });\n }\n sendReset() {\n this.send({ id: this.streamId, type: this.types.RESET });\n }\n sendCloseWrite() {\n this.send({ id: this.streamId, type: this.types.CLOSE });\n }\n sendCloseRead() {\n // mplex does not support close read, only close write\n }\n}\nfunction createStream(options) {\n const { id, name, send, onEnd, type = 'initiator', maxMsgSize = _decode_js__WEBPACK_IMPORTED_MODULE_3__.MAX_MSG_SIZE } = options;\n return new MplexStream({\n id: type === 'initiator' ? (`i${id}`) : `r${id}`,\n streamId: id,\n name: `${name == null ? id : name}`,\n direction: type === 'initiator' ? 'outbound' : 'inbound',\n maxDataSize: maxMsgSize,\n onEnd,\n send\n });\n}\n//# sourceMappingURL=stream.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/mplex/dist/src/stream.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/multistream-select/dist/src/constants.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@libp2p/multistream-select/dist/src/constants.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_PROTOCOL_LENGTH: () => (/* binding */ MAX_PROTOCOL_LENGTH),\n/* harmony export */ PROTOCOL_ID: () => (/* binding */ PROTOCOL_ID)\n/* harmony export */ });\nconst PROTOCOL_ID = '/multistream/1.0.0';\n// Conforming to go-libp2p\n// See https://github.com/multiformats/go-multistream/blob/master/multistream.go#L297\nconst MAX_PROTOCOL_LENGTH = 1024;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/multistream-select/dist/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/multistream-select/dist/src/handle.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/multistream-select/dist/src/handle.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ handle: () => (/* binding */ handle)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var it_handshake__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-handshake */ \"./node_modules/it-handshake/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/multistream-select/dist/src/constants.js\");\n/* harmony import */ var _multistream_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./multistream.js */ \"./node_modules/@libp2p/multistream-select/dist/src/multistream.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:mss:handle');\nasync function handle(stream, protocols, options) {\n protocols = Array.isArray(protocols) ? protocols : [protocols];\n const { writer, reader, rest, stream: shakeStream } = (0,it_handshake__WEBPACK_IMPORTED_MODULE_1__.handshake)(stream);\n while (true) {\n const protocol = await _multistream_js__WEBPACK_IMPORTED_MODULE_5__.readString(reader, options);\n log.trace('read \"%s\"', protocol);\n if (protocol === _constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID) {\n log.trace('respond with \"%s\" for \"%s\"', _constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID, protocol);\n _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(writer, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(_constants_js__WEBPACK_IMPORTED_MODULE_4__.PROTOCOL_ID), options);\n continue;\n }\n if (protocols.includes(protocol)) {\n _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(writer, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(protocol), options);\n log.trace('respond with \"%s\" for \"%s\"', protocol, protocol);\n rest();\n return { stream: shakeStream, protocol };\n }\n if (protocol === 'ls') {\n // \\n\\n\\n\n _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(writer, new uint8arraylist__WEBPACK_IMPORTED_MODULE_2__.Uint8ArrayList(...protocols.map(p => _multistream_js__WEBPACK_IMPORTED_MODULE_5__.encode((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(p)))), options);\n // multistream.writeAll(writer, protocols.map(p => uint8ArrayFromString(p)))\n log.trace('respond with \"%s\" for %s', protocols, protocol);\n continue;\n }\n _multistream_js__WEBPACK_IMPORTED_MODULE_5__.write(writer, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)('na'), options);\n log('respond with \"na\" for \"%s\"', protocol);\n }\n}\n//# sourceMappingURL=handle.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/multistream-select/dist/src/handle.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/multistream-select/dist/src/index.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@libp2p/multistream-select/dist/src/index.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PROTOCOL_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.PROTOCOL_ID),\n/* harmony export */ handle: () => (/* reexport safe */ _handle_js__WEBPACK_IMPORTED_MODULE_2__.handle),\n/* harmony export */ lazySelect: () => (/* reexport safe */ _select_js__WEBPACK_IMPORTED_MODULE_1__.lazySelect),\n/* harmony export */ select: () => (/* reexport safe */ _select_js__WEBPACK_IMPORTED_MODULE_1__.select)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/multistream-select/dist/src/constants.js\");\n/* harmony import */ var _select_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./select.js */ \"./node_modules/@libp2p/multistream-select/dist/src/select.js\");\n/* harmony import */ var _handle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./handle.js */ \"./node_modules/@libp2p/multistream-select/dist/src/handle.js\");\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/multistream-select/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/multistream-select/dist/src/multistream.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@libp2p/multistream-select/dist/src/multistream.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ read: () => (/* binding */ read),\n/* harmony export */ readString: () => (/* binding */ readString),\n/* harmony export */ write: () => (/* binding */ write),\n/* harmony export */ writeAll: () => (/* binding */ writeAll)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var it_first__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-first */ \"./node_modules/it-first/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/multistream-select/dist/src/constants.js\");\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:mss');\nconst NewLine = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)('\\n');\nfunction encode(buffer) {\n const list = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList(buffer, NewLine);\n return it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.encode.single(list);\n}\n/**\n * `write` encodes and writes a single buffer\n */\nfunction write(writer, buffer, options = {}) {\n const encoded = encode(buffer);\n if (options.writeBytes === true) {\n writer.push(encoded.subarray());\n }\n else {\n writer.push(encoded);\n }\n}\n/**\n * `writeAll` behaves like `write`, except it encodes an array of items as a single write\n */\nfunction writeAll(writer, buffers, options = {}) {\n const list = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList();\n for (const buf of buffers) {\n list.append(encode(buf));\n }\n if (options.writeBytes === true) {\n writer.push(list.subarray());\n }\n else {\n writer.push(list);\n }\n}\nasync function read(reader, options) {\n let byteLength = 1; // Read single byte chunks until the length is known\n const varByteSource = {\n [Symbol.asyncIterator]: () => varByteSource,\n next: async () => reader.next(byteLength)\n };\n let input = varByteSource;\n // If we have been passed an abort signal, wrap the input source in an abortable\n // iterator that will throw if the operation is aborted\n if (options?.signal != null) {\n input = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_2__.abortableSource)(varByteSource, options.signal);\n }\n // Once the length has been parsed, read chunk for that length\n const onLength = (l) => {\n byteLength = l;\n };\n const buf = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)(input, (source) => it_length_prefixed__WEBPACK_IMPORTED_MODULE_4__.decode(source, { onLength, maxDataLength: _constants_js__WEBPACK_IMPORTED_MODULE_9__.MAX_PROTOCOL_LENGTH }), async (source) => (0,it_first__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n if (buf == null || buf.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('no buffer returned', 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE');\n }\n if (buf.get(buf.byteLength - 1) !== NewLine[0]) {\n log.error('Invalid mss message - missing newline - %s', buf.subarray());\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('missing newline', 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE');\n }\n return buf.sublist(0, -1); // Remove newline\n}\nasync function readString(reader, options) {\n const buf = await read(reader, options);\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__.toString)(buf.subarray());\n}\n//# sourceMappingURL=multistream.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/multistream-select/dist/src/multistream.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/multistream-select/dist/src/select.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/multistream-select/dist/src/select.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ lazySelect: () => (/* binding */ lazySelect),\n/* harmony export */ select: () => (/* binding */ select)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var it_handshake__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-handshake */ \"./node_modules/it-handshake/dist/src/index.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var it_reader__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-reader */ \"./node_modules/it-reader/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _multistream_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./multistream.js */ \"./node_modules/@libp2p/multistream-select/dist/src/multistream.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./index.js */ \"./node_modules/@libp2p/multistream-select/dist/src/index.js\");\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:mss:select');\nasync function select(stream, protocols, options = {}) {\n protocols = Array.isArray(protocols) ? [...protocols] : [protocols];\n const { reader, writer, rest, stream: shakeStream } = (0,it_handshake__WEBPACK_IMPORTED_MODULE_2__.handshake)(stream);\n const protocol = protocols.shift();\n if (protocol == null) {\n throw new Error('At least one protocol must be specified');\n }\n log.trace('select: write [\"%s\", \"%s\"]', _index_js__WEBPACK_IMPORTED_MODULE_9__.PROTOCOL_ID, protocol);\n const p1 = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(_index_js__WEBPACK_IMPORTED_MODULE_9__.PROTOCOL_ID);\n const p2 = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(protocol);\n _multistream_js__WEBPACK_IMPORTED_MODULE_8__.writeAll(writer, [p1, p2], options);\n let response = await _multistream_js__WEBPACK_IMPORTED_MODULE_8__.readString(reader, options);\n log.trace('select: read \"%s\"', response);\n // Read the protocol response if we got the protocolId in return\n if (response === _index_js__WEBPACK_IMPORTED_MODULE_9__.PROTOCOL_ID) {\n response = await _multistream_js__WEBPACK_IMPORTED_MODULE_8__.readString(reader, options);\n log.trace('select: read \"%s\"', response);\n }\n // We're done\n if (response === protocol) {\n rest();\n return { stream: shakeStream, protocol };\n }\n // We haven't gotten a valid ack, try the other protocols\n for (const protocol of protocols) {\n log.trace('select: write \"%s\"', protocol);\n _multistream_js__WEBPACK_IMPORTED_MODULE_8__.write(writer, (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(protocol), options);\n const response = await _multistream_js__WEBPACK_IMPORTED_MODULE_8__.readString(reader, options);\n log.trace('select: read \"%s\" for \"%s\"', response, protocol);\n if (response === protocol) {\n rest(); // End our writer so others can start writing to stream\n return { stream: shakeStream, protocol };\n }\n }\n rest();\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('protocol selection failed', 'ERR_UNSUPPORTED_PROTOCOL');\n}\nfunction lazySelect(stream, protocol) {\n // This is a signal to write the multistream headers if the consumer tries to\n // read from the source\n const negotiateTrigger = (0,it_pushable__WEBPACK_IMPORTED_MODULE_4__.pushable)();\n let negotiated = false;\n return {\n stream: {\n sink: async (source) => {\n await stream.sink((async function* () {\n let first = true;\n for await (const chunk of (0,it_merge__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source, negotiateTrigger)) {\n if (first) {\n first = false;\n negotiated = true;\n negotiateTrigger.end();\n const p1 = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(_index_js__WEBPACK_IMPORTED_MODULE_9__.PROTOCOL_ID);\n const p2 = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(protocol);\n const list = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList(_multistream_js__WEBPACK_IMPORTED_MODULE_8__.encode(p1), _multistream_js__WEBPACK_IMPORTED_MODULE_8__.encode(p2));\n if (chunk.length > 0)\n list.append(chunk);\n yield* list;\n }\n else {\n yield chunk;\n }\n }\n })());\n },\n source: (async function* () {\n if (!negotiated)\n negotiateTrigger.push(new Uint8Array());\n const byteReader = (0,it_reader__WEBPACK_IMPORTED_MODULE_5__.reader)(stream.source);\n let response = await _multistream_js__WEBPACK_IMPORTED_MODULE_8__.readString(byteReader);\n if (response === _index_js__WEBPACK_IMPORTED_MODULE_9__.PROTOCOL_ID) {\n response = await _multistream_js__WEBPACK_IMPORTED_MODULE_8__.readString(byteReader);\n }\n if (response !== protocol) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('protocol selection failed', 'ERR_UNSUPPORTED_PROTOCOL');\n }\n for await (const chunk of byteReader) {\n yield* chunk;\n }\n })()\n },\n protocol\n };\n}\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/multistream-select/dist/src/select.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-collections/dist/src/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@libp2p/peer-collections/dist/src/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerList: () => (/* reexport safe */ _list_js__WEBPACK_IMPORTED_MODULE_2__.PeerList),\n/* harmony export */ PeerMap: () => (/* reexport safe */ _map_js__WEBPACK_IMPORTED_MODULE_0__.PeerMap),\n/* harmony export */ PeerSet: () => (/* reexport safe */ _set_js__WEBPACK_IMPORTED_MODULE_1__.PeerSet)\n/* harmony export */ });\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./map.js */ \"./node_modules/@libp2p/peer-collections/dist/src/map.js\");\n/* harmony import */ var _set_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./set.js */ \"./node_modules/@libp2p/peer-collections/dist/src/set.js\");\n/* harmony import */ var _list_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./list.js */ \"./node_modules/@libp2p/peer-collections/dist/src/list.js\");\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-collections/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-collections/dist/src/list.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/peer-collections/dist/src/list.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerList: () => (/* binding */ PeerList)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/peer-collections/dist/src/util.js\");\n\n\n/**\n * We can't use PeerIds as list entries because list entries are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n *\n * @example\n *\n * ```JavaScript\n * import { peerList } from '@libp2p/peer-collections'\n *\n * const list = peerList()\n * list.push(peerId)\n * ```\n */\nclass PeerList {\n list;\n constructor(list) {\n this.list = [];\n if (list != null) {\n for (const value of list) {\n this.list.push(value.toString());\n }\n }\n }\n [Symbol.iterator]() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.mapIterable)(this.list.entries(), (val) => {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(val[1]);\n });\n }\n concat(list) {\n const output = new PeerList(this);\n for (const value of list) {\n output.push(value);\n }\n return output;\n }\n entries() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.mapIterable)(this.list.entries(), (val) => {\n return [val[0], (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(val[1])];\n });\n }\n every(predicate) {\n return this.list.every((str, index) => {\n return predicate((0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str), index, this);\n });\n }\n filter(predicate) {\n const output = new PeerList();\n this.list.forEach((str, index) => {\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str);\n if (predicate(peerId, index, this)) {\n output.push(peerId);\n }\n });\n return output;\n }\n find(predicate) {\n const str = this.list.find((str, index) => {\n return predicate((0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str), index, this);\n });\n if (str == null) {\n return undefined;\n }\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str);\n }\n findIndex(predicate) {\n return this.list.findIndex((str, index) => {\n return predicate((0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str), index, this);\n });\n }\n forEach(predicate) {\n this.list.forEach((str, index) => {\n predicate((0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str), index, this);\n });\n }\n includes(peerId) {\n return this.list.includes(peerId.toString());\n }\n indexOf(peerId) {\n return this.list.indexOf(peerId.toString());\n }\n pop() {\n const str = this.list.pop();\n if (str == null) {\n return undefined;\n }\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str);\n }\n push(...peerIds) {\n for (const peerId of peerIds) {\n this.list.push(peerId.toString());\n }\n }\n shift() {\n const str = this.list.shift();\n if (str == null) {\n return undefined;\n }\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str);\n }\n unshift(...peerIds) {\n let len = this.list.length;\n for (let i = peerIds.length - 1; i > -1; i--) {\n len = this.list.unshift(peerIds[i].toString());\n }\n return len;\n }\n get length() {\n return this.list.length;\n }\n}\n//# sourceMappingURL=list.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-collections/dist/src/list.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-collections/dist/src/map.js": +/*!***************************************************************!*\ + !*** ./node_modules/@libp2p/peer-collections/dist/src/map.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerMap: () => (/* binding */ PeerMap)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/peer-collections/dist/src/util.js\");\n\n\n/**\n * We can't use PeerIds as map keys because map keys are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n *\n * @example\n *\n * ```JavaScript\n * import { peerMap } from '@libp2p/peer-collections'\n *\n * const map = peerMap()\n * map.set(peerId, 'value')\n * ```\n */\nclass PeerMap {\n map;\n constructor(map) {\n this.map = new Map();\n if (map != null) {\n for (const [key, value] of map.entries()) {\n this.map.set(key.toString(), value);\n }\n }\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n clear() {\n this.map.clear();\n }\n delete(peer) {\n this.map.delete(peer.toString());\n }\n entries() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.mapIterable)(this.map.entries(), (val) => {\n return [(0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(val[0]), val[1]];\n });\n }\n forEach(fn) {\n this.map.forEach((value, key) => {\n fn(value, (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(key), this);\n });\n }\n get(peer) {\n return this.map.get(peer.toString());\n }\n has(peer) {\n return this.map.has(peer.toString());\n }\n set(peer, value) {\n this.map.set(peer.toString(), value);\n }\n keys() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.mapIterable)(this.map.keys(), (val) => {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(val);\n });\n }\n values() {\n return this.map.values();\n }\n get size() {\n return this.map.size;\n }\n}\n//# sourceMappingURL=map.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-collections/dist/src/map.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-collections/dist/src/set.js": +/*!***************************************************************!*\ + !*** ./node_modules/@libp2p/peer-collections/dist/src/set.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerSet: () => (/* binding */ PeerSet)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/peer-collections/dist/src/util.js\");\n\n\n/**\n * We can't use PeerIds as set entries because set entries are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n *\n * @example\n *\n * ```JavaScript\n * import { peerSet } from '@libp2p/peer-collections'\n *\n * const set = peerSet()\n * set.add(peerId)\n * ```\n */\nclass PeerSet {\n set;\n constructor(set) {\n this.set = new Set();\n if (set != null) {\n for (const key of set) {\n this.set.add(key.toString());\n }\n }\n }\n get size() {\n return this.set.size;\n }\n [Symbol.iterator]() {\n return this.values();\n }\n add(peer) {\n this.set.add(peer.toString());\n }\n clear() {\n this.set.clear();\n }\n delete(peer) {\n this.set.delete(peer.toString());\n }\n entries() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.mapIterable)(this.set.entries(), (val) => {\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(val[0]);\n return [peerId, peerId];\n });\n }\n forEach(predicate) {\n this.set.forEach((str) => {\n const id = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(str);\n predicate(id, id, this);\n });\n }\n has(peer) {\n return this.set.has(peer.toString());\n }\n values() {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.mapIterable)(this.set.values(), (val) => {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromString)(val);\n });\n }\n intersection(other) {\n const output = new PeerSet();\n for (const peerId of other) {\n if (this.has(peerId)) {\n output.add(peerId);\n }\n }\n return output;\n }\n difference(other) {\n const output = new PeerSet();\n for (const peerId of this) {\n if (!other.has(peerId)) {\n output.add(peerId);\n }\n }\n return output;\n }\n union(other) {\n const output = new PeerSet();\n for (const peerId of other) {\n output.add(peerId);\n }\n for (const peerId of this) {\n output.add(peerId);\n }\n return output;\n }\n}\n//# sourceMappingURL=set.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-collections/dist/src/set.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-collections/dist/src/util.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/peer-collections/dist/src/util.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mapIterable: () => (/* binding */ mapIterable)\n/* harmony export */ });\n/**\n * Calls the passed map function on every entry of the passed iterable iterator\n */\nfunction mapIterable(iter, map) {\n const iterator = {\n [Symbol.iterator]: () => {\n return iterator;\n },\n next: () => {\n const next = iter.next();\n const val = next.value;\n if (next.done === true || val == null) {\n const result = {\n done: true,\n value: undefined\n };\n return result;\n }\n return {\n done: false,\n value: map(val)\n };\n }\n };\n return iterator;\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-collections/dist/src/util.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-id-factory/dist/src/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/peer-id-factory/dist/src/index.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createEd25519PeerId: () => (/* binding */ createEd25519PeerId),\n/* harmony export */ createFromJSON: () => (/* binding */ createFromJSON),\n/* harmony export */ createFromPrivKey: () => (/* binding */ createFromPrivKey),\n/* harmony export */ createFromProtobuf: () => (/* binding */ createFromProtobuf),\n/* harmony export */ createFromPubKey: () => (/* binding */ createFromPubKey),\n/* harmony export */ createRSAPeerId: () => (/* binding */ createRSAPeerId),\n/* harmony export */ createSecp256k1PeerId: () => (/* binding */ createSecp256k1PeerId),\n/* harmony export */ exportToProtobuf: () => (/* binding */ exportToProtobuf)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _proto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proto.js */ \"./node_modules/@libp2p/peer-id-factory/dist/src/proto.js\");\n\n\n\n\nconst createEd25519PeerId = async () => {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.generateKeyPair)('Ed25519');\n const id = await createFromPrivKey(key);\n if (id.type === 'Ed25519') {\n return id;\n }\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`);\n};\nconst createSecp256k1PeerId = async () => {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.generateKeyPair)('secp256k1');\n const id = await createFromPrivKey(key);\n if (id.type === 'secp256k1') {\n return id;\n }\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`);\n};\nconst createRSAPeerId = async (opts) => {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.generateKeyPair)('RSA', opts?.bits ?? 2048);\n const id = await createFromPrivKey(key);\n if (id.type === 'RSA') {\n return id;\n }\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`);\n};\nasync function createFromPubKey(publicKey) {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromKeys)((0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.marshalPublicKey)(publicKey));\n}\nasync function createFromPrivKey(privateKey) {\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromKeys)((0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.marshalPublicKey)(privateKey.public), (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.marshalPrivateKey)(privateKey));\n}\nfunction exportToProtobuf(peerId, excludePrivateKey) {\n return _proto_js__WEBPACK_IMPORTED_MODULE_3__.PeerIdProto.encode({\n id: peerId.multihash.bytes,\n pubKey: peerId.publicKey,\n privKey: excludePrivateKey === true || peerId.privateKey == null ? undefined : peerId.privateKey\n });\n}\nasync function createFromProtobuf(buf) {\n const { id, privKey, pubKey } = _proto_js__WEBPACK_IMPORTED_MODULE_3__.PeerIdProto.decode(buf);\n return createFromParts(id ?? new Uint8Array(0), privKey, pubKey);\n}\nasync function createFromJSON(obj) {\n return createFromParts((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(obj.id, 'base58btc'), obj.privKey != null ? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(obj.privKey, 'base64pad') : undefined, obj.pubKey != null ? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(obj.pubKey, 'base64pad') : undefined);\n}\nasync function createFromParts(multihash, privKey, pubKey) {\n if (privKey != null) {\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(privKey);\n return createFromPrivKey(key);\n }\n else if (pubKey != null) {\n const key = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPublicKey)(pubKey);\n return createFromPubKey(key);\n }\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromBytes)(multihash);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-id-factory/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-id-factory/dist/src/proto.js": +/*!****************************************************************!*\ + !*** ./node_modules/@libp2p/peer-id-factory/dist/src/proto.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerIdProto: () => (/* binding */ PeerIdProto)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerIdProto;\n(function (PeerIdProto) {\n let _codec;\n PeerIdProto.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.id != null) {\n w.uint32(10);\n w.bytes(obj.id);\n }\n if (obj.pubKey != null) {\n w.uint32(18);\n w.bytes(obj.pubKey);\n }\n if (obj.privKey != null) {\n w.uint32(26);\n w.bytes(obj.privKey);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.id = reader.bytes();\n break;\n case 2:\n obj.pubKey = reader.bytes();\n break;\n case 3:\n obj.privKey = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerIdProto.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerIdProto.codec());\n };\n PeerIdProto.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerIdProto.codec());\n };\n})(PeerIdProto || (PeerIdProto = {}));\n//# sourceMappingURL=proto.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-id-factory/dist/src/proto.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-id/dist/src/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@libp2p/peer-id/dist/src/index.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerId: () => (/* binding */ createPeerId),\n/* harmony export */ peerIdFromBytes: () => (/* binding */ peerIdFromBytes),\n/* harmony export */ peerIdFromCID: () => (/* binding */ peerIdFromCID),\n/* harmony export */ peerIdFromKeys: () => (/* binding */ peerIdFromKeys),\n/* harmony export */ peerIdFromPeerId: () => (/* binding */ peerIdFromPeerId),\n/* harmony export */ peerIdFromString: () => (/* binding */ peerIdFromString)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-peer-id */ \"./node_modules/@libp2p/interface-peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/src/basics.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/src/cid.js\");\n/* harmony import */ var multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! multiformats/hashes/digest */ \"./node_modules/multiformats/src/hashes/digest.js\");\n/* harmony import */ var multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! multiformats/hashes/identity */ \"./node_modules/multiformats/src/hashes/identity.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n\n\n\n\n\n\n\n\n\nconst inspect = Symbol.for('nodejs.util.inspect.custom');\nconst baseDecoder = Object\n .values(multiformats_basics__WEBPACK_IMPORTED_MODULE_3__.bases)\n .map(codec => codec.decoder)\n // @ts-expect-error https://github.com/multiformats/js-multiformats/issues/141\n .reduce((acc, curr) => acc.or(curr), multiformats_basics__WEBPACK_IMPORTED_MODULE_3__.bases.identity.decoder);\n// these values are from https://github.com/multiformats/multicodec/blob/master/table.csv\nconst LIBP2P_KEY_CODE = 0x72;\nconst MARSHALLED_ED225519_PUBLIC_KEY_LENGTH = 36;\nconst MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH = 37;\nclass PeerIdImpl {\n type;\n multihash;\n privateKey;\n publicKey;\n string;\n constructor(init) {\n this.type = init.type;\n this.multihash = init.multihash;\n this.privateKey = init.privateKey;\n // mark string cache as non-enumerable\n Object.defineProperty(this, 'string', {\n enumerable: false,\n writable: true\n });\n }\n get [Symbol.toStringTag]() {\n return `PeerId(${this.toString()})`;\n }\n [_libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__.symbol] = true;\n toString() {\n if (this.string == null) {\n this.string = multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__.base58btc.encode(this.multihash.bytes).slice(1);\n }\n return this.string;\n }\n // return self-describing String representation\n // in default format from RFC 0001: https://github.com/libp2p/specs/pull/209\n toCID() {\n return multiformats_cid__WEBPACK_IMPORTED_MODULE_4__.CID.createV1(LIBP2P_KEY_CODE, this.multihash);\n }\n toBytes() {\n return this.multihash.bytes;\n }\n /**\n * Returns Multiaddr as a JSON string\n */\n toJSON() {\n return this.toString();\n }\n /**\n * Checks the equality of `this` peer against a given PeerId\n */\n equals(id) {\n if (id instanceof Uint8Array) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_8__.equals)(this.multihash.bytes, id);\n }\n else if (typeof id === 'string') {\n return peerIdFromString(id).equals(this);\n }\n else if (id?.multihash?.bytes != null) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_8__.equals)(this.multihash.bytes, id.multihash.bytes);\n }\n else {\n throw new Error('not valid Id');\n }\n }\n /**\n * Returns PeerId as a human-readable string\n * https://nodejs.org/api/util.html#utilinspectcustom\n *\n * @example\n * ```js\n * import { peerIdFromString } from '@libp2p/peer-id'\n *\n * console.info(peerIdFromString('QmFoo'))\n * // 'PeerId(QmFoo)'\n * ```\n */\n [inspect]() {\n return `PeerId(${this.toString()})`;\n }\n}\nclass RSAPeerIdImpl extends PeerIdImpl {\n type = 'RSA';\n publicKey;\n constructor(init) {\n super({ ...init, type: 'RSA' });\n this.publicKey = init.publicKey;\n }\n}\nclass Ed25519PeerIdImpl extends PeerIdImpl {\n type = 'Ed25519';\n publicKey;\n constructor(init) {\n super({ ...init, type: 'Ed25519' });\n this.publicKey = init.multihash.digest;\n }\n}\nclass Secp256k1PeerIdImpl extends PeerIdImpl {\n type = 'secp256k1';\n publicKey;\n constructor(init) {\n super({ ...init, type: 'secp256k1' });\n this.publicKey = init.multihash.digest;\n }\n}\nfunction createPeerId(init) {\n if (init.type === 'RSA') {\n return new RSAPeerIdImpl(init);\n }\n if (init.type === 'Ed25519') {\n return new Ed25519PeerIdImpl(init);\n }\n if (init.type === 'secp256k1') {\n return new Secp256k1PeerIdImpl(init);\n }\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Type must be \"RSA\", \"Ed25519\" or \"secp256k1\"', 'ERR_INVALID_PARAMETERS');\n}\nfunction peerIdFromPeerId(other) {\n if (other.type === 'RSA') {\n return new RSAPeerIdImpl(other);\n }\n if (other.type === 'Ed25519') {\n return new Ed25519PeerIdImpl(other);\n }\n if (other.type === 'secp256k1') {\n return new Secp256k1PeerIdImpl(other);\n }\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Not a PeerId', 'ERR_INVALID_PARAMETERS');\n}\nfunction peerIdFromString(str, decoder) {\n decoder = decoder ?? baseDecoder;\n if (str.charAt(0) === '1' || str.charAt(0) === 'Q') {\n // identity hash ed25519/secp256k1 key or sha2-256 hash of\n // rsa public key - base58btc encoded either way\n const multihash = multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__.decode(multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__.base58btc.decode(`z${str}`));\n if (str.startsWith('12D')) {\n return new Ed25519PeerIdImpl({ multihash });\n }\n else if (str.startsWith('16U')) {\n return new Secp256k1PeerIdImpl({ multihash });\n }\n else {\n return new RSAPeerIdImpl({ multihash });\n }\n }\n return peerIdFromBytes(baseDecoder.decode(str));\n}\nfunction peerIdFromBytes(buf) {\n try {\n const multihash = multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__.decode(buf);\n if (multihash.code === multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_6__.identity.code) {\n if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {\n return new Ed25519PeerIdImpl({ multihash });\n }\n else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {\n return new Secp256k1PeerIdImpl({ multihash });\n }\n }\n if (multihash.code === multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_7__.sha256.code) {\n return new RSAPeerIdImpl({ multihash });\n }\n }\n catch {\n return peerIdFromCID(multiformats_cid__WEBPACK_IMPORTED_MODULE_4__.CID.decode(buf));\n }\n throw new Error('Supplied PeerID CID is invalid');\n}\nfunction peerIdFromCID(cid) {\n if (cid == null || cid.multihash == null || cid.version == null || (cid.version === 1 && cid.code !== LIBP2P_KEY_CODE)) {\n throw new Error('Supplied PeerID CID is invalid');\n }\n const multihash = cid.multihash;\n if (multihash.code === multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_7__.sha256.code) {\n return new RSAPeerIdImpl({ multihash: cid.multihash });\n }\n else if (multihash.code === multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_6__.identity.code) {\n if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {\n return new Ed25519PeerIdImpl({ multihash: cid.multihash });\n }\n else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {\n return new Secp256k1PeerIdImpl({ multihash: cid.multihash });\n }\n }\n throw new Error('Supplied PeerID CID is invalid');\n}\n/**\n * @param publicKey - A marshalled public key\n * @param privateKey - A marshalled private key\n */\nasync function peerIdFromKeys(publicKey, privateKey) {\n if (publicKey.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {\n return new Ed25519PeerIdImpl({ multihash: multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__.create(multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_6__.identity.code, publicKey), privateKey });\n }\n if (publicKey.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {\n return new Secp256k1PeerIdImpl({ multihash: multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__.create(multiformats_hashes_identity__WEBPACK_IMPORTED_MODULE_6__.identity.code, publicKey), privateKey });\n }\n return new RSAPeerIdImpl({ multihash: await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_7__.sha256.digest(publicKey), publicKey, privateKey });\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-id/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js": +/*!************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Envelope: () => (/* binding */ Envelope)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Envelope;\n(function (Envelope) {\n let _codec;\n Envelope.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.publicKey != null && obj.publicKey.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.publicKey);\n }\n if ((obj.payloadType != null && obj.payloadType.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.payloadType);\n }\n if ((obj.payload != null && obj.payload.byteLength > 0)) {\n w.uint32(26);\n w.bytes(obj.payload);\n }\n if ((obj.signature != null && obj.signature.byteLength > 0)) {\n w.uint32(42);\n w.bytes(obj.signature);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n publicKey: new Uint8Array(0),\n payloadType: new Uint8Array(0),\n payload: new Uint8Array(0),\n signature: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.publicKey = reader.bytes();\n break;\n case 2:\n obj.payloadType = reader.bytes();\n break;\n case 3:\n obj.payload = reader.bytes();\n break;\n case 5:\n obj.signature = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Envelope.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Envelope.codec());\n };\n Envelope.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Envelope.codec());\n };\n})(Envelope || (Envelope = {}));\n//# sourceMappingURL=envelope.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/envelope/index.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/envelope/index.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RecordEnvelope: () => (/* binding */ RecordEnvelope)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-record/dist/src/errors.js\");\n/* harmony import */ var _envelope_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./envelope.js */ \"./node_modules/@libp2p/peer-record/dist/src/envelope/envelope.js\");\n\n\n\n\n\n\n\n\n\nclass RecordEnvelope {\n /**\n * Unmarshal a serialized Envelope protobuf message\n */\n static createFromProtobuf = async (data) => {\n const envelopeData = _envelope_js__WEBPACK_IMPORTED_MODULE_8__.Envelope.decode(data);\n const peerId = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromKeys)(envelopeData.publicKey);\n return new RecordEnvelope({\n peerId,\n payloadType: envelopeData.payloadType,\n payload: envelopeData.payload,\n signature: envelopeData.signature\n });\n };\n /**\n * Seal marshals the given Record, places the marshaled bytes inside an Envelope\n * and signs it with the given peerId's private key\n */\n static seal = async (record, peerId) => {\n if (peerId.privateKey == null) {\n throw new Error('Missing private key');\n }\n const domain = record.domain;\n const payloadType = record.codec;\n const payload = record.marshal();\n const signData = formatSignaturePayload(domain, payloadType, payload);\n const key = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(peerId.privateKey);\n const signature = await key.sign(signData.subarray());\n return new RecordEnvelope({\n peerId,\n payloadType,\n payload,\n signature\n });\n };\n /**\n * Open and certify a given marshalled envelope.\n * Data is unmarshalled and the signature validated for the given domain.\n */\n static openAndCertify = async (data, domain) => {\n const envelope = await RecordEnvelope.createFromProtobuf(data);\n const valid = await envelope.validate(domain);\n if (!valid) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('envelope signature is not valid for the given domain', _errors_js__WEBPACK_IMPORTED_MODULE_7__.codes.ERR_SIGNATURE_NOT_VALID);\n }\n return envelope;\n };\n peerId;\n payloadType;\n payload;\n signature;\n marshaled;\n /**\n * The Envelope is responsible for keeping an arbitrary signed record\n * by a libp2p peer.\n */\n constructor(init) {\n const { peerId, payloadType, payload, signature } = init;\n this.peerId = peerId;\n this.payloadType = payloadType;\n this.payload = payload;\n this.signature = signature;\n }\n /**\n * Marshal the envelope content\n */\n marshal() {\n if (this.peerId.publicKey == null) {\n throw new Error('Missing public key');\n }\n if (this.marshaled == null) {\n this.marshaled = _envelope_js__WEBPACK_IMPORTED_MODULE_8__.Envelope.encode({\n publicKey: this.peerId.publicKey,\n payloadType: this.payloadType,\n payload: this.payload.subarray(),\n signature: this.signature\n });\n }\n return this.marshaled;\n }\n /**\n * Verifies if the other Envelope is identical to this one\n */\n equals(other) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__.equals)(this.marshal(), other.marshal());\n }\n /**\n * Validate envelope data signature for the given domain\n */\n async validate(domain) {\n const signData = formatSignaturePayload(domain, this.payloadType, this.payload);\n if (this.peerId.publicKey == null) {\n throw new Error('Missing public key');\n }\n const key = (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPublicKey)(this.peerId.publicKey);\n return key.verify(signData.subarray(), this.signature);\n }\n}\n/**\n * Helper function that prepares a Uint8Array to sign or verify a signature\n */\nconst formatSignaturePayload = (domain, payloadType, payload) => {\n // When signing, a peer will prepare a Uint8Array by concatenating the following:\n // - The length of the domain separation string string in bytes\n // - The domain separation string, encoded as UTF-8\n // - The length of the payload_type field in bytes\n // - The value of the payload_type field\n // - The length of the payload field in bytes\n // - The value of the payload field\n const domainUint8Array = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_6__.fromString)(domain);\n const domainLength = uint8_varint__WEBPACK_IMPORTED_MODULE_3__.unsigned.encode(domainUint8Array.byteLength);\n const payloadTypeLength = uint8_varint__WEBPACK_IMPORTED_MODULE_3__.unsigned.encode(payloadType.length);\n const payloadLength = uint8_varint__WEBPACK_IMPORTED_MODULE_3__.unsigned.encode(payload.length);\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_4__.Uint8ArrayList(domainLength, domainUint8Array, payloadTypeLength, payloadType, payloadLength, payload);\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/envelope/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/errors.js": +/*!*************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/errors.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nconst codes = {\n ERR_SIGNATURE_NOT_VALID: 'ERR_SIGNATURE_NOT_VALID'\n};\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerRecord: () => (/* reexport safe */ _peer_record_index_js__WEBPACK_IMPORTED_MODULE_1__.PeerRecord),\n/* harmony export */ RecordEnvelope: () => (/* reexport safe */ _envelope_index_js__WEBPACK_IMPORTED_MODULE_0__.RecordEnvelope)\n/* harmony export */ });\n/* harmony import */ var _envelope_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./envelope/index.js */ \"./node_modules/@libp2p/peer-record/dist/src/envelope/index.js\");\n/* harmony import */ var _peer_record_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./peer-record/index.js */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENVELOPE_DOMAIN_PEER_RECORD: () => (/* binding */ ENVELOPE_DOMAIN_PEER_RECORD),\n/* harmony export */ ENVELOPE_PAYLOAD_TYPE_PEER_RECORD: () => (/* binding */ ENVELOPE_PAYLOAD_TYPE_PEER_RECORD)\n/* harmony export */ });\n// The domain string used for peer records contained in a Envelope.\nconst ENVELOPE_DOMAIN_PEER_RECORD = 'libp2p-peer-record';\n// The type hint used to identify peer records in a Envelope.\n// Defined in https://github.com/multiformats/multicodec/blob/master/table.csv\n// with name \"libp2p-peer-record\"\nconst ENVELOPE_PAYLOAD_TYPE_PEER_RECORD = Uint8Array.from([3, 1]);\n//# sourceMappingURL=consts.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerRecord: () => (/* binding */ PeerRecord)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_utils_array_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/utils/array-equals */ \"./node_modules/@libp2p/utils/dist/src/array-equals.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./consts.js */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/consts.js\");\n/* harmony import */ var _peer_record_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer-record.js */ \"./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js\");\n\n\n\n\n\n/**\n * The PeerRecord is used for distributing peer routing records across the network.\n * It contains the peer's reachable listen addresses.\n */\nclass PeerRecord {\n /**\n * Unmarshal Peer Record Protobuf\n */\n static createFromProtobuf = (buf) => {\n const peerRecord = _peer_record_js__WEBPACK_IMPORTED_MODULE_4__.PeerRecord.decode(buf);\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromBytes)(peerRecord.peerId);\n const multiaddrs = (peerRecord.addresses ?? []).map((a) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(a.multiaddr));\n const seqNumber = peerRecord.seq;\n return new PeerRecord({ peerId, multiaddrs, seqNumber });\n };\n static DOMAIN = _consts_js__WEBPACK_IMPORTED_MODULE_3__.ENVELOPE_DOMAIN_PEER_RECORD;\n static CODEC = _consts_js__WEBPACK_IMPORTED_MODULE_3__.ENVELOPE_PAYLOAD_TYPE_PEER_RECORD;\n peerId;\n multiaddrs;\n seqNumber;\n domain = PeerRecord.DOMAIN;\n codec = PeerRecord.CODEC;\n marshaled;\n constructor(init) {\n const { peerId, multiaddrs, seqNumber } = init;\n this.peerId = peerId;\n this.multiaddrs = multiaddrs ?? [];\n this.seqNumber = seqNumber ?? BigInt(Date.now());\n }\n /**\n * Marshal a record to be used in an envelope\n */\n marshal() {\n if (this.marshaled == null) {\n this.marshaled = _peer_record_js__WEBPACK_IMPORTED_MODULE_4__.PeerRecord.encode({\n peerId: this.peerId.toBytes(),\n seq: BigInt(this.seqNumber),\n addresses: this.multiaddrs.map((m) => ({\n multiaddr: m.bytes\n }))\n });\n }\n return this.marshaled;\n }\n /**\n * Returns true if `this` record equals the `other`\n */\n equals(other) {\n if (!(other instanceof PeerRecord)) {\n return false;\n }\n // Validate PeerId\n if (!this.peerId.equals(other.peerId)) {\n return false;\n }\n // Validate seqNumber\n if (this.seqNumber !== other.seqNumber) {\n return false;\n }\n // Validate multiaddrs\n if (!(0,_libp2p_utils_array_equals__WEBPACK_IMPORTED_MODULE_1__.arrayEquals)(this.multiaddrs, other.multiaddrs)) {\n return false;\n }\n return true;\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/peer-record/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerRecord: () => (/* binding */ PeerRecord)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerRecord;\n(function (PeerRecord) {\n let AddressInfo;\n (function (AddressInfo) {\n let _codec;\n AddressInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.multiaddr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n multiaddr: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.multiaddr = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n AddressInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, AddressInfo.codec());\n };\n AddressInfo.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, AddressInfo.codec());\n };\n })(AddressInfo = PeerRecord.AddressInfo || (PeerRecord.AddressInfo = {}));\n let _codec;\n PeerRecord.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.peerId != null && obj.peerId.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.peerId);\n }\n if ((obj.seq != null && obj.seq !== 0n)) {\n w.uint32(16);\n w.uint64(obj.seq);\n }\n if (obj.addresses != null) {\n for (const value of obj.addresses) {\n w.uint32(26);\n PeerRecord.AddressInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n peerId: new Uint8Array(0),\n seq: 0n,\n addresses: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.peerId = reader.bytes();\n break;\n case 2:\n obj.seq = reader.uint64();\n break;\n case 3:\n obj.addresses.push(PeerRecord.AddressInfo.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerRecord.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerRecord.codec());\n };\n PeerRecord.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerRecord.codec());\n };\n})(PeerRecord || (PeerRecord = {}));\n//# sourceMappingURL=peer-record.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-record/dist/src/peer-record/peer-record.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/errors.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/errors.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nconst codes = {\n ERR_INVALID_PARAMETERS: 'ERR_INVALID_PARAMETERS'\n};\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PersistentPeerStore: () => (/* binding */ PersistentPeerStore)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/index.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@libp2p/peer-store/dist/src/store.js\");\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:peer-store');\n/**\n * An implementation of PeerStore that stores data in a Datastore\n */\nclass PersistentPeerStore {\n store;\n events;\n peerId;\n constructor(components, init = {}) {\n this.events = components.events;\n this.peerId = components.peerId;\n this.store = new _store_js__WEBPACK_IMPORTED_MODULE_3__.PersistentStore(components, init);\n }\n async forEach(fn, query) {\n log.trace('forEach await read lock');\n const release = await this.store.lock.readLock();\n log.trace('forEach got read lock');\n try {\n for await (const peer of this.store.all(query)) {\n fn(peer);\n }\n }\n finally {\n log.trace('forEach release read lock');\n release();\n }\n }\n async all(query) {\n log.trace('all await read lock');\n const release = await this.store.lock.readLock();\n log.trace('all got read lock');\n try {\n return await (0,it_all__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(this.store.all(query));\n }\n finally {\n log.trace('all release read lock');\n release();\n }\n }\n async delete(peerId) {\n log.trace('delete await write lock');\n const release = await this.store.lock.writeLock();\n log.trace('delete got write lock');\n try {\n await this.store.delete(peerId);\n }\n finally {\n log.trace('delete release write lock');\n release();\n }\n }\n async has(peerId) {\n log.trace('has await read lock');\n const release = await this.store.lock.readLock();\n log.trace('has got read lock');\n try {\n return await this.store.has(peerId);\n }\n finally {\n log.trace('has release read lock');\n release();\n }\n }\n async get(peerId) {\n log.trace('get await read lock');\n const release = await this.store.lock.readLock();\n log.trace('get got read lock');\n try {\n return await this.store.load(peerId);\n }\n finally {\n log.trace('get release read lock');\n release();\n }\n }\n async save(id, data) {\n log.trace('save await write lock');\n const release = await this.store.lock.writeLock();\n log.trace('save got write lock');\n try {\n const result = await this.store.save(id, data);\n this.#emitIfUpdated(id, result);\n return result.peer;\n }\n finally {\n log.trace('save release write lock');\n release();\n }\n }\n async patch(id, data) {\n log.trace('patch await write lock');\n const release = await this.store.lock.writeLock();\n log.trace('patch got write lock');\n try {\n const result = await this.store.patch(id, data);\n this.#emitIfUpdated(id, result);\n return result.peer;\n }\n finally {\n log.trace('patch release write lock');\n release();\n }\n }\n async merge(id, data) {\n log.trace('merge await write lock');\n const release = await this.store.lock.writeLock();\n log.trace('merge got write lock');\n try {\n const result = await this.store.merge(id, data);\n this.#emitIfUpdated(id, result);\n return result.peer;\n }\n finally {\n log.trace('merge release write lock');\n release();\n }\n }\n async consumePeerRecord(buf, expectedPeer) {\n const envelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_1__.RecordEnvelope.openAndCertify(buf, _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_1__.PeerRecord.DOMAIN);\n if (expectedPeer?.equals(envelope.peerId) === false) {\n log('envelope peer id was not the expected peer id - expected: %p received: %p', expectedPeer, envelope.peerId);\n return false;\n }\n const peerRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_1__.PeerRecord.createFromProtobuf(envelope.payload);\n let peer;\n try {\n peer = await this.get(envelope.peerId);\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n // ensure seq is greater than, or equal to, the last received\n if (peer?.peerRecordEnvelope != null) {\n const storedEnvelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_1__.RecordEnvelope.createFromProtobuf(peer.peerRecordEnvelope);\n const storedRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_1__.PeerRecord.createFromProtobuf(storedEnvelope.payload);\n if (storedRecord.seqNumber >= peerRecord.seqNumber) {\n log('sequence number was lower or equal to existing sequence number - stored: %d received: %d', storedRecord.seqNumber, peerRecord.seqNumber);\n return false;\n }\n }\n await this.patch(peerRecord.peerId, {\n peerRecordEnvelope: buf,\n addresses: peerRecord.multiaddrs.map(multiaddr => ({\n isCertified: true,\n multiaddr\n }))\n });\n return true;\n }\n #emitIfUpdated(id, result) {\n if (!result.updated) {\n return;\n }\n if (this.peerId.equals(id)) {\n this.events.safeDispatchEvent('self:peer:update', { detail: result });\n }\n else {\n this.events.safeDispatchEvent('peer:update', { detail: result });\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/pb/peer.js": +/*!*************************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/pb/peer.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Address: () => (/* binding */ Address),\n/* harmony export */ Peer: () => (/* binding */ Peer),\n/* harmony export */ Tag: () => (/* binding */ Tag)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Peer;\n(function (Peer) {\n let Peer$metadataEntry;\n (function (Peer$metadataEntry) {\n let _codec;\n Peer$metadataEntry.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.key != null && obj.key !== '')) {\n w.uint32(10);\n w.string(obj.key);\n }\n if ((obj.value != null && obj.value.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.value);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n key: '',\n value: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.key = reader.string();\n break;\n case 2:\n obj.value = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer$metadataEntry.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer$metadataEntry.codec());\n };\n Peer$metadataEntry.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer$metadataEntry.codec());\n };\n })(Peer$metadataEntry = Peer.Peer$metadataEntry || (Peer.Peer$metadataEntry = {}));\n let Peer$tagsEntry;\n (function (Peer$tagsEntry) {\n let _codec;\n Peer$tagsEntry.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.key != null && obj.key !== '')) {\n w.uint32(10);\n w.string(obj.key);\n }\n if (obj.value != null) {\n w.uint32(18);\n Tag.codec().encode(obj.value, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n key: ''\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.key = reader.string();\n break;\n case 2:\n obj.value = Tag.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer$tagsEntry.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer$tagsEntry.codec());\n };\n Peer$tagsEntry.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer$tagsEntry.codec());\n };\n })(Peer$tagsEntry = Peer.Peer$tagsEntry || (Peer.Peer$tagsEntry = {}));\n let _codec;\n Peer.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.addresses != null) {\n for (const value of obj.addresses) {\n w.uint32(10);\n Address.codec().encode(value, w);\n }\n }\n if (obj.protocols != null) {\n for (const value of obj.protocols) {\n w.uint32(18);\n w.string(value);\n }\n }\n if (obj.publicKey != null) {\n w.uint32(34);\n w.bytes(obj.publicKey);\n }\n if (obj.peerRecordEnvelope != null) {\n w.uint32(42);\n w.bytes(obj.peerRecordEnvelope);\n }\n if (obj.metadata != null && obj.metadata.size !== 0) {\n for (const [key, value] of obj.metadata.entries()) {\n w.uint32(50);\n Peer.Peer$metadataEntry.codec().encode({ key, value }, w);\n }\n }\n if (obj.tags != null && obj.tags.size !== 0) {\n for (const [key, value] of obj.tags.entries()) {\n w.uint32(58);\n Peer.Peer$tagsEntry.codec().encode({ key, value }, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n addresses: [],\n protocols: [],\n metadata: new Map(),\n tags: new Map()\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.addresses.push(Address.codec().decode(reader, reader.uint32()));\n break;\n case 2:\n obj.protocols.push(reader.string());\n break;\n case 4:\n obj.publicKey = reader.bytes();\n break;\n case 5:\n obj.peerRecordEnvelope = reader.bytes();\n break;\n case 6: {\n const entry = Peer.Peer$metadataEntry.codec().decode(reader, reader.uint32());\n obj.metadata.set(entry.key, entry.value);\n break;\n }\n case 7: {\n const entry = Peer.Peer$tagsEntry.codec().decode(reader, reader.uint32());\n obj.tags.set(entry.key, entry.value);\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer.codec());\n };\n Peer.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer.codec());\n };\n})(Peer || (Peer = {}));\nvar Address;\n(function (Address) {\n let _codec;\n Address.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.multiaddr);\n }\n if (obj.isCertified != null) {\n w.uint32(16);\n w.bool(obj.isCertified);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n multiaddr: new Uint8Array(0)\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.multiaddr = reader.bytes();\n break;\n case 2:\n obj.isCertified = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Address.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Address.codec());\n };\n Address.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Address.codec());\n };\n})(Address || (Address = {}));\nvar Tag;\n(function (Tag) {\n let _codec;\n Tag.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.value != null && obj.value !== 0)) {\n w.uint32(8);\n w.uint32(obj.value);\n }\n if (obj.expiry != null) {\n w.uint32(16);\n w.uint64(obj.expiry);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n value: 0\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.value = reader.uint32();\n break;\n case 2:\n obj.expiry = reader.uint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Tag.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Tag.codec());\n };\n Tag.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Tag.codec());\n };\n})(Tag || (Tag = {}));\n//# sourceMappingURL=peer.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/pb/peer.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/store.js": +/*!***********************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/store.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PersistentStore: () => (/* binding */ PersistentStore)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var mortice__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mortice */ \"./node_modules/mortice/dist/src/index.js\");\n/* harmony import */ var multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! multiformats/bases/base32 */ \"./node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n/* harmony import */ var _pb_peer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./pb/peer.js */ \"./node_modules/@libp2p/peer-store/dist/src/pb/peer.js\");\n/* harmony import */ var _utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/bytes-to-peer.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js\");\n/* harmony import */ var _utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/peer-id-to-datastore-key.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js\");\n/* harmony import */ var _utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/to-peer-pb.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js\");\n\n\n\n\n\n\n\n\n\n\n\nfunction decodePeer(key, value, cache) {\n // /peers/${peer-id-as-libp2p-key-cid-string-in-base-32}\n const base32Str = key.toString().split('/')[2];\n const buf = multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_4__.base32.decode(base32Str);\n const peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromBytes)(buf);\n const cached = cache.get(peerId);\n if (cached != null) {\n return cached;\n }\n const peer = (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_8__.bytesToPeer)(peerId, value);\n cache.set(peerId, peer);\n return peer;\n}\nfunction mapQuery(query, cache) {\n if (query == null) {\n return {};\n }\n return {\n prefix: _utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__.NAMESPACE_COMMON,\n filters: (query.filters ?? []).map(fn => ({ key, value }) => {\n return fn(decodePeer(key, value, cache));\n }),\n orders: (query.orders ?? []).map(fn => (a, b) => {\n return fn(decodePeer(a.key, a.value, cache), decodePeer(b.key, b.value, cache));\n })\n };\n}\nclass PersistentStore {\n peerId;\n datastore;\n lock;\n addressFilter;\n constructor(components, init = {}) {\n this.peerId = components.peerId;\n this.datastore = components.datastore;\n this.addressFilter = init.addressFilter;\n this.lock = (0,mortice__WEBPACK_IMPORTED_MODULE_3__[\"default\"])({\n name: 'peer-store',\n singleProcess: true\n });\n }\n async has(peerId) {\n return this.datastore.has((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__.peerIdToDatastoreKey)(peerId));\n }\n async delete(peerId) {\n if (this.peerId.equals(peerId)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Cannot delete self peer', _errors_js__WEBPACK_IMPORTED_MODULE_6__.codes.ERR_INVALID_PARAMETERS);\n }\n await this.datastore.delete((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__.peerIdToDatastoreKey)(peerId));\n }\n async load(peerId) {\n const buf = await this.datastore.get((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__.peerIdToDatastoreKey)(peerId));\n return (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_8__.bytesToPeer)(peerId, buf);\n }\n async save(peerId, data) {\n const { existingBuf, existingPeer } = await this.#findExistingPeer(peerId);\n const peerPb = await (0,_utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_10__.toPeerPB)(peerId, data, 'patch', {\n addressFilter: this.addressFilter\n });\n return this.#saveIfDifferent(peerId, peerPb, existingBuf, existingPeer);\n }\n async patch(peerId, data) {\n const { existingBuf, existingPeer } = await this.#findExistingPeer(peerId);\n const peerPb = await (0,_utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_10__.toPeerPB)(peerId, data, 'patch', {\n addressFilter: this.addressFilter,\n existingPeer\n });\n return this.#saveIfDifferent(peerId, peerPb, existingBuf, existingPeer);\n }\n async merge(peerId, data) {\n const { existingBuf, existingPeer } = await this.#findExistingPeer(peerId);\n const peerPb = await (0,_utils_to_peer_pb_js__WEBPACK_IMPORTED_MODULE_10__.toPeerPB)(peerId, data, 'merge', {\n addressFilter: this.addressFilter,\n existingPeer\n });\n return this.#saveIfDifferent(peerId, peerPb, existingBuf, existingPeer);\n }\n async *all(query) {\n const peerCache = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__.PeerMap();\n for await (const { key, value } of this.datastore.query(mapQuery(query ?? {}, peerCache))) {\n const peer = decodePeer(key, value, peerCache);\n if (peer.id.equals(this.peerId)) {\n // Skip self peer if present\n continue;\n }\n yield peer;\n }\n }\n async #findExistingPeer(peerId) {\n try {\n const existingBuf = await this.datastore.get((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__.peerIdToDatastoreKey)(peerId));\n const existingPeer = (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_8__.bytesToPeer)(peerId, existingBuf);\n return {\n existingBuf,\n existingPeer\n };\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n return {};\n }\n async #saveIfDifferent(peerId, peer, existingBuf, existingPeer) {\n const buf = _pb_peer_js__WEBPACK_IMPORTED_MODULE_7__.Peer.encode(peer);\n if (existingBuf != null && (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_5__.equals)(buf, existingBuf)) {\n return {\n peer: (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_8__.bytesToPeer)(peerId, buf),\n previous: existingPeer,\n updated: false\n };\n }\n await this.datastore.put((0,_utils_peer_id_to_datastore_key_js__WEBPACK_IMPORTED_MODULE_9__.peerIdToDatastoreKey)(peerId), buf);\n return {\n peer: (0,_utils_bytes_to_peer_js__WEBPACK_IMPORTED_MODULE_8__.bytesToPeer)(peerId, buf),\n previous: existingPeer,\n updated: true\n };\n }\n}\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/store.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytesToPeer: () => (/* binding */ bytesToPeer)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _pb_peer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../pb/peer.js */ \"./node_modules/@libp2p/peer-store/dist/src/pb/peer.js\");\n\n\n\nfunction bytesToPeer(peerId, buf) {\n const peer = _pb_peer_js__WEBPACK_IMPORTED_MODULE_2__.Peer.decode(buf);\n if (peer.publicKey != null && peerId.publicKey == null) {\n peerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_0__.peerIdFromPeerId)({\n ...peerId,\n publicKey: peerId.publicKey\n });\n }\n const tags = new Map();\n // remove any expired tags\n const now = BigInt(Date.now());\n for (const [key, tag] of peer.tags.entries()) {\n if (tag.expiry != null && tag.expiry < now) {\n continue;\n }\n tags.set(key, tag);\n }\n return {\n ...peer,\n id: peerId,\n addresses: peer.addresses.map(({ multiaddr: ma, isCertified }) => {\n return {\n multiaddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(ma),\n isCertified: isCertified ?? false\n };\n }),\n metadata: peer.metadata,\n peerRecordEnvelope: peer.peerRecordEnvelope ?? undefined,\n tags\n };\n}\n//# sourceMappingURL=bytes-to-peer.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/utils/bytes-to-peer.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ dedupeFilterAndSortAddresses: () => (/* binding */ dedupeFilterAndSortAddresses)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n\n\n\nasync function dedupeFilterAndSortAddresses(peerId, filter, addresses) {\n const addressMap = new Map();\n for (const addr of addresses) {\n if (addr == null) {\n continue;\n }\n if (addr.multiaddr instanceof Uint8Array) {\n addr.multiaddr = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(addr.multiaddr);\n }\n if (!(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__.isMultiaddr)(addr.multiaddr)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Multiaddr was invalid', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (!(await filter(peerId, addr.multiaddr))) {\n continue;\n }\n const isCertified = addr.isCertified ?? false;\n const maStr = addr.multiaddr.toString();\n const existingAddr = addressMap.get(maStr);\n if (existingAddr != null) {\n addr.isCertified = existingAddr.isCertified || isCertified;\n }\n else {\n addressMap.set(maStr, {\n multiaddr: addr.multiaddr,\n isCertified\n });\n }\n }\n return [...addressMap.values()]\n .sort((a, b) => {\n return a.multiaddr.toString().localeCompare(b.multiaddr.toString());\n })\n .map(({ isCertified, multiaddr }) => ({\n isCertified,\n multiaddr: multiaddr.bytes\n }));\n}\n//# sourceMappingURL=dedupe-addresses.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NAMESPACE_COMMON: () => (/* binding */ NAMESPACE_COMMON),\n/* harmony export */ peerIdToDatastoreKey: () => (/* binding */ peerIdToDatastoreKey)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-peer-id */ \"./node_modules/@libp2p/interface-peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var interface_datastore_key__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! interface-datastore/key */ \"./node_modules/interface-datastore/dist/src/key.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n\n\n\n\nconst NAMESPACE_COMMON = '/peers/';\nfunction peerIdToDatastoreKey(peerId) {\n if (!(0,_libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__.isPeerId)(peerId) || peerId.type == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Invalid PeerId', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_INVALID_PARAMETERS);\n }\n const b32key = peerId.toCID().toString();\n return new interface_datastore_key__WEBPACK_IMPORTED_MODULE_2__.Key(`${NAMESPACE_COMMON}${b32key}`);\n}\n//# sourceMappingURL=peer-id-to-datastore-key.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/utils/peer-id-to-datastore-key.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toPeerPB: () => (/* binding */ toPeerPB)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/@libp2p/peer-store/dist/src/errors.js\");\n/* harmony import */ var _dedupe_addresses_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dedupe-addresses.js */ \"./node_modules/@libp2p/peer-store/dist/src/utils/dedupe-addresses.js\");\n\n\n\n\nasync function toPeerPB(peerId, data, strategy, options) {\n if (data == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Invalid PeerData', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (data.publicKey != null && peerId.publicKey != null && !(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(data.publicKey, peerId.publicKey)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('publicKey bytes do not match peer id publicKey bytes', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n const existingPeer = options.existingPeer;\n if (existingPeer != null && !peerId.equals(existingPeer.id)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('peer id did not match existing peer id', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n let addresses = existingPeer?.addresses ?? [];\n let protocols = new Set(existingPeer?.protocols ?? []);\n let metadata = existingPeer?.metadata ?? new Map();\n let tags = existingPeer?.tags ?? new Map();\n let peerRecordEnvelope = existingPeer?.peerRecordEnvelope;\n // when patching, we replace the original fields with passed values\n if (strategy === 'patch') {\n if (data.multiaddrs != null || data.addresses != null) {\n addresses = [];\n if (data.multiaddrs != null) {\n addresses.push(...data.multiaddrs.map(multiaddr => ({\n isCertified: false,\n multiaddr\n })));\n }\n if (data.addresses != null) {\n addresses.push(...data.addresses);\n }\n }\n if (data.protocols != null) {\n protocols = new Set(data.protocols);\n }\n if (data.metadata != null) {\n const metadataEntries = data.metadata instanceof Map ? [...data.metadata.entries()] : Object.entries(data.metadata);\n metadata = createSortedMap(metadataEntries, {\n validate: validateMetadata\n });\n }\n if (data.tags != null) {\n const tagsEntries = data.tags instanceof Map ? [...data.tags.entries()] : Object.entries(data.tags);\n tags = createSortedMap(tagsEntries, {\n validate: validateTag,\n map: mapTag\n });\n }\n if (data.peerRecordEnvelope != null) {\n peerRecordEnvelope = data.peerRecordEnvelope;\n }\n }\n // when merging, we join the original fields with passed values\n if (strategy === 'merge') {\n if (data.multiaddrs != null) {\n addresses.push(...data.multiaddrs.map(multiaddr => ({\n isCertified: false,\n multiaddr\n })));\n }\n if (data.addresses != null) {\n addresses.push(...data.addresses);\n }\n if (data.protocols != null) {\n protocols = new Set([...protocols, ...data.protocols]);\n }\n if (data.metadata != null) {\n const metadataEntries = data.metadata instanceof Map ? [...data.metadata.entries()] : Object.entries(data.metadata);\n for (const [key, value] of metadataEntries) {\n if (value == null) {\n metadata.delete(key);\n }\n else {\n metadata.set(key, value);\n }\n }\n metadata = createSortedMap([...metadata.entries()], {\n validate: validateMetadata\n });\n }\n if (data.tags != null) {\n const tagsEntries = data.tags instanceof Map ? [...data.tags.entries()] : Object.entries(data.tags);\n const mergedTags = new Map(tags);\n for (const [key, value] of tagsEntries) {\n if (value == null) {\n mergedTags.delete(key);\n }\n else {\n mergedTags.set(key, value);\n }\n }\n tags = createSortedMap([...mergedTags.entries()], {\n validate: validateTag,\n map: mapTag\n });\n }\n if (data.peerRecordEnvelope != null) {\n peerRecordEnvelope = data.peerRecordEnvelope;\n }\n }\n const output = {\n addresses: await (0,_dedupe_addresses_js__WEBPACK_IMPORTED_MODULE_3__.dedupeFilterAndSortAddresses)(peerId, options.addressFilter ?? (async () => true), addresses),\n protocols: [...protocols.values()].sort((a, b) => {\n return a.localeCompare(b);\n }),\n metadata,\n tags,\n publicKey: existingPeer?.id.publicKey ?? data.publicKey ?? peerId.publicKey,\n peerRecordEnvelope\n };\n // Ed25519 and secp256k1 have their public key embedded in them so no need to duplicate it\n if (peerId.type !== 'RSA') {\n delete output.publicKey;\n }\n return output;\n}\n/**\n * In JS maps are ordered by insertion order so create a new map with the\n * keys inserted in alphabetical order.\n */\nfunction createSortedMap(entries, options) {\n const output = new Map();\n for (const [key, value] of entries) {\n if (value == null) {\n continue;\n }\n options.validate(key, value);\n }\n for (const [key, value] of entries.sort(([a], [b]) => {\n return a.localeCompare(b);\n })) {\n if (value != null) {\n output.set(key, options.map?.(key, value) ?? value);\n }\n }\n return output;\n}\nfunction validateMetadata(key, value) {\n if (typeof key !== 'string') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Metadata key must be a string', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (!(value instanceof Uint8Array)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Metadata value must be a Uint8Array', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n}\nfunction validateTag(key, tag) {\n if (typeof key !== 'string') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Tag name must be a string', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (tag.value != null) {\n if (parseInt(`${tag.value}`, 10) !== tag.value) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Tag value must be an integer', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (tag.value < 0 || tag.value > 100) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Tag value must be between 0-100', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n if (tag.ttl != null) {\n if (parseInt(`${tag.ttl}`, 10) !== tag.ttl) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Tag ttl must be an integer', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n if (tag.ttl < 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Tag ttl must be between greater than 0', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n}\nfunction mapTag(key, tag) {\n let expiry;\n if (tag.expiry != null) {\n expiry = tag.expiry;\n }\n if (tag.ttl != null) {\n expiry = BigInt(Date.now() + Number(tag.ttl));\n }\n return {\n value: tag.value ?? 0,\n expiry\n };\n}\n//# sourceMappingURL=to-peer-pb.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/peer-store/dist/src/utils/to-peer-pb.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/pubsub/dist/src/errors.js": +/*!********************************************************!*\ + !*** ./node_modules/@libp2p/pubsub/dist/src/errors.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\nconst codes = {\n /**\n * Signature policy is invalid\n */\n ERR_INVALID_SIGNATURE_POLICY: 'ERR_INVALID_SIGNATURE_POLICY',\n /**\n * Signature policy is unhandled\n */\n ERR_UNHANDLED_SIGNATURE_POLICY: 'ERR_UNHANDLED_SIGNATURE_POLICY',\n // Strict signing codes\n /**\n * Message expected to have a `signature`, but doesn't\n */\n ERR_MISSING_SIGNATURE: 'ERR_MISSING_SIGNATURE',\n /**\n * Message expected to have a `seqno`, but doesn't\n */\n ERR_MISSING_SEQNO: 'ERR_MISSING_SEQNO',\n /**\n * Message expected to have a `key`, but doesn't\n */\n ERR_MISSING_KEY: 'ERR_MISSING_KEY',\n /**\n * Message `signature` is invalid\n */\n ERR_INVALID_SIGNATURE: 'ERR_INVALID_SIGNATURE',\n /**\n * Message expected to have a `from`, but doesn't\n */\n ERR_MISSING_FROM: 'ERR_MISSING_FROM',\n // Strict no-signing codes\n /**\n * Message expected to not have a `from`, but does\n */\n ERR_UNEXPECTED_FROM: 'ERR_UNEXPECTED_FROM',\n /**\n * Message expected to not have a `signature`, but does\n */\n ERR_UNEXPECTED_SIGNATURE: 'ERR_UNEXPECTED_SIGNATURE',\n /**\n * Message expected to not have a `key`, but does\n */\n ERR_UNEXPECTED_KEY: 'ERR_UNEXPECTED_KEY',\n /**\n * Message expected to not have a `seqno`, but does\n */\n ERR_UNEXPECTED_SEQNO: 'ERR_UNEXPECTED_SEQNO',\n /**\n * Message failed topic validator\n */\n ERR_TOPIC_VALIDATOR_REJECT: 'ERR_TOPIC_VALIDATOR_REJECT'\n};\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/pubsub/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/pubsub/dist/src/utils.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/pubsub/dist/src/utils.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ anyMatch: () => (/* binding */ anyMatch),\n/* harmony export */ bigIntFromBytes: () => (/* binding */ bigIntFromBytes),\n/* harmony export */ bigIntToBytes: () => (/* binding */ bigIntToBytes),\n/* harmony export */ ensureArray: () => (/* binding */ ensureArray),\n/* harmony export */ msgId: () => (/* binding */ msgId),\n/* harmony export */ noSignMsgId: () => (/* binding */ noSignMsgId),\n/* harmony export */ randomSeqno: () => (/* binding */ randomSeqno),\n/* harmony export */ toMessage: () => (/* binding */ toMessage),\n/* harmony export */ toRpcMessage: () => (/* binding */ toRpcMessage)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/@libp2p/pubsub/dist/src/errors.js\");\n\n\n\n\n\n\n\n/**\n * Generate a random sequence number\n */\nfunction randomSeqno() {\n return BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)((0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_0__.randomBytes)(8), 'base16')}`);\n}\n/**\n * Generate a message id, based on the `key` and `seqno`\n */\nconst msgId = (key, seqno) => {\n const seqnoBytes = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(seqno.toString(16).padStart(16, '0'), 'base16');\n const msgId = new Uint8Array(key.length + seqnoBytes.length);\n msgId.set(key, 0);\n msgId.set(seqnoBytes, key.length);\n return msgId;\n};\n/**\n * Generate a message id, based on message `data`\n */\nconst noSignMsgId = (data) => {\n return multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_3__.sha256.encode(data);\n};\n/**\n * Check if any member of the first set is also a member\n * of the second set\n */\nconst anyMatch = (a, b) => {\n let bHas;\n if (Array.isArray(b)) {\n bHas = (val) => b.includes(val);\n }\n else {\n bHas = (val) => b.has(val);\n }\n for (const val of a) {\n if (bHas(val)) {\n return true;\n }\n }\n return false;\n};\n/**\n * Make everything an array\n */\nconst ensureArray = function (maybeArray) {\n if (!Array.isArray(maybeArray)) {\n return [maybeArray];\n }\n return maybeArray;\n};\nconst isSigned = async (message) => {\n if ((message.sequenceNumber == null) || (message.from == null) || (message.signature == null)) {\n return false;\n }\n // if a public key is present in the `from` field, the message should be signed\n const fromID = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromBytes)(message.from);\n if (fromID.publicKey != null) {\n return true;\n }\n if (message.key != null) {\n const signingID = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromKeys)(message.key);\n return signingID.equals(fromID);\n }\n return false;\n};\nconst toMessage = async (message) => {\n if (message.from == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('RPC message was missing from', _errors_js__WEBPACK_IMPORTED_MODULE_6__.codes.ERR_MISSING_FROM);\n }\n if (!await isSigned(message)) {\n return {\n type: 'unsigned',\n topic: message.topic ?? '',\n data: message.data ?? new Uint8Array(0)\n };\n }\n const from = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromBytes)(message.from);\n const msg = {\n type: 'signed',\n from: (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_2__.peerIdFromBytes)(message.from),\n topic: message.topic ?? '',\n sequenceNumber: bigIntFromBytes(message.sequenceNumber ?? new Uint8Array(0)),\n data: message.data ?? new Uint8Array(0),\n signature: message.signature ?? new Uint8Array(0),\n key: message.key ?? from.publicKey ?? new Uint8Array(0)\n };\n if (msg.key.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Signed RPC message was missing key', _errors_js__WEBPACK_IMPORTED_MODULE_6__.codes.ERR_MISSING_KEY);\n }\n return msg;\n};\nconst toRpcMessage = (message) => {\n if (message.type === 'signed') {\n return {\n from: message.from.multihash.bytes,\n data: message.data,\n sequenceNumber: bigIntToBytes(message.sequenceNumber),\n topic: message.topic,\n signature: message.signature,\n key: message.key\n };\n }\n return {\n data: message.data,\n topic: message.topic\n };\n};\nconst bigIntToBytes = (num) => {\n let str = num.toString(16);\n if (str.length % 2 !== 0) {\n str = `0${str}`;\n }\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_4__.fromString)(str, 'base16');\n};\nconst bigIntFromBytes = (num) => {\n return BigInt(`0x${(0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_5__.toString)(num, 'base16')}`);\n};\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/pubsub/dist/src/utils.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/topology/dist/src/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/@libp2p/topology/dist/src/index.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createTopology: () => (/* binding */ createTopology)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_registrar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-registrar */ \"./node_modules/@libp2p/interface-registrar/dist/src/index.js\");\n\nconst noop = () => { };\nclass TopologyImpl {\n min;\n max;\n /**\n * Set of peers that support the protocol\n */\n peers;\n onConnect;\n onDisconnect;\n registrar;\n constructor(init) {\n this.min = init.min ?? 0;\n this.max = init.max ?? Infinity;\n this.peers = new Set();\n this.onConnect = init.onConnect ?? noop;\n this.onDisconnect = init.onDisconnect ?? noop;\n }\n get [Symbol.toStringTag]() {\n return _libp2p_interface_registrar__WEBPACK_IMPORTED_MODULE_0__.topologySymbol.toString();\n }\n [_libp2p_interface_registrar__WEBPACK_IMPORTED_MODULE_0__.topologySymbol] = true;\n async setRegistrar(registrar) {\n this.registrar = registrar;\n }\n /**\n * Notify about peer disconnected event\n */\n disconnect(peerId) {\n this.onDisconnect(peerId);\n }\n}\nfunction createTopology(init) {\n return new TopologyImpl(init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/topology/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/tracked-map/dist/src/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/tracked-map/dist/src/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ trackedMap: () => (/* binding */ trackedMap)\n/* harmony export */ });\nclass TrackedMap extends Map {\n metric;\n constructor(init) {\n super();\n const { name, metrics } = init;\n this.metric = metrics.registerMetric(name);\n this.updateComponentMetric();\n }\n set(key, value) {\n super.set(key, value);\n this.updateComponentMetric();\n return this;\n }\n delete(key) {\n const deleted = super.delete(key);\n this.updateComponentMetric();\n return deleted;\n }\n clear() {\n super.clear();\n this.updateComponentMetric();\n }\n updateComponentMetric() {\n this.metric.update(this.size);\n }\n}\nfunction trackedMap(config) {\n const { name, metrics } = config;\n let map;\n if (metrics != null) {\n map = new TrackedMap({ name, metrics });\n }\n else {\n map = new Map();\n }\n return map;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/tracked-map/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/utils/dist/src/address-sort.js": +/*!*************************************************************!*\ + !*** ./node_modules/@libp2p/utils/dist/src/address-sort.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ publicAddressesFirst: () => (/* binding */ publicAddressesFirst),\n/* harmony export */ something: () => (/* binding */ something)\n/* harmony export */ });\n/* harmony import */ var _multiaddr_is_private_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./multiaddr/is-private.js */ \"./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js\");\n/**\n * @packageDocumentation\n *\n * Provides strategies to sort a list of multiaddrs.\n *\n * @example\n *\n * ```typescript\n * import { publicAddressesFirst } from '@libp2p/utils/address-sort'\n * import { multiaddr } from '@multformats/multiaddr'\n *\n *\n * const addresses = [\n * multiaddr('/ip4/127.0.0.1/tcp/9000'),\n * multiaddr('/ip4/82.41.53.1/tcp/9000')\n * ].sort(publicAddressesFirst)\n *\n * console.info(addresses)\n * // ['/ip4/82.41.53.1/tcp/9000', '/ip4/127.0.0.1/tcp/9000']\n * ```\n */\n\n/**\n * Compare function for array.sort().\n * This sort aims to move the private addresses to the end of the array.\n * In case of equality, a certified address will come first.\n */\nfunction publicAddressesFirst(a, b) {\n const isAPrivate = (0,_multiaddr_is_private_js__WEBPACK_IMPORTED_MODULE_0__.isPrivate)(a.multiaddr);\n const isBPrivate = (0,_multiaddr_is_private_js__WEBPACK_IMPORTED_MODULE_0__.isPrivate)(b.multiaddr);\n if (isAPrivate && !isBPrivate) {\n return 1;\n }\n else if (!isAPrivate && isBPrivate) {\n return -1;\n }\n // Check certified?\n if (a.isCertified && !b.isCertified) {\n return -1;\n }\n else if (!a.isCertified && b.isCertified) {\n return 1;\n }\n return 0;\n}\n/**\n * A test thing\n */\nasync function something() {\n return Uint8Array.from([0, 1, 2]);\n}\n//# sourceMappingURL=address-sort.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/utils/dist/src/address-sort.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/utils/dist/src/array-equals.js": +/*!*************************************************************!*\ + !*** ./node_modules/@libp2p/utils/dist/src/array-equals.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayEquals: () => (/* binding */ arrayEquals)\n/* harmony export */ });\n/**\n * @packageDocumentation\n *\n * Provides strategies ensure arrays are equivalent.\n *\n * @example\n *\n * ```typescript\n * import { arrayEquals } from '@libp2p/utils/array-equals'\n * import { multiaddr } from '@multformats/multiaddr'\n *\n * const ma1 = multiaddr('/ip4/127.0.0.1/tcp/9000'),\n * const ma2 = multiaddr('/ip4/82.41.53.1/tcp/9000')\n *\n * console.info(arrayEquals([ma1], [ma1])) // true\n * console.info(arrayEquals([ma1], [ma2])) // false\n * ```\n */\n/**\n * Verify if two arrays of non primitive types with the \"equals\" function are equal.\n * Compatible with multiaddr, peer-id and others.\n */\nfunction arrayEquals(a, b) {\n const sort = (a, b) => a.toString().localeCompare(b.toString());\n if (a.length !== b.length) {\n return false;\n }\n b.sort(sort);\n return a.sort(sort).every((item, index) => b[index].equals(item));\n}\n//# sourceMappingURL=array-equals.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/utils/dist/src/array-equals.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPrivate: () => (/* binding */ isPrivate)\n/* harmony export */ });\n/* harmony import */ var private_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! private-ip */ \"./node_modules/private-ip/index.js\");\n\n/**\n * Check if a given multiaddr has a private address.\n */\nfunction isPrivate(ma) {\n try {\n const { address } = ma.nodeAddress();\n return Boolean((0,private_ip__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(address));\n }\n catch {\n return true;\n }\n}\n//# sourceMappingURL=is-private.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/utils/dist/src/multiaddr/is-private.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/utils/dist/src/stream-to-ma-conn.js": +/*!******************************************************************!*\ + !*** ./node_modules/@libp2p/utils/dist/src/stream-to-ma-conn.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ streamToMaConnection: () => (/* binding */ streamToMaConnection)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:stream:converter');\n/**\n * Convert a duplex iterable into a MultiaddrConnection.\n * https://github.com/libp2p/interface-transport#multiaddrconnection\n */\nfunction streamToMaConnection(props, options = {}) {\n const { stream, remoteAddr } = props;\n const { sink, source } = stream;\n const mapSource = (async function* () {\n for await (const list of source) {\n if (list instanceof Uint8Array) {\n yield list;\n }\n else {\n yield* list;\n }\n }\n }());\n const maConn = {\n async sink(source) {\n if (options.signal != null) {\n source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableSource)(source, options.signal);\n }\n try {\n await sink(source);\n await close();\n }\n catch (err) {\n // If aborted we can safely ignore\n if (err.type !== 'aborted') {\n // If the source errored the socket will already have been destroyed by\n // toIterable.duplex(). If the socket errored it will already be\n // destroyed. There's nothing to do here except log the error & return.\n log(err);\n }\n }\n },\n source: (options.signal != null) ? (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableSource)(mapSource, options.signal) : mapSource,\n remoteAddr,\n timeline: { open: Date.now(), close: undefined },\n async close() {\n await sink(async function* () {\n yield new Uint8Array(0);\n }());\n await close();\n }\n };\n async function close() {\n if (maConn.timeline.close == null) {\n maConn.timeline.close = Date.now();\n }\n await Promise.resolve();\n }\n return maConn;\n}\n//# sourceMappingURL=stream-to-ma-conn.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/utils/dist/src/stream-to-ma-conn.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/error.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/error.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionClosedError: () => (/* binding */ ConnectionClosedError),\n/* harmony export */ DataChannelError: () => (/* binding */ DataChannelError),\n/* harmony export */ InappropriateMultiaddrError: () => (/* binding */ InappropriateMultiaddrError),\n/* harmony export */ InvalidArgumentError: () => (/* binding */ InvalidArgumentError),\n/* harmony export */ InvalidFingerprintError: () => (/* binding */ InvalidFingerprintError),\n/* harmony export */ OperationAbortedError: () => (/* binding */ OperationAbortedError),\n/* harmony export */ OverStreamLimitError: () => (/* binding */ OverStreamLimitError),\n/* harmony export */ UnimplementedError: () => (/* binding */ UnimplementedError),\n/* harmony export */ UnsupportedHashAlgorithmError: () => (/* binding */ UnsupportedHashAlgorithmError),\n/* harmony export */ WebRTCTransportError: () => (/* binding */ WebRTCTransportError),\n/* harmony export */ codes: () => (/* binding */ codes),\n/* harmony export */ connectionClosedError: () => (/* binding */ connectionClosedError),\n/* harmony export */ dataChannelError: () => (/* binding */ dataChannelError),\n/* harmony export */ inappropriateMultiaddr: () => (/* binding */ inappropriateMultiaddr),\n/* harmony export */ invalidArgument: () => (/* binding */ invalidArgument),\n/* harmony export */ invalidFingerprint: () => (/* binding */ invalidFingerprint),\n/* harmony export */ operationAborted: () => (/* binding */ operationAborted),\n/* harmony export */ overStreamLimit: () => (/* binding */ overStreamLimit),\n/* harmony export */ unimplemented: () => (/* binding */ unimplemented),\n/* harmony export */ unsupportedHashAlgorithm: () => (/* binding */ unsupportedHashAlgorithm)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n\nvar codes;\n(function (codes) {\n codes[\"ERR_ALREADY_ABORTED\"] = \"ERR_ALREADY_ABORTED\";\n codes[\"ERR_DATA_CHANNEL\"] = \"ERR_DATA_CHANNEL\";\n codes[\"ERR_CONNECTION_CLOSED\"] = \"ERR_CONNECTION_CLOSED\";\n codes[\"ERR_HASH_NOT_SUPPORTED\"] = \"ERR_HASH_NOT_SUPPORTED\";\n codes[\"ERR_INVALID_MULTIADDR\"] = \"ERR_INVALID_MULTIADDR\";\n codes[\"ERR_INVALID_FINGERPRINT\"] = \"ERR_INVALID_FINGERPRINT\";\n codes[\"ERR_INVALID_PARAMETERS\"] = \"ERR_INVALID_PARAMETERS\";\n codes[\"ERR_NOT_IMPLEMENTED\"] = \"ERR_NOT_IMPLEMENTED\";\n codes[\"ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS\"] = \"ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS\";\n codes[\"ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS\"] = \"ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS\";\n})(codes || (codes = {}));\nclass WebRTCTransportError extends _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError {\n constructor(msg, code) {\n super(`WebRTC transport error: ${msg}`, code ?? '');\n this.name = 'WebRTCTransportError';\n }\n}\nclass ConnectionClosedError extends WebRTCTransportError {\n constructor(state, msg) {\n super(`peerconnection moved to state: ${state}: ${msg}`, codes.ERR_CONNECTION_CLOSED);\n this.name = 'WebRTC/ConnectionClosed';\n }\n}\nfunction connectionClosedError(state, msg) {\n return new ConnectionClosedError(state, msg);\n}\nclass DataChannelError extends WebRTCTransportError {\n constructor(streamLabel, msg) {\n super(`[stream: ${streamLabel}] data channel error: ${msg}`, codes.ERR_DATA_CHANNEL);\n this.name = 'WebRTC/DataChannelError';\n }\n}\nfunction dataChannelError(streamLabel, msg) {\n return new DataChannelError(streamLabel, msg);\n}\nclass InappropriateMultiaddrError extends WebRTCTransportError {\n constructor(msg) {\n super(`There was a problem with the Multiaddr which was passed in: ${msg}`, codes.ERR_INVALID_MULTIADDR);\n this.name = 'WebRTC/InappropriateMultiaddrError';\n }\n}\nfunction inappropriateMultiaddr(msg) {\n return new InappropriateMultiaddrError(msg);\n}\nclass InvalidArgumentError extends WebRTCTransportError {\n constructor(msg) {\n super(`There was a problem with a provided argument: ${msg}`, codes.ERR_INVALID_PARAMETERS);\n this.name = 'WebRTC/InvalidArgumentError';\n }\n}\nfunction invalidArgument(msg) {\n return new InvalidArgumentError(msg);\n}\nclass InvalidFingerprintError extends WebRTCTransportError {\n constructor(fingerprint, source) {\n super(`Invalid fingerprint \"${fingerprint}\" within ${source}`, codes.ERR_INVALID_FINGERPRINT);\n this.name = 'WebRTC/InvalidFingerprintError';\n }\n}\nfunction invalidFingerprint(fingerprint, source) {\n return new InvalidFingerprintError(fingerprint, source);\n}\nclass OperationAbortedError extends WebRTCTransportError {\n constructor(context, abortReason) {\n super(`Signalled to abort because (${abortReason}}) ${context}`, codes.ERR_ALREADY_ABORTED);\n this.name = 'WebRTC/OperationAbortedError';\n }\n}\nfunction operationAborted(context, reason) {\n return new OperationAbortedError(context, reason);\n}\nclass OverStreamLimitError extends WebRTCTransportError {\n constructor(msg) {\n const code = msg.startsWith('inbound') ? codes.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS : codes.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS;\n super(msg, code);\n this.name = 'WebRTC/OverStreamLimitError';\n }\n}\nfunction overStreamLimit(dir, proto) {\n return new OverStreamLimitError(`${dir} stream limit reached for protocol - ${proto}`);\n}\nclass UnimplementedError extends WebRTCTransportError {\n constructor(methodName) {\n super(`A method (${methodName}) was called though it has been intentionally left unimplemented.`, codes.ERR_NOT_IMPLEMENTED);\n this.name = 'WebRTC/UnimplementedError';\n }\n}\nfunction unimplemented(methodName) {\n return new UnimplementedError(methodName);\n}\nclass UnsupportedHashAlgorithmError extends WebRTCTransportError {\n constructor(algo) {\n super(`unsupported hash algorithm: ${algo}`, codes.ERR_HASH_NOT_SUPPORTED);\n this.name = 'WebRTC/UnsupportedHashAlgorithmError';\n }\n}\nfunction unsupportedHashAlgorithm(algorithm) {\n return new UnsupportedHashAlgorithmError(algorithm);\n}\n//# sourceMappingURL=error.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/error.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/index.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ webRTC: () => (/* binding */ webRTC),\n/* harmony export */ webRTCDirect: () => (/* binding */ webRTCDirect)\n/* harmony export */ });\n/* harmony import */ var _private_to_private_transport_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./private-to-private/transport.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-private/transport.js\");\n/* harmony import */ var _private_to_public_transport_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./private-to-public/transport.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-public/transport.js\");\n\n\n/**\n * @param {WebRTCTransportDirectInit} init - WebRTC direct transport configuration\n * @param init.dataChannel - DataChannel configurations\n * @param {number} init.dataChannel.maxMessageSize - Max message size that can be sent through the DataChannel. Larger messages will be chunked into smaller messages below this size (default 16kb)\n * @param {number} init.dataChannel.maxBufferedAmount - Max buffered amount a DataChannel can have (default 16mb)\n * @param {number} init.dataChannel.bufferedAmountLowEventTimeout - If max buffered amount is reached, this is the max time that is waited before the buffer is cleared (default 30 seconds)\n * @returns\n */\nfunction webRTCDirect(init) {\n return (components) => new _private_to_public_transport_js__WEBPACK_IMPORTED_MODULE_1__.WebRTCDirectTransport(components, init);\n}\n/**\n * @param {WebRTCTransportInit} init - WebRTC transport configuration\n * @param {RTCConfiguration} init.rtcConfiguration - RTCConfiguration\n * @param init.dataChannel - DataChannel configurations\n * @param {number} init.dataChannel.maxMessageSize - Max message size that can be sent through the DataChannel. Larger messages will be chunked into smaller messages below this size (default 16kb)\n * @param {number} init.dataChannel.maxBufferedAmount - Max buffered amount a DataChannel can have (default 16mb)\n * @param {number} init.dataChannel.bufferedAmountLowEventTimeout - If max buffered amount is reached, this is the max time that is waited before the buffer is cleared (default 30 seconds)\n * @returns\n */\nfunction webRTC(init) {\n return (components) => new _private_to_private_transport_js__WEBPACK_IMPORTED_MODULE_0__.WebRTCTransport(components, init);\n}\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/maconn.js": +/*!********************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/maconn.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WebRTCMultiaddrConnection: () => (/* binding */ WebRTCMultiaddrConnection)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/webrtc/dist/src/util.js\");\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:webrtc:connection');\nclass WebRTCMultiaddrConnection {\n /**\n * WebRTC Peer Connection\n */\n peerConnection;\n /**\n * The multiaddr address used to communicate with the remote peer\n */\n remoteAddr;\n /**\n * Holds the lifecycle times of the connection\n */\n timeline;\n /**\n * Optional metrics counter group for this connection\n */\n metrics;\n /**\n * The stream source, a no-op as the transport natively supports multiplexing\n */\n source = (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.nopSource)();\n /**\n * The stream destination, a no-op as the transport natively supports multiplexing\n */\n sink = _util_js__WEBPACK_IMPORTED_MODULE_1__.nopSink;\n constructor(init) {\n this.remoteAddr = init.remoteAddr;\n this.timeline = init.timeline;\n this.peerConnection = init.peerConnection;\n this.peerConnection.onconnectionstatechange = () => {\n if (this.peerConnection.connectionState === 'closed' || this.peerConnection.connectionState === 'disconnected' || this.peerConnection.connectionState === 'failed') {\n this.timeline.close = Date.now();\n }\n };\n }\n async close(err) {\n if (err !== undefined) {\n log.error('error closing connection', err);\n }\n log.trace('closing connection');\n this.timeline.close = Date.now();\n this.peerConnection.close();\n this.metrics?.increment({ close: true });\n }\n}\n//# sourceMappingURL=maconn.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/maconn.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/muxer.js": +/*!*******************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/muxer.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DataChannelMuxer: () => (/* binding */ DataChannelMuxer),\n/* harmony export */ DataChannelMuxerFactory: () => (/* binding */ DataChannelMuxerFactory)\n/* harmony export */ });\n/* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stream.js */ \"./node_modules/@libp2p/webrtc/dist/src/stream.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/webrtc/dist/src/util.js\");\n\n\nconst PROTOCOL = '/webrtc';\nclass DataChannelMuxerFactory {\n protocol;\n /**\n * WebRTC Peer Connection\n */\n peerConnection;\n streamBuffer = [];\n metrics;\n dataChannelOptions;\n constructor(init) {\n this.peerConnection = init.peerConnection;\n this.metrics = init.metrics;\n this.protocol = init.protocol ?? PROTOCOL;\n this.dataChannelOptions = init.dataChannelOptions;\n // store any datachannels opened before upgrade has been completed\n this.peerConnection.ondatachannel = ({ channel }) => {\n const stream = (0,_stream_js__WEBPACK_IMPORTED_MODULE_0__.createStream)({\n channel,\n direction: 'inbound',\n dataChannelOptions: init.dataChannelOptions,\n onEnd: () => {\n this.streamBuffer = this.streamBuffer.filter(s => s.id !== stream.id);\n }\n });\n this.streamBuffer.push(stream);\n };\n }\n createStreamMuxer(init) {\n return new DataChannelMuxer({\n ...init,\n peerConnection: this.peerConnection,\n dataChannelOptions: this.dataChannelOptions,\n metrics: this.metrics,\n streams: this.streamBuffer,\n protocol: this.protocol\n });\n }\n}\n/**\n * A libp2p data channel stream muxer\n */\nclass DataChannelMuxer {\n init;\n /**\n * Array of streams in the data channel\n */\n streams;\n protocol;\n peerConnection;\n dataChannelOptions;\n metrics;\n /**\n * Close or abort all tracked streams and stop the muxer\n */\n close = () => { };\n /**\n * The stream source, a no-op as the transport natively supports multiplexing\n */\n source = (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.nopSource)();\n /**\n * The stream destination, a no-op as the transport natively supports multiplexing\n */\n sink = _util_js__WEBPACK_IMPORTED_MODULE_1__.nopSink;\n constructor(init) {\n this.init = init;\n this.streams = init.streams;\n this.peerConnection = init.peerConnection;\n this.protocol = init.protocol ?? PROTOCOL;\n this.metrics = init.metrics;\n /**\n * Fired when a data channel has been added to the connection has been\n * added by the remote peer.\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/datachannel_event}\n */\n this.peerConnection.ondatachannel = ({ channel }) => {\n const stream = (0,_stream_js__WEBPACK_IMPORTED_MODULE_0__.createStream)({\n channel,\n direction: 'inbound',\n dataChannelOptions: this.dataChannelOptions,\n onEnd: () => {\n this.streams = this.streams.filter(s => s.id !== stream.id);\n this.metrics?.increment({ stream_end: true });\n init?.onStreamEnd?.(stream);\n }\n });\n this.streams.push(stream);\n if ((init?.onIncomingStream) != null) {\n this.metrics?.increment({ incoming_stream: true });\n init.onIncomingStream(stream);\n }\n };\n const onIncomingStream = init?.onIncomingStream;\n if (onIncomingStream != null) {\n this.streams.forEach(s => { onIncomingStream(s); });\n }\n }\n newStream() {\n // The spec says the label SHOULD be an empty string: https://github.com/libp2p/specs/blob/master/webrtc/README.md#rtcdatachannel-label\n const channel = this.peerConnection.createDataChannel('');\n const stream = (0,_stream_js__WEBPACK_IMPORTED_MODULE_0__.createStream)({\n channel,\n direction: 'outbound',\n dataChannelOptions: this.dataChannelOptions,\n onEnd: () => {\n this.streams = this.streams.filter(s => s.id !== stream.id);\n this.metrics?.increment({ stream_end: true });\n this.init?.onStreamEnd?.(stream);\n }\n });\n this.streams.push(stream);\n this.metrics?.increment({ outgoing_stream: true });\n return stream;\n }\n}\n//# sourceMappingURL=muxer.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/muxer.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/pb/message.js": +/*!************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/pb/message.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Message: () => (/* binding */ Message)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Message;\n(function (Message) {\n let Flag;\n (function (Flag) {\n Flag[\"FIN\"] = \"FIN\";\n Flag[\"STOP_SENDING\"] = \"STOP_SENDING\";\n Flag[\"RESET\"] = \"RESET\";\n })(Flag = Message.Flag || (Message.Flag = {}));\n let __FlagValues;\n (function (__FlagValues) {\n __FlagValues[__FlagValues[\"FIN\"] = 0] = \"FIN\";\n __FlagValues[__FlagValues[\"STOP_SENDING\"] = 1] = \"STOP_SENDING\";\n __FlagValues[__FlagValues[\"RESET\"] = 2] = \"RESET\";\n })(__FlagValues || (__FlagValues = {}));\n (function (Flag) {\n Flag.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__FlagValues);\n };\n })(Flag = Message.Flag || (Message.Flag = {}));\n let _codec;\n Message.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.flag != null) {\n w.uint32(8);\n Message.Flag.codec().encode(obj.flag, w);\n }\n if (obj.message != null) {\n w.uint32(18);\n w.bytes(obj.message);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.flag = Message.Flag.codec().decode(reader);\n break;\n case 2:\n obj.message = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Message.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Message.codec());\n };\n Message.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Message.codec());\n };\n})(Message || (Message = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/pb/message.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-private/handler.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-private/handler.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ handleIncomingStream: () => (/* binding */ handleIncomingStream),\n/* harmony export */ initiateConnection: () => (/* binding */ initiateConnection)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var it_pb_stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pb-stream */ \"./node_modules/it-pb-stream/dist/src/index.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var _muxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../muxer.js */ \"./node_modules/@libp2p/webrtc/dist/src/muxer.js\");\n/* harmony import */ var _pb_message_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pb/message.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-private/pb/message.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-private/util.js\");\n\n\n\n\n\n\n\nconst DEFAULT_TIMEOUT = 30 * 1000;\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:webrtc:peer');\nasync function handleIncomingStream({ rtcConfiguration, dataChannelOptions, stream: rawStream }) {\n const signal = AbortSignal.timeout(DEFAULT_TIMEOUT);\n const stream = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)((0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableDuplex)(rawStream, signal)).pb(_pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message);\n const pc = new RTCPeerConnection(rtcConfiguration);\n const muxerFactory = new _muxer_js__WEBPACK_IMPORTED_MODULE_4__.DataChannelMuxerFactory({ peerConnection: pc, dataChannelOptions });\n const connectedPromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n const answerSentPromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n signal.onabort = () => { connectedPromise.reject(); };\n // candidate callbacks\n pc.onicecandidate = ({ candidate }) => {\n answerSentPromise.promise.then(() => {\n stream.write({\n type: _pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message.Type.ICE_CANDIDATE,\n data: (candidate != null) ? JSON.stringify(candidate.toJSON()) : ''\n });\n }, (err) => {\n log.error('cannot set candidate since sending answer failed', err);\n });\n };\n (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.resolveOnConnected)(pc, connectedPromise);\n // read an SDP offer\n const pbOffer = await stream.read();\n if (pbOffer.type !== _pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message.Type.SDP_OFFER) {\n throw new Error(`expected message type SDP_OFFER, received: ${pbOffer.type ?? 'undefined'} `);\n }\n const offer = new RTCSessionDescription({\n type: 'offer',\n sdp: pbOffer.data\n });\n await pc.setRemoteDescription(offer).catch(err => {\n log.error('could not execute setRemoteDescription', err);\n throw new Error('Failed to set remoteDescription');\n });\n // create and write an SDP answer\n const answer = await pc.createAnswer().catch(err => {\n log.error('could not execute createAnswer', err);\n answerSentPromise.reject(err);\n throw new Error('Failed to create answer');\n });\n // write the answer to the remote\n stream.write({ type: _pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message.Type.SDP_ANSWER, data: answer.sdp });\n await pc.setLocalDescription(answer).catch(err => {\n log.error('could not execute setLocalDescription', err);\n answerSentPromise.reject(err);\n throw new Error('Failed to set localDescription');\n });\n answerSentPromise.resolve();\n // wait until candidates are connected\n await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.readCandidatesUntilConnected)(connectedPromise, pc, stream);\n const remoteAddress = parseRemoteAddress(pc.currentRemoteDescription?.sdp ?? '');\n return { pc, muxerFactory, remoteAddress };\n}\nasync function initiateConnection({ rtcConfiguration, dataChannelOptions, signal, stream: rawStream }) {\n const stream = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_2__.pbStream)((0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableDuplex)(rawStream, signal)).pb(_pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message);\n // setup peer connection\n const pc = new RTCPeerConnection(rtcConfiguration);\n const muxerFactory = new _muxer_js__WEBPACK_IMPORTED_MODULE_4__.DataChannelMuxerFactory({ peerConnection: pc, dataChannelOptions });\n const connectedPromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.resolveOnConnected)(pc, connectedPromise);\n // reject the connectedPromise if the signal aborts\n signal.onabort = connectedPromise.reject;\n // we create the channel so that the peerconnection has a component for which\n // to collect candidates. The label is not relevant to connection initiation\n // but can be useful for debugging\n const channel = pc.createDataChannel('init');\n // setup callback to write ICE candidates to the remote\n // peer\n pc.onicecandidate = ({ candidate }) => {\n stream.write({\n type: _pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message.Type.ICE_CANDIDATE,\n data: (candidate != null) ? JSON.stringify(candidate.toJSON()) : ''\n });\n };\n // create an offer\n const offerSdp = await pc.createOffer();\n // write the offer to the stream\n stream.write({ type: _pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message.Type.SDP_OFFER, data: offerSdp.sdp });\n // set offer as local description\n await pc.setLocalDescription(offerSdp).catch(err => {\n log.error('could not execute setLocalDescription', err);\n throw new Error('Failed to set localDescription');\n });\n // read answer\n const answerMessage = await stream.read();\n if (answerMessage.type !== _pb_message_js__WEBPACK_IMPORTED_MODULE_5__.Message.Type.SDP_ANSWER) {\n throw new Error('remote should send an SDP answer');\n }\n const answerSdp = new RTCSessionDescription({ type: 'answer', sdp: answerMessage.data });\n await pc.setRemoteDescription(answerSdp).catch(err => {\n log.error('could not execute setRemoteDescription', err);\n throw new Error('Failed to set remoteDescription');\n });\n await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__.readCandidatesUntilConnected)(connectedPromise, pc, stream);\n channel.close();\n const remoteAddress = parseRemoteAddress(pc.currentRemoteDescription?.sdp ?? '');\n return { pc, muxerFactory, remoteAddress };\n}\nfunction parseRemoteAddress(sdp) {\n // 'a=candidate:1746876089 1 udp 2113937151 0614fbad-b...ocal 54882 typ host generation 0 network-cost 999'\n const candidateLine = sdp.split('\\r\\n').filter(line => line.startsWith('a=candidate')).pop();\n const candidateParts = candidateLine?.split(' ');\n if (candidateLine == null || candidateParts == null || candidateParts.length < 5) {\n log('could not parse remote address from', candidateLine);\n return '/webrtc';\n }\n return `/dnsaddr/${candidateParts[4]}/${candidateParts[2].toLowerCase()}/${candidateParts[3]}/webrtc`;\n}\n//# sourceMappingURL=handler.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-private/handler.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-private/listener.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-private/listener.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WebRTCPeerListener: () => (/* binding */ WebRTCPeerListener)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/mafmt */ \"./node_modules/@multiformats/mafmt/dist/src/index.js\");\n\n\nclass WebRTCPeerListener extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter {\n peerId;\n transportManager;\n constructor(opts) {\n super();\n this.peerId = opts.peerId;\n this.transportManager = opts.transportManager;\n }\n async listen() {\n this.safeDispatchEvent('listening', {});\n }\n getAddrs() {\n return this.transportManager\n .getListeners()\n .filter(l => l !== this)\n .map(l => l.getAddrs()\n .filter(ma => _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_1__.Circuit.matches(ma))\n .map(ma => {\n return ma.encapsulate(`/webrtc/p2p/${this.peerId}`);\n }))\n .flat();\n }\n async close() {\n this.safeDispatchEvent('close', {});\n }\n}\n//# sourceMappingURL=listener.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-private/listener.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-private/pb/message.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-private/pb/message.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Message: () => (/* binding */ Message)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Message;\n(function (Message) {\n let Type;\n (function (Type) {\n Type[\"SDP_OFFER\"] = \"SDP_OFFER\";\n Type[\"SDP_ANSWER\"] = \"SDP_ANSWER\";\n Type[\"ICE_CANDIDATE\"] = \"ICE_CANDIDATE\";\n })(Type = Message.Type || (Message.Type = {}));\n let __TypeValues;\n (function (__TypeValues) {\n __TypeValues[__TypeValues[\"SDP_OFFER\"] = 0] = \"SDP_OFFER\";\n __TypeValues[__TypeValues[\"SDP_ANSWER\"] = 1] = \"SDP_ANSWER\";\n __TypeValues[__TypeValues[\"ICE_CANDIDATE\"] = 2] = \"ICE_CANDIDATE\";\n })(__TypeValues || (__TypeValues = {}));\n (function (Type) {\n Type.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__TypeValues);\n };\n })(Type = Message.Type || (Message.Type = {}));\n let _codec;\n Message.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.type != null) {\n w.uint32(8);\n Message.Type.codec().encode(obj.type, w);\n }\n if (obj.data != null) {\n w.uint32(18);\n w.string(obj.data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.type = Message.Type.codec().decode(reader);\n break;\n case 2:\n obj.data = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Message.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Message.codec());\n };\n Message.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Message.codec());\n };\n})(Message || (Message = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-private/pb/message.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-private/transport.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-private/transport.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WebRTCTransport: () => (/* binding */ WebRTCTransport),\n/* harmony export */ splitAddr: () => (/* binding */ splitAddr)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-transport */ \"./node_modules/@libp2p/interface-transport/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _error_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../error.js */ \"./node_modules/@libp2p/webrtc/dist/src/error.js\");\n/* harmony import */ var _maconn_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../maconn.js */ \"./node_modules/@libp2p/webrtc/dist/src/maconn.js\");\n/* harmony import */ var _handler_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./handler.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-private/handler.js\");\n/* harmony import */ var _listener_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./listener.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-private/listener.js\");\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:webrtc:peer');\nconst WEBRTC_TRANSPORT = '/webrtc';\nconst CIRCUIT_RELAY_TRANSPORT = '/p2p-circuit';\nconst SIGNALING_PROTO_ID = '/webrtc-signaling/0.0.1';\nconst WEBRTC_CODE = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.protocols)('webrtc').code;\nclass WebRTCTransport {\n components;\n init;\n _started = false;\n constructor(components, init = {}) {\n this.components = components;\n this.init = init;\n }\n isStarted() {\n return this._started;\n }\n async start() {\n await this.components.registrar.handle(SIGNALING_PROTO_ID, (data) => {\n this._onProtocol(data).catch(err => { log.error('failed to handle incoming connect from %p', data.connection.remotePeer, err); });\n });\n this._started = true;\n }\n async stop() {\n await this.components.registrar.unhandle(SIGNALING_PROTO_ID);\n this._started = false;\n }\n createListener(options) {\n return new _listener_js__WEBPACK_IMPORTED_MODULE_8__.WebRTCPeerListener(this.components);\n }\n [Symbol.toStringTag] = '@libp2p/webrtc';\n [_libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.symbol] = true;\n filter(multiaddrs) {\n return multiaddrs.filter((ma) => {\n const codes = ma.protoCodes();\n return codes.includes(WEBRTC_CODE);\n });\n }\n /*\n * dial connects to a remote via the circuit relay or any other protocol\n * and proceeds to upgrade to a webrtc connection.\n * multiaddr of the form: /webrtc/p2p/\n * For a circuit relay, this will be of the form\n * /p2p//p2p-circuit/webrtc/p2p/\n */\n async dial(ma, options) {\n log.trace('dialing address: ', ma);\n const { baseAddr, peerId } = splitAddr(ma);\n if (options.signal == null) {\n const controller = new AbortController();\n options.signal = controller.signal;\n }\n const connection = await this.components.transportManager.dial(baseAddr, options);\n const signalingStream = await connection.newStream([SIGNALING_PROTO_ID], options);\n try {\n const { pc, muxerFactory, remoteAddress } = await (0,_handler_js__WEBPACK_IMPORTED_MODULE_7__.initiateConnection)({\n stream: signalingStream,\n rtcConfiguration: this.init.rtcConfiguration,\n dataChannelOptions: this.init.dataChannel,\n signal: options.signal\n });\n const result = await options.upgrader.upgradeOutbound(new _maconn_js__WEBPACK_IMPORTED_MODULE_6__.WebRTCMultiaddrConnection({\n peerConnection: pc,\n timeline: { open: Date.now() },\n remoteAddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.multiaddr)(remoteAddress).encapsulate(`/p2p/${peerId.toString()}`)\n }), {\n skipProtection: true,\n skipEncryption: true,\n muxerFactory\n });\n // close the stream if SDP has been exchanged successfully\n signalingStream.close();\n return result;\n }\n catch (err) {\n // reset the stream in case of any error\n signalingStream.reset();\n throw err;\n }\n finally {\n // Close the signaling connection\n await connection.close();\n }\n }\n async _onProtocol({ connection, stream }) {\n try {\n const { pc, muxerFactory, remoteAddress } = await (0,_handler_js__WEBPACK_IMPORTED_MODULE_7__.handleIncomingStream)({\n rtcConfiguration: this.init.rtcConfiguration,\n connection,\n stream,\n dataChannelOptions: this.init.dataChannel\n });\n await this.components.upgrader.upgradeInbound(new _maconn_js__WEBPACK_IMPORTED_MODULE_6__.WebRTCMultiaddrConnection({\n peerConnection: pc,\n timeline: { open: (new Date()).getTime() },\n remoteAddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.multiaddr)(remoteAddress).encapsulate(`/p2p/${connection.remotePeer.toString()}`)\n }), {\n skipEncryption: true,\n skipProtection: true,\n muxerFactory\n });\n }\n catch (err) {\n stream.reset();\n throw err;\n }\n finally {\n // Close the signaling connection\n await connection.close();\n }\n }\n}\nfunction splitAddr(ma) {\n const addrs = ma.toString().split(WEBRTC_TRANSPORT + '/');\n if (addrs.length !== 2) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('webrtc protocol was not present in multiaddr', _error_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_MULTIADDR);\n }\n if (!addrs[0].includes(CIRCUIT_RELAY_TRANSPORT)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('p2p-circuit protocol was not present in multiaddr', _error_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_MULTIADDR);\n }\n // look for remote peerId\n let remoteAddr = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.multiaddr)(addrs[0]);\n const destination = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.multiaddr)('/' + addrs[1]);\n const destinationIdString = destination.getPeerId();\n if (destinationIdString == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('destination peer id was missing', _error_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_MULTIADDR);\n }\n const lastProtoInRemote = remoteAddr.protos().pop();\n if (lastProtoInRemote === undefined) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('invalid multiaddr', _error_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_MULTIADDR);\n }\n if (lastProtoInRemote.name !== 'p2p') {\n remoteAddr = remoteAddr.encapsulate(`/p2p/${destinationIdString}`);\n }\n return { baseAddr: remoteAddr, peerId: (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString)(destinationIdString) };\n}\n//# sourceMappingURL=transport.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-private/transport.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-private/util.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-private/util.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ readCandidatesUntilConnected: () => (/* binding */ readCandidatesUntilConnected),\n/* harmony export */ resolveOnConnected: () => (/* binding */ resolveOnConnected)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/webrtc/dist/src/util.js\");\n/* harmony import */ var _pb_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pb/message.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-private/pb/message.js\");\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:webrtc:peer:util');\nconst readCandidatesUntilConnected = async (connectedPromise, pc, stream) => {\n while (true) {\n const readResult = await Promise.race([connectedPromise.promise, stream.read()]);\n // check if readResult is a message\n if (readResult instanceof Object) {\n const message = readResult;\n if (message.type !== _pb_message_js__WEBPACK_IMPORTED_MODULE_2__.Message.Type.ICE_CANDIDATE) {\n throw new Error('expected only ice candidates');\n }\n // end of candidates has been signalled\n if (message.data == null || message.data === '') {\n log.trace('end-of-candidates received');\n break;\n }\n log.trace('received new ICE candidate: %s', message.data);\n try {\n await pc.addIceCandidate(new RTCIceCandidate(JSON.parse(message.data)));\n }\n catch (err) {\n log.error('bad candidate received: ', err);\n throw new Error('bad candidate received');\n }\n }\n else {\n // connected promise resolved\n break;\n }\n }\n await connectedPromise.promise;\n};\nfunction resolveOnConnected(pc, promise) {\n pc[_util_js__WEBPACK_IMPORTED_MODULE_1__.isFirefox ? 'oniceconnectionstatechange' : 'onconnectionstatechange'] = (_) => {\n log.trace('receiver peerConnectionState state: ', pc.connectionState);\n switch (_util_js__WEBPACK_IMPORTED_MODULE_1__.isFirefox ? pc.iceConnectionState : pc.connectionState) {\n case 'connected':\n promise.resolve();\n break;\n case 'failed':\n case 'disconnected':\n case 'closed':\n promise.reject(new Error('RTCPeerConnection was closed'));\n break;\n default:\n break;\n }\n };\n}\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-private/util.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-public/sdp.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-public/sdp.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ certhash: () => (/* binding */ certhash),\n/* harmony export */ decodeCerthash: () => (/* binding */ decodeCerthash),\n/* harmony export */ fromMultiAddr: () => (/* binding */ fromMultiAddr),\n/* harmony export */ getFingerprintFromSdp: () => (/* binding */ getFingerprintFromSdp),\n/* harmony export */ getLocalFingerprint: () => (/* binding */ getLocalFingerprint),\n/* harmony export */ ma2Fingerprint: () => (/* binding */ ma2Fingerprint),\n/* harmony export */ mbdecoder: () => (/* binding */ mbdecoder),\n/* harmony export */ munge: () => (/* binding */ munge),\n/* harmony export */ toSupportedHashFunction: () => (/* binding */ toSupportedHashFunction)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/src/basics.js\");\n/* harmony import */ var multihashes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multihashes */ \"./node_modules/multihashes/src/index.js\");\n/* harmony import */ var _error_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../error.js */ \"./node_modules/@libp2p/webrtc/dist/src/error.js\");\n/* harmony import */ var _transport_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./transport.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-public/transport.js\");\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:webrtc:sdp');\n/**\n * Get base2 | identity decoders\n */\n// @ts-expect-error - Not easy to combine these types.\nconst mbdecoder = Object.values(multiformats_basics__WEBPACK_IMPORTED_MODULE_1__.bases).map(b => b.decoder).reduce((d, b) => d.or(b));\nfunction getLocalFingerprint(pc) {\n // try to fetch fingerprint from local certificate\n const localCert = pc.getConfiguration().certificates?.at(0);\n if (localCert == null || localCert.getFingerprints == null) {\n log.trace('fetching fingerprint from local SDP');\n const localDescription = pc.localDescription;\n if (localDescription == null) {\n return undefined;\n }\n return getFingerprintFromSdp(localDescription.sdp);\n }\n log.trace('fetching fingerprint from local certificate');\n if (localCert.getFingerprints().length === 0) {\n return undefined;\n }\n const fingerprint = localCert.getFingerprints()[0].value;\n if (fingerprint == null) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_3__.invalidFingerprint)('', 'no fingerprint on local certificate');\n }\n return fingerprint;\n}\nconst fingerprintRegex = /^a=fingerprint:(?:\\w+-[0-9]+)\\s(?(:?[0-9a-fA-F]{2})+)$/m;\nfunction getFingerprintFromSdp(sdp) {\n const searchResult = sdp.match(fingerprintRegex);\n return searchResult?.groups?.fingerprint;\n}\n/**\n * Get base2 | identity decoders\n */\nfunction ipv(ma) {\n for (const proto of ma.protoNames()) {\n if (proto.startsWith('ip')) {\n return proto.toUpperCase();\n }\n }\n log('Warning: multiaddr does not appear to contain IP4 or IP6, defaulting to IP6', ma);\n return 'IP6';\n}\n// Extract the certhash from a multiaddr\nfunction certhash(ma) {\n const tups = ma.stringTuples();\n const certhash = tups.filter((tup) => tup[0] === _transport_js__WEBPACK_IMPORTED_MODULE_4__.CERTHASH_CODE).map((tup) => tup[1])[0];\n if (certhash === undefined || certhash === '') {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_3__.inappropriateMultiaddr)(`Couldn't find a certhash component of multiaddr: ${ma.toString()}`);\n }\n return certhash;\n}\n/**\n * Convert a certhash into a multihash\n */\nfunction decodeCerthash(certhash) {\n const mbdecoded = mbdecoder.decode(certhash);\n return multihashes__WEBPACK_IMPORTED_MODULE_2__.decode(mbdecoded);\n}\n/**\n * Extract the fingerprint from a multiaddr\n */\nfunction ma2Fingerprint(ma) {\n const mhdecoded = decodeCerthash(certhash(ma));\n const prefix = toSupportedHashFunction(mhdecoded.name);\n const fingerprint = mhdecoded.digest.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');\n const sdp = fingerprint.match(/.{1,2}/g);\n if (sdp == null) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_3__.invalidFingerprint)(fingerprint, ma.toString());\n }\n return [`${prefix.toUpperCase()} ${sdp.join(':').toUpperCase()}`, fingerprint];\n}\n/**\n * Normalize the hash name from a given multihash has name\n */\nfunction toSupportedHashFunction(name) {\n switch (name) {\n case 'sha1':\n return 'sha-1';\n case 'sha2-256':\n return 'sha-256';\n case 'sha2-512':\n return 'sha-512';\n default:\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_3__.unsupportedHashAlgorithm)(name);\n }\n}\n/**\n * Convert a multiaddr into a SDP\n */\nfunction ma2sdp(ma, ufrag) {\n const { host, port } = ma.toOptions();\n const ipVersion = ipv(ma);\n const [CERTFP] = ma2Fingerprint(ma);\n return `v=0\no=- 0 0 IN ${ipVersion} ${host}\ns=-\nc=IN ${ipVersion} ${host}\nt=0 0\na=ice-lite\nm=application ${port} UDP/DTLS/SCTP webrtc-datachannel\na=mid:0\na=setup:passive\na=ice-ufrag:${ufrag}\na=ice-pwd:${ufrag}\na=fingerprint:${CERTFP}\na=sctp-port:5000\na=max-message-size:100000\na=candidate:1467250027 1 UDP 1467250027 ${host} ${port} typ host\\r\\n`;\n}\n/**\n * Create an answer SDP from a multiaddr\n */\nfunction fromMultiAddr(ma, ufrag) {\n return {\n type: 'answer',\n sdp: ma2sdp(ma, ufrag)\n };\n}\n/**\n * Replace (munge) the ufrag and password values in a SDP\n */\nfunction munge(desc, ufrag) {\n if (desc.sdp === undefined) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_3__.invalidArgument)(\"Can't munge a missing SDP\");\n }\n desc.sdp = desc.sdp\n .replace(/\\na=ice-ufrag:[^\\n]*\\n/, '\\na=ice-ufrag:' + ufrag + '\\n')\n .replace(/\\na=ice-pwd:[^\\n]*\\n/, '\\na=ice-pwd:' + ufrag + '\\n');\n return desc;\n}\n//# sourceMappingURL=sdp.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-public/sdp.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-public/transport.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-public/transport.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CERTHASH_CODE: () => (/* binding */ CERTHASH_CODE),\n/* harmony export */ WEBRTC_CODE: () => (/* binding */ WEBRTC_CODE),\n/* harmony export */ WebRTCDirectTransport: () => (/* binding */ WebRTCDirectTransport)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_libp2p_noise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/libp2p-noise */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/index.js\");\n/* harmony import */ var _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface-transport */ \"./node_modules/@libp2p/interface-transport/dist/src/index.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var multihashes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! multihashes */ \"./node_modules/multihashes/src/index.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _error_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../error.js */ \"./node_modules/@libp2p/webrtc/dist/src/error.js\");\n/* harmony import */ var _maconn_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../maconn.js */ \"./node_modules/@libp2p/webrtc/dist/src/maconn.js\");\n/* harmony import */ var _muxer_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../muxer.js */ \"./node_modules/@libp2p/webrtc/dist/src/muxer.js\");\n/* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../stream.js */ \"./node_modules/@libp2p/webrtc/dist/src/stream.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@libp2p/webrtc/dist/src/util.js\");\n/* harmony import */ var _sdp_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./sdp.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-public/sdp.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@libp2p/webrtc/dist/src/private-to-public/util.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:webrtc:transport');\n/**\n * The time to wait, in milliseconds, for the data channel handshake to complete\n */\nconst HANDSHAKE_TIMEOUT_MS = 10000;\n/**\n * Created by converting the hexadecimal protocol code to an integer.\n *\n * {@link https://github.com/multiformats/multiaddr/blob/master/protocols.csv}\n */\nconst WEBRTC_CODE = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.protocols)('webrtc-direct').code;\n/**\n * Created by converting the hexadecimal protocol code to an integer.\n *\n * {@link https://github.com/multiformats/multiaddr/blob/master/protocols.csv}\n */\nconst CERTHASH_CODE = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.protocols)('certhash').code;\nclass WebRTCDirectTransport {\n metrics;\n components;\n init;\n constructor(components, init = {}) {\n this.components = components;\n this.init = init;\n if (components.metrics != null) {\n this.metrics = {\n dialerEvents: components.metrics.registerCounterGroup('libp2p_webrtc_dialer_events_total', {\n label: 'event',\n help: 'Total count of WebRTC dial events by type'\n })\n };\n }\n }\n /**\n * Dial a given multiaddr\n */\n async dial(ma, options) {\n const rawConn = await this._connect(ma, options);\n log(`dialing address - ${ma.toString()}`);\n return rawConn;\n }\n /**\n * Create transport listeners no supported by browsers\n */\n createListener(options) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_8__.unimplemented)('WebRTCTransport.createListener');\n }\n /**\n * Takes a list of `Multiaddr`s and returns only valid addresses for the transport\n */\n filter(multiaddrs) {\n return multiaddrs.filter(validMa);\n }\n /**\n * Implement toString() for WebRTCTransport\n */\n [Symbol.toStringTag] = '@libp2p/webrtc-direct';\n /**\n * Symbol.for('@libp2p/transport')\n */\n [_libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_1__.symbol] = true;\n /**\n * Connect to a peer using a multiaddr\n */\n async _connect(ma, options) {\n const controller = new AbortController();\n const signal = controller.signal;\n const remotePeerString = ma.getPeerId();\n if (remotePeerString === null) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_8__.inappropriateMultiaddr)(\"we need to have the remote's PeerId\");\n }\n const theirPeerId = _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString(remotePeerString);\n const remoteCerthash = _sdp_js__WEBPACK_IMPORTED_MODULE_13__.decodeCerthash(_sdp_js__WEBPACK_IMPORTED_MODULE_13__.certhash(ma));\n // ECDSA is preferred over RSA here. From our testing we find that P-256 elliptic\n // curve is supported by Pion, webrtc-rs, as well as Chromium (P-228 and P-384\n // was not supported in Chromium). We use the same hash function as found in the\n // multiaddr if it is supported.\n const certificate = await RTCPeerConnection.generateCertificate({\n name: 'ECDSA',\n namedCurve: 'P-256',\n hash: _sdp_js__WEBPACK_IMPORTED_MODULE_13__.toSupportedHashFunction(remoteCerthash.name)\n });\n const peerConnection = new RTCPeerConnection({ certificates: [certificate] });\n // create data channel for running the noise handshake. Once the data channel is opened,\n // the remote will initiate the noise handshake. This is used to confirm the identity of\n // the peer.\n const dataChannelOpenPromise = new Promise((resolve, reject) => {\n const handshakeDataChannel = peerConnection.createDataChannel('', { negotiated: true, id: 0 });\n const handshakeTimeout = setTimeout(() => {\n const error = `Data channel was never opened: state: ${handshakeDataChannel.readyState}`;\n log.error(error);\n this.metrics?.dialerEvents.increment({ open_error: true });\n reject((0,_error_js__WEBPACK_IMPORTED_MODULE_8__.dataChannelError)('data', error));\n }, HANDSHAKE_TIMEOUT_MS);\n handshakeDataChannel.onopen = (_) => {\n clearTimeout(handshakeTimeout);\n resolve(handshakeDataChannel);\n };\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/error_event\n handshakeDataChannel.onerror = (event) => {\n clearTimeout(handshakeTimeout);\n const errorTarget = event.target?.toString() ?? 'not specified';\n const error = `Error opening a data channel for handshaking: ${errorTarget}`;\n log.error(error);\n // NOTE: We use unknown error here but this could potentially be considered a reset by some standards.\n this.metrics?.dialerEvents.increment({ unknown_error: true });\n reject((0,_error_js__WEBPACK_IMPORTED_MODULE_8__.dataChannelError)('data', error));\n };\n });\n const ufrag = 'libp2p+webrtc+v1/' + (0,_util_js__WEBPACK_IMPORTED_MODULE_14__.genUfrag)(32);\n // Create offer and munge sdp with ufrag == pwd. This allows the remote to\n // respond to STUN messages without performing an actual SDP exchange.\n // This is because it can infer the passwd field by reading the USERNAME\n // attribute of the STUN message.\n const offerSdp = await peerConnection.createOffer();\n const mungedOfferSdp = _sdp_js__WEBPACK_IMPORTED_MODULE_13__.munge(offerSdp, ufrag);\n await peerConnection.setLocalDescription(mungedOfferSdp);\n // construct answer sdp from multiaddr and ufrag\n const answerSdp = _sdp_js__WEBPACK_IMPORTED_MODULE_13__.fromMultiAddr(ma, ufrag);\n await peerConnection.setRemoteDescription(answerSdp);\n // wait for peerconnection.onopen to fire, or for the datachannel to open\n const handshakeDataChannel = await dataChannelOpenPromise;\n const myPeerId = this.components.peerId;\n // Do noise handshake.\n // Set the Noise Prologue to libp2p-webrtc-noise: before starting the actual Noise handshake.\n // is the concatenation of the of the two TLS fingerprints of A and B in their multihash byte representation, sorted in ascending order.\n const fingerprintsPrologue = this.generateNoisePrologue(peerConnection, remoteCerthash.code, ma);\n // Since we use the default crypto interface and do not use a static key or early data,\n // we pass in undefined for these parameters.\n const noise = (0,_chainsafe_libp2p_noise__WEBPACK_IMPORTED_MODULE_0__.noise)({ prologueBytes: fingerprintsPrologue })();\n const wrappedChannel = (0,_stream_js__WEBPACK_IMPORTED_MODULE_11__.createStream)({ channel: handshakeDataChannel, direction: 'inbound', dataChannelOptions: this.init.dataChannel });\n const wrappedDuplex = {\n ...wrappedChannel,\n sink: wrappedChannel.sink.bind(wrappedChannel),\n source: (async function* () {\n for await (const list of wrappedChannel.source) {\n for (const buf of list) {\n yield buf;\n }\n }\n }())\n };\n // Creating the connection before completion of the noise\n // handshake ensures that the stream opening callback is set up\n const maConn = new _maconn_js__WEBPACK_IMPORTED_MODULE_9__.WebRTCMultiaddrConnection({\n peerConnection,\n remoteAddr: ma,\n timeline: {\n open: Date.now()\n },\n metrics: this.metrics?.dialerEvents\n });\n const eventListeningName = _util_js__WEBPACK_IMPORTED_MODULE_12__.isFirefox ? 'iceconnectionstatechange' : 'connectionstatechange';\n peerConnection.addEventListener(eventListeningName, () => {\n switch (peerConnection.connectionState) {\n case 'failed':\n case 'disconnected':\n case 'closed':\n maConn.close().catch((err) => {\n log.error('error closing connection', err);\n }).finally(() => {\n // Remove the event listener once the connection is closed\n controller.abort();\n });\n break;\n default:\n break;\n }\n }, { signal });\n // Track opened peer connection\n this.metrics?.dialerEvents.increment({ peer_connection: true });\n const muxerFactory = new _muxer_js__WEBPACK_IMPORTED_MODULE_10__.DataChannelMuxerFactory({ peerConnection, metrics: this.metrics?.dialerEvents, dataChannelOptions: this.init.dataChannel });\n // For outbound connections, the remote is expected to start the noise handshake.\n // Therefore, we need to secure an inbound noise connection from the remote.\n await noise.secureInbound(myPeerId, wrappedDuplex, theirPeerId);\n return options.upgrader.upgradeOutbound(maConn, { skipProtection: true, skipEncryption: true, muxerFactory });\n }\n /**\n * Generate a noise prologue from the peer connection's certificate.\n * noise prologue = bytes('libp2p-webrtc-noise:') + noise-responder fingerprint + noise-initiator fingerprint\n */\n generateNoisePrologue(pc, hashCode, ma) {\n if (pc.getConfiguration().certificates?.length === 0) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_8__.invalidArgument)('no local certificate');\n }\n const localFingerprint = _sdp_js__WEBPACK_IMPORTED_MODULE_13__.getLocalFingerprint(pc);\n if (localFingerprint == null) {\n throw (0,_error_js__WEBPACK_IMPORTED_MODULE_8__.invalidArgument)('no local fingerprint found');\n }\n const localFpString = localFingerprint.trim().toLowerCase().replaceAll(':', '');\n const localFpArray = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(localFpString, 'hex');\n const local = multihashes__WEBPACK_IMPORTED_MODULE_5__.encode(localFpArray, hashCode);\n const remote = _sdp_js__WEBPACK_IMPORTED_MODULE_13__.mbdecoder.decode(_sdp_js__WEBPACK_IMPORTED_MODULE_13__.certhash(ma));\n const prefix = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)('libp2p-webrtc-noise:');\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__.concat)([prefix, local, remote]);\n }\n}\n/**\n * Determine if a given multiaddr contains a WebRTC Code (280),\n * a Certhash Code (466) and a PeerId\n */\nfunction validMa(ma) {\n const codes = ma.protoCodes();\n return codes.includes(WEBRTC_CODE) && codes.includes(CERTHASH_CODE) && ma.getPeerId() != null && !codes.includes((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.protocols)('p2p-circuit').code);\n}\n//# sourceMappingURL=transport.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-public/transport.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/private-to-public/util.js": +/*!************************************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/private-to-public/util.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ genUfrag: () => (/* binding */ genUfrag)\n/* harmony export */ });\nconst charset = Array.from('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/');\nconst genUfrag = (len) => [...Array(len)].map(() => charset.at(Math.floor(Math.random() * charset.length))).join('');\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/private-to-public/util.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/stream.js": +/*!********************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/stream.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createStream: () => (/* binding */ createStream)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_stream_muxer_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-stream-muxer/stream */ \"./node_modules/@libp2p/interface-stream-muxer/dist/src/stream.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var p_event__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! p-event */ \"./node_modules/p-event/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _pb_message_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./pb/message.js */ \"./node_modules/@libp2p/webrtc/dist/src/pb/message.js\");\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:webrtc:stream');\n// Max message size that can be sent to the DataChannel\nconst MAX_MESSAGE_SIZE = 16 * 1024;\n// How much can be buffered to the DataChannel at once\nconst MAX_BUFFERED_AMOUNT = 16 * 1024 * 1024;\n// How long time we wait for the 'bufferedamountlow' event to be emitted\nconst BUFFERED_AMOUNT_LOW_TIMEOUT = 30 * 1000;\n// protobuf field definition overhead\nconst PROTOBUF_OVERHEAD = 3;\nclass WebRTCStream extends _libp2p_interface_stream_muxer_stream__WEBPACK_IMPORTED_MODULE_0__.AbstractStream {\n /**\n * The data channel used to send and receive data\n */\n channel;\n /**\n * Data channel options\n */\n dataChannelOptions;\n /**\n * push data from the underlying datachannel to the length prefix decoder\n * and then the protobuf decoder.\n */\n incomingData;\n messageQueue;\n constructor(init) {\n super(init);\n this.channel = init.channel;\n this.channel.binaryType = 'arraybuffer';\n this.incomingData = (0,it_pushable__WEBPACK_IMPORTED_MODULE_4__.pushable)();\n this.messageQueue = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList();\n this.dataChannelOptions = {\n bufferedAmountLowEventTimeout: init.dataChannelOptions?.bufferedAmountLowEventTimeout ?? BUFFERED_AMOUNT_LOW_TIMEOUT,\n maxBufferedAmount: init.dataChannelOptions?.maxBufferedAmount ?? MAX_BUFFERED_AMOUNT,\n maxMessageSize: init.dataChannelOptions?.maxMessageSize ?? MAX_MESSAGE_SIZE\n };\n // set up initial state\n switch (this.channel.readyState) {\n case 'open':\n break;\n case 'closed':\n case 'closing':\n if (this.stat.timeline.close === undefined || this.stat.timeline.close === 0) {\n this.stat.timeline.close = Date.now();\n }\n break;\n case 'connecting':\n // noop\n break;\n default:\n log.error('unknown datachannel state %s', this.channel.readyState);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Unknown datachannel state', 'ERR_INVALID_STATE');\n }\n // handle RTCDataChannel events\n this.channel.onopen = (_evt) => {\n this.stat.timeline.open = new Date().getTime();\n if (this.messageQueue != null) {\n // send any queued messages\n this._sendMessage(this.messageQueue)\n .catch(err => {\n this.abort(err);\n });\n this.messageQueue = undefined;\n }\n };\n this.channel.onclose = (_evt) => {\n this.close();\n };\n this.channel.onerror = (evt) => {\n const err = evt.error;\n this.abort(err);\n };\n const self = this;\n this.channel.onmessage = async (event) => {\n const { data } = event;\n if (data === null || data.byteLength === 0) {\n return;\n }\n this.incomingData.push(new Uint8Array(data, 0, data.byteLength));\n };\n // pipe framed protobuf messages through a length prefixed decoder, and\n // surface data from the `Message.message` field through a source.\n Promise.resolve().then(async () => {\n for await (const buf of it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode(this.incomingData)) {\n const message = self.processIncomingProtobuf(buf.subarray());\n if (message != null) {\n self.sourcePush(new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList(message));\n }\n }\n })\n .catch(err => {\n log.error('error processing incoming data channel messages', err);\n });\n }\n sendNewStream() {\n // opening new streams is handled by WebRTC so this is a noop\n }\n async _sendMessage(data, checkBuffer = true) {\n if (checkBuffer && this.channel.bufferedAmount > this.dataChannelOptions.maxBufferedAmount) {\n try {\n await (0,p_event__WEBPACK_IMPORTED_MODULE_5__.pEvent)(this.channel, 'bufferedamountlow', { timeout: this.dataChannelOptions.bufferedAmountLowEventTimeout });\n }\n catch (err) {\n if (err instanceof p_event__WEBPACK_IMPORTED_MODULE_5__.TimeoutError) {\n this.abort(err);\n throw new Error('Timed out waiting for DataChannel buffer to clear');\n }\n throw err;\n }\n }\n if (this.channel.readyState === 'closed' || this.channel.readyState === 'closing') {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Invalid datachannel state - closed or closing', 'ERR_INVALID_STATE');\n }\n if (this.channel.readyState === 'open') {\n // send message without copying data\n for (const buf of data) {\n this.channel.send(buf);\n }\n }\n else if (this.channel.readyState === 'connecting') {\n // queue message for when we are open\n if (this.messageQueue == null) {\n this.messageQueue = new uint8arraylist__WEBPACK_IMPORTED_MODULE_6__.Uint8ArrayList();\n }\n this.messageQueue.append(data);\n }\n else {\n log.error('unknown datachannel state %s', this.channel.readyState);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Unknown datachannel state', 'ERR_INVALID_STATE');\n }\n }\n async sendData(data) {\n const msgbuf = _pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.encode({ message: data.subarray() });\n const sendbuf = it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode.single(msgbuf);\n await this._sendMessage(sendbuf);\n }\n async sendReset() {\n await this._sendFlag(_pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.Flag.RESET);\n }\n async sendCloseWrite() {\n await this._sendFlag(_pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.Flag.FIN);\n }\n async sendCloseRead() {\n await this._sendFlag(_pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.Flag.STOP_SENDING);\n }\n /**\n * Handle incoming\n */\n processIncomingProtobuf(buffer) {\n const message = _pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.decode(buffer);\n if (message.flag !== undefined) {\n if (message.flag === _pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.Flag.FIN) {\n // We should expect no more data from the remote, stop reading\n this.incomingData.end();\n this.closeRead();\n }\n if (message.flag === _pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.Flag.RESET) {\n // Stop reading and writing to the stream immediately\n this.reset();\n }\n if (message.flag === _pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.Flag.STOP_SENDING) {\n // The remote has stopped reading\n this.closeWrite();\n }\n }\n return message.message;\n }\n async _sendFlag(flag) {\n log.trace('Sending flag: %s', flag.toString());\n const msgbuf = _pb_message_js__WEBPACK_IMPORTED_MODULE_7__.Message.encode({ flag });\n const prefixedBuf = it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode.single(msgbuf);\n await this._sendMessage(prefixedBuf, false);\n }\n}\nfunction createStream(options) {\n const { channel, direction, onEnd, dataChannelOptions } = options;\n return new WebRTCStream({\n id: direction === 'inbound' ? (`i${channel.id}`) : `r${channel.id}`,\n direction,\n maxDataSize: (dataChannelOptions?.maxMessageSize ?? MAX_MESSAGE_SIZE) - PROTOBUF_OVERHEAD,\n dataChannelOptions,\n onEnd,\n channel\n });\n}\n//# sourceMappingURL=stream.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/stream.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/webrtc/dist/src/util.js": +/*!******************************************************!*\ + !*** ./node_modules/@libp2p/webrtc/dist/src/util.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isFirefox: () => (/* binding */ isFirefox),\n/* harmony export */ nopSink: () => (/* binding */ nopSink),\n/* harmony export */ nopSource: () => (/* binding */ nopSource)\n/* harmony export */ });\n/* harmony import */ var detect_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! detect-browser */ \"./node_modules/detect-browser/es/index.js\");\n\nconst browser = (0,detect_browser__WEBPACK_IMPORTED_MODULE_0__.detect)();\nconst isFirefox = ((browser != null) && browser.name === 'firefox');\nconst nopSource = async function* nop() { };\nconst nopSink = async (_) => { };\n//# sourceMappingURL=util.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/webrtc/dist/src/util.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/websockets/dist/src/constants.js": +/*!***************************************************************!*\ + !*** ./node_modules/@libp2p/websockets/dist/src/constants.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CLOSE_TIMEOUT: () => (/* binding */ CLOSE_TIMEOUT),\n/* harmony export */ CODE_CIRCUIT: () => (/* binding */ CODE_CIRCUIT),\n/* harmony export */ CODE_P2P: () => (/* binding */ CODE_P2P),\n/* harmony export */ CODE_TCP: () => (/* binding */ CODE_TCP),\n/* harmony export */ CODE_WS: () => (/* binding */ CODE_WS),\n/* harmony export */ CODE_WSS: () => (/* binding */ CODE_WSS)\n/* harmony export */ });\n// p2p multi-address code\nconst CODE_P2P = 421;\nconst CODE_CIRCUIT = 290;\nconst CODE_TCP = 6;\nconst CODE_WS = 477;\nconst CODE_WSS = 478;\n// Time to wait for a connection to close gracefully before destroying it manually\nconst CLOSE_TIMEOUT = 2000;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/websockets/dist/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/websockets/dist/src/filters.js": +/*!*************************************************************!*\ + !*** ./node_modules/@libp2p/websockets/dist/src/filters.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ all: () => (/* binding */ all),\n/* harmony export */ dnsWsOrWss: () => (/* binding */ dnsWsOrWss),\n/* harmony export */ dnsWss: () => (/* binding */ dnsWss),\n/* harmony export */ wss: () => (/* binding */ wss)\n/* harmony export */ });\n/* harmony import */ var _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/mafmt */ \"./node_modules/@multiformats/mafmt/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/websockets/dist/src/constants.js\");\n\n\nfunction all(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSockets.matches(testMa) ||\n _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa);\n });\n}\nfunction wss(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa);\n });\n}\nfunction dnsWss(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa) &&\n _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.DNS.matches(testMa.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_TCP).decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_WSS));\n });\n}\nfunction dnsWsOrWss(multiaddrs) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_CIRCUIT)) {\n return false;\n }\n const testMa = ma.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_P2P);\n // WS\n if (_multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSockets.matches(testMa)) {\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.DNS.matches(testMa.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_TCP).decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_WS));\n }\n // WSS\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.WebSocketsSecure.matches(testMa) &&\n _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_0__.DNS.matches(testMa.decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_TCP).decapsulateCode(_constants_js__WEBPACK_IMPORTED_MODULE_1__.CODE_WSS));\n });\n}\n//# sourceMappingURL=filters.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/websockets/dist/src/filters.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/websockets/dist/src/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@libp2p/websockets/dist/src/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ webSockets: () => (/* binding */ webSockets)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-transport */ \"./node_modules/@libp2p/interface-transport/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_to_uri__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @multiformats/multiaddr-to-uri */ \"./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js\");\n/* harmony import */ var it_ws_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-ws/client */ \"./node_modules/it-ws/dist/src/client.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var wherearewe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! wherearewe */ \"./node_modules/wherearewe/src/index.js\");\n/* harmony import */ var _filters_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./filters.js */ \"./node_modules/@libp2p/websockets/dist/src/filters.js\");\n/* harmony import */ var _listener_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./listener.js */ \"./node_modules/@libp2p/websockets/dist/src/listener.browser.js\");\n/* harmony import */ var _socket_to_conn_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./socket-to-conn.js */ \"./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js\");\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:websockets');\nclass WebSockets {\n init;\n constructor(init) {\n this.init = init;\n }\n [Symbol.toStringTag] = '@libp2p/websockets';\n [_libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.symbol] = true;\n async dial(ma, options) {\n log('dialing %s', ma);\n options = options ?? {};\n const socket = await this._connect(ma, options);\n const maConn = (0,_socket_to_conn_js__WEBPACK_IMPORTED_MODULE_9__.socketToMaConn)(socket, ma);\n log('new outbound connection %s', maConn.remoteAddr);\n const conn = await options.upgrader.upgradeOutbound(maConn);\n log('outbound connection %s upgraded', maConn.remoteAddr);\n return conn;\n }\n async _connect(ma, options) {\n if (options?.signal?.aborted === true) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.AbortError();\n }\n const cOpts = ma.toOptions();\n log('dialing %s:%s', cOpts.host, cOpts.port);\n const errorPromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_5__[\"default\"])();\n const errfn = (err) => {\n log.error('connection error:', err);\n errorPromise.reject(err);\n };\n const rawSocket = (0,it_ws_client__WEBPACK_IMPORTED_MODULE_4__.connect)((0,_multiformats_multiaddr_to_uri__WEBPACK_IMPORTED_MODULE_3__.multiaddrToUri)(ma), this.init);\n if (rawSocket.socket.on != null) {\n rawSocket.socket.on('error', errfn);\n }\n else {\n rawSocket.socket.onerror = errfn;\n }\n if (options.signal == null) {\n await Promise.race([rawSocket.connected(), errorPromise.promise]);\n log('connected %s', ma);\n return rawSocket;\n }\n // Allow abort via signal during connect\n let onAbort;\n const abort = new Promise((resolve, reject) => {\n onAbort = () => {\n reject(new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.AbortError());\n rawSocket.close().catch(err => {\n log.error('error closing raw socket', err);\n });\n };\n // Already aborted?\n if (options?.signal?.aborted === true) {\n onAbort();\n return;\n }\n options?.signal?.addEventListener('abort', onAbort);\n });\n try {\n await Promise.race([abort, errorPromise.promise, rawSocket.connected()]);\n }\n finally {\n if (onAbort != null) {\n options?.signal?.removeEventListener('abort', onAbort);\n }\n }\n log('connected %s', ma);\n return rawSocket;\n }\n /**\n * Creates a Websockets listener. The provided `handler` function will be called\n * anytime a new incoming Connection has been successfully upgraded via\n * `upgrader.upgradeInbound`\n */\n createListener(options) {\n return (0,_listener_js__WEBPACK_IMPORTED_MODULE_8__.createListener)({ ...this.init, ...options });\n }\n /**\n * Takes a list of `Multiaddr`s and returns only valid Websockets addresses.\n * By default, in a browser environment only DNS+WSS multiaddr is accepted,\n * while in a Node.js environment DNS+{WS, WSS} multiaddrs are accepted.\n */\n filter(multiaddrs) {\n multiaddrs = Array.isArray(multiaddrs) ? multiaddrs : [multiaddrs];\n if (this.init?.filter != null) {\n return this.init?.filter(multiaddrs);\n }\n // Browser\n if (wherearewe__WEBPACK_IMPORTED_MODULE_6__.isBrowser || wherearewe__WEBPACK_IMPORTED_MODULE_6__.isWebWorker) {\n return _filters_js__WEBPACK_IMPORTED_MODULE_7__.wss(multiaddrs);\n }\n return _filters_js__WEBPACK_IMPORTED_MODULE_7__.all(multiaddrs);\n }\n}\nfunction webSockets(init = {}) {\n return () => {\n return new WebSockets(init);\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/websockets/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/websockets/dist/src/listener.browser.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@libp2p/websockets/dist/src/listener.browser.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createListener: () => (/* binding */ createListener)\n/* harmony export */ });\nfunction createListener() {\n throw new Error('WebSocket Servers can not be created in the browser!');\n}\n//# sourceMappingURL=listener.browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/websockets/dist/src/listener.browser.js?"); + +/***/ }), + +/***/ "./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js": +/*!********************************************************************!*\ + !*** ./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ socketToMaConn: () => (/* binding */ socketToMaConn)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-timeout/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@libp2p/websockets/dist/src/constants.js\");\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:websockets:socket');\n// Convert a stream into a MultiaddrConnection\n// https://github.com/libp2p/interface-transport#multiaddrconnection\nfunction socketToMaConn(stream, remoteAddr, options) {\n options = options ?? {};\n const maConn = {\n async sink(source) {\n if ((options?.signal) != null) {\n source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableSource)(source, options.signal);\n }\n try {\n await stream.sink(source);\n }\n catch (err) {\n if (err.type !== 'aborted') {\n log.error(err);\n }\n }\n },\n source: (options.signal != null) ? (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableSource)(stream.source, options.signal) : stream.source,\n remoteAddr,\n timeline: { open: Date.now() },\n async close() {\n const start = Date.now();\n try {\n await (0,p_timeout__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(stream.close(), {\n milliseconds: _constants_js__WEBPACK_IMPORTED_MODULE_3__.CLOSE_TIMEOUT\n });\n }\n catch (err) {\n const { host, port } = maConn.remoteAddr.toOptions();\n log('timeout closing stream to %s:%s after %dms, destroying it manually', host, port, Date.now() - start);\n stream.destroy();\n }\n finally {\n maConn.timeline.close = Date.now();\n }\n }\n };\n stream.socket.addEventListener('close', () => {\n // In instances where `close` was not explicitly called,\n // such as an iterable stream ending, ensure we have set the close\n // timeline\n if (maConn.timeline.close == null) {\n maConn.timeline.close = Date.now();\n }\n }, { once: true });\n return maConn;\n}\n//# sourceMappingURL=socket-to-conn.js.map\n\n//# sourceURL=webpack://light/./node_modules/@libp2p/websockets/dist/src/socket-to-conn.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/mafmt/dist/src/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@multiformats/mafmt/dist/src/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Circuit: () => (/* binding */ Circuit),\n/* harmony export */ DNS: () => (/* binding */ DNS),\n/* harmony export */ DNS4: () => (/* binding */ DNS4),\n/* harmony export */ DNS6: () => (/* binding */ DNS6),\n/* harmony export */ DNSADDR: () => (/* binding */ DNSADDR),\n/* harmony export */ HTTP: () => (/* binding */ HTTP),\n/* harmony export */ HTTPS: () => (/* binding */ HTTPS),\n/* harmony export */ IP: () => (/* binding */ IP),\n/* harmony export */ IPFS: () => (/* binding */ IPFS),\n/* harmony export */ P2P: () => (/* binding */ P2P),\n/* harmony export */ P2PWebRTCDirect: () => (/* binding */ P2PWebRTCDirect),\n/* harmony export */ P2PWebRTCStar: () => (/* binding */ P2PWebRTCStar),\n/* harmony export */ QUIC: () => (/* binding */ QUIC),\n/* harmony export */ QUICV1: () => (/* binding */ QUICV1),\n/* harmony export */ Reliable: () => (/* binding */ Reliable),\n/* harmony export */ Stardust: () => (/* binding */ Stardust),\n/* harmony export */ TCP: () => (/* binding */ TCP),\n/* harmony export */ UDP: () => (/* binding */ UDP),\n/* harmony export */ UTP: () => (/* binding */ UTP),\n/* harmony export */ WebRTC: () => (/* binding */ WebRTC),\n/* harmony export */ WebRTCDirect: () => (/* binding */ WebRTCDirect),\n/* harmony export */ WebSocketStar: () => (/* binding */ WebSocketStar),\n/* harmony export */ WebSockets: () => (/* binding */ WebSockets),\n/* harmony export */ WebSocketsSecure: () => (/* binding */ WebSocketsSecure),\n/* harmony export */ WebTransport: () => (/* binding */ WebTransport)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\n/*\n * Valid combinations\n */\nconst DNS4 = base('dns4');\nconst DNS6 = base('dns6');\nconst DNSADDR = base('dnsaddr');\nconst DNS = or(base('dns'), DNSADDR, DNS4, DNS6);\nconst IP = or(base('ip4'), base('ip6'));\nconst TCP = or(and(IP, base('tcp')), and(DNS, base('tcp')));\nconst UDP = and(IP, base('udp'));\nconst UTP = and(UDP, base('utp'));\nconst QUIC = and(UDP, base('quic'));\nconst QUICV1 = and(UDP, base('quic-v1'));\nconst _WebSockets = or(and(TCP, base('ws')), and(DNS, base('ws')));\nconst WebSockets = or(and(_WebSockets, base('p2p')), _WebSockets);\nconst _WebSocketsSecure = or(and(TCP, base('wss')), and(DNS, base('wss')), and(TCP, base('tls'), base('ws')), and(DNS, base('tls'), base('ws')));\nconst WebSocketsSecure = or(and(_WebSocketsSecure, base('p2p')), _WebSocketsSecure);\nconst HTTP = or(and(TCP, base('http')), and(IP, base('http')), and(DNS, base('http')));\nconst HTTPS = or(and(TCP, base('https')), and(IP, base('https')), and(DNS, base('https')));\nconst _WebRTCDirect = and(UDP, base('webrtc-direct'), base('certhash'));\nconst WebRTCDirect = or(and(_WebRTCDirect, base('p2p')), _WebRTCDirect);\nconst _WebTransport = and(QUICV1, base('webtransport'), base('certhash'), base('certhash'));\nconst WebTransport = or(and(_WebTransport, base('p2p')), _WebTransport);\n/**\n * @deprecated\n */\nconst P2PWebRTCStar = or(and(WebSockets, base('p2p-webrtc-star'), base('p2p')), and(WebSocketsSecure, base('p2p-webrtc-star'), base('p2p')), and(WebSockets, base('p2p-webrtc-star')), and(WebSocketsSecure, base('p2p-webrtc-star')));\nconst WebSocketStar = or(and(WebSockets, base('p2p-websocket-star'), base('p2p')), and(WebSocketsSecure, base('p2p-websocket-star'), base('p2p')), and(WebSockets, base('p2p-websocket-star')), and(WebSocketsSecure, base('p2p-websocket-star')));\n/**\n * @deprecated\n */\nconst P2PWebRTCDirect = or(and(HTTP, base('p2p-webrtc-direct'), base('p2p')), and(HTTPS, base('p2p-webrtc-direct'), base('p2p')), and(HTTP, base('p2p-webrtc-direct')), and(HTTPS, base('p2p-webrtc-direct')));\nconst Reliable = or(_WebSockets, _WebSocketsSecure, HTTP, HTTPS, P2PWebRTCStar, P2PWebRTCDirect, TCP, UTP, QUIC, DNS, WebRTCDirect, WebTransport);\n// Unlike ws-star, stardust can run over any transport thus removing the requirement for websockets (but don't even think about running a stardust server over webrtc-star ;) )\nconst Stardust = or(and(Reliable, base('p2p-stardust'), base('p2p')), and(Reliable, base('p2p-stardust')));\nconst _P2P = or(and(Reliable, base('p2p')), P2PWebRTCStar, P2PWebRTCDirect, WebRTCDirect, WebTransport, base('p2p'));\nconst _Circuit = or(and(_P2P, base('p2p-circuit'), _P2P), and(_P2P, base('p2p-circuit')), and(base('p2p-circuit'), _P2P), and(Reliable, base('p2p-circuit')), and(base('p2p-circuit'), Reliable), base('p2p-circuit'));\nconst CircuitRecursive = () => or(and(_Circuit, CircuitRecursive), _Circuit);\nconst Circuit = CircuitRecursive();\nconst P2P = or(and(Circuit, _P2P, Circuit), and(_P2P, Circuit), and(Circuit, _P2P), Circuit, _P2P);\nconst IPFS = P2P;\nconst WebRTC = or(and(Circuit, base('webrtc'), base('p2p')), and(Circuit, base('webrtc')), and(Reliable, base('webrtc'), base('p2p')), and(Reliable, base('webrtc')), base('webrtc'));\n/*\n * Validation funcs\n */\nfunction makeMatchesFunction(partialMatch) {\n function matches(a) {\n let ma;\n try {\n ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a);\n }\n catch (err) { // catch error\n return false; // also if it's invalid it's probably not matching as well so return false\n }\n const out = partialMatch(ma.protoNames());\n if (out === null) {\n return false;\n }\n if (out === true || out === false) {\n return out;\n }\n return out.length === 0;\n }\n return matches;\n}\nfunction and(...args) {\n function partialMatch(a) {\n if (a.length < args.length) {\n return null;\n }\n let out = a;\n args.some((arg) => {\n out = typeof arg === 'function'\n ? arg().partialMatch(a)\n : arg.partialMatch(a);\n if (Array.isArray(out)) {\n a = out;\n }\n if (out === null) {\n return true;\n }\n return false;\n });\n return out;\n }\n return {\n toString: function () { return '{ ' + args.join(' ') + ' }'; },\n input: args,\n matches: makeMatchesFunction(partialMatch),\n partialMatch\n };\n}\nfunction or(...args) {\n function partialMatch(a) {\n let out = null;\n args.some((arg) => {\n const res = typeof arg === 'function'\n ? arg().partialMatch(a)\n : arg.partialMatch(a);\n if (res != null) {\n out = res;\n return true;\n }\n return false;\n });\n return out;\n }\n const result = {\n toString: function () { return '{ ' + args.join(' ') + ' }'; },\n input: args,\n matches: makeMatchesFunction(partialMatch),\n partialMatch\n };\n return result;\n}\nfunction base(n) {\n const name = n;\n function matches(a) {\n let ma;\n try {\n ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(a);\n }\n catch (err) { // catch error\n return false; // also if it's invalid it's probably not matching as well so return false\n }\n const pnames = ma.protoNames();\n if (pnames.length === 1 && pnames[0] === name) {\n return true;\n }\n return false;\n }\n function partialMatch(protos) {\n if (protos.length === 0) {\n return null;\n }\n if (protos[0] === name) {\n return protos.slice(1);\n }\n return null;\n }\n return {\n toString: function () { return name; },\n matches,\n partialMatch\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/mafmt/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiaddrToUri: () => (/* binding */ multiaddrToUri)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\nfunction extractSNI(ma) {\n let sniProtoCode;\n try {\n sniProtoCode = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('sni').code;\n }\n catch (e) {\n // No SNI protocol in multiaddr\n return null;\n }\n for (const [proto, value] of ma) {\n if (proto === sniProtoCode && value !== undefined) {\n return value;\n }\n }\n return null;\n}\nfunction hasTLS(ma) {\n return ma.some(([proto, _]) => proto === (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('tls').code);\n}\nfunction interpretNext(headProtoCode, headProtoVal, restMa) {\n const interpreter = interpreters[(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)(headProtoCode).name];\n if (interpreter === undefined) {\n throw new Error(`Can't interpret protocol ${(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)(headProtoCode).name}`);\n }\n const restVal = interpreter(headProtoVal, restMa);\n if (headProtoCode === (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('ip6').code) {\n return `[${restVal}]`;\n }\n return restVal;\n}\nconst interpreters = {\n ip4: (value, restMa) => value,\n ip6: (value, restMa) => {\n if (restMa.length === 0) {\n return value;\n }\n return `[${value}]`;\n },\n tcp: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `tcp://${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}:${value}`;\n },\n udp: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `udp://${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}:${value}`;\n },\n dnsaddr: (value, restMa) => value,\n dns4: (value, restMa) => value,\n dns6: (value, restMa) => value,\n dns: (value, restMa) => value,\n ipfs: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/ipfs/${value}`;\n },\n p2p: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p/${value}`;\n },\n http: (value, restMa) => {\n const maHasTLS = hasTLS(restMa);\n const sni = extractSNI(restMa);\n if (maHasTLS && sni !== null) {\n return `https://${sni}`;\n }\n const protocol = maHasTLS ? 'https://' : 'http://';\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base as http, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `${protocol}${baseVal}`;\n },\n tls: (value, restMa) => {\n // Noop, the parent context knows that it's tls. We don't need to do\n // anything here\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n },\n sni: (value, restMa) => {\n // Noop, the parent context uses the sni information, we don't need to do\n // anything here\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n },\n https: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base as http, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `https://${baseVal}`;\n },\n ws: (value, restMa) => {\n const maHasTLS = hasTLS(restMa);\n const sni = extractSNI(restMa);\n if (maHasTLS && sni !== null) {\n return `wss://${sni}`;\n }\n const protocol = maHasTLS ? 'wss://' : 'ws://';\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `${protocol}${baseVal}`;\n },\n wss: (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n let baseVal = interpretNext(tailProto[0], tailProto[1] ?? '', restMa);\n // We are reinterpreting the base as http, so we need to remove the tcp:// if it's there\n baseVal = baseVal.replace('tcp://', '');\n return `wss://${baseVal}`;\n },\n 'p2p-websocket-star': (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p-websocket-star`;\n },\n 'p2p-webrtc-star': (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p-webrtc-star`;\n },\n 'p2p-webrtc-direct': (value, restMa) => {\n const tailProto = restMa.pop();\n if (tailProto === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n return `${interpretNext(tailProto[0], tailProto[1] ?? '', restMa)}/p2p-webrtc-direct`;\n }\n};\nfunction multiaddrToUri(input, opts) {\n const ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(input);\n const parts = ma.stringTuples();\n const head = parts.pop();\n if (head === undefined) {\n throw new Error('Unexpected end of multiaddr');\n }\n const protocol = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)(head[0]);\n const interpreter = interpreters[protocol.name];\n if (interpreter == null) {\n throw new Error(`No interpreter found for ${protocol.name}`);\n }\n let uri = interpreter(head[1] ?? '', parts);\n if (opts?.assumeHttp !== false && head[0] === (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.protocols)('tcp').code) {\n // If rightmost proto is tcp, we assume http here\n uri = uri.replace('tcp://', 'http://');\n if (head[1] === '443' || head[1] === '80') {\n if (head[1] === '443') {\n uri = uri.replace('http://', 'https://');\n }\n // Drop the port\n uri = uri.substring(0, uri.lastIndexOf(':'));\n }\n }\n return uri;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr-to-uri/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/codec.js": +/*!****************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/codec.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ParseError: () => (/* binding */ ParseError),\n/* harmony export */ bytesToString: () => (/* binding */ bytesToString),\n/* harmony export */ bytesToTuples: () => (/* binding */ bytesToTuples),\n/* harmony export */ cleanPath: () => (/* binding */ cleanPath),\n/* harmony export */ fromBytes: () => (/* binding */ fromBytes),\n/* harmony export */ fromString: () => (/* binding */ fromString),\n/* harmony export */ isValidBytes: () => (/* binding */ isValidBytes),\n/* harmony export */ protoFromTuple: () => (/* binding */ protoFromTuple),\n/* harmony export */ sizeForAddr: () => (/* binding */ sizeForAddr),\n/* harmony export */ stringToBytes: () => (/* binding */ stringToBytes),\n/* harmony export */ stringToStringTuples: () => (/* binding */ stringToStringTuples),\n/* harmony export */ stringTuplesToString: () => (/* binding */ stringTuplesToString),\n/* harmony export */ stringTuplesToTuples: () => (/* binding */ stringTuplesToTuples),\n/* harmony export */ tuplesToBytes: () => (/* binding */ tuplesToBytes),\n/* harmony export */ tuplesToStringTuples: () => (/* binding */ tuplesToStringTuples),\n/* harmony export */ validateBytes: () => (/* binding */ validateBytes)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var varint__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! varint */ \"./node_modules/varint/index.js\");\n/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./convert.js */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n\n\n\n\n\n/**\n * string -> [[str name, str addr]... ]\n */\nfunction stringToStringTuples(str) {\n const tuples = [];\n const parts = str.split('/').slice(1); // skip first empty elem\n if (parts.length === 1 && parts[0] === '') {\n return [];\n }\n for (let p = 0; p < parts.length; p++) {\n const part = parts[p];\n const proto = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(part);\n if (proto.size === 0) {\n tuples.push([part]);\n // eslint-disable-next-line no-continue\n continue;\n }\n p++; // advance addr part\n if (p >= parts.length) {\n throw ParseError('invalid address: ' + str);\n }\n // if it's a path proto, take the rest\n if (proto.path === true) {\n tuples.push([\n part,\n // should we need to check each path part to see if it's a proto?\n // This would allow for other protocols to be added after a unix path,\n // however it would have issues if the path had a protocol name in the path\n cleanPath(parts.slice(p).join('/'))\n ]);\n break;\n }\n tuples.push([part, parts[p]]);\n }\n return tuples;\n}\n/**\n * [[str name, str addr]... ] -> string\n */\nfunction stringTuplesToString(tuples) {\n const parts = [];\n tuples.map((tup) => {\n const proto = protoFromTuple(tup);\n parts.push(proto.name);\n if (tup.length > 1 && tup[1] != null) {\n parts.push(tup[1]);\n }\n return null;\n });\n return cleanPath(parts.join('/'));\n}\n/**\n * [[str name, str addr]... ] -> [[int code, Uint8Array]... ]\n */\nfunction stringTuplesToTuples(tuples) {\n return tuples.map((tup) => {\n if (!Array.isArray(tup)) {\n tup = [tup];\n }\n const proto = protoFromTuple(tup);\n if (tup.length > 1) {\n return [proto.code, (0,_convert_js__WEBPACK_IMPORTED_MODULE_3__.convertToBytes)(proto.code, tup[1])];\n }\n return [proto.code];\n });\n}\n/**\n * Convert tuples to string tuples\n *\n * [[int code, Uint8Array]... ] -> [[int code, str addr]... ]\n */\nfunction tuplesToStringTuples(tuples) {\n return tuples.map(tup => {\n const proto = protoFromTuple(tup);\n if (tup[1] != null) {\n return [proto.code, (0,_convert_js__WEBPACK_IMPORTED_MODULE_3__.convertToString)(proto.code, tup[1])];\n }\n return [proto.code];\n });\n}\n/**\n * [[int code, Uint8Array ]... ] -> Uint8Array\n */\nfunction tuplesToBytes(tuples) {\n return fromBytes((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)(tuples.map((tup) => {\n const proto = protoFromTuple(tup);\n let buf = Uint8Array.from(varint__WEBPACK_IMPORTED_MODULE_2__.encode(proto.code));\n if (tup.length > 1 && tup[1] != null) {\n buf = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([buf, tup[1]]); // add address buffer\n }\n return buf;\n })));\n}\n/**\n * For the passed address, return the serialized size\n */\nfunction sizeForAddr(p, addr) {\n if (p.size > 0) {\n return p.size / 8;\n }\n else if (p.size === 0) {\n return 0;\n }\n else {\n const size = varint__WEBPACK_IMPORTED_MODULE_2__.decode(addr);\n return size + (varint__WEBPACK_IMPORTED_MODULE_2__.decode.bytes ?? 0);\n }\n}\nfunction bytesToTuples(buf) {\n const tuples = [];\n let i = 0;\n while (i < buf.length) {\n const code = varint__WEBPACK_IMPORTED_MODULE_2__.decode(buf, i);\n const n = varint__WEBPACK_IMPORTED_MODULE_2__.decode.bytes ?? 0;\n const p = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(code);\n const size = sizeForAddr(p, buf.slice(i + n));\n if (size === 0) {\n tuples.push([code]);\n i += n;\n // eslint-disable-next-line no-continue\n continue;\n }\n const addr = buf.slice(i + n, i + n + size);\n i += (size + n);\n if (i > buf.length) { // did not end _exactly_ at buffer.length\n throw ParseError('Invalid address Uint8Array: ' + (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(buf, 'base16'));\n }\n // ok, tuple seems good.\n tuples.push([code, addr]);\n }\n return tuples;\n}\n/**\n * Uint8Array -> String\n */\nfunction bytesToString(buf) {\n const a = bytesToTuples(buf);\n const b = tuplesToStringTuples(a);\n return stringTuplesToString(b);\n}\n/**\n * String -> Uint8Array\n */\nfunction stringToBytes(str) {\n str = cleanPath(str);\n const a = stringToStringTuples(str);\n const b = stringTuplesToTuples(a);\n return tuplesToBytes(b);\n}\n/**\n * String -> Uint8Array\n */\nfunction fromString(str) {\n return stringToBytes(str);\n}\n/**\n * Uint8Array -> Uint8Array\n */\nfunction fromBytes(buf) {\n const err = validateBytes(buf);\n if (err != null) {\n throw err;\n }\n return Uint8Array.from(buf); // copy\n}\nfunction validateBytes(buf) {\n try {\n bytesToTuples(buf); // try to parse. will throw if breaks\n }\n catch (err) {\n return err;\n }\n}\nfunction isValidBytes(buf) {\n return validateBytes(buf) === undefined;\n}\nfunction cleanPath(str) {\n return '/' + str.trim().split('/').filter((a) => a).join('/');\n}\nfunction ParseError(str) {\n return new Error('Error parsing address: ' + str);\n}\nfunction protoFromTuple(tup) {\n const proto = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_4__.getProtocol)(tup[0]);\n return proto;\n}\n//# sourceMappingURL=codec.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/codec.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/convert.js": +/*!******************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/convert.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ convert: () => (/* binding */ convert),\n/* harmony export */ convertToBytes: () => (/* binding */ convertToBytes),\n/* harmony export */ convertToIpNet: () => (/* binding */ convertToIpNet),\n/* harmony export */ convertToString: () => (/* binding */ convertToString)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_netmask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/netmask */ \"./node_modules/@chainsafe/netmask/dist/src/index.js\");\n/* harmony import */ var multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base32 */ \"./node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/src/basics.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/src/cid.js\");\n/* harmony import */ var multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! multiformats/hashes/digest */ \"./node_modules/multiformats/src/hashes/digest.js\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var varint__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! varint */ \"./node_modules/varint/index.js\");\n/* harmony import */ var _ip_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ip.js */ \"./node_modules/@multiformats/multiaddr/dist/src/ip.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n/**\n * @packageDocumentation\n *\n * Provides methods for converting\n */\n\n\n\n\n\n\n\n\n\n\n\n\nconst ip4Protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)('ip4');\nconst ip6Protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)('ip6');\nconst ipcidrProtocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)('ipcidr');\nfunction convert(proto, a) {\n if (a instanceof Uint8Array) {\n return convertToString(proto, a);\n }\n else {\n return convertToBytes(proto, a);\n }\n}\n/**\n * Convert [code,Uint8Array] to string\n */\nfunction convertToString(proto, buf) {\n const protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)(proto);\n switch (protocol.code) {\n case 4: // ipv4\n case 41: // ipv6\n return bytes2ip(buf);\n case 42: // ipv6zone\n return bytes2str(buf);\n case 6: // tcp\n case 273: // udp\n case 33: // dccp\n case 132: // sctp\n return bytes2port(buf).toString();\n case 53: // dns\n case 54: // dns4\n case 55: // dns6\n case 56: // dnsaddr\n case 400: // unix\n case 449: // sni\n case 777: // memory\n return bytes2str(buf);\n case 421: // ipfs\n return bytes2mh(buf);\n case 444: // onion\n return bytes2onion(buf);\n case 445: // onion3\n return bytes2onion(buf);\n case 466: // certhash\n return bytes2mb(buf);\n default:\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__.toString)(buf, 'base16'); // no clue. convert to hex\n }\n}\nfunction convertToBytes(proto, str) {\n const protocol = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_11__.getProtocol)(proto);\n switch (protocol.code) {\n case 4: // ipv4\n return ip2bytes(str);\n case 41: // ipv6\n return ip2bytes(str);\n case 42: // ipv6zone\n return str2bytes(str);\n case 6: // tcp\n case 273: // udp\n case 33: // dccp\n case 132: // sctp\n return port2bytes(parseInt(str, 10));\n case 53: // dns\n case 54: // dns4\n case 55: // dns6\n case 56: // dnsaddr\n case 400: // unix\n case 449: // sni\n case 777: // memory\n return str2bytes(str);\n case 421: // ipfs\n return mh2bytes(str);\n case 444: // onion\n return onion2bytes(str);\n case 445: // onion3\n return onion32bytes(str);\n case 466: // certhash\n return mb2bytes(str);\n default:\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(str, 'base16'); // no clue. convert from hex\n }\n}\nfunction convertToIpNet(multiaddr) {\n let mask;\n let addr;\n multiaddr.stringTuples().forEach(([code, value]) => {\n if (code === ip4Protocol.code || code === ip6Protocol.code) {\n addr = value;\n }\n if (code === ipcidrProtocol.code) {\n mask = value;\n }\n });\n if (mask == null || addr == null) {\n throw new Error('Invalid multiaddr');\n }\n return new _chainsafe_netmask__WEBPACK_IMPORTED_MODULE_0__.IpNet(addr, mask);\n}\nconst decoders = Object.values(multiformats_basics__WEBPACK_IMPORTED_MODULE_3__.bases).map((c) => c.decoder);\nconst anybaseDecoder = (function () {\n let acc = decoders[0].or(decoders[1]);\n decoders.slice(2).forEach((d) => (acc = acc.or(d)));\n return acc;\n})();\nfunction ip2bytes(ipString) {\n if (!_ip_js__WEBPACK_IMPORTED_MODULE_10__.isIP(ipString)) {\n throw new Error('invalid ip address');\n }\n return _ip_js__WEBPACK_IMPORTED_MODULE_10__.toBytes(ipString);\n}\nfunction bytes2ip(ipBuff) {\n const ipString = _ip_js__WEBPACK_IMPORTED_MODULE_10__.toString(ipBuff, 0, ipBuff.length);\n if (ipString == null) {\n throw new Error('ipBuff is required');\n }\n if (!_ip_js__WEBPACK_IMPORTED_MODULE_10__.isIP(ipString)) {\n throw new Error('invalid ip address');\n }\n return ipString;\n}\nfunction port2bytes(port) {\n const buf = new ArrayBuffer(2);\n const view = new DataView(buf);\n view.setUint16(0, port);\n return new Uint8Array(buf);\n}\nfunction bytes2port(buf) {\n const view = new DataView(buf.buffer);\n return view.getUint16(buf.byteOffset);\n}\nfunction str2bytes(str) {\n const buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_7__.fromString)(str);\n const size = Uint8Array.from(varint__WEBPACK_IMPORTED_MODULE_9__.encode(buf.length));\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__.concat)([size, buf], size.length + buf.length);\n}\nfunction bytes2str(buf) {\n const size = varint__WEBPACK_IMPORTED_MODULE_9__.decode(buf);\n buf = buf.slice(varint__WEBPACK_IMPORTED_MODULE_9__.decode.bytes);\n if (buf.length !== size) {\n throw new Error('inconsistent lengths');\n }\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__.toString)(buf);\n}\nfunction mh2bytes(hash) {\n let mh;\n if (hash[0] === 'Q' || hash[0] === '1') {\n mh = multiformats_hashes_digest__WEBPACK_IMPORTED_MODULE_5__.decode(multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_2__.base58btc.decode(`z${hash}`)).bytes;\n }\n else {\n mh = multiformats_cid__WEBPACK_IMPORTED_MODULE_4__.CID.parse(hash).multihash.bytes;\n }\n // the address is a varint prefixed multihash string representation\n const size = Uint8Array.from(varint__WEBPACK_IMPORTED_MODULE_9__.encode(mh.length));\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__.concat)([size, mh], size.length + mh.length);\n}\nfunction mb2bytes(mbstr) {\n const mb = anybaseDecoder.decode(mbstr);\n const size = Uint8Array.from(varint__WEBPACK_IMPORTED_MODULE_9__.encode(mb.length));\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__.concat)([size, mb], size.length + mb.length);\n}\nfunction bytes2mb(buf) {\n const size = varint__WEBPACK_IMPORTED_MODULE_9__.decode(buf);\n const hash = buf.slice(varint__WEBPACK_IMPORTED_MODULE_9__.decode.bytes);\n if (hash.length !== size) {\n throw new Error('inconsistent lengths');\n }\n return 'u' + (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__.toString)(hash, 'base64url');\n}\n/**\n * Converts bytes to bas58btc string\n */\nfunction bytes2mh(buf) {\n const size = varint__WEBPACK_IMPORTED_MODULE_9__.decode(buf);\n const address = buf.slice(varint__WEBPACK_IMPORTED_MODULE_9__.decode.bytes);\n if (address.length !== size) {\n throw new Error('inconsistent lengths');\n }\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__.toString)(address, 'base58btc');\n}\nfunction onion2bytes(str) {\n const addr = str.split(':');\n if (addr.length !== 2) {\n throw new Error(`failed to parse onion addr: [\"'${addr.join('\", \"')}'\"]' does not contain a port number`);\n }\n if (addr[0].length !== 16) {\n throw new Error(`failed to parse onion addr: ${addr[0]} not a Tor onion address.`);\n }\n // onion addresses do not include the multibase prefix, add it before decoding\n const buf = multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__.base32.decode('b' + addr[0]);\n // onion port number\n const port = parseInt(addr[1], 10);\n if (port < 1 || port > 65536) {\n throw new Error('Port number is not in range(1, 65536)');\n }\n const portBuf = port2bytes(port);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__.concat)([buf, portBuf], buf.length + portBuf.length);\n}\nfunction onion32bytes(str) {\n const addr = str.split(':');\n if (addr.length !== 2) {\n throw new Error(`failed to parse onion addr: [\"'${addr.join('\", \"')}'\"]' does not contain a port number`);\n }\n if (addr[0].length !== 56) {\n throw new Error(`failed to parse onion addr: ${addr[0]} not a Tor onion3 address.`);\n }\n // onion addresses do not include the multibase prefix, add it before decoding\n const buf = multiformats_bases_base32__WEBPACK_IMPORTED_MODULE_1__.base32.decode(`b${addr[0]}`);\n // onion port number\n const port = parseInt(addr[1], 10);\n if (port < 1 || port > 65536) {\n throw new Error('Port number is not in range(1, 65536)');\n }\n const portBuf = port2bytes(port);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_6__.concat)([buf, portBuf], buf.length + portBuf.length);\n}\nfunction bytes2onion(buf) {\n const addrBytes = buf.slice(0, buf.length - 2);\n const portBytes = buf.slice(buf.length - 2);\n const addr = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_8__.toString)(addrBytes, 'base32');\n const port = bytes2port(portBytes);\n return `${addr}:${port}`;\n}\n//# sourceMappingURL=convert.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/convert.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MultiaddrFilter: () => (/* binding */ MultiaddrFilter)\n/* harmony export */ });\n/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../convert.js */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\n\n/**\n * A utility class to determine if a Multiaddr contains another\n * multiaddr.\n *\n * This can be used with ipcidr ranges to determine if a given\n * multiaddr is in a ipcidr range.\n *\n * @example\n *\n * ```js\n * import { multiaddr, MultiaddrFilter } from '@multiformats/multiaddr'\n *\n * const range = multiaddr('/ip4/192.168.10.10/ipcidr/24')\n * const filter = new MultiaddrFilter(range)\n *\n * const input = multiaddr('/ip4/192.168.10.2/udp/60')\n * console.info(filter.contains(input)) // true\n * ```\n */\nclass MultiaddrFilter {\n multiaddr;\n netmask;\n constructor(input) {\n this.multiaddr = (0,_index_js__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(input);\n this.netmask = (0,_convert_js__WEBPACK_IMPORTED_MODULE_0__.convertToIpNet)(this.multiaddr);\n }\n contains(input) {\n if (input == null)\n return false;\n const m = (0,_index_js__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(input);\n let ip;\n for (const [code, value] of m.stringTuples()) {\n if (code === 4 || code === 41) {\n ip = value;\n break;\n }\n }\n if (ip === undefined)\n return false;\n return this.netmask.contains(ip);\n }\n}\n//# sourceMappingURL=multiaddr-filter.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/index.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MultiaddrFilter: () => (/* reexport safe */ _filter_multiaddr_filter_js__WEBPACK_IMPORTED_MODULE_8__.MultiaddrFilter),\n/* harmony export */ fromNodeAddress: () => (/* binding */ fromNodeAddress),\n/* harmony export */ isMultiaddr: () => (/* binding */ isMultiaddr),\n/* harmony export */ isName: () => (/* binding */ isName),\n/* harmony export */ multiaddr: () => (/* binding */ multiaddr),\n/* harmony export */ protocols: () => (/* reexport safe */ _protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol),\n/* harmony export */ resolvers: () => (/* binding */ resolvers)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! multiformats/bases/base58 */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/src/cid.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var varint__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! varint */ \"./node_modules/varint/index.js\");\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./codec.js */ \"./node_modules/@multiformats/multiaddr/dist/src/codec.js\");\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n/* harmony import */ var _filter_multiaddr_filter_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./filter/multiaddr-filter.js */ \"./node_modules/@multiformats/multiaddr/dist/src/filter/multiaddr-filter.js\");\n/**\n * @packageDocumentation\n *\n * An implementation of a Multiaddr in JavaScript\n *\n * @example\n *\n * ```js\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * const ma = multiaddr('/ip4/127.0.0.1/tcp/1234')\n * ```\n */\n\n\n\n\n\n\n\n\nconst inspect = Symbol.for('nodejs.util.inspect.custom');\nconst DNS_CODES = [\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('dns').code,\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('dns4').code,\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('dns6').code,\n (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('dnsaddr').code\n];\n/**\n * All configured {@link Resolver}s\n */\nconst resolvers = new Map();\nconst symbol = Symbol.for('@multiformats/js-multiaddr/multiaddr');\n\n/**\n * Creates a Multiaddr from a node-friendly address object\n *\n * @example\n * ```js\n * import { fromNodeAddress } from '@multiformats/multiaddr'\n *\n * fromNodeAddress({address: '127.0.0.1', port: '4001'}, 'tcp')\n * // Multiaddr(/ip4/127.0.0.1/tcp/4001)\n * ```\n */\nfunction fromNodeAddress(addr, transport) {\n if (addr == null) {\n throw new Error('requires node address object');\n }\n if (transport == null) {\n throw new Error('requires transport protocol');\n }\n let ip;\n let host = addr.address;\n switch (addr.family) {\n case 4:\n ip = 'ip4';\n break;\n case 6:\n ip = 'ip6';\n if (host.includes('%')) {\n const parts = host.split('%');\n if (parts.length !== 2) {\n throw Error('Multiple ip6 zones in multiaddr');\n }\n host = parts[0];\n const zone = parts[1];\n ip = `/ip6zone/${zone}/ip6`;\n }\n break;\n default:\n throw Error('Invalid addr family, should be 4 or 6.');\n }\n return new DefaultMultiaddr('/' + [ip, host, transport, addr.port].join('/'));\n}\n/**\n * Returns if something is a {@link Multiaddr} that is a resolvable name\n *\n * @example\n *\n * ```js\n * import { isName, multiaddr } from '@multiformats/multiaddr'\n *\n * isName(multiaddr('/ip4/127.0.0.1'))\n * // false\n * isName(multiaddr('/dns/ipfs.io'))\n * // true\n * ```\n */\nfunction isName(addr) {\n if (!isMultiaddr(addr)) {\n return false;\n }\n // if a part of the multiaddr is resolvable, then return true\n return addr.protos().some((proto) => proto.resolvable);\n}\n/**\n * Check if object is a {@link Multiaddr} instance\n *\n * @example\n *\n * ```js\n * import { isMultiaddr, multiaddr } from '@multiformats/multiaddr'\n *\n * isMultiaddr(5)\n * // false\n * isMultiaddr(multiaddr('/ip4/127.0.0.1'))\n * // true\n * ```\n */\nfunction isMultiaddr(value) {\n return Boolean(value?.[symbol]);\n}\n/**\n * Creates a {@link Multiaddr} from a {@link MultiaddrInput}\n */\nclass DefaultMultiaddr {\n bytes;\n #string;\n #tuples;\n #stringTuples;\n #path;\n [symbol] = true;\n constructor(addr) {\n // default\n if (addr == null) {\n addr = '';\n }\n if (addr instanceof Uint8Array) {\n this.bytes = _codec_js__WEBPACK_IMPORTED_MODULE_6__.fromBytes(addr);\n }\n else if (typeof addr === 'string') {\n if (addr.length > 0 && addr.charAt(0) !== '/') {\n throw new Error(`multiaddr \"${addr}\" must start with a \"/\"`);\n }\n this.bytes = _codec_js__WEBPACK_IMPORTED_MODULE_6__.fromString(addr);\n }\n else if (isMultiaddr(addr)) { // Multiaddr\n this.bytes = _codec_js__WEBPACK_IMPORTED_MODULE_6__.fromBytes(addr.bytes); // validate + copy buffer\n }\n else {\n throw new Error('addr must be a string, Buffer, or another Multiaddr');\n }\n }\n toString() {\n if (this.#string == null) {\n this.#string = _codec_js__WEBPACK_IMPORTED_MODULE_6__.bytesToString(this.bytes);\n }\n return this.#string;\n }\n toJSON() {\n return this.toString();\n }\n toOptions() {\n let family;\n let transport;\n let host;\n let port;\n let zone = '';\n const tcp = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('tcp');\n const udp = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('udp');\n const ip4 = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('ip4');\n const ip6 = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('ip6');\n const dns6 = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('dns6');\n const ip6zone = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)('ip6zone');\n for (const [code, value] of this.stringTuples()) {\n if (code === ip6zone.code) {\n zone = `%${value ?? ''}`;\n }\n // default to https when protocol & port are omitted from DNS addrs\n if (DNS_CODES.includes(code)) {\n transport = tcp.name;\n port = 443;\n host = `${value ?? ''}${zone}`;\n family = code === dns6.code ? 6 : 4;\n }\n if (code === tcp.code || code === udp.code) {\n transport = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)(code).name;\n port = parseInt(value ?? '');\n }\n if (code === ip4.code || code === ip6.code) {\n transport = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)(code).name;\n host = `${value ?? ''}${zone}`;\n family = code === ip6.code ? 6 : 4;\n }\n }\n if (family == null || transport == null || host == null || port == null) {\n throw new Error('multiaddr must have a valid format: \"/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}\".');\n }\n const opts = {\n family,\n host,\n transport,\n port\n };\n return opts;\n }\n protos() {\n return this.protoCodes().map(code => Object.assign({}, (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)(code)));\n }\n protoCodes() {\n const codes = [];\n const buf = this.bytes;\n let i = 0;\n while (i < buf.length) {\n const code = varint__WEBPACK_IMPORTED_MODULE_5__.decode(buf, i);\n const n = varint__WEBPACK_IMPORTED_MODULE_5__.decode.bytes ?? 0;\n const p = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)(code);\n const size = _codec_js__WEBPACK_IMPORTED_MODULE_6__.sizeForAddr(p, buf.slice(i + n));\n i += (size + n);\n codes.push(code);\n }\n return codes;\n }\n protoNames() {\n return this.protos().map(proto => proto.name);\n }\n tuples() {\n if (this.#tuples == null) {\n this.#tuples = _codec_js__WEBPACK_IMPORTED_MODULE_6__.bytesToTuples(this.bytes);\n }\n return this.#tuples;\n }\n stringTuples() {\n if (this.#stringTuples == null) {\n this.#stringTuples = _codec_js__WEBPACK_IMPORTED_MODULE_6__.tuplesToStringTuples(this.tuples());\n }\n return this.#stringTuples;\n }\n encapsulate(addr) {\n addr = new DefaultMultiaddr(addr);\n return new DefaultMultiaddr(this.toString() + addr.toString());\n }\n decapsulate(addr) {\n const addrString = addr.toString();\n const s = this.toString();\n const i = s.lastIndexOf(addrString);\n if (i < 0) {\n throw new Error(`Address ${this.toString()} does not contain subaddress: ${addr.toString()}`);\n }\n return new DefaultMultiaddr(s.slice(0, i));\n }\n decapsulateCode(code) {\n const tuples = this.tuples();\n for (let i = tuples.length - 1; i >= 0; i--) {\n if (tuples[i][0] === code) {\n return new DefaultMultiaddr(_codec_js__WEBPACK_IMPORTED_MODULE_6__.tuplesToBytes(tuples.slice(0, i)));\n }\n }\n return this;\n }\n getPeerId() {\n try {\n const tuples = this.stringTuples().filter((tuple) => {\n if (tuple[0] === _protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.names.ipfs.code) {\n return true;\n }\n return false;\n });\n // Get the last ipfs tuple ['ipfs', 'peerid string']\n const tuple = tuples.pop();\n if (tuple?.[1] != null) {\n const peerIdStr = tuple[1];\n // peer id is base58btc encoded string but not multibase encoded so add the `z`\n // prefix so we can validate that it is correctly encoded\n if (peerIdStr[0] === 'Q' || peerIdStr[0] === '1') {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(multiformats_bases_base58__WEBPACK_IMPORTED_MODULE_1__.base58btc.decode(`z${peerIdStr}`), 'base58btc');\n }\n // try to parse peer id as CID\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_4__.toString)(multiformats_cid__WEBPACK_IMPORTED_MODULE_2__.CID.parse(peerIdStr).multihash.bytes, 'base58btc');\n }\n return null;\n }\n catch (e) {\n return null;\n }\n }\n getPath() {\n // on initialization, this.#path is undefined\n // after the first call, it is either a string or null\n if (this.#path === undefined) {\n try {\n this.#path = this.stringTuples().filter((tuple) => {\n const proto = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_7__.getProtocol)(tuple[0]);\n if (proto.path === true) {\n return true;\n }\n return false;\n })[0][1];\n if (this.#path == null) {\n this.#path = null;\n }\n }\n catch {\n this.#path = null;\n }\n }\n return this.#path;\n }\n equals(addr) {\n return (0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_3__.equals)(this.bytes, addr.bytes);\n }\n async resolve(options) {\n const resolvableProto = this.protos().find((p) => p.resolvable);\n // Multiaddr is not resolvable?\n if (resolvableProto == null) {\n return [this];\n }\n const resolver = resolvers.get(resolvableProto.name);\n if (resolver == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`no available resolver for ${resolvableProto.name}`, 'ERR_NO_AVAILABLE_RESOLVER');\n }\n const addresses = await resolver(this, options);\n return addresses.map((a) => new DefaultMultiaddr(a));\n }\n nodeAddress() {\n const options = this.toOptions();\n if (options.transport !== 'tcp' && options.transport !== 'udp') {\n throw new Error(`multiaddr must have a valid format - no protocol with name: \"${options.transport}\". Must have a valid transport protocol: \"{tcp, udp}\"`);\n }\n return {\n family: options.family,\n address: options.host,\n port: options.port\n };\n }\n isThinWaistAddress(addr) {\n const protos = (addr ?? this).protos();\n if (protos.length !== 2) {\n return false;\n }\n if (protos[0].code !== 4 && protos[0].code !== 41) {\n return false;\n }\n if (protos[1].code !== 6 && protos[1].code !== 273) {\n return false;\n }\n return true;\n }\n /**\n * Returns Multiaddr as a human-readable string\n * https://nodejs.org/api/util.html#utilinspectcustom\n *\n * @example\n * ```js\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * console.info(multiaddr('/ip4/127.0.0.1/tcp/4001'))\n * // 'Multiaddr(/ip4/127.0.0.1/tcp/4001)'\n * ```\n */\n [inspect]() {\n return `Multiaddr(${_codec_js__WEBPACK_IMPORTED_MODULE_6__.bytesToString(this.bytes)})`;\n }\n}\n/**\n * A function that takes a {@link MultiaddrInput} and returns a {@link Multiaddr}\n *\n * @example\n * ```js\n * import { multiaddr } from '@libp2p/multiaddr'\n *\n * multiaddr('/ip4/127.0.0.1/tcp/4001')\n * // Multiaddr(/ip4/127.0.0.1/tcp/4001)\n * ```\n *\n * @param {MultiaddrInput} [addr] - If String or Uint8Array, needs to adhere to the address format of a [multiaddr](https://github.com/multiformats/multiaddr#string-format)\n */\nfunction multiaddr(addr) {\n return new DefaultMultiaddr(addr);\n}\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/ip.js": +/*!*************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/ip.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isIP: () => (/* reexport safe */ _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIP),\n/* harmony export */ isV4: () => (/* binding */ isV4),\n/* harmony export */ isV6: () => (/* binding */ isV6),\n/* harmony export */ toBytes: () => (/* binding */ toBytes),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/is-ip */ \"./node_modules/@chainsafe/is-ip/lib/is-ip.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n\nconst isV4 = _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv4;\nconst isV6 = _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_0__.isIPv6;\n// Copied from https://github.com/indutny/node-ip/blob/master/lib/ip.js#L7\n// but with buf/offset args removed because we don't use them\nconst toBytes = function (ip) {\n let offset = 0;\n ip = ip.toString().trim();\n if (isV4(ip)) {\n const bytes = new Uint8Array(offset + 4);\n ip.split(/\\./g).forEach((byte) => {\n bytes[offset++] = parseInt(byte, 10) & 0xff;\n });\n return bytes;\n }\n if (isV6(ip)) {\n const sections = ip.split(':', 8);\n let i;\n for (i = 0; i < sections.length; i++) {\n const isv4 = isV4(sections[i]);\n let v4Buffer;\n if (isv4) {\n v4Buffer = toBytes(sections[i]);\n sections[i] = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(v4Buffer.slice(0, 2), 'base16');\n }\n if (v4Buffer != null && ++i < 8) {\n sections.splice(i, 0, (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(v4Buffer.slice(2, 4), 'base16'));\n }\n }\n if (sections[0] === '') {\n while (sections.length < 8)\n sections.unshift('0');\n }\n else if (sections[sections.length - 1] === '') {\n while (sections.length < 8)\n sections.push('0');\n }\n else if (sections.length < 8) {\n for (i = 0; i < sections.length && sections[i] !== ''; i++)\n ;\n const argv = [i, 1];\n for (i = 9 - sections.length; i > 0; i--) {\n argv.push('0');\n }\n sections.splice.apply(sections, argv);\n }\n const bytes = new Uint8Array(offset + 16);\n for (i = 0; i < sections.length; i++) {\n const word = parseInt(sections[i], 16);\n bytes[offset++] = (word >> 8) & 0xff;\n bytes[offset++] = word & 0xff;\n }\n return bytes;\n }\n throw new Error('invalid ip address');\n};\n// Copied from https://github.com/indutny/node-ip/blob/master/lib/ip.js#L63\nconst toString = function (buf, offset = 0, length) {\n offset = ~~offset;\n length = length ?? (buf.length - offset);\n const view = new DataView(buf.buffer);\n if (length === 4) {\n const result = [];\n // IPv4\n for (let i = 0; i < length; i++) {\n result.push(buf[offset + i]);\n }\n return result.join('.');\n }\n if (length === 16) {\n const result = [];\n // IPv6\n for (let i = 0; i < length; i += 2) {\n result.push(view.getUint16(offset + i).toString(16));\n }\n return result.join(':')\n .replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')\n .replace(/:{3,4}/, '::');\n }\n return '';\n};\n//# sourceMappingURL=ip.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/ip.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes),\n/* harmony export */ createProtocol: () => (/* binding */ createProtocol),\n/* harmony export */ getProtocol: () => (/* binding */ getProtocol),\n/* harmony export */ names: () => (/* binding */ names),\n/* harmony export */ table: () => (/* binding */ table)\n/* harmony export */ });\nconst V = -1;\nconst names = {};\nconst codes = {};\nconst table = [\n [4, 32, 'ip4'],\n [6, 16, 'tcp'],\n [33, 16, 'dccp'],\n [41, 128, 'ip6'],\n [42, V, 'ip6zone'],\n [43, 8, 'ipcidr'],\n [53, V, 'dns', true],\n [54, V, 'dns4', true],\n [55, V, 'dns6', true],\n [56, V, 'dnsaddr', true],\n [132, 16, 'sctp'],\n [273, 16, 'udp'],\n [275, 0, 'p2p-webrtc-star'],\n [276, 0, 'p2p-webrtc-direct'],\n [277, 0, 'p2p-stardust'],\n [280, 0, 'webrtc-direct'],\n [281, 0, 'webrtc'],\n [290, 0, 'p2p-circuit'],\n [301, 0, 'udt'],\n [302, 0, 'utp'],\n [400, V, 'unix', false, true],\n // `ipfs` is added before `p2p` for legacy support.\n // All text representations will default to `p2p`, but `ipfs` will\n // still be supported\n [421, V, 'ipfs'],\n // `p2p` is the preferred name for 421, and is now the default\n [421, V, 'p2p'],\n [443, 0, 'https'],\n [444, 96, 'onion'],\n [445, 296, 'onion3'],\n [446, V, 'garlic64'],\n [448, 0, 'tls'],\n [449, V, 'sni'],\n [460, 0, 'quic'],\n [461, 0, 'quic-v1'],\n [465, 0, 'webtransport'],\n [466, V, 'certhash'],\n [477, 0, 'ws'],\n [478, 0, 'wss'],\n [479, 0, 'p2p-websocket-star'],\n [480, 0, 'http'],\n [777, V, 'memory']\n];\n// populate tables\ntable.forEach(row => {\n const proto = createProtocol(...row);\n codes[proto.code] = proto;\n names[proto.name] = proto;\n});\nfunction createProtocol(code, size, name, resolvable, path) {\n return {\n code,\n size,\n name,\n resolvable: Boolean(resolvable),\n path: Boolean(path)\n };\n}\n/**\n * For the passed proto string or number, return a {@link Protocol}\n *\n * @example\n *\n * ```js\n * import { protocol } from '@multiformats/multiaddr'\n *\n * console.info(protocol(4))\n * // { code: 4, size: 32, name: 'ip4', resolvable: false, path: false }\n * ```\n */\nfunction getProtocol(proto) {\n if (typeof proto === 'number') {\n if (codes[proto] != null) {\n return codes[proto];\n }\n throw new Error(`no protocol with code: ${proto}`);\n }\n else if (typeof proto === 'string') {\n if (names[proto] != null) {\n return names[proto];\n }\n throw new Error(`no protocol with name: ${proto}`);\n }\n throw new Error(`invalid protocol id type: ${typeof proto}`);\n}\n//# sourceMappingURL=protocols-table.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/resolvers/dns.browser.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/resolvers/dns.browser.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var dns_over_http_resolver__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dns-over-http-resolver */ \"./node_modules/dns-over-http-resolver/dist/src/index.js\");\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (dns_over_http_resolver__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n//# sourceMappingURL=dns.browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/resolvers/dns.browser.js?"); + +/***/ }), + +/***/ "./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ dnsaddrResolver: () => (/* binding */ dnsaddrResolver)\n/* harmony export */ });\n/* harmony import */ var _protocols_table_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../protocols-table.js */ \"./node_modules/@multiformats/multiaddr/dist/src/protocols-table.js\");\n/* harmony import */ var _dns_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dns.js */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/dns.browser.js\");\n/**\n * @packageDocumentation\n *\n * Provides strategies for resolving multiaddrs.\n */\n\n\nconst { code: dnsaddrCode } = (0,_protocols_table_js__WEBPACK_IMPORTED_MODULE_0__.getProtocol)('dnsaddr');\n/**\n * Resolver for dnsaddr addresses.\n *\n * @example\n *\n * ```typescript\n * import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'\n * import { multiaddr } from '@multiformats/multiaddr'\n *\n * const ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\n * const addresses = await dnsaddrResolver(ma)\n *\n * console.info(addresses)\n * //[\n * // '/dnsaddr/am6.bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb',\n * // '/dnsaddr/ny5.bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa',\n * // '/dnsaddr/sg1.bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt',\n * // '/dnsaddr/sv15.bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN'\n * //]\n * ```\n */\nasync function dnsaddrResolver(addr, options = {}) {\n const resolver = new _dns_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n if (options.signal != null) {\n options.signal.addEventListener('abort', () => {\n resolver.cancel();\n });\n }\n const peerId = addr.getPeerId();\n const [, hostname] = addr.stringTuples().find(([proto]) => proto === dnsaddrCode) ?? [];\n if (hostname == null) {\n throw new Error('No hostname found in multiaddr');\n }\n const records = await resolver.resolveTxt(`_dnsaddr.${hostname}`);\n let addresses = records.flat().map((a) => a.split('=')[1]).filter(Boolean);\n if (peerId != null) {\n addresses = addresses.filter((entry) => entry.includes(peerId));\n }\n return addresses;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/ciphers/esm/_assert.js": +/*!****************************************************!*\ + !*** ./node_modules/@noble/ciphers/esm/_assert.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bool: () => (/* binding */ bool),\n/* harmony export */ bytes: () => (/* binding */ bytes),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ exists: () => (/* binding */ exists),\n/* harmony export */ hash: () => (/* binding */ hash),\n/* harmony export */ number: () => (/* binding */ number),\n/* harmony export */ output: () => (/* binding */ output)\n/* harmony export */ });\nfunction number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nconst assert = { number, bool, bytes, hash, exists, output };\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (assert);\n//# sourceMappingURL=_assert.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/ciphers/esm/_assert.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/ciphers/esm/_poly1305.js": +/*!******************************************************!*\ + !*** ./node_modules/@noble/ciphers/esm/_poly1305.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ poly1305: () => (/* binding */ poly1305),\n/* harmony export */ wrapConstructorWithKey: () => (/* binding */ wrapConstructorWithKey)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/ciphers/esm/utils.js\");\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/ciphers/esm/_assert.js\");\n\n\n// Poly1305 is a fast and parallel secret-key message-authentication code.\n// https://cr.yp.to/mac.html, https://cr.yp.to/mac/poly1305-20050329.pdf\n// https://datatracker.ietf.org/doc/html/rfc8439\n// Based on Public Domain poly1305-donna https://github.com/floodyberry/poly1305-donna\nconst u8to16 = (a, i) => (a[i++] & 0xff) | ((a[i++] & 0xff) << 8);\nclass Poly1305 {\n constructor(key) {\n this.blockLen = 16;\n this.outputLen = 16;\n this.buffer = new Uint8Array(16);\n this.r = new Uint16Array(10);\n this.h = new Uint16Array(10);\n this.pad = new Uint16Array(8);\n this.pos = 0;\n this.finished = false;\n key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(key);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(key, 32);\n const t0 = u8to16(key, 0);\n const t1 = u8to16(key, 2);\n const t2 = u8to16(key, 4);\n const t3 = u8to16(key, 6);\n const t4 = u8to16(key, 8);\n const t5 = u8to16(key, 10);\n const t6 = u8to16(key, 12);\n const t7 = u8to16(key, 14);\n // https://github.com/floodyberry/poly1305-donna/blob/e6ad6e091d30d7f4ec2d4f978be1fcfcbce72781/poly1305-donna-16.h#L47\n this.r[0] = t0 & 0x1fff;\n this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this.r[5] = (t4 >>> 1) & 0x1ffe;\n this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this.r[9] = (t7 >>> 5) & 0x007f;\n for (let i = 0; i < 8; i++)\n this.pad[i] = u8to16(key, 16 + 2 * i);\n }\n process(data, offset, isLast = false) {\n const hibit = isLast ? 0 : 1 << 11;\n const { h, r } = this;\n const r0 = r[0];\n const r1 = r[1];\n const r2 = r[2];\n const r3 = r[3];\n const r4 = r[4];\n const r5 = r[5];\n const r6 = r[6];\n const r7 = r[7];\n const r8 = r[8];\n const r9 = r[9];\n const t0 = u8to16(data, offset + 0);\n const t1 = u8to16(data, offset + 2);\n const t2 = u8to16(data, offset + 4);\n const t3 = u8to16(data, offset + 6);\n const t4 = u8to16(data, offset + 8);\n const t5 = u8to16(data, offset + 10);\n const t6 = u8to16(data, offset + 12);\n const t7 = u8to16(data, offset + 14);\n let h0 = h[0] + (t0 & 0x1fff);\n let h1 = h[1] + (((t0 >>> 13) | (t1 << 3)) & 0x1fff);\n let h2 = h[2] + (((t1 >>> 10) | (t2 << 6)) & 0x1fff);\n let h3 = h[3] + (((t2 >>> 7) | (t3 << 9)) & 0x1fff);\n let h4 = h[4] + (((t3 >>> 4) | (t4 << 12)) & 0x1fff);\n let h5 = h[5] + ((t4 >>> 1) & 0x1fff);\n let h6 = h[6] + (((t4 >>> 14) | (t5 << 2)) & 0x1fff);\n let h7 = h[7] + (((t5 >>> 11) | (t6 << 5)) & 0x1fff);\n let h8 = h[8] + (((t6 >>> 8) | (t7 << 8)) & 0x1fff);\n let h9 = h[9] + ((t7 >>> 5) | hibit);\n let c = 0;\n let d0 = c + h0 * r0 + h1 * (5 * r9) + h2 * (5 * r8) + h3 * (5 * r7) + h4 * (5 * r6);\n c = d0 >>> 13;\n d0 &= 0x1fff;\n d0 += h5 * (5 * r5) + h6 * (5 * r4) + h7 * (5 * r3) + h8 * (5 * r2) + h9 * (5 * r1);\n c += d0 >>> 13;\n d0 &= 0x1fff;\n let d1 = c + h0 * r1 + h1 * r0 + h2 * (5 * r9) + h3 * (5 * r8) + h4 * (5 * r7);\n c = d1 >>> 13;\n d1 &= 0x1fff;\n d1 += h5 * (5 * r6) + h6 * (5 * r5) + h7 * (5 * r4) + h8 * (5 * r3) + h9 * (5 * r2);\n c += d1 >>> 13;\n d1 &= 0x1fff;\n let d2 = c + h0 * r2 + h1 * r1 + h2 * r0 + h3 * (5 * r9) + h4 * (5 * r8);\n c = d2 >>> 13;\n d2 &= 0x1fff;\n d2 += h5 * (5 * r7) + h6 * (5 * r6) + h7 * (5 * r5) + h8 * (5 * r4) + h9 * (5 * r3);\n c += d2 >>> 13;\n d2 &= 0x1fff;\n let d3 = c + h0 * r3 + h1 * r2 + h2 * r1 + h3 * r0 + h4 * (5 * r9);\n c = d3 >>> 13;\n d3 &= 0x1fff;\n d3 += h5 * (5 * r8) + h6 * (5 * r7) + h7 * (5 * r6) + h8 * (5 * r5) + h9 * (5 * r4);\n c += d3 >>> 13;\n d3 &= 0x1fff;\n let d4 = c + h0 * r4 + h1 * r3 + h2 * r2 + h3 * r1 + h4 * r0;\n c = d4 >>> 13;\n d4 &= 0x1fff;\n d4 += h5 * (5 * r9) + h6 * (5 * r8) + h7 * (5 * r7) + h8 * (5 * r6) + h9 * (5 * r5);\n c += d4 >>> 13;\n d4 &= 0x1fff;\n let d5 = c + h0 * r5 + h1 * r4 + h2 * r3 + h3 * r2 + h4 * r1;\n c = d5 >>> 13;\n d5 &= 0x1fff;\n d5 += h5 * r0 + h6 * (5 * r9) + h7 * (5 * r8) + h8 * (5 * r7) + h9 * (5 * r6);\n c += d5 >>> 13;\n d5 &= 0x1fff;\n let d6 = c + h0 * r6 + h1 * r5 + h2 * r4 + h3 * r3 + h4 * r2;\n c = d6 >>> 13;\n d6 &= 0x1fff;\n d6 += h5 * r1 + h6 * r0 + h7 * (5 * r9) + h8 * (5 * r8) + h9 * (5 * r7);\n c += d6 >>> 13;\n d6 &= 0x1fff;\n let d7 = c + h0 * r7 + h1 * r6 + h2 * r5 + h3 * r4 + h4 * r3;\n c = d7 >>> 13;\n d7 &= 0x1fff;\n d7 += h5 * r2 + h6 * r1 + h7 * r0 + h8 * (5 * r9) + h9 * (5 * r8);\n c += d7 >>> 13;\n d7 &= 0x1fff;\n let d8 = c + h0 * r8 + h1 * r7 + h2 * r6 + h3 * r5 + h4 * r4;\n c = d8 >>> 13;\n d8 &= 0x1fff;\n d8 += h5 * r3 + h6 * r2 + h7 * r1 + h8 * r0 + h9 * (5 * r9);\n c += d8 >>> 13;\n d8 &= 0x1fff;\n let d9 = c + h0 * r9 + h1 * r8 + h2 * r7 + h3 * r6 + h4 * r5;\n c = d9 >>> 13;\n d9 &= 0x1fff;\n d9 += h5 * r4 + h6 * r3 + h7 * r2 + h8 * r1 + h9 * r0;\n c += d9 >>> 13;\n d9 &= 0x1fff;\n c = ((c << 2) + c) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = c >>> 13;\n d1 += c;\n h[0] = d0;\n h[1] = d1;\n h[2] = d2;\n h[3] = d3;\n h[4] = d4;\n h[5] = d5;\n h[6] = d6;\n h[7] = d7;\n h[8] = d8;\n h[9] = d9;\n }\n finalize() {\n const { h, pad } = this;\n const g = new Uint16Array(10);\n let c = h[1] >>> 13;\n h[1] &= 0x1fff;\n for (let i = 2; i < 10; i++) {\n h[i] += c;\n c = h[i] >>> 13;\n h[i] &= 0x1fff;\n }\n h[0] += c * 5;\n c = h[0] >>> 13;\n h[0] &= 0x1fff;\n h[1] += c;\n c = h[1] >>> 13;\n h[1] &= 0x1fff;\n h[2] += c;\n g[0] = h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (let i = 1; i < 10; i++) {\n g[i] = h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= 1 << 13;\n let mask = (c ^ 1) - 1;\n for (let i = 0; i < 10; i++)\n g[i] &= mask;\n mask = ~mask;\n for (let i = 0; i < 10; i++)\n h[i] = (h[i] & mask) | g[i];\n h[0] = (h[0] | (h[1] << 13)) & 0xffff;\n h[1] = ((h[1] >>> 3) | (h[2] << 10)) & 0xffff;\n h[2] = ((h[2] >>> 6) | (h[3] << 7)) & 0xffff;\n h[3] = ((h[3] >>> 9) | (h[4] << 4)) & 0xffff;\n h[4] = ((h[4] >>> 12) | (h[5] << 1) | (h[6] << 14)) & 0xffff;\n h[5] = ((h[6] >>> 2) | (h[7] << 11)) & 0xffff;\n h[6] = ((h[7] >>> 5) | (h[8] << 8)) & 0xffff;\n h[7] = ((h[8] >>> 8) | (h[9] << 5)) & 0xffff;\n let f = h[0] + pad[0];\n h[0] = f & 0xffff;\n for (let i = 1; i < 8; i++) {\n f = (((h[i] + pad[i]) | 0) + (f >>> 16)) | 0;\n h[i] = f & 0xffff;\n }\n }\n update(data) {\n _assert_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].exists(this);\n const { buffer, blockLen } = this;\n data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input\n if (take === blockLen) {\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(data, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(buffer, 0, false);\n this.pos = 0;\n }\n }\n return this;\n }\n destroy() {\n this.h.fill(0);\n this.r.fill(0);\n this.buffer.fill(0);\n this.pad.fill(0);\n }\n digestInto(out) {\n _assert_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].exists(this);\n _assert_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].output(out, this);\n this.finished = true;\n const { buffer, h } = this;\n let { pos } = this;\n if (pos) {\n buffer[pos++] = 1;\n // buffer.subarray(pos).fill(0);\n for (; pos < 16; pos++)\n buffer[pos] = 0;\n this.process(buffer, 0, true);\n }\n this.finalize();\n let opos = 0;\n for (let i = 0; i < 8; i++) {\n out[opos++] = h[i] >>> 0;\n out[opos++] = h[i] >>> 8;\n }\n return out;\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n}\nfunction wrapConstructorWithKey(hashCons) {\n const hashC = (msg, key) => hashCons(key).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(msg)).digest();\n const tmp = hashCons(new Uint8Array(32));\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (key) => hashCons(key);\n return hashC;\n}\nconst poly1305 = wrapConstructorWithKey((key) => new Poly1305(key));\n//# sourceMappingURL=_poly1305.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/ciphers/esm/_poly1305.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/ciphers/esm/_salsa.js": +/*!***************************************************!*\ + !*** ./node_modules/@noble/ciphers/esm/_salsa.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ salsaBasic: () => (/* binding */ salsaBasic)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/ciphers/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/ciphers/esm/utils.js\");\n// Basic utils for salsa-like ciphers\n// Check out _micro.ts for descriptive documentation.\n\n\n/*\nRFC8439 requires multi-step cipher stream, where\nauthKey starts with counter: 0, actual msg with counter: 1.\n\nFor this, we need a way to re-use nonce / counter:\n\n const counter = new Uint8Array(4);\n chacha(..., counter, ...); // counter is now 1\n chacha(..., counter, ...); // counter is now 2\n\nThis is complicated:\n\n- Original papers don't allow mutating counters\n- Counter overflow is undefined: https://mailarchive.ietf.org/arch/msg/cfrg/gsOnTJzcbgG6OqD8Sc0GO5aR_tU/\n- 3rd-party library stablelib implementation uses an approach where you can provide\n nonce and counter instead of just nonce - and it will re-use it\n- We could have did something similar, but ChaCha has different counter position\n (counter | nonce), which is not composable with XChaCha, because full counter\n is (nonce16 | counter | nonce16). Stablelib doesn't support in-place counter for XChaCha.\n- We could separate nonce & counter and provide separate API for counter re-use, but\n there are different counter sizes depending on an algorithm.\n- Salsa & ChaCha also differ in structures of key / sigma:\n\n salsa: c0 | k(4) | c1 | nonce(2) | ctr(2) | c2 | k(4) | c4\n chacha: c(4) | k(8) | ctr(1) | nonce(3)\n chachaDJB: c(4) | k(8) | ctr(2) | nonce(2)\n- Creating function such as `setSalsaState(key, nonce, sigma, data)` won't work,\n because we can't re-use counter array\n- 32-bit nonce is `2 ** 32 * 64` = 256GB with 32-bit counter\n- JS does not allow UintArrays bigger than 4GB, so supporting 64-bit counters doesn't matter\n\nStructure is as following:\n\nkey=16 -> sigma16, k=key|key\nkey=32 -> sigma32, k=key\n\nnonces:\nsalsa20: 8 (8-byte counter)\nchacha20djb: 8 (8-byte counter)\nchacha20tls: 12 (4-byte counter)\nxsalsa: 24 (16 -> hsalsa, 8 -> old nonce)\nxchacha: 24 (16 -> hchacha, 8 -> old nonce)\n\nhttps://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha#appendix-A.2\nUse the subkey and remaining 8 byte nonce with ChaCha20 as normal\n(prefixed by 4 NUL bytes, since [RFC8439] specifies a 12-byte nonce).\n*/\nconst sigma16 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('expand 16-byte k');\nconst sigma32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('expand 32-byte k');\nconst sigma16_32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(sigma16);\nconst sigma32_32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(sigma32);\n// Is byte array aligned to 4 byte offset (u32)?\nconst isAligned32 = (b) => !(b.byteOffset % 4);\nconst salsaBasic = (opts) => {\n const { core, rounds, counterRight, counterLen, allow128bitKeys, extendNonceFn, blockLen } = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.checkOpts)({ rounds: 20, counterRight: false, counterLen: 8, allow128bitKeys: true, blockLen: 64 }, opts);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].number(counterLen);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].number(rounds);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].number(blockLen);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bool(counterRight);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bool(allow128bitKeys);\n const blockLen32 = blockLen / 4;\n if (blockLen % 4 !== 0)\n throw new Error('Salsa/ChaCha: blockLen should be aligned to 4 bytes');\n return (key, nonce, data, output, counter = 0) => {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bytes(key);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bytes(nonce);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bytes(data);\n if (!output)\n output = new Uint8Array(data.length);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bytes(output);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].number(counter);\n // > new Uint32Array([2**32])\n // Uint32Array(1) [ 0 ]\n // > new Uint32Array([2**32-1])\n // Uint32Array(1) [ 4294967295 ]\n if (counter < 0 || counter >= 2 ** 32 - 1)\n throw new Error('Salsa/ChaCha: counter overflow');\n if (output.length < data.length) {\n throw new Error(`Salsa/ChaCha: output (${output.length}) is shorter than data (${data.length})`);\n }\n const toClean = [];\n let k, sigma;\n // Handle 128 byte keys\n if (key.length === 32) {\n k = key;\n sigma = sigma32_32;\n }\n else if (key.length === 16 && allow128bitKeys) {\n k = new Uint8Array(32);\n k.set(key);\n k.set(key, 16);\n sigma = sigma16_32;\n toClean.push(k);\n }\n else\n throw new Error(`Salsa/ChaCha: wrong key length=${key.length}, expected`);\n // Handle extended nonce (HChaCha/HSalsa)\n if (extendNonceFn) {\n if (nonce.length <= 16)\n throw new Error(`Salsa/ChaCha: extended nonce should be bigger than 16 bytes`);\n k = extendNonceFn(sigma, k, nonce.subarray(0, 16), new Uint8Array(32));\n toClean.push(k);\n nonce = nonce.subarray(16);\n }\n // Handle nonce counter\n const nonceLen = 16 - counterLen;\n if (nonce.length !== nonceLen)\n throw new Error(`Salsa/ChaCha: nonce should be ${nonceLen} or 16 bytes`);\n // Pad counter when nonce is 64 bit\n if (nonceLen !== 12) {\n const nc = new Uint8Array(12);\n nc.set(nonce, counterRight ? 0 : 12 - nonce.length);\n toClean.push((nonce = nc));\n }\n // Counter positions\n const block = new Uint8Array(blockLen);\n // Cast to Uint32Array for speed\n const b32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(block);\n const k32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(k);\n const n32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(nonce);\n // Make sure that buffers aligned to 4 bytes\n const d32 = isAligned32(data) && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(data);\n const o32 = isAligned32(output) && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(output);\n toClean.push(b32);\n const len = data.length;\n for (let pos = 0, ctr = counter; pos < len; ctr++) {\n core(sigma, k32, n32, b32, ctr, rounds);\n if (ctr >= 2 ** 32 - 1)\n throw new Error('Salsa/ChaCha: counter overflow');\n const take = Math.min(blockLen, len - pos);\n // full block && aligned to 4 bytes\n if (take === blockLen && o32 && d32) {\n const pos32 = pos / 4;\n if (pos % 4 !== 0)\n throw new Error('Salsa/ChaCha: wrong block position');\n for (let j = 0; j < blockLen32; j++)\n o32[pos32 + j] = d32[pos32 + j] ^ b32[j];\n pos += blockLen;\n continue;\n }\n for (let j = 0; j < take; j++)\n output[pos + j] = data[pos + j] ^ block[j];\n pos += take;\n }\n for (let i = 0; i < toClean.length; i++)\n toClean[i].fill(0);\n return output;\n };\n};\n//# sourceMappingURL=_salsa.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/ciphers/esm/_salsa.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/ciphers/esm/chacha.js": +/*!***************************************************!*\ + !*** ./node_modules/@noble/ciphers/esm/chacha.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _poly1305_aead: () => (/* binding */ _poly1305_aead),\n/* harmony export */ chacha12: () => (/* binding */ chacha12),\n/* harmony export */ chacha20: () => (/* binding */ chacha20),\n/* harmony export */ chacha20_poly1305: () => (/* binding */ chacha20_poly1305),\n/* harmony export */ chacha20orig: () => (/* binding */ chacha20orig),\n/* harmony export */ chacha8: () => (/* binding */ chacha8),\n/* harmony export */ hchacha: () => (/* binding */ hchacha),\n/* harmony export */ xchacha20: () => (/* binding */ xchacha20),\n/* harmony export */ xchacha20_poly1305: () => (/* binding */ xchacha20_poly1305)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/ciphers/esm/utils.js\");\n/* harmony import */ var _poly1305_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_poly1305.js */ \"./node_modules/@noble/ciphers/esm/_poly1305.js\");\n/* harmony import */ var _salsa_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_salsa.js */ \"./node_modules/@noble/ciphers/esm/_salsa.js\");\n\n\n\n// ChaCha20 stream cipher was released in 2008. ChaCha aims to increase\n// the diffusion per round, but had slightly less cryptanalysis.\n// https://cr.yp.to/chacha.html, http://cr.yp.to/chacha/chacha-20080128.pdf\n// Left rotate for uint32\nconst rotl = (a, b) => (a << b) | (a >>> (32 - b));\n/**\n * ChaCha core function.\n */\n// prettier-ignore\nfunction chachaCore(c, k, n, out, cnt, rounds = 20) {\n let y00 = c[0], y01 = c[1], y02 = c[2], y03 = c[3]; // \"expa\" \"nd 3\" \"2-by\" \"te k\"\n let y04 = k[0], y05 = k[1], y06 = k[2], y07 = k[3]; // Key Key Key Key\n let y08 = k[4], y09 = k[5], y10 = k[6], y11 = k[7]; // Key Key Key Key\n let y12 = cnt, y13 = n[0], y14 = n[1], y15 = n[2]; // Counter Counter\tNonce Nonce\n // Save state to temporary variables\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop\n for (let i = 0; i < rounds; i += 2) {\n x00 = (x00 + x04) | 0;\n x12 = rotl(x12 ^ x00, 16);\n x08 = (x08 + x12) | 0;\n x04 = rotl(x04 ^ x08, 12);\n x00 = (x00 + x04) | 0;\n x12 = rotl(x12 ^ x00, 8);\n x08 = (x08 + x12) | 0;\n x04 = rotl(x04 ^ x08, 7);\n x01 = (x01 + x05) | 0;\n x13 = rotl(x13 ^ x01, 16);\n x09 = (x09 + x13) | 0;\n x05 = rotl(x05 ^ x09, 12);\n x01 = (x01 + x05) | 0;\n x13 = rotl(x13 ^ x01, 8);\n x09 = (x09 + x13) | 0;\n x05 = rotl(x05 ^ x09, 7);\n x02 = (x02 + x06) | 0;\n x14 = rotl(x14 ^ x02, 16);\n x10 = (x10 + x14) | 0;\n x06 = rotl(x06 ^ x10, 12);\n x02 = (x02 + x06) | 0;\n x14 = rotl(x14 ^ x02, 8);\n x10 = (x10 + x14) | 0;\n x06 = rotl(x06 ^ x10, 7);\n x03 = (x03 + x07) | 0;\n x15 = rotl(x15 ^ x03, 16);\n x11 = (x11 + x15) | 0;\n x07 = rotl(x07 ^ x11, 12);\n x03 = (x03 + x07) | 0;\n x15 = rotl(x15 ^ x03, 8);\n x11 = (x11 + x15) | 0;\n x07 = rotl(x07 ^ x11, 7);\n x00 = (x00 + x05) | 0;\n x15 = rotl(x15 ^ x00, 16);\n x10 = (x10 + x15) | 0;\n x05 = rotl(x05 ^ x10, 12);\n x00 = (x00 + x05) | 0;\n x15 = rotl(x15 ^ x00, 8);\n x10 = (x10 + x15) | 0;\n x05 = rotl(x05 ^ x10, 7);\n x01 = (x01 + x06) | 0;\n x12 = rotl(x12 ^ x01, 16);\n x11 = (x11 + x12) | 0;\n x06 = rotl(x06 ^ x11, 12);\n x01 = (x01 + x06) | 0;\n x12 = rotl(x12 ^ x01, 8);\n x11 = (x11 + x12) | 0;\n x06 = rotl(x06 ^ x11, 7);\n x02 = (x02 + x07) | 0;\n x13 = rotl(x13 ^ x02, 16);\n x08 = (x08 + x13) | 0;\n x07 = rotl(x07 ^ x08, 12);\n x02 = (x02 + x07) | 0;\n x13 = rotl(x13 ^ x02, 8);\n x08 = (x08 + x13) | 0;\n x07 = rotl(x07 ^ x08, 7);\n x03 = (x03 + x04) | 0;\n x14 = rotl(x14 ^ x03, 16);\n x09 = (x09 + x14) | 0;\n x04 = rotl(x04 ^ x09, 12);\n x03 = (x03 + x04) | 0;\n x14 = rotl(x14 ^ x03, 8);\n x09 = (x09 + x14) | 0;\n x04 = rotl(x04 ^ x09, 7);\n }\n // Write output\n let oi = 0;\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\n/**\n * hchacha helper method, used primarily in xchacha, to hash\n * key and nonce into key' and nonce'.\n * Same as chachaCore, but there doesn't seem to be a way to move the block\n * out without 25% performance hit.\n */\n// prettier-ignore\nfunction hchacha(c, key, src, out) {\n const k32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(key);\n const i32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(src);\n const o32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(out);\n let x00 = c[0], x01 = c[1], x02 = c[2], x03 = c[3];\n let x04 = k32[0], x05 = k32[1], x06 = k32[2], x07 = k32[3];\n let x08 = k32[4], x09 = k32[5], x10 = k32[6], x11 = k32[7];\n let x12 = i32[0], x13 = i32[1], x14 = i32[2], x15 = i32[3];\n for (let i = 0; i < 20; i += 2) {\n x00 = (x00 + x04) | 0;\n x12 = rotl(x12 ^ x00, 16);\n x08 = (x08 + x12) | 0;\n x04 = rotl(x04 ^ x08, 12);\n x00 = (x00 + x04) | 0;\n x12 = rotl(x12 ^ x00, 8);\n x08 = (x08 + x12) | 0;\n x04 = rotl(x04 ^ x08, 7);\n x01 = (x01 + x05) | 0;\n x13 = rotl(x13 ^ x01, 16);\n x09 = (x09 + x13) | 0;\n x05 = rotl(x05 ^ x09, 12);\n x01 = (x01 + x05) | 0;\n x13 = rotl(x13 ^ x01, 8);\n x09 = (x09 + x13) | 0;\n x05 = rotl(x05 ^ x09, 7);\n x02 = (x02 + x06) | 0;\n x14 = rotl(x14 ^ x02, 16);\n x10 = (x10 + x14) | 0;\n x06 = rotl(x06 ^ x10, 12);\n x02 = (x02 + x06) | 0;\n x14 = rotl(x14 ^ x02, 8);\n x10 = (x10 + x14) | 0;\n x06 = rotl(x06 ^ x10, 7);\n x03 = (x03 + x07) | 0;\n x15 = rotl(x15 ^ x03, 16);\n x11 = (x11 + x15) | 0;\n x07 = rotl(x07 ^ x11, 12);\n x03 = (x03 + x07) | 0;\n x15 = rotl(x15 ^ x03, 8);\n x11 = (x11 + x15) | 0;\n x07 = rotl(x07 ^ x11, 7);\n x00 = (x00 + x05) | 0;\n x15 = rotl(x15 ^ x00, 16);\n x10 = (x10 + x15) | 0;\n x05 = rotl(x05 ^ x10, 12);\n x00 = (x00 + x05) | 0;\n x15 = rotl(x15 ^ x00, 8);\n x10 = (x10 + x15) | 0;\n x05 = rotl(x05 ^ x10, 7);\n x01 = (x01 + x06) | 0;\n x12 = rotl(x12 ^ x01, 16);\n x11 = (x11 + x12) | 0;\n x06 = rotl(x06 ^ x11, 12);\n x01 = (x01 + x06) | 0;\n x12 = rotl(x12 ^ x01, 8);\n x11 = (x11 + x12) | 0;\n x06 = rotl(x06 ^ x11, 7);\n x02 = (x02 + x07) | 0;\n x13 = rotl(x13 ^ x02, 16);\n x08 = (x08 + x13) | 0;\n x07 = rotl(x07 ^ x08, 12);\n x02 = (x02 + x07) | 0;\n x13 = rotl(x13 ^ x02, 8);\n x08 = (x08 + x13) | 0;\n x07 = rotl(x07 ^ x08, 7);\n x03 = (x03 + x04) | 0;\n x14 = rotl(x14 ^ x03, 16);\n x09 = (x09 + x14) | 0;\n x04 = rotl(x04 ^ x09, 12);\n x03 = (x03 + x04) | 0;\n x14 = rotl(x14 ^ x03, 8);\n x09 = (x09 + x14) | 0;\n x04 = rotl(x04 ^ x09, 7);\n }\n o32[0] = x00;\n o32[1] = x01;\n o32[2] = x02;\n o32[3] = x03;\n o32[4] = x12;\n o32[5] = x13;\n o32[6] = x14;\n o32[7] = x15;\n return out;\n}\n/**\n * Original, non-RFC chacha20 from DJB. 8-byte nonce, 8-byte counter.\n */\nconst chacha20orig = (0,_salsa_js__WEBPACK_IMPORTED_MODULE_2__.salsaBasic)({ core: chachaCore, counterRight: false, counterLen: 8 });\n/**\n * ChaCha stream cipher. Conforms to RFC 8439 (IETF, TLS). 12-byte nonce, 4-byte counter.\n * With 12-byte nonce, it's not safe to use fill it with random (CSPRNG), due to collision chance.\n */\nconst chacha20 = (0,_salsa_js__WEBPACK_IMPORTED_MODULE_2__.salsaBasic)({\n core: chachaCore,\n counterRight: false,\n counterLen: 4,\n allow128bitKeys: false,\n});\n/**\n * XChaCha eXtended-nonce ChaCha. 24-byte nonce.\n * With 24-byte nonce, it's safe to use fill it with random (CSPRNG).\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha\n */\nconst xchacha20 = (0,_salsa_js__WEBPACK_IMPORTED_MODULE_2__.salsaBasic)({\n core: chachaCore,\n counterRight: false,\n counterLen: 8,\n extendNonceFn: hchacha,\n allow128bitKeys: false,\n});\n/**\n * Reduced 8-round chacha, described in original paper.\n */\nconst chacha8 = (0,_salsa_js__WEBPACK_IMPORTED_MODULE_2__.salsaBasic)({\n core: chachaCore,\n counterRight: false,\n counterLen: 4,\n rounds: 8,\n});\n/**\n * Reduced 12-round chacha, described in original paper.\n */\nconst chacha12 = (0,_salsa_js__WEBPACK_IMPORTED_MODULE_2__.salsaBasic)({\n core: chachaCore,\n counterRight: false,\n counterLen: 4,\n rounds: 12,\n});\nconst ZERO = new Uint8Array(16);\n// Pad to digest size with zeros\nconst updatePadded = (h, msg) => {\n h.update(msg);\n const left = msg.length % 16;\n if (left)\n h.update(ZERO.subarray(left));\n};\nconst computeTag = (fn, key, nonce, data, AAD) => {\n const authKey = fn(key, nonce, new Uint8Array(32));\n const h = _poly1305_js__WEBPACK_IMPORTED_MODULE_1__.poly1305.create(authKey);\n if (AAD)\n updatePadded(h, AAD);\n updatePadded(h, data);\n const num = new Uint8Array(16);\n const view = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.createView)(num);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.setBigUint64)(view, 0, BigInt(AAD ? AAD.length : 0), true);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.setBigUint64)(view, 8, BigInt(data.length), true);\n h.update(num);\n const res = h.digest();\n authKey.fill(0);\n return res;\n};\n/**\n * AEAD algorithm from RFC 8439.\n * Salsa20 and chacha (RFC 8439) use poly1305 differently.\n * We could have composed them similar to:\n * https://github.com/paulmillr/scure-base/blob/b266c73dde977b1dd7ef40ef7a23cc15aab526b3/index.ts#L250\n * But it's hard because of authKey:\n * In salsa20, authKey changes position in salsa stream.\n * In chacha, authKey can't be computed inside computeTag, it modifies the counter.\n */\nconst _poly1305_aead = (fn) => (key, nonce, AAD) => {\n const tagLength = 16;\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(key, 32);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)(nonce);\n return {\n tagLength,\n encrypt: (plaintext) => {\n const res = new Uint8Array(plaintext.length + tagLength);\n fn(key, nonce, plaintext, res, 1);\n const tag = computeTag(fn, key, nonce, res.subarray(0, -tagLength), AAD);\n res.set(tag, plaintext.length); // append tag\n return res;\n },\n decrypt: (ciphertext) => {\n if (ciphertext.length < tagLength)\n throw new Error(`Encrypted data should be at least ${tagLength}`);\n const realTag = ciphertext.subarray(-tagLength);\n const data = ciphertext.subarray(0, -tagLength);\n const tag = computeTag(fn, key, nonce, data, AAD);\n if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.equalBytes)(realTag, tag))\n throw new Error('Wrong tag');\n return fn(key, nonce, data, undefined, 1);\n },\n };\n};\n/**\n * ChaCha20-Poly1305 from RFC 8439.\n * With 12-byte nonce, it's not safe to use fill it with random (CSPRNG), due to collision chance.\n */\nconst chacha20_poly1305 = _poly1305_aead(chacha20);\n/**\n * XChaCha20-Poly1305 extended-nonce chacha.\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha\n * With 24-byte nonce, it's safe to use fill it with random (CSPRNG).\n */\nconst xchacha20_poly1305 = _poly1305_aead(xchacha20);\n//# sourceMappingURL=chacha.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/ciphers/esm/chacha.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/ciphers/esm/utils.js": +/*!**************************************************!*\ + !*** ./node_modules/@noble/ciphers/esm/utils.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hash: () => (/* binding */ Hash),\n/* harmony export */ asyncLoop: () => (/* binding */ asyncLoop),\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8),\n/* harmony export */ checkOpts: () => (/* binding */ checkOpts),\n/* harmony export */ concatBytes: () => (/* binding */ concatBytes),\n/* harmony export */ createView: () => (/* binding */ createView),\n/* harmony export */ ensureBytes: () => (/* binding */ ensureBytes),\n/* harmony export */ equalBytes: () => (/* binding */ equalBytes),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ isLE: () => (/* binding */ isLE),\n/* harmony export */ nextTick: () => (/* binding */ nextTick),\n/* harmony export */ setBigUint64: () => (/* binding */ setBigUint64),\n/* harmony export */ toBytes: () => (/* binding */ toBytes),\n/* harmony export */ u16: () => (/* binding */ u16),\n/* harmony export */ u32: () => (/* binding */ u32),\n/* harmony export */ u8: () => (/* binding */ u8),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes)\n/* harmony export */ });\n/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nconst u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nconst u16 = (arr) => new Uint16Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 2));\nconst u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nconst createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// big-endian hardware is rare. Just in case someone still decides to run ciphers:\n// early-throw an error because we don't support BE yet.\nconst isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nconst nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nasync function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\nfunction bytesToUtf8(bytes) {\n return new TextDecoder().decode(bytes);\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nfunction toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// Check if object doens't have custom constructor (like Uint8Array/Array)\nconst isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;\nfunction checkOpts(defaults, opts) {\n if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nfunction ensureBytes(b, len) {\n if (!(b instanceof Uint8Array))\n throw new Error('Uint8Array expected');\n if (typeof len === 'number')\n if (b.length !== len)\n throw new Error(`Uint8Array length ${len} expected`);\n}\n// Constant-time equality\nfunction equalBytes(a, b) {\n // Should not happen\n if (a.length !== b.length)\n throw new Error('equalBytes: Different size of Uint8Arrays');\n let isSame = true;\n for (let i = 0; i < a.length; i++)\n isSame && (isSame = a[i] === b[i]); // Lets hope JIT won't optimize away.\n return isSame;\n}\n// For runtime check if class implements interface\nclass Hash {\n}\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/ciphers/esm/utils.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/abstract/curve.js": +/*!**********************************************************!*\ + !*** ./node_modules/@noble/curves/esm/abstract/curve.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ validateBasic: () => (/* binding */ validateBasic),\n/* harmony export */ wNAF: () => (/* binding */ wNAF)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\n\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nfunction wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const opts = (W) => {\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm, n) {\n let p = c.ZERO;\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm, W) {\n const { windows, windowSize } = opts(W);\n const points = [];\n let p = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n let p = c.ZERO;\n let f = c.BASE;\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n // Shift number by W bits.\n n >>= shiftBy;\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n wNAFCached(P, precomputesMap, n, transform) {\n // @ts-ignore\n const W = P._WINDOW_SIZE || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = precomputesMap.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W);\n if (W !== 1) {\n precomputesMap.set(P, transform(comp));\n }\n }\n return this.wNAF(W, comp, n);\n },\n };\n}\nfunction validateBasic(curve) {\n (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.validateField)(curve.Fp);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...(0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.nLength)(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\n//# sourceMappingURL=curve.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/abstract/curve.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/abstract/edwards.js": +/*!************************************************************!*\ + !*** ./node_modules/@noble/curves/esm/abstract/edwards.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ twistedEdwards: () => (/* binding */ twistedEdwards)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./curve.js */ \"./node_modules/@noble/curves/esm/abstract/curve.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y²\n\n\n\n\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8);\n// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex:\nconst VERIFY_DEFAULT = { zip215: true };\nfunction validateOpts(curve) {\n const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.validateBasic)(curve);\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject(curve, {\n hash: 'function',\n a: 'bigint',\n d: 'bigint',\n randomBytes: 'function',\n }, {\n adjustScalarBytes: 'function',\n domain: 'function',\n uvRatio: 'function',\n mapToCurve: 'function',\n });\n // Set defaults\n return Object.freeze({ ...opts });\n}\n// It is not generic twisted curve for now, but ed25519/ed448 generic implementation\nfunction twistedEdwards(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE;\n const MASK = _2n << (BigInt(nByteLength * 8) - _1n);\n const modP = Fp.create; // Function overrides\n // sqrt(u/v)\n const uvRatio = CURVE.uvRatio ||\n ((u, v) => {\n try {\n return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) };\n }\n catch (e) {\n return { isValid: false, value: _0n };\n }\n });\n const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); // NOOP\n const domain = CURVE.domain ||\n ((data, ctx, phflag) => {\n if (ctx.length || phflag)\n throw new Error('Contexts/pre-hash are not supported');\n return data;\n }); // NOOP\n const inBig = (n) => typeof n === 'bigint' && _0n < n; // n in [1..]\n const inRange = (n, max) => inBig(n) && inBig(max) && n < max; // n in [1..max-1]\n const in0MaskRange = (n) => n === _0n || inRange(n, MASK); // n in [0..MASK-1]\n function assertInRange(n, max) {\n // n in [1..max-1]\n if (inRange(n, max))\n return n;\n throw new Error(`Expected valid scalar < ${max}, got ${typeof n} ${n}`);\n }\n function assertGE0(n) {\n // n in [0..CURVE_ORDER-1]\n return n === _0n ? n : assertInRange(n, CURVE_ORDER); // GE = prime subgroup, not full group\n }\n const pointPrecomputes = new Map();\n function isPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ExtendedPoint expected');\n }\n // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy).\n // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates\n class Point {\n constructor(ex, ey, ez, et) {\n this.ex = ex;\n this.ey = ey;\n this.ez = ez;\n this.et = et;\n if (!in0MaskRange(ex))\n throw new Error('x required');\n if (!in0MaskRange(ey))\n throw new Error('y required');\n if (!in0MaskRange(ez))\n throw new Error('z required');\n if (!in0MaskRange(et))\n throw new Error('t required');\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n static fromAffine(p) {\n if (p instanceof Point)\n throw new Error('extended point not allowed');\n const { x, y } = p || {};\n if (!in0MaskRange(x) || !in0MaskRange(y))\n throw new Error('invalid affine point');\n return new Point(x, y, _1n, modP(x * y));\n }\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.ez));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n // Not required for fromHex(), which always creates valid points.\n // Could be useful for fromAffine().\n assertValidity() {\n const { a, d } = CURVE;\n if (this.is0())\n throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?\n // Equation in affine coordinates: ax² + y² = 1 + dx²y²\n // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y²\n const { ex: X, ey: Y, ez: Z, et: T } = this;\n const X2 = modP(X * X); // X²\n const Y2 = modP(Y * Y); // Y²\n const Z2 = modP(Z * Z); // Z²\n const Z4 = modP(Z2 * Z2); // Z⁴\n const aX2 = modP(X2 * a); // aX²\n const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z²\n const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y²\n if (left !== right)\n throw new Error('bad point: equation left != right (1)');\n // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T\n const XY = modP(X * Y);\n const ZT = modP(Z * T);\n if (XY !== ZT)\n throw new Error('bad point: equation left != right (2)');\n }\n // Compare one point to another.\n equals(other) {\n isPoint(other);\n const { ex: X1, ey: Y1, ez: Z1 } = this;\n const { ex: X2, ey: Y2, ez: Z2 } = other;\n const X1Z2 = modP(X1 * Z2);\n const X2Z1 = modP(X2 * Z1);\n const Y1Z2 = modP(Y1 * Z2);\n const Y2Z1 = modP(Y2 * Z1);\n return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n negate() {\n // Flips point sign to a negative one (-x, y in affine coords)\n return new Point(modP(-this.ex), this.ey, this.ez, modP(-this.et));\n }\n // Fast algo for doubling Extended Point.\n // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd\n // Cost: 4M + 4S + 1*a + 6add + 1*2.\n double() {\n const { a } = CURVE;\n const { ex: X1, ey: Y1, ez: Z1 } = this;\n const A = modP(X1 * X1); // A = X12\n const B = modP(Y1 * Y1); // B = Y12\n const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12\n const D = modP(a * A); // D = a*A\n const x1y1 = X1 + Y1;\n const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B\n const G = D + B; // G = D+B\n const F = G - C; // F = G-C\n const H = D - B; // H = D-B\n const X3 = modP(E * F); // X3 = E*F\n const Y3 = modP(G * H); // Y3 = G*H\n const T3 = modP(E * H); // T3 = E*H\n const Z3 = modP(F * G); // Z3 = F*G\n return new Point(X3, Y3, Z3, T3);\n }\n // Fast algo for adding 2 Extended Points.\n // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd\n // Cost: 9M + 1*a + 1*d + 7add.\n add(other) {\n isPoint(other);\n const { a, d } = CURVE;\n const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this;\n const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other;\n // Faster algo for adding 2 Extended Points when curve's a=-1.\n // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-4\n // Cost: 8M + 8add + 2*2.\n // Note: It does not check whether the `other` point is valid.\n if (a === BigInt(-1)) {\n const A = modP((Y1 - X1) * (Y2 + X2));\n const B = modP((Y1 + X1) * (Y2 - X2));\n const F = modP(B - A);\n if (F === _0n)\n return this.double(); // Same point. Tests say it doesn't affect timing\n const C = modP(Z1 * _2n * T2);\n const D = modP(T1 * _2n * Z2);\n const E = D + C;\n const G = B + A;\n const H = D - C;\n const X3 = modP(E * F);\n const Y3 = modP(G * H);\n const T3 = modP(E * H);\n const Z3 = modP(F * G);\n return new Point(X3, Y3, Z3, T3);\n }\n const A = modP(X1 * X2); // A = X1*X2\n const B = modP(Y1 * Y2); // B = Y1*Y2\n const C = modP(T1 * d * T2); // C = T1*d*T2\n const D = modP(Z1 * Z2); // D = Z1*Z2\n const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B\n const F = D - C; // F = D-C\n const G = D + C; // G = D+C\n const H = modP(B - a * A); // H = B-a*A\n const X3 = modP(E * F); // X3 = E*F\n const Y3 = modP(G * H); // Y3 = G*H\n const T3 = modP(E * H); // T3 = E*H\n const Z3 = modP(F * G); // Z3 = F*G\n return new Point(X3, Y3, Z3, T3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, pointPrecomputes, n, Point.normalizeZ);\n }\n // Constant-time multiplication.\n multiply(scalar) {\n const { p, f } = this.wNAF(assertInRange(scalar, CURVE_ORDER));\n return Point.normalizeZ([p, f])[0];\n }\n // Non-constant-time multiplication. Uses double-and-add algorithm.\n // It's faster, but should only be used when you don't care about\n // an exposed private key e.g. sig verification.\n // Does NOT allow scalars higher than CURVE.n.\n multiplyUnsafe(scalar) {\n let n = assertGE0(scalar); // 0 <= scalar < CURVE.n\n if (n === _0n)\n return I;\n if (this.equals(I) || n === _1n)\n return this;\n if (this.equals(G))\n return this.wNAF(n).p;\n return wnaf.unsafeLadder(this, n);\n }\n // Checks if point is of small order.\n // If you add something to small order point, you will have \"dirty\"\n // point with torsion component.\n // Multiplies point by cofactor and checks if the result is 0.\n isSmallOrder() {\n return this.multiplyUnsafe(cofactor).is0();\n }\n // Multiplies point by curve order and checks if the result is 0.\n // Returns `false` is the point is dirty.\n isTorsionFree() {\n return wnaf.unsafeLadder(this, CURVE_ORDER).is0();\n }\n // Converts Extended point to default (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n toAffine(iz) {\n const { ex: x, ey: y, ez: z } = this;\n const is0 = this.is0();\n if (iz == null)\n iz = is0 ? _8n : Fp.inv(z); // 8 was chosen arbitrarily\n const ax = modP(x * iz);\n const ay = modP(y * iz);\n const zz = modP(z * iz);\n if (is0)\n return { x: _0n, y: _1n };\n if (zz !== _1n)\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n clearCofactor() {\n const { h: cofactor } = CURVE;\n if (cofactor === _1n)\n return this;\n return this.multiplyUnsafe(cofactor);\n }\n // Converts hash string or Uint8Array to Point.\n // Uses algo from RFC8032 5.1.3.\n static fromHex(hex, zip215 = false) {\n const { d, a } = CURVE;\n const len = Fp.BYTES;\n hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('pointHex', hex, len); // copy hex to a new array\n const normed = hex.slice(); // copy again, we'll manipulate it\n const lastByte = hex[len - 1]; // select last byte\n normed[len - 1] = lastByte & ~0x80; // clear last bit\n const y = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE(normed);\n if (y === _0n) {\n // y=0 is allowed\n }\n else {\n // RFC8032 prohibits >= p, but ZIP215 doesn't\n if (zip215)\n assertInRange(y, MASK); // zip215=true [1..P-1] (2^255-19-1 for ed25519)\n else\n assertInRange(y, Fp.ORDER); // zip215=false [1..MASK-1] (2^256-1 for ed25519)\n }\n // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case:\n // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a)\n const y2 = modP(y * y); // denominator is always non-0 mod p.\n const u = modP(y2 - _1n); // u = y² - 1\n const v = modP(d * y2 - a); // v = d y² + 1.\n let { isValid, value: x } = uvRatio(u, v); // √(u/v)\n if (!isValid)\n throw new Error('Point.fromHex: invalid y coordinate');\n const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper\n const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit\n if (!zip215 && x === _0n && isLastByteOdd)\n // if x=0 and x_0 = 1, fail\n throw new Error('Point.fromHex: x=0 and x_0=1');\n if (isLastByteOdd !== isXOdd)\n x = modP(-x); // if x_0 != x mod 2, set x = p-x\n return Point.fromAffine({ x, y });\n }\n static fromPrivateKey(privKey) {\n return getExtendedPublicKey(privKey).point;\n }\n toRawBytes() {\n const { x, y } = this.toAffine();\n const bytes = _utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE(y, Fp.BYTES); // each y has 2 x values (x, -y)\n bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; // when compressing, it's enough to store y\n return bytes; // and use the last byte to encode sign of x\n }\n toHex() {\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex(this.toRawBytes()); // Same as toRawBytes, but returns string.\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy));\n Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0\n const { BASE: G, ZERO: I } = Point;\n const wnaf = (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.wNAF)(Point, nByteLength * 8);\n function modN(a) {\n return (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(a, CURVE_ORDER);\n }\n // Little-endian SHA512 with modulo n\n function modN_LE(hash) {\n return modN(_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE(hash));\n }\n /** Convenience method that creates public key and other stuff. RFC8032 5.1.5 */\n function getExtendedPublicKey(key) {\n const len = nByteLength;\n key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('private key', key, len);\n // Hash private key with curve's hash function to produce uniformingly random input\n // Check byte lengths: ensure(64, h(ensure(32, key)))\n const hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('hashed private key', cHash(key), 2 * len);\n const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE\n const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6)\n const scalar = modN_LE(head); // The actual private scalar\n const point = G.multiply(scalar); // Point on Edwards curve aka public key\n const pointBytes = point.toRawBytes(); // Uint8Array representation\n return { head, prefix, scalar, point, pointBytes };\n }\n // Calculates EdDSA pub key. RFC8032 5.1.5. Privkey is hashed. Use first half with 3 bits cleared\n function getPublicKey(privKey) {\n return getExtendedPublicKey(privKey).pointBytes;\n }\n // int('LE', SHA512(dom2(F, C) || msgs)) mod N\n function hashDomainToScalar(context = new Uint8Array(), ...msgs) {\n const msg = _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes(...msgs);\n return modN_LE(cHash(domain(msg, (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('context', context), !!prehash)));\n }\n /** Signs message with privateKey. RFC8032 5.1.6 */\n function sign(msg, privKey, options = {}) {\n msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('message', msg);\n if (prehash)\n msg = prehash(msg); // for ed25519ph etc.\n const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey);\n const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M)\n const R = G.multiply(r).toRawBytes(); // R = rG\n const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M)\n const s = modN(r + k * scalar); // S = (r + k * s) mod L\n assertGE0(s); // 0 <= s < l\n const res = _utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes(R, _utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE(s, Fp.BYTES));\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('result', res, nByteLength * 2); // 64-byte signature\n }\n const verifyOpts = VERIFY_DEFAULT;\n function verify(sig, msg, publicKey, options = verifyOpts) {\n const { context, zip215 } = options;\n const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7.\n sig = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('signature', sig, 2 * len); // An extended group equation is checked.\n msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('message', msg);\n if (prehash)\n msg = prehash(msg); // for ed25519ph, etc\n const s = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE(sig.slice(len, 2 * len));\n // zip215: true is good for consensus-critical apps and allows points < 2^256\n // zip215: false follows RFC8032 / NIST186-5 and restricts points to CURVE.p\n let A, R, SB;\n try {\n A = Point.fromHex(publicKey, zip215);\n R = Point.fromHex(sig.slice(0, len), zip215);\n SB = G.multiplyUnsafe(s); // 0 <= s < l is done inside\n }\n catch (error) {\n return false;\n }\n if (!zip215 && A.isSmallOrder())\n return false;\n const k = hashDomainToScalar(context, R.toRawBytes(), A.toRawBytes(), msg);\n const RkA = R.add(A.multiplyUnsafe(k));\n // [8][S]B = [8]R + [8][k]A'\n return RkA.subtract(SB).clearCofactor().equals(Point.ZERO);\n }\n G._setWindowSize(8); // Enable precomputes. Slows down first publicKey computation by 20ms.\n const utils = {\n getExtendedPublicKey,\n // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1.\n randomPrivateKey: () => randomBytes(Fp.BYTES),\n /**\n * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT\n * values. This slows down first getPublicKey() by milliseconds (see Speed section),\n * but allows to speed-up subsequent getPublicKey() calls up to 20x.\n * @param windowSize 2, 4, 8, 16\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3));\n return point;\n },\n };\n return {\n CURVE,\n getPublicKey,\n sign,\n verify,\n ExtendedPoint: Point,\n utils,\n };\n}\n//# sourceMappingURL=edwards.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/abstract/edwards.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/abstract/hash-to-curve.js": +/*!******************************************************************!*\ + !*** ./node_modules/@noble/curves/esm/abstract/hash-to-curve.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createHasher: () => (/* binding */ createHasher),\n/* harmony export */ expand_message_xmd: () => (/* binding */ expand_message_xmd),\n/* harmony export */ expand_message_xof: () => (/* binding */ expand_message_xof),\n/* harmony export */ hash_to_field: () => (/* binding */ hash_to_field),\n/* harmony export */ isogenyMap: () => (/* binding */ isogenyMap)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n\n\nfunction validateDST(dst) {\n if (dst instanceof Uint8Array)\n return dst;\n if (typeof dst === 'string')\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(dst);\n throw new Error('DST must be Uint8Array or string');\n}\n// Octet Stream to Integer. \"spec\" implementation of os2ip is 2.5x slower vs bytesToNumberBE.\nconst os2ip = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE;\n// Integer to Octet Stream (numberToBytesBE)\nfunction i2osp(value, length) {\n if (value < 0 || value >= 1 << (8 * length)) {\n throw new Error(`bad I2OSP call: value=${value} length=${length}`);\n }\n const res = Array.from({ length }).fill(0);\n for (let i = length - 1; i >= 0; i--) {\n res[i] = value & 0xff;\n value >>>= 8;\n }\n return new Uint8Array(res);\n}\nfunction strxor(a, b) {\n const arr = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n arr[i] = a[i] ^ b[i];\n }\n return arr;\n}\nfunction isBytes(item) {\n if (!(item instanceof Uint8Array))\n throw new Error('Uint8Array expected');\n}\nfunction isNum(item) {\n if (!Number.isSafeInteger(item))\n throw new Error('number expected');\n}\n// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits\n// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-11#section-5.4.1\nfunction expand_message_xmd(msg, DST, lenInBytes, H) {\n isBytes(msg);\n isBytes(DST);\n isNum(lenInBytes);\n // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-5.3.3\n if (DST.length > 255)\n DST = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST));\n const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;\n const ell = Math.ceil(lenInBytes / b_in_bytes);\n if (ell > 255)\n throw new Error('Invalid xmd length');\n const DST_prime = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(DST, i2osp(DST.length, 1));\n const Z_pad = i2osp(0, r_in_bytes);\n const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str\n const b = new Array(ell);\n const b_0 = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));\n b[0] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(b_0, i2osp(1, 1), DST_prime));\n for (let i = 1; i <= ell; i++) {\n const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];\n b[i] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...args));\n }\n const pseudo_random_bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...b);\n return pseudo_random_bytes.slice(0, lenInBytes);\n}\nfunction expand_message_xof(msg, DST, lenInBytes, k, H) {\n isBytes(msg);\n isBytes(DST);\n isNum(lenInBytes);\n // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-5.3.3\n // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8));\n if (DST.length > 255) {\n const dkLen = Math.ceil((2 * k) / 8);\n DST = H.create({ dkLen }).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest();\n }\n if (lenInBytes > 65535 || DST.length > 255)\n throw new Error('expand_message_xof: invalid lenInBytes');\n return (H.create({ dkLen: lenInBytes })\n .update(msg)\n .update(i2osp(lenInBytes, 2))\n // 2. DST_prime = DST || I2OSP(len(DST), 1)\n .update(DST)\n .update(i2osp(DST.length, 1))\n .digest());\n}\n/**\n * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-11#section-5.3\n * @param msg a byte string containing the message to hash\n * @param count the number of elements of F to output\n * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above\n * @returns [u_0, ..., u_(count - 1)], a list of field elements.\n */\nfunction hash_to_field(msg, count, options) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(options, {\n DST: 'string',\n p: 'bigint',\n m: 'isSafeInteger',\n k: 'isSafeInteger',\n hash: 'hash',\n });\n const { p, k, m, hash, expand, DST: _DST } = options;\n isBytes(msg);\n isNum(count);\n const DST = validateDST(_DST);\n const log2p = p.toString(2).length;\n const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above\n const len_in_bytes = count * m * L;\n let prb; // pseudo_random_bytes\n if (expand === 'xmd') {\n prb = expand_message_xmd(msg, DST, len_in_bytes, hash);\n }\n else if (expand === 'xof') {\n prb = expand_message_xof(msg, DST, len_in_bytes, k, hash);\n }\n else if (expand === '_internal_pass') {\n // for internal tests only\n prb = msg;\n }\n else {\n throw new Error('expand must be \"xmd\" or \"xof\"');\n }\n const u = new Array(count);\n for (let i = 0; i < count; i++) {\n const e = new Array(m);\n for (let j = 0; j < m; j++) {\n const elm_offset = L * (j + i * m);\n const tv = prb.subarray(elm_offset, elm_offset + L);\n e[j] = (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(os2ip(tv), p);\n }\n u[i] = e;\n }\n return u;\n}\nfunction isogenyMap(field, map) {\n // Make same order as in spec\n const COEFF = map.map((i) => Array.from(i).reverse());\n return (x, y) => {\n const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));\n x = field.div(xNum, xDen); // xNum / xDen\n y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev)\n return { x, y };\n };\n}\nfunction createHasher(Point, mapToCurve, def) {\n if (typeof mapToCurve !== 'function')\n throw new Error('mapToCurve() must be defined');\n return {\n // Encodes byte string to elliptic curve\n // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-3\n hashToCurve(msg, options) {\n const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options });\n const u0 = Point.fromAffine(mapToCurve(u[0]));\n const u1 = Point.fromAffine(mapToCurve(u[1]));\n const P = u0.add(u1).clearCofactor();\n P.assertValidity();\n return P;\n },\n // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-3\n encodeToCurve(msg, options) {\n const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options });\n const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor();\n P.assertValidity();\n return P;\n },\n };\n}\n//# sourceMappingURL=hash-to-curve.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/abstract/hash-to-curve.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/abstract/modular.js": +/*!************************************************************!*\ + !*** ./node_modules/@noble/curves/esm/abstract/modular.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Field: () => (/* binding */ Field),\n/* harmony export */ FpDiv: () => (/* binding */ FpDiv),\n/* harmony export */ FpInvertBatch: () => (/* binding */ FpInvertBatch),\n/* harmony export */ FpIsSquare: () => (/* binding */ FpIsSquare),\n/* harmony export */ FpPow: () => (/* binding */ FpPow),\n/* harmony export */ FpSqrt: () => (/* binding */ FpSqrt),\n/* harmony export */ FpSqrtEven: () => (/* binding */ FpSqrtEven),\n/* harmony export */ FpSqrtOdd: () => (/* binding */ FpSqrtOdd),\n/* harmony export */ hashToPrivateScalar: () => (/* binding */ hashToPrivateScalar),\n/* harmony export */ invert: () => (/* binding */ invert),\n/* harmony export */ isNegativeLE: () => (/* binding */ isNegativeLE),\n/* harmony export */ mod: () => (/* binding */ mod),\n/* harmony export */ nLength: () => (/* binding */ nLength),\n/* harmony export */ pow: () => (/* binding */ pow),\n/* harmony export */ pow2: () => (/* binding */ pow2),\n/* harmony export */ tonelliShanks: () => (/* binding */ tonelliShanks),\n/* harmony export */ validateField: () => (/* binding */ validateField)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\n\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n// Calculates a modulo b\nfunction mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nfunction pow(num, power, modulo) {\n if (modulo <= _0n || power < _0n)\n throw new Error('Expected power/modulo > 0');\n if (modulo === _1n)\n return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n)\n res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nfunction pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n// Inverses number over modulo\nfunction invert(number, modulo) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\n// Tonelli-Shanks algorithm\n// Paper 1: https://eprint.iacr.org/2012/685.pdf (page 12)\n// Paper 2: Square Roots from 1; 24, 51, 10 to Dan Shanks\nfunction tonelliShanks(P) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n let Q, S, Z;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++)\n ;\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++)\n ;\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp, n) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))\n throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO))\n return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE))\n break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\nfunction FpSqrt(P) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp, n) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp, n) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nconst isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nfunction validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.validateObject)(field, opts);\n}\n// Generic field functions\nfunction FpPow(f, num, power) {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n)\n throw new Error('Expected power > 0');\n if (power === _0n)\n return f.ONE;\n if (power === _1n)\n return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n// 0 is non-invertible: non-batched version will throw on 0\nfunction FpInvertBatch(f, nums) {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\nfunction FpDiv(f, lhs, rhs) {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\n// This function returns True whenever the value x is a square in the field F.\nfunction FpIsSquare(f) {\n const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic\n return (x) => {\n const p = f.pow(x, legendreConst);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\n// CURVE.n lengths\nfunction nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Initializes a galois field over prime. Non-primes are not supported for now.\n * Do not init in loop: slow. Very fragile: always run a benchmark on change.\n * Major performance gains:\n * a) non-normalized operations like mulN instead of mul\n * b) `Object.freeze`\n * c) Same object shape: never add or remove keys\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nfunction Field(ORDER, bitLen, isLE = false, redef = {}) {\n if (ORDER <= _0n)\n throw new Error(`Expected Fp ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048)\n throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitMask)(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(num, BYTES) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesBE)(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(bytes) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(bytes);\n },\n });\n return Object.freeze(f);\n}\nfunction FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nfunction FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * FIPS 186 B.4.1-compliant \"constant-time\" private key generation utility.\n * Can take (n+8) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 40 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. curveFn.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nfunction hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(hash) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n//# sourceMappingURL=modular.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/abstract/modular.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/abstract/montgomery.js": +/*!***************************************************************!*\ + !*** ./node_modules/@noble/curves/esm/abstract/montgomery.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ montgomery: () => (/* binding */ montgomery)\n/* harmony export */ });\n/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nfunction validateOpts(curve) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(curve, {\n a: 'bigint',\n }, {\n montgomeryBits: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n adjustScalarBytes: 'function',\n domain: 'function',\n powPminus2: 'function',\n Gu: 'bigint',\n });\n // Set defaults\n return Object.freeze({ ...curve });\n}\n// NOTE: not really montgomery curve, just bunch of very specific methods for X25519/X448 (RFC 7748, https://www.rfc-editor.org/rfc/rfc7748)\n// Uses only one coordinate instead of two\nfunction montgomery(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { P } = CURVE;\n const modP = (n) => (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(n, P);\n const montgomeryBits = CURVE.montgomeryBits;\n const montgomeryBytes = Math.ceil(montgomeryBits / 8);\n const fieldLen = CURVE.nByteLength;\n const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);\n const powPminus2 = CURVE.powPminus2 || ((x) => (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.pow)(x, P - BigInt(2), P));\n // cswap from RFC7748. But it is not from RFC7748!\n /*\n cswap(swap, x_2, x_3):\n dummy = mask(swap) AND (x_2 XOR x_3)\n x_2 = x_2 XOR dummy\n x_3 = x_3 XOR dummy\n Return (x_2, x_3)\n Where mask(swap) is the all-1 or all-0 word of the same length as x_2\n and x_3, computed, e.g., as mask(swap) = 0 - swap.\n */\n function cswap(swap, x_2, x_3) {\n const dummy = modP(swap * (x_2 - x_3));\n x_2 = modP(x_2 - dummy);\n x_3 = modP(x_3 + dummy);\n return [x_2, x_3];\n }\n // Accepts 0 as well\n function assertFieldElement(n) {\n if (typeof n === 'bigint' && _0n <= n && n < P)\n return n;\n throw new Error('Expected valid scalar 0 < scalar < CURVE.P');\n }\n // x25519 from 4\n // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519\n const a24 = (CURVE.a - BigInt(2)) / BigInt(4);\n /**\n *\n * @param pointU u coordinate (x) on Montgomery Curve 25519\n * @param scalar by which the point would be multiplied\n * @returns new Point on Montgomery curve\n */\n function montgomeryLadder(pointU, scalar) {\n const u = assertFieldElement(pointU);\n // Section 5: Implementations MUST accept non-canonical values and process them as\n // if they had been reduced modulo the field prime.\n const k = assertFieldElement(scalar);\n const x_1 = u;\n let x_2 = _1n;\n let z_2 = _0n;\n let x_3 = u;\n let z_3 = _1n;\n let swap = _0n;\n let sw;\n for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) {\n const k_t = (k >> t) & _1n;\n swap ^= k_t;\n sw = cswap(swap, x_2, x_3);\n x_2 = sw[0];\n x_3 = sw[1];\n sw = cswap(swap, z_2, z_3);\n z_2 = sw[0];\n z_3 = sw[1];\n swap = k_t;\n const A = x_2 + z_2;\n const AA = modP(A * A);\n const B = x_2 - z_2;\n const BB = modP(B * B);\n const E = AA - BB;\n const C = x_3 + z_3;\n const D = x_3 - z_3;\n const DA = modP(D * A);\n const CB = modP(C * B);\n const dacb = DA + CB;\n const da_cb = DA - CB;\n x_3 = modP(dacb * dacb);\n z_3 = modP(x_1 * modP(da_cb * da_cb));\n x_2 = modP(AA * BB);\n z_2 = modP(E * (AA + modP(a24 * E)));\n }\n // (x_2, x_3) = cswap(swap, x_2, x_3)\n sw = cswap(swap, x_2, x_3);\n x_2 = sw[0];\n x_3 = sw[1];\n // (z_2, z_3) = cswap(swap, z_2, z_3)\n sw = cswap(swap, z_2, z_3);\n z_2 = sw[0];\n z_3 = sw[1];\n // z_2^(p - 2)\n const z2 = powPminus2(z_2);\n // Return x_2 * (z_2^(p - 2))\n return modP(x_2 * z2);\n }\n function encodeUCoordinate(u) {\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE)(modP(u), montgomeryBytes);\n }\n function decodeUCoordinate(uEnc) {\n // Section 5: When receiving such an array, implementations of X25519\n // MUST mask the most significant bit in the final byte.\n // This is very ugly way, but it works because fieldLen-1 is outside of bounds for X448, so this becomes NOOP\n // fieldLen - scalaryBytes = 1 for X448 and = 0 for X25519\n const u = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('u coordinate', uEnc, montgomeryBytes);\n // u[fieldLen-1] crashes QuickJS (TypeError: out-of-bound numeric index)\n if (fieldLen === montgomeryBytes)\n u[fieldLen - 1] &= 127; // 0b0111_1111\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE)(u);\n }\n function decodeScalar(n) {\n const bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('scalar', n);\n if (bytes.length !== montgomeryBytes && bytes.length !== fieldLen)\n throw new Error(`Expected ${montgomeryBytes} or ${fieldLen} bytes, got ${bytes.length}`);\n return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE)(adjustScalarBytes(bytes));\n }\n function scalarMult(scalar, u) {\n const pointU = decodeUCoordinate(u);\n const _scalar = decodeScalar(scalar);\n const pu = montgomeryLadder(pointU, _scalar);\n // The result was not contributory\n // https://cr.yp.to/ecdh.html#validate\n if (pu === _0n)\n throw new Error('Invalid private or public key received');\n return encodeUCoordinate(pu);\n }\n // Computes public key from private. By doing scalar multiplication of base point.\n const GuBytes = encodeUCoordinate(CURVE.Gu);\n function scalarMultBase(scalar) {\n return scalarMult(scalar, GuBytes);\n }\n return {\n scalarMult,\n scalarMultBase,\n getSharedSecret: (privateKey, publicKey) => scalarMult(privateKey, publicKey),\n getPublicKey: (privateKey) => scalarMultBase(privateKey),\n utils: { randomPrivateKey: () => CURVE.randomBytes(CURVE.nByteLength) },\n GuBytes: GuBytes,\n };\n}\n//# sourceMappingURL=montgomery.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/abstract/montgomery.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/abstract/utils.js": +/*!**********************************************************!*\ + !*** ./node_modules/@noble/curves/esm/abstract/utils.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bitGet: () => (/* binding */ bitGet),\n/* harmony export */ bitLen: () => (/* binding */ bitLen),\n/* harmony export */ bitMask: () => (/* binding */ bitMask),\n/* harmony export */ bitSet: () => (/* binding */ bitSet),\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToNumberBE: () => (/* binding */ bytesToNumberBE),\n/* harmony export */ bytesToNumberLE: () => (/* binding */ bytesToNumberLE),\n/* harmony export */ concatBytes: () => (/* binding */ concatBytes),\n/* harmony export */ createHmacDrbg: () => (/* binding */ createHmacDrbg),\n/* harmony export */ ensureBytes: () => (/* binding */ ensureBytes),\n/* harmony export */ equalBytes: () => (/* binding */ equalBytes),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ hexToNumber: () => (/* binding */ hexToNumber),\n/* harmony export */ numberToBytesBE: () => (/* binding */ numberToBytesBE),\n/* harmony export */ numberToBytesLE: () => (/* binding */ numberToBytesLE),\n/* harmony export */ numberToHexUnpadded: () => (/* binding */ numberToHexUnpadded),\n/* harmony export */ numberToVarBytesBE: () => (/* binding */ numberToVarBytesBE),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes),\n/* harmony export */ validateObject: () => (/* binding */ validateObject)\n/* harmony export */ });\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst u8a = (a) => a instanceof Uint8Array;\nconst hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nfunction numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nfunction hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// BE: Big Endian, LE: Little Endian\nfunction bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nfunction bytesToNumberLE(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\nfunction numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nfunction numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nfunction numberToVarBytesBE(n) {\n return hexToBytes(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nfunction ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n }\n catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n }\n else if (u8a(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\nfunction equalBytes(b1, b2) {\n // We don't care about timing attacks here\n if (b1.length !== b2.length)\n return false;\n for (let i = 0; i < b1.length; i++)\n if (b1[i] !== b2[i])\n return false;\n return true;\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nfunction bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nfunction bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nconst bitSet = (n, pos, value) => {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n};\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nconst bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;\n// DRBG\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr) => Uint8Array.from(arr); // another shortcut\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nfunction createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record = { [P in K]: T; }\nfunction validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/abstract/utils.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/curves/esm/ed25519.js": +/*!***************************************************!*\ + !*** ./node_modules/@noble/curves/esm/ed25519.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ED25519_TORSION_SUBGROUP: () => (/* binding */ ED25519_TORSION_SUBGROUP),\n/* harmony export */ RistrettoPoint: () => (/* binding */ RistrettoPoint),\n/* harmony export */ ed25519: () => (/* binding */ ed25519),\n/* harmony export */ ed25519ctx: () => (/* binding */ ed25519ctx),\n/* harmony export */ ed25519ph: () => (/* binding */ ed25519ph),\n/* harmony export */ edwardsToMontgomery: () => (/* binding */ edwardsToMontgomery),\n/* harmony export */ edwardsToMontgomeryPriv: () => (/* binding */ edwardsToMontgomeryPriv),\n/* harmony export */ edwardsToMontgomeryPub: () => (/* binding */ edwardsToMontgomeryPub),\n/* harmony export */ encodeToCurve: () => (/* binding */ encodeToCurve),\n/* harmony export */ hashToCurve: () => (/* binding */ hashToCurve),\n/* harmony export */ hash_to_ristretto255: () => (/* binding */ hash_to_ristretto255),\n/* harmony export */ x25519: () => (/* binding */ x25519)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha512 */ \"./node_modules/@noble/hashes/esm/sha512.js\");\n/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/@noble/hashes/esm/utils.js\");\n/* harmony import */ var _abstract_edwards_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract/edwards.js */ \"./node_modules/@noble/curves/esm/abstract/edwards.js\");\n/* harmony import */ var _abstract_montgomery_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/montgomery.js */ \"./node_modules/@noble/curves/esm/abstract/montgomery.js\");\n/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./abstract/modular.js */ \"./node_modules/@noble/curves/esm/abstract/modular.js\");\n/* harmony import */ var _abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abstract/utils.js */ \"./node_modules/@noble/curves/esm/abstract/utils.js\");\n/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abstract/hash-to-curve.js */ \"./node_modules/@noble/curves/esm/abstract/hash-to-curve.js\");\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n\n\n\n\n\n\n/**\n * ed25519 Twisted Edwards curve with following addons:\n * - X25519 ECDH\n * - Ristretto cofactor elimination\n * - Elligator hash-to-group / point indistinguishability\n */\nconst ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949');\n// √(-1) aka √(a) aka 2^((p-1)/4)\nconst ED25519_SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _5n = BigInt(5);\n// prettier-ignore\nconst _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);\nfunction ed25519_pow_2_252_3(x) {\n const P = ED25519_P;\n const x2 = (x * x) % P;\n const b2 = (x2 * x) % P; // x^3, 11\n const b4 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b2, _2n, P) * b2) % P; // x^15, 1111\n const b5 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b4, _1n, P) * x) % P; // x^31\n const b10 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b5, _5n, P) * b5) % P;\n const b20 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b10, _10n, P) * b10) % P;\n const b40 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b20, _20n, P) * b20) % P;\n const b80 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b40, _40n, P) * b40) % P;\n const b160 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b80, _80n, P) * b80) % P;\n const b240 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b160, _80n, P) * b80) % P;\n const b250 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b240, _10n, P) * b10) % P;\n const pow_p_5_8 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b250, _2n, P) * x) % P;\n // ^ To pow to (p+3)/8, multiply it by x.\n return { pow_p_5_8, b2 };\n}\nfunction adjustScalarBytes(bytes) {\n // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar,\n // set the three least significant bits of the first byte\n bytes[0] &= 248; // 0b1111_1000\n // and the most significant bit of the last to zero,\n bytes[31] &= 127; // 0b0111_1111\n // set the second most significant bit of the last byte to 1\n bytes[31] |= 64; // 0b0100_0000\n return bytes;\n}\n// sqrt(u/v)\nfunction uvRatio(u, v) {\n const P = ED25519_P;\n const v3 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(v * v * v, P); // v³\n const v7 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(v3 * v3 * v, P); // v⁷\n // (p+3)/8 and (p-5)/8\n const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8;\n let x = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8\n const vx2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(v * x * x, P); // vx²\n const root1 = x; // First root candidate\n const root2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(x * ED25519_SQRT_M1, P); // Second root candidate\n const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root\n const useRoot2 = vx2 === (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4)\n const noRoot = vx2 === (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1)\n if (useRoot1)\n x = root1;\n if (useRoot2 || noRoot)\n x = root2; // We return root2 anyway, for const-time\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(x, P))\n x = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)(-x, P);\n return { isValid: useRoot1 || useRoot2, value: x };\n}\n// Just in case\nconst ED25519_TORSION_SUBGROUP = [\n '0100000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a',\n '0000000000000000000000000000000000000000000000000000000000000080',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05',\n 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85',\n '0000000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa',\n];\nconst Fp = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.Field)(ED25519_P, undefined, true);\nconst ed25519Defaults = {\n // Param: a\n a: BigInt(-1),\n // d is equal to -121665/121666 over finite field.\n // Negative number is P - number, and division is invert(number, P)\n d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'),\n // Finite field 𝔽p over which we'll do calculations; 2n**255n - 19n\n Fp,\n // Subgroup order: how many points curve has\n // 2n**252n + 27742317777372353535851937790883648493n;\n n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'),\n // Cofactor\n h: BigInt(8),\n // Base point (x, y) aka generator point\n Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),\n Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'),\n hash: _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_0__.sha512,\n randomBytes: _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.randomBytes,\n adjustScalarBytes,\n // dom2\n // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3.\n // Constant-time, u/√v\n uvRatio,\n};\nconst ed25519 = (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_2__.twistedEdwards)(ed25519Defaults);\nfunction ed25519_domain(data, ctx, phflag) {\n if (ctx.length > 255)\n throw new Error('Context is too big');\n return (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.concatBytes)((0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);\n}\nconst ed25519ctx = (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_2__.twistedEdwards)({ ...ed25519Defaults, domain: ed25519_domain });\nconst ed25519ph = (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_2__.twistedEdwards)({\n ...ed25519Defaults,\n domain: ed25519_domain,\n prehash: _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_0__.sha512,\n});\nconst x25519 = /* @__PURE__ */ (() => (0,_abstract_montgomery_js__WEBPACK_IMPORTED_MODULE_3__.montgomery)({\n P: ED25519_P,\n a: BigInt(486662),\n montgomeryBits: 255,\n nByteLength: 32,\n Gu: BigInt(9),\n powPminus2: (x) => {\n const P = ED25519_P;\n // x^(p-2) aka x^(2^255-21)\n const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x);\n return (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod)((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(pow_p_5_8, BigInt(3), P) * b2, P);\n },\n adjustScalarBytes,\n randomBytes: _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.randomBytes,\n}))();\n/**\n * Converts ed25519 public key to x25519 public key. Uses formula:\n * * `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)`\n * * `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))`\n * @example\n * const someonesPub = ed25519.getPublicKey(ed25519.utils.randomPrivateKey());\n * const aPriv = x25519.utils.randomPrivateKey();\n * x25519.getSharedSecret(aPriv, edwardsToMontgomeryPub(someonesPub))\n */\nfunction edwardsToMontgomeryPub(edwardsPub) {\n const { y } = ed25519.ExtendedPoint.fromHex(edwardsPub);\n const _1n = BigInt(1);\n return Fp.toBytes(Fp.create((_1n + y) * Fp.inv(_1n - y)));\n}\nconst edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated\n/**\n * Converts ed25519 secret key to x25519 secret key.\n * @example\n * const someonesPub = x25519.getPublicKey(x25519.utils.randomPrivateKey());\n * const aPriv = ed25519.utils.randomPrivateKey();\n * x25519.getSharedSecret(edwardsToMontgomeryPriv(aPriv), someonesPub)\n */\nfunction edwardsToMontgomeryPriv(edwardsPriv) {\n const hashed = ed25519Defaults.hash(edwardsPriv.subarray(0, 32));\n return ed25519Defaults.adjustScalarBytes(hashed).subarray(0, 32);\n}\n// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator)\n// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since\n// SageMath returns different root first and everything falls apart\nconst ELL2_C1 = (Fp.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic\nconst ELL2_C2 = Fp.pow(_2n, ELL2_C1); // 2. c2 = 2^c1\nconst ELL2_C3 = Fp.sqrt(Fp.neg(Fp.ONE)); // 3. c3 = sqrt(-1)\nconst ELL2_C4 = (Fp.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic\nconst ELL2_J = BigInt(486662);\n// prettier-ignore\nfunction map_to_curve_elligator2_curve25519(u) {\n let tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1\n let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not\n let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2)\n let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2\n let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3\n let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd\n gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd\n gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2\n gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2\n let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2\n tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4\n tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3\n tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3\n tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7\n let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8)\n y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8)\n let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3\n tv2 = Fp.sqr(y11); // 19. tv2 = y11^2\n tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd\n let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1\n let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt\n let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd\n let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u\n y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2\n let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3\n let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1)\n tv2 = Fp.sqr(y21); // 28. tv2 = y21^2\n tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd\n let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2\n let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt\n tv2 = Fp.sqr(y1); // 32. tv2 = y1^2\n tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd\n let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1\n let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2\n let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2\n let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y\n y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4)\n return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1)\n}\nconst ELL2_C1_EDWARDS = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))); // sgn0(c1) MUST equal 0\nfunction map_to_curve_elligator2_edwards25519(u) {\n const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) =\n // map_to_curve_elligator2_curve25519(u)\n let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd\n xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1\n let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM\n let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd\n let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d)\n let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd\n let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0\n xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e)\n xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e)\n yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e)\n yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e)\n const inv = Fp.invertBatch([xd, yd]); // batch division\n return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) }; // 13. return (xn, xd, yn, yd)\n}\nconst htf = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_6__.createHasher)(ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {\n DST: 'edwards25519_XMD:SHA-512_ELL2_RO_',\n encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_0__.sha512,\n}))();\nconst hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nconst encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\nfunction assertRstPoint(other) {\n if (!(other instanceof RistPoint))\n throw new Error('RistrettoPoint expected');\n}\n// √(-1) aka √(a) aka 2^((p-1)/4)\nconst SQRT_M1 = ED25519_SQRT_M1;\n// √(ad - 1)\nconst SQRT_AD_MINUS_ONE = BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235');\n// 1 / √(a-d)\nconst INVSQRT_A_MINUS_D = BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578');\n// 1-d²\nconst ONE_MINUS_D_SQ = BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838');\n// (d-1)²\nconst D_MINUS_ONE_SQ = BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952');\n// Calculates 1/√(number)\nconst invertSqrt = (number) => uvRatio(_1n, number);\nconst MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');\nconst bytes255ToNumberLE = (bytes) => ed25519.CURVE.Fp.create((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.bytesToNumberLE)(bytes) & MAX_255B);\n// Computes Elligator map for Ristretto\n// https://ristretto.group/formulas/elligator.html\nfunction calcElligatorRistrettoMap(r0) {\n const { d } = ed25519.CURVE;\n const P = ed25519.CURVE.Fp.ORDER;\n const mod = ed25519.CURVE.Fp.create;\n const r = mod(SQRT_M1 * r0 * r0); // 1\n const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2\n let c = BigInt(-1); // 3\n const D = mod((c - d * r) * mod(r + d)); // 4\n let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5\n let s_ = mod(s * r0); // 6\n if (!(0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(s_, P))\n s_ = mod(-s_);\n if (!Ns_D_is_sq)\n s = s_; // 7\n if (!Ns_D_is_sq)\n c = r; // 8\n const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9\n const s2 = s * s;\n const W0 = mod((s + s) * D); // 10\n const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11\n const W2 = mod(_1n - s2); // 12\n const W3 = mod(_1n + s2); // 13\n return new ed25519.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));\n}\n/**\n * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be\n * a source of bugs for protocols like ring signatures. Ristretto was created to solve this.\n * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint,\n * but it should work in its own namespace: do not combine those two.\n * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448\n */\nclass RistPoint {\n // Private property to discourage combining ExtendedPoint + RistrettoPoint\n // Always use Ristretto encoding/decoding instead.\n constructor(ep) {\n this.ep = ep;\n }\n static fromAffine(ap) {\n return new RistPoint(ed25519.ExtendedPoint.fromAffine(ap));\n }\n /**\n * Takes uniform output of 64-byte hash function like sha512 and converts it to `RistrettoPoint`.\n * The hash-to-group operation applies Elligator twice and adds the results.\n * **Note:** this is one-way map, there is no conversion from point to hash.\n * https://ristretto.group/formulas/elligator.html\n * @param hex 64-byte output of a hash function\n */\n static hashToCurve(hex) {\n hex = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.ensureBytes)('ristrettoHash', hex, 64);\n const r1 = bytes255ToNumberLE(hex.slice(0, 32));\n const R1 = calcElligatorRistrettoMap(r1);\n const r2 = bytes255ToNumberLE(hex.slice(32, 64));\n const R2 = calcElligatorRistrettoMap(r2);\n return new RistPoint(R1.add(R2));\n }\n /**\n * Converts ristretto-encoded string to ristretto point.\n * https://ristretto.group/formulas/decoding.html\n * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding\n */\n static fromHex(hex) {\n hex = (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.ensureBytes)('ristrettoHex', hex, 32);\n const { a, d } = ed25519.CURVE;\n const P = ed25519.CURVE.Fp.ORDER;\n const mod = ed25519.CURVE.Fp.create;\n const emsg = 'RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint';\n const s = bytes255ToNumberLE(hex);\n // 1. Check that s_bytes is the canonical encoding of a field element, or else abort.\n // 3. Check that s is non-negative, or else abort\n if (!(0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.equalBytes)((0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.numberToBytesLE)(s, 32), hex) || (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(s, P))\n throw new Error(emsg);\n const s2 = mod(s * s);\n const u1 = mod(_1n + a * s2); // 4 (a is -1)\n const u2 = mod(_1n - a * s2); // 5\n const u1_2 = mod(u1 * u1);\n const u2_2 = mod(u2 * u2);\n const v = mod(a * d * u1_2 - u2_2); // 6\n const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7\n const Dx = mod(I * u2); // 8\n const Dy = mod(I * Dx * v); // 9\n let x = mod((s + s) * Dx); // 10\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(x, P))\n x = mod(-x); // 10\n const y = mod(u1 * Dy); // 11\n const t = mod(x * y); // 12\n if (!isValid || (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(t, P) || y === _0n)\n throw new Error(emsg);\n return new RistPoint(new ed25519.ExtendedPoint(x, y, _1n, t));\n }\n /**\n * Encodes ristretto point to Uint8Array.\n * https://ristretto.group/formulas/encoding.html\n */\n toRawBytes() {\n let { ex: x, ey: y, ez: z, et: t } = this.ep;\n const P = ed25519.CURVE.Fp.ORDER;\n const mod = ed25519.CURVE.Fp.create;\n const u1 = mod(mod(z + y) * mod(z - y)); // 1\n const u2 = mod(x * y); // 2\n // Square root always exists\n const u2sq = mod(u2 * u2);\n const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3\n const D1 = mod(invsqrt * u1); // 4\n const D2 = mod(invsqrt * u2); // 5\n const zInv = mod(D1 * D2 * t); // 6\n let D; // 7\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(t * zInv, P)) {\n let _x = mod(y * SQRT_M1);\n let _y = mod(x * SQRT_M1);\n x = _x;\n y = _y;\n D = mod(D1 * INVSQRT_A_MINUS_D);\n }\n else {\n D = D2; // 8\n }\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(x * zInv, P))\n y = mod(-y); // 9\n let s = mod((z - y) * D); // 10 (check footer's note, no sqrt(-a))\n if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.isNegativeLE)(s, P))\n s = mod(-s);\n return (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.numberToBytesLE)(s, 32); // 11\n }\n toHex() {\n return (0,_abstract_utils_js__WEBPACK_IMPORTED_MODULE_5__.bytesToHex)(this.toRawBytes());\n }\n toString() {\n return this.toHex();\n }\n // Compare one point to another.\n equals(other) {\n assertRstPoint(other);\n const { ex: X1, ey: Y1 } = this.ep;\n const { ex: X2, ey: Y2 } = other.ep;\n const mod = ed25519.CURVE.Fp.create;\n // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2)\n const one = mod(X1 * Y2) === mod(Y1 * X2);\n const two = mod(Y1 * Y2) === mod(X1 * X2);\n return one || two;\n }\n add(other) {\n assertRstPoint(other);\n return new RistPoint(this.ep.add(other.ep));\n }\n subtract(other) {\n assertRstPoint(other);\n return new RistPoint(this.ep.subtract(other.ep));\n }\n multiply(scalar) {\n return new RistPoint(this.ep.multiply(scalar));\n }\n multiplyUnsafe(scalar) {\n return new RistPoint(this.ep.multiplyUnsafe(scalar));\n }\n}\nconst RistrettoPoint = /* @__PURE__ */ (() => {\n if (!RistPoint.BASE)\n RistPoint.BASE = new RistPoint(ed25519.ExtendedPoint.BASE);\n if (!RistPoint.ZERO)\n RistPoint.ZERO = new RistPoint(ed25519.ExtendedPoint.ZERO);\n return RistPoint;\n})();\n// https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/14/\n// Appendix B. Hashing to ristretto255\nconst hash_to_ristretto255 = (msg, options) => {\n const d = options.DST;\n const DST = typeof d === 'string' ? (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(d) : d;\n const uniform_bytes = (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_6__.expand_message_xmd)(msg, DST, 64, _noble_hashes_sha512__WEBPACK_IMPORTED_MODULE_0__.sha512);\n const P = RistPoint.hashToCurve(uniform_bytes);\n return P;\n};\n//# sourceMappingURL=ed25519.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/curves/esm/ed25519.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/ed25519/lib/esm/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@noble/ed25519/lib/esm/index.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("var crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CURVE: () => (/* binding */ CURVE),\n/* harmony export */ ExtendedPoint: () => (/* binding */ ExtendedPoint),\n/* harmony export */ Point: () => (/* binding */ Point),\n/* harmony export */ RistrettoPoint: () => (/* binding */ RistrettoPoint),\n/* harmony export */ Signature: () => (/* binding */ Signature),\n/* harmony export */ curve25519: () => (/* binding */ curve25519),\n/* harmony export */ getPublicKey: () => (/* binding */ getPublicKey),\n/* harmony export */ getSharedSecret: () => (/* binding */ getSharedSecret),\n/* harmony export */ sign: () => (/* binding */ sign),\n/* harmony export */ sync: () => (/* binding */ sync),\n/* harmony export */ utils: () => (/* binding */ utils),\n/* harmony export */ verify: () => (/* binding */ verify)\n/* harmony export */ });\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crypto */ \"?51ea\");\n/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _8n = BigInt(8);\nconst CU_O = BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989');\nconst CURVE = Object.freeze({\n a: BigInt(-1),\n d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'),\n P: BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949'),\n l: CU_O,\n n: CU_O,\n h: BigInt(8),\n Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),\n Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'),\n});\n\nconst POW_2_256 = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000');\nconst SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');\nconst SQRT_D = BigInt('6853475219497561581579357271197624642482790079785650197046958215289687604742');\nconst SQRT_AD_MINUS_ONE = BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235');\nconst INVSQRT_A_MINUS_D = BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578');\nconst ONE_MINUS_D_SQ = BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838');\nconst D_MINUS_ONE_SQ = BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952');\nclass ExtendedPoint {\n constructor(x, y, z, t) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.t = t;\n }\n static fromAffine(p) {\n if (!(p instanceof Point)) {\n throw new TypeError('ExtendedPoint#fromAffine: expected Point');\n }\n if (p.equals(Point.ZERO))\n return ExtendedPoint.ZERO;\n return new ExtendedPoint(p.x, p.y, _1n, mod(p.x * p.y));\n }\n static toAffineBatch(points) {\n const toInv = invertBatch(points.map((p) => p.z));\n return points.map((p, i) => p.toAffine(toInv[i]));\n }\n static normalizeZ(points) {\n return this.toAffineBatch(points).map(this.fromAffine);\n }\n equals(other) {\n assertExtPoint(other);\n const { x: X1, y: Y1, z: Z1 } = this;\n const { x: X2, y: Y2, z: Z2 } = other;\n const X1Z2 = mod(X1 * Z2);\n const X2Z1 = mod(X2 * Z1);\n const Y1Z2 = mod(Y1 * Z2);\n const Y2Z1 = mod(Y2 * Z1);\n return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;\n }\n negate() {\n return new ExtendedPoint(mod(-this.x), this.y, this.z, mod(-this.t));\n }\n double() {\n const { x: X1, y: Y1, z: Z1 } = this;\n const { a } = CURVE;\n const A = mod(X1 * X1);\n const B = mod(Y1 * Y1);\n const C = mod(_2n * mod(Z1 * Z1));\n const D = mod(a * A);\n const x1y1 = X1 + Y1;\n const E = mod(mod(x1y1 * x1y1) - A - B);\n const G = D + B;\n const F = G - C;\n const H = D - B;\n const X3 = mod(E * F);\n const Y3 = mod(G * H);\n const T3 = mod(E * H);\n const Z3 = mod(F * G);\n return new ExtendedPoint(X3, Y3, Z3, T3);\n }\n add(other) {\n assertExtPoint(other);\n const { x: X1, y: Y1, z: Z1, t: T1 } = this;\n const { x: X2, y: Y2, z: Z2, t: T2 } = other;\n const A = mod((Y1 - X1) * (Y2 + X2));\n const B = mod((Y1 + X1) * (Y2 - X2));\n const F = mod(B - A);\n if (F === _0n)\n return this.double();\n const C = mod(Z1 * _2n * T2);\n const D = mod(T1 * _2n * Z2);\n const E = D + C;\n const G = B + A;\n const H = D - C;\n const X3 = mod(E * F);\n const Y3 = mod(G * H);\n const T3 = mod(E * H);\n const Z3 = mod(F * G);\n return new ExtendedPoint(X3, Y3, Z3, T3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n precomputeWindow(W) {\n const windows = 1 + 256 / W;\n const points = [];\n let p = this;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n for (let i = 1; i < 2 ** (W - 1); i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n }\n wNAF(n, affinePoint) {\n if (!affinePoint && this.equals(ExtendedPoint.BASE))\n affinePoint = Point.BASE;\n const W = (affinePoint && affinePoint._WINDOW_SIZE) || 1;\n if (256 % W) {\n throw new Error('Point#wNAF: Invalid precomputation window, must be power of 2');\n }\n let precomputes = affinePoint && pointPrecomputes.get(affinePoint);\n if (!precomputes) {\n precomputes = this.precomputeWindow(W);\n if (affinePoint && W !== 1) {\n precomputes = ExtendedPoint.normalizeZ(precomputes);\n pointPrecomputes.set(affinePoint, precomputes);\n }\n }\n let p = ExtendedPoint.ZERO;\n let f = ExtendedPoint.BASE;\n const windows = 1 + 256 / W;\n const windowSize = 2 ** (W - 1);\n const mask = BigInt(2 ** W - 1);\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n let wbits = Number(n & mask);\n n >>= shiftBy;\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1;\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n return ExtendedPoint.normalizeZ([p, f])[0];\n }\n multiply(scalar, affinePoint) {\n return this.wNAF(normalizeScalar(scalar, CURVE.l), affinePoint);\n }\n multiplyUnsafe(scalar) {\n let n = normalizeScalar(scalar, CURVE.l, false);\n const G = ExtendedPoint.BASE;\n const P0 = ExtendedPoint.ZERO;\n if (n === _0n)\n return P0;\n if (this.equals(P0) || n === _1n)\n return this;\n if (this.equals(G))\n return this.wNAF(n);\n let p = P0;\n let d = this;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n }\n isSmallOrder() {\n return this.multiplyUnsafe(CURVE.h).equals(ExtendedPoint.ZERO);\n }\n isTorsionFree() {\n let p = this.multiplyUnsafe(CURVE.l / _2n).double();\n if (CURVE.l % _2n)\n p = p.add(this);\n return p.equals(ExtendedPoint.ZERO);\n }\n toAffine(invZ) {\n const { x, y, z } = this;\n const is0 = this.equals(ExtendedPoint.ZERO);\n if (invZ == null)\n invZ = is0 ? _8n : invert(z);\n const ax = mod(x * invZ);\n const ay = mod(y * invZ);\n const zz = mod(z * invZ);\n if (is0)\n return Point.ZERO;\n if (zz !== _1n)\n throw new Error('invZ was invalid');\n return new Point(ax, ay);\n }\n fromRistrettoBytes() {\n legacyRist();\n }\n toRistrettoBytes() {\n legacyRist();\n }\n fromRistrettoHash() {\n legacyRist();\n }\n}\nExtendedPoint.BASE = new ExtendedPoint(CURVE.Gx, CURVE.Gy, _1n, mod(CURVE.Gx * CURVE.Gy));\nExtendedPoint.ZERO = new ExtendedPoint(_0n, _1n, _1n, _0n);\nfunction constTimeNegate(condition, item) {\n const neg = item.negate();\n return condition ? neg : item;\n}\nfunction assertExtPoint(other) {\n if (!(other instanceof ExtendedPoint))\n throw new TypeError('ExtendedPoint expected');\n}\nfunction assertRstPoint(other) {\n if (!(other instanceof RistrettoPoint))\n throw new TypeError('RistrettoPoint expected');\n}\nfunction legacyRist() {\n throw new Error('Legacy method: switch to RistrettoPoint');\n}\nclass RistrettoPoint {\n constructor(ep) {\n this.ep = ep;\n }\n static calcElligatorRistrettoMap(r0) {\n const { d } = CURVE;\n const r = mod(SQRT_M1 * r0 * r0);\n const Ns = mod((r + _1n) * ONE_MINUS_D_SQ);\n let c = BigInt(-1);\n const D = mod((c - d * r) * mod(r + d));\n let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D);\n let s_ = mod(s * r0);\n if (!edIsNegative(s_))\n s_ = mod(-s_);\n if (!Ns_D_is_sq)\n s = s_;\n if (!Ns_D_is_sq)\n c = r;\n const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D);\n const s2 = s * s;\n const W0 = mod((s + s) * D);\n const W1 = mod(Nt * SQRT_AD_MINUS_ONE);\n const W2 = mod(_1n - s2);\n const W3 = mod(_1n + s2);\n return new ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));\n }\n static hashToCurve(hex) {\n hex = ensureBytes(hex, 64);\n const r1 = bytes255ToNumberLE(hex.slice(0, 32));\n const R1 = this.calcElligatorRistrettoMap(r1);\n const r2 = bytes255ToNumberLE(hex.slice(32, 64));\n const R2 = this.calcElligatorRistrettoMap(r2);\n return new RistrettoPoint(R1.add(R2));\n }\n static fromHex(hex) {\n hex = ensureBytes(hex, 32);\n const { a, d } = CURVE;\n const emsg = 'RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint';\n const s = bytes255ToNumberLE(hex);\n if (!equalBytes(numberTo32BytesLE(s), hex) || edIsNegative(s))\n throw new Error(emsg);\n const s2 = mod(s * s);\n const u1 = mod(_1n + a * s2);\n const u2 = mod(_1n - a * s2);\n const u1_2 = mod(u1 * u1);\n const u2_2 = mod(u2 * u2);\n const v = mod(a * d * u1_2 - u2_2);\n const { isValid, value: I } = invertSqrt(mod(v * u2_2));\n const Dx = mod(I * u2);\n const Dy = mod(I * Dx * v);\n let x = mod((s + s) * Dx);\n if (edIsNegative(x))\n x = mod(-x);\n const y = mod(u1 * Dy);\n const t = mod(x * y);\n if (!isValid || edIsNegative(t) || y === _0n)\n throw new Error(emsg);\n return new RistrettoPoint(new ExtendedPoint(x, y, _1n, t));\n }\n toRawBytes() {\n let { x, y, z, t } = this.ep;\n const u1 = mod(mod(z + y) * mod(z - y));\n const u2 = mod(x * y);\n const u2sq = mod(u2 * u2);\n const { value: invsqrt } = invertSqrt(mod(u1 * u2sq));\n const D1 = mod(invsqrt * u1);\n const D2 = mod(invsqrt * u2);\n const zInv = mod(D1 * D2 * t);\n let D;\n if (edIsNegative(t * zInv)) {\n let _x = mod(y * SQRT_M1);\n let _y = mod(x * SQRT_M1);\n x = _x;\n y = _y;\n D = mod(D1 * INVSQRT_A_MINUS_D);\n }\n else {\n D = D2;\n }\n if (edIsNegative(x * zInv))\n y = mod(-y);\n let s = mod((z - y) * D);\n if (edIsNegative(s))\n s = mod(-s);\n return numberTo32BytesLE(s);\n }\n toHex() {\n return bytesToHex(this.toRawBytes());\n }\n toString() {\n return this.toHex();\n }\n equals(other) {\n assertRstPoint(other);\n const a = this.ep;\n const b = other.ep;\n const one = mod(a.x * b.y) === mod(a.y * b.x);\n const two = mod(a.y * b.y) === mod(a.x * b.x);\n return one || two;\n }\n add(other) {\n assertRstPoint(other);\n return new RistrettoPoint(this.ep.add(other.ep));\n }\n subtract(other) {\n assertRstPoint(other);\n return new RistrettoPoint(this.ep.subtract(other.ep));\n }\n multiply(scalar) {\n return new RistrettoPoint(this.ep.multiply(scalar));\n }\n multiplyUnsafe(scalar) {\n return new RistrettoPoint(this.ep.multiplyUnsafe(scalar));\n }\n}\nRistrettoPoint.BASE = new RistrettoPoint(ExtendedPoint.BASE);\nRistrettoPoint.ZERO = new RistrettoPoint(ExtendedPoint.ZERO);\nconst pointPrecomputes = new WeakMap();\nclass Point {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n }\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n static fromHex(hex, strict = true) {\n const { d, P } = CURVE;\n hex = ensureBytes(hex, 32);\n const normed = hex.slice();\n normed[31] = hex[31] & ~0x80;\n const y = bytesToNumberLE(normed);\n if (strict && y >= P)\n throw new Error('Expected 0 < hex < P');\n if (!strict && y >= POW_2_256)\n throw new Error('Expected 0 < hex < 2**256');\n const y2 = mod(y * y);\n const u = mod(y2 - _1n);\n const v = mod(d * y2 + _1n);\n let { isValid, value: x } = uvRatio(u, v);\n if (!isValid)\n throw new Error('Point.fromHex: invalid y coordinate');\n const isXOdd = (x & _1n) === _1n;\n const isLastByteOdd = (hex[31] & 0x80) !== 0;\n if (isLastByteOdd !== isXOdd) {\n x = mod(-x);\n }\n return new Point(x, y);\n }\n static async fromPrivateKey(privateKey) {\n return (await getExtendedPublicKey(privateKey)).point;\n }\n toRawBytes() {\n const bytes = numberTo32BytesLE(this.y);\n bytes[31] |= this.x & _1n ? 0x80 : 0;\n return bytes;\n }\n toHex() {\n return bytesToHex(this.toRawBytes());\n }\n toX25519() {\n const { y } = this;\n const u = mod((_1n + y) * invert(_1n - y));\n return numberTo32BytesLE(u);\n }\n isTorsionFree() {\n return ExtendedPoint.fromAffine(this).isTorsionFree();\n }\n equals(other) {\n return this.x === other.x && this.y === other.y;\n }\n negate() {\n return new Point(mod(-this.x), this.y);\n }\n add(other) {\n return ExtendedPoint.fromAffine(this).add(ExtendedPoint.fromAffine(other)).toAffine();\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiply(scalar) {\n return ExtendedPoint.fromAffine(this).multiply(scalar, this).toAffine();\n }\n}\nPoint.BASE = new Point(CURVE.Gx, CURVE.Gy);\nPoint.ZERO = new Point(_0n, _1n);\nclass Signature {\n constructor(r, s) {\n this.r = r;\n this.s = s;\n this.assertValidity();\n }\n static fromHex(hex) {\n const bytes = ensureBytes(hex, 64);\n const r = Point.fromHex(bytes.slice(0, 32), false);\n const s = bytesToNumberLE(bytes.slice(32, 64));\n return new Signature(r, s);\n }\n assertValidity() {\n const { r, s } = this;\n if (!(r instanceof Point))\n throw new Error('Expected Point instance');\n normalizeScalar(s, CURVE.l, false);\n return this;\n }\n toRawBytes() {\n const u8 = new Uint8Array(64);\n u8.set(this.r.toRawBytes());\n u8.set(numberTo32BytesLE(this.s), 32);\n return u8;\n }\n toHex() {\n return bytesToHex(this.toRawBytes());\n }\n}\n\nfunction concatBytes(...arrays) {\n if (!arrays.every((a) => a instanceof Uint8Array))\n throw new Error('Expected Uint8Array list');\n if (arrays.length === 1)\n return arrays[0];\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const arr = arrays[i];\n result.set(arr, pad);\n pad += arr.length;\n }\n return result;\n}\nconst hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));\nfunction bytesToHex(uint8a) {\n if (!(uint8a instanceof Uint8Array))\n throw new Error('Uint8Array expected');\n let hex = '';\n for (let i = 0; i < uint8a.length; i++) {\n hex += hexes[uint8a[i]];\n }\n return hex;\n}\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToBytes: expected string, got ' + typeof hex);\n }\n if (hex.length % 2)\n throw new Error('hexToBytes: received invalid unpadded hex');\n const array = new Uint8Array(hex.length / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\nfunction numberTo32BytesBE(num) {\n const length = 32;\n const hex = num.toString(16).padStart(length * 2, '0');\n return hexToBytes(hex);\n}\nfunction numberTo32BytesLE(num) {\n return numberTo32BytesBE(num).reverse();\n}\nfunction edIsNegative(num) {\n return (mod(num) & _1n) === _1n;\n}\nfunction bytesToNumberLE(uint8a) {\n if (!(uint8a instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n return BigInt('0x' + bytesToHex(Uint8Array.from(uint8a).reverse()));\n}\nconst MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');\nfunction bytes255ToNumberLE(bytes) {\n return mod(bytesToNumberLE(bytes) & MAX_255B);\n}\nfunction mod(a, b = CURVE.P) {\n const res = a % b;\n return res >= _0n ? res : b + res;\n}\nfunction invert(number, modulo = CURVE.P) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n let a = mod(number, modulo);\n let b = modulo;\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\nfunction invertBatch(nums, p = CURVE.P) {\n const tmp = new Array(nums.length);\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (num === _0n)\n return acc;\n tmp[i] = acc;\n return mod(acc * num, p);\n }, _1n);\n const inverted = invert(lastMultiplied, p);\n nums.reduceRight((acc, num, i) => {\n if (num === _0n)\n return acc;\n tmp[i] = mod(acc * tmp[i], p);\n return mod(acc * num, p);\n }, inverted);\n return tmp;\n}\nfunction pow2(x, power) {\n const { P } = CURVE;\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= P;\n }\n return res;\n}\nfunction pow_2_252_3(x) {\n const { P } = CURVE;\n const _5n = BigInt(5);\n const _10n = BigInt(10);\n const _20n = BigInt(20);\n const _40n = BigInt(40);\n const _80n = BigInt(80);\n const x2 = (x * x) % P;\n const b2 = (x2 * x) % P;\n const b4 = (pow2(b2, _2n) * b2) % P;\n const b5 = (pow2(b4, _1n) * x) % P;\n const b10 = (pow2(b5, _5n) * b5) % P;\n const b20 = (pow2(b10, _10n) * b10) % P;\n const b40 = (pow2(b20, _20n) * b20) % P;\n const b80 = (pow2(b40, _40n) * b40) % P;\n const b160 = (pow2(b80, _80n) * b80) % P;\n const b240 = (pow2(b160, _80n) * b80) % P;\n const b250 = (pow2(b240, _10n) * b10) % P;\n const pow_p_5_8 = (pow2(b250, _2n) * x) % P;\n return { pow_p_5_8, b2 };\n}\nfunction uvRatio(u, v) {\n const v3 = mod(v * v * v);\n const v7 = mod(v3 * v3 * v);\n const pow = pow_2_252_3(u * v7).pow_p_5_8;\n let x = mod(u * v3 * pow);\n const vx2 = mod(v * x * x);\n const root1 = x;\n const root2 = mod(x * SQRT_M1);\n const useRoot1 = vx2 === u;\n const useRoot2 = vx2 === mod(-u);\n const noRoot = vx2 === mod(-u * SQRT_M1);\n if (useRoot1)\n x = root1;\n if (useRoot2 || noRoot)\n x = root2;\n if (edIsNegative(x))\n x = mod(-x);\n return { isValid: useRoot1 || useRoot2, value: x };\n}\nfunction invertSqrt(number) {\n return uvRatio(_1n, number);\n}\nfunction modlLE(hash) {\n return mod(bytesToNumberLE(hash), CURVE.l);\n}\nfunction equalBytes(b1, b2) {\n if (b1.length !== b2.length) {\n return false;\n }\n for (let i = 0; i < b1.length; i++) {\n if (b1[i] !== b2[i]) {\n return false;\n }\n }\n return true;\n}\nfunction ensureBytes(hex, expectedLength) {\n const bytes = hex instanceof Uint8Array ? Uint8Array.from(hex) : hexToBytes(hex);\n if (typeof expectedLength === 'number' && bytes.length !== expectedLength)\n throw new Error(`Expected ${expectedLength} bytes`);\n return bytes;\n}\nfunction normalizeScalar(num, max, strict = true) {\n if (!max)\n throw new TypeError('Specify max value');\n if (typeof num === 'number' && Number.isSafeInteger(num))\n num = BigInt(num);\n if (typeof num === 'bigint' && num < max) {\n if (strict) {\n if (_0n < num)\n return num;\n }\n else {\n if (_0n <= num)\n return num;\n }\n }\n throw new TypeError('Expected valid scalar: 0 < scalar < max');\n}\nfunction adjustBytes25519(bytes) {\n bytes[0] &= 248;\n bytes[31] &= 127;\n bytes[31] |= 64;\n return bytes;\n}\nfunction decodeScalar25519(n) {\n return bytesToNumberLE(adjustBytes25519(ensureBytes(n, 32)));\n}\nfunction checkPrivateKey(key) {\n key =\n typeof key === 'bigint' || typeof key === 'number'\n ? numberTo32BytesBE(normalizeScalar(key, POW_2_256))\n : ensureBytes(key);\n if (key.length !== 32)\n throw new Error(`Expected 32 bytes`);\n return key;\n}\nfunction getKeyFromHash(hashed) {\n const head = adjustBytes25519(hashed.slice(0, 32));\n const prefix = hashed.slice(32, 64);\n const scalar = modlLE(head);\n const point = Point.BASE.multiply(scalar);\n const pointBytes = point.toRawBytes();\n return { head, prefix, scalar, point, pointBytes };\n}\nlet _sha512Sync;\nfunction sha512s(...m) {\n if (typeof _sha512Sync !== 'function')\n throw new Error('utils.sha512Sync must be set to use sync methods');\n return _sha512Sync(...m);\n}\nasync function getExtendedPublicKey(key) {\n return getKeyFromHash(await utils.sha512(checkPrivateKey(key)));\n}\nfunction getExtendedPublicKeySync(key) {\n return getKeyFromHash(sha512s(checkPrivateKey(key)));\n}\nasync function getPublicKey(privateKey) {\n return (await getExtendedPublicKey(privateKey)).pointBytes;\n}\nfunction getPublicKeySync(privateKey) {\n return getExtendedPublicKeySync(privateKey).pointBytes;\n}\nasync function sign(message, privateKey) {\n message = ensureBytes(message);\n const { prefix, scalar, pointBytes } = await getExtendedPublicKey(privateKey);\n const r = modlLE(await utils.sha512(prefix, message));\n const R = Point.BASE.multiply(r);\n const k = modlLE(await utils.sha512(R.toRawBytes(), pointBytes, message));\n const s = mod(r + k * scalar, CURVE.l);\n return new Signature(R, s).toRawBytes();\n}\nfunction signSync(message, privateKey) {\n message = ensureBytes(message);\n const { prefix, scalar, pointBytes } = getExtendedPublicKeySync(privateKey);\n const r = modlLE(sha512s(prefix, message));\n const R = Point.BASE.multiply(r);\n const k = modlLE(sha512s(R.toRawBytes(), pointBytes, message));\n const s = mod(r + k * scalar, CURVE.l);\n return new Signature(R, s).toRawBytes();\n}\nfunction prepareVerification(sig, message, publicKey) {\n message = ensureBytes(message);\n if (!(publicKey instanceof Point))\n publicKey = Point.fromHex(publicKey, false);\n const { r, s } = sig instanceof Signature ? sig.assertValidity() : Signature.fromHex(sig);\n const SB = ExtendedPoint.BASE.multiplyUnsafe(s);\n return { r, s, SB, pub: publicKey, msg: message };\n}\nfunction finishVerification(publicKey, r, SB, hashed) {\n const k = modlLE(hashed);\n const kA = ExtendedPoint.fromAffine(publicKey).multiplyUnsafe(k);\n const RkA = ExtendedPoint.fromAffine(r).add(kA);\n return RkA.subtract(SB).multiplyUnsafe(CURVE.h).equals(ExtendedPoint.ZERO);\n}\nasync function verify(sig, message, publicKey) {\n const { r, SB, msg, pub } = prepareVerification(sig, message, publicKey);\n const hashed = await utils.sha512(r.toRawBytes(), pub.toRawBytes(), msg);\n return finishVerification(pub, r, SB, hashed);\n}\nfunction verifySync(sig, message, publicKey) {\n const { r, SB, msg, pub } = prepareVerification(sig, message, publicKey);\n const hashed = sha512s(r.toRawBytes(), pub.toRawBytes(), msg);\n return finishVerification(pub, r, SB, hashed);\n}\nconst sync = {\n getExtendedPublicKey: getExtendedPublicKeySync,\n getPublicKey: getPublicKeySync,\n sign: signSync,\n verify: verifySync,\n};\nasync function getSharedSecret(privateKey, publicKey) {\n const { head } = await getExtendedPublicKey(privateKey);\n const u = Point.fromHex(publicKey).toX25519();\n return curve25519.scalarMult(head, u);\n}\nPoint.BASE._setWindowSize(8);\nfunction cswap(swap, x_2, x_3) {\n const dummy = mod(swap * (x_2 - x_3));\n x_2 = mod(x_2 - dummy);\n x_3 = mod(x_3 + dummy);\n return [x_2, x_3];\n}\nfunction montgomeryLadder(pointU, scalar) {\n const { P } = CURVE;\n const u = normalizeScalar(pointU, P);\n const k = normalizeScalar(scalar, P);\n const a24 = BigInt(121665);\n const x_1 = u;\n let x_2 = _1n;\n let z_2 = _0n;\n let x_3 = u;\n let z_3 = _1n;\n let swap = _0n;\n let sw;\n for (let t = BigInt(255 - 1); t >= _0n; t--) {\n const k_t = (k >> t) & _1n;\n swap ^= k_t;\n sw = cswap(swap, x_2, x_3);\n x_2 = sw[0];\n x_3 = sw[1];\n sw = cswap(swap, z_2, z_3);\n z_2 = sw[0];\n z_3 = sw[1];\n swap = k_t;\n const A = x_2 + z_2;\n const AA = mod(A * A);\n const B = x_2 - z_2;\n const BB = mod(B * B);\n const E = AA - BB;\n const C = x_3 + z_3;\n const D = x_3 - z_3;\n const DA = mod(D * A);\n const CB = mod(C * B);\n const dacb = DA + CB;\n const da_cb = DA - CB;\n x_3 = mod(dacb * dacb);\n z_3 = mod(x_1 * mod(da_cb * da_cb));\n x_2 = mod(AA * BB);\n z_2 = mod(E * (AA + mod(a24 * E)));\n }\n sw = cswap(swap, x_2, x_3);\n x_2 = sw[0];\n x_3 = sw[1];\n sw = cswap(swap, z_2, z_3);\n z_2 = sw[0];\n z_3 = sw[1];\n const { pow_p_5_8, b2 } = pow_2_252_3(z_2);\n const xp2 = mod(pow2(pow_p_5_8, BigInt(3)) * b2);\n return mod(x_2 * xp2);\n}\nfunction encodeUCoordinate(u) {\n return numberTo32BytesLE(mod(u, CURVE.P));\n}\nfunction decodeUCoordinate(uEnc) {\n const u = ensureBytes(uEnc, 32);\n u[31] &= 127;\n return bytesToNumberLE(u);\n}\nconst curve25519 = {\n BASE_POINT_U: '0900000000000000000000000000000000000000000000000000000000000000',\n scalarMult(privateKey, publicKey) {\n const u = decodeUCoordinate(publicKey);\n const p = decodeScalar25519(privateKey);\n const pu = montgomeryLadder(u, p);\n if (pu === _0n)\n throw new Error('Invalid private or public key received');\n return encodeUCoordinate(pu);\n },\n scalarMultBase(privateKey) {\n return curve25519.scalarMult(privateKey, curve25519.BASE_POINT_U);\n },\n};\nconst crypto = {\n node: /*#__PURE__*/ (crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(crypto__WEBPACK_IMPORTED_MODULE_0__, 2))),\n web: typeof self === 'object' && 'crypto' in self ? self.crypto : undefined,\n};\nconst utils = {\n bytesToHex,\n hexToBytes,\n concatBytes,\n getExtendedPublicKey,\n mod,\n invert,\n TORSION_SUBGROUP: [\n '0100000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a',\n '0000000000000000000000000000000000000000000000000000000000000080',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05',\n 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85',\n '0000000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa',\n ],\n hashToPrivateScalar: (hash) => {\n hash = ensureBytes(hash);\n if (hash.length < 40 || hash.length > 1024)\n throw new Error('Expected 40-1024 bytes of private key as per FIPS 186');\n return mod(bytesToNumberLE(hash), CURVE.l - _1n) + _1n;\n },\n randomBytes: (bytesLength = 32) => {\n if (crypto.web) {\n return crypto.web.getRandomValues(new Uint8Array(bytesLength));\n }\n else if (crypto.node) {\n const { randomBytes } = crypto.node;\n return new Uint8Array(randomBytes(bytesLength).buffer);\n }\n else {\n throw new Error(\"The environment doesn't have randomBytes function\");\n }\n },\n randomPrivateKey: () => {\n return utils.randomBytes(32);\n },\n sha512: async (...messages) => {\n const message = concatBytes(...messages);\n if (crypto.web) {\n const buffer = await crypto.web.subtle.digest('SHA-512', message.buffer);\n return new Uint8Array(buffer);\n }\n else if (crypto.node) {\n return Uint8Array.from(crypto.node.createHash('sha512').update(message).digest());\n }\n else {\n throw new Error(\"The environment doesn't have sha512 function\");\n }\n },\n precompute(windowSize = 8, point = Point.BASE) {\n const cached = point.equals(Point.BASE) ? point : new Point(point.x, point.y);\n cached._setWindowSize(windowSize);\n cached.multiply(_2n);\n return cached;\n },\n sha512Sync: undefined,\n};\nObject.defineProperties(utils, {\n sha512Sync: {\n configurable: false,\n get() {\n return _sha512Sync;\n },\n set(val) {\n if (!_sha512Sync)\n _sha512Sync = val;\n },\n },\n});\n\n\n//# sourceURL=webpack://light/./node_modules/@noble/ed25519/lib/esm/index.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/_assert.js": +/*!***************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/_assert.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bool: () => (/* binding */ bool),\n/* harmony export */ bytes: () => (/* binding */ bytes),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ exists: () => (/* binding */ exists),\n/* harmony export */ hash: () => (/* binding */ hash),\n/* harmony export */ number: () => (/* binding */ number),\n/* harmony export */ output: () => (/* binding */ output)\n/* harmony export */ });\nfunction number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nconst assert = {\n number,\n bool,\n bytes,\n hash,\n exists,\n output,\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (assert);\n//# sourceMappingURL=_assert.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/_assert.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/_sha2.js": +/*!*************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/_sha2.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SHA2: () => (/* binding */ SHA2)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nclass SHA2 extends _utils_js__WEBPACK_IMPORTED_MODULE_1__.Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createView)(this.buffer);\n }\n update(data) {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].exists(this);\n const { view, buffer, blockLen } = this;\n data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createView)(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].exists(this);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createView)(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_sha2.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/_sha2.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/_u64.js": +/*!************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/_u64.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ fromBig: () => (/* binding */ fromBig),\n/* harmony export */ split: () => (/* binding */ split),\n/* harmony export */ toBig: () => (/* binding */ toBig)\n/* harmony export */ });\nconst U32_MASK64 = BigInt(2 ** 32 - 1);\nconst _32n = BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (h, l) => l;\nconst rotr32L = (h, l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\n// Removing \"export\" has 5% perf penalty -_-\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (u64);\n//# sourceMappingURL=_u64.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/_u64.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/crypto.js": +/*!**************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/crypto.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ crypto: () => (/* binding */ crypto)\n/* harmony export */ });\nconst crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/crypto.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/hkdf.js": +/*!************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/hkdf.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ expand: () => (/* binding */ expand),\n/* harmony export */ extract: () => (/* binding */ extract),\n/* harmony export */ hkdf: () => (/* binding */ hkdf)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/@noble/hashes/esm/hmac.js\");\n\n\n\n// HKDF (RFC 5869)\n// https://soatok.blog/2021/11/17/understanding-hkdf/\n/**\n * HKDF-Extract(IKM, salt) -> PRK\n * Arguments position differs from spec (IKM is first one, since it is not optional)\n * @param hash\n * @param ikm\n * @param salt\n * @returns\n */\nfunction extract(hash, ikm, salt) {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].hash(hash);\n // NOTE: some libraries treat zero-length array as 'not provided';\n // we don't, since we have undefined as 'not provided'\n // https://github.com/RustCrypto/KDFs/issues/15\n if (salt === undefined)\n salt = new Uint8Array(hash.outputLen); // if not provided, it is set to a string of HashLen zeros\n return (0,_hmac_js__WEBPACK_IMPORTED_MODULE_2__.hmac)(hash, (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(salt), (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(ikm));\n}\n// HKDF-Expand(PRK, info, L) -> OKM\nconst HKDF_COUNTER = new Uint8Array([0]);\nconst EMPTY_BUFFER = new Uint8Array();\n/**\n * HKDF-expand from the spec.\n * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)\n * @param info - optional context and application specific information (can be a zero-length string)\n * @param length - length of output keying material in octets\n */\nfunction expand(hash, prk, info, length = 32) {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].hash(hash);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].number(length);\n if (length > 255 * hash.outputLen)\n throw new Error('Length should be <= 255*HashLen');\n const blocks = Math.ceil(length / hash.outputLen);\n if (info === undefined)\n info = EMPTY_BUFFER;\n // first L(ength) octets of T\n const okm = new Uint8Array(blocks * hash.outputLen);\n // Re-use HMAC instance between blocks\n const HMAC = _hmac_js__WEBPACK_IMPORTED_MODULE_2__.hmac.create(hash, prk);\n const HMACTmp = HMAC._cloneInto();\n const T = new Uint8Array(HMAC.outputLen);\n for (let counter = 0; counter < blocks; counter++) {\n HKDF_COUNTER[0] = counter + 1;\n // T(0) = empty string (zero length)\n // T(N) = HMAC-Hash(PRK, T(N-1) | info | N)\n HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T)\n .update(info)\n .update(HKDF_COUNTER)\n .digestInto(T);\n okm.set(T, hash.outputLen * counter);\n HMAC._cloneInto(HMACTmp);\n }\n HMAC.destroy();\n HMACTmp.destroy();\n T.fill(0);\n HKDF_COUNTER.fill(0);\n return okm.slice(0, length);\n}\n/**\n * HKDF (RFC 5869): extract + expand in one step.\n * @param hash - hash function that would be used (e.g. sha256)\n * @param ikm - input keying material, the initial key\n * @param salt - optional salt value (a non-secret random value)\n * @param info - optional context and application specific information\n * @param length - length of output keying material in octets\n */\nconst hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);\n//# sourceMappingURL=hkdf.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/hkdf.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/hmac.js": +/*!************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/hmac.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HMAC: () => (/* binding */ HMAC),\n/* harmony export */ hmac: () => (/* binding */ hmac)\n/* harmony export */ });\n/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_assert.js */ \"./node_modules/@noble/hashes/esm/_assert.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n// HMAC (RFC 2104)\nclass HMAC extends _utils_js__WEBPACK_IMPORTED_MODULE_1__.Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].hash(hash);\n const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].exists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].exists(this);\n _assert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nconst hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/hmac.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/sha256.js": +/*!**************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/sha256.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha224: () => (/* binding */ sha224),\n/* harmony export */ sha256: () => (/* binding */ sha256)\n/* harmony export */ });\n/* harmony import */ var _sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_sha2.js */ \"./node_modules/@noble/hashes/esm/_sha2.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = new Uint32Array(64);\nclass SHA256 extends _sha2_js__WEBPACK_IMPORTED_MODULE_0__.SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W15, 7) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W15, 18) ^ (W15 >>> 3);\n const s1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W2, 17) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(E, 6) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(E, 11) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(A, 2) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(A, 13) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.rotr)(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nconst sha256 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.wrapConstructor)(() => new SHA256());\nconst sha224 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.wrapConstructor)(() => new SHA224());\n//# sourceMappingURL=sha256.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/sha256.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/sha512.js": +/*!**************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/sha512.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SHA512: () => (/* binding */ SHA512),\n/* harmony export */ sha384: () => (/* binding */ sha384),\n/* harmony export */ sha512: () => (/* binding */ sha512),\n/* harmony export */ sha512_224: () => (/* binding */ sha512_224),\n/* harmony export */ sha512_256: () => (/* binding */ sha512_256)\n/* harmony export */ });\n/* harmony import */ var _sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_sha2.js */ \"./node_modules/@noble/hashes/esm/_sha2.js\");\n/* harmony import */ var _u64_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_u64.js */ \"./node_modules/@noble/hashes/esm/_u64.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/@noble/hashes/esm/utils.js\");\n\n\n\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n)));\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = new Uint32Array(80);\nconst SHA512_W_L = new Uint32Array(80);\nclass SHA512 extends _sha2_js__WEBPACK_IMPORTED_MODULE_0__.SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSH(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSH(W15h, W15l, 8) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].shrSH(W15h, W15l, 7);\n const s0l = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSL(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSL(W15h, W15l, 8) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSH(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBH(W2h, W2l, 61) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].shrSH(W2h, W2l, 6);\n const s1l = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSL(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBL(W2h, W2l, 61) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSH(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSH(Eh, El, 18) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBH(Eh, El, 41);\n const sigma1l = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSL(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSL(Eh, El, 18) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSH(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBH(Ah, Al, 34) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBH(Ah, Al, 39);\n const sigma0l = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrSL(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBL(Ah, Al, 34) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add3L(T1l, sigma0l, MAJl);\n Ah = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nconst sha512 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA512());\nconst sha512_224 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA512_224());\nconst sha512_256 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA512_256());\nconst sha384 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.wrapConstructor)(() => new SHA384());\n//# sourceMappingURL=sha512.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/sha512.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/hashes/esm/utils.js": +/*!*************************************************!*\ + !*** ./node_modules/@noble/hashes/esm/utils.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hash: () => (/* binding */ Hash),\n/* harmony export */ asyncLoop: () => (/* binding */ asyncLoop),\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ checkOpts: () => (/* binding */ checkOpts),\n/* harmony export */ concatBytes: () => (/* binding */ concatBytes),\n/* harmony export */ createView: () => (/* binding */ createView),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ isLE: () => (/* binding */ isLE),\n/* harmony export */ nextTick: () => (/* binding */ nextTick),\n/* harmony export */ randomBytes: () => (/* binding */ randomBytes),\n/* harmony export */ rotr: () => (/* binding */ rotr),\n/* harmony export */ toBytes: () => (/* binding */ toBytes),\n/* harmony export */ u32: () => (/* binding */ u32),\n/* harmony export */ u8: () => (/* binding */ u8),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes),\n/* harmony export */ wrapConstructor: () => (/* binding */ wrapConstructor),\n/* harmony export */ wrapConstructorWithOpts: () => (/* binding */ wrapConstructorWithOpts),\n/* harmony export */ wrapXOFConstructorWithOpts: () => (/* binding */ wrapXOFConstructorWithOpts)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/crypto */ \"./node_modules/@noble/hashes/esm/crypto.js\");\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\n\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nconst u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nconst u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nconst createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nconst rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nconst isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nconst nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nasync function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nfunction toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nclass Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\n// Check if object doens't have custom constructor (like Uint8Array/Array)\nconst isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;\nfunction checkOpts(defaults, opts) {\n if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nfunction wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nfunction wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nfunction wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nfunction randomBytes(bytesLength = 32) {\n if (_noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto && typeof _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto.getRandomValues === 'function') {\n return _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/@noble/hashes/esm/utils.js?"); + +/***/ }), + +/***/ "./node_modules/@noble/secp256k1/lib/esm/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@noble/secp256k1/lib/esm/index.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("var crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CURVE: () => (/* binding */ CURVE),\n/* harmony export */ Point: () => (/* binding */ Point),\n/* harmony export */ Signature: () => (/* binding */ Signature),\n/* harmony export */ getPublicKey: () => (/* binding */ getPublicKey),\n/* harmony export */ getSharedSecret: () => (/* binding */ getSharedSecret),\n/* harmony export */ recoverPublicKey: () => (/* binding */ recoverPublicKey),\n/* harmony export */ schnorr: () => (/* binding */ schnorr),\n/* harmony export */ sign: () => (/* binding */ sign),\n/* harmony export */ signSync: () => (/* binding */ signSync),\n/* harmony export */ utils: () => (/* binding */ utils),\n/* harmony export */ verify: () => (/* binding */ verify)\n/* harmony export */ });\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crypto */ \"?ce41\");\n/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */\n\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _3n = BigInt(3);\nconst _8n = BigInt(8);\nconst CURVE = Object.freeze({\n a: _0n,\n b: BigInt(7),\n P: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'),\n n: BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'),\n h: _1n,\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n});\nconst divNearest = (a, b) => (a + b / _2n) / b;\nconst endo = {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar(k) {\n const { n } = CURVE;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000');\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = mod(k - c1 * a1 - c2 * a2, n);\n let k2 = mod(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalarEndo: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n};\nconst fieldLen = 32;\nconst groupLen = 32;\nconst hashLen = 32;\nconst compressedLen = fieldLen + 1;\nconst uncompressedLen = 2 * fieldLen + 1;\n\nfunction weierstrass(x) {\n const { a, b } = CURVE;\n const x2 = mod(x * x);\n const x3 = mod(x2 * x);\n return mod(x3 + a * x + b);\n}\nconst USE_ENDOMORPHISM = CURVE.a === _0n;\nclass ShaError extends Error {\n constructor(message) {\n super(message);\n }\n}\nfunction assertJacPoint(other) {\n if (!(other instanceof JacobianPoint))\n throw new TypeError('JacobianPoint expected');\n}\nclass JacobianPoint {\n constructor(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n static fromAffine(p) {\n if (!(p instanceof Point)) {\n throw new TypeError('JacobianPoint#fromAffine: expected Point');\n }\n if (p.equals(Point.ZERO))\n return JacobianPoint.ZERO;\n return new JacobianPoint(p.x, p.y, _1n);\n }\n static toAffineBatch(points) {\n const toInv = invertBatch(points.map((p) => p.z));\n return points.map((p, i) => p.toAffine(toInv[i]));\n }\n static normalizeZ(points) {\n return JacobianPoint.toAffineBatch(points).map(JacobianPoint.fromAffine);\n }\n equals(other) {\n assertJacPoint(other);\n const { x: X1, y: Y1, z: Z1 } = this;\n const { x: X2, y: Y2, z: Z2 } = other;\n const Z1Z1 = mod(Z1 * Z1);\n const Z2Z2 = mod(Z2 * Z2);\n const U1 = mod(X1 * Z2Z2);\n const U2 = mod(X2 * Z1Z1);\n const S1 = mod(mod(Y1 * Z2) * Z2Z2);\n const S2 = mod(mod(Y2 * Z1) * Z1Z1);\n return U1 === U2 && S1 === S2;\n }\n negate() {\n return new JacobianPoint(this.x, mod(-this.y), this.z);\n }\n double() {\n const { x: X1, y: Y1, z: Z1 } = this;\n const A = mod(X1 * X1);\n const B = mod(Y1 * Y1);\n const C = mod(B * B);\n const x1b = X1 + B;\n const D = mod(_2n * (mod(x1b * x1b) - A - C));\n const E = mod(_3n * A);\n const F = mod(E * E);\n const X3 = mod(F - _2n * D);\n const Y3 = mod(E * (D - X3) - _8n * C);\n const Z3 = mod(_2n * Y1 * Z1);\n return new JacobianPoint(X3, Y3, Z3);\n }\n add(other) {\n assertJacPoint(other);\n const { x: X1, y: Y1, z: Z1 } = this;\n const { x: X2, y: Y2, z: Z2 } = other;\n if (X2 === _0n || Y2 === _0n)\n return this;\n if (X1 === _0n || Y1 === _0n)\n return other;\n const Z1Z1 = mod(Z1 * Z1);\n const Z2Z2 = mod(Z2 * Z2);\n const U1 = mod(X1 * Z2Z2);\n const U2 = mod(X2 * Z1Z1);\n const S1 = mod(mod(Y1 * Z2) * Z2Z2);\n const S2 = mod(mod(Y2 * Z1) * Z1Z1);\n const H = mod(U2 - U1);\n const r = mod(S2 - S1);\n if (H === _0n) {\n if (r === _0n) {\n return this.double();\n }\n else {\n return JacobianPoint.ZERO;\n }\n }\n const HH = mod(H * H);\n const HHH = mod(H * HH);\n const V = mod(U1 * HH);\n const X3 = mod(r * r - HHH - _2n * V);\n const Y3 = mod(r * (V - X3) - S1 * HHH);\n const Z3 = mod(Z1 * Z2 * H);\n return new JacobianPoint(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiplyUnsafe(scalar) {\n const P0 = JacobianPoint.ZERO;\n if (typeof scalar === 'bigint' && scalar === _0n)\n return P0;\n let n = normalizeScalar(scalar);\n if (n === _1n)\n return this;\n if (!USE_ENDOMORPHISM) {\n let p = P0;\n let d = this;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n }\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = P0;\n let k2p = P0;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new JacobianPoint(mod(k2p.x * endo.beta), k2p.y, k2p.z);\n return k1p.add(k2p);\n }\n precomputeWindow(W) {\n const windows = USE_ENDOMORPHISM ? 128 / W + 1 : 256 / W + 1;\n const points = [];\n let p = this;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n for (let i = 1; i < 2 ** (W - 1); i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n }\n wNAF(n, affinePoint) {\n if (!affinePoint && this.equals(JacobianPoint.BASE))\n affinePoint = Point.BASE;\n const W = (affinePoint && affinePoint._WINDOW_SIZE) || 1;\n if (256 % W) {\n throw new Error('Point#wNAF: Invalid precomputation window, must be power of 2');\n }\n let precomputes = affinePoint && pointPrecomputes.get(affinePoint);\n if (!precomputes) {\n precomputes = this.precomputeWindow(W);\n if (affinePoint && W !== 1) {\n precomputes = JacobianPoint.normalizeZ(precomputes);\n pointPrecomputes.set(affinePoint, precomputes);\n }\n }\n let p = JacobianPoint.ZERO;\n let f = JacobianPoint.BASE;\n const windows = 1 + (USE_ENDOMORPHISM ? 128 / W : 256 / W);\n const windowSize = 2 ** (W - 1);\n const mask = BigInt(2 ** W - 1);\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n let wbits = Number(n & mask);\n n >>= shiftBy;\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1;\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n return { p, f };\n }\n multiply(scalar, affinePoint) {\n let n = normalizeScalar(scalar);\n let point;\n let fake;\n if (USE_ENDOMORPHISM) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1, affinePoint);\n let { p: k2p, f: f2p } = this.wNAF(k2, affinePoint);\n k1p = constTimeNegate(k1neg, k1p);\n k2p = constTimeNegate(k2neg, k2p);\n k2p = new JacobianPoint(mod(k2p.x * endo.beta), k2p.y, k2p.z);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(n, affinePoint);\n point = p;\n fake = f;\n }\n return JacobianPoint.normalizeZ([point, fake])[0];\n }\n toAffine(invZ) {\n const { x, y, z } = this;\n const is0 = this.equals(JacobianPoint.ZERO);\n if (invZ == null)\n invZ = is0 ? _8n : invert(z);\n const iz1 = invZ;\n const iz2 = mod(iz1 * iz1);\n const iz3 = mod(iz2 * iz1);\n const ax = mod(x * iz2);\n const ay = mod(y * iz3);\n const zz = mod(z * iz1);\n if (is0)\n return Point.ZERO;\n if (zz !== _1n)\n throw new Error('invZ was invalid');\n return new Point(ax, ay);\n }\n}\nJacobianPoint.BASE = new JacobianPoint(CURVE.Gx, CURVE.Gy, _1n);\nJacobianPoint.ZERO = new JacobianPoint(_0n, _1n, _0n);\nfunction constTimeNegate(condition, item) {\n const neg = item.negate();\n return condition ? neg : item;\n}\nconst pointPrecomputes = new WeakMap();\nclass Point {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n }\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n hasEvenY() {\n return this.y % _2n === _0n;\n }\n static fromCompressedHex(bytes) {\n const isShort = bytes.length === 32;\n const x = bytesToNumber(isShort ? bytes : bytes.subarray(1));\n if (!isValidFieldElement(x))\n throw new Error('Point is not on curve');\n const y2 = weierstrass(x);\n let y = sqrtMod(y2);\n const isYOdd = (y & _1n) === _1n;\n if (isShort) {\n if (isYOdd)\n y = mod(-y);\n }\n else {\n const isFirstByteOdd = (bytes[0] & 1) === 1;\n if (isFirstByteOdd !== isYOdd)\n y = mod(-y);\n }\n const point = new Point(x, y);\n point.assertValidity();\n return point;\n }\n static fromUncompressedHex(bytes) {\n const x = bytesToNumber(bytes.subarray(1, fieldLen + 1));\n const y = bytesToNumber(bytes.subarray(fieldLen + 1, fieldLen * 2 + 1));\n const point = new Point(x, y);\n point.assertValidity();\n return point;\n }\n static fromHex(hex) {\n const bytes = ensureBytes(hex);\n const len = bytes.length;\n const header = bytes[0];\n if (len === fieldLen)\n return this.fromCompressedHex(bytes);\n if (len === compressedLen && (header === 0x02 || header === 0x03)) {\n return this.fromCompressedHex(bytes);\n }\n if (len === uncompressedLen && header === 0x04)\n return this.fromUncompressedHex(bytes);\n throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not ${len}`);\n }\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normalizePrivateKey(privateKey));\n }\n static fromSignature(msgHash, signature, recovery) {\n const { r, s } = normalizeSignature(signature);\n if (![0, 1, 2, 3].includes(recovery))\n throw new Error('Cannot recover: invalid recovery bit');\n const h = truncateHash(ensureBytes(msgHash));\n const { n } = CURVE;\n const radj = recovery === 2 || recovery === 3 ? r + n : r;\n const rinv = invert(radj, n);\n const u1 = mod(-h * rinv, n);\n const u2 = mod(s * rinv, n);\n const prefix = recovery & 1 ? '03' : '02';\n const R = Point.fromHex(prefix + numTo32bStr(radj));\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2);\n if (!Q)\n throw new Error('Cannot recover signature: point at infinify');\n Q.assertValidity();\n return Q;\n }\n toRawBytes(isCompressed = false) {\n return hexToBytes(this.toHex(isCompressed));\n }\n toHex(isCompressed = false) {\n const x = numTo32bStr(this.x);\n if (isCompressed) {\n const prefix = this.hasEvenY() ? '02' : '03';\n return `${prefix}${x}`;\n }\n else {\n return `04${x}${numTo32bStr(this.y)}`;\n }\n }\n toHexX() {\n return this.toHex(true).slice(2);\n }\n toRawX() {\n return this.toRawBytes(true).slice(1);\n }\n assertValidity() {\n const msg = 'Point is not on elliptic curve';\n const { x, y } = this;\n if (!isValidFieldElement(x) || !isValidFieldElement(y))\n throw new Error(msg);\n const left = mod(y * y);\n const right = weierstrass(x);\n if (mod(left - right) !== _0n)\n throw new Error(msg);\n }\n equals(other) {\n return this.x === other.x && this.y === other.y;\n }\n negate() {\n return new Point(this.x, mod(-this.y));\n }\n double() {\n return JacobianPoint.fromAffine(this).double().toAffine();\n }\n add(other) {\n return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(other)).toAffine();\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiply(scalar) {\n return JacobianPoint.fromAffine(this).multiply(scalar, this).toAffine();\n }\n multiplyAndAddUnsafe(Q, a, b) {\n const P = JacobianPoint.fromAffine(this);\n const aP = a === _0n || a === _1n || this !== Point.BASE ? P.multiplyUnsafe(a) : P.multiply(a);\n const bQ = JacobianPoint.fromAffine(Q).multiplyUnsafe(b);\n const sum = aP.add(bQ);\n return sum.equals(JacobianPoint.ZERO) ? undefined : sum.toAffine();\n }\n}\nPoint.BASE = new Point(CURVE.Gx, CURVE.Gy);\nPoint.ZERO = new Point(_0n, _0n);\nfunction sliceDER(s) {\n return Number.parseInt(s[0], 16) >= 8 ? '00' + s : s;\n}\nfunction parseDERInt(data) {\n if (data.length < 2 || data[0] !== 0x02) {\n throw new Error(`Invalid signature integer tag: ${bytesToHex(data)}`);\n }\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len) {\n throw new Error(`Invalid signature integer: wrong length`);\n }\n if (res[0] === 0x00 && res[1] <= 0x7f) {\n throw new Error('Invalid signature integer: trailing length');\n }\n return { data: bytesToNumber(res), left: data.subarray(len + 2) };\n}\nfunction parseDERSignature(data) {\n if (data.length < 2 || data[0] != 0x30) {\n throw new Error(`Invalid signature tag: ${bytesToHex(data)}`);\n }\n if (data[1] !== data.length - 2) {\n throw new Error('Invalid signature: incorrect length');\n }\n const { data: r, left: sBytes } = parseDERInt(data.subarray(2));\n const { data: s, left: rBytesLeft } = parseDERInt(sBytes);\n if (rBytesLeft.length) {\n throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex(rBytesLeft)}`);\n }\n return { r, s };\n}\nclass Signature {\n constructor(r, s) {\n this.r = r;\n this.s = s;\n this.assertValidity();\n }\n static fromCompact(hex) {\n const arr = hex instanceof Uint8Array;\n const name = 'Signature.fromCompact';\n if (typeof hex !== 'string' && !arr)\n throw new TypeError(`${name}: Expected string or Uint8Array`);\n const str = arr ? bytesToHex(hex) : hex;\n if (str.length !== 128)\n throw new Error(`${name}: Expected 64-byte hex`);\n return new Signature(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));\n }\n static fromDER(hex) {\n const arr = hex instanceof Uint8Array;\n if (typeof hex !== 'string' && !arr)\n throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`);\n const { r, s } = parseDERSignature(arr ? hex : hexToBytes(hex));\n return new Signature(r, s);\n }\n static fromHex(hex) {\n return this.fromDER(hex);\n }\n assertValidity() {\n const { r, s } = this;\n if (!isWithinCurveOrder(r))\n throw new Error('Invalid Signature: r must be 0 < r < n');\n if (!isWithinCurveOrder(s))\n throw new Error('Invalid Signature: s must be 0 < s < n');\n }\n hasHighS() {\n const HALF = CURVE.n >> _1n;\n return this.s > HALF;\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, mod(-this.s, CURVE.n)) : this;\n }\n toDERRawBytes() {\n return hexToBytes(this.toDERHex());\n }\n toDERHex() {\n const sHex = sliceDER(numberToHexUnpadded(this.s));\n const rHex = sliceDER(numberToHexUnpadded(this.r));\n const sHexL = sHex.length / 2;\n const rHexL = rHex.length / 2;\n const sLen = numberToHexUnpadded(sHexL);\n const rLen = numberToHexUnpadded(rHexL);\n const length = numberToHexUnpadded(rHexL + sHexL + 4);\n return `30${length}02${rLen}${rHex}02${sLen}${sHex}`;\n }\n toRawBytes() {\n return this.toDERRawBytes();\n }\n toHex() {\n return this.toDERHex();\n }\n toCompactRawBytes() {\n return hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numTo32bStr(this.r) + numTo32bStr(this.s);\n }\n}\nfunction concatBytes(...arrays) {\n if (!arrays.every((b) => b instanceof Uint8Array))\n throw new Error('Uint8Array list expected');\n if (arrays.length === 1)\n return arrays[0];\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const arr = arrays[i];\n result.set(arr, pad);\n pad += arr.length;\n }\n return result;\n}\nconst hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));\nfunction bytesToHex(uint8a) {\n if (!(uint8a instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n let hex = '';\n for (let i = 0; i < uint8a.length; i++) {\n hex += hexes[uint8a[i]];\n }\n return hex;\n}\nconst POW_2_256 = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000');\nfunction numTo32bStr(num) {\n if (typeof num !== 'bigint')\n throw new Error('Expected bigint');\n if (!(_0n <= num && num < POW_2_256))\n throw new Error('Expected number 0 <= n < 2^256');\n return num.toString(16).padStart(64, '0');\n}\nfunction numTo32b(num) {\n const b = hexToBytes(numTo32bStr(num));\n if (b.length !== 32)\n throw new Error('Error: expected 32 bytes');\n return b;\n}\nfunction numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nfunction hexToNumber(hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToNumber: expected string, got ' + typeof hex);\n }\n return BigInt(`0x${hex}`);\n}\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToBytes: expected string, got ' + typeof hex);\n }\n if (hex.length % 2)\n throw new Error('hexToBytes: received invalid unpadded hex' + hex.length);\n const array = new Uint8Array(hex.length / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\nfunction bytesToNumber(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nfunction ensureBytes(hex) {\n return hex instanceof Uint8Array ? Uint8Array.from(hex) : hexToBytes(hex);\n}\nfunction normalizeScalar(num) {\n if (typeof num === 'number' && Number.isSafeInteger(num) && num > 0)\n return BigInt(num);\n if (typeof num === 'bigint' && isWithinCurveOrder(num))\n return num;\n throw new TypeError('Expected valid private scalar: 0 < scalar < curve.n');\n}\nfunction mod(a, b = CURVE.P) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\nfunction pow2(x, power) {\n const { P } = CURVE;\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= P;\n }\n return res;\n}\nfunction sqrtMod(x) {\n const { P } = CURVE;\n const _6n = BigInt(6);\n const _11n = BigInt(11);\n const _22n = BigInt(22);\n const _23n = BigInt(23);\n const _44n = BigInt(44);\n const _88n = BigInt(88);\n const b2 = (x * x * x) % P;\n const b3 = (b2 * b2 * x) % P;\n const b6 = (pow2(b3, _3n) * b3) % P;\n const b9 = (pow2(b6, _3n) * b3) % P;\n const b11 = (pow2(b9, _2n) * b2) % P;\n const b22 = (pow2(b11, _11n) * b11) % P;\n const b44 = (pow2(b22, _22n) * b22) % P;\n const b88 = (pow2(b44, _44n) * b44) % P;\n const b176 = (pow2(b88, _88n) * b88) % P;\n const b220 = (pow2(b176, _44n) * b44) % P;\n const b223 = (pow2(b220, _3n) * b3) % P;\n const t1 = (pow2(b223, _23n) * b22) % P;\n const t2 = (pow2(t1, _6n) * b2) % P;\n const rt = pow2(t2, _2n);\n const xc = (rt * rt) % P;\n if (xc !== x)\n throw new Error('Cannot find square root');\n return rt;\n}\nfunction invert(number, modulo = CURVE.P) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n let a = mod(number, modulo);\n let b = modulo;\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\nfunction invertBatch(nums, p = CURVE.P) {\n const scratch = new Array(nums.length);\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (num === _0n)\n return acc;\n scratch[i] = acc;\n return mod(acc * num, p);\n }, _1n);\n const inverted = invert(lastMultiplied, p);\n nums.reduceRight((acc, num, i) => {\n if (num === _0n)\n return acc;\n scratch[i] = mod(acc * scratch[i], p);\n return mod(acc * num, p);\n }, inverted);\n return scratch;\n}\nfunction bits2int_2(bytes) {\n const delta = bytes.length * 8 - groupLen * 8;\n const num = bytesToNumber(bytes);\n return delta > 0 ? num >> BigInt(delta) : num;\n}\nfunction truncateHash(hash, truncateOnly = false) {\n const h = bits2int_2(hash);\n if (truncateOnly)\n return h;\n const { n } = CURVE;\n return h >= n ? h - n : h;\n}\nlet _sha256Sync;\nlet _hmacSha256Sync;\nclass HmacDrbg {\n constructor(hashLen, qByteLen) {\n this.hashLen = hashLen;\n this.qByteLen = qByteLen;\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n this.v = new Uint8Array(hashLen).fill(1);\n this.k = new Uint8Array(hashLen).fill(0);\n this.counter = 0;\n }\n hmac(...values) {\n return utils.hmacSha256(this.k, ...values);\n }\n hmacSync(...values) {\n return _hmacSha256Sync(this.k, ...values);\n }\n checkSync() {\n if (typeof _hmacSha256Sync !== 'function')\n throw new ShaError('hmacSha256Sync needs to be set');\n }\n incr() {\n if (this.counter >= 1000)\n throw new Error('Tried 1,000 k values for sign(), all were invalid');\n this.counter += 1;\n }\n async reseed(seed = new Uint8Array()) {\n this.k = await this.hmac(this.v, Uint8Array.from([0x00]), seed);\n this.v = await this.hmac(this.v);\n if (seed.length === 0)\n return;\n this.k = await this.hmac(this.v, Uint8Array.from([0x01]), seed);\n this.v = await this.hmac(this.v);\n }\n reseedSync(seed = new Uint8Array()) {\n this.checkSync();\n this.k = this.hmacSync(this.v, Uint8Array.from([0x00]), seed);\n this.v = this.hmacSync(this.v);\n if (seed.length === 0)\n return;\n this.k = this.hmacSync(this.v, Uint8Array.from([0x01]), seed);\n this.v = this.hmacSync(this.v);\n }\n async generate() {\n this.incr();\n let len = 0;\n const out = [];\n while (len < this.qByteLen) {\n this.v = await this.hmac(this.v);\n const sl = this.v.slice();\n out.push(sl);\n len += this.v.length;\n }\n return concatBytes(...out);\n }\n generateSync() {\n this.checkSync();\n this.incr();\n let len = 0;\n const out = [];\n while (len < this.qByteLen) {\n this.v = this.hmacSync(this.v);\n const sl = this.v.slice();\n out.push(sl);\n len += this.v.length;\n }\n return concatBytes(...out);\n }\n}\nfunction isWithinCurveOrder(num) {\n return _0n < num && num < CURVE.n;\n}\nfunction isValidFieldElement(num) {\n return _0n < num && num < CURVE.P;\n}\nfunction kmdToSig(kBytes, m, d, lowS = true) {\n const { n } = CURVE;\n const k = truncateHash(kBytes, true);\n if (!isWithinCurveOrder(k))\n return;\n const kinv = invert(k, n);\n const q = Point.BASE.multiply(k);\n const r = mod(q.x, n);\n if (r === _0n)\n return;\n const s = mod(kinv * mod(m + d * r, n), n);\n if (s === _0n)\n return;\n let sig = new Signature(r, s);\n let recovery = (q.x === sig.r ? 0 : 2) | Number(q.y & _1n);\n if (lowS && sig.hasHighS()) {\n sig = sig.normalizeS();\n recovery ^= 1;\n }\n return { sig, recovery };\n}\nfunction normalizePrivateKey(key) {\n let num;\n if (typeof key === 'bigint') {\n num = key;\n }\n else if (typeof key === 'number' && Number.isSafeInteger(key) && key > 0) {\n num = BigInt(key);\n }\n else if (typeof key === 'string') {\n if (key.length !== 2 * groupLen)\n throw new Error('Expected 32 bytes of private key');\n num = hexToNumber(key);\n }\n else if (key instanceof Uint8Array) {\n if (key.length !== groupLen)\n throw new Error('Expected 32 bytes of private key');\n num = bytesToNumber(key);\n }\n else {\n throw new TypeError('Expected valid private key');\n }\n if (!isWithinCurveOrder(num))\n throw new Error('Expected private key: 0 < key < n');\n return num;\n}\nfunction normalizePublicKey(publicKey) {\n if (publicKey instanceof Point) {\n publicKey.assertValidity();\n return publicKey;\n }\n else {\n return Point.fromHex(publicKey);\n }\n}\nfunction normalizeSignature(signature) {\n if (signature instanceof Signature) {\n signature.assertValidity();\n return signature;\n }\n try {\n return Signature.fromDER(signature);\n }\n catch (error) {\n return Signature.fromCompact(signature);\n }\n}\nfunction getPublicKey(privateKey, isCompressed = false) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n}\nfunction recoverPublicKey(msgHash, signature, recovery, isCompressed = false) {\n return Point.fromSignature(msgHash, signature, recovery).toRawBytes(isCompressed);\n}\nfunction isProbPub(item) {\n const arr = item instanceof Uint8Array;\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === compressedLen * 2 || len === uncompressedLen * 2;\n if (item instanceof Point)\n return true;\n return false;\n}\nfunction getSharedSecret(privateA, publicB, isCompressed = false) {\n if (isProbPub(privateA))\n throw new TypeError('getSharedSecret: first arg must be private key');\n if (!isProbPub(publicB))\n throw new TypeError('getSharedSecret: second arg must be public key');\n const b = normalizePublicKey(publicB);\n b.assertValidity();\n return b.multiply(normalizePrivateKey(privateA)).toRawBytes(isCompressed);\n}\nfunction bits2int(bytes) {\n const slice = bytes.length > fieldLen ? bytes.slice(0, fieldLen) : bytes;\n return bytesToNumber(slice);\n}\nfunction bits2octets(bytes) {\n const z1 = bits2int(bytes);\n const z2 = mod(z1, CURVE.n);\n return int2octets(z2 < _0n ? z1 : z2);\n}\nfunction int2octets(num) {\n return numTo32b(num);\n}\nfunction initSigArgs(msgHash, privateKey, extraEntropy) {\n if (msgHash == null)\n throw new Error(`sign: expected valid message hash, not \"${msgHash}\"`);\n const h1 = ensureBytes(msgHash);\n const d = normalizePrivateKey(privateKey);\n const seedArgs = [int2octets(d), bits2octets(h1)];\n if (extraEntropy != null) {\n if (extraEntropy === true)\n extraEntropy = utils.randomBytes(fieldLen);\n const e = ensureBytes(extraEntropy);\n if (e.length !== fieldLen)\n throw new Error(`sign: Expected ${fieldLen} bytes of extra data`);\n seedArgs.push(e);\n }\n const seed = concatBytes(...seedArgs);\n const m = bits2int(h1);\n return { seed, m, d };\n}\nfunction finalizeSig(recSig, opts) {\n const { sig, recovery } = recSig;\n const { der, recovered } = Object.assign({ canonical: true, der: true }, opts);\n const hashed = der ? sig.toDERRawBytes() : sig.toCompactRawBytes();\n return recovered ? [hashed, recovery] : hashed;\n}\nasync function sign(msgHash, privKey, opts = {}) {\n const { seed, m, d } = initSigArgs(msgHash, privKey, opts.extraEntropy);\n const drbg = new HmacDrbg(hashLen, groupLen);\n await drbg.reseed(seed);\n let sig;\n while (!(sig = kmdToSig(await drbg.generate(), m, d, opts.canonical)))\n await drbg.reseed();\n return finalizeSig(sig, opts);\n}\nfunction signSync(msgHash, privKey, opts = {}) {\n const { seed, m, d } = initSigArgs(msgHash, privKey, opts.extraEntropy);\n const drbg = new HmacDrbg(hashLen, groupLen);\n drbg.reseedSync(seed);\n let sig;\n while (!(sig = kmdToSig(drbg.generateSync(), m, d, opts.canonical)))\n drbg.reseedSync();\n return finalizeSig(sig, opts);\n}\n\nconst vopts = { strict: true };\nfunction verify(signature, msgHash, publicKey, opts = vopts) {\n let sig;\n try {\n sig = normalizeSignature(signature);\n msgHash = ensureBytes(msgHash);\n }\n catch (error) {\n return false;\n }\n const { r, s } = sig;\n if (opts.strict && sig.hasHighS())\n return false;\n const h = truncateHash(msgHash);\n let P;\n try {\n P = normalizePublicKey(publicKey);\n }\n catch (error) {\n return false;\n }\n const { n } = CURVE;\n const sinv = invert(s, n);\n const u1 = mod(h * sinv, n);\n const u2 = mod(r * sinv, n);\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2);\n if (!R)\n return false;\n const v = mod(R.x, n);\n return v === r;\n}\nfunction schnorrChallengeFinalize(ch) {\n return mod(bytesToNumber(ch), CURVE.n);\n}\nclass SchnorrSignature {\n constructor(r, s) {\n this.r = r;\n this.s = s;\n this.assertValidity();\n }\n static fromHex(hex) {\n const bytes = ensureBytes(hex);\n if (bytes.length !== 64)\n throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${bytes.length}`);\n const r = bytesToNumber(bytes.subarray(0, 32));\n const s = bytesToNumber(bytes.subarray(32, 64));\n return new SchnorrSignature(r, s);\n }\n assertValidity() {\n const { r, s } = this;\n if (!isValidFieldElement(r) || !isWithinCurveOrder(s))\n throw new Error('Invalid signature');\n }\n toHex() {\n return numTo32bStr(this.r) + numTo32bStr(this.s);\n }\n toRawBytes() {\n return hexToBytes(this.toHex());\n }\n}\nfunction schnorrGetPublicKey(privateKey) {\n return Point.fromPrivateKey(privateKey).toRawX();\n}\nclass InternalSchnorrSignature {\n constructor(message, privateKey, auxRand = utils.randomBytes()) {\n if (message == null)\n throw new TypeError(`sign: Expected valid message, not \"${message}\"`);\n this.m = ensureBytes(message);\n const { x, scalar } = this.getScalar(normalizePrivateKey(privateKey));\n this.px = x;\n this.d = scalar;\n this.rand = ensureBytes(auxRand);\n if (this.rand.length !== 32)\n throw new TypeError('sign: Expected 32 bytes of aux randomness');\n }\n getScalar(priv) {\n const point = Point.fromPrivateKey(priv);\n const scalar = point.hasEvenY() ? priv : CURVE.n - priv;\n return { point, scalar, x: point.toRawX() };\n }\n initNonce(d, t0h) {\n return numTo32b(d ^ bytesToNumber(t0h));\n }\n finalizeNonce(k0h) {\n const k0 = mod(bytesToNumber(k0h), CURVE.n);\n if (k0 === _0n)\n throw new Error('sign: Creation of signature failed. k is zero');\n const { point: R, x: rx, scalar: k } = this.getScalar(k0);\n return { R, rx, k };\n }\n finalizeSig(R, k, e, d) {\n return new SchnorrSignature(R.x, mod(k + e * d, CURVE.n)).toRawBytes();\n }\n error() {\n throw new Error('sign: Invalid signature produced');\n }\n async calc() {\n const { m, d, px, rand } = this;\n const tag = utils.taggedHash;\n const t = this.initNonce(d, await tag(TAGS.aux, rand));\n const { R, rx, k } = this.finalizeNonce(await tag(TAGS.nonce, t, px, m));\n const e = schnorrChallengeFinalize(await tag(TAGS.challenge, rx, px, m));\n const sig = this.finalizeSig(R, k, e, d);\n if (!(await schnorrVerify(sig, m, px)))\n this.error();\n return sig;\n }\n calcSync() {\n const { m, d, px, rand } = this;\n const tag = utils.taggedHashSync;\n const t = this.initNonce(d, tag(TAGS.aux, rand));\n const { R, rx, k } = this.finalizeNonce(tag(TAGS.nonce, t, px, m));\n const e = schnorrChallengeFinalize(tag(TAGS.challenge, rx, px, m));\n const sig = this.finalizeSig(R, k, e, d);\n if (!schnorrVerifySync(sig, m, px))\n this.error();\n return sig;\n }\n}\nasync function schnorrSign(msg, privKey, auxRand) {\n return new InternalSchnorrSignature(msg, privKey, auxRand).calc();\n}\nfunction schnorrSignSync(msg, privKey, auxRand) {\n return new InternalSchnorrSignature(msg, privKey, auxRand).calcSync();\n}\nfunction initSchnorrVerify(signature, message, publicKey) {\n const raw = signature instanceof SchnorrSignature;\n const sig = raw ? signature : SchnorrSignature.fromHex(signature);\n if (raw)\n sig.assertValidity();\n return {\n ...sig,\n m: ensureBytes(message),\n P: normalizePublicKey(publicKey),\n };\n}\nfunction finalizeSchnorrVerify(r, P, s, e) {\n const R = Point.BASE.multiplyAndAddUnsafe(P, normalizePrivateKey(s), mod(-e, CURVE.n));\n if (!R || !R.hasEvenY() || R.x !== r)\n return false;\n return true;\n}\nasync function schnorrVerify(signature, message, publicKey) {\n try {\n const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey);\n const e = schnorrChallengeFinalize(await utils.taggedHash(TAGS.challenge, numTo32b(r), P.toRawX(), m));\n return finalizeSchnorrVerify(r, P, s, e);\n }\n catch (error) {\n return false;\n }\n}\nfunction schnorrVerifySync(signature, message, publicKey) {\n try {\n const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey);\n const e = schnorrChallengeFinalize(utils.taggedHashSync(TAGS.challenge, numTo32b(r), P.toRawX(), m));\n return finalizeSchnorrVerify(r, P, s, e);\n }\n catch (error) {\n if (error instanceof ShaError)\n throw error;\n return false;\n }\n}\nconst schnorr = {\n Signature: SchnorrSignature,\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n signSync: schnorrSignSync,\n verifySync: schnorrVerifySync,\n};\nPoint.BASE._setWindowSize(8);\nconst crypto = {\n node: /*#__PURE__*/ (crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (crypto__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(crypto__WEBPACK_IMPORTED_MODULE_0__, 2))),\n web: typeof self === 'object' && 'crypto' in self ? self.crypto : undefined,\n};\nconst TAGS = {\n challenge: 'BIP0340/challenge',\n aux: 'BIP0340/aux',\n nonce: 'BIP0340/nonce',\n};\nconst TAGGED_HASH_PREFIXES = {};\nconst utils = {\n bytesToHex,\n hexToBytes,\n concatBytes,\n mod,\n invert,\n isValidPrivateKey(privateKey) {\n try {\n normalizePrivateKey(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n _bigintTo32Bytes: numTo32b,\n _normalizePrivateKey: normalizePrivateKey,\n hashToPrivateKey: (hash) => {\n hash = ensureBytes(hash);\n const minLen = groupLen + 8;\n if (hash.length < minLen || hash.length > 1024) {\n throw new Error(`Expected valid bytes of private key as per FIPS 186`);\n }\n const num = mod(bytesToNumber(hash), CURVE.n - _1n) + _1n;\n return numTo32b(num);\n },\n randomBytes: (bytesLength = 32) => {\n if (crypto.web) {\n return crypto.web.getRandomValues(new Uint8Array(bytesLength));\n }\n else if (crypto.node) {\n const { randomBytes } = crypto.node;\n return Uint8Array.from(randomBytes(bytesLength));\n }\n else {\n throw new Error(\"The environment doesn't have randomBytes function\");\n }\n },\n randomPrivateKey: () => utils.hashToPrivateKey(utils.randomBytes(groupLen + 8)),\n precompute(windowSize = 8, point = Point.BASE) {\n const cached = point === Point.BASE ? point : new Point(point.x, point.y);\n cached._setWindowSize(windowSize);\n cached.multiply(_3n);\n return cached;\n },\n sha256: async (...messages) => {\n if (crypto.web) {\n const buffer = await crypto.web.subtle.digest('SHA-256', concatBytes(...messages));\n return new Uint8Array(buffer);\n }\n else if (crypto.node) {\n const { createHash } = crypto.node;\n const hash = createHash('sha256');\n messages.forEach((m) => hash.update(m));\n return Uint8Array.from(hash.digest());\n }\n else {\n throw new Error(\"The environment doesn't have sha256 function\");\n }\n },\n hmacSha256: async (key, ...messages) => {\n if (crypto.web) {\n const ckey = await crypto.web.subtle.importKey('raw', key, { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']);\n const message = concatBytes(...messages);\n const buffer = await crypto.web.subtle.sign('HMAC', ckey, message);\n return new Uint8Array(buffer);\n }\n else if (crypto.node) {\n const { createHmac } = crypto.node;\n const hash = createHmac('sha256', key);\n messages.forEach((m) => hash.update(m));\n return Uint8Array.from(hash.digest());\n }\n else {\n throw new Error(\"The environment doesn't have hmac-sha256 function\");\n }\n },\n sha256Sync: undefined,\n hmacSha256Sync: undefined,\n taggedHash: async (tag, ...messages) => {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = await utils.sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return utils.sha256(tagP, ...messages);\n },\n taggedHashSync: (tag, ...messages) => {\n if (typeof _sha256Sync !== 'function')\n throw new ShaError('sha256Sync is undefined, you need to set it');\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = _sha256Sync(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return _sha256Sync(tagP, ...messages);\n },\n _JacobianPoint: JacobianPoint,\n};\nObject.defineProperties(utils, {\n sha256Sync: {\n configurable: false,\n get() {\n return _sha256Sync;\n },\n set(val) {\n if (!_sha256Sync)\n _sha256Sync = val;\n },\n },\n hmacSha256Sync: {\n configurable: false,\n get() {\n return _hmacSha256Sync;\n },\n set(val) {\n if (!_hmacSha256Sync)\n _hmacSha256Sync = val;\n },\n },\n});\n\n\n//# sourceURL=webpack://light/./node_modules/@noble/secp256k1/lib/esm/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/index.js": +/*!***********************************************!*\ + !*** ./node_modules/@waku/core/dist/index.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionManager: () => (/* reexport safe */ _lib_connection_manager_js__WEBPACK_IMPORTED_MODULE_8__.ConnectionManager),\n/* harmony export */ DefaultPubSubTopic: () => (/* reexport safe */ _lib_constants_js__WEBPACK_IMPORTED_MODULE_1__.DefaultPubSubTopic),\n/* harmony export */ DefaultUserAgent: () => (/* reexport safe */ _lib_waku_js__WEBPACK_IMPORTED_MODULE_0__.DefaultUserAgent),\n/* harmony export */ KeepAliveManager: () => (/* reexport safe */ _lib_keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_9__.KeepAliveManager),\n/* harmony export */ LightPushCodec: () => (/* reexport safe */ _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_5__.LightPushCodec),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_6__.PageDirection),\n/* harmony export */ StoreCodec: () => (/* reexport safe */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_6__.StoreCodec),\n/* harmony export */ WakuNode: () => (/* reexport safe */ _lib_waku_js__WEBPACK_IMPORTED_MODULE_0__.WakuNode),\n/* harmony export */ createCursor: () => (/* reexport safe */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_6__.createCursor),\n/* harmony export */ createDecoder: () => (/* reexport safe */ _lib_message_version_0_js__WEBPACK_IMPORTED_MODULE_2__.createDecoder),\n/* harmony export */ createEncoder: () => (/* reexport safe */ _lib_message_version_0_js__WEBPACK_IMPORTED_MODULE_2__.createEncoder),\n/* harmony export */ message: () => (/* reexport module object */ _lib_message_index_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ waitForRemotePeer: () => (/* reexport safe */ _lib_wait_for_remote_peer_js__WEBPACK_IMPORTED_MODULE_7__.waitForRemotePeer),\n/* harmony export */ waku: () => (/* reexport module object */ _lib_waku_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ wakuFilter: () => (/* reexport safe */ _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_4__.wakuFilter),\n/* harmony export */ wakuLightPush: () => (/* reexport safe */ _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_5__.wakuLightPush),\n/* harmony export */ wakuStore: () => (/* reexport safe */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_6__.wakuStore),\n/* harmony export */ waku_filter: () => (/* reexport module object */ _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ waku_light_push: () => (/* reexport module object */ _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_5__),\n/* harmony export */ waku_store: () => (/* reexport module object */ _lib_store_index_js__WEBPACK_IMPORTED_MODULE_6__)\n/* harmony export */ });\n/* harmony import */ var _lib_waku_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/waku.js */ \"./node_modules/@waku/core/dist/lib/waku.js\");\n/* harmony import */ var _lib_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/constants.js */ \"./node_modules/@waku/core/dist/lib/constants.js\");\n/* harmony import */ var _lib_message_version_0_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/message/version_0.js */ \"./node_modules/@waku/core/dist/lib/message/version_0.js\");\n/* harmony import */ var _lib_message_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/message/index.js */ \"./node_modules/@waku/core/dist/lib/message/index.js\");\n/* harmony import */ var _lib_filter_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/filter/index.js */ \"./node_modules/@waku/core/dist/lib/filter/index.js\");\n/* harmony import */ var _lib_light_push_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/light_push/index.js */ \"./node_modules/@waku/core/dist/lib/light_push/index.js\");\n/* harmony import */ var _lib_store_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/store/index.js */ \"./node_modules/@waku/core/dist/lib/store/index.js\");\n/* harmony import */ var _lib_wait_for_remote_peer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/wait_for_remote_peer.js */ \"./node_modules/@waku/core/dist/lib/wait_for_remote_peer.js\");\n/* harmony import */ var _lib_connection_manager_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lib/connection_manager.js */ \"./node_modules/@waku/core/dist/lib/connection_manager.js\");\n/* harmony import */ var _lib_keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lib/keep_alive_manager.js */ \"./node_modules/@waku/core/dist/lib/keep_alive_manager.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/base_protocol.js": +/*!***********************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/base_protocol.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseProtocol: () => (/* binding */ BaseProtocol)\n/* harmony export */ });\n/* harmony import */ var _waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils/libp2p */ \"./node_modules/@waku/utils/dist/libp2p/index.js\");\n\n/**\n * A class with predefined helpers, to be used as a base to implement Waku\n * Protocols.\n */\nclass BaseProtocol {\n multicodec;\n components;\n addLibp2pEventListener;\n removeLibp2pEventListener;\n constructor(multicodec, components) {\n this.multicodec = multicodec;\n this.components = components;\n this.addLibp2pEventListener = components.events.addEventListener.bind(components.events);\n this.removeLibp2pEventListener = components.events.removeEventListener.bind(components.events);\n }\n get peerStore() {\n return this.components.peerStore;\n }\n /**\n * Returns known peers from the address book (`libp2p.peerStore`) that support\n * the class protocol. Waku may or may not be currently connected to these\n * peers.\n */\n async peers() {\n return (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_0__.getPeersForProtocol)(this.peerStore, [this.multicodec]);\n }\n async getPeer(peerId) {\n const { peer } = await (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_0__.selectPeerForProtocol)(this.peerStore, [this.multicodec], peerId);\n return peer;\n }\n async newStream(peer) {\n const connections = this.components.connectionManager.getConnections(peer.id);\n const connection = (0,_waku_utils_libp2p__WEBPACK_IMPORTED_MODULE_0__.selectConnection)(connections);\n if (!connection) {\n throw new Error(\"Failed to get a connection to the peer\");\n }\n return connection.newStream(this.multicodec);\n }\n}\n//# sourceMappingURL=base_protocol.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/base_protocol.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/connection_manager.js": +/*!****************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/connection_manager.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionManager: () => (/* binding */ ConnectionManager),\n/* harmony export */ DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED: () => (/* binding */ DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED),\n/* harmony export */ DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER: () => (/* binding */ DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER),\n/* harmony export */ DEFAULT_MAX_PARALLEL_DIALS: () => (/* binding */ DEFAULT_MAX_PARALLEL_DIALS)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./keep_alive_manager.js */ \"./node_modules/@waku/core/dist/lib/keep_alive_manager.js\");\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_2__(\"waku:connection-manager\");\nconst DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED = 1;\nconst DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER = 3;\nconst DEFAULT_MAX_PARALLEL_DIALS = 3;\nclass ConnectionManager extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter {\n static instances = new Map();\n keepAliveManager;\n options;\n libp2p;\n dialAttemptsForPeer = new Map();\n dialErrorsForPeer = new Map();\n currentActiveDialCount = 0;\n pendingPeerDialQueue = [];\n static create(peerId, libp2p, keepAliveOptions, relay, options) {\n let instance = ConnectionManager.instances.get(peerId);\n if (!instance) {\n instance = new ConnectionManager(libp2p, keepAliveOptions, relay, options);\n ConnectionManager.instances.set(peerId, instance);\n }\n return instance;\n }\n async getPeersByDiscovery() {\n const peersDiscovered = await this.libp2p.peerStore.all();\n const peersConnected = this.libp2p\n .getConnections()\n .map((conn) => conn.remotePeer);\n const peersDiscoveredByBootstrap = [];\n const peersDiscoveredByPeerExchange = [];\n const peersConnectedByBootstrap = [];\n const peersConnectedByPeerExchange = [];\n for (const peer of peersDiscovered) {\n const tags = await this.getTagNamesForPeer(peer.id);\n if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP)) {\n peersDiscoveredByBootstrap.push(peer);\n }\n else if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.PEER_EXCHANGE)) {\n peersDiscoveredByPeerExchange.push(peer);\n }\n }\n for (const peerId of peersConnected) {\n const peer = await this.libp2p.peerStore.get(peerId);\n const tags = await this.getTagNamesForPeer(peerId);\n if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP)) {\n peersConnectedByBootstrap.push(peer);\n }\n else if (tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.PEER_EXCHANGE)) {\n peersConnectedByPeerExchange.push(peer);\n }\n }\n return {\n DISCOVERED: {\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP]: peersDiscoveredByBootstrap,\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.PEER_EXCHANGE]: peersDiscoveredByPeerExchange,\n },\n CONNECTED: {\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP]: peersConnectedByBootstrap,\n [_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.PEER_EXCHANGE]: peersConnectedByPeerExchange,\n },\n };\n }\n constructor(libp2p, keepAliveOptions, relay, options) {\n super();\n this.libp2p = libp2p;\n this.options = {\n maxDialAttemptsForPeer: DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER,\n maxBootstrapPeersAllowed: DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED,\n maxParallelDials: DEFAULT_MAX_PARALLEL_DIALS,\n ...options,\n };\n this.keepAliveManager = new _keep_alive_manager_js__WEBPACK_IMPORTED_MODULE_3__.KeepAliveManager(keepAliveOptions, relay);\n this.run()\n .then(() => log(`Connection Manager is now running`))\n .catch((error) => log(`Unexpected error while running service`, error));\n // libp2p emits `peer:discovery` events during its initialization\n // which means that before the ConnectionManager is initialized, some peers may have been discovered\n // we will dial the peers in peerStore ONCE before we start to listen to the `peer:discovery` events within the ConnectionManager\n this.dialPeerStorePeers().catch((error) => log(`Unexpected error while dialing peer store peers`, error));\n }\n async dialPeerStorePeers() {\n const peerInfos = await this.libp2p.peerStore.all();\n const dialPromises = [];\n for (const peerInfo of peerInfos) {\n if (this.libp2p.getConnections().find((c) => c.remotePeer === peerInfo.id))\n continue;\n dialPromises.push(this.attemptDial(peerInfo.id));\n }\n try {\n await Promise.all(dialPromises);\n }\n catch (error) {\n log(`Unexpected error while dialing peer store peers`, error);\n }\n }\n async run() {\n // start event listeners\n this.startPeerDiscoveryListener();\n this.startPeerConnectionListener();\n this.startPeerDisconnectionListener();\n }\n stop() {\n this.keepAliveManager.stopAll();\n this.libp2p.removeEventListener(\"peer:connect\", this.onEventHandlers[\"peer:connect\"]);\n this.libp2p.removeEventListener(\"peer:disconnect\", this.onEventHandlers[\"peer:disconnect\"]);\n this.libp2p.removeEventListener(\"peer:discovery\", this.onEventHandlers[\"peer:discovery\"]);\n }\n async dialPeer(peerId) {\n this.currentActiveDialCount += 1;\n let dialAttempt = 0;\n while (dialAttempt <= this.options.maxDialAttemptsForPeer) {\n try {\n log(`Dialing peer ${peerId.toString()}`);\n await this.libp2p.dial(peerId);\n const tags = await this.getTagNamesForPeer(peerId);\n // add tag to connection describing discovery mechanism\n // don't add duplicate tags\n this.libp2p\n .getConnections(peerId)\n .forEach((conn) => (conn.tags = Array.from(new Set([...conn.tags, ...tags]))));\n this.dialAttemptsForPeer.delete(peerId.toString());\n return;\n }\n catch (e) {\n const error = e;\n this.dialErrorsForPeer.set(peerId.toString(), error);\n log(`Error dialing peer ${peerId.toString()} - ${error.errors}`);\n dialAttempt = this.dialAttemptsForPeer.get(peerId.toString()) ?? 1;\n this.dialAttemptsForPeer.set(peerId.toString(), dialAttempt + 1);\n if (dialAttempt <= this.options.maxDialAttemptsForPeer) {\n log(`Reattempting dial (${dialAttempt})`);\n }\n }\n }\n try {\n log(`Deleting undialable peer ${peerId.toString()} from peer store. Error: ${JSON.stringify(this.dialErrorsForPeer.get(peerId.toString()).errors[0])}\n }`);\n this.dialErrorsForPeer.delete(peerId.toString());\n return await this.libp2p.peerStore.delete(peerId);\n }\n catch (error) {\n throw `Error deleting undialable peer ${peerId.toString()} from peer store - ${error}`;\n }\n finally {\n this.currentActiveDialCount -= 1;\n this.processDialQueue();\n }\n }\n async dropConnection(peerId) {\n try {\n this.keepAliveManager.stop(peerId);\n await this.libp2p.hangUp(peerId);\n log(`Dropped connection with peer ${peerId.toString()}`);\n }\n catch (error) {\n log(`Error dropping connection with peer ${peerId.toString()} - ${error}`);\n }\n }\n processDialQueue() {\n if (this.pendingPeerDialQueue.length > 0 &&\n this.currentActiveDialCount < this.options.maxParallelDials) {\n const peerId = this.pendingPeerDialQueue.shift();\n if (!peerId)\n return;\n this.attemptDial(peerId).catch((error) => {\n log(error);\n });\n }\n }\n startPeerDiscoveryListener() {\n this.libp2p.addEventListener(\"peer:discovery\", this.onEventHandlers[\"peer:discovery\"]);\n }\n startPeerConnectionListener() {\n this.libp2p.addEventListener(\"peer:connect\", this.onEventHandlers[\"peer:connect\"]);\n }\n startPeerDisconnectionListener() {\n // TODO: ensure that these following issues are updated and confirmed\n /**\n * NOTE: Event is not being emitted on closing nor losing a connection.\n * @see https://github.com/libp2p/js-libp2p/issues/939\n * @see https://github.com/status-im/js-waku/issues/252\n *\n * >This event will be triggered anytime we are disconnected from another peer,\n * >regardless of the circumstances of that disconnection.\n * >If we happen to have multiple connections to a peer,\n * >this event will **only** be triggered when the last connection is closed.\n * @see https://github.com/libp2p/js-libp2p/blob/bad9e8c0ff58d60a78314077720c82ae331cc55b/doc/API.md?plain=1#L2100\n */\n this.libp2p.addEventListener(\"peer:disconnect\", this.onEventHandlers[\"peer:disconnect\"]);\n }\n async attemptDial(peerId) {\n if (this.currentActiveDialCount >= this.options.maxParallelDials) {\n this.pendingPeerDialQueue.push(peerId);\n return;\n }\n if (!(await this.shouldDialPeer(peerId)))\n return;\n this.dialPeer(peerId).catch((err) => {\n throw `Error dialing peer ${peerId.toString()} : ${err}`;\n });\n }\n onEventHandlers = {\n \"peer:discovery\": (evt) => {\n void (async () => {\n const { id: peerId } = evt.detail;\n const isBootstrap = (await this.getTagNamesForPeer(peerId)).includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP);\n if (isBootstrap) {\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.EPeersByDiscoveryEvents.PEER_DISCOVERY_BOOTSTRAP, {\n detail: peerId,\n }));\n }\n else {\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.EPeersByDiscoveryEvents.PEER_DISCOVERY_PEER_EXCHANGE, {\n detail: peerId,\n }));\n }\n try {\n await this.attemptDial(peerId);\n }\n catch (error) {\n log(`Error dialing peer ${peerId.toString()} : ${error}`);\n }\n })();\n },\n \"peer:connect\": (evt) => {\n void (async () => {\n const peerId = evt.detail;\n this.keepAliveManager.start(peerId, this.libp2p.services.ping);\n const isBootstrap = (await this.getTagNamesForPeer(peerId)).includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP);\n if (isBootstrap) {\n const bootstrapConnections = this.libp2p\n .getConnections()\n .filter((conn) => conn.tags.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP));\n // If we have too many bootstrap connections, drop one\n if (bootstrapConnections.length > this.options.maxBootstrapPeersAllowed) {\n await this.dropConnection(peerId);\n }\n else {\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.EPeersByDiscoveryEvents.PEER_CONNECT_BOOTSTRAP, {\n detail: peerId,\n }));\n }\n }\n else {\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.CustomEvent(_waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.EPeersByDiscoveryEvents.PEER_CONNECT_PEER_EXCHANGE, {\n detail: peerId,\n }));\n }\n })();\n },\n \"peer:disconnect\": () => {\n return (evt) => {\n this.keepAliveManager.stop(evt.detail);\n };\n },\n };\n /**\n * Checks if the peer is dialable based on the following conditions:\n * 1. If the peer is a bootstrap peer, it is only dialable if the number of current bootstrap connections is less than the max allowed.\n * 2. If the peer is not a bootstrap peer\n */\n async shouldDialPeer(peerId) {\n const isConnected = this.libp2p.getConnections(peerId).length > 0;\n if (isConnected)\n return false;\n const tagNames = await this.getTagNamesForPeer(peerId);\n const isBootstrap = tagNames.some((tagName) => tagName === _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP);\n if (isBootstrap) {\n const currentBootstrapConnections = this.libp2p\n .getConnections()\n .filter((conn) => {\n return conn.tags.find((name) => name === _waku_interfaces__WEBPACK_IMPORTED_MODULE_1__.Tags.BOOTSTRAP);\n }).length;\n if (currentBootstrapConnections < this.options.maxBootstrapPeersAllowed)\n return true;\n }\n else {\n return true;\n }\n return false;\n }\n /**\n * Fetches the tag names for a given peer\n */\n async getTagNamesForPeer(peerId) {\n try {\n const peer = await this.libp2p.peerStore.get(peerId);\n return Array.from(peer.tags.keys());\n }\n catch (error) {\n log(`Failed to get peer ${peerId}, error: ${error}`);\n return [];\n }\n }\n}\n\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/connection_manager.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/constants.js": +/*!*******************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/constants.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPubSubTopic: () => (/* binding */ DefaultPubSubTopic)\n/* harmony export */ });\n/**\n * DefaultPubSubTopic is the default gossipsub topic to use for Waku.\n */\nconst DefaultPubSubTopic = \"/waku/2/default-waku/proto\";\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/filter/filter_rpc.js": +/*!***************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/filter/filter_rpc.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterPushRpc: () => (/* binding */ FilterPushRpc),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ FilterSubscribeRpc: () => (/* binding */ FilterSubscribeRpc)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\n/**\n * FilterPushRPC represents a message conforming to the Waku FilterPush protocol.\n * Protocol documentation: https://rfc.vac.dev/spec/12/\n */\nclass FilterPushRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.MessagePush.decode(bytes);\n return new FilterPushRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.MessagePush.encode(this.proto);\n }\n get wakuMessage() {\n return this.proto.wakuMessage;\n }\n /**\n * Get the pubsub topic from the FilterPushRpc object.\n * @returns string\n */\n get pubsubTopic() {\n return this.proto.pubsubTopic;\n }\n}\nclass FilterSubscribeRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static createSubscribeRequest(pubsubTopic, contentTopics) {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.SUBSCRIBE,\n pubsubTopic,\n contentTopics,\n });\n }\n static createUnsubscribeRequest(pubsubTopic, contentTopics) {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.UNSUBSCRIBE,\n pubsubTopic,\n contentTopics,\n });\n }\n static createUnsubscribeAllRequest(pubsubTopic) {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.UNSUBSCRIBE_ALL,\n pubsubTopic,\n contentTopics: [],\n });\n }\n static createSubscriberPingRequest() {\n return new FilterSubscribeRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n filterSubscribeType: _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.FilterSubscribeType.SUBSCRIBER_PING,\n pubsubTopic: \"\",\n contentTopics: [],\n });\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.decode(bytes);\n return new FilterSubscribeRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeRequest.encode(this.proto);\n }\n get filterSubscribeType() {\n return this.proto.filterSubscribeType;\n }\n get requestId() {\n return this.proto.requestId;\n }\n get pubsubTopic() {\n return this.proto.pubsubTopic;\n }\n get contentTopics() {\n return this.proto.contentTopics;\n }\n}\nclass FilterSubscribeResponse {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeResponse.decode(bytes);\n return new FilterSubscribeResponse(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_filter_v2.FilterSubscribeResponse.encode(this.proto);\n }\n get statusCode() {\n return this.proto.statusCode;\n }\n get statusDesc() {\n return this.proto.statusDesc;\n }\n get requestId() {\n return this.proto.requestId;\n }\n}\n//# sourceMappingURL=filter_rpc.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/filter/filter_rpc.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/filter/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/filter/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ wakuFilter: () => (/* binding */ wakuFilter)\n/* harmony export */ });\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@waku/core/dist/lib/constants.js\");\n/* harmony import */ var _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./filter_rpc.js */ \"./node_modules/@waku/core/dist/lib/filter/filter_rpc.js\");\n\n\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_1__(\"waku:filter:v2\");\nconst FilterCodecs = {\n SUBSCRIBE: \"/vac/waku/filter-subscribe/2.0.0-beta1\",\n PUSH: \"/vac/waku/filter-push/2.0.0-beta1\",\n};\nclass Subscription {\n peer;\n pubSubTopic;\n newStream;\n subscriptionCallbacks;\n constructor(pubSubTopic, remotePeer, newStream) {\n this.peer = remotePeer;\n this.pubSubTopic = pubSubTopic;\n this.newStream = newStream;\n this.subscriptionCallbacks = new Map();\n }\n async subscribe(decoders, callback) {\n const decodersArray = Array.isArray(decoders) ? decoders : [decoders];\n const decodersGroupedByCT = (0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.groupByContentTopic)(decodersArray);\n const contentTopics = Array.from(decodersGroupedByCT.keys());\n const stream = await this.newStream(this.peer);\n const request = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createSubscribeRequest(this.pubSubTopic, contentTopics);\n try {\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_4__.pipe)([request.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(source));\n const { statusCode, requestId, statusDesc } = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeResponse.decode(res[0].slice());\n if (statusCode < 200 || statusCode >= 300) {\n throw new Error(`Filter subscribe request ${requestId} failed with status code ${statusCode}: ${statusDesc}`);\n }\n log(\"Subscribed to peer \", this.peer.id.toString(), \"for content topics\", contentTopics);\n }\n catch (e) {\n throw new Error(\"Error subscribing to peer: \" +\n this.peer.id.toString() +\n \" for content topics: \" +\n contentTopics +\n \": \" +\n e);\n }\n // Save the callback functions by content topics so they\n // can easily be removed (reciprocally replaced) if `unsubscribe` (reciprocally `subscribe`)\n // is called for those content topics\n decodersGroupedByCT.forEach((decoders, contentTopic) => {\n // Cast the type because a given `subscriptionCallbacks` map may hold\n // Decoder that decode to different implementations of `IDecodedMessage`\n const subscriptionCallback = {\n decoders,\n callback,\n };\n // The callback and decoder may override previous values, this is on\n // purpose as the user may call `subscribe` to refresh the subscription\n this.subscriptionCallbacks.set(contentTopic, subscriptionCallback);\n });\n }\n async unsubscribe(contentTopics) {\n const stream = await this.newStream(this.peer);\n const unsubscribeRequest = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createUnsubscribeRequest(this.pubSubTopic, contentTopics);\n try {\n await (0,it_pipe__WEBPACK_IMPORTED_MODULE_4__.pipe)([unsubscribeRequest.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode, stream.sink);\n }\n catch (error) {\n throw new Error(\"Error subscribing: \" + error);\n }\n contentTopics.forEach((contentTopic) => {\n this.subscriptionCallbacks.delete(contentTopic);\n });\n }\n async ping() {\n const stream = await this.newStream(this.peer);\n const request = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createSubscriberPingRequest();\n try {\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_4__.pipe)([request.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(source));\n const { statusCode, requestId, statusDesc } = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeResponse.decode(res[0].slice());\n if (statusCode < 200 || statusCode >= 300) {\n throw new Error(`Filter ping request ${requestId} failed with status code ${statusCode}: ${statusDesc}`);\n }\n log(\"Ping successful\");\n }\n catch (error) {\n log(\"Error pinging: \", error);\n throw new Error(\"Error pinging: \" + error);\n }\n }\n async unsubscribeAll() {\n const stream = await this.newStream(this.peer);\n const request = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeRpc.createUnsubscribeAllRequest(this.pubSubTopic);\n try {\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_4__.pipe)([request.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(source));\n const { statusCode, requestId, statusDesc } = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterSubscribeResponse.decode(res[0].slice());\n if (statusCode < 200 || statusCode >= 300) {\n throw new Error(`Filter unsubscribe all request ${requestId} failed with status code ${statusCode}: ${statusDesc}`);\n }\n this.subscriptionCallbacks.clear();\n log(\"Unsubscribed from all content topics\");\n }\n catch (error) {\n throw new Error(\"Error unsubscribing from all content topics: \" + error);\n }\n }\n async processMessage(message) {\n const contentTopic = message.contentTopic;\n const subscriptionCallback = this.subscriptionCallbacks.get(contentTopic);\n if (!subscriptionCallback) {\n log(\"No subscription callback available for \", contentTopic);\n return;\n }\n await pushMessage(subscriptionCallback, this.pubSubTopic, message);\n }\n}\nclass Filter extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_5__.BaseProtocol {\n options;\n activeSubscriptions = new Map();\n getActiveSubscription(pubSubTopic, peerIdStr) {\n return this.activeSubscriptions.get(`${pubSubTopic}_${peerIdStr}`);\n }\n setActiveSubscription(pubSubTopic, peerIdStr, subscription) {\n this.activeSubscriptions.set(`${pubSubTopic}_${peerIdStr}`, subscription);\n return subscription;\n }\n constructor(libp2p, options) {\n super(FilterCodecs.SUBSCRIBE, libp2p.components);\n libp2p.handle(FilterCodecs.PUSH, this.onRequest.bind(this)).catch((e) => {\n log(\"Failed to register \", FilterCodecs.PUSH, e);\n });\n this.activeSubscriptions = new Map();\n this.options = options ?? {};\n }\n async createSubscription(pubSubTopic, peerId) {\n const _pubSubTopic = pubSubTopic ?? this.options.pubSubTopic ?? _constants_js__WEBPACK_IMPORTED_MODULE_6__.DefaultPubSubTopic;\n const peer = await this.getPeer(peerId);\n const subscription = this.getActiveSubscription(_pubSubTopic, peer.id.toString()) ??\n this.setActiveSubscription(_pubSubTopic, peer.id.toString(), new Subscription(_pubSubTopic, peer, this.newStream.bind(this, peer)));\n return subscription;\n }\n toSubscriptionIterator(decoders, opts) {\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.toAsyncIterator)(this, decoders, opts);\n }\n /**\n * This method is used to satisfy the `IReceiver` interface.\n *\n * @hidden\n *\n * @param decoders The decoders to use for the subscription.\n * @param callback The callback function to use for the subscription.\n * @param opts Optional protocol options for the subscription.\n *\n * @returns A Promise that resolves to a function that unsubscribes from the subscription.\n *\n * @remarks\n * This method should not be used directly.\n * Instead, use `createSubscription` to create a new subscription.\n */\n async subscribe(decoders, callback, opts) {\n const subscription = await this.createSubscription(undefined, opts?.peerId);\n await subscription.subscribe(decoders, callback);\n const contentTopics = Array.from((0,_waku_utils__WEBPACK_IMPORTED_MODULE_0__.groupByContentTopic)(Array.isArray(decoders) ? decoders : [decoders]).keys());\n return async () => {\n await subscription.unsubscribe(contentTopics);\n };\n }\n onRequest(streamData) {\n log(\"Receiving message push\");\n try {\n (0,it_pipe__WEBPACK_IMPORTED_MODULE_4__.pipe)(streamData.stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_3__.decode, async (source) => {\n for await (const bytes of source) {\n const response = _filter_rpc_js__WEBPACK_IMPORTED_MODULE_7__.FilterPushRpc.decode(bytes.slice());\n const { pubsubTopic, wakuMessage } = response;\n if (!wakuMessage) {\n log(\"Received empty message\");\n return;\n }\n if (!pubsubTopic) {\n log(\"PubSub topic missing from push message\");\n return;\n }\n const peerIdStr = streamData.connection.remotePeer.toString();\n const subscription = this.getActiveSubscription(pubsubTopic, peerIdStr);\n if (!subscription) {\n log(`No subscription locally registered for topic ${pubsubTopic}`);\n return;\n }\n await subscription.processMessage(wakuMessage);\n }\n }).then(() => {\n log(\"Receiving pipe closed.\");\n }, (e) => {\n log(\"Error with receiving pipe\", e);\n });\n }\n catch (e) {\n log(\"Error decoding message\", e);\n }\n }\n}\nfunction wakuFilter(init = {}) {\n return (libp2p) => new Filter(libp2p, init);\n}\nasync function pushMessage(subscriptionCallback, pubSubTopic, message) {\n const { decoders, callback } = subscriptionCallback;\n const { contentTopic } = message;\n if (!contentTopic) {\n log(\"Message has no content topic, skipping\");\n return;\n }\n let didDecodeMsg = false;\n // We don't want to wait for decoding failure, just attempt to decode\n // all messages and do the call back on the one that works\n // noinspection ES6MissingAwait\n for (const dec of decoders) {\n if (didDecodeMsg)\n break;\n const decoded = await dec.fromProtoObj(pubSubTopic, message);\n if (!decoded) {\n log(\"Not able to decode message\");\n continue;\n }\n // This is just to prevent more decoding attempt\n // TODO: Could be better if we were to abort promises\n didDecodeMsg = Boolean(decoded);\n await callback(decoded);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/filter/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/keep_alive_manager.js": +/*!****************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/keep_alive_manager.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ KeepAliveManager: () => (/* binding */ KeepAliveManager),\n/* harmony export */ RelayPingContentTopic: () => (/* binding */ RelayPingContentTopic)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index.js */ \"./node_modules/@waku/core/dist/index.js\");\n\n\nconst RelayPingContentTopic = \"/relay-ping/1/ping/null\";\nconst log = debug__WEBPACK_IMPORTED_MODULE_0__(\"waku:keep-alive\");\nclass KeepAliveManager {\n pingKeepAliveTimers;\n relayKeepAliveTimers;\n options;\n relay;\n constructor(options, relay) {\n this.pingKeepAliveTimers = new Map();\n this.relayKeepAliveTimers = new Map();\n this.options = options;\n this.relay = relay;\n }\n start(peerId, libp2pPing) {\n // Just in case a timer already exist for this peer\n this.stop(peerId);\n const { pingKeepAlive: pingPeriodSecs, relayKeepAlive: relayPeriodSecs } = this.options;\n const peerIdStr = peerId.toString();\n if (pingPeriodSecs !== 0) {\n const interval = setInterval(() => {\n libp2pPing.ping(peerId).catch((e) => {\n log(`Ping failed (${peerIdStr})`, e);\n });\n }, pingPeriodSecs * 1000);\n this.pingKeepAliveTimers.set(peerIdStr, interval);\n }\n const relay = this.relay;\n if (relay && relayPeriodSecs !== 0) {\n const encoder = (0,_index_js__WEBPACK_IMPORTED_MODULE_1__.createEncoder)({\n contentTopic: RelayPingContentTopic,\n ephemeral: true,\n });\n const interval = setInterval(() => {\n log(\"Sending Waku Relay ping message\");\n relay\n .send(encoder, { payload: new Uint8Array([1]) })\n .catch((e) => log(\"Failed to send relay ping\", e));\n }, relayPeriodSecs * 1000);\n this.relayKeepAliveTimers.set(peerId, interval);\n }\n }\n stop(peerId) {\n const peerIdStr = peerId.toString();\n if (this.pingKeepAliveTimers.has(peerIdStr)) {\n clearInterval(this.pingKeepAliveTimers.get(peerIdStr));\n this.pingKeepAliveTimers.delete(peerIdStr);\n }\n if (this.relayKeepAliveTimers.has(peerId)) {\n clearInterval(this.relayKeepAliveTimers.get(peerId));\n this.relayKeepAliveTimers.delete(peerId);\n }\n }\n stopAll() {\n for (const timer of [\n ...Object.values(this.pingKeepAliveTimers),\n ...Object.values(this.relayKeepAliveTimers),\n ]) {\n clearInterval(timer);\n }\n this.pingKeepAliveTimers.clear();\n this.relayKeepAliveTimers.clear();\n }\n}\n//# sourceMappingURL=keep_alive_manager.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/keep_alive_manager.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/light_push/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/light_push/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LightPushCodec: () => (/* binding */ LightPushCodec),\n/* harmony export */ PushResponse: () => (/* reexport safe */ _waku_proto__WEBPACK_IMPORTED_MODULE_1__.PushResponse),\n/* harmony export */ wakuLightPush: () => (/* binding */ wakuLightPush)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@waku/core/dist/lib/constants.js\");\n/* harmony import */ var _push_rpc_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./push_rpc.js */ \"./node_modules/@waku/core/dist/lib/light_push/push_rpc.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_3__(\"waku:light-push\");\nconst LightPushCodec = \"/vac/waku/lightpush/2.0.0-beta1\";\n\n/**\n * Implements the [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/).\n */\nclass LightPush extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_8__.BaseProtocol {\n options;\n constructor(libp2p, options) {\n super(LightPushCodec, libp2p.components);\n this.options = options || {};\n }\n async send(encoder, message, opts) {\n const { pubSubTopic = _constants_js__WEBPACK_IMPORTED_MODULE_9__.DefaultPubSubTopic } = this.options;\n const peer = await this.getPeer(opts?.peerId);\n const stream = await this.newStream(peer);\n const recipients = [];\n let error = undefined;\n try {\n if (!(0,_waku_utils__WEBPACK_IMPORTED_MODULE_2__.isSizeValid)(message.payload)) {\n log(\"Failed to send waku light push: message is bigger that 1MB\");\n return {\n recipients,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.SendError.SIZE_TOO_BIG,\n };\n }\n const protoMessage = await encoder.toProtoObj(message);\n if (!protoMessage) {\n log(\"Failed to encode to protoMessage, aborting push\");\n return {\n recipients,\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.SendError.ENCODE_FAILED,\n };\n }\n const query = _push_rpc_js__WEBPACK_IMPORTED_MODULE_10__.PushRpc.createRequest(protoMessage, pubSubTopic);\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_6__.pipe)([query.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_5__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_5__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(source));\n try {\n const bytes = new uint8arraylist__WEBPACK_IMPORTED_MODULE_7__.Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n const response = _push_rpc_js__WEBPACK_IMPORTED_MODULE_10__.PushRpc.decode(bytes).response;\n if (response?.isSuccess) {\n recipients.push(peer.id);\n }\n else {\n log(\"No response in PushRPC\");\n error = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.SendError.NO_RPC_RESPONSE;\n }\n }\n catch (err) {\n log(\"Failed to decode push reply\", err);\n error = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.SendError.DECODE_FAILED;\n }\n }\n catch (err) {\n log(\"Failed to send waku light push request\", err);\n error = _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.SendError.GENERIC_FAIL;\n }\n return {\n error,\n recipients,\n };\n }\n}\nfunction wakuLightPush(init = {}) {\n return (libp2p) => new LightPush(libp2p, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/light_push/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/light_push/push_rpc.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/light_push/push_rpc.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\nclass PushRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n static createRequest(message, pubSubTopic) {\n return new PushRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n request: {\n message: message,\n pubsubTopic: pubSubTopic,\n },\n response: undefined,\n });\n }\n static decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_lightpush.PushRpc.decode(bytes);\n return new PushRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_lightpush.PushRpc.encode(this.proto);\n }\n get query() {\n return this.proto.request;\n }\n get response() {\n return this.proto.response;\n }\n}\n//# sourceMappingURL=push_rpc.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/light_push/push_rpc.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/message/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/message/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version_0: () => (/* reexport module object */ _version_0_js__WEBPACK_IMPORTED_MODULE_0__)\n/* harmony export */ });\n/* harmony import */ var _version_0_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version_0.js */ \"./node_modules/@waku/core/dist/lib/message/version_0.js\");\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/message/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/message/version_0.js": +/*!***************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/message/version_0.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DecodedMessage: () => (/* binding */ DecodedMessage),\n/* harmony export */ Decoder: () => (/* binding */ Decoder),\n/* harmony export */ Encoder: () => (/* binding */ Encoder),\n/* harmony export */ Version: () => (/* binding */ Version),\n/* harmony export */ createDecoder: () => (/* binding */ createDecoder),\n/* harmony export */ createEncoder: () => (/* binding */ createEncoder),\n/* harmony export */ proto: () => (/* reexport safe */ _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_1__(\"waku:message:version-0\");\nconst OneMillion = BigInt(1000000);\nconst Version = 0;\n\nclass DecodedMessage {\n pubSubTopic;\n proto;\n constructor(pubSubTopic, proto) {\n this.pubSubTopic = pubSubTopic;\n this.proto = proto;\n }\n get ephemeral() {\n return Boolean(this.proto.ephemeral);\n }\n get payload() {\n return this.proto.payload;\n }\n get contentTopic() {\n return this.proto.contentTopic;\n }\n get _rawTimestamp() {\n return this.proto.timestamp;\n }\n get timestamp() {\n // In the case we receive a value that is bigger than JS's max number,\n // we catch the error and return undefined.\n try {\n if (this.proto.timestamp) {\n // nanoseconds 10^-9 to milliseconds 10^-3\n const timestamp = this.proto.timestamp / OneMillion;\n return new Date(Number(timestamp));\n }\n return;\n }\n catch (e) {\n return;\n }\n }\n get meta() {\n return this.proto.meta;\n }\n get version() {\n // https://rfc.vac.dev/spec/14/\n // > If omitted, the value SHOULD be interpreted as version 0.\n return this.proto.version ?? 0;\n }\n get rateLimitProof() {\n return this.proto.rateLimitProof;\n }\n}\nclass Encoder {\n contentTopic;\n ephemeral;\n metaSetter;\n constructor(contentTopic, ephemeral = false, metaSetter) {\n this.contentTopic = contentTopic;\n this.ephemeral = ephemeral;\n this.metaSetter = metaSetter;\n if (!contentTopic || contentTopic === \"\") {\n throw new Error(\"Content topic must be specified\");\n }\n }\n async toWire(message) {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.encode(await this.toProtoObj(message));\n }\n async toProtoObj(message) {\n const timestamp = message.timestamp ?? new Date();\n const protoMessage = {\n payload: message.payload,\n version: Version,\n contentTopic: this.contentTopic,\n timestamp: BigInt(timestamp.valueOf()) * OneMillion,\n meta: undefined,\n rateLimitProof: message.rateLimitProof,\n ephemeral: this.ephemeral,\n };\n if (this.metaSetter) {\n const meta = this.metaSetter(protoMessage);\n return { ...protoMessage, meta };\n }\n return protoMessage;\n }\n}\n/**\n * Creates an encoder that encode messages without Waku level encryption or signature.\n *\n * An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)\n * format to be sent over the Waku network. The resulting encoder can then be\n * pass to { @link @waku/interfaces.LightPush.push } or\n * { @link @waku/interfaces.Relay.send } to automatically encode outgoing\n * messages.\n */\nfunction createEncoder({ contentTopic, ephemeral, metaSetter, }) {\n return new Encoder(contentTopic, ephemeral, metaSetter);\n}\nclass Decoder {\n contentTopic;\n constructor(contentTopic) {\n this.contentTopic = contentTopic;\n if (!contentTopic || contentTopic === \"\") {\n throw new Error(\"Content topic must be specified\");\n }\n }\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_message.WakuMessage.decode(bytes);\n log(\"Message decoded\", protoMessage);\n return Promise.resolve({\n payload: protoMessage.payload,\n contentTopic: protoMessage.contentTopic,\n version: protoMessage.version ?? undefined,\n timestamp: protoMessage.timestamp ?? undefined,\n meta: protoMessage.meta ?? undefined,\n rateLimitProof: protoMessage.rateLimitProof ?? undefined,\n ephemeral: protoMessage.ephemeral ?? false,\n });\n }\n async fromProtoObj(pubSubTopic, proto) {\n // https://rfc.vac.dev/spec/14/\n // > If omitted, the value SHOULD be interpreted as version 0.\n if (proto.version ?? 0 !== Version) {\n log(\"Failed to decode due to incorrect version, expected:\", Version, \", actual:\", proto.version);\n return Promise.resolve(undefined);\n }\n return new DecodedMessage(pubSubTopic, proto);\n }\n}\n/**\n * Creates a decoder that decode messages without Waku level encryption.\n *\n * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)\n * format when received from the Waku network. The resulting decoder can then be\n * pass to { @link @waku/interfaces.Filter.subscribe } or\n * { @link @waku/interfaces.Relay.subscribe } to automatically decode incoming\n * messages.\n *\n * @param contentTopic The resulting decoder will only decode messages with this content topic.\n */\nfunction createDecoder(contentTopic) {\n return new Decoder(contentTopic);\n}\n//# sourceMappingURL=version_0.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/message/version_0.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/store/history_rpc.js": +/*!***************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/store/history_rpc.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\nconst OneMillion = BigInt(1000000);\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\nclass HistoryRpc {\n proto;\n constructor(proto) {\n this.proto = proto;\n }\n get query() {\n return this.proto.query;\n }\n get response() {\n return this.proto.response;\n }\n /**\n * Create History Query.\n */\n static createQuery(params) {\n const contentFilters = params.contentTopics.map((contentTopic) => {\n return { contentTopic };\n });\n const direction = directionToProto(params.pageDirection);\n const pagingInfo = {\n pageSize: BigInt(params.pageSize),\n cursor: params.cursor,\n direction,\n };\n let startTime, endTime;\n if (params.startTime) {\n // milliseconds 10^-3 to nanoseconds 10^-9\n startTime = BigInt(params.startTime.valueOf()) * OneMillion;\n }\n if (params.endTime) {\n // milliseconds 10^-3 to nanoseconds 10^-9\n endTime = BigInt(params.endTime.valueOf()) * OneMillion;\n }\n return new HistoryRpc({\n requestId: (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(),\n query: {\n pubsubTopic: params.pubSubTopic,\n contentFilters,\n pagingInfo,\n startTime,\n endTime,\n },\n response: undefined,\n });\n }\n decode(bytes) {\n const res = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.HistoryRpc.decode(bytes);\n return new HistoryRpc(res);\n }\n encode() {\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.HistoryRpc.encode(this.proto);\n }\n}\nfunction directionToProto(pageDirection) {\n switch (pageDirection) {\n case PageDirection.BACKWARD:\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.PagingInfo.Direction.BACKWARD;\n case PageDirection.FORWARD:\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.PagingInfo.Direction.FORWARD;\n default:\n return _waku_proto__WEBPACK_IMPORTED_MODULE_0__.proto_store.PagingInfo.Direction.BACKWARD;\n }\n}\n//# sourceMappingURL=history_rpc.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/store/history_rpc.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/store/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/store/index.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPageSize: () => (/* binding */ DefaultPageSize),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _history_rpc_js__WEBPACK_IMPORTED_MODULE_12__.PageDirection),\n/* harmony export */ StoreCodec: () => (/* binding */ StoreCodec),\n/* harmony export */ createCursor: () => (/* binding */ createCursor),\n/* harmony export */ wakuStore: () => (/* binding */ wakuStore)\n/* harmony export */ });\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var _base_protocol_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../base_protocol.js */ \"./node_modules/@waku/core/dist/lib/base_protocol.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/@waku/core/dist/lib/constants.js\");\n/* harmony import */ var _to_proto_message_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../to_proto_message.js */ \"./node_modules/@waku/core/dist/lib/to_proto_message.js\");\n/* harmony import */ var _history_rpc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./history_rpc.js */ \"./node_modules/@waku/core/dist/lib/store/history_rpc.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar HistoryError = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.proto_store.HistoryResponse.HistoryError;\nconst log = debug__WEBPACK_IMPORTED_MODULE_4__(\"waku:store\");\nconst StoreCodec = \"/vac/waku/store/2.0.0-beta4\";\nconst DefaultPageSize = 10;\n\n/**\n * Implements the [Waku v2 Store protocol](https://rfc.vac.dev/spec/13/).\n *\n * The Waku Store protocol can be used to retrieved historical messages.\n */\nclass Store extends _base_protocol_js__WEBPACK_IMPORTED_MODULE_9__.BaseProtocol {\n options;\n constructor(libp2p, options) {\n super(StoreCodec, libp2p.components);\n this.options = options ?? {};\n }\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n *\n * The callback function takes a `WakuMessage` in input,\n * messages are processed in order:\n * - oldest to latest if `options.pageDirection` == { @link PageDirection.FORWARD }\n * - latest to oldest if `options.pageDirection` == { @link PageDirection.BACKWARD }\n *\n * The ordering may affect performance.\n * The ordering depends on the behavior of the remote store node.\n * If strong ordering is needed, you may need to handle this at application level\n * and set your own timestamps too (the WakuMessage timestamps are not certified).\n *\n * @throws If not able to reach a Waku Store peer to query,\n * or if an error is encountered when processing the reply,\n * or if two decoders with the same content topic are passed.\n */\n async queryOrderedCallback(decoders, callback, options) {\n let abort = false;\n for await (const promises of this.queryGenerator(decoders, options)) {\n if (abort)\n break;\n const messagesOrUndef = await Promise.all(promises);\n let messages = messagesOrUndef.filter(_waku_utils__WEBPACK_IMPORTED_MODULE_2__.isDefined);\n // Messages in pages are ordered from oldest (first) to most recent (last).\n // https://github.com/vacp2p/rfc/issues/533\n if (typeof options?.pageDirection === \"undefined\" ||\n options?.pageDirection === _history_rpc_js__WEBPACK_IMPORTED_MODULE_12__.PageDirection.BACKWARD) {\n messages = messages.reverse();\n }\n await Promise.all(messages.map(async (msg) => {\n if (msg && !abort) {\n abort = Boolean(await callback(msg));\n }\n }));\n }\n }\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n *\n * The callback function takes a `Promise` in input,\n * useful if messages needs to be decrypted and performance matters.\n *\n * The order of the messages passed to the callback is as follows:\n * - within a page, messages are expected to be ordered from oldest to most recent\n * - pages direction depends on { @link QueryOptions.pageDirection }\n *\n * Do note that the resolution of the `Promise {\n if (!abort) {\n abort = Boolean(await callback(msg));\n }\n });\n promises = promises.concat(_promises);\n }\n await Promise.all(promises);\n }\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n *\n * This is a generator, useful if you want most control on how messages\n * are processed.\n *\n * The order of the messages returned by the remote Waku node SHOULD BE\n * as follows:\n * - within a page, messages SHOULD be ordered from oldest to most recent\n * - pages direction depends on { @link QueryOptions.pageDirection }\n *\n * However, there is no way to guarantee the behavior of the remote node.\n *\n * @throws If not able to reach a Waku Store peer to query,\n * or if an error is encountered when processing the reply,\n * or if two decoders with the same content topic are passed.\n */\n async *queryGenerator(decoders, options) {\n const { pubSubTopic = _constants_js__WEBPACK_IMPORTED_MODULE_10__.DefaultPubSubTopic } = this.options;\n let startTime, endTime;\n if (options?.timeFilter) {\n startTime = options.timeFilter.startTime;\n endTime = options.timeFilter.endTime;\n }\n const decodersAsMap = new Map();\n decoders.forEach((dec) => {\n if (decodersAsMap.has(dec.contentTopic)) {\n throw new Error(\"API does not support different decoder per content topic\");\n }\n decodersAsMap.set(dec.contentTopic, dec);\n });\n const contentTopics = decoders.map((dec) => dec.contentTopic);\n const queryOpts = Object.assign({\n pubSubTopic: pubSubTopic,\n pageDirection: _history_rpc_js__WEBPACK_IMPORTED_MODULE_12__.PageDirection.BACKWARD,\n pageSize: DefaultPageSize,\n }, options, { contentTopics, startTime, endTime });\n log(\"Querying history with the following options\", {\n ...options,\n peerId: options?.peerId?.toString(),\n });\n const peer = await this.getPeer(options?.peerId);\n for await (const messages of paginate(this.newStream.bind(this, peer), queryOpts, decodersAsMap, options?.cursor)) {\n yield messages;\n }\n }\n}\nasync function* paginate(streamFactory, queryOpts, decoders, cursor) {\n if (queryOpts.contentTopics.toString() !==\n Array.from(decoders.keys()).toString()) {\n throw new Error(\"Internal error, the decoders should match the query's content topics\");\n }\n let currentCursor = cursor;\n while (true) {\n queryOpts.cursor = currentCursor;\n const historyRpcQuery = _history_rpc_js__WEBPACK_IMPORTED_MODULE_12__.HistoryRpc.createQuery(queryOpts);\n log(\"Querying store peer\", `for (${queryOpts.pubSubTopic})`, queryOpts.contentTopics);\n const stream = await streamFactory();\n const res = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_7__.pipe)([historyRpcQuery.encode()], it_length_prefixed__WEBPACK_IMPORTED_MODULE_6__.encode, stream, it_length_prefixed__WEBPACK_IMPORTED_MODULE_6__.decode, async (source) => await (0,it_all__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(source));\n const bytes = new uint8arraylist__WEBPACK_IMPORTED_MODULE_8__.Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n const reply = historyRpcQuery.decode(bytes);\n if (!reply.response) {\n log(\"Stopping pagination due to store `response` field missing\");\n break;\n }\n const response = reply.response;\n if (response.error && response.error !== HistoryError.NONE) {\n throw \"History response contains an Error: \" + response.error;\n }\n if (!response.messages || !response.messages.length) {\n log(\"Stopping pagination due to store `response.messages` field missing or empty\");\n break;\n }\n log(`${response.messages.length} messages retrieved from store`);\n yield response.messages.map((protoMsg) => {\n const contentTopic = protoMsg.contentTopic;\n if (typeof contentTopic !== \"undefined\") {\n const decoder = decoders.get(contentTopic);\n if (decoder) {\n return decoder.fromProtoObj(queryOpts.pubSubTopic, (0,_to_proto_message_js__WEBPACK_IMPORTED_MODULE_11__.toProtoMessage)(protoMsg));\n }\n }\n return Promise.resolve(undefined);\n });\n const nextCursor = response.pagingInfo?.cursor;\n if (typeof nextCursor === \"undefined\") {\n // If the server does not return cursor then there is an issue,\n // Need to abort, or we end up in an infinite loop\n log(\"Stopping pagination due to `response.pagingInfo.cursor` missing from store response\");\n break;\n }\n currentCursor = nextCursor;\n const responsePageSize = response.pagingInfo?.pageSize;\n const queryPageSize = historyRpcQuery.query?.pagingInfo?.pageSize;\n if (\n // Response page size smaller than query, meaning this is the last page\n responsePageSize &&\n queryPageSize &&\n responsePageSize < queryPageSize) {\n break;\n }\n }\n}\nasync function createCursor(message, pubsubTopic = _constants_js__WEBPACK_IMPORTED_MODULE_10__.DefaultPubSubTopic) {\n if (!message ||\n !message.timestamp ||\n !message.payload ||\n !message.contentTopic) {\n throw new Error(\"Message is missing required fields\");\n }\n const contentTopicBytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_3__.utf8ToBytes)(message.contentTopic);\n const digest = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_0__.sha256)((0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([contentTopicBytes, message.payload]));\n const messageTime = BigInt(message.timestamp.getTime()) * BigInt(1000000);\n return {\n digest,\n pubsubTopic,\n senderTime: messageTime,\n receiverTime: messageTime,\n };\n}\nfunction wakuStore(init = {}) {\n return (libp2p) => new Store(libp2p, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/store/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/to_proto_message.js": +/*!**************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/to_proto_message.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toProtoMessage: () => (/* binding */ toProtoMessage)\n/* harmony export */ });\nconst EmptyMessage = {\n payload: new Uint8Array(),\n contentTopic: \"\",\n version: undefined,\n timestamp: undefined,\n meta: undefined,\n rateLimitProof: undefined,\n ephemeral: undefined,\n};\nfunction toProtoMessage(wire) {\n return { ...EmptyMessage, ...wire };\n}\n//# sourceMappingURL=to_proto_message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/to_proto_message.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/wait_for_remote_peer.js": +/*!******************************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/wait_for_remote_peer.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ waitForRemotePeer: () => (/* binding */ waitForRemotePeer)\n/* harmony export */ });\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var p_event__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-event */ \"./node_modules/@waku/core/node_modules/p-event/index.js\");\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_1__(\"waku:wait-for-remote-peer\");\n/**\n * Wait for a remote peer to be ready given the passed protocols.\n * Must be used after attempting to connect to nodes, using\n * {@link @waku/core.WakuNode.dial} or a bootstrap method with\n * {@link @waku/sdk.createLightNode}.\n *\n * If the passed protocols is a GossipSub protocol, then it resolves only once\n * a peer is in a mesh, to help ensure that other peers will send and receive\n * message to us.\n *\n * @param waku The Waku Node\n * @param protocols The protocols that need to be enabled by remote peers.\n * @param timeoutMs A timeout value in milliseconds..\n *\n * @returns A promise that **resolves** if all desired protocols are fulfilled by\n * remote nodes, **rejects** if the timeoutMs is reached.\n * @throws If passing a protocol that is not mounted\n * @default Wait for remote peers with protocols enabled locally and no time out is applied.\n */\nasync function waitForRemotePeer(waku, protocols, timeoutMs) {\n protocols = protocols ?? getEnabledProtocols(waku);\n if (!waku.isStarted())\n return Promise.reject(\"Waku node is not started\");\n const promises = [];\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Relay)) {\n if (!waku.relay)\n throw new Error(\"Cannot wait for Relay peer: protocol not mounted\");\n promises.push(waitForGossipSubPeerInMesh(waku.relay));\n }\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Store)) {\n if (!waku.store)\n throw new Error(\"Cannot wait for Store peer: protocol not mounted\");\n promises.push(waitForConnectedPeer(waku.store));\n }\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.LightPush)) {\n if (!waku.lightPush)\n throw new Error(\"Cannot wait for LightPush peer: protocol not mounted\");\n promises.push(waitForConnectedPeer(waku.lightPush));\n }\n if (protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Filter)) {\n if (!waku.filter)\n throw new Error(\"Cannot wait for Filter peer: protocol not mounted\");\n promises.push(waitForConnectedPeer(waku.filter));\n }\n if (timeoutMs) {\n await rejectOnTimeout(Promise.all(promises), timeoutMs, \"Timed out waiting for a remote peer.\");\n }\n else {\n await Promise.all(promises);\n }\n}\n/**\n * Wait for a peer with the given protocol to be connected.\n */\nasync function waitForConnectedPeer(protocol) {\n const codec = protocol.multicodec;\n const peers = await protocol.peers();\n if (peers.length) {\n log(`${codec} peer found: `, peers[0].id.toString());\n return;\n }\n await new Promise((resolve) => {\n const cb = (evt) => {\n if (evt.detail?.protocols?.includes(codec)) {\n log(\"Resolving for\", codec, evt.detail.protocols);\n protocol.removeLibp2pEventListener(\"peer:identify\", cb);\n resolve();\n }\n };\n protocol.addLibp2pEventListener(\"peer:identify\", cb);\n });\n}\n/**\n * Wait for a peer with the given protocol to be connected and in the gossipsub\n * mesh.\n */\nasync function waitForGossipSubPeerInMesh(waku) {\n let peers = waku.getMeshPeers();\n while (peers.length == 0) {\n await (0,p_event__WEBPACK_IMPORTED_MODULE_2__.pEvent)(waku.gossipSub, \"gossipsub:heartbeat\");\n peers = waku.getMeshPeers();\n }\n}\nconst awaitTimeout = (ms, rejectReason) => new Promise((_resolve, reject) => setTimeout(() => reject(rejectReason), ms));\nasync function rejectOnTimeout(promise, timeoutMs, rejectReason) {\n await Promise.race([promise, awaitTimeout(timeoutMs, rejectReason)]);\n}\nfunction getEnabledProtocols(waku) {\n const protocols = [];\n if (waku.relay) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Relay);\n }\n if (waku.filter) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Filter);\n }\n if (waku.store) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.Store);\n }\n if (waku.lightPush) {\n protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_0__.Protocols.LightPush);\n }\n return protocols;\n}\n//# sourceMappingURL=wait_for_remote_peer.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/wait_for_remote_peer.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/dist/lib/waku.js": +/*!**************************************************!*\ + !*** ./node_modules/@waku/core/dist/lib/waku.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPingKeepAliveValueSecs: () => (/* binding */ DefaultPingKeepAliveValueSecs),\n/* harmony export */ DefaultRelayKeepAliveValueSecs: () => (/* binding */ DefaultRelayKeepAliveValueSecs),\n/* harmony export */ DefaultUserAgent: () => (/* binding */ DefaultUserAgent),\n/* harmony export */ WakuNode: () => (/* binding */ WakuNode)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-peer-id */ \"./node_modules/@libp2p/interface-peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/core/dist/lib/connection_manager.js\");\n\n\n\n\n\nconst DefaultPingKeepAliveValueSecs = 0;\nconst DefaultRelayKeepAliveValueSecs = 5 * 60;\nconst DefaultUserAgent = \"js-waku\";\nconst log = debug__WEBPACK_IMPORTED_MODULE_3__(\"waku:waku\");\nclass WakuNode {\n libp2p;\n relay;\n store;\n filter;\n lightPush;\n connectionManager;\n constructor(options, libp2p, store, lightPush, filter, relay) {\n this.libp2p = libp2p;\n if (store) {\n this.store = store(libp2p);\n }\n if (filter) {\n this.filter = filter(libp2p);\n }\n if (lightPush) {\n this.lightPush = lightPush(libp2p);\n }\n if (relay) {\n this.relay = relay(libp2p);\n }\n const pingKeepAlive = options.pingKeepAlive || DefaultPingKeepAliveValueSecs;\n const relayKeepAlive = this.relay\n ? options.relayKeepAlive || DefaultRelayKeepAliveValueSecs\n : 0;\n const peerId = this.libp2p.peerId.toString();\n this.connectionManager = _connection_manager_js__WEBPACK_IMPORTED_MODULE_4__.ConnectionManager.create(peerId, libp2p, { pingKeepAlive, relayKeepAlive }, this.relay);\n log(\"Waku node created\", peerId, `relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this\n .lightPush}, filter: ${!!this.filter}`);\n }\n /**\n * Dials to the provided peer.\n *\n * @param peer The peer to dial\n * @param protocols Waku protocols we expect from the peer; Defaults to mounted protocols\n */\n async dial(peer, protocols) {\n const _protocols = protocols ?? [];\n const peerId = mapToPeerIdOrMultiaddr(peer);\n if (typeof protocols === \"undefined\") {\n this.relay && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Relay);\n this.store && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Store);\n this.filter && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Filter);\n this.lightPush && _protocols.push(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.LightPush);\n }\n const codecs = [];\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Relay)) {\n if (this.relay) {\n this.relay.gossipSub.multicodecs.forEach((codec) => codecs.push(codec));\n }\n else {\n log(\"Relay codec not included in dial codec: protocol not mounted locally\");\n }\n }\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Store)) {\n if (this.store) {\n codecs.push(this.store.multicodec);\n }\n else {\n log(\"Store codec not included in dial codec: protocol not mounted locally\");\n }\n }\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.LightPush)) {\n if (this.lightPush) {\n codecs.push(this.lightPush.multicodec);\n }\n else {\n log(\"Light Push codec not included in dial codec: protocol not mounted locally\");\n }\n }\n if (_protocols.includes(_waku_interfaces__WEBPACK_IMPORTED_MODULE_2__.Protocols.Filter)) {\n if (this.filter) {\n codecs.push(this.filter.multicodec);\n }\n else {\n log(\"Filter codec not included in dial codec: protocol not mounted locally\");\n }\n }\n log(`Dialing to ${peerId.toString()} with protocols ${_protocols}`);\n return this.libp2p.dialProtocol(peerId, codecs);\n }\n async start() {\n await this.libp2p.start();\n }\n async stop() {\n this.connectionManager.stop();\n await this.libp2p.stop();\n }\n isStarted() {\n return this.libp2p.isStarted();\n }\n /**\n * Return the local multiaddr with peer id on which libp2p is listening.\n *\n * @throws if libp2p is not listening on localhost.\n */\n getLocalMultiaddrWithID() {\n const localMultiaddr = this.libp2p\n .getMultiaddrs()\n .find((addr) => addr.toString().match(/127\\.0\\.0\\.1/));\n if (!localMultiaddr || localMultiaddr.toString() === \"\") {\n throw \"Not listening on localhost\";\n }\n return localMultiaddr + \"/p2p/\" + this.libp2p.peerId.toString();\n }\n}\nfunction mapToPeerIdOrMultiaddr(peerId) {\n return (0,_libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__.isPeerId)(peerId) ? peerId : (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_1__.multiaddr)(peerId);\n}\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/dist/lib/waku.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/node_modules/p-event/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/@waku/core/node_modules/p-event/index.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TimeoutError: () => (/* reexport safe */ p_timeout__WEBPACK_IMPORTED_MODULE_0__.TimeoutError),\n/* harmony export */ pEvent: () => (/* binding */ pEvent),\n/* harmony export */ pEventIterator: () => (/* binding */ pEventIterator),\n/* harmony export */ pEventMultiple: () => (/* binding */ pEventMultiple)\n/* harmony export */ });\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-timeout */ \"./node_modules/@waku/core/node_modules/p-timeout/index.js\");\n\n\nconst normalizeEmitter = emitter => {\n\tconst addListener = emitter.on || emitter.addListener || emitter.addEventListener;\n\tconst removeListener = emitter.off || emitter.removeListener || emitter.removeEventListener;\n\n\tif (!addListener || !removeListener) {\n\t\tthrow new TypeError('Emitter is not compatible');\n\t}\n\n\treturn {\n\t\taddListener: addListener.bind(emitter),\n\t\tremoveListener: removeListener.bind(emitter),\n\t};\n};\n\nfunction pEventMultiple(emitter, event, options) {\n\tlet cancel;\n\tconst returnValue = new Promise((resolve, reject) => {\n\t\toptions = {\n\t\t\trejectionEvents: ['error'],\n\t\t\tmultiArgs: false,\n\t\t\tresolveImmediately: false,\n\t\t\t...options,\n\t\t};\n\n\t\tif (!(options.count >= 0 && (options.count === Number.POSITIVE_INFINITY || Number.isInteger(options.count)))) {\n\t\t\tthrow new TypeError('The `count` option should be at least 0 or more');\n\t\t}\n\n\t\t// Allow multiple events\n\t\tconst events = [event].flat();\n\n\t\tconst items = [];\n\t\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\t\tconst onItem = (...arguments_) => {\n\t\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\t\tif (options.filter && !options.filter(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titems.push(value);\n\n\t\t\tif (options.count === items.length) {\n\t\t\t\tcancel();\n\t\t\t\tresolve(items);\n\t\t\t}\n\t\t};\n\n\t\tconst rejectHandler = error => {\n\t\t\tcancel();\n\t\t\treject(error);\n\t\t};\n\n\t\tcancel = () => {\n\t\t\tfor (const event of events) {\n\t\t\t\tremoveListener(event, onItem);\n\t\t\t}\n\n\t\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t\t}\n\t\t};\n\n\t\tfor (const event of events) {\n\t\t\taddListener(event, onItem);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\taddListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tif (options.resolveImmediately) {\n\t\t\tresolve(items);\n\t\t}\n\t});\n\n\treturnValue.cancel = cancel;\n\n\tif (typeof options.timeout === 'number') {\n\t\tconst timeout = (0,p_timeout__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(returnValue, options.timeout);\n\t\ttimeout.cancel = cancel;\n\t\treturn timeout;\n\t}\n\n\treturn returnValue;\n}\n\nfunction pEvent(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\toptions = {\n\t\t...options,\n\t\tcount: 1,\n\t\tresolveImmediately: false,\n\t};\n\n\tconst arrayPromise = pEventMultiple(emitter, event, options);\n\tconst promise = arrayPromise.then(array => array[0]); // eslint-disable-line promise/prefer-await-to-then\n\tpromise.cancel = arrayPromise.cancel;\n\n\treturn promise;\n}\n\nfunction pEventIterator(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\t// Allow multiple events\n\tconst events = [event].flat();\n\n\toptions = {\n\t\trejectionEvents: ['error'],\n\t\tresolutionEvents: [],\n\t\tlimit: Number.POSITIVE_INFINITY,\n\t\tmultiArgs: false,\n\t\t...options,\n\t};\n\n\tconst {limit} = options;\n\tconst isValidLimit = limit >= 0 && (limit === Number.POSITIVE_INFINITY || Number.isInteger(limit));\n\tif (!isValidLimit) {\n\t\tthrow new TypeError('The `limit` option should be a non-negative integer or Infinity');\n\t}\n\n\tif (limit === 0) {\n\t\t// Return an empty async iterator to avoid any further cost\n\t\treturn {\n\t\t\t[Symbol.asyncIterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tasync next() {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\tlet isDone = false;\n\tlet error;\n\tlet hasPendingError = false;\n\tconst nextQueue = [];\n\tconst valueQueue = [];\n\tlet eventCount = 0;\n\tlet isLimitReached = false;\n\n\tconst valueHandler = (...arguments_) => {\n\t\teventCount++;\n\t\tisLimitReached = eventCount === limit;\n\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\n\t\t\tresolve({done: false, value});\n\n\t\t\tif (isLimitReached) {\n\t\t\t\tcancel();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueQueue.push(value);\n\n\t\tif (isLimitReached) {\n\t\t\tcancel();\n\t\t}\n\t};\n\n\tconst cancel = () => {\n\t\tisDone = true;\n\n\t\tfor (const event of events) {\n\t\t\tremoveListener(event, valueHandler);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\t\tremoveListener(resolutionEvent, resolveHandler);\n\t\t}\n\n\t\twhile (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value: undefined});\n\t\t}\n\t};\n\n\tconst rejectHandler = (...arguments_) => {\n\t\terror = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {reject} = nextQueue.shift();\n\t\t\treject(error);\n\t\t} else {\n\t\t\thasPendingError = true;\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tconst resolveHandler = (...arguments_) => {\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\tif (options.filter && !options.filter(value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value});\n\t\t} else {\n\t\t\tvalueQueue.push(value);\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tfor (const event of events) {\n\t\taddListener(event, valueHandler);\n\t}\n\n\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\taddListener(rejectionEvent, rejectHandler);\n\t}\n\n\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\taddListener(resolutionEvent, resolveHandler);\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\treturn this;\n\t\t},\n\t\tasync next() {\n\t\t\tif (valueQueue.length > 0) {\n\t\t\t\tconst value = valueQueue.shift();\n\t\t\t\treturn {\n\t\t\t\t\tdone: isDone && valueQueue.length === 0 && !isLimitReached,\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (hasPendingError) {\n\t\t\t\thasPendingError = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (isDone) {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tnextQueue.push({resolve, reject});\n\t\t\t});\n\t\t},\n\t\tasync return(value) {\n\t\t\tcancel();\n\t\t\treturn {\n\t\t\t\tdone: isDone,\n\t\t\t\tvalue,\n\t\t\t};\n\t\t},\n\t};\n}\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/node_modules/p-event/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/core/node_modules/p-timeout/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@waku/core/node_modules/p-timeout/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ \"default\": () => (/* binding */ pTimeout)\n/* harmony export */ });\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nclass AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined ?\n\tnew AbortError(errorMessage) :\n\tnew DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined ?\n\t\tgetDOMException('This operation was aborted.') :\n\t\tsignal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nfunction pTimeout(promise, milliseconds, fallback, options) {\n\tlet timer;\n\n\tconst cancelablePromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tresolve(promise);\n\t\t\treturn;\n\t\t}\n\n\t\toptions = {\n\t\t\tcustomTimers: {setTimeout, clearTimeout},\n\t\t\t...options\n\t\t};\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\ttimer = options.customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (typeof fallback === 'function') {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\treject(timeoutError);\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t} finally {\n\t\t\t\toptions.customTimers.clearTimeout.call(undefined, timer);\n\t\t\t}\n\t\t})();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tclearTimeout(timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/@waku/core/node_modules/p-timeout/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/dns-discovery/dist/dns.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/dns-discovery/dist/dns.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnsNodeDiscovery: () => (/* binding */ DnsNodeDiscovery)\n/* harmony export */ });\n/* harmony import */ var _waku_enr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/enr */ \"./node_modules/@waku/enr/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _dns_over_https_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dns_over_https.js */ \"./node_modules/@waku/dns-discovery/dist/dns_over_https.js\");\n/* harmony import */ var _enrtree_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enrtree.js */ \"./node_modules/@waku/dns-discovery/dist/enrtree.js\");\n/* harmony import */ var _fetch_nodes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fetch_nodes.js */ \"./node_modules/@waku/dns-discovery/dist/fetch_nodes.js\");\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_1__(\"waku:discovery:dns\");\nclass DnsNodeDiscovery {\n dns;\n _DNSTreeCache;\n _errorTolerance = 10;\n static async dnsOverHttp(dnsClient) {\n if (!dnsClient) {\n dnsClient = await _dns_over_https_js__WEBPACK_IMPORTED_MODULE_2__.DnsOverHttps.create();\n }\n return new DnsNodeDiscovery(dnsClient);\n }\n /**\n * Returns a list of verified peers listed in an EIP-1459 DNS tree. Method may\n * return fewer peers than requested if @link wantedNodeCapabilityCount requires\n * larger quantity of peers than available or the number of errors/duplicate\n * peers encountered by randomized search exceeds the sum of the fields of\n * @link wantedNodeCapabilityCount plus the @link _errorTolerance factor.\n */\n async getPeers(enrTreeUrls, wantedNodeCapabilityCount) {\n const networkIndex = Math.floor(Math.random() * enrTreeUrls.length);\n const { publicKey, domain } = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseTree(enrTreeUrls[networkIndex]);\n const context = {\n domain,\n publicKey,\n visits: {},\n };\n const peers = await (0,_fetch_nodes_js__WEBPACK_IMPORTED_MODULE_4__.fetchNodesUntilCapabilitiesFulfilled)(wantedNodeCapabilityCount, this._errorTolerance, () => this._search(domain, context));\n log(\"retrieved peers: \", peers.map((peer) => {\n return {\n id: peer.peerId?.toString(),\n multiaddrs: peer.multiaddrs?.map((ma) => ma.toString()),\n };\n }));\n return peers;\n }\n constructor(dns) {\n this._DNSTreeCache = {};\n this.dns = dns;\n }\n /**\n * {@inheritDoc getPeers}\n */\n async *getNextPeer(enrTreeUrls, wantedNodeCapabilityCount) {\n const networkIndex = Math.floor(Math.random() * enrTreeUrls.length);\n const { publicKey, domain } = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseTree(enrTreeUrls[networkIndex]);\n const context = {\n domain,\n publicKey,\n visits: {},\n };\n for await (const peer of (0,_fetch_nodes_js__WEBPACK_IMPORTED_MODULE_4__.yieldNodesUntilCapabilitiesFulfilled)(wantedNodeCapabilityCount, this._errorTolerance, () => this._search(domain, context))) {\n yield peer;\n }\n }\n /**\n * Runs a recursive, randomized descent of the DNS tree to retrieve a single\n * ENR record as an ENR. Returns null if parsing or DNS resolution fails.\n */\n async _search(subdomain, context) {\n try {\n const entry = await this._getTXTRecord(subdomain, context);\n context.visits[subdomain] = true;\n let next;\n let branches;\n const entryType = getEntryType(entry);\n try {\n switch (entryType) {\n case _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.ROOT_PREFIX:\n next = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseAndVerifyRoot(entry, context.publicKey);\n return await this._search(next, context);\n case _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.BRANCH_PREFIX:\n branches = _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.parseBranch(entry);\n next = selectRandomPath(branches, context);\n return await this._search(next, context);\n case _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.RECORD_PREFIX:\n return _waku_enr__WEBPACK_IMPORTED_MODULE_0__.EnrDecoder.fromString(entry);\n default:\n return null;\n }\n }\n catch (error) {\n log(`Failed to search DNS tree ${entryType} at subdomain ${subdomain}: ${error}`);\n return null;\n }\n }\n catch (error) {\n log(`Failed to retrieve TXT record at subdomain ${subdomain}: ${error}`);\n return null;\n }\n }\n /**\n * Retrieves the TXT record stored at a location from either\n * this DNS tree cache or via DNS query.\n *\n * @throws if the TXT Record contains non-UTF-8 values.\n */\n async _getTXTRecord(subdomain, context) {\n if (this._DNSTreeCache[subdomain]) {\n return this._DNSTreeCache[subdomain];\n }\n // Location is either the top level tree entry host or a subdomain of it.\n const location = subdomain !== context.domain\n ? `${subdomain}.${context.domain}`\n : context.domain;\n const response = await this.dns.resolveTXT(location);\n if (!response.length)\n throw new Error(\"Received empty result array while fetching TXT record\");\n if (!response[0].length)\n throw new Error(\"Received empty TXT record\");\n // Branch entries can be an array of strings of comma delimited subdomains, with\n // some subdomain strings split across the array elements\n const result = response.join(\"\");\n this._DNSTreeCache[subdomain] = result;\n return result;\n }\n}\nfunction getEntryType(entry) {\n if (entry.startsWith(_enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.ROOT_PREFIX))\n return _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.ROOT_PREFIX;\n if (entry.startsWith(_enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.BRANCH_PREFIX))\n return _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.BRANCH_PREFIX;\n if (entry.startsWith(_enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.RECORD_PREFIX))\n return _enrtree_js__WEBPACK_IMPORTED_MODULE_3__.ENRTree.RECORD_PREFIX;\n return \"\";\n}\n/**\n * Returns a randomly selected subdomain string from the list provided by a branch\n * entry record.\n *\n * The client must track subdomains which are already resolved to avoid\n * going into an infinite loop b/c branch entries can contain\n * circular references. It’s in the client’s best interest to traverse the\n * tree in random order.\n */\nfunction selectRandomPath(branches, context) {\n // Identify domains already visited in this traversal of the DNS tree.\n // Then filter against them to prevent cycles.\n const circularRefs = {};\n for (const [idx, subdomain] of branches.entries()) {\n if (context.visits[subdomain]) {\n circularRefs[idx] = true;\n }\n }\n // If all possible paths are circular...\n if (Object.keys(circularRefs).length === branches.length) {\n throw new Error(\"Unresolvable circular path detected\");\n }\n // Randomly select a viable path\n let index;\n do {\n index = Math.floor(Math.random() * branches.length);\n } while (circularRefs[index]);\n return branches[index];\n}\n//# sourceMappingURL=dns.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/dns-discovery/dist/dns.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/dns-discovery/dist/dns_over_https.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@waku/dns-discovery/dist/dns_over_https.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnsOverHttps: () => (/* binding */ DnsOverHttps)\n/* harmony export */ });\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var dns_query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dns-query */ \"./node_modules/dns-query/index.mjs\");\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_1__(\"waku:dns-over-https\");\nclass DnsOverHttps {\n endpoints;\n retries;\n /**\n * Create new Dns-Over-Http DNS client.\n *\n * @param endpoints The endpoints for Dns-Over-Https queries;\n * Defaults to using dns-query's API..\n * @param retries Retries if a given endpoint fails.\n *\n * @throws {code: string} If DNS query fails.\n */\n static async create(endpoints, retries) {\n const _endpoints = endpoints ?? (await dns_query__WEBPACK_IMPORTED_MODULE_2__.wellknown.endpoints(\"doh\"));\n return new DnsOverHttps(_endpoints, retries);\n }\n constructor(endpoints, retries = 3) {\n this.endpoints = endpoints;\n this.retries = retries;\n }\n /**\n * Resolves a TXT record\n *\n * @param domain The domain name\n *\n * @throws if the query fails\n */\n async resolveTXT(domain) {\n let answers;\n try {\n const res = await (0,dns_query__WEBPACK_IMPORTED_MODULE_2__.query)({\n question: { type: \"TXT\", name: domain },\n }, {\n endpoints: this.endpoints,\n retries: this.retries,\n });\n answers = res.answers;\n }\n catch (error) {\n log(\"query failed: \", error);\n throw new Error(\"DNS query failed\");\n }\n if (!answers)\n throw new Error(`Could not resolve ${domain}`);\n const data = answers.map((a) => a.data);\n const result = [];\n data.forEach((d) => {\n if (typeof d === \"string\") {\n result.push(d);\n }\n else if (Array.isArray(d)) {\n d.forEach((sd) => {\n if (typeof sd === \"string\") {\n result.push(sd);\n }\n else {\n result.push((0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.bytesToUtf8)(sd));\n }\n });\n }\n else {\n result.push((0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.bytesToUtf8)(d));\n }\n });\n return result;\n }\n}\n//# sourceMappingURL=dns_over_https.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/dns-discovery/dist/dns_over_https.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/dns-discovery/dist/enrtree.js": +/*!**********************************************************!*\ + !*** ./node_modules/@waku/dns-discovery/dist/enrtree.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENRTree: () => (/* binding */ ENRTree)\n/* harmony export */ });\n/* harmony import */ var _waku_enr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/enr */ \"./node_modules/@waku/enr/dist/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var hi_base32__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! hi-base32 */ \"./node_modules/hi-base32/src/base32.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n\n\n\n\n\nclass ENRTree {\n static RECORD_PREFIX = _waku_enr__WEBPACK_IMPORTED_MODULE_0__.ENR.RECORD_PREFIX;\n static TREE_PREFIX = \"enrtree:\";\n static BRANCH_PREFIX = \"enrtree-branch:\";\n static ROOT_PREFIX = \"enrtree-root:\";\n /**\n * Extracts the branch subdomain referenced by a DNS tree root string after verifying\n * the root record signature with its base32 compressed public key.\n */\n static parseAndVerifyRoot(root, publicKey) {\n if (!root.startsWith(this.ROOT_PREFIX))\n throw new Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);\n const rootValues = ENRTree.parseRootValues(root);\n const decodedPublicKey = hi_base32__WEBPACK_IMPORTED_MODULE_2__.decode.asBytes(publicKey);\n // The signature is a 65-byte secp256k1 over the keccak256 hash\n // of the record content, excluding the `sig=` part, encoded as URL-safe base64 string\n // (Trailing recovery bit must be trimmed to pass `ecdsaVerify` method)\n const signedComponent = root.split(\" sig\")[0];\n const signedComponentBuffer = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(signedComponent);\n const signatureBuffer = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_3__.fromString)(rootValues.signature, \"base64url\").slice(0, 64);\n const isVerified = (0,_waku_enr__WEBPACK_IMPORTED_MODULE_0__.verifySignature)(signatureBuffer, (0,_waku_enr__WEBPACK_IMPORTED_MODULE_0__.keccak256)(signedComponentBuffer), new Uint8Array(decodedPublicKey));\n if (!isVerified)\n throw new Error(\"Unable to verify ENRTree root signature\");\n return rootValues.eRoot;\n }\n static parseRootValues(txt) {\n const matches = txt.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\\d+) sig=([^ ]+)$/);\n if (!Array.isArray(matches))\n throw new Error(\"Could not parse ENRTree root entry\");\n matches.shift(); // The first entry is the full match\n const [eRoot, lRoot, seq, signature] = matches;\n if (!eRoot)\n throw new Error(\"Could not parse 'e' value from ENRTree root entry\");\n if (!lRoot)\n throw new Error(\"Could not parse 'l' value from ENRTree root entry\");\n if (!seq)\n throw new Error(\"Could not parse 'seq' value from ENRTree root entry\");\n if (!signature)\n throw new Error(\"Could not parse 'sig' value from ENRTree root entry\");\n return { eRoot, lRoot, seq: Number(seq), signature };\n }\n /**\n * Returns the public key and top level domain of an ENR tree entry.\n * The domain is the starting point for traversing a set of linked DNS TXT records\n * and the public key is used to verify the root entry record\n */\n static parseTree(tree) {\n if (!tree.startsWith(this.TREE_PREFIX))\n throw new Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);\n const matches = tree.match(/^enrtree:\\/\\/([^@]+)@(.+)$/);\n if (!Array.isArray(matches))\n throw new Error(\"Could not parse ENRTree tree entry\");\n matches.shift(); // The first entry is the full match\n const [publicKey, domain] = matches;\n if (!publicKey)\n throw new Error(\"Could not parse public key from ENRTree tree entry\");\n if (!domain)\n throw new Error(\"Could not parse domain from ENRTree tree entry\");\n return { publicKey, domain };\n }\n /**\n * Returns subdomains listed in an ENR branch entry. These in turn lead to\n * either further branch entries or ENR records.\n */\n static parseBranch(branch) {\n if (!branch.startsWith(this.BRANCH_PREFIX))\n throw new Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);\n return branch.split(this.BRANCH_PREFIX)[1].split(\",\");\n }\n}\n\n//# sourceMappingURL=enrtree.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/dns-discovery/dist/enrtree.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/dns-discovery/dist/fetch_nodes.js": +/*!**************************************************************!*\ + !*** ./node_modules/@waku/dns-discovery/dist/fetch_nodes.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fetchNodesUntilCapabilitiesFulfilled: () => (/* binding */ fetchNodesUntilCapabilitiesFulfilled),\n/* harmony export */ yieldNodesUntilCapabilitiesFulfilled: () => (/* binding */ yieldNodesUntilCapabilitiesFulfilled)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_0__(\"waku:discovery:fetch_nodes\");\n/**\n * Fetch nodes using passed [[getNode]] until all wanted capabilities are\n * fulfilled or the number of [[getNode]] call exceeds the sum of\n * [[wantedNodeCapabilityCount]] plus [[errorTolerance]].\n */\nasync function fetchNodesUntilCapabilitiesFulfilled(wantedNodeCapabilityCount, errorTolerance, getNode) {\n const wanted = {\n relay: wantedNodeCapabilityCount.relay ?? 0,\n store: wantedNodeCapabilityCount.store ?? 0,\n filter: wantedNodeCapabilityCount.filter ?? 0,\n lightPush: wantedNodeCapabilityCount.lightPush ?? 0,\n };\n const maxSearches = wanted.relay + wanted.store + wanted.filter + wanted.lightPush;\n const actual = {\n relay: 0,\n store: 0,\n filter: 0,\n lightPush: 0,\n };\n let totalSearches = 0;\n const peers = [];\n while (!isSatisfied(wanted, actual) &&\n totalSearches < maxSearches + errorTolerance) {\n const peer = await getNode();\n if (peer && isNewPeer(peer, peers)) {\n // ENRs without a waku2 key are ignored.\n if (peer.waku2) {\n if (helpsSatisfyCapabilities(peer.waku2, wanted, actual)) {\n addCapabilities(peer.waku2, actual);\n peers.push(peer);\n }\n }\n log(`got new peer candidate from DNS address=${peer.nodeId}@${peer.ip}`);\n }\n totalSearches++;\n }\n return peers;\n}\n/**\n * Fetch nodes using passed [[getNode]] until all wanted capabilities are\n * fulfilled or the number of [[getNode]] call exceeds the sum of\n * [[wantedNodeCapabilityCount]] plus [[errorTolerance]].\n */\nasync function* yieldNodesUntilCapabilitiesFulfilled(wantedNodeCapabilityCount, errorTolerance, getNode) {\n const wanted = {\n relay: wantedNodeCapabilityCount.relay ?? 0,\n store: wantedNodeCapabilityCount.store ?? 0,\n filter: wantedNodeCapabilityCount.filter ?? 0,\n lightPush: wantedNodeCapabilityCount.lightPush ?? 0,\n };\n const maxSearches = wanted.relay + wanted.store + wanted.filter + wanted.lightPush;\n const actual = {\n relay: 0,\n store: 0,\n filter: 0,\n lightPush: 0,\n };\n let totalSearches = 0;\n const peerNodeIds = new Set();\n while (!isSatisfied(wanted, actual) &&\n totalSearches < maxSearches + errorTolerance) {\n const peer = await getNode();\n if (peer && peer.nodeId && !peerNodeIds.has(peer.nodeId)) {\n peerNodeIds.add(peer.nodeId);\n // ENRs without a waku2 key are ignored.\n if (peer.waku2) {\n if (helpsSatisfyCapabilities(peer.waku2, wanted, actual)) {\n addCapabilities(peer.waku2, actual);\n yield peer;\n }\n }\n log(`got new peer candidate from DNS address=${peer.nodeId}@${peer.ip}`);\n }\n totalSearches++;\n }\n}\nfunction isSatisfied(wanted, actual) {\n return (actual.relay >= wanted.relay &&\n actual.store >= wanted.store &&\n actual.filter >= wanted.filter &&\n actual.lightPush >= wanted.lightPush);\n}\nfunction isNewPeer(peer, peers) {\n if (!peer.nodeId)\n return false;\n for (const existingPeer of peers) {\n if (peer.nodeId === existingPeer.nodeId) {\n return false;\n }\n }\n return true;\n}\nfunction addCapabilities(node, total) {\n if (node.relay)\n total.relay += 1;\n if (node.store)\n total.store += 1;\n if (node.filter)\n total.filter += 1;\n if (node.lightPush)\n total.lightPush += 1;\n}\n/**\n * Checks if the proposed ENR [[node]] helps satisfy the [[wanted]] capabilities,\n * considering the [[actual]] capabilities of nodes retrieved so far..\n *\n * @throws If the function is called when the wanted capabilities are already fulfilled.\n */\nfunction helpsSatisfyCapabilities(node, wanted, actual) {\n if (isSatisfied(wanted, actual)) {\n throw \"Internal Error: Waku2 wanted capabilities are already fulfilled\";\n }\n const missing = missingCapabilities(wanted, actual);\n return ((missing.relay && node.relay) ||\n (missing.store && node.store) ||\n (missing.filter && node.filter) ||\n (missing.lightPush && node.lightPush));\n}\n/**\n * Return a [[Waku2]] Object for which capabilities are set to true if they are\n * [[wanted]] yet missing from [[actual]].\n */\nfunction missingCapabilities(wanted, actual) {\n return {\n relay: actual.relay < wanted.relay,\n store: actual.store < wanted.store,\n filter: actual.filter < wanted.filter,\n lightPush: actual.lightPush < wanted.lightPush,\n };\n}\n//# sourceMappingURL=fetch_nodes.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/dns-discovery/dist/fetch_nodes.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/dns-discovery/dist/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@waku/dns-discovery/dist/index.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DnsNodeDiscovery: () => (/* reexport safe */ _dns_js__WEBPACK_IMPORTED_MODULE_3__.DnsNodeDiscovery),\n/* harmony export */ PeerDiscoveryDns: () => (/* binding */ PeerDiscoveryDns),\n/* harmony export */ enrTree: () => (/* binding */ enrTree),\n/* harmony export */ wakuDnsDiscovery: () => (/* binding */ wakuDnsDiscovery)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_peer_discovery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-peer-discovery */ \"./node_modules/@libp2p/interface-peer-discovery/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _dns_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dns.js */ \"./node_modules/@waku/dns-discovery/dist/dns.js\");\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_2__(\"waku:peer-discovery-dns\");\nconst enrTree = {\n TEST: \"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im\",\n PROD: \"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im\",\n};\nconst DEFAULT_BOOTSTRAP_TAG_NAME = \"bootstrap\";\nconst DEFAULT_BOOTSTRAP_TAG_VALUE = 50;\nconst DEFAULT_BOOTSTRAP_TAG_TTL = 120000;\n/**\n * Parse options and expose function to return bootstrap peer addresses.\n */\nclass PeerDiscoveryDns extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter {\n nextPeer;\n _started;\n _components;\n _options;\n constructor(components, options) {\n super();\n this._started = false;\n this._components = components;\n this._options = options;\n const { enrUrls } = options;\n log(\"Use following EIP-1459 ENR Tree URLs: \", enrUrls);\n }\n /**\n * Start discovery process\n */\n async start() {\n log(\"Starting peer discovery via dns\");\n this._started = true;\n if (this.nextPeer === undefined) {\n let { enrUrls } = this._options;\n if (!Array.isArray(enrUrls))\n enrUrls = [enrUrls];\n const { wantedNodeCapabilityCount } = this._options;\n const dns = await _dns_js__WEBPACK_IMPORTED_MODULE_3__.DnsNodeDiscovery.dnsOverHttp();\n this.nextPeer = dns.getNextPeer.bind(dns, enrUrls, wantedNodeCapabilityCount);\n }\n for await (const peerEnr of this.nextPeer()) {\n if (!this._started) {\n return;\n }\n const peerInfo = peerEnr.peerInfo;\n if (!peerInfo) {\n continue;\n }\n const tagsToUpdate = {\n tags: {\n [DEFAULT_BOOTSTRAP_TAG_NAME]: {\n value: this._options.tagValue ?? DEFAULT_BOOTSTRAP_TAG_VALUE,\n ttl: this._options.tagTTL ?? DEFAULT_BOOTSTRAP_TAG_TTL,\n },\n },\n };\n let isPeerChanged = false;\n const isPeerExists = await this._components.peerStore.has(peerInfo.id);\n if (isPeerExists) {\n const peer = await this._components.peerStore.get(peerInfo.id);\n const hasBootstrapTag = peer.tags.has(DEFAULT_BOOTSTRAP_TAG_NAME);\n if (!hasBootstrapTag) {\n isPeerChanged = true;\n await this._components.peerStore.merge(peerInfo.id, tagsToUpdate);\n }\n }\n else {\n isPeerChanged = true;\n await this._components.peerStore.save(peerInfo.id, tagsToUpdate);\n }\n if (isPeerChanged) {\n this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__.CustomEvent(\"peer\", { detail: peerInfo }));\n }\n }\n }\n /**\n * Stop emitting events\n */\n stop() {\n this._started = false;\n }\n get [_libp2p_interface_peer_discovery__WEBPACK_IMPORTED_MODULE_0__.peerDiscovery]() {\n return true;\n }\n get [Symbol.toStringTag]() {\n return \"@waku/bootstrap\";\n }\n}\nfunction wakuDnsDiscovery(enrUrls, wantedNodeCapabilityCount) {\n return (components) => new PeerDiscoveryDns(components, { enrUrls, wantedNodeCapabilityCount });\n}\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/dns-discovery/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/constants.js": +/*!**************************************************!*\ + !*** ./node_modules/@waku/enr/dist/constants.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ERR_INVALID_ID: () => (/* binding */ ERR_INVALID_ID),\n/* harmony export */ ERR_NO_SIGNATURE: () => (/* binding */ ERR_NO_SIGNATURE),\n/* harmony export */ MAX_RECORD_SIZE: () => (/* binding */ MAX_RECORD_SIZE),\n/* harmony export */ MULTIADDR_LENGTH_SIZE: () => (/* binding */ MULTIADDR_LENGTH_SIZE)\n/* harmony export */ });\n// Maximum encoded size of an ENR\nconst MAX_RECORD_SIZE = 300;\nconst ERR_INVALID_ID = \"Invalid record id\";\nconst ERR_NO_SIGNATURE = \"No valid signature found\";\n// The maximum length of byte size of a multiaddr to encode in the `multiaddr` field\n// The size is a big endian 16-bit unsigned integer\nconst MULTIADDR_LENGTH_SIZE = 2;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/creator.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/enr/dist/creator.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EnrCreator: () => (/* binding */ EnrCreator)\n/* harmony export */ });\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/enr/dist/crypto.js\");\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/enr/dist/enr.js\");\n/* harmony import */ var _peer_id_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./peer_id.js */ \"./node_modules/@waku/enr/dist/peer_id.js\");\n\n\n\n\nclass EnrCreator {\n static fromPublicKey(publicKey, kvs = {}) {\n // EIP-778 specifies that the key must be in compressed format, 33 bytes\n if (publicKey.length !== 33) {\n publicKey = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_1__.compressPublicKey)(publicKey);\n }\n return _enr_js__WEBPACK_IMPORTED_MODULE_2__.ENR.create({\n ...kvs,\n id: (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.utf8ToBytes)(\"v4\"),\n secp256k1: publicKey,\n });\n }\n static async fromPeerId(peerId, kvs = {}) {\n switch (peerId.type) {\n case \"secp256k1\":\n return EnrCreator.fromPublicKey((0,_peer_id_js__WEBPACK_IMPORTED_MODULE_3__.getPublicKeyFromPeerId)(peerId), kvs);\n default:\n throw new Error();\n }\n }\n}\n//# sourceMappingURL=creator.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/creator.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/crypto.js": +/*!***********************************************!*\ + !*** ./node_modules/@waku/enr/dist/crypto.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compressPublicKey: () => (/* binding */ compressPublicKey),\n/* harmony export */ keccak256: () => (/* binding */ keccak256),\n/* harmony export */ sign: () => (/* binding */ sign),\n/* harmony export */ verifySignature: () => (/* binding */ verifySignature)\n/* harmony export */ });\n/* harmony import */ var _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/secp256k1 */ \"./node_modules/@noble/secp256k1/lib/esm/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n\n\n\n/**\n * ECDSA Sign a message with the given private key.\n *\n * @param message The message to sign, usually a hash.\n * @param privateKey The ECDSA private key to use to sign the message.\n *\n * @returns The signature and the recovery id concatenated.\n */\nasync function sign(message, privateKey) {\n const [signature, recoveryId] = await _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.sign(message, privateKey, {\n recovered: true,\n der: false,\n });\n return (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.concat)([signature, new Uint8Array([recoveryId])], signature.length + 1);\n}\nfunction keccak256(input) {\n return new Uint8Array(js_sha3__WEBPACK_IMPORTED_MODULE_2__.keccak256.arrayBuffer(input));\n}\nfunction compressPublicKey(publicKey) {\n if (publicKey.length === 64) {\n publicKey = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.concat)([new Uint8Array([4]), publicKey], 65);\n }\n const point = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.Point.fromHex(publicKey);\n return point.toRawBytes(true);\n}\n/**\n * Verify an ECDSA signature.\n */\nfunction verifySignature(signature, message, publicKey) {\n try {\n const _signature = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.Signature.fromCompact(signature.slice(0, 64));\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.verify(_signature, message, publicKey);\n }\n catch {\n return false;\n }\n}\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/crypto.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/decoder.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/enr/dist/decoder.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EnrDecoder: () => (/* binding */ EnrDecoder)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/enr/dist/enr.js\");\n\n\n\n\n\nclass EnrDecoder {\n static fromString(encoded) {\n if (!encoded.startsWith(_enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR.RECORD_PREFIX)) {\n throw new Error(`\"string encoded ENR must start with '${_enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR.RECORD_PREFIX}'`);\n }\n return EnrDecoder.fromRLP((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(encoded.slice(4), \"base64url\"));\n }\n static fromRLP(encoded) {\n const decoded = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_4__.decode(encoded).map(_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.hexToBytes);\n return fromValues(decoded);\n }\n}\nasync function fromValues(values) {\n const { signature, seq, kvs } = checkValues(values);\n const obj = {};\n for (let i = 0; i < kvs.length; i += 2) {\n try {\n obj[(0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.bytesToUtf8)(kvs[i])] = kvs[i + 1];\n }\n catch (e) {\n (0,debug__WEBPACK_IMPORTED_MODULE_1__.log)(\"Failed to decode ENR key to UTF-8, skipping it\", kvs[i], e);\n }\n }\n const _seq = decodeSeq(seq);\n const enr = await _enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR.create(obj, _seq, signature);\n checkSignature(seq, kvs, enr, signature);\n return enr;\n}\nfunction decodeSeq(seq) {\n // If seq is an empty array, translate as value 0\n if (!seq.length)\n return BigInt(0);\n return BigInt(\"0x\" + (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.bytesToHex)(seq));\n}\nfunction checkValues(values) {\n if (!Array.isArray(values)) {\n throw new Error(\"Decoded ENR must be an array\");\n }\n if (values.length % 2 !== 0) {\n throw new Error(\"Decoded ENR must have an even number of elements\");\n }\n const [signature, seq, ...kvs] = values;\n if (!signature || Array.isArray(signature)) {\n throw new Error(\"Decoded ENR invalid signature: must be a byte array\");\n }\n if (!seq || Array.isArray(seq)) {\n throw new Error(\"Decoded ENR invalid sequence number: must be a byte array\");\n }\n return { signature, seq, kvs };\n}\nfunction checkSignature(seq, kvs, enr, signature) {\n const rlpEncodedBytes = (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_0__.hexToBytes)(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_4__.encode([seq, ...kvs]));\n if (!enr.verify(rlpEncodedBytes, signature)) {\n throw new Error(\"Unable to verify ENR signature\");\n }\n}\n//# sourceMappingURL=decoder.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/decoder.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/enr.js": +/*!********************************************!*\ + !*** ./node_modules/@waku/enr/dist/enr.js ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENR: () => (/* binding */ ENR),\n/* harmony export */ TransportProtocol: () => (/* binding */ TransportProtocol),\n/* harmony export */ TransportProtocolPerIpVersion: () => (/* binding */ TransportProtocolPerIpVersion)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/enr/dist/constants.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/enr/dist/crypto.js\");\n/* harmony import */ var _get_multiaddr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./get_multiaddr.js */ \"./node_modules/@waku/enr/dist/get_multiaddr.js\");\n/* harmony import */ var _peer_id_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_id.js */ \"./node_modules/@waku/enr/dist/peer_id.js\");\n/* harmony import */ var _raw_enr_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./raw_enr.js */ \"./node_modules/@waku/enr/dist/raw_enr.js\");\n/* harmony import */ var _v4_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./v4.js */ \"./node_modules/@waku/enr/dist/v4.js\");\n\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_0__(\"waku:enr\");\nvar TransportProtocol;\n(function (TransportProtocol) {\n TransportProtocol[\"TCP\"] = \"tcp\";\n TransportProtocol[\"UDP\"] = \"udp\";\n})(TransportProtocol || (TransportProtocol = {}));\nvar TransportProtocolPerIpVersion;\n(function (TransportProtocolPerIpVersion) {\n TransportProtocolPerIpVersion[\"TCP4\"] = \"tcp4\";\n TransportProtocolPerIpVersion[\"UDP4\"] = \"udp4\";\n TransportProtocolPerIpVersion[\"TCP6\"] = \"tcp6\";\n TransportProtocolPerIpVersion[\"UDP6\"] = \"udp6\";\n})(TransportProtocolPerIpVersion || (TransportProtocolPerIpVersion = {}));\nclass ENR extends _raw_enr_js__WEBPACK_IMPORTED_MODULE_5__.RawEnr {\n static RECORD_PREFIX = \"enr:\";\n peerId;\n static async create(kvs = {}, seq = BigInt(1), signature) {\n const enr = new ENR(kvs, seq, signature);\n try {\n const publicKey = enr.publicKey;\n if (publicKey) {\n enr.peerId = await (0,_peer_id_js__WEBPACK_IMPORTED_MODULE_4__.createPeerIdFromPublicKey)(publicKey);\n }\n }\n catch (e) {\n log(\"Could not calculate peer id for ENR\", e);\n }\n return enr;\n }\n get nodeId() {\n switch (this.id) {\n case \"v4\":\n return this.publicKey ? _v4_js__WEBPACK_IMPORTED_MODULE_6__.nodeId(this.publicKey) : undefined;\n default:\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_ID);\n }\n }\n getLocationMultiaddr = _get_multiaddr_js__WEBPACK_IMPORTED_MODULE_3__.locationMultiaddrFromEnrFields.bind({}, this);\n setLocationMultiaddr(multiaddr) {\n const protoNames = multiaddr.protoNames();\n if (protoNames.length !== 2 &&\n protoNames[1] !== \"udp\" &&\n protoNames[1] !== \"tcp\") {\n throw new Error(\"Invalid multiaddr\");\n }\n const tuples = multiaddr.tuples();\n if (!tuples[0][1] || !tuples[1][1]) {\n throw new Error(\"Invalid multiaddr\");\n }\n // IPv4\n if (tuples[0][0] === 4) {\n this.set(\"ip\", tuples[0][1]);\n this.set(protoNames[1], tuples[1][1]);\n }\n else {\n this.set(\"ip6\", tuples[0][1]);\n this.set(protoNames[1] + \"6\", tuples[1][1]);\n }\n }\n getAllLocationMultiaddrs() {\n const multiaddrs = [];\n for (const protocol of Object.values(TransportProtocolPerIpVersion)) {\n const ma = this.getLocationMultiaddr(protocol);\n if (ma)\n multiaddrs.push(ma);\n }\n const _multiaddrs = this.multiaddrs ?? [];\n return multiaddrs.concat(_multiaddrs);\n }\n get peerInfo() {\n const id = this.peerId;\n if (!id)\n return;\n return {\n id,\n multiaddrs: this.getAllLocationMultiaddrs(),\n protocols: [],\n };\n }\n /**\n * Returns the full multiaddr from the ENR fields matching the provided\n * `protocol` parameter.\n * To return full multiaddrs from the `multiaddrs` ENR field,\n * use { @link ENR.getFullMultiaddrs }.\n *\n * @param protocol\n */\n getFullMultiaddr(protocol) {\n if (this.peerId) {\n const locationMultiaddr = this.getLocationMultiaddr(protocol);\n if (locationMultiaddr) {\n return locationMultiaddr.encapsulate(`/p2p/${this.peerId.toString()}`);\n }\n }\n return;\n }\n /**\n * Returns the full multiaddrs from the `multiaddrs` ENR field.\n */\n getFullMultiaddrs() {\n if (this.peerId && this.multiaddrs) {\n const peerId = this.peerId;\n return this.multiaddrs.map((ma) => {\n return ma.encapsulate(`/p2p/${peerId.toString()}`);\n });\n }\n return [];\n }\n verify(data, signature) {\n if (!this.get(\"id\") || this.id !== \"v4\") {\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_ID);\n }\n if (!this.publicKey) {\n throw new Error(\"Failed to verify ENR: No public key\");\n }\n return (0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.verifySignature)(signature, (0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)(data), this.publicKey);\n }\n async sign(data, privateKey) {\n switch (this.id) {\n case \"v4\":\n this.signature = await _v4_js__WEBPACK_IMPORTED_MODULE_6__.sign(privateKey, data);\n break;\n default:\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_1__.ERR_INVALID_ID);\n }\n return this.signature;\n }\n}\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/enr.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/get_multiaddr.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/enr/dist/get_multiaddr.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ locationMultiaddrFromEnrFields: () => (/* binding */ locationMultiaddrFromEnrFields)\n/* harmony export */ });\n/* harmony import */ var _multiaddr_from_fields_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./multiaddr_from_fields.js */ \"./node_modules/@waku/enr/dist/multiaddr_from_fields.js\");\n\nfunction locationMultiaddrFromEnrFields(enr, protocol) {\n switch (protocol) {\n case \"udp\":\n return (locationMultiaddrFromEnrFields(enr, \"udp4\") ||\n locationMultiaddrFromEnrFields(enr, \"udp6\"));\n case \"tcp\":\n return (locationMultiaddrFromEnrFields(enr, \"tcp4\") ||\n locationMultiaddrFromEnrFields(enr, \"tcp6\"));\n }\n const isIpv6 = protocol.endsWith(\"6\");\n const ipVal = enr.get(isIpv6 ? \"ip6\" : \"ip\");\n if (!ipVal)\n return;\n const protoName = protocol.slice(0, 3);\n let protoVal;\n switch (protoName) {\n case \"udp\":\n protoVal = isIpv6 ? enr.get(\"udp6\") : enr.get(\"udp\");\n break;\n case \"tcp\":\n protoVal = isIpv6 ? enr.get(\"tcp6\") : enr.get(\"tcp\");\n break;\n default:\n return;\n }\n if (!protoVal)\n return;\n return (0,_multiaddr_from_fields_js__WEBPACK_IMPORTED_MODULE_0__.multiaddrFromFields)(isIpv6 ? \"ip6\" : \"ip4\", protoName, ipVal, protoVal);\n}\n//# sourceMappingURL=get_multiaddr.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/get_multiaddr.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/index.js": +/*!**********************************************!*\ + !*** ./node_modules/@waku/enr/dist/index.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENR: () => (/* reexport safe */ _enr_js__WEBPACK_IMPORTED_MODULE_3__.ENR),\n/* harmony export */ ERR_INVALID_ID: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_INVALID_ID),\n/* harmony export */ ERR_NO_SIGNATURE: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.ERR_NO_SIGNATURE),\n/* harmony export */ EnrCreator: () => (/* reexport safe */ _creator_js__WEBPACK_IMPORTED_MODULE_1__.EnrCreator),\n/* harmony export */ EnrDecoder: () => (/* reexport safe */ _decoder_js__WEBPACK_IMPORTED_MODULE_2__.EnrDecoder),\n/* harmony export */ MAX_RECORD_SIZE: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.MAX_RECORD_SIZE),\n/* harmony export */ MULTIADDR_LENGTH_SIZE: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.MULTIADDR_LENGTH_SIZE),\n/* harmony export */ TransportProtocol: () => (/* reexport safe */ _enr_js__WEBPACK_IMPORTED_MODULE_3__.TransportProtocol),\n/* harmony export */ TransportProtocolPerIpVersion: () => (/* reexport safe */ _enr_js__WEBPACK_IMPORTED_MODULE_3__.TransportProtocolPerIpVersion),\n/* harmony export */ compressPublicKey: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.compressPublicKey),\n/* harmony export */ createPeerIdFromPublicKey: () => (/* reexport safe */ _peer_id_js__WEBPACK_IMPORTED_MODULE_4__.createPeerIdFromPublicKey),\n/* harmony export */ decodeWaku2: () => (/* reexport safe */ _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__.decodeWaku2),\n/* harmony export */ encodeWaku2: () => (/* reexport safe */ _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__.encodeWaku2),\n/* harmony export */ getPrivateKeyFromPeerId: () => (/* reexport safe */ _peer_id_js__WEBPACK_IMPORTED_MODULE_4__.getPrivateKeyFromPeerId),\n/* harmony export */ getPublicKeyFromPeerId: () => (/* reexport safe */ _peer_id_js__WEBPACK_IMPORTED_MODULE_4__.getPublicKeyFromPeerId),\n/* harmony export */ keccak256: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.keccak256),\n/* harmony export */ sign: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.sign),\n/* harmony export */ verifySignature: () => (/* reexport safe */ _crypto_js__WEBPACK_IMPORTED_MODULE_6__.verifySignature)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/enr/dist/constants.js\");\n/* harmony import */ var _creator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./creator.js */ \"./node_modules/@waku/enr/dist/creator.js\");\n/* harmony import */ var _decoder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decoder.js */ \"./node_modules/@waku/enr/dist/decoder.js\");\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/enr/dist/enr.js\");\n/* harmony import */ var _peer_id_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_id.js */ \"./node_modules/@waku/enr/dist/peer_id.js\");\n/* harmony import */ var _waku2_codec_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./waku2_codec.js */ \"./node_modules/@waku/enr/dist/waku2_codec.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/enr/dist/crypto.js\");\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/multiaddr_from_fields.js": +/*!**************************************************************!*\ + !*** ./node_modules/@waku/enr/dist/multiaddr_from_fields.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiaddrFromFields: () => (/* binding */ multiaddrFromFields)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @multiformats/multiaddr/convert */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n\n\nfunction multiaddrFromFields(ipFamily, protocol, ipBytes, protocolBytes) {\n let ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(\"/\" + ipFamily + \"/\" + (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_1__.convertToString)(ipFamily, ipBytes));\n ma = ma.encapsulate((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(\"/\" + protocol + \"/\" + (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_1__.convertToString)(protocol, protocolBytes)));\n return ma;\n}\n//# sourceMappingURL=multiaddr_from_fields.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/multiaddr_from_fields.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/multiaddrs_codec.js": +/*!*********************************************************!*\ + !*** ./node_modules/@waku/enr/dist/multiaddrs_codec.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeMultiaddrs: () => (/* binding */ decodeMultiaddrs),\n/* harmony export */ encodeMultiaddrs: () => (/* binding */ encodeMultiaddrs)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/enr/dist/constants.js\");\n\n\nfunction decodeMultiaddrs(bytes) {\n const multiaddrs = [];\n let index = 0;\n while (index < bytes.length) {\n const sizeDataView = new DataView(bytes.buffer, index, _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE);\n const size = sizeDataView.getUint16(0);\n index += _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE;\n const multiaddrBytes = bytes.slice(index, index + size);\n index += size;\n multiaddrs.push((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_0__.multiaddr)(multiaddrBytes));\n }\n return multiaddrs;\n}\nfunction encodeMultiaddrs(multiaddrs) {\n const totalLength = multiaddrs.reduce((acc, ma) => acc + _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE + ma.bytes.length, 0);\n const bytes = new Uint8Array(totalLength);\n const dataView = new DataView(bytes.buffer);\n let index = 0;\n multiaddrs.forEach((multiaddr) => {\n if (multiaddr.getPeerId())\n throw new Error(\"`multiaddr` field MUST not contain peer id\");\n // Prepend the size of the next entry\n dataView.setUint16(index, multiaddr.bytes.length);\n index += _constants_js__WEBPACK_IMPORTED_MODULE_1__.MULTIADDR_LENGTH_SIZE;\n bytes.set(multiaddr.bytes, index);\n index += multiaddr.bytes.length;\n });\n return bytes;\n}\n//# sourceMappingURL=multiaddrs_codec.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/multiaddrs_codec.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/peer_id.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/enr/dist/peer_id.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPeerIdFromPublicKey: () => (/* binding */ createPeerIdFromPublicKey),\n/* harmony export */ getPrivateKeyFromPeerId: () => (/* binding */ getPrivateKeyFromPeerId),\n/* harmony export */ getPublicKeyFromPeerId: () => (/* binding */ getPublicKeyFromPeerId)\n/* harmony export */ });\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n\n\n\nfunction createPeerIdFromPublicKey(publicKey) {\n const _publicKey = new _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.supportedKeys.secp256k1.Secp256k1PublicKey(publicKey);\n return (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromKeys)(_publicKey.bytes, undefined);\n}\nfunction getPublicKeyFromPeerId(peerId) {\n if (peerId.type !== \"secp256k1\") {\n throw new Error(\"Unsupported peer id type\");\n }\n return (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPublicKey)(peerId.publicKey).marshal();\n}\n// Only used in tests\nasync function getPrivateKeyFromPeerId(peerId) {\n if (peerId.type !== \"secp256k1\") {\n throw new Error(\"Unsupported peer id type\");\n }\n if (!peerId.privateKey) {\n throw new Error(\"Private key not present on peer id\");\n }\n const privateKey = await (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_0__.unmarshalPrivateKey)(peerId.privateKey);\n return privateKey.marshal();\n}\n//# sourceMappingURL=peer_id.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/peer_id.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/raw_enr.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/enr/dist/raw_enr.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RawEnr: () => (/* binding */ RawEnr)\n/* harmony export */ });\n/* harmony import */ var _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @multiformats/multiaddr/convert */ \"./node_modules/@multiformats/multiaddr/dist/src/convert.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/enr/dist/constants.js\");\n/* harmony import */ var _multiaddrs_codec_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./multiaddrs_codec.js */ \"./node_modules/@waku/enr/dist/multiaddrs_codec.js\");\n/* harmony import */ var _waku2_codec_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./waku2_codec.js */ \"./node_modules/@waku/enr/dist/waku2_codec.js\");\n\n\n\n\n\nclass RawEnr extends Map {\n seq;\n signature;\n constructor(kvs = {}, seq = BigInt(1), signature) {\n super(Object.entries(kvs));\n this.seq = seq;\n this.signature = signature;\n }\n set(k, v) {\n this.signature = undefined;\n this.seq++;\n return super.set(k, v);\n }\n get id() {\n const id = this.get(\"id\");\n if (!id)\n throw new Error(\"id not found.\");\n return (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToUtf8)(id);\n }\n get publicKey() {\n switch (this.id) {\n case \"v4\":\n return this.get(\"secp256k1\");\n default:\n throw new Error(_constants_js__WEBPACK_IMPORTED_MODULE_2__.ERR_INVALID_ID);\n }\n }\n get ip() {\n return getStringValue(this, \"ip\", \"ip4\");\n }\n set ip(ip) {\n setStringValue(this, \"ip\", \"ip4\", ip);\n }\n get tcp() {\n return getNumberAsStringValue(this, \"tcp\", \"tcp\");\n }\n set tcp(port) {\n setNumberAsStringValue(this, \"tcp\", \"tcp\", port);\n }\n get udp() {\n return getNumberAsStringValue(this, \"udp\", \"udp\");\n }\n set udp(port) {\n setNumberAsStringValue(this, \"udp\", \"udp\", port);\n }\n get ip6() {\n return getStringValue(this, \"ip6\", \"ip6\");\n }\n set ip6(ip) {\n setStringValue(this, \"ip6\", \"ip6\", ip);\n }\n get tcp6() {\n return getNumberAsStringValue(this, \"tcp6\", \"tcp\");\n }\n set tcp6(port) {\n setNumberAsStringValue(this, \"tcp6\", \"tcp\", port);\n }\n get udp6() {\n return getNumberAsStringValue(this, \"udp6\", \"udp\");\n }\n set udp6(port) {\n setNumberAsStringValue(this, \"udp6\", \"udp\", port);\n }\n /**\n * Get the `multiaddrs` field from ENR.\n *\n * This field is used to store multiaddresses that cannot be stored with the current ENR pre-defined keys.\n * These can be a multiaddresses that include encapsulation (e.g. wss) or do not use `ip4` nor `ip6` for the host\n * address (e.g. `dns4`, `dnsaddr`, etc)..\n *\n * If the peer information only contains information that can be represented with the ENR pre-defined keys\n * (ip, tcp, etc) then the usage of { @link ENR.getLocationMultiaddr } should be preferred.\n *\n * The multiaddresses stored in this field are expected to be location multiaddresses, ie, peer id less.\n */\n get multiaddrs() {\n const raw = this.get(\"multiaddrs\");\n if (raw)\n return (0,_multiaddrs_codec_js__WEBPACK_IMPORTED_MODULE_3__.decodeMultiaddrs)(raw);\n return;\n }\n /**\n * Set the `multiaddrs` field on the ENR.\n *\n * This field is used to store multiaddresses that cannot be stored with the current ENR pre-defined keys.\n * These can be a multiaddresses that include encapsulation (e.g. wss) or do not use `ip4` nor `ip6` for the host\n * address (e.g. `dns4`, `dnsaddr`, etc)..\n *\n * If the peer information only contains information that can be represented with the ENR pre-defined keys\n * (ip, tcp, etc) then the usage of { @link ENR.setLocationMultiaddr } should be preferred.\n * The multiaddresses stored in this field must be location multiaddresses,\n * ie, without a peer id.\n */\n set multiaddrs(multiaddrs) {\n deleteUndefined(this, \"multiaddrs\", multiaddrs, _multiaddrs_codec_js__WEBPACK_IMPORTED_MODULE_3__.encodeMultiaddrs);\n }\n /**\n * Get the `waku2` field from ENR.\n */\n get waku2() {\n const raw = this.get(\"waku2\");\n if (raw)\n return (0,_waku2_codec_js__WEBPACK_IMPORTED_MODULE_4__.decodeWaku2)(raw[0]);\n return;\n }\n /**\n * Set the `waku2` field on the ENR.\n */\n set waku2(waku2) {\n deleteUndefined(this, \"waku2\", waku2, (w) => new Uint8Array([(0,_waku2_codec_js__WEBPACK_IMPORTED_MODULE_4__.encodeWaku2)(w)]));\n }\n}\nfunction getStringValue(map, key, proto) {\n const raw = map.get(key);\n if (!raw)\n return;\n return (0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToString)(proto, raw);\n}\nfunction getNumberAsStringValue(map, key, proto) {\n const raw = map.get(key);\n if (!raw)\n return;\n return Number((0,_multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToString)(proto, raw));\n}\nfunction setStringValue(map, key, proto, value) {\n deleteUndefined(map, key, value, _multiformats_multiaddr_convert__WEBPACK_IMPORTED_MODULE_0__.convertToBytes.bind({}, proto));\n}\nfunction setNumberAsStringValue(map, key, proto, value) {\n setStringValue(map, key, proto, value?.toString(10));\n}\nfunction deleteUndefined(map, key, value, transform) {\n if (value !== undefined) {\n map.set(key, transform(value));\n }\n else {\n map.delete(key);\n }\n}\n//# sourceMappingURL=raw_enr.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/raw_enr.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/v4.js": +/*!*******************************************!*\ + !*** ./node_modules/@waku/enr/dist/v4.js ***! + \*******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ nodeId: () => (/* binding */ nodeId),\n/* harmony export */ sign: () => (/* binding */ sign)\n/* harmony export */ });\n/* harmony import */ var _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/secp256k1 */ \"./node_modules/@noble/secp256k1/lib/esm/index.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./crypto.js */ \"./node_modules/@waku/enr/dist/crypto.js\");\n\n\n\nasync function sign(privKey, msg) {\n return _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.sign((0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)(msg), privKey, {\n der: false,\n });\n}\nfunction nodeId(pubKey) {\n const publicKey = _noble_secp256k1__WEBPACK_IMPORTED_MODULE_0__.Point.fromHex(pubKey);\n const uncompressedPubkey = publicKey.toRawBytes(false);\n return (0,_waku_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.bytesToHex)((0,_crypto_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)(uncompressedPubkey.slice(1)));\n}\n//# sourceMappingURL=v4.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/v4.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/enr/dist/waku2_codec.js": +/*!****************************************************!*\ + !*** ./node_modules/@waku/enr/dist/waku2_codec.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeWaku2: () => (/* binding */ decodeWaku2),\n/* harmony export */ encodeWaku2: () => (/* binding */ encodeWaku2)\n/* harmony export */ });\nfunction encodeWaku2(protocols) {\n let byte = 0;\n if (protocols.lightPush)\n byte += 1;\n byte = byte << 1;\n if (protocols.filter)\n byte += 1;\n byte = byte << 1;\n if (protocols.store)\n byte += 1;\n byte = byte << 1;\n if (protocols.relay)\n byte += 1;\n return byte;\n}\nfunction decodeWaku2(byte) {\n const waku2 = {\n relay: false,\n store: false,\n filter: false,\n lightPush: false,\n };\n if (byte % 2)\n waku2.relay = true;\n byte = byte >> 1;\n if (byte % 2)\n waku2.store = true;\n byte = byte >> 1;\n if (byte % 2)\n waku2.filter = true;\n byte = byte >> 1;\n if (byte % 2)\n waku2.lightPush = true;\n return waku2;\n}\n//# sourceMappingURL=waku2_codec.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/enr/dist/waku2_codec.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/connection_manager.js": +/*!******************************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/connection_manager.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* binding */ EPeersByDiscoveryEvents),\n/* harmony export */ Tags: () => (/* binding */ Tags)\n/* harmony export */ });\nvar Tags;\n(function (Tags) {\n Tags[\"BOOTSTRAP\"] = \"bootstrap\";\n Tags[\"PEER_EXCHANGE\"] = \"peer-exchange\";\n})(Tags || (Tags = {}));\nvar EPeersByDiscoveryEvents;\n(function (EPeersByDiscoveryEvents) {\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_BOOTSTRAP\"] = \"peer:discovery:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_DISCOVERY_PEER_EXCHANGE\"] = \"peer:discovery:peer-exchange\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_BOOTSTRAP\"] = \"peer:connected:bootstrap\";\n EPeersByDiscoveryEvents[\"PEER_CONNECT_PEER_EXCHANGE\"] = \"peer:connected:peer-exchange\";\n})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));\n//# sourceMappingURL=connection_manager.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/connection_manager.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/enr.js": +/*!***************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/enr.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=enr.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/enr.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/filter.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/filter.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/filter.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/index.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.EPeersByDiscoveryEvents),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _store_js__WEBPACK_IMPORTED_MODULE_7__.PageDirection),\n/* harmony export */ Protocols: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ SendError: () => (/* reexport safe */ _protocols_js__WEBPACK_IMPORTED_MODULE_5__.SendError),\n/* harmony export */ Tags: () => (/* reexport safe */ _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__.Tags)\n/* harmony export */ });\n/* harmony import */ var _enr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enr.js */ \"./node_modules/@waku/interfaces/dist/enr.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/@waku/interfaces/dist/filter.js\");\n/* harmony import */ var _light_push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./light_push.js */ \"./node_modules/@waku/interfaces/dist/light_push.js\");\n/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message.js */ \"./node_modules/@waku/interfaces/dist/message.js\");\n/* harmony import */ var _peer_exchange_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./peer_exchange.js */ \"./node_modules/@waku/interfaces/dist/peer_exchange.js\");\n/* harmony import */ var _protocols_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./protocols.js */ \"./node_modules/@waku/interfaces/dist/protocols.js\");\n/* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./relay.js */ \"./node_modules/@waku/interfaces/dist/relay.js\");\n/* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store.js */ \"./node_modules/@waku/interfaces/dist/store.js\");\n/* harmony import */ var _waku_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./waku.js */ \"./node_modules/@waku/interfaces/dist/waku.js\");\n/* harmony import */ var _connection_manager_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./connection_manager.js */ \"./node_modules/@waku/interfaces/dist/connection_manager.js\");\n/* harmony import */ var _sender_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sender.js */ \"./node_modules/@waku/interfaces/dist/sender.js\");\n/* harmony import */ var _receiver_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./receiver.js */ \"./node_modules/@waku/interfaces/dist/receiver.js\");\n/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./misc.js */ \"./node_modules/@waku/interfaces/dist/misc.js\");\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/@waku/interfaces/dist/libp2p.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/libp2p.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/libp2p.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/libp2p.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/light_push.js": +/*!**********************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/light_push.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/light_push.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/message.js": +/*!*******************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/message.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/message.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/misc.js": +/*!****************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/misc.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/misc.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/peer_exchange.js": +/*!*************************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/peer_exchange.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/peer_exchange.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/protocols.js": +/*!*********************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/protocols.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Protocols: () => (/* binding */ Protocols),\n/* harmony export */ SendError: () => (/* binding */ SendError)\n/* harmony export */ });\nvar Protocols;\n(function (Protocols) {\n Protocols[\"Relay\"] = \"relay\";\n Protocols[\"Store\"] = \"store\";\n Protocols[\"LightPush\"] = \"lightpush\";\n Protocols[\"Filter\"] = \"filter\";\n})(Protocols || (Protocols = {}));\nvar SendError;\n(function (SendError) {\n SendError[\"GENERIC_FAIL\"] = \"Generic error\";\n SendError[\"ENCODE_FAILED\"] = \"Failed to encode\";\n SendError[\"DECODE_FAILED\"] = \"Failed to decode\";\n SendError[\"SIZE_TOO_BIG\"] = \"Size is too big\";\n SendError[\"NO_RPC_RESPONSE\"] = \"No RPC response\";\n})(SendError || (SendError = {}));\n//# sourceMappingURL=protocols.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/protocols.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/receiver.js": +/*!********************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/receiver.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=receiver.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/receiver.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/relay.js": +/*!*****************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/relay.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=relay.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/relay.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/sender.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/sender.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=sender.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/sender.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/store.js": +/*!*****************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/store.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PageDirection: () => (/* binding */ PageDirection)\n/* harmony export */ });\nvar PageDirection;\n(function (PageDirection) {\n PageDirection[\"BACKWARD\"] = \"backward\";\n PageDirection[\"FORWARD\"] = \"forward\";\n})(PageDirection || (PageDirection = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/store.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/interfaces/dist/waku.js": +/*!****************************************************!*\ + !*** ./node_modules/@waku/interfaces/dist/waku.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=waku.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/interfaces/dist/waku.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/index.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/proto/dist/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushResponse: () => (/* reexport safe */ _lib_light_push_js__WEBPACK_IMPORTED_MODULE_4__.PushResponse),\n/* harmony export */ TopicOnlyMessage: () => (/* reexport safe */ _lib_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__.TopicOnlyMessage),\n/* harmony export */ WakuMessage: () => (/* reexport safe */ _lib_filter_js__WEBPACK_IMPORTED_MODULE_1__.WakuMessage),\n/* harmony export */ proto_filter: () => (/* reexport module object */ _lib_filter_js__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ proto_filter_v2: () => (/* reexport module object */ _lib_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ proto_lightpush: () => (/* reexport module object */ _lib_light_push_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ proto_message: () => (/* reexport module object */ _lib_message_js__WEBPACK_IMPORTED_MODULE_0__),\n/* harmony export */ proto_peer_exchange: () => (/* reexport module object */ _lib_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__),\n/* harmony export */ proto_store: () => (/* reexport module object */ _lib_store_js__WEBPACK_IMPORTED_MODULE_5__),\n/* harmony export */ proto_topic_only_message: () => (/* reexport module object */ _lib_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__)\n/* harmony export */ });\n/* harmony import */ var _lib_message_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/message.js */ \"./node_modules/@waku/proto/dist/lib/message.js\");\n/* harmony import */ var _lib_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/filter.js */ \"./node_modules/@waku/proto/dist/lib/filter.js\");\n/* harmony import */ var _lib_topic_only_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/topic_only_message.js */ \"./node_modules/@waku/proto/dist/lib/topic_only_message.js\");\n/* harmony import */ var _lib_filter_v2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/filter_v2.js */ \"./node_modules/@waku/proto/dist/lib/filter_v2.js\");\n/* harmony import */ var _lib_light_push_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/light_push.js */ \"./node_modules/@waku/proto/dist/lib/light_push.js\");\n/* harmony import */ var _lib_store_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/store.js */ \"./node_modules/@waku/proto/dist/lib/store.js\");\n/* harmony import */ var _lib_peer_exchange_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/peer_exchange.js */ \"./node_modules/@waku/proto/dist/lib/peer_exchange.js\");\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/filter.js": +/*!*****************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/filter.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterRequest: () => (/* binding */ FilterRequest),\n/* harmony export */ FilterRpc: () => (/* binding */ FilterRpc),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar FilterRequest;\n(function (FilterRequest) {\n let ContentFilter;\n (function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec());\n };\n })(ContentFilter = FilterRequest.ContentFilter || (FilterRequest.ContentFilter = {}));\n let _codec;\n FilterRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.subscribe != null && obj.subscribe !== false) {\n w.uint32(8);\n w.bool(obj.subscribe);\n }\n if (obj.topic != null && obj.topic !== \"\") {\n w.uint32(18);\n w.string(obj.topic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n FilterRequest.ContentFilter.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n subscribe: false,\n topic: \"\",\n contentFilters: [],\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.subscribe = reader.bool();\n break;\n case 2:\n obj.topic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRequest.codec());\n };\n FilterRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRequest.codec());\n };\n})(FilterRequest || (FilterRequest = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(10);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n messages: [],\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec());\n };\n})(MessagePush || (MessagePush = {}));\nvar FilterRpc;\n(function (FilterRpc) {\n let _codec;\n FilterRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.requestId != null && obj.requestId !== \"\") {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n FilterRequest.codec().encode(obj.request, w);\n }\n if (obj.push != null) {\n w.uint32(26);\n MessagePush.codec().encode(obj.push, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.request = FilterRequest.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.push = MessagePush.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterRpc.codec());\n };\n FilterRpc.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterRpc.codec());\n };\n})(FilterRpc || (FilterRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.proof != null && obj.proof.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if (obj.epoch != null && obj.epoch.byteLength > 0) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if (obj.shareX != null && obj.shareX.byteLength > 0) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if (obj.shareY != null && obj.shareY.byteLength > 0) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if (obj.nullifier != null && obj.nullifier.byteLength > 0) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0),\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.payload != null && obj.payload.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/filter.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/filter_v2.js": +/*!********************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/filter_v2.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FilterSubscribeRequest: () => (/* binding */ FilterSubscribeRequest),\n/* harmony export */ FilterSubscribeResponse: () => (/* binding */ FilterSubscribeResponse),\n/* harmony export */ MessagePush: () => (/* binding */ MessagePush),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar FilterSubscribeRequest;\n(function (FilterSubscribeRequest) {\n let FilterSubscribeType;\n (function (FilterSubscribeType) {\n FilterSubscribeType[\"SUBSCRIBER_PING\"] = \"SUBSCRIBER_PING\";\n FilterSubscribeType[\"SUBSCRIBE\"] = \"SUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE\"] = \"UNSUBSCRIBE\";\n FilterSubscribeType[\"UNSUBSCRIBE_ALL\"] = \"UNSUBSCRIBE_ALL\";\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let __FilterSubscribeTypeValues;\n (function (__FilterSubscribeTypeValues) {\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBER_PING\"] = 0] = \"SUBSCRIBER_PING\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"SUBSCRIBE\"] = 1] = \"SUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE\"] = 2] = \"UNSUBSCRIBE\";\n __FilterSubscribeTypeValues[__FilterSubscribeTypeValues[\"UNSUBSCRIBE_ALL\"] = 3] = \"UNSUBSCRIBE_ALL\";\n })(__FilterSubscribeTypeValues || (__FilterSubscribeTypeValues = {}));\n (function (FilterSubscribeType) {\n FilterSubscribeType.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__FilterSubscribeTypeValues);\n };\n })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));\n let _codec;\n FilterSubscribeRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.requestId != null && obj.requestId !== \"\") {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.filterSubscribeType != null &&\n __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {\n w.uint32(16);\n FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(82);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentTopics != null) {\n for (const value of obj.contentTopics) {\n w.uint32(90);\n w.string(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: \"\",\n filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,\n contentTopics: [],\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.filterSubscribeType =\n FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader);\n break;\n case 10:\n obj.pubsubTopic = reader.string();\n break;\n case 11:\n obj.contentTopics.push(reader.string());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeRequest.codec());\n };\n FilterSubscribeRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeRequest.codec());\n };\n})(FilterSubscribeRequest || (FilterSubscribeRequest = {}));\nvar FilterSubscribeResponse;\n(function (FilterSubscribeResponse) {\n let _codec;\n FilterSubscribeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.requestId != null && obj.requestId !== \"\") {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.statusCode != null && obj.statusCode !== 0) {\n w.uint32(80);\n w.uint32(obj.statusCode);\n }\n if (obj.statusDesc != null) {\n w.uint32(90);\n w.string(obj.statusDesc);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: \"\",\n statusCode: 0,\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 10:\n obj.statusCode = reader.uint32();\n break;\n case 11:\n obj.statusDesc = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n FilterSubscribeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, FilterSubscribeResponse.codec());\n };\n FilterSubscribeResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, FilterSubscribeResponse.codec());\n };\n})(FilterSubscribeResponse || (FilterSubscribeResponse = {}));\nvar MessagePush;\n(function (MessagePush) {\n let _codec;\n MessagePush.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.wakuMessage != null) {\n w.uint32(10);\n WakuMessage.codec().encode(obj.wakuMessage, w);\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32());\n break;\n case 2:\n obj.pubsubTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n MessagePush.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, MessagePush.codec());\n };\n MessagePush.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, MessagePush.codec());\n };\n})(MessagePush || (MessagePush = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.proof != null && obj.proof.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if (obj.epoch != null && obj.epoch.byteLength > 0) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if (obj.shareX != null && obj.shareX.byteLength > 0) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if (obj.shareY != null && obj.shareY.byteLength > 0) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if (obj.nullifier != null && obj.nullifier.byteLength > 0) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0),\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.payload != null && obj.payload.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=filter_v2.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/filter_v2.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/light_push.js": +/*!*********************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/light_push.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PushRequest: () => (/* binding */ PushRequest),\n/* harmony export */ PushResponse: () => (/* binding */ PushResponse),\n/* harmony export */ PushRpc: () => (/* binding */ PushRpc),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PushRequest;\n(function (PushRequest) {\n let _codec;\n PushRequest.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pubsubTopic != null && obj.pubsubTopic !== \"\") {\n w.uint32(10);\n w.string(obj.pubsubTopic);\n }\n if (obj.message != null) {\n w.uint32(18);\n WakuMessage.codec().encode(obj.message, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n pubsubTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.pubsubTopic = reader.string();\n break;\n case 2:\n obj.message = WakuMessage.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRequest.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRequest.codec());\n };\n PushRequest.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRequest.codec());\n };\n})(PushRequest || (PushRequest = {}));\nvar PushResponse;\n(function (PushResponse) {\n let _codec;\n PushResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.isSuccess != null && obj.isSuccess !== false) {\n w.uint32(8);\n w.bool(obj.isSuccess);\n }\n if (obj.info != null) {\n w.uint32(18);\n w.string(obj.info);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n isSuccess: false,\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.isSuccess = reader.bool();\n break;\n case 2:\n obj.info = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushResponse.codec());\n };\n PushResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushResponse.codec());\n };\n})(PushResponse || (PushResponse = {}));\nvar PushRpc;\n(function (PushRpc) {\n let _codec;\n PushRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.requestId != null && obj.requestId !== \"\") {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.request != null) {\n w.uint32(18);\n PushRequest.codec().encode(obj.request, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n PushResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.request = PushRequest.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.response = PushResponse.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PushRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PushRpc.codec());\n };\n PushRpc.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PushRpc.codec());\n };\n})(PushRpc || (PushRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.proof != null && obj.proof.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if (obj.epoch != null && obj.epoch.byteLength > 0) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if (obj.shareX != null && obj.shareX.byteLength > 0) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if (obj.shareY != null && obj.shareY.byteLength > 0) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if (obj.nullifier != null && obj.nullifier.byteLength > 0) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0),\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.payload != null && obj.payload.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=light_push.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/light_push.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/message.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/message.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.proof != null && obj.proof.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if (obj.epoch != null && obj.epoch.byteLength > 0) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if (obj.shareX != null && obj.shareX.byteLength > 0) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if (obj.shareY != null && obj.shareY.byteLength > 0) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if (obj.nullifier != null && obj.nullifier.byteLength > 0) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0),\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.payload != null && obj.payload.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/message.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/peer_exchange.js": +/*!************************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/peer_exchange.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerExchangeQuery: () => (/* binding */ PeerExchangeQuery),\n/* harmony export */ PeerExchangeRPC: () => (/* binding */ PeerExchangeRPC),\n/* harmony export */ PeerExchangeResponse: () => (/* binding */ PeerExchangeResponse),\n/* harmony export */ PeerInfo: () => (/* binding */ PeerInfo)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar PeerInfo;\n(function (PeerInfo) {\n let _codec;\n PeerInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.enr != null) {\n w.uint32(10);\n w.bytes(obj.enr);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.enr = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerInfo.codec());\n };\n PeerInfo.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerInfo.codec());\n };\n})(PeerInfo || (PeerInfo = {}));\nvar PeerExchangeQuery;\n(function (PeerExchangeQuery) {\n let _codec;\n PeerExchangeQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.numPeers != null) {\n w.uint32(8);\n w.uint64(obj.numPeers);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.numPeers = reader.uint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeQuery.codec());\n };\n PeerExchangeQuery.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeQuery.codec());\n };\n})(PeerExchangeQuery || (PeerExchangeQuery = {}));\nvar PeerExchangeResponse;\n(function (PeerExchangeResponse) {\n let _codec;\n PeerExchangeResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.peerInfos != null) {\n for (const value of obj.peerInfos) {\n w.uint32(10);\n PeerInfo.codec().encode(value, w);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n peerInfos: [],\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeResponse.codec());\n };\n PeerExchangeResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeResponse.codec());\n };\n})(PeerExchangeResponse || (PeerExchangeResponse = {}));\nvar PeerExchangeRPC;\n(function (PeerExchangeRPC) {\n let _codec;\n PeerExchangeRPC.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.query != null) {\n w.uint32(10);\n PeerExchangeQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(18);\n PeerExchangeResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32());\n break;\n case 2:\n obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PeerExchangeRPC.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PeerExchangeRPC.codec());\n };\n PeerExchangeRPC.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PeerExchangeRPC.codec());\n };\n})(PeerExchangeRPC || (PeerExchangeRPC = {}));\n//# sourceMappingURL=peer_exchange.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/peer_exchange.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/store.js": +/*!****************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/store.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentFilter: () => (/* binding */ ContentFilter),\n/* harmony export */ HistoryQuery: () => (/* binding */ HistoryQuery),\n/* harmony export */ HistoryResponse: () => (/* binding */ HistoryResponse),\n/* harmony export */ HistoryRpc: () => (/* binding */ HistoryRpc),\n/* harmony export */ Index: () => (/* binding */ Index),\n/* harmony export */ PagingInfo: () => (/* binding */ PagingInfo),\n/* harmony export */ RateLimitProof: () => (/* binding */ RateLimitProof),\n/* harmony export */ WakuMessage: () => (/* binding */ WakuMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Index;\n(function (Index) {\n let _codec;\n Index.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.digest != null && obj.digest.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.digest);\n }\n if (obj.receiverTime != null && obj.receiverTime !== 0n) {\n w.uint32(16);\n w.sint64(obj.receiverTime);\n }\n if (obj.senderTime != null && obj.senderTime !== 0n) {\n w.uint32(24);\n w.sint64(obj.senderTime);\n }\n if (obj.pubsubTopic != null && obj.pubsubTopic !== \"\") {\n w.uint32(34);\n w.string(obj.pubsubTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n digest: new Uint8Array(0),\n receiverTime: 0n,\n senderTime: 0n,\n pubsubTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.digest = reader.bytes();\n break;\n case 2:\n obj.receiverTime = reader.sint64();\n break;\n case 3:\n obj.senderTime = reader.sint64();\n break;\n case 4:\n obj.pubsubTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Index.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Index.codec());\n };\n Index.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Index.codec());\n };\n})(Index || (Index = {}));\nvar PagingInfo;\n(function (PagingInfo) {\n let Direction;\n (function (Direction) {\n Direction[\"BACKWARD\"] = \"BACKWARD\";\n Direction[\"FORWARD\"] = \"FORWARD\";\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let __DirectionValues;\n (function (__DirectionValues) {\n __DirectionValues[__DirectionValues[\"BACKWARD\"] = 0] = \"BACKWARD\";\n __DirectionValues[__DirectionValues[\"FORWARD\"] = 1] = \"FORWARD\";\n })(__DirectionValues || (__DirectionValues = {}));\n (function (Direction) {\n Direction.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__DirectionValues);\n };\n })(Direction = PagingInfo.Direction || (PagingInfo.Direction = {}));\n let _codec;\n PagingInfo.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pageSize != null) {\n w.uint32(8);\n w.uint64(obj.pageSize);\n }\n if (obj.cursor != null) {\n w.uint32(18);\n Index.codec().encode(obj.cursor, w);\n }\n if (obj.direction != null) {\n w.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.pageSize = reader.uint64();\n break;\n case 2:\n obj.cursor = Index.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n PagingInfo.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, PagingInfo.codec());\n };\n PagingInfo.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, PagingInfo.codec());\n };\n})(PagingInfo || (PagingInfo = {}));\nvar ContentFilter;\n(function (ContentFilter) {\n let _codec;\n ContentFilter.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(10);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ContentFilter.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ContentFilter.codec());\n };\n ContentFilter.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ContentFilter.codec());\n };\n})(ContentFilter || (ContentFilter = {}));\nvar HistoryQuery;\n(function (HistoryQuery) {\n let _codec;\n HistoryQuery.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.pubsubTopic != null) {\n w.uint32(18);\n w.string(obj.pubsubTopic);\n }\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n w.uint32(26);\n ContentFilter.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.startTime != null) {\n w.uint32(40);\n w.sint64(obj.startTime);\n }\n if (obj.endTime != null) {\n w.uint32(48);\n w.sint64(obj.endTime);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentFilters: [],\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n obj.pubsubTopic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32()));\n break;\n case 4:\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32());\n break;\n case 5:\n obj.startTime = reader.sint64();\n break;\n case 6:\n obj.endTime = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryQuery.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryQuery.codec());\n };\n HistoryQuery.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryQuery.codec());\n };\n})(HistoryQuery || (HistoryQuery = {}));\nvar HistoryResponse;\n(function (HistoryResponse) {\n let HistoryError;\n (function (HistoryError) {\n HistoryError[\"NONE\"] = \"NONE\";\n HistoryError[\"INVALID_CURSOR\"] = \"INVALID_CURSOR\";\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let __HistoryErrorValues;\n (function (__HistoryErrorValues) {\n __HistoryErrorValues[__HistoryErrorValues[\"NONE\"] = 0] = \"NONE\";\n __HistoryErrorValues[__HistoryErrorValues[\"INVALID_CURSOR\"] = 1] = \"INVALID_CURSOR\";\n })(__HistoryErrorValues || (__HistoryErrorValues = {}));\n (function (HistoryError) {\n HistoryError.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__HistoryErrorValues);\n };\n })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));\n let _codec;\n HistoryResponse.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.messages != null) {\n for (const value of obj.messages) {\n w.uint32(18);\n WakuMessage.codec().encode(value, w);\n }\n }\n if (obj.pagingInfo != null) {\n w.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, w);\n }\n if (obj.error != null && __HistoryErrorValues[obj.error] !== 0) {\n w.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n messages: [],\n error: HistoryError.NONE,\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32()));\n break;\n case 3:\n obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32());\n break;\n case 4:\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryResponse.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryResponse.codec());\n };\n HistoryResponse.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryResponse.codec());\n };\n})(HistoryResponse || (HistoryResponse = {}));\nvar HistoryRpc;\n(function (HistoryRpc) {\n let _codec;\n HistoryRpc.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.requestId != null && obj.requestId !== \"\") {\n w.uint32(10);\n w.string(obj.requestId);\n }\n if (obj.query != null) {\n w.uint32(18);\n HistoryQuery.codec().encode(obj.query, w);\n }\n if (obj.response != null) {\n w.uint32(26);\n HistoryResponse.codec().encode(obj.response, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n requestId: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.query = HistoryQuery.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.response = HistoryResponse.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HistoryRpc.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HistoryRpc.codec());\n };\n HistoryRpc.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HistoryRpc.codec());\n };\n})(HistoryRpc || (HistoryRpc = {}));\nvar RateLimitProof;\n(function (RateLimitProof) {\n let _codec;\n RateLimitProof.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.proof != null && obj.proof.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.proof);\n }\n if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) {\n w.uint32(18);\n w.bytes(obj.merkleRoot);\n }\n if (obj.epoch != null && obj.epoch.byteLength > 0) {\n w.uint32(26);\n w.bytes(obj.epoch);\n }\n if (obj.shareX != null && obj.shareX.byteLength > 0) {\n w.uint32(34);\n w.bytes(obj.shareX);\n }\n if (obj.shareY != null && obj.shareY.byteLength > 0) {\n w.uint32(42);\n w.bytes(obj.shareY);\n }\n if (obj.nullifier != null && obj.nullifier.byteLength > 0) {\n w.uint32(50);\n w.bytes(obj.nullifier);\n }\n if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) {\n w.uint32(58);\n w.bytes(obj.rlnIdentifier);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n proof: new Uint8Array(0),\n merkleRoot: new Uint8Array(0),\n epoch: new Uint8Array(0),\n shareX: new Uint8Array(0),\n shareY: new Uint8Array(0),\n nullifier: new Uint8Array(0),\n rlnIdentifier: new Uint8Array(0),\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.proof = reader.bytes();\n break;\n case 2:\n obj.merkleRoot = reader.bytes();\n break;\n case 3:\n obj.epoch = reader.bytes();\n break;\n case 4:\n obj.shareX = reader.bytes();\n break;\n case 5:\n obj.shareY = reader.bytes();\n break;\n case 6:\n obj.nullifier = reader.bytes();\n break;\n case 7:\n obj.rlnIdentifier = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n RateLimitProof.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, RateLimitProof.codec());\n };\n RateLimitProof.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, RateLimitProof.codec());\n };\n})(RateLimitProof || (RateLimitProof = {}));\nvar WakuMessage;\n(function (WakuMessage) {\n let _codec;\n WakuMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.payload != null && obj.payload.byteLength > 0) {\n w.uint32(10);\n w.bytes(obj.payload);\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (obj.version != null) {\n w.uint32(24);\n w.uint32(obj.version);\n }\n if (obj.timestamp != null) {\n w.uint32(80);\n w.sint64(obj.timestamp);\n }\n if (obj.meta != null) {\n w.uint32(90);\n w.bytes(obj.meta);\n }\n if (obj.rateLimitProof != null) {\n w.uint32(170);\n RateLimitProof.codec().encode(obj.rateLimitProof, w);\n }\n if (obj.ephemeral != null) {\n w.uint32(248);\n w.bool(obj.ephemeral);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n payload: new Uint8Array(0),\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n case 11:\n obj.meta = reader.bytes();\n break;\n case 21:\n obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32());\n break;\n case 31:\n obj.ephemeral = reader.bool();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n WakuMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, WakuMessage.codec());\n };\n WakuMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, WakuMessage.codec());\n };\n})(WakuMessage || (WakuMessage = {}));\n//# sourceMappingURL=store.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/store.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/proto/dist/lib/topic_only_message.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@waku/proto/dist/lib/topic_only_message.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar TopicOnlyMessage;\n(function (TopicOnlyMessage) {\n let _codec;\n TopicOnlyMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.contentTopic != null && obj.contentTopic !== \"\") {\n w.uint32(18);\n w.string(obj.contentTopic);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n contentTopic: \"\",\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n TopicOnlyMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, TopicOnlyMessage.codec());\n };\n TopicOnlyMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, TopicOnlyMessage.codec());\n };\n})(TopicOnlyMessage || (TopicOnlyMessage = {}));\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/proto/dist/lib/topic_only_message.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/relay/dist/constants.js": +/*!****************************************************!*\ + !*** ./node_modules/@waku/relay/dist/constants.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RelayCodecs: () => (/* binding */ RelayCodecs),\n/* harmony export */ RelayFanoutTTL: () => (/* binding */ RelayFanoutTTL),\n/* harmony export */ RelayGossipFactor: () => (/* binding */ RelayGossipFactor),\n/* harmony export */ RelayHeartbeatInitialDelay: () => (/* binding */ RelayHeartbeatInitialDelay),\n/* harmony export */ RelayHeartbeatInterval: () => (/* binding */ RelayHeartbeatInterval),\n/* harmony export */ RelayMaxIHaveLength: () => (/* binding */ RelayMaxIHaveLength),\n/* harmony export */ RelayOpportunisticGraftPeers: () => (/* binding */ RelayOpportunisticGraftPeers),\n/* harmony export */ RelayOpportunisticGraftTicks: () => (/* binding */ RelayOpportunisticGraftTicks),\n/* harmony export */ RelayPruneBackoff: () => (/* binding */ RelayPruneBackoff),\n/* harmony export */ RelayPrunePeers: () => (/* binding */ RelayPrunePeers),\n/* harmony export */ minute: () => (/* binding */ minute),\n/* harmony export */ second: () => (/* binding */ second)\n/* harmony export */ });\nconst second = 1000;\nconst minute = 60 * second;\n/**\n * RelayCodec is the libp2p identifier for the waku relay protocol\n */\nconst RelayCodecs = [\"/vac/waku/relay/2.0.0\"];\n/**\n * RelayGossipFactor affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to RelayGossipFactor * (total number of non-mesh peers), or\n * RelayDlazy, whichever is greater.\n */\nconst RelayGossipFactor = 0.25;\n/**\n * GossipsubHeartbeatInitialDelay is the short delay before the heartbeat timer begins\n * after the router is initialized.\n */\nconst RelayHeartbeatInitialDelay = 100;\n/**\n * RelayHeartbeatInterval controls the time between heartbeats.\n */\nconst RelayHeartbeatInterval = second;\n/**\n * RelayPrunePeers controls the number of peers to include in prune Peer eXchange.\n * When we prune a peer that's eligible for PX (has a good score, etc), we will try to\n * send them signed peer records for up to RelayPrunePeers other peers that we\n * know of.\n */\nconst RelayPrunePeers = 16;\n/**\n * RelayPruneBackoff controls the backoff time for pruned peers. This is how long\n * a peer must wait before attempting to graft into our mesh again after being pruned.\n * When pruning a peer, we send them our value of RelayPruneBackoff so they know\n * the minimum time to wait. Peers running older versions may not send a backoff time,\n * so if we receive a prune message without one, we will wait at least RelayPruneBackoff\n * before attempting to re-graft.\n */\nconst RelayPruneBackoff = minute;\n/**\n * RelayFanoutTTL controls how long we keep track of the fanout state. If it's been\n * RelayFanoutTTL since we've published to a topic that we're not subscribed to,\n * we'll delete the fanout map for that topic.\n */\nconst RelayFanoutTTL = minute;\n/**\n * RelayOpportunisticGraftTicks is the number of heartbeat ticks for attempting to improve the mesh\n * with opportunistic grafting. Every RelayOpportunisticGraftTicks we will attempt to select some\n * high-scoring mesh peers to replace lower-scoring ones, if the median score of our mesh peers falls\n * below a threshold\n */\nconst RelayOpportunisticGraftTicks = 60;\n/**\n * RelayOpportunisticGraftPeers is the number of peers to opportunistically graft.\n */\nconst RelayOpportunisticGraftPeers = 2;\n/**\n * RelayMaxIHaveLength is the maximum number of messages to include in an IHAVE message.\n * Also controls the maximum number of IHAVE ids we will accept and request with IWANT from a\n * peer within a heartbeat, to protect from IHAVE floods. You should adjust this value from the\n * default if your system is pushing more than 5000 messages in GossipsubHistoryGossip heartbeats;\n * with the defaults this is 1666 messages/s.\n */\nconst RelayMaxIHaveLength = 5000;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/relay/dist/constants.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/relay/dist/index.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/relay/dist/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ wakuGossipSub: () => (/* binding */ wakuGossipSub),\n/* harmony export */ wakuRelay: () => (/* binding */ wakuRelay)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_libp2p_gossipsub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/libp2p-gossipsub */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/index.js\");\n/* harmony import */ var _chainsafe_libp2p_gossipsub_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @chainsafe/libp2p-gossipsub/types */ \"./node_modules/@chainsafe/libp2p-gossipsub/dist/src/types.js\");\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/@waku/relay/dist/constants.js\");\n/* harmony import */ var _message_validator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./message_validator.js */ \"./node_modules/@waku/relay/dist/message_validator.js\");\n/* harmony import */ var _topic_only_message_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./topic_only_message.js */ \"./node_modules/@waku/relay/dist/topic_only_message.js\");\n\n\n\n\n\n\n\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_6__(\"waku:relay\");\n/**\n * Implements the [Waku v2 Relay protocol](https://rfc.vac.dev/spec/11/).\n * Throws if libp2p.pubsub does not support Waku Relay\n */\nclass Relay {\n pubSubTopic;\n defaultDecoder;\n static multicodec = _constants_js__WEBPACK_IMPORTED_MODULE_7__.RelayCodecs[0];\n gossipSub;\n /**\n * observers called when receiving new message.\n * Observers under key `\"\"` are always called.\n */\n observers;\n constructor(libp2p, options) {\n if (!this.isRelayPubSub(libp2p.services.pubsub)) {\n throw Error(`Failed to initialize Relay. libp2p.pubsub does not support ${Relay.multicodec}`);\n }\n this.gossipSub = libp2p.services.pubsub;\n this.pubSubTopic = options?.pubSubTopic ?? _waku_core__WEBPACK_IMPORTED_MODULE_3__.DefaultPubSubTopic;\n if (this.gossipSub.isStarted()) {\n this.gossipSubSubscribe(this.pubSubTopic);\n }\n this.observers = new Map();\n // TODO: User might want to decide what decoder should be used (e.g. for RLN)\n this.defaultDecoder = new _topic_only_message_js__WEBPACK_IMPORTED_MODULE_9__.TopicOnlyDecoder();\n }\n /**\n * Mounts the gossipsub protocol onto the libp2p node\n * and subscribes to the default topic.\n *\n * @override\n * @returns {void}\n */\n async start() {\n if (this.gossipSub.isStarted()) {\n throw Error(\"GossipSub already started.\");\n }\n await this.gossipSub.start();\n this.gossipSubSubscribe(this.pubSubTopic);\n }\n /**\n * Send Waku message.\n */\n async send(encoder, message) {\n if (!(0,_waku_utils__WEBPACK_IMPORTED_MODULE_5__.isSizeValid)(message.payload)) {\n log(\"Failed to send waku relay: message is bigger that 1MB\");\n return {\n recipients: [],\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_4__.SendError.SIZE_TOO_BIG,\n };\n }\n const msg = await encoder.toWire(message);\n if (!msg) {\n log(\"Failed to encode message, aborting publish\");\n return {\n recipients: [],\n error: _waku_interfaces__WEBPACK_IMPORTED_MODULE_4__.SendError.ENCODE_FAILED,\n };\n }\n return this.gossipSub.publish(this.pubSubTopic, msg);\n }\n /**\n * Add an observer and associated Decoder to process incoming messages on a given content topic.\n *\n * @returns Function to delete the observer\n */\n subscribe(decoders, callback) {\n const contentTopicToObservers = Array.isArray(decoders)\n ? toObservers(decoders, callback)\n : toObservers([decoders], callback);\n for (const contentTopic of contentTopicToObservers.keys()) {\n const currObservers = this.observers.get(contentTopic) || new Set();\n const newObservers = contentTopicToObservers.get(contentTopic) || new Set();\n this.observers.set(contentTopic, union(currObservers, newObservers));\n }\n return () => {\n for (const contentTopic of contentTopicToObservers.keys()) {\n const currentObservers = this.observers.get(contentTopic) || new Set();\n const observersToRemove = contentTopicToObservers.get(contentTopic) || new Set();\n const nextObservers = leftMinusJoin(currentObservers, observersToRemove);\n if (nextObservers.size) {\n this.observers.set(contentTopic, nextObservers);\n }\n else {\n this.observers.delete(contentTopic);\n }\n }\n };\n }\n toSubscriptionIterator(decoders, opts) {\n return (0,_waku_utils__WEBPACK_IMPORTED_MODULE_5__.toAsyncIterator)(this, decoders, opts);\n }\n getActiveSubscriptions() {\n const map = new Map();\n map.set(this.pubSubTopic, this.observers.keys());\n return map;\n }\n getMeshPeers(topic) {\n return this.gossipSub.getMeshPeers(topic ?? this.pubSubTopic);\n }\n async processIncomingMessage(pubSubTopic, bytes) {\n const topicOnlyMsg = await this.defaultDecoder.fromWireToProtoObj(bytes);\n if (!topicOnlyMsg || !topicOnlyMsg.contentTopic) {\n log(\"Message does not have a content topic, skipping\");\n return;\n }\n const observers = this.observers.get(topicOnlyMsg.contentTopic);\n if (!observers) {\n return;\n }\n await Promise.all(Array.from(observers).map(({ decoder, callback }) => {\n return (async () => {\n try {\n const protoMsg = await decoder.fromWireToProtoObj(bytes);\n if (!protoMsg) {\n log(\"Internal error: message previously decoded failed on 2nd pass.\");\n return;\n }\n const msg = await decoder.fromProtoObj(pubSubTopic, protoMsg);\n if (msg) {\n await callback(msg);\n }\n else {\n log(\"Failed to decode messages on\", topicOnlyMsg.contentTopic);\n }\n }\n catch (error) {\n log(\"Error while decoding message:\", error);\n }\n })();\n }));\n }\n /**\n * Subscribe to a pubsub topic and start emitting Waku messages to observers.\n *\n * @override\n */\n gossipSubSubscribe(pubSubTopic) {\n this.gossipSub.addEventListener(\"gossipsub:message\", (event) => {\n if (event.detail.msg.topic !== pubSubTopic)\n return;\n log(`Message received on ${pubSubTopic}`);\n this.processIncomingMessage(event.detail.msg.topic, event.detail.msg.data).catch((e) => log(\"Failed to process incoming message\", e));\n });\n this.gossipSub.topicValidators.set(pubSubTopic, _message_validator_js__WEBPACK_IMPORTED_MODULE_8__.messageValidator);\n this.gossipSub.subscribe(pubSubTopic);\n }\n isRelayPubSub(pubsub) {\n return pubsub?.multicodecs?.includes(Relay.multicodec) || false;\n }\n}\nfunction wakuRelay(init = {}) {\n return (libp2p) => new Relay(libp2p, init);\n}\nfunction wakuGossipSub(init = {}) {\n return (components) => {\n init = {\n ...init,\n msgIdFn: ({ data }) => (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_2__.sha256)(data),\n // Ensure that no signature is included nor expected in the messages.\n globalSignaturePolicy: _chainsafe_libp2p_gossipsub_types__WEBPACK_IMPORTED_MODULE_1__.SignaturePolicy.StrictNoSign,\n fallbackToFloodsub: false,\n };\n const pubsub = new _chainsafe_libp2p_gossipsub__WEBPACK_IMPORTED_MODULE_0__.GossipSub(components, init);\n pubsub.multicodecs = _constants_js__WEBPACK_IMPORTED_MODULE_7__.RelayCodecs;\n return pubsub;\n };\n}\nfunction toObservers(decoders, callback) {\n const contentTopicToDecoders = Array.from((0,_waku_utils__WEBPACK_IMPORTED_MODULE_5__.groupByContentTopic)(decoders).entries());\n const contentTopicToObserversEntries = contentTopicToDecoders.map(([contentTopic, decoders]) => [\n contentTopic,\n new Set(decoders.map((decoder) => ({\n decoder,\n callback,\n }))),\n ]);\n return new Map(contentTopicToObserversEntries);\n}\nfunction union(left, right) {\n for (const val of right.values()) {\n left.add(val);\n }\n return left;\n}\nfunction leftMinusJoin(left, right) {\n for (const val of right.values()) {\n if (left.has(val)) {\n left.delete(val);\n }\n }\n return left;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/relay/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/relay/dist/message_validator.js": +/*!************************************************************!*\ + !*** ./node_modules/@waku/relay/dist/message_validator.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ messageValidator: () => (/* binding */ messageValidator)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-pubsub */ \"./node_modules/@libp2p/interface-pubsub/dist/src/index.js\");\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_2__(\"waku:relay\");\nfunction messageValidator(peer, message) {\n const startTime = performance.now();\n log(`validating message from ${peer} received on ${message.topic}`);\n let result = _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Accept;\n try {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_1__.proto_message.WakuMessage.decode(message.data);\n if (!protoMessage.contentTopic ||\n !protoMessage.contentTopic.length ||\n !protoMessage.payload ||\n !protoMessage.payload.length) {\n result = _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Reject;\n }\n }\n catch (e) {\n result = _libp2p_interface_pubsub__WEBPACK_IMPORTED_MODULE_0__.TopicValidatorResult.Reject;\n }\n const endTime = performance.now();\n log(`Validation time (must be <100ms): ${endTime - startTime}ms`);\n return result;\n}\n//# sourceMappingURL=message_validator.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/relay/dist/message_validator.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/relay/dist/topic_only_message.js": +/*!*************************************************************!*\ + !*** ./node_modules/@waku/relay/dist/topic_only_message.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TopicOnlyDecoder: () => (/* binding */ TopicOnlyDecoder),\n/* harmony export */ TopicOnlyMessage: () => (/* binding */ TopicOnlyMessage)\n/* harmony export */ });\n/* harmony import */ var _waku_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/proto */ \"./node_modules/@waku/proto/dist/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_1__(\"waku:message:topic-only\");\nclass TopicOnlyMessage {\n pubSubTopic;\n proto;\n payload = new Uint8Array();\n rateLimitProof;\n timestamp;\n meta;\n ephemeral;\n constructor(pubSubTopic, proto) {\n this.pubSubTopic = pubSubTopic;\n this.proto = proto;\n }\n get contentTopic() {\n return this.proto.contentTopic;\n }\n}\nclass TopicOnlyDecoder {\n contentTopic = \"\";\n fromWireToProtoObj(bytes) {\n const protoMessage = _waku_proto__WEBPACK_IMPORTED_MODULE_0__.TopicOnlyMessage.decode(bytes);\n log(\"Message decoded\", protoMessage);\n return Promise.resolve({\n contentTopic: protoMessage.contentTopic,\n payload: new Uint8Array(),\n rateLimitProof: undefined,\n timestamp: undefined,\n meta: undefined,\n version: undefined,\n ephemeral: undefined,\n });\n }\n async fromProtoObj(pubSubTopic, proto) {\n return new TopicOnlyMessage(pubSubTopic, proto);\n }\n}\n//# sourceMappingURL=topic_only_message.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/relay/dist/topic_only_message.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/sdk/dist/create.js": +/*!***********************************************!*\ + !*** ./node_modules/@waku/sdk/dist/create.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createFullNode: () => (/* binding */ createFullNode),\n/* harmony export */ createLightNode: () => (/* binding */ createLightNode),\n/* harmony export */ createRelayNode: () => (/* binding */ createRelayNode),\n/* harmony export */ defaultLibp2p: () => (/* binding */ defaultLibp2p),\n/* harmony export */ defaultPeerDiscovery: () => (/* binding */ defaultPeerDiscovery)\n/* harmony export */ });\n/* harmony import */ var _chainsafe_libp2p_noise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @chainsafe/libp2p-noise */ \"./node_modules/@chainsafe/libp2p-noise/dist/src/index.js\");\n/* harmony import */ var _libp2p_mplex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/mplex */ \"./node_modules/@libp2p/mplex/dist/src/index.js\");\n/* harmony import */ var _libp2p_websockets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/websockets */ \"./node_modules/@libp2p/websockets/dist/src/index.js\");\n/* harmony import */ var _libp2p_websockets_filters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/websockets/filters */ \"./node_modules/@libp2p/websockets/dist/src/filters.js\");\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_dns_discovery__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @waku/dns-discovery */ \"./node_modules/@waku/dns-discovery/dist/index.js\");\n/* harmony import */ var _waku_relay__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @waku/relay */ \"./node_modules/@waku/relay/dist/index.js\");\n/* harmony import */ var libp2p__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! libp2p */ \"./node_modules/libp2p/dist/src/index.js\");\n/* harmony import */ var libp2p_identify__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! libp2p/identify */ \"./node_modules/libp2p/dist/src/identify/index.js\");\n/* harmony import */ var libp2p_ping__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! libp2p/ping */ \"./node_modules/libp2p/dist/src/ping/index.js\");\n\n\n\n\n\n\n\n\n\n\nconst DEFAULT_NODE_REQUIREMENTS = {\n lightPush: 1,\n filter: 1,\n store: 1,\n};\n/**\n * Create a Waku node that uses Waku Light Push, Filter and Store to send and\n * receive messages, enabling low resource consumption.\n * Uses Waku Filter V2 by default.\n */\nasync function createLightNode(options) {\n const libp2pOptions = options?.libp2p ?? {};\n const peerDiscovery = libp2pOptions.peerDiscovery ?? [];\n if (options?.defaultBootstrap) {\n peerDiscovery.push(defaultPeerDiscovery());\n Object.assign(libp2pOptions, { peerDiscovery });\n }\n const libp2p = await defaultLibp2p(undefined, libp2pOptions, options?.userAgent);\n const store = (0,_waku_core__WEBPACK_IMPORTED_MODULE_4__.wakuStore)(options);\n const lightPush = (0,_waku_core__WEBPACK_IMPORTED_MODULE_4__.wakuLightPush)(options);\n const filter = (0,_waku_core__WEBPACK_IMPORTED_MODULE_4__.wakuFilter)(options);\n return new _waku_core__WEBPACK_IMPORTED_MODULE_4__.WakuNode(options ?? {}, libp2p, store, lightPush, filter);\n}\n/**\n * Create a Waku node that uses Waku Relay to send and receive messages,\n * enabling some privacy preserving properties.\n */\nasync function createRelayNode(options) {\n const libp2pOptions = options?.libp2p ?? {};\n const peerDiscovery = libp2pOptions.peerDiscovery ?? [];\n if (options?.defaultBootstrap) {\n peerDiscovery.push(defaultPeerDiscovery());\n Object.assign(libp2pOptions, { peerDiscovery });\n }\n const libp2p = await defaultLibp2p((0,_waku_relay__WEBPACK_IMPORTED_MODULE_6__.wakuGossipSub)(options), libp2pOptions, options?.userAgent);\n const relay = (0,_waku_relay__WEBPACK_IMPORTED_MODULE_6__.wakuRelay)(options);\n return new _waku_core__WEBPACK_IMPORTED_MODULE_4__.WakuNode(options ?? {}, libp2p, undefined, undefined, undefined, relay);\n}\n/**\n * Create a Waku node that uses all Waku protocols.\n *\n * This helper is not recommended except if:\n * - you are interfacing with nwaku v0.11 or below\n * - you are doing some form of testing\n *\n * If you are building a full node, it is recommended to use\n * [nwaku](github.com/status-im/nwaku) and its JSON RPC API or wip REST API.\n *\n * @see https://github.com/status-im/nwaku/issues/1085\n * @internal\n */\nasync function createFullNode(options) {\n const libp2pOptions = options?.libp2p ?? {};\n const peerDiscovery = libp2pOptions.peerDiscovery ?? [];\n if (options?.defaultBootstrap) {\n peerDiscovery.push(defaultPeerDiscovery());\n Object.assign(libp2pOptions, { peerDiscovery });\n }\n const libp2p = await defaultLibp2p((0,_waku_relay__WEBPACK_IMPORTED_MODULE_6__.wakuGossipSub)(options), libp2pOptions, options?.userAgent);\n const store = (0,_waku_core__WEBPACK_IMPORTED_MODULE_4__.wakuStore)(options);\n const lightPush = (0,_waku_core__WEBPACK_IMPORTED_MODULE_4__.wakuLightPush)(options);\n const filter = (0,_waku_core__WEBPACK_IMPORTED_MODULE_4__.wakuFilter)(options);\n const relay = (0,_waku_relay__WEBPACK_IMPORTED_MODULE_6__.wakuRelay)(options);\n return new _waku_core__WEBPACK_IMPORTED_MODULE_4__.WakuNode(options ?? {}, libp2p, store, lightPush, filter, relay);\n}\nfunction defaultPeerDiscovery() {\n return (0,_waku_dns_discovery__WEBPACK_IMPORTED_MODULE_5__.wakuDnsDiscovery)([_waku_dns_discovery__WEBPACK_IMPORTED_MODULE_5__.enrTree[\"PROD\"]], DEFAULT_NODE_REQUIREMENTS);\n}\nasync function defaultLibp2p(wakuGossipSub, options, userAgent) {\n const pubsubService = wakuGossipSub\n ? { pubsub: wakuGossipSub }\n : {};\n return (0,libp2p__WEBPACK_IMPORTED_MODULE_7__.createLibp2p)({\n connectionManager: {\n minConnections: 1,\n },\n transports: [(0,_libp2p_websockets__WEBPACK_IMPORTED_MODULE_2__.webSockets)({ filter: _libp2p_websockets_filters__WEBPACK_IMPORTED_MODULE_3__.all })],\n streamMuxers: [(0,_libp2p_mplex__WEBPACK_IMPORTED_MODULE_1__.mplex)()],\n connectionEncryption: [(0,_chainsafe_libp2p_noise__WEBPACK_IMPORTED_MODULE_0__.noise)()],\n ...options,\n services: {\n identify: (0,libp2p_identify__WEBPACK_IMPORTED_MODULE_8__.identifyService)({\n agentVersion: userAgent ?? _waku_core__WEBPACK_IMPORTED_MODULE_4__.DefaultUserAgent,\n }),\n ping: (0,libp2p_ping__WEBPACK_IMPORTED_MODULE_9__.pingService)(),\n ...pubsubService,\n ...options?.services,\n },\n }); // TODO: make libp2p include it;\n}\n//# sourceMappingURL=create.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/sdk/dist/create.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/sdk/dist/index.js": +/*!**********************************************!*\ + !*** ./node_modules/@waku/sdk/dist/index.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DecodedMessage: () => (/* reexport safe */ _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__.DecodedMessage),\n/* harmony export */ Decoder: () => (/* reexport safe */ _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__.Decoder),\n/* harmony export */ EPeersByDiscoveryEvents: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_5__.EPeersByDiscoveryEvents),\n/* harmony export */ Encoder: () => (/* reexport safe */ _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__.Encoder),\n/* harmony export */ PageDirection: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_5__.PageDirection),\n/* harmony export */ Protocols: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_5__.Protocols),\n/* harmony export */ SendError: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_5__.SendError),\n/* harmony export */ Tags: () => (/* reexport safe */ _waku_interfaces__WEBPACK_IMPORTED_MODULE_5__.Tags),\n/* harmony export */ WakuNode: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.WakuNode),\n/* harmony export */ bytesToUtf8: () => (/* reexport safe */ _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__.bytesToUtf8),\n/* harmony export */ createDecoder: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.createDecoder),\n/* harmony export */ createEncoder: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.createEncoder),\n/* harmony export */ createFullNode: () => (/* reexport safe */ _create_js__WEBPACK_IMPORTED_MODULE_3__.createFullNode),\n/* harmony export */ createLightNode: () => (/* reexport safe */ _create_js__WEBPACK_IMPORTED_MODULE_3__.createLightNode),\n/* harmony export */ createRelayNode: () => (/* reexport safe */ _create_js__WEBPACK_IMPORTED_MODULE_3__.createRelayNode),\n/* harmony export */ defaultLibp2p: () => (/* reexport safe */ _create_js__WEBPACK_IMPORTED_MODULE_3__.defaultLibp2p),\n/* harmony export */ defaultPeerDiscovery: () => (/* reexport safe */ _create_js__WEBPACK_IMPORTED_MODULE_3__.defaultPeerDiscovery),\n/* harmony export */ relay: () => (/* reexport module object */ _waku_relay__WEBPACK_IMPORTED_MODULE_6__),\n/* harmony export */ utf8ToBytes: () => (/* reexport safe */ _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__.utf8ToBytes),\n/* harmony export */ utils: () => (/* reexport module object */ _waku_utils__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ waitForRemotePeer: () => (/* reexport safe */ _waku_core__WEBPACK_IMPORTED_MODULE_0__.waitForRemotePeer),\n/* harmony export */ waku: () => (/* reexport module object */ _waku_core__WEBPACK_IMPORTED_MODULE_0__)\n/* harmony export */ });\n/* harmony import */ var _waku_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @waku/core */ \"./node_modules/@waku/core/dist/index.js\");\n/* harmony import */ var _waku_core_lib_message_version_0__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @waku/core/lib/message/version_0 */ \"./node_modules/@waku/core/dist/lib/message/version_0.js\");\n/* harmony import */ var _waku_utils_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @waku/utils/bytes */ \"./node_modules/@waku/utils/dist/bytes/index.js\");\n/* harmony import */ var _create_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./create.js */ \"./node_modules/@waku/sdk/dist/create.js\");\n/* harmony import */ var _waku_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @waku/utils */ \"./node_modules/@waku/utils/dist/index.js\");\n/* harmony import */ var _waku_interfaces__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @waku/interfaces */ \"./node_modules/@waku/interfaces/dist/index.js\");\n/* harmony import */ var _waku_relay__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @waku/relay */ \"./node_modules/@waku/relay/dist/index.js\");\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/sdk/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/bytes/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@waku/utils/dist/bytes/index.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex),\n/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8),\n/* harmony export */ concat: () => (/* binding */ concat),\n/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes),\n/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n/**\n * Convert input to a byte array.\n *\n * Handles both `0x` prefixed and non-prefixed strings.\n */\nfunction hexToBytes(hex) {\n if (typeof hex === \"string\") {\n const _hex = hex.replace(/^0x/i, \"\");\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(_hex.toLowerCase(), \"base16\");\n }\n return hex;\n}\n/**\n * Convert byte array to hex string (no `0x` prefix).\n */\nconst bytesToHex = (bytes) => (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(bytes, \"base16\");\n/**\n * Decode byte array to utf-8 string.\n */\nconst bytesToUtf8 = (b) => (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(b, \"utf8\");\n/**\n * Encode utf-8 string to byte array.\n */\nconst utf8ToBytes = (s) => (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(s, \"utf8\");\n/**\n * Concatenate using Uint8Arrays as `Buffer` has a different behavior with `DataView`\n */\nfunction concat(byteArrays, totalLength) {\n const len = totalLength ?? byteArrays.reduce((acc, curr) => acc + curr.length, 0);\n const res = new Uint8Array(len);\n let offset = 0;\n for (const bytes of byteArrays) {\n res.set(bytes, offset);\n offset += bytes.length;\n }\n return res;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/bytes/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/common/group_by.js": +/*!**********************************************************!*\ + !*** ./node_modules/@waku/utils/dist/common/group_by.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ groupByContentTopic: () => (/* binding */ groupByContentTopic)\n/* harmony export */ });\nfunction groupByContentTopic(values) {\n const groupedDecoders = new Map();\n values.forEach((value) => {\n let decs = groupedDecoders.get(value.contentTopic);\n if (!decs) {\n groupedDecoders.set(value.contentTopic, []);\n decs = groupedDecoders.get(value.contentTopic);\n }\n decs.push(value);\n });\n return groupedDecoders;\n}\n//# sourceMappingURL=group_by.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/common/group_by.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/common/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/@waku/utils/dist/common/index.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPseudoRandomSubset: () => (/* reexport safe */ _random_subset_js__WEBPACK_IMPORTED_MODULE_1__.getPseudoRandomSubset),\n/* harmony export */ groupByContentTopic: () => (/* reexport safe */ _group_by_js__WEBPACK_IMPORTED_MODULE_2__.groupByContentTopic),\n/* harmony export */ isDefined: () => (/* reexport safe */ _is_defined_js__WEBPACK_IMPORTED_MODULE_0__.isDefined),\n/* harmony export */ isSizeValid: () => (/* reexport safe */ _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__.isSizeValid),\n/* harmony export */ removeItemFromArray: () => (/* binding */ removeItemFromArray),\n/* harmony export */ toAsyncIterator: () => (/* reexport safe */ _to_async_iterator_js__WEBPACK_IMPORTED_MODULE_3__.toAsyncIterator)\n/* harmony export */ });\n/* harmony import */ var _is_defined_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is_defined.js */ \"./node_modules/@waku/utils/dist/common/is_defined.js\");\n/* harmony import */ var _random_subset_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./random_subset.js */ \"./node_modules/@waku/utils/dist/common/random_subset.js\");\n/* harmony import */ var _group_by_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./group_by.js */ \"./node_modules/@waku/utils/dist/common/group_by.js\");\n/* harmony import */ var _to_async_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./to_async_iterator.js */ \"./node_modules/@waku/utils/dist/common/to_async_iterator.js\");\n/* harmony import */ var _is_size_valid_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./is_size_valid.js */ \"./node_modules/@waku/utils/dist/common/is_size_valid.js\");\n\n\nfunction removeItemFromArray(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n }\n return arr;\n}\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/common/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/common/is_defined.js": +/*!************************************************************!*\ + !*** ./node_modules/@waku/utils/dist/common/is_defined.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isDefined: () => (/* binding */ isDefined)\n/* harmony export */ });\nfunction isDefined(value) {\n return Boolean(value);\n}\n//# sourceMappingURL=is_defined.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/common/is_defined.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/common/is_size_valid.js": +/*!***************************************************************!*\ + !*** ./node_modules/@waku/utils/dist/common/is_size_valid.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isSizeValid: () => (/* binding */ isSizeValid)\n/* harmony export */ });\nconst MB = 1024 ** 2;\nconst SIZE_CAP = 1; // 1 MB\nconst isSizeValid = (payload) => {\n if (payload.length / MB > SIZE_CAP) {\n return false;\n }\n return true;\n};\n//# sourceMappingURL=is_size_valid.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/common/is_size_valid.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/common/random_subset.js": +/*!***************************************************************!*\ + !*** ./node_modules/@waku/utils/dist/common/random_subset.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPseudoRandomSubset: () => (/* binding */ getPseudoRandomSubset)\n/* harmony export */ });\n/**\n * Return pseudo random subset of the input.\n */\nfunction getPseudoRandomSubset(values, wantedNumber) {\n if (values.length <= wantedNumber || values.length <= 1) {\n return values;\n }\n return shuffle(values).slice(0, wantedNumber);\n}\nfunction shuffle(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const randInt = () => {\n return Math.floor(Math.random() * Math.floor(arr.length));\n };\n for (let i = 0; i < arr.length; i++) {\n const j = randInt();\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr;\n}\n//# sourceMappingURL=random_subset.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/common/random_subset.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/common/to_async_iterator.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@waku/utils/dist/common/to_async_iterator.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toAsyncIterator: () => (/* binding */ toAsyncIterator)\n/* harmony export */ });\nconst FRAME_RATE = 60;\n/**\n * Function that transforms IReceiver subscription to iterable stream of data.\n * @param receiver - object that allows to be subscribed to;\n * @param decoder - parameter to be passed to receiver for subscription;\n * @param options - options for receiver for subscription;\n * @param iteratorOptions - optional configuration for iterator;\n * @returns iterator and stop function to terminate it.\n */\nasync function toAsyncIterator(receiver, decoder, options, iteratorOptions) {\n const iteratorDelay = iteratorOptions?.iteratorDelay ?? FRAME_RATE;\n const messages = [];\n let unsubscribe;\n unsubscribe = await receiver.subscribe(decoder, (message) => {\n messages.push(message);\n }, options);\n const isWithTimeout = Number.isInteger(iteratorOptions?.timeoutMs);\n const timeoutMs = iteratorOptions?.timeoutMs ?? 0;\n const startTime = Date.now();\n async function* iterator() {\n while (true) {\n if (isWithTimeout && Date.now() - startTime >= timeoutMs) {\n return;\n }\n await wait(iteratorDelay);\n const message = messages.shift();\n if (!unsubscribe && messages.length === 0) {\n return message;\n }\n if (!message && unsubscribe) {\n continue;\n }\n yield message;\n }\n }\n return {\n iterator: iterator(),\n async stop() {\n if (unsubscribe) {\n await unsubscribe();\n unsubscribe = undefined;\n }\n },\n };\n}\nfunction wait(ms) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n//# sourceMappingURL=to_async_iterator.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/common/to_async_iterator.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/index.js": +/*!************************************************!*\ + !*** ./node_modules/@waku/utils/dist/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPseudoRandomSubset: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.getPseudoRandomSubset),\n/* harmony export */ groupByContentTopic: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.groupByContentTopic),\n/* harmony export */ isDefined: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isDefined),\n/* harmony export */ isSizeValid: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.isSizeValid),\n/* harmony export */ removeItemFromArray: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.removeItemFromArray),\n/* harmony export */ toAsyncIterator: () => (/* reexport safe */ _common_index_js__WEBPACK_IMPORTED_MODULE_0__.toAsyncIterator)\n/* harmony export */ });\n/* harmony import */ var _common_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index.js */ \"./node_modules/@waku/utils/dist/common/index.js\");\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/@waku/utils/dist/libp2p/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/@waku/utils/dist/libp2p/index.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPeersForProtocol: () => (/* binding */ getPeersForProtocol),\n/* harmony export */ selectConnection: () => (/* binding */ selectConnection),\n/* harmony export */ selectPeerForProtocol: () => (/* binding */ selectPeerForProtocol),\n/* harmony export */ selectRandomPeer: () => (/* binding */ selectRandomPeer)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n\nconst log = debug__WEBPACK_IMPORTED_MODULE_0__(\"waku:libp2p-utils\");\n/**\n * Returns a pseudo-random peer that supports the given protocol.\n * Useful for protocols such as store and light push\n */\nfunction selectRandomPeer(peers) {\n if (peers.length === 0)\n return;\n const index = Math.round(Math.random() * (peers.length - 1));\n return peers[index];\n}\n/**\n * Returns the list of peers that supports the given protocol.\n */\nasync function getPeersForProtocol(peerStore, protocols) {\n const peers = [];\n await peerStore.forEach((peer) => {\n for (let i = 0; i < protocols.length; i++) {\n if (peer.protocols.includes(protocols[i])) {\n peers.push(peer);\n break;\n }\n }\n });\n return peers;\n}\nasync function selectPeerForProtocol(peerStore, protocols, peerId) {\n let peer;\n if (peerId) {\n peer = await peerStore.get(peerId);\n if (!peer) {\n throw new Error(`Failed to retrieve connection details for provided peer in peer store: ${peerId.toString()}`);\n }\n }\n else {\n const peers = await getPeersForProtocol(peerStore, protocols);\n peer = selectRandomPeer(peers);\n if (!peer) {\n throw new Error(`Failed to find known peer that registers protocols: ${protocols}`);\n }\n }\n let protocol;\n for (const codec of protocols) {\n if (peer.protocols.includes(codec)) {\n protocol = codec;\n // Do not break as we want to keep the last value\n }\n }\n log(`Using codec ${protocol}`);\n if (!protocol) {\n throw new Error(`Peer does not register required protocols (${peer.id.toString()}): ${protocols}`);\n }\n return { peer, protocol };\n}\nfunction selectConnection(connections) {\n if (!connections.length)\n return;\n if (connections.length === 1)\n return connections[0];\n let latestConnection;\n connections.forEach((connection) => {\n if (connection.stat.status === \"OPEN\") {\n if (!latestConnection) {\n latestConnection = connection;\n }\n else if (connection.stat.timeline.open > latestConnection.stat.timeline.open) {\n latestConnection = connection;\n }\n }\n });\n return latestConnection;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/@waku/utils/dist/libp2p/index.js?"); + +/***/ }), + +/***/ "./node_modules/abortable-iterator/dist/src/abort-error.js": +/*!*****************************************************************!*\ + !*** ./node_modules/abortable-iterator/dist/src/abort-error.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError)\n/* harmony export */ });\nclass AbortError extends Error {\n constructor(message, code) {\n super(message ?? 'The operation was aborted');\n this.type = 'aborted';\n this.code = code ?? 'ABORT_ERR';\n }\n}\n//# sourceMappingURL=abort-error.js.map\n\n//# sourceURL=webpack://light/./node_modules/abortable-iterator/dist/src/abort-error.js?"); + +/***/ }), + +/***/ "./node_modules/abortable-iterator/dist/src/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/abortable-iterator/dist/src/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* reexport safe */ _abort_error_js__WEBPACK_IMPORTED_MODULE_0__.AbortError),\n/* harmony export */ abortableDuplex: () => (/* binding */ abortableDuplex),\n/* harmony export */ abortableSink: () => (/* binding */ abortableSink),\n/* harmony export */ abortableSource: () => (/* binding */ abortableSource),\n/* harmony export */ abortableTransform: () => (/* binding */ abortableSink)\n/* harmony export */ });\n/* harmony import */ var _abort_error_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abort-error.js */ \"./node_modules/abortable-iterator/dist/src/abort-error.js\");\n/* harmony import */ var get_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! get-iterator */ \"./node_modules/get-iterator/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * @example\n *\n * ```js\n * import { abortableSource } from 'abortable-iterator'\n *\n * async function main () {\n * // An example function that creates an async iterator that yields an increasing\n * // number every x milliseconds and NEVER ENDS!\n * const asyncCounter = async function * (start, delay) {\n * let i = start\n * while (true) {\n * yield new Promise(resolve => setTimeout(() => resolve(i++), delay))\n * }\n * }\n *\n * // Create a counter that'll yield numbers from 0 upwards every second\n * const everySecond = asyncCounter(0, 1000)\n *\n * // Make everySecond abortable!\n * const controller = new AbortController()\n * const abortableEverySecond = abortableSource(everySecond, controller.signal)\n *\n * // Abort after 5 seconds\n * setTimeout(() => controller.abort(), 5000)\n *\n * try {\n * // Start the iteration, which will throw after 5 seconds when it is aborted\n * for await (const n of abortableEverySecond) {\n * console.log(n)\n * }\n * } catch (err) {\n * if (err.code === 'ERR_ABORTED') {\n * // Expected - all ok :D\n * } else {\n * throw err\n * }\n * }\n * }\n *\n * main()\n * ```\n */\n\n\n/**\n * Wrap an iterator to make it abortable, allow cleanup when aborted via onAbort\n */\nfunction abortableSource(source, signal, options) {\n const opts = options ?? {};\n const iterator = (0,get_iterator__WEBPACK_IMPORTED_MODULE_1__.getIterator)(source);\n async function* abortable() {\n let nextAbortHandler;\n const abortHandler = () => {\n if (nextAbortHandler != null)\n nextAbortHandler();\n };\n signal.addEventListener('abort', abortHandler);\n while (true) {\n let result;\n try {\n if (signal.aborted) {\n const { abortMessage, abortCode } = opts;\n throw new _abort_error_js__WEBPACK_IMPORTED_MODULE_0__.AbortError(abortMessage, abortCode);\n }\n const abort = new Promise((resolve, reject) => {\n nextAbortHandler = () => {\n const { abortMessage, abortCode } = opts;\n reject(new _abort_error_js__WEBPACK_IMPORTED_MODULE_0__.AbortError(abortMessage, abortCode));\n };\n });\n // Race the iterator and the abort signals\n result = await Promise.race([abort, iterator.next()]);\n nextAbortHandler = null;\n }\n catch (err) {\n signal.removeEventListener('abort', abortHandler);\n // Might not have been aborted by a known signal\n const isKnownAborter = err.type === 'aborted' && signal.aborted;\n if (isKnownAborter && (opts.onAbort != null)) {\n // Do any custom abort handling for the iterator\n opts.onAbort(source);\n }\n // End the iterator if it is a generator\n if (typeof iterator.return === 'function') {\n try {\n const p = iterator.return();\n if (p instanceof Promise) { // eslint-disable-line max-depth\n p.catch(err => {\n if (opts.onReturnError != null) {\n opts.onReturnError(err);\n }\n });\n }\n }\n catch (err) {\n if (opts.onReturnError != null) { // eslint-disable-line max-depth\n opts.onReturnError(err);\n }\n }\n }\n if (isKnownAborter && opts.returnOnAbort === true) {\n return;\n }\n throw err;\n }\n if (result.done === true) {\n break;\n }\n yield result.value;\n }\n signal.removeEventListener('abort', abortHandler);\n }\n return abortable();\n}\nfunction abortableSink(sink, signal, options) {\n return (source) => sink(abortableSource(source, signal, options));\n}\nfunction abortableDuplex(duplex, signal, options) {\n return {\n sink: abortableSink(duplex.sink, signal, {\n ...options,\n onAbort: undefined\n }),\n source: abortableSource(duplex.source, signal, options)\n };\n}\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/abortable-iterator/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/any-signal/dist/src/index.js": +/*!***************************************************!*\ + !*** ./node_modules/any-signal/dist/src/index.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ anySignal: () => (/* binding */ anySignal)\n/* harmony export */ });\n/**\n * Takes an array of AbortSignals and returns a single signal.\n * If any signals are aborted, the returned signal will be aborted.\n */\nfunction anySignal(signals) {\n const controller = new globalThis.AbortController();\n function onAbort() {\n controller.abort();\n for (const signal of signals) {\n if (signal?.removeEventListener != null) {\n signal.removeEventListener('abort', onAbort);\n }\n }\n }\n for (const signal of signals) {\n if (signal?.aborted === true) {\n onAbort();\n break;\n }\n if (signal?.addEventListener != null) {\n signal.addEventListener('abort', onAbort);\n }\n }\n function clear() {\n for (const signal of signals) {\n if (signal?.removeEventListener != null) {\n signal.removeEventListener('abort', onAbort);\n }\n }\n }\n const signal = controller.signal;\n signal.clear = clear;\n return signal;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/any-signal/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/byte-access/dist/src/index.js": +/*!****************************************************!*\ + !*** ./node_modules/byte-access/dist/src/index.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ accessor)\n/* harmony export */ });\nfunction accessor(buf) {\n if (buf instanceof Uint8Array) {\n return {\n get(index) {\n return buf[index];\n },\n set(index, value) {\n buf[index] = value;\n }\n };\n }\n return {\n get(index) {\n return buf.get(index);\n },\n set(index, value) {\n buf.set(index, value);\n }\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/byte-access/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/datastore-core/dist/src/base.js": +/*!******************************************************!*\ + !*** ./node_modules/datastore-core/dist/src/base.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseDatastore: () => (/* binding */ BaseDatastore)\n/* harmony export */ });\n/* harmony import */ var it_drain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-drain */ \"./node_modules/it-drain/dist/src/index.js\");\n/* harmony import */ var it_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-filter */ \"./node_modules/it-filter/dist/src/index.js\");\n/* harmony import */ var it_sort__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-sort */ \"./node_modules/it-sort/dist/src/index.js\");\n/* harmony import */ var it_take__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-take */ \"./node_modules/it-take/dist/src/index.js\");\n\n\n\n\nclass BaseDatastore {\n put(key, val, options) {\n return Promise.reject(new Error('.put is not implemented'));\n }\n get(key, options) {\n return Promise.reject(new Error('.get is not implemented'));\n }\n has(key, options) {\n return Promise.reject(new Error('.has is not implemented'));\n }\n delete(key, options) {\n return Promise.reject(new Error('.delete is not implemented'));\n }\n async *putMany(source, options = {}) {\n for await (const { key, value } of source) {\n await this.put(key, value, options);\n yield key;\n }\n }\n async *getMany(source, options = {}) {\n for await (const key of source) {\n yield {\n key,\n value: await this.get(key, options)\n };\n }\n }\n async *deleteMany(source, options = {}) {\n for await (const key of source) {\n await this.delete(key, options);\n yield key;\n }\n }\n batch() {\n let puts = [];\n let dels = [];\n return {\n put(key, value) {\n puts.push({ key, value });\n },\n delete(key) {\n dels.push(key);\n },\n commit: async (options) => {\n await (0,it_drain__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.putMany(puts, options));\n puts = [];\n await (0,it_drain__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.deleteMany(dels, options));\n dels = [];\n }\n };\n }\n /**\n * Extending classes should override `query` or implement this method\n */\n // eslint-disable-next-line require-yield\n async *_all(q, options) {\n throw new Error('._all is not implemented');\n }\n /**\n * Extending classes should override `queryKeys` or implement this method\n */\n // eslint-disable-next-line require-yield\n async *_allKeys(q, options) {\n throw new Error('._allKeys is not implemented');\n }\n query(q, options) {\n let it = this._all(q, options);\n if (q.prefix != null) {\n const prefix = q.prefix;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, (e) => e.key.toString().startsWith(prefix));\n }\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, f), it);\n }\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => (0,it_sort__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(it, f), it);\n }\n if (q.offset != null) {\n let i = 0;\n const offset = q.offset;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, () => i++ >= offset);\n }\n if (q.limit != null) {\n it = (0,it_take__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(it, q.limit);\n }\n return it;\n }\n queryKeys(q, options) {\n let it = this._allKeys(q, options);\n if (q.prefix != null) {\n const prefix = q.prefix;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, (key) => key.toString().startsWith(prefix));\n }\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, f), it);\n }\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => (0,it_sort__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(it, f), it);\n }\n if (q.offset != null) {\n const offset = q.offset;\n let i = 0;\n it = (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(it, () => i++ >= offset);\n }\n if (q.limit != null) {\n it = (0,it_take__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(it, q.limit);\n }\n return it;\n }\n}\n//# sourceMappingURL=base.js.map\n\n//# sourceURL=webpack://light/./node_modules/datastore-core/dist/src/base.js?"); + +/***/ }), + +/***/ "./node_modules/datastore-core/dist/src/errors.js": +/*!********************************************************!*\ + !*** ./node_modules/datastore-core/dist/src/errors.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ abortedError: () => (/* binding */ abortedError),\n/* harmony export */ dbDeleteFailedError: () => (/* binding */ dbDeleteFailedError),\n/* harmony export */ dbOpenFailedError: () => (/* binding */ dbOpenFailedError),\n/* harmony export */ dbReadFailedError: () => (/* binding */ dbReadFailedError),\n/* harmony export */ dbWriteFailedError: () => (/* binding */ dbWriteFailedError),\n/* harmony export */ notFoundError: () => (/* binding */ notFoundError)\n/* harmony export */ });\n/* harmony import */ var err_code__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! err-code */ \"./node_modules/err-code/index.js\");\n\nfunction dbOpenFailedError(err) {\n err = err ?? new Error('Cannot open database');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_OPEN_FAILED');\n}\nfunction dbDeleteFailedError(err) {\n err = err ?? new Error('Delete failed');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_DELETE_FAILED');\n}\nfunction dbWriteFailedError(err) {\n err = err ?? new Error('Write failed');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_WRITE_FAILED');\n}\nfunction dbReadFailedError(err) {\n err = err ?? new Error('Read failed');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_DB_READ_FAILED');\n}\nfunction notFoundError(err) {\n err = err ?? new Error('Not Found');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_NOT_FOUND');\n}\nfunction abortedError(err) {\n err = err ?? new Error('Aborted');\n return err_code__WEBPACK_IMPORTED_MODULE_0__(err, 'ERR_ABORTED');\n}\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/datastore-core/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/datastore-core/dist/src/memory.js": +/*!********************************************************!*\ + !*** ./node_modules/datastore-core/dist/src/memory.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MemoryDatastore: () => (/* binding */ MemoryDatastore)\n/* harmony export */ });\n/* harmony import */ var interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! interface-datastore/key */ \"./node_modules/interface-datastore/dist/src/key.js\");\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ \"./node_modules/datastore-core/dist/src/base.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/datastore-core/dist/src/errors.js\");\n\n\n\nclass MemoryDatastore extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseDatastore {\n data;\n constructor() {\n super();\n this.data = new Map();\n }\n put(key, val) {\n this.data.set(key.toString(), val);\n return key;\n }\n get(key) {\n const result = this.data.get(key.toString());\n if (result == null) {\n throw _errors_js__WEBPACK_IMPORTED_MODULE_2__.notFoundError();\n }\n return result;\n }\n has(key) {\n return this.data.has(key.toString());\n }\n delete(key) {\n this.data.delete(key.toString());\n }\n *_all() {\n for (const [key, value] of this.data.entries()) {\n yield { key: new interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__.Key(key), value };\n }\n }\n *_allKeys() {\n for (const key of this.data.keys()) {\n yield new interface_datastore_key__WEBPACK_IMPORTED_MODULE_0__.Key(key);\n }\n }\n}\n//# sourceMappingURL=memory.js.map\n\n//# sourceURL=webpack://light/./node_modules/datastore-core/dist/src/memory.js?"); + +/***/ }), + +/***/ "./node_modules/dns-over-http-resolver/dist/src/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/dns-over-http-resolver/dist/src/index.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var receptacle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! receptacle */ \"./node_modules/receptacle/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/dns-over-http-resolver/dist/src/utils.js\");\n\n\n\nconst log = Object.assign(debug__WEBPACK_IMPORTED_MODULE_0__('dns-over-http-resolver'), {\n error: debug__WEBPACK_IMPORTED_MODULE_0__('dns-over-http-resolver:error')\n});\n/**\n * DNS over HTTP resolver.\n * Uses a list of servers to resolve DNS records with HTTP requests.\n */\nclass Resolver {\n /**\n * @class\n * @param {object} [options]\n * @param {number} [options.maxCache = 100] - maximum number of cached dns records\n * @param {Request} [options.request] - function to return DNSJSON\n */\n constructor(options = {}) {\n this._cache = new receptacle__WEBPACK_IMPORTED_MODULE_1__({ max: options?.maxCache ?? 100 });\n this._TXTcache = new receptacle__WEBPACK_IMPORTED_MODULE_1__({ max: options?.maxCache ?? 100 });\n this._servers = [\n 'https://cloudflare-dns.com/dns-query',\n 'https://dns.google/resolve'\n ];\n this._request = options.request ?? _utils_js__WEBPACK_IMPORTED_MODULE_2__.request;\n this._abortControllers = [];\n }\n /**\n * Cancel all outstanding DNS queries made by this resolver. Any outstanding\n * requests will be aborted and promises rejected.\n */\n cancel() {\n this._abortControllers.forEach(controller => controller.abort());\n }\n /**\n * Get an array of the IP addresses currently configured for DNS resolution.\n * These addresses are formatted according to RFC 5952. It can include a custom port.\n */\n getServers() {\n return this._servers;\n }\n /**\n * Get a shuffled array of the IP addresses currently configured for DNS resolution.\n * These addresses are formatted according to RFC 5952. It can include a custom port.\n */\n _getShuffledServers() {\n const newServers = [...this._servers];\n for (let i = newServers.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = newServers[i];\n newServers[i] = newServers[j];\n newServers[j] = temp;\n }\n return newServers;\n }\n /**\n * Sets the IP address and port of servers to be used when performing DNS resolution.\n *\n * @param {string[]} servers - array of RFC 5952 formatted addresses.\n */\n setServers(servers) {\n this._servers = servers;\n }\n /**\n * Uses the DNS protocol to resolve the given host name into the appropriate DNS record\n *\n * @param {string} hostname - host name to resolve\n * @param {string} [rrType = 'A'] - resource record type\n */\n async resolve(hostname, rrType = 'A') {\n switch (rrType) {\n case 'A':\n return await this.resolve4(hostname);\n case 'AAAA':\n return await this.resolve6(hostname);\n case 'TXT':\n return await this.resolveTxt(hostname);\n default:\n throw new Error(`${rrType} is not supported`);\n }\n }\n /**\n * Uses the DNS protocol to resolve the given host name into IPv4 addresses\n *\n * @param {string} hostname - host name to resolve\n */\n async resolve4(hostname) {\n const recordType = 'A';\n const cached = this._cache.get(_utils_js__WEBPACK_IMPORTED_MODULE_2__.getCacheKey(hostname, recordType));\n if (cached != null) {\n return cached;\n }\n let aborted = false;\n for (const server of this._getShuffledServers()) {\n const controller = new AbortController();\n this._abortControllers.push(controller);\n try {\n const response = await this._request(_utils_js__WEBPACK_IMPORTED_MODULE_2__.buildResource(server, hostname, recordType), controller.signal);\n const data = response.Answer.map(a => a.data);\n const ttl = Math.min(...response.Answer.map(a => a.TTL));\n this._cache.set(_utils_js__WEBPACK_IMPORTED_MODULE_2__.getCacheKey(hostname, recordType), data, { ttl });\n return data;\n }\n catch (err) {\n if (controller.signal.aborted) {\n aborted = true;\n }\n log.error(`${server} could not resolve ${hostname} record ${recordType}`);\n }\n finally {\n this._abortControllers = this._abortControllers.filter(c => c !== controller);\n }\n }\n if (aborted) {\n throw Object.assign(new Error('queryA ECANCELLED'), {\n code: 'ECANCELLED'\n });\n }\n throw new Error(`Could not resolve ${hostname} record ${recordType}`);\n }\n /**\n * Uses the DNS protocol to resolve the given host name into IPv6 addresses\n *\n * @param {string} hostname - host name to resolve\n */\n async resolve6(hostname) {\n const recordType = 'AAAA';\n const cached = this._cache.get(_utils_js__WEBPACK_IMPORTED_MODULE_2__.getCacheKey(hostname, recordType));\n if (cached != null) {\n return cached;\n }\n let aborted = false;\n for (const server of this._getShuffledServers()) {\n const controller = new AbortController();\n this._abortControllers.push(controller);\n try {\n const response = await this._request(_utils_js__WEBPACK_IMPORTED_MODULE_2__.buildResource(server, hostname, recordType), controller.signal);\n const data = response.Answer.map(a => a.data);\n const ttl = Math.min(...response.Answer.map(a => a.TTL));\n this._cache.set(_utils_js__WEBPACK_IMPORTED_MODULE_2__.getCacheKey(hostname, recordType), data, { ttl });\n return data;\n }\n catch (err) {\n if (controller.signal.aborted) {\n aborted = true;\n }\n log.error(`${server} could not resolve ${hostname} record ${recordType}`);\n }\n finally {\n this._abortControllers = this._abortControllers.filter(c => c !== controller);\n }\n }\n if (aborted) {\n throw Object.assign(new Error('queryAaaa ECANCELLED'), {\n code: 'ECANCELLED'\n });\n }\n throw new Error(`Could not resolve ${hostname} record ${recordType}`);\n }\n /**\n * Uses the DNS protocol to resolve the given host name into a Text record\n *\n * @param {string} hostname - host name to resolve\n */\n async resolveTxt(hostname) {\n const recordType = 'TXT';\n const cached = this._TXTcache.get(_utils_js__WEBPACK_IMPORTED_MODULE_2__.getCacheKey(hostname, recordType));\n if (cached != null) {\n return cached;\n }\n let aborted = false;\n for (const server of this._getShuffledServers()) {\n const controller = new AbortController();\n this._abortControllers.push(controller);\n try {\n const response = await this._request(_utils_js__WEBPACK_IMPORTED_MODULE_2__.buildResource(server, hostname, recordType), controller.signal);\n const data = response.Answer.map(a => [a.data.replace(/['\"]+/g, '')]);\n const ttl = Math.min(...response.Answer.map(a => a.TTL));\n this._TXTcache.set(_utils_js__WEBPACK_IMPORTED_MODULE_2__.getCacheKey(hostname, recordType), data, { ttl });\n return data;\n }\n catch (err) {\n if (controller.signal.aborted) {\n aborted = true;\n }\n log.error(`${server} could not resolve ${hostname} record ${recordType}`);\n }\n finally {\n this._abortControllers = this._abortControllers.filter(c => c !== controller);\n }\n }\n if (aborted) {\n throw Object.assign(new Error('queryTxt ECANCELLED'), {\n code: 'ECANCELLED'\n });\n }\n throw new Error(`Could not resolve ${hostname} record ${recordType}`);\n }\n clearCache() {\n this._cache.clear();\n this._TXTcache.clear();\n }\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Resolver);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/dns-over-http-resolver/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/dns-over-http-resolver/dist/src/utils.js": +/*!***************************************************************!*\ + !*** ./node_modules/dns-over-http-resolver/dist/src/utils.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ buildResource: () => (/* binding */ buildResource),\n/* harmony export */ getCacheKey: () => (/* binding */ getCacheKey),\n/* harmony export */ request: () => (/* binding */ request)\n/* harmony export */ });\n/* harmony import */ var native_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! native-fetch */ \"./node_modules/native-fetch/esm/src/index.js\");\n\n/**\n * Build fetch resource for request\n */\nfunction buildResource(serverResolver, hostname, recordType) {\n return `${serverResolver}?name=${hostname}&type=${recordType}`;\n}\n/**\n * Use fetch to find the record\n */\nasync function request(resource, signal) {\n const req = await (0,native_fetch__WEBPACK_IMPORTED_MODULE_0__.fetch)(resource, {\n headers: new native_fetch__WEBPACK_IMPORTED_MODULE_0__.Headers({\n accept: 'application/dns-json'\n }),\n signal\n });\n const res = await req.json();\n return res;\n}\n/**\n * Creates cache key composed by recordType and hostname\n *\n * @param {string} hostname\n * @param {string} recordType\n */\nfunction getCacheKey(hostname, recordType) {\n return `${recordType}_${hostname}`;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/dns-over-http-resolver/dist/src/utils.js?"); + +/***/ }), + +/***/ "./node_modules/dns-query/common.mjs": +/*!*******************************************!*\ + !*** ./node_modules/dns-query/common.mjs ***! + \*******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ BaseEndpoint: () => (/* binding */ BaseEndpoint),\n/* harmony export */ HTTPEndpoint: () => (/* binding */ HTTPEndpoint),\n/* harmony export */ HTTPStatusError: () => (/* binding */ HTTPStatusError),\n/* harmony export */ InvalidProtocolError: () => (/* binding */ InvalidProtocolError),\n/* harmony export */ ResponseError: () => (/* binding */ ResponseError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ UDP4Endpoint: () => (/* binding */ UDP4Endpoint),\n/* harmony export */ UDP6Endpoint: () => (/* binding */ UDP6Endpoint),\n/* harmony export */ UDPEndpoint: () => (/* binding */ UDPEndpoint),\n/* harmony export */ URL: () => (/* binding */ URL),\n/* harmony export */ parseEndpoint: () => (/* binding */ parseEndpoint),\n/* harmony export */ reduceError: () => (/* binding */ reduceError),\n/* harmony export */ supportedProtocols: () => (/* binding */ supportedProtocols),\n/* harmony export */ toEndpoint: () => (/* binding */ toEndpoint)\n/* harmony export */ });\nlet AbortError = typeof global !== 'undefined' ? global.AbortError : typeof window !== 'undefined' ? window.AbortError : null\nif (!AbortError) {\n AbortError = class AbortError extends Error {\n constructor (message = 'Request aborted.') {\n super(message)\n }\n }\n}\nAbortError.prototype.name = 'AbortError'\nAbortError.prototype.code = 'ABORT_ERR'\n\nconst URL = (typeof globalThis !== 'undefined' && globalThis.URL) || require('url').URL\n\n\n\nclass HTTPStatusError extends Error {\n constructor (uri, code, method) {\n super('status=' + code + ' while requesting ' + uri + ' [' + method + ']')\n this.uri = uri\n this.status = code\n this.method = method\n }\n\n toJSON () {\n return {\n code: this.code,\n uri: this.uri,\n status: this.status,\n method: this.method,\n endpoint: this.endpoint\n }\n }\n}\nHTTPStatusError.prototype.name = 'HTTPStatusError'\nHTTPStatusError.prototype.code = 'HTTP_STATUS'\n\nclass ResponseError extends Error {\n constructor (message, cause) {\n super(message)\n this.cause = cause\n }\n\n toJSON () {\n return {\n message: this.message,\n endpoint: this.endpoint,\n code: this.code,\n cause: reduceError(this.cause)\n }\n }\n}\nResponseError.prototype.name = 'ResponseError'\nResponseError.prototype.code = 'RESPONSE_ERR'\n\nclass TimeoutError extends Error {\n constructor (timeout) {\n super('Timeout (t=' + timeout + ').')\n this.timeout = timeout\n }\n\n toJSON () {\n return {\n code: this.code,\n endpoint: this.endpoint,\n timeout: this.timeout\n }\n }\n}\nTimeoutError.prototype.name = 'TimeoutError'\nTimeoutError.prototype.code = 'ETIMEOUT'\n\nconst v4Regex = /^((\\d{1,3}\\.){3,3}\\d{1,3})(:(\\d{2,5}))?$/\nconst v6Regex = /^((::)?(((\\d{1,3}\\.){3}(\\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\\d{2,5}))?$/i\n\nfunction reduceError (err) {\n if (typeof err === 'string') {\n return {\n message: err\n }\n }\n try {\n const json = JSON.stringify(err)\n if (json !== '{}') {\n return JSON.parse(json)\n }\n } catch (e) {}\n const error = {\n message: String(err.message || err)\n }\n if (err.code !== undefined) {\n error.code = String(err.code)\n }\n return error\n}\n\nconst baseParts = /^(([a-z0-9]+:)\\/\\/)?([^/[\\s:]+|\\[[^\\]]+\\])?(:([^/\\s]+))?(\\/[^\\s]*)?(.*)$/\nconst httpFlags = /\\[(post|get|((ipv4|ipv6|name)=([^\\]]+)))\\]/ig\nconst updFlags = /\\[(((pk|name)=([^\\]]+)))\\]/ig\n\nfunction parseEndpoint (endpoint) {\n const parts = baseParts.exec(endpoint)\n const protocol = parts[2] || 'https:'\n const host = parts[3]\n const port = parts[5]\n const path = parts[6]\n const rest = parts[7]\n if (protocol === 'https:' || protocol === 'http:') {\n const flags = parseFlags(rest, httpFlags)\n return {\n name: flags.name,\n protocol,\n ipv4: flags.ipv4,\n ipv6: flags.ipv6,\n host,\n port,\n path,\n method: flags.post ? 'POST' : 'GET'\n }\n }\n if (protocol === 'udp:' || protocol === 'udp4:' || protocol === 'udp6:') {\n const flags = parseFlags(rest, updFlags)\n const v6Parts = /^\\[(.*)\\]$/.exec(host)\n if (v6Parts && protocol === 'udp4:') {\n throw new Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${endpoint})`)\n }\n if (!v6Parts && protocol === 'udp6:') {\n throw new Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${endpoint})`)\n }\n if (v6Parts) {\n return new UDP6Endpoint({ protocol: 'udp6:', ipv6: v6Parts[1], port, pk: flags.pk, name: flags.name })\n }\n return new UDP4Endpoint({ protocol: 'udp4:', ipv4: host, port, pk: flags.pk, name: flags.name })\n }\n throw new InvalidProtocolError(protocol, endpoint)\n}\n\nfunction parseFlags (rest, regex) {\n regex.lastIndex = 0\n const result = {}\n while (true) {\n const match = regex.exec(rest)\n if (!match) break\n if (match[2]) {\n result[match[3].toLowerCase()] = match[4]\n } else {\n result[match[1].toLowerCase()] = true\n }\n }\n return result\n}\n\nclass InvalidProtocolError extends Error {\n constructor (protocol, endpoint) {\n super(`Invalid Endpoint: unsupported protocol \"${protocol}\" for endpoint: ${endpoint}, supported protocols: ${supportedProtocols.join(', ')}`)\n this.protocol = protocol\n this.endpoint = endpoint\n }\n\n toJSON () {\n return {\n code: this.code,\n endpoint: this.endpoint,\n timeout: this.timeout\n }\n }\n}\nInvalidProtocolError.prototype.name = 'InvalidProtocolError'\nInvalidProtocolError.prototype.code = 'EPROTOCOL'\n\nconst supportedProtocols = ['http:', 'https:', 'udp4:', 'udp6:']\n\nclass BaseEndpoint {\n constructor (opts, isHTTP) {\n this.name = opts.name || null\n this.protocol = opts.protocol\n const port = typeof opts.port === 'string' ? opts.port = parseInt(opts.port, 10) : opts.port\n if (port === undefined || port === null) {\n this.port = isHTTP\n ? (this.protocol === 'https:' ? 443 : 80)\n : (opts.pk ? 443 : 53)\n } else if (typeof port !== 'number' && !isNaN(port)) {\n throw new Error(`Invalid Endpoint: port \"${opts.port}\" needs to be a number: ${JSON.stringify(opts)}`)\n } else {\n this.port = port\n }\n }\n\n toJSON () {\n return this.toString()\n }\n}\n\nclass UDPEndpoint extends BaseEndpoint {\n constructor (opts) {\n super(opts, false)\n this.pk = opts.pk || null\n }\n\n toString () {\n const port = this.port !== (this.pk ? 443 : 53) ? `:${this.port}` : ''\n const pk = this.pk ? ` [pk=${this.pk}]` : ''\n const name = this.name ? ` [name=${this.name}]` : ''\n return `udp://${this.ipv4 || `[${this.ipv6}]`}${port}${pk}${name}`\n }\n}\n\nclass UDP4Endpoint extends UDPEndpoint {\n constructor (opts) {\n super(Object.assign({ protocol: 'udp4:' }, opts))\n if (!opts.ipv4 || typeof opts.ipv4 !== 'string') {\n throw new Error(`Invalid Endpoint: .ipv4 \"${opts.ipv4}\" needs to be set: ${JSON.stringify(opts)}`)\n }\n this.ipv4 = opts.ipv4\n }\n}\n\nclass UDP6Endpoint extends UDPEndpoint {\n constructor (opts) {\n super(Object.assign({ protocol: 'udp6:' }, opts))\n if (!opts.ipv6 || typeof opts.ipv6 !== 'string') {\n throw new Error(`Invalid Endpoint: .ipv6 \"${opts.ipv6}\" needs to be set: ${JSON.stringify(opts)}`)\n }\n this.ipv6 = opts.ipv6\n }\n}\n\nfunction safeHost (host) {\n return v6Regex.test(host) && !v4Regex.test(host) ? `[${host}]` : host\n}\n\nclass HTTPEndpoint extends BaseEndpoint {\n constructor (opts) {\n super(Object.assign({ protocol: 'https:' }, opts), true)\n if (!opts.host) {\n if (opts.ipv4) {\n opts.host = opts.ipv4\n }\n if (opts.ipv6) {\n opts.host = `[${opts.ipv6}]`\n }\n }\n if (!opts.host || typeof opts.host !== 'string') {\n throw new Error(`Invalid Endpoint: host \"${opts.path}\" needs to be set: ${JSON.stringify(opts)}`)\n }\n this.host = opts.host\n this.path = opts.path || '/dns-query'\n this.method = /^post$/i.test(opts.method) ? 'POST' : 'GET'\n this.ipv4 = opts.ipv4\n this.ipv6 = opts.ipv6\n if (!this.ipv6) {\n const v6Parts = v6Regex.exec(this.host)\n if (v6Parts) {\n this.ipv6 = v6Parts[1]\n }\n }\n if (!this.ipv4) {\n if (v4Regex.test(this.host)) {\n this.ipv4 = this.host\n }\n }\n const url = `${this.protocol}//${safeHost(this.host)}:${this.port}${this.path}`\n try {\n this.url = new URL(url)\n } catch (err) {\n throw new Error(err.message + ` [${url}]`)\n }\n }\n\n toString () {\n const protocol = this.protocol === 'https:' ? '' : 'http://'\n const port = this.port !== (this.protocol === 'https:' ? 443 : 80) ? `:${this.port}` : ''\n const method = this.method !== 'GET' ? ' [post]' : ''\n const path = this.path === '/dns-query' ? '' : this.path\n const name = this.name ? ` [name=${this.name}]` : ''\n const ipv4 = this.ipv4 && this.ipv4 !== this.host ? ` [ipv4=${this.ipv4}]` : ''\n const ipv6 = this.ipv6 && this.ipv6 !== this.host ? ` [ipv6=${this.ipv6}]` : ''\n return `${protocol}${safeHost(this.host)}${port}${path}${method}${ipv4}${ipv6}${name}`\n }\n}\n\nfunction toEndpoint (input) {\n let opts\n if (typeof input === 'string') {\n opts = parseEndpoint(input)\n } else {\n if (typeof input !== 'object' || input === null || Array.isArray(input)) {\n throw new Error(`Can not convert ${input} to an endpoint`)\n } else if (input instanceof BaseEndpoint) {\n return input\n }\n opts = input\n }\n if (opts.protocol === null || opts.protocol === undefined) {\n opts.protocol = 'https:'\n }\n const protocol = opts.protocol\n if (protocol === 'udp4:') {\n return new UDP4Endpoint(opts)\n }\n if (protocol === 'udp6:') {\n return new UDP6Endpoint(opts)\n }\n if (protocol === 'https:' || protocol === 'http:') {\n return new HTTPEndpoint(opts)\n }\n throw new InvalidProtocolError(protocol, JSON.stringify(opts))\n}\n\n\n//# sourceURL=webpack://light/./node_modules/dns-query/common.mjs?"); + +/***/ }), + +/***/ "./node_modules/dns-query/index.mjs": +/*!******************************************!*\ + !*** ./node_modules/dns-query/index.mjs ***! + \******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.AbortError),\n/* harmony export */ BaseEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.BaseEndpoint),\n/* harmony export */ DNSRcodeError: () => (/* binding */ DNSRcodeError),\n/* harmony export */ DNS_RCODE_ERROR: () => (/* binding */ DNS_RCODE_ERROR),\n/* harmony export */ DNS_RCODE_MESSAGE: () => (/* binding */ DNS_RCODE_MESSAGE),\n/* harmony export */ HTTPEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.HTTPEndpoint),\n/* harmony export */ HTTPStatusError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.HTTPStatusError),\n/* harmony export */ ResponseError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.ResponseError),\n/* harmony export */ TimeoutError: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.TimeoutError),\n/* harmony export */ UDP4Endpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.UDP4Endpoint),\n/* harmony export */ UDP6Endpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.UDP6Endpoint),\n/* harmony export */ Wellknown: () => (/* binding */ Wellknown),\n/* harmony export */ backup: () => (/* binding */ backup),\n/* harmony export */ combineTXT: () => (/* binding */ combineTXT),\n/* harmony export */ lookupTxt: () => (/* binding */ lookupTxt),\n/* harmony export */ parseEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.parseEndpoint),\n/* harmony export */ query: () => (/* binding */ query),\n/* harmony export */ toEndpoint: () => (/* reexport safe */ _common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint),\n/* harmony export */ validateResponse: () => (/* binding */ validateResponse),\n/* harmony export */ wellknown: () => (/* binding */ wellknown)\n/* harmony export */ });\n/* harmony import */ var _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @leichtgewicht/dns-packet */ \"./node_modules/@leichtgewicht/dns-packet/index.mjs\");\n/* harmony import */ var _leichtgewicht_dns_packet_rcodes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @leichtgewicht/dns-packet/rcodes.js */ \"./node_modules/@leichtgewicht/dns-packet/rcodes.mjs\");\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n/* harmony import */ var _lib_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib.mjs */ \"./node_modules/dns-query/lib.browser.mjs\");\n/* harmony import */ var _resolvers_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./resolvers.mjs */ \"./node_modules/dns-query/resolvers.mjs\");\n/* harmony import */ var _common_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./common.mjs */ \"./node_modules/dns-query/common.mjs\");\n\n\n\n\n\n\n\n\n\nconst DNS_RCODE_ERROR = {\n 1: 'FormErr',\n 2: 'ServFail',\n 3: 'NXDomain',\n 4: 'NotImp',\n 5: 'Refused',\n 6: 'YXDomain',\n 7: 'YXRRSet',\n 8: 'NXRRSet',\n 9: 'NotAuth',\n 10: 'NotZone',\n 11: 'DSOTYPENI'\n}\n\nconst DNS_RCODE_MESSAGE = {\n // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6\n 1: 'The name server was unable to interpret the query.',\n 2: 'The name server was unable to process this query due to a problem with the name server.',\n 3: 'Non-Existent Domain.',\n 4: 'The name server does not support the requested kind of query.',\n 5: 'The name server refuses to perform the specified operation for policy reasons.',\n 6: 'Name Exists when it should not.',\n 7: 'RR Set Exists when it should not.',\n 8: 'RR Set that should exist does not.',\n 9: 'Server Not Authoritative for zone / Not Authorized.',\n 10: 'Name not contained in zone.',\n 11: 'DSO-TYPE Not Implemented.'\n}\n\nclass DNSRcodeError extends Error {\n constructor (rcode, question) {\n super(`${(DNS_RCODE_MESSAGE[rcode] || 'Undefined error.')} (rcode=${rcode}${DNS_RCODE_ERROR[rcode] ? `, error=${DNS_RCODE_ERROR[rcode]}` : ''}, question=${JSON.stringify(question)})`)\n this.rcode = rcode\n this.code = `DNS_RCODE_${rcode}`\n this.error = DNS_RCODE_ERROR[rcode]\n this.question = question\n }\n\n toJSON () {\n return {\n code: this.code,\n error: this.error,\n question: this.question,\n endpoint: this.endpoint\n }\n }\n}\n\nfunction validateResponse (data, question) {\n const rcode = (0,_leichtgewicht_dns_packet_rcodes_js__WEBPACK_IMPORTED_MODULE_1__.toRcode)(data.rcode)\n if (rcode !== 0) {\n const err = new DNSRcodeError(rcode, question)\n err.endpoint = data.endpoint\n throw err\n }\n return data\n}\n\nfunction processResolvers (res) {\n const time = (res.time === null || res.time === undefined) ? Date.now() : res.time\n const resolvers = _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.processResolvers(res.data.map(resolver => {\n resolver.endpoint = (0,_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint)(Object.assign({ name: resolver.name }, resolver.endpoint))\n return resolver\n }))\n const endpoints = resolvers.map(resolver => resolver.endpoint)\n return {\n data: {\n resolvers,\n resolverByName: resolvers.reduce((byName, resolver) => {\n byName[resolver.name] = resolver\n return byName\n }, {}),\n endpoints,\n endpointByName: endpoints.reduce((byName, endpoint) => {\n byName[endpoint.name] = endpoint\n return byName\n }, {})\n },\n time\n }\n}\n\nconst backup = processResolvers(_resolvers_mjs__WEBPACK_IMPORTED_MODULE_4__.resolvers)\n\nfunction toMultiQuery (singleQuery) {\n const query = Object.assign({\n type: 'query'\n }, singleQuery)\n delete query.question\n query.questions = []\n if (singleQuery.question) {\n query.questions.push(singleQuery.question)\n }\n return query\n}\n\nfunction queryOne (endpoint, query, timeout, abortSignal) {\n if (abortSignal && abortSignal.aborted) {\n return Promise.reject(new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.AbortError())\n }\n if (endpoint.protocol === 'udp4:' || endpoint.protocol === 'udp6:') {\n return _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.queryDns(endpoint, query, timeout, abortSignal)\n }\n return queryDoh(endpoint, query, timeout, abortSignal)\n}\n\nfunction queryDoh (endpoint, query, timeout, abortSignal) {\n return _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.request(\n endpoint.url,\n endpoint.method,\n _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__.encode(Object.assign({\n flags: _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__.RECURSION_DESIRED\n }, query)),\n timeout,\n abortSignal\n ).then(\n function (res) {\n const data = res.data\n const response = res.response\n let error = res.error\n if (error === undefined) {\n if (data.length === 0) {\n error = new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.ResponseError('Empty.')\n } else {\n try {\n const decoded = _leichtgewicht_dns_packet__WEBPACK_IMPORTED_MODULE_0__.decode(data)\n decoded.response = response\n return decoded\n } catch (err) {\n error = new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.ResponseError('Invalid packet (cause=' + err.message + ')', err)\n }\n }\n }\n throw Object.assign(error, { response })\n }\n )\n}\n\nconst UPDATE_URL = new _common_mjs__WEBPACK_IMPORTED_MODULE_5__.URL('https://martinheidegger.github.io/dns-query/resolvers.json')\n\nfunction concatUint8 (arrs) {\n const res = new Uint8Array(\n arrs.reduce((len, arr) => len + arr.length, 0)\n )\n let pos = 0\n for (const arr of arrs) {\n res.set(arr, pos)\n pos += arr.length\n }\n return res\n}\n\nfunction combineTXT (inputs) {\n return (0,utf8_codec__WEBPACK_IMPORTED_MODULE_2__.decode)(concatUint8(inputs))\n}\n\nfunction isNameString (entry) {\n return /^@/.test(entry)\n}\n\nclass Wellknown {\n constructor (opts) {\n this.opts = Object.assign({\n timeout: 5000,\n update: true,\n updateURL: UPDATE_URL,\n persist: false,\n localStoragePrefix: 'dnsquery_',\n maxAge: 300000 // 5 minutes\n }, opts)\n this._dataP = null\n }\n\n _data (force, outdated) {\n if (!force && this._dataP !== null) {\n return this._dataP.then(res => {\n if (res.time < Date.now() - this.opts.maxAge) {\n return this._data(true, res)\n }\n return res\n })\n }\n this._dataP = (!this.opts.update\n ? Promise.resolve(backup)\n : _lib_mjs__WEBPACK_IMPORTED_MODULE_3__.loadJSON(\n this.opts.updateURL,\n this.opts.persist\n ? {\n name: 'resolvers.json',\n localStoragePrefix: this.opts.localStoragePrefix,\n maxTime: Date.now() - this.opts.maxAge\n }\n : null,\n this.opts.timeout\n )\n .then(res => processResolvers({\n data: res.data.resolvers,\n time: res.time\n }))\n .catch(() => outdated || backup)\n )\n return this._dataP\n }\n\n data () {\n return this._data(false).then(data => data.data)\n }\n\n endpoints (input) {\n if (input === null || input === undefined) {\n return this.data().then(data => data.endpoints)\n }\n if (input === 'doh') {\n input = filterDoh\n }\n if (input === 'dns') {\n input = filterDns\n }\n if (typeof input === 'function') {\n return this.data().then(data => data.endpoints.filter(input))\n }\n if (typeof input === 'string' || typeof input[Symbol.iterator] !== 'function') {\n return Promise.reject(new Error(`Endpoints (${input}) needs to be iterable (array).`))\n }\n input = Array.from(input).filter(Boolean)\n if (input.findIndex(isNameString) === -1) {\n try {\n return Promise.resolve(input.map(_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint))\n } catch (err) {\n return Promise.reject(err)\n }\n }\n return this.data().then(data =>\n input.map(entry => {\n if (isNameString(entry)) {\n const found = data.endpointByName[entry.substring(1)]\n if (!found) {\n throw new Error(`Endpoint ${entry} is not known.`)\n }\n return found\n }\n return (0,_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint)(entry)\n })\n )\n }\n}\n\nconst wellknown = new Wellknown()\n\nfunction isPromise (input) {\n if (input === null) {\n return false\n }\n if (typeof input !== 'object') {\n return false\n }\n return typeof input.then === 'function'\n}\n\nfunction toPromise (input) {\n return isPromise(input) ? input : Promise.resolve(input)\n}\n\nfunction query (q, opts) {\n opts = Object.assign({\n retries: 5,\n timeout: 30000 // 30 seconds\n }, opts)\n if (!q.question) return Promise.reject(new Error('To request data you need to specify a .question!'))\n return toPromise(opts.endpoints)\n .then(endpoints => {\n if (!Array.isArray(endpoints) || endpoints.length === 0) {\n throw new Error('No endpoints defined to lookup dns records.')\n }\n return queryN(endpoints.map(_common_mjs__WEBPACK_IMPORTED_MODULE_5__.toEndpoint), toMultiQuery(q), opts)\n })\n .then(data => {\n data.question = data.questions[0]\n delete data.questions\n return data\n })\n}\n\nfunction lookupTxt (domain, opts) {\n const q = Object.assign({\n question: {\n type: 'TXT',\n name: domain\n }\n }, opts.query)\n return query(q, opts)\n .then(data => {\n validateResponse(data, q)\n return {\n entries: (data.answers || [])\n .filter(answer => answer.type === 'TXT' && answer.data)\n .map(answer => {\n return ({\n data: combineTXT(answer.data),\n ttl: answer.ttl\n })\n })\n .sort((a, b) => {\n if (a.data > b.data) return 1\n if (a.data < b.data) return -1\n return 0\n }),\n endpoint: data.endpoint\n }\n })\n}\n\nfunction queryN (endpoints, q, opts) {\n const endpoint = endpoints.length === 1\n ? endpoints[0]\n : endpoints[Math.floor(Math.random() * endpoints.length) % endpoints.length]\n return queryOne(endpoint, q, opts.timeout, opts.signal)\n .then(\n data => {\n // Add the endpoint to give a chance to identify which endpoint returned the result\n data.endpoint = endpoint.toString()\n return data\n },\n err => {\n if (err.name === 'AbortError' || opts.retries === 0) {\n err.endpoint = endpoint.toString()\n throw err\n }\n if (opts.retries > 0) {\n opts.retries -= 1\n }\n return queryN(endpoints, q, opts)\n }\n )\n}\n\nfunction filterDoh (endpoint) {\n return endpoint.protocol === 'https:' || endpoint.protocol === 'http:'\n}\n\nfunction filterDns (endpoint) {\n return endpoint.protocol === 'udp4:' || endpoint.protocol === 'udp6:'\n}\n\n\n//# sourceURL=webpack://light/./node_modules/dns-query/index.mjs?"); + +/***/ }), + +/***/ "./node_modules/dns-query/lib.browser.mjs": +/*!************************************************!*\ + !*** ./node_modules/dns-query/lib.browser.mjs ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadJSON: () => (/* binding */ loadJSON),\n/* harmony export */ processResolvers: () => (/* binding */ processResolvers),\n/* harmony export */ queryDns: () => (/* binding */ queryDns),\n/* harmony export */ request: () => (/* binding */ request)\n/* harmony export */ });\n/* harmony import */ var utf8_codec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! utf8-codec */ \"./node_modules/utf8-codec/index.mjs\");\n/* harmony import */ var _leichtgewicht_base64_codec__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @leichtgewicht/base64-codec */ \"./node_modules/@leichtgewicht/base64-codec/index.mjs\");\n/* harmony import */ var _common_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common.mjs */ \"./node_modules/dns-query/common.mjs\");\n/* global XMLHttpRequest, localStorage */\n\n\n\nconst contentType = 'application/dns-message'\n\nfunction noop () { }\n\nfunction queryDns () {\n throw new Error('Only \"doh\" endpoints are supported in the browser')\n}\n\nasync function loadJSON (url, cache, timeout, abortSignal) {\n const cacheKey = cache ? cache.localStoragePrefix + cache.name : null\n if (cacheKey) {\n try {\n const cached = JSON.parse(localStorage.getItem(cacheKey))\n if (cached && cached.time > cache.maxTime) {\n return cached\n }\n } catch (err) {}\n }\n const { data } = await requestRaw(url, 'GET', null, timeout, abortSignal)\n const result = {\n time: Date.now(),\n data: JSON.parse(utf8_codec__WEBPACK_IMPORTED_MODULE_0__.decode(data))\n }\n if (cacheKey) {\n try {\n localStorage.setItem(cacheKey, JSON.stringify(result))\n } catch (err) {\n result.time = null\n }\n }\n return result\n}\n\nfunction requestRaw (url, method, data, timeout, abortSignal) {\n return new Promise((resolve, reject) => {\n const target = new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.URL(url)\n if (method === 'GET' && data) {\n target.search = '?dns=' + _leichtgewicht_base64_codec__WEBPACK_IMPORTED_MODULE_1__.base64URL.decode(data)\n }\n const uri = target.toString()\n const xhr = new XMLHttpRequest()\n xhr.open(method, uri, true)\n xhr.setRequestHeader('Accept', contentType)\n if (method === 'POST') {\n xhr.setRequestHeader('Content-Type', contentType)\n }\n xhr.responseType = 'arraybuffer'\n xhr.timeout = timeout\n xhr.ontimeout = ontimeout\n xhr.onreadystatechange = onreadystatechange\n xhr.onerror = onerror\n xhr.onload = onload\n if (method === 'POST') {\n xhr.send(data)\n } else {\n xhr.send()\n }\n\n if (abortSignal) {\n abortSignal.addEventListener('abort', onabort)\n }\n\n function ontimeout () {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.TimeoutError(timeout))\n try {\n xhr.abort()\n } catch (e) { }\n }\n\n function onload () {\n if (xhr.status !== 200) {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.HTTPStatusError(uri, xhr.status, method))\n } else {\n let buf\n if (typeof xhr.response === 'string') {\n buf = utf8_codec__WEBPACK_IMPORTED_MODULE_0__.encode(xhr.response)\n } else if (xhr.response instanceof Uint8Array) {\n buf = xhr.response\n } else if (Array.isArray(xhr.response) || xhr.response instanceof ArrayBuffer) {\n buf = new Uint8Array(xhr.response)\n } else {\n throw new Error('Unprocessable response ' + xhr.response)\n }\n finish(null, buf)\n }\n }\n\n function onreadystatechange () {\n if (xhr.readyState > 1 && xhr.status !== 200 && xhr.status !== 0) {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.HTTPStatusError(uri, xhr.status, method))\n try {\n xhr.abort()\n } catch (e) { }\n }\n }\n\n let finish = function (error, data) {\n finish = noop\n if (abortSignal) {\n abortSignal.removeEventListener('abort', onabort)\n }\n if (error) {\n resolve({\n error,\n response: xhr\n })\n } else {\n resolve({\n data,\n response: xhr\n })\n }\n }\n\n function onerror () {\n finish(xhr.status === 200 ? new Error('Inexplicable XHR Error') : new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.HTTPStatusError(uri, xhr.status, method))\n }\n\n function onabort () {\n finish(new _common_mjs__WEBPACK_IMPORTED_MODULE_2__.AbortError())\n try {\n xhr.abort()\n } catch (e) { }\n }\n })\n}\n\nfunction request (url, method, packet, timeout, abortSignal) {\n return requestRaw(url, method, packet, timeout, abortSignal)\n}\n\nfunction processResolvers (resolvers) {\n return resolvers.filter(resolver => resolver.cors || resolver.endpoint.cors)\n}\n\n\n//# sourceURL=webpack://light/./node_modules/dns-query/lib.browser.mjs?"); + +/***/ }), + +/***/ "./node_modules/dns-query/resolvers.mjs": +/*!**********************************************!*\ + !*** ./node_modules/dns-query/resolvers.mjs ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ resolvers: () => (/* binding */ resolvers)\n/* harmony export */ });\nconst resolvers = {\n data: [\n {\n name: 'adfree.usableprivacy.net',\n endpoint: {\n protocol: 'https:',\n host: 'adfree.usableprivacy.net'\n },\n description: 'Public updns DoH service with advertising, tracker and malware filters.\\nHosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n },\n filter: true\n },\n {\n name: 'adguard-dns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.adguard.com',\n ipv4: '94.140.15.15'\n },\n description: 'Remove ads and protect your computer from malware (over DoH)',\n country: 'France',\n location: {\n lat: 48.8582,\n long: 2.3387\n },\n filter: true\n },\n {\n name: 'adguard-dns-family-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns-family.adguard.com',\n ipv4: '94.140.15.16'\n },\n description: 'Adguard DNS with safesearch and adult content blocking (over DoH)',\n country: 'France',\n location: {\n lat: 48.8582,\n long: 2.3387\n },\n filter: true\n },\n {\n name: 'adguard-dns-unfiltered-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns-unfiltered.adguard.com',\n ipv4: '94.140.14.140'\n },\n description: 'AdGuard public DNS servers without filters (over DoH)',\n country: 'France',\n location: {\n lat: 48.8582,\n long: 2.3387\n }\n },\n {\n name: 'ahadns-doh-chi',\n endpoint: {\n protocol: 'https:',\n host: 'doh.chi.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=chi',\n country: 'United States',\n location: {\n lat: 41.8483,\n long: -87.6517\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-in',\n endpoint: {\n protocol: 'https:',\n host: 'doh.in.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=in',\n country: 'India',\n location: {\n lat: 19.0748,\n long: 72.8856\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-la',\n endpoint: {\n protocol: 'https:',\n host: 'doh.la.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=la',\n country: 'United States',\n location: {\n lat: 34.0549,\n long: -118.2578\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-nl',\n endpoint: {\n protocol: 'https:',\n host: 'doh.nl.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Amsterdam, Netherlands. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=nl',\n country: 'Netherlands',\n location: {\n lat: 52.3824,\n long: 4.8995\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-ny',\n endpoint: {\n protocol: 'https:',\n host: 'doh.ny.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in New York. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=ny',\n country: 'United States',\n location: {\n lat: 40.7308,\n long: -73.9975\n },\n filter: true,\n cors: true\n },\n {\n name: 'ahadns-doh-pl',\n endpoint: {\n protocol: 'https:',\n host: 'doh.pl.ahadns.net',\n cors: true\n },\n description: 'A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Poland. By https://ahadns.com/\\nServer statistics can be seen at: https://statistics.ahadns.com/?server=pl',\n country: 'Netherlands',\n location: {\n lat: 52.3824,\n long: 4.8995\n },\n filter: true,\n cors: true\n },\n {\n name: 'alidns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.alidns.com',\n ipv4: '223.5.5.5',\n cors: true\n },\n description: 'A public DNS resolver that supports DoH/DoT in mainland China, provided by Alibaba-Cloud.\\nWarning: GFW filtering rules are applied by that resolver.\\nHomepage: https://alidns.com/',\n country: 'China',\n location: {\n lat: 34.7725,\n long: 113.7266\n },\n filter: true,\n log: true,\n cors: true\n },\n {\n name: 'ams-ads-doh-nl',\n endpoint: {\n protocol: 'https:',\n host: 'dnsnl-noads.alekberg.net'\n },\n description: 'Resolver in Amsterdam. DoH protocol. Non-logging. Blocks ads, malware and trackers. DNSSEC enabled.',\n country: 'Romania',\n location: {\n lat: 45.9968,\n long: 24.997\n },\n filter: true\n },\n {\n name: 'ams-doh-nl',\n endpoint: {\n protocol: 'https:',\n host: 'dnsnl.alekberg.net'\n },\n description: 'Resolver in Amsterdam. DoH protocol. Non-logging, non-filtering, DNSSEC.',\n country: 'Romania',\n location: {\n lat: 45.9968,\n long: 24.997\n }\n },\n {\n name: 'att',\n endpoint: {\n protocol: 'https:',\n host: 'dohtrial.att.net'\n },\n description: 'AT&T test DoH server.',\n log: true\n },\n {\n name: 'bcn-ads-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dnses-noads.alekberg.net'\n },\n description: 'Resolver in Spain. DoH protocol. Non-logging, remove ads and malware, DNSSEC.',\n country: 'Spain',\n location: {\n lat: 41.3891,\n long: 2.1611\n },\n filter: true\n },\n {\n name: 'bcn-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dnses.alekberg.net'\n },\n description: 'Resolver in Spain. DoH protocol. Non-logging, non-filtering, DNSSEC.',\n country: 'Spain',\n location: {\n lat: 41.3891,\n long: 2.1611\n }\n },\n {\n name: 'brahma-world',\n endpoint: {\n protocol: 'https:',\n host: 'dns.brahma.world'\n },\n description: 'DNS-over-HTTPS server. Non Logging, filters ads, trackers and malware. DNSSEC ready, QNAME Minimization, No EDNS Client-Subnet.\\nHosted in Stockholm, Sweden. (https://dns.brahma.world)',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'cisco-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.opendns.com',\n ipv4: '146.112.41.2'\n },\n description: 'Remove your DNS blind spot (DoH protocol)\\nWarning: modifies your queries to include a copy of your network\\naddress when forwarding them to a selection of companies and organizations.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true,\n log: true\n },\n {\n name: 'cloudflare',\n endpoint: {\n protocol: 'https:',\n host: 'dns.cloudflare.com',\n ipv4: '1.0.0.1',\n cors: true\n },\n description: 'Cloudflare DNS (anycast) - aka 1.1.1.1 / 1.0.0.1',\n country: 'Australia',\n location: {\n lat: -33.494,\n long: 143.2104\n },\n cors: true\n },\n {\n name: 'cloudflare-family',\n endpoint: {\n protocol: 'https:',\n host: 'family.cloudflare-dns.com',\n ipv4: '1.0.0.3',\n cors: true\n },\n description: 'Cloudflare DNS (anycast) with malware protection and parental control - aka 1.1.1.3 / 1.0.0.3',\n country: 'Australia',\n location: {\n lat: -33.494,\n long: 143.2104\n },\n filter: true,\n cors: true\n },\n {\n name: 'cloudflare-ipv6',\n endpoint: {\n protocol: 'https:',\n host: '1dot1dot1dot1.cloudflare-dns.com',\n cors: true\n },\n description: 'Cloudflare DNS over IPv6 (anycast)',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'cloudflare-security',\n endpoint: {\n protocol: 'https:',\n host: 'security.cloudflare-dns.com',\n ipv4: '1.0.0.2',\n cors: true\n },\n description: 'Cloudflare DNS (anycast) with malware blocking - aka 1.1.1.2 / 1.0.0.2',\n country: 'Australia',\n location: {\n lat: -33.494,\n long: 143.2104\n },\n filter: true,\n cors: true\n },\n {\n name: 'controld-block-malware',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p1'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-block-malware-ad',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p2'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware, Ads & Tracking domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-block-malware-ad-social',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p3'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware, Ads & Tracking and Social Networks domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-family-friendly',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/family'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS blocks Malware, Ads & Tracking, Adult Content and Drugs domains.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n },\n filter: true\n },\n {\n name: 'controld-uncensored',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/uncensored'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis DNS unblocks censored domains from various countries.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n }\n },\n {\n name: 'controld-unfiltered',\n endpoint: {\n protocol: 'https:',\n host: 'freedns.controld.com',\n path: '/p0'\n },\n description: 'ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\\nThis is a Unfiltered DNS, no DNS record blocking or manipulation here, if you want to block Malware, Ads & Tracking or Social Network domains, use the other ControlD DNS configs.',\n country: 'Canada',\n location: {\n lat: 43.6319,\n long: -79.3716\n }\n },\n {\n name: 'dns.digitale-gesellschaft.ch',\n endpoint: {\n protocol: 'https:',\n host: 'dns.digitale-gesellschaft.ch'\n },\n description: 'Public DoH resolver operated by the Digital Society (https://www.digitale-gesellschaft.ch).\\nHosted in Zurich, Switzerland.\\nNon-logging, non-filtering, supports DNSSEC.',\n country: 'Switzerland',\n location: {\n lat: 47.1449,\n long: 8.1551\n }\n },\n {\n name: 'dns.ryan-palmer',\n endpoint: {\n protocol: 'https:',\n host: 'dns1.ryan-palmer.com'\n },\n description: 'Non-logging, non-filtering, DNSSEC DoH Server. Hosted in the UK.',\n country: 'United Kingdom',\n location: {\n lat: 51.5164,\n long: -0.093\n }\n },\n {\n name: 'dns.sb',\n endpoint: {\n protocol: 'https:',\n host: 'doh.sb',\n ipv4: '185.222.222.222',\n cors: true\n },\n description: 'DNSSEC-enabled DoH server by https://xtom.com/\\nhttps://dns.sb/doh/',\n country: 'Unknown',\n location: {\n lat: 47,\n long: 8\n },\n cors: true\n },\n {\n name: 'dns.therifleman.name',\n endpoint: {\n protocol: 'https:',\n host: 'dns.therifleman.name'\n },\n description: 'DNS-over-HTTPS DNS forwarder from Mumbai, India. Blocks web and Android trackers and ads.\\nIP addresses are not logged, but queries are logged for 24 hours for debugging.\\nReport issues, send suggestions @ joker349 at protonmail.com.\\nAlso supports DoT (for android) @ dns.therifleman.name and plain DNS @ 172.104.206.174',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'dnsforfamily-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns-doh.dnsforfamily.com'\n },\n description: '(DoH Protocol) (Now supports DNSSEC). Block adult websites, gambling websites, malwares and advertisements.\\nIt also enforces safe search in: Google, YouTube, Bing, DuckDuckGo and Yandex.\\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\\nProvided by: https://dnsforfamily.com',\n country: 'Finland',\n location: {\n lat: 60.1758,\n long: 24.9349\n },\n filter: true\n },\n {\n name: 'dnsforfamily-doh-no-safe-search',\n endpoint: {\n protocol: 'https:',\n host: 'dns-doh-no-safe-search.dnsforfamily.com'\n },\n description: '(DoH Protocol) (Now supports DNSSEC) Block adult websites, gambling websites, malwares and advertisements.\\nUnlike other dnsforfamily servers, this one does not enforces safe search. So Google, YouTube, Bing, DuckDuckGo and Yandex are completely accessible without any restriction.\\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\\nWarning: This server is incompatible with anonymization.\\nProvided by: https://dnsforfamily.com',\n country: 'Finland',\n location: {\n lat: 60.1758,\n long: 24.9349\n },\n filter: true\n },\n {\n name: 'dnsforge.de',\n endpoint: {\n protocol: 'https:',\n host: 'dnsforge.de',\n cors: true\n },\n description: 'Public DoH resolver running with Pihole for Adblocking (https://dnsforge.de).\\nNon-logging, AD-filtering, supports DNSSEC. Hosted in Germany.',\n country: 'Germany',\n location: {\n lat: 52.2998,\n long: 9.447\n },\n filter: true,\n cors: true\n },\n {\n name: 'dnshome-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.dnshome.de'\n },\n description: 'https://www.dnshome.de/ public resolver in Germany'\n },\n {\n name: 'dnspod-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.pub',\n cors: true\n },\n description: 'A public DNS resolver in mainland China provided by DNSPod (Tencent Cloud).\\nhttps://www.dnspod.cn/Products/Public.DNS?lang=en',\n filter: true,\n log: true,\n cors: true\n },\n {\n name: 'dnswarden-asia-adblock-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.asia.dnswarden.com',\n path: '/adblock'\n },\n description: 'Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n },\n filter: true\n },\n {\n name: 'dnswarden-asia-adultfilter-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.asia.dnswarden.com',\n path: '/adultfilter'\n },\n description: 'Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n },\n filter: true\n },\n {\n name: 'dnswarden-asia-uncensor-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.asia.dnswarden.com',\n path: '/uncensored'\n },\n description: 'Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n }\n },\n {\n name: 'dnswarden-eu-adblock-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.eu.dnswarden.com'\n },\n description: 'Hosted in Germany. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'Germany',\n location: {\n lat: 50.1103,\n long: 8.7147\n },\n filter: true\n },\n {\n name: 'dnswarden-us-adblock-dohv4',\n endpoint: {\n protocol: 'https:',\n host: 'doh.us.dnswarden.com'\n },\n description: 'Hosted in USA (Dallas) . For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).',\n country: 'United States',\n location: {\n lat: 32.7889,\n long: -96.8021\n },\n filter: true\n },\n {\n name: 'doh-ch-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-ch.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Switzerland. By https://blahdns.com/',\n country: 'Netherlands',\n location: {\n lat: 52.3824,\n long: 4.8995\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh-cleanbrowsing-adult',\n endpoint: {\n protocol: 'https:',\n host: 'doh.cleanbrowsing.org',\n path: '/doh/adult-filter/',\n cors: true\n },\n description: 'Blocks access to all adult, pornographic and explicit sites. It does\\nnot block proxy or VPNs, nor mixed-content sites. Sites like Reddit\\nare allowed. Google and Bing are set to the Safe Mode.\\nBy https://cleanbrowsing.org/',\n filter: true,\n cors: true\n },\n {\n name: 'doh-cleanbrowsing-family',\n endpoint: {\n protocol: 'https:',\n host: 'doh.cleanbrowsing.org',\n path: '/doh/family-filter/',\n cors: true\n },\n description: 'Blocks access to all adult, pornographic and explicit sites. It also\\nblocks proxy and VPN domains that are used to bypass the filters.\\nMixed content sites (like Reddit) are also blocked. Google, Bing and\\nYoutube are set to the Safe Mode.\\nBy https://cleanbrowsing.org/',\n filter: true,\n cors: true\n },\n {\n name: 'doh-cleanbrowsing-security',\n endpoint: {\n protocol: 'https:',\n host: 'doh.cleanbrowsing.org',\n path: '/doh/security-filter/',\n cors: true\n },\n description: 'Block access to phishing, malware and malicious domains. It does not block adult content.\\nBy https://cleanbrowsing.org/',\n filter: true,\n cors: true\n },\n {\n name: 'doh-crypto-sx',\n endpoint: {\n protocol: 'https:',\n host: 'doh.crypto.sx',\n cors: true\n },\n description: 'DNS-over-HTTPS server. Anycast, no logs, no censorship, DNSSEC.\\nBackend hosted by Scaleway, globally cached via Cloudflare.\\nMaintained by Frank Denis.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'doh-crypto-sx-ipv6',\n endpoint: {\n protocol: 'https:',\n host: 'doh-ipv6.crypto.sx',\n cors: true\n },\n description: 'DNS-over-HTTPS server accessible over IPv6. Anycast, no logs, no censorship, DNSSEC.\\nBackend hosted by Scaleway, globally cached via Cloudflare.\\nMaintained by Frank Denis.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'doh-de-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-de.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Germany. By https://blahdns.com/',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh-fi-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-fi.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Finland. By https://blahdns.com/',\n country: 'Finland',\n location: {\n lat: 60.1758,\n long: 24.9349\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh-ibksturm',\n endpoint: {\n protocol: 'https:',\n host: 'ibksturm.synology.me'\n },\n description: 'DoH & DoT Server, No Logging, No Filters, DNSSEC\\nRunning privately by ibksturm in Thurgau, Switzerland'\n },\n {\n name: 'doh-jp-blahdns',\n endpoint: {\n protocol: 'https:',\n host: 'doh-jp.blahdns.com',\n cors: true\n },\n description: 'Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Japan. By https://blahdns.com/',\n country: 'Japan',\n location: {\n lat: 35.6882,\n long: 139.7532\n },\n filter: true,\n cors: true\n },\n {\n name: 'doh.ffmuc.net',\n endpoint: {\n protocol: 'https:',\n host: 'doh.ffmuc.net'\n },\n description: 'An open (non-logging, non-filtering, non-censoring) DoH resolver operated by Freifunk Munich with nodes in DE.\\nhttps://ffmuc.net/',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n }\n },\n {\n name: 'doh.tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiarap.org'\n },\n description: 'Non-Logging DNS-over-HTTPS server, cached via Cloudflare.\\nFilters out ads, trackers and malware, NO ECS, supports DNSSEC.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'google',\n endpoint: {\n protocol: 'https:',\n host: 'dns.google',\n ipv4: '8.8.8.8',\n cors: true\n },\n description: 'Google DNS (anycast)',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n log: true,\n cors: true\n },\n {\n name: 'hdns',\n endpoint: {\n protocol: 'https:',\n host: 'query.hdns.io',\n cors: true\n },\n description: 'HDNS is a public DNS resolver that supports Handshake domains.\\nhttps://www.hdns.io',\n country: 'United States',\n location: {\n lat: 37.7771,\n long: -122.406\n },\n cors: true\n },\n {\n name: 'he',\n endpoint: {\n protocol: 'https:',\n host: 'ordns.he.net'\n },\n description: 'Hurricane Electric DoH server (anycast)\\nUnknown logging policy.',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n log: true\n },\n {\n name: 'id-gmail-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiar.app'\n },\n description: 'Non-Logging DNS-over-HTTPS server located in Singapore.\\nFilters out ads, trackers and malware, supports DNSSEC, provided by id-gmail.',\n country: 'Singapore',\n location: {\n lat: 1.2929,\n long: 103.8547\n },\n filter: true\n },\n {\n name: 'iij',\n endpoint: {\n protocol: 'https:',\n host: 'public.dns.iij.jp'\n },\n description: 'DoH server operated by Internet Initiative Japan in Tokyo.\\nhttps://www.iij.ad.jp/',\n country: 'Japan',\n location: {\n lat: 35.69,\n long: 139.69\n },\n log: true\n },\n {\n name: 'iqdns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'a.passcloud.xyz'\n },\n description: 'Non-logging DoH service runned by V2EX.com user johnsonwil.\\nReturns \"no such domain\" for anti-Chinese government websites. Supports DNSSEC.\\nFor more information: https://www.v2ex.com/t/785666',\n filter: true\n },\n {\n name: 'jp.tiar.app-doh',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiar.app'\n },\n description: 'Non-Logging, Non-Filtering DNS-over-HTTPS server in Japan.\\nNo ECS, Support DNSSEC',\n country: 'Japan',\n location: {\n lat: 35.6882,\n long: 139.7532\n }\n },\n {\n name: 'jp.tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiarap.org'\n },\n description: 'DNS-over-HTTPS Server. Non-Logging, Non-Filtering, No ECS, Support DNSSEC.\\nCached via Cloudflare.'\n },\n {\n name: 'libredns',\n endpoint: {\n protocol: 'https:',\n host: 'doh.libredns.gr'\n },\n description: 'DoH server in Germany. No logging, but no DNS padding and no DNSSEC support.\\nhttps://libredns.gr/',\n country: 'Germany',\n location: {\n lat: 51.2993,\n long: 9.491\n }\n },\n {\n name: 'nextdns',\n endpoint: {\n protocol: 'https:',\n host: 'anycsast.dns.nextdns.io'\n },\n description: 'NextDNS is a cloud-based private DNS service that gives you full control\\nover what is allowed and what is blocked on the Internet.\\nDNSSEC, Anycast, Non-logging, NoFilters\\nhttps://www.nextdns.io/',\n country: 'Netherlands',\n location: {\n lat: 52.3891,\n long: 4.6563\n }\n },\n {\n name: 'nextdns-ultralow',\n endpoint: {\n protocol: 'https:',\n host: 'dns.nextdns.io',\n path: '/dnscrypt-proxy'\n },\n description: 'NextDNS is a cloud-based private DNS service that gives you full control\\nover what is allowed and what is blocked on the Internet.\\nhttps://www.nextdns.io/\\nTo select the server location, the \"-ultralow\" variant relies on bootstrap servers\\ninstead of anycast.'\n },\n {\n name: 'njalla-doh',\n endpoint: {\n protocol: 'https:',\n host: 'dns.njal.la',\n cors: true\n },\n description: 'Non-logging DoH server in Sweden operated by Njalla.\\nhttps://dns.njal.la/',\n country: 'Sweden',\n location: {\n lat: 59.3247,\n long: 18.056\n },\n cors: true\n },\n {\n name: 'odoh-cloudflare',\n endpoint: {\n protocol: 'https:',\n host: 'odoh.cloudflare-dns.com',\n cors: true\n },\n description: 'Cloudflare ODoH server.\\nhttps://cloudflare.com',\n cors: true\n },\n {\n name: 'odoh-crypto-sx',\n endpoint: {\n protocol: 'https:',\n host: 'odoh.crypto.sx',\n cors: true\n },\n description: 'ODoH target server. Anycast, no logs.\\nBackend hosted by Scaleway. Maintained by Frank Denis.',\n cors: true\n },\n {\n name: 'odoh-id-gmail',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiar.app',\n path: '/odoh'\n },\n description: 'ODoH target server. Based in Singapore, no logs.\\nFilter ads, trackers and malware.',\n filter: true\n },\n {\n name: 'odoh-jp.tiar.app',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiar.app',\n path: '/odoh'\n },\n description: 'ODoH target server. no logs.'\n },\n {\n name: 'odoh-jp.tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'jp.tiarap.org',\n path: '/odoh'\n },\n description: 'ODoH target server via Cloudflare, no logs.'\n },\n {\n name: 'odoh-resolver4.dns.openinternet.io',\n endpoint: {\n protocol: 'https:',\n host: 'resolver4.dns.openinternet.io'\n },\n description: \"ODoH target server. no logs, no filter, DNSSEC.\\nRunning on dedicated hardware colocated at Sonic.net in Santa Rosa, CA in the United States.\\nUses Sonic's recusrive DNS servers as upstream resolvers (but is not affiliated with Sonic\\nin any way). Provided by https://openinternet.io\"\n },\n {\n name: 'odoh-tiarap.org',\n endpoint: {\n protocol: 'https:',\n host: 'doh.tiarap.org',\n path: '/odoh'\n },\n description: 'ODoH target server via Cloudflare, no logs.\\nFilter ads, trackers and malware.',\n filter: true\n },\n {\n name: 'publicarray-au2-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh-2.seby.io',\n cors: true\n },\n description: 'DNSSEC • OpenNIC • Non-logging • Uncensored - hosted on ovh.com.au\\nMaintained by publicarray - https://dns.seby.io',\n country: 'Australia',\n location: {\n lat: -33.8591,\n long: 151.2002\n },\n cors: true\n },\n {\n name: 'puredns-doh',\n endpoint: {\n protocol: 'https:',\n host: 'puredns.org',\n ipv4: '146.190.6.13',\n cors: true\n },\n description: 'Public uncensored DNS resolver in Singapore - https://puredns.org\\n** Only available in Indonesia and Singapore **',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n cors: true\n },\n {\n name: 'quad101',\n endpoint: {\n protocol: 'https:',\n host: 'dns.twnic.tw',\n cors: true\n },\n description: 'DNSSEC-aware public resolver by the Taiwan Network Information Center (TWNIC)\\nhttps://101.101.101.101/index_en.html',\n cors: true\n },\n {\n name: 'quad9-doh-ip4-port443-filter-ecs-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns11.quad9.net',\n ipv4: '149.112.112.11'\n },\n description: 'Quad9 (anycast) dnssec/no-log/filter/ecs 9.9.9.11 - 149.112.112.11',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'quad9-doh-ip4-port443-filter-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns.quad9.net',\n ipv4: '149.112.112.112'\n },\n description: 'Quad9 (anycast) dnssec/no-log/filter 9.9.9.9 - 149.112.112.9 - 149.112.112.112',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'quad9-doh-ip4-port443-nofilter-ecs-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns12.quad9.net',\n ipv4: '9.9.9.12'\n },\n description: 'Quad9 (anycast) no-dnssec/no-log/no-filter/ecs 9.9.9.12 - 149.112.112.12',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n }\n },\n {\n name: 'quad9-doh-ip4-port443-nofilter-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns10.quad9.net',\n ipv4: '149.112.112.10'\n },\n description: 'Quad9 (anycast) no-dnssec/no-log/no-filter 9.9.9.10 - 149.112.112.10',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n }\n },\n {\n name: 'quad9-doh-ip6-port5053-filter-pri',\n endpoint: {\n protocol: 'https:',\n host: 'dns9.quad9.net'\n },\n description: 'Quad9 (anycast) dnssec/no-log/filter 2620:fe::fe - 2620:fe::9 - 2620:fe::fe:9',\n country: 'United States',\n location: {\n lat: 37.751,\n long: -97.822\n },\n filter: true\n },\n {\n name: 'safesurfer-doh',\n endpoint: {\n protocol: 'https:',\n host: 'doh.safesurfer.io'\n },\n description: 'Family safety focused blocklist for over 2 million adult sites, as well as phishing and malware and more.\\nFree to use, paid for customizing blocking for more categories+sites and viewing usage at my.safesurfer.io. Logs taken for viewing\\nusage, data never sold - https://safesurfer.io',\n filter: true,\n log: true\n },\n {\n name: 'sth-ads-doh-se',\n endpoint: {\n protocol: 'https:',\n host: 'dnsse-noads.alekberg.net'\n },\n description: 'Resolver in Stockholm, Sweden. DoH server. Non-logging, remove ads and malware, DNSSEC.',\n country: 'Bulgaria',\n location: {\n lat: 42.696,\n long: 23.332\n },\n filter: true\n },\n {\n name: 'sth-doh-se',\n endpoint: {\n protocol: 'https:',\n host: 'dnsse.alekberg.net'\n },\n description: 'Resolver in Stockholm, Sweden. DoH server. Non-logging, non-filtering, DNSSEC.',\n country: 'Bulgaria',\n location: {\n lat: 42.696,\n long: 23.332\n }\n },\n {\n name: 'switch',\n endpoint: {\n protocol: 'https:',\n host: 'dns.switch.ch'\n },\n description: 'Public DoH service provided by SWITCH in Switzerland\\nhttps://www.switch.ch\\nProvides protection against malware, but does not block ads.',\n filter: true\n },\n {\n name: 'uncensoreddns-dk-ipv4',\n endpoint: {\n protocol: 'https:',\n host: 'unicast.uncensoreddns.org'\n },\n description: 'Also known as censurfridns.\\nDoH, no logs, no filter, DNSSEC, unicast hosted in Denmark - https://blog.uncensoreddns.org',\n country: 'Denmark',\n location: {\n lat: 55.7123,\n long: 12.0564\n }\n },\n {\n name: 'uncensoreddns-ipv4',\n endpoint: {\n protocol: 'https:',\n host: 'anycast.uncensoreddns.org'\n },\n description: 'Also known as censurfridns.\\nDoH, no logs, no filter, DNSSEC, anycast - https://blog.uncensoreddns.org',\n country: 'Denmark',\n location: {\n lat: 55.7123,\n long: 12.0564\n }\n },\n {\n name: 'v.dnscrypt.uk-doh-ipv4',\n endpoint: {\n protocol: 'https:',\n host: 'v.dnscrypt.uk'\n },\n description: 'DoH, no logs, uncensored, DNSSEC. Hosted in London UK on Digital Ocean\\nhttps://www.dnscrypt.uk',\n country: 'United Kingdom',\n location: {\n lat: 51.4964,\n long: -0.1224\n }\n }\n ],\n time: 1654187067783\n}\n\n\n//# sourceURL=webpack://light/./node_modules/dns-query/resolvers.mjs?"); + +/***/ }), + +/***/ "./node_modules/get-iterator/dist/src/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/get-iterator/dist/src/index.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getIterator: () => (/* binding */ getIterator)\n/* harmony export */ });\nfunction getIterator(obj) {\n if (obj != null) {\n if (typeof obj[Symbol.iterator] === 'function') {\n return obj[Symbol.iterator]();\n }\n if (typeof obj[Symbol.asyncIterator] === 'function') {\n return obj[Symbol.asyncIterator]();\n }\n if (typeof obj.next === 'function') {\n return obj; // probably an iterator\n }\n }\n throw new Error('argument is not an iterator or iterable');\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/get-iterator/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/interface-datastore/dist/src/key.js": +/*!**********************************************************!*\ + !*** ./node_modules/interface-datastore/dist/src/key.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Key: () => (/* binding */ Key)\n/* harmony export */ });\n/* harmony import */ var nanoid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! nanoid */ \"./node_modules/nanoid/index.browser.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n\n\n\nconst pathSepS = '/';\nconst pathSepB = new TextEncoder().encode(pathSepS);\nconst pathSep = pathSepB[0];\n/**\n * A Key represents the unique identifier of an object.\n * Our Key scheme is inspired by file systems and Google App Engine key model.\n * Keys are meant to be unique across a system. Keys are hierarchical,\n * incorporating more and more specific namespaces. Thus keys can be deemed\n * 'children' or 'ancestors' of other keys:\n * - `new Key('/Comedy')`\n * - `new Key('/Comedy/MontyPython')`\n * Also, every namespace can be parametrized to embed relevant object\n * information. For example, the Key `name` (most specific namespace) could\n * include the object type:\n * - `new Key('/Comedy/MontyPython/Actor:JohnCleese')`\n * - `new Key('/Comedy/MontyPython/Sketch:CheeseShop')`\n * - `new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')`\n *\n */\nclass Key {\n _buf;\n /**\n * @param {string | Uint8Array} s\n * @param {boolean} [clean]\n */\n constructor(s, clean) {\n if (typeof s === 'string') {\n this._buf = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_0__.fromString)(s);\n }\n else if (s instanceof Uint8Array) {\n this._buf = s;\n }\n else {\n throw new Error('Invalid key, should be String of Uint8Array');\n }\n if (clean == null) {\n clean = true;\n }\n if (clean) {\n this.clean();\n }\n if (this._buf.byteLength === 0 || this._buf[0] !== pathSep) {\n throw new Error('Invalid key');\n }\n }\n /**\n * Convert to the string representation\n *\n * @param {import('uint8arrays/to-string').SupportedEncodings} [encoding='utf8'] - The encoding to use.\n * @returns {string}\n */\n toString(encoding = 'utf8') {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(this._buf, encoding);\n }\n /**\n * Return the Uint8Array representation of the key\n *\n * @returns {Uint8Array}\n */\n uint8Array() {\n return this._buf;\n }\n /**\n * Return string representation of the key\n *\n * @returns {string}\n */\n get [Symbol.toStringTag]() {\n return `Key(${this.toString()})`;\n }\n /**\n * Constructs a key out of a namespace array.\n *\n * @param {Array} list - The array of namespaces\n * @returns {Key}\n *\n * @example\n * ```js\n * Key.withNamespaces(['one', 'two'])\n * // => Key('/one/two')\n * ```\n */\n static withNamespaces(list) {\n return new Key(list.join(pathSepS));\n }\n /**\n * Returns a randomly (uuid) generated key.\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * Key.random()\n * // => Key('/f98719ea086343f7b71f32ea9d9d521d')\n * ```\n */\n static random() {\n return new Key((0,nanoid__WEBPACK_IMPORTED_MODULE_2__.nanoid)().replace(/-/g, ''));\n }\n /**\n * @param {*} other\n */\n static asKey(other) {\n if (other instanceof Uint8Array || typeof other === 'string') {\n // we can create a key from this\n return new Key(other);\n }\n if (typeof other.uint8Array === 'function') {\n // this is an older version or may have crossed the esm/cjs boundary\n return new Key(other.uint8Array());\n }\n return null;\n }\n /**\n * Cleanup the current key\n *\n * @returns {void}\n */\n clean() {\n if (this._buf == null || this._buf.byteLength === 0) {\n this._buf = pathSepB;\n }\n if (this._buf[0] !== pathSep) {\n const bytes = new Uint8Array(this._buf.byteLength + 1);\n bytes.fill(pathSep, 0, 1);\n bytes.set(this._buf, 1);\n this._buf = bytes;\n }\n // normalize does not remove trailing slashes\n while (this._buf.byteLength > 1 && this._buf[this._buf.byteLength - 1] === pathSep) {\n this._buf = this._buf.subarray(0, -1);\n }\n }\n /**\n * Check if the given key is sorted lower than ourself.\n *\n * @param {Key} key - The other Key to check against\n * @returns {boolean}\n */\n less(key) {\n const list1 = this.list();\n const list2 = key.list();\n for (let i = 0; i < list1.length; i++) {\n if (list2.length < i + 1) {\n return false;\n }\n const c1 = list1[i];\n const c2 = list2[i];\n if (c1 < c2) {\n return true;\n }\n else if (c1 > c2) {\n return false;\n }\n }\n return list1.length < list2.length;\n }\n /**\n * Returns the key with all parts in reversed order.\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').reverse()\n * // => Key('/Actor:JohnCleese/MontyPython/Comedy')\n * ```\n */\n reverse() {\n return Key.withNamespaces(this.list().slice().reverse());\n }\n /**\n * Returns the `namespaces` making up this Key.\n *\n * @returns {Array}\n */\n namespaces() {\n return this.list();\n }\n /** Returns the \"base\" namespace of this key.\n *\n * @returns {string}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').baseNamespace()\n * // => 'Actor:JohnCleese'\n * ```\n */\n baseNamespace() {\n const ns = this.namespaces();\n return ns[ns.length - 1];\n }\n /**\n * Returns the `list` representation of this key.\n *\n * @returns {Array}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').list()\n * // => ['Comedy', 'MontyPythong', 'Actor:JohnCleese']\n * ```\n */\n list() {\n return this.toString().split(pathSepS).slice(1);\n }\n /**\n * Returns the \"type\" of this key (value of last namespace).\n *\n * @returns {string}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').type()\n * // => 'Actor'\n * ```\n */\n type() {\n return namespaceType(this.baseNamespace());\n }\n /**\n * Returns the \"name\" of this key (field of last namespace).\n *\n * @returns {string}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').name()\n * // => 'JohnCleese'\n * ```\n */\n name() {\n return namespaceValue(this.baseNamespace());\n }\n /**\n * Returns an \"instance\" of this type key (appends value to namespace).\n *\n * @param {string} s - The string to append.\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor').instance('JohnClesse')\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n * ```\n */\n instance(s) {\n return new Key(this.toString() + ':' + s);\n }\n /**\n * Returns the \"path\" of this key (parent + type).\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').path()\n * // => Key('/Comedy/MontyPython/Actor')\n * ```\n */\n path() {\n let p = this.parent().toString();\n if (!p.endsWith(pathSepS)) {\n p += pathSepS;\n }\n p += this.type();\n return new Key(p);\n }\n /**\n * Returns the `parent` Key of this Key.\n *\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key(\"/Comedy/MontyPython/Actor:JohnCleese\").parent()\n * // => Key(\"/Comedy/MontyPython\")\n * ```\n */\n parent() {\n const list = this.list();\n if (list.length === 1) {\n return new Key(pathSepS);\n }\n return new Key(list.slice(0, -1).join(pathSepS));\n }\n /**\n * Returns the `child` Key of this Key.\n *\n * @param {Key} key - The child Key to add\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython').child(new Key('Actor:JohnCleese'))\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n * ```\n */\n child(key) {\n if (this.toString() === pathSepS) {\n return key;\n }\n else if (key.toString() === pathSepS) {\n return this;\n }\n return new Key(this.toString() + key.toString(), false);\n }\n /**\n * Returns whether this key is a prefix of `other`\n *\n * @param {Key} other - The other key to test against\n * @returns {boolean}\n *\n * @example\n * ```js\n * new Key('/Comedy').isAncestorOf('/Comedy/MontyPython')\n * // => true\n * ```\n */\n isAncestorOf(other) {\n if (other.toString() === this.toString()) {\n return false;\n }\n return other.toString().startsWith(this.toString());\n }\n /**\n * Returns whether this key is a contains another as prefix.\n *\n * @param {Key} other - The other Key to test against\n * @returns {boolean}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython').isDecendantOf('/Comedy')\n * // => true\n * ```\n */\n isDecendantOf(other) {\n if (other.toString() === this.toString()) {\n return false;\n }\n return this.toString().startsWith(other.toString());\n }\n /**\n * Checks if this key has only one namespace.\n *\n * @returns {boolean}\n */\n isTopLevel() {\n return this.list().length === 1;\n }\n /**\n * Concats one or more Keys into one new Key.\n *\n * @param {Array} keys - The array of keys to concatenate\n * @returns {Key}\n */\n concat(...keys) {\n return Key.withNamespaces([...this.namespaces(), ...flatten(keys.map(key => key.namespaces()))]);\n }\n}\n/**\n * The first component of a namespace. `foo` in `foo:bar`\n *\n * @param {string} ns\n * @returns {string}\n */\nfunction namespaceType(ns) {\n const parts = ns.split(':');\n if (parts.length < 2) {\n return '';\n }\n return parts.slice(0, -1).join(':');\n}\n/**\n * The last component of a namespace, `baz` in `foo:bar:baz`.\n *\n * @param {string} ns\n * @returns {string}\n */\nfunction namespaceValue(ns) {\n const parts = ns.split(':');\n return parts[parts.length - 1];\n}\n/**\n * Flatten array of arrays (only one level)\n *\n * @template T\n * @param {Array} arr\n * @returns {T[]}\n */\nfunction flatten(arr) {\n return ([]).concat(...arr);\n}\n//# sourceMappingURL=key.js.map\n\n//# sourceURL=webpack://light/./node_modules/interface-datastore/dist/src/key.js?"); + +/***/ }), + +/***/ "./node_modules/ip-regex/index.js": +/*!****************************************!*\ + !*** ./node_modules/ip-regex/index.js ***! + \****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst word = '[a-fA-F\\\\d:]';\n\nconst boundry = options => options && options.includeBoundaries\n\t? `(?:(?<=\\\\s|^)(?=${word})|(?<=${word})(?=\\\\s|$))`\n\t: '';\n\nconst v4 = '(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}';\n\nconst v6segment = '[a-fA-F\\\\d]{1,4}';\n\nconst v6 = `\n(?:\n(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\\s*\\/\\/.*$/gm, '').replace(/\\n/g, '').trim();\n\n// Pre-compile only the exact regexes because adding a global flag make regexes stateful\nconst v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);\nconst v4exact = new RegExp(`^${v4}$`);\nconst v6exact = new RegExp(`^${v6}$`);\n\nconst ipRegex = options => options && options.exact\n\t? v46Exact\n\t: new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g');\n\nipRegex.v4 = options => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g');\nipRegex.v6 = options => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g');\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ipRegex);\n\n\n//# sourceURL=webpack://light/./node_modules/ip-regex/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-all/dist/src/index.js": +/*!***********************************************!*\ + !*** ./node_modules/it-all/dist/src/index.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction all(source) {\n if (isAsyncIterable(source)) {\n return (async () => {\n const arr = [];\n for await (const entry of source) {\n arr.push(entry);\n }\n return arr;\n })();\n }\n const arr = [];\n for (const entry of source) {\n arr.push(entry);\n }\n return arr;\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (all);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-all/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-batched-bytes/dist/src/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/it-batched-bytes/dist/src/index.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nconst DEFAULT_BATCH_SIZE = 1024 * 1024;\nconst DEFAULT_SERIALIZE = (buf, list) => { list.append(buf); };\nfunction batchedBytes(source, options) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n let buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList();\n let ended = false;\n let deferred = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n let size = Number(options?.size ?? DEFAULT_BATCH_SIZE);\n if (isNaN(size) || size === 0 || size < 0) {\n size = DEFAULT_BATCH_SIZE;\n }\n if (size !== Math.round(size)) {\n throw new Error('Batch size must be an integer');\n }\n const yieldAfter = options?.yieldAfter ?? 0;\n const serialize = options?.serialize ?? DEFAULT_SERIALIZE;\n void Promise.resolve().then(async () => {\n try {\n let timeout;\n for await (const buf of source) {\n // @ts-expect-error - if buf is not `Uint8Array | Uint8ArrayList` we cannot use the default serializer\n serialize(buf, buffer);\n if (buffer.byteLength >= size) {\n clearTimeout(timeout);\n deferred.resolve();\n continue;\n }\n timeout = setTimeout(() => {\n deferred.resolve();\n }, yieldAfter);\n }\n clearTimeout(timeout);\n deferred.resolve();\n }\n catch (err) {\n deferred.reject(err);\n }\n finally {\n ended = true;\n }\n });\n while (!ended) { // eslint-disable-line no-unmodified-loop-condition\n await deferred.promise;\n deferred = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n if (buffer.byteLength > 0) {\n const b = buffer;\n buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList();\n yield b.subarray();\n }\n }\n })();\n }\n return (function* () {\n const buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayList();\n let size = Number(options?.size ?? DEFAULT_BATCH_SIZE);\n if (isNaN(size) || size === 0 || size < 0) {\n size = DEFAULT_BATCH_SIZE;\n }\n if (size !== Math.round(size)) {\n throw new Error('Batch size must be an integer');\n }\n const serialize = options?.serialize ?? DEFAULT_SERIALIZE;\n for (const buf of source) {\n // @ts-expect-error - if buf is not `Uint8Array | Uint8ArrayList` we cannot use the default serializer\n serialize(buf, buffer);\n if (buffer.byteLength >= size) {\n yield buffer.subarray(0, size);\n buffer.consume(size);\n }\n }\n if (buffer.byteLength > 0) {\n yield buffer.subarray();\n }\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (batchedBytes);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-batched-bytes/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-drain/dist/src/index.js": +/*!*************************************************!*\ + !*** ./node_modules/it-drain/dist/src/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction drain(source) {\n if (isAsyncIterable(source)) {\n return (async () => {\n for await (const _ of source) { } // eslint-disable-line no-unused-vars,no-empty,@typescript-eslint/no-unused-vars\n })();\n }\n else {\n for (const _ of source) { } // eslint-disable-line no-unused-vars,no-empty,@typescript-eslint/no-unused-vars\n }\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drain);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-drain/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-filter/dist/src/index.js": +/*!**************************************************!*\ + !*** ./node_modules/it-filter/dist/src/index.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_peekable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-peekable */ \"./node_modules/it-peekable/dist/src/index.js\");\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction filter(source, fn) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n for await (const entry of source) {\n if (await fn(entry)) {\n yield entry;\n }\n }\n })();\n }\n // if mapping function returns a promise we have to return an async generator\n const peekable = (0,it_peekable__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n const { value, done } = peekable.next();\n if (done === true) {\n return (function* () { }());\n }\n const res = fn(value);\n // @ts-expect-error .then is not present on O\n if (typeof res.then === 'function') {\n return (async function* () {\n if (await res) {\n yield value;\n }\n for await (const entry of peekable) {\n if (await fn(entry)) {\n yield entry;\n }\n }\n })();\n }\n const func = fn;\n return (function* () {\n if (res === true) {\n yield value;\n }\n for (const entry of peekable) {\n if (func(entry)) {\n yield entry;\n }\n }\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (filter);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-filter/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-first/dist/src/index.js": +/*!*************************************************!*\ + !*** ./node_modules/it-first/dist/src/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction first(source) {\n if (isAsyncIterable(source)) {\n return (async () => {\n for await (const entry of source) { // eslint-disable-line no-unreachable-loop\n return entry;\n }\n return undefined;\n })();\n }\n for (const entry of source) { // eslint-disable-line no-unreachable-loop\n return entry;\n }\n return undefined;\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (first);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-first/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-handshake/dist/src/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/it-handshake/dist/src/index.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ handshake: () => (/* binding */ handshake)\n/* harmony export */ });\n/* harmony import */ var it_reader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-reader */ \"./node_modules/it-reader/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/**\n * @packageDocumentation\n *\n * @example\n *\n * ```js\n *\n * import { pipe } from 'it-pipe'\n * import { duplexPair } from 'it-pair/duplex'\n * import { handshake } from 'it-handshake'\n *\n * // Create connected duplex streams\n * const [client, server] = duplexPair()\n * const clientShake = handshake(client)\n * const serverShake = handshake(server)\n *\n * clientShake.write('hello')\n * console.log('client: %s', await serverShake.read())\n * // > client: hello\n * serverShake.write('hi')\n * serverShake.rest() // the server has finished the handshake\n * console.log('server: %s', await clientShake.read())\n * // > server: hi\n * clientShake.rest() // the client has finished the handshake\n *\n * // Make the server echo responses\n * pipe(\n * serverShake.stream,\n * async function * (source) {\n * for await (const message of source) {\n * yield message\n * }\n * },\n * serverShake.stream\n * )\n *\n * // Send and receive an echo through the handshake stream\n * pipe(\n * ['echo'],\n * clientShake.stream,\n * async function * (source) {\n * for await (const bufferList of source) {\n * console.log('Echo response: %s', bufferList.slice())\n * // > Echo response: echo\n * }\n * }\n * )\n * ```\n */\n\n\n\n// Convert a duplex stream into a reader and writer and rest stream\nfunction handshake(stream) {\n const writer = (0,it_pushable__WEBPACK_IMPORTED_MODULE_1__.pushable)(); // Write bytes on demand to the sink\n const source = (0,it_reader__WEBPACK_IMPORTED_MODULE_0__.reader)(stream.source); // Read bytes on demand from the source\n // Waits for a source to be passed to the rest stream's sink\n const sourcePromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\n let sinkErr;\n const sinkPromise = stream.sink((async function* () {\n yield* writer;\n const source = await sourcePromise.promise;\n yield* source;\n })());\n sinkPromise.catch(err => {\n sinkErr = err;\n });\n const rest = {\n sink: async (source) => {\n if (sinkErr != null) {\n await Promise.reject(sinkErr);\n return;\n }\n sourcePromise.resolve(source);\n await sinkPromise;\n },\n source\n };\n return {\n reader: source,\n writer,\n stream: rest,\n rest: () => writer.end(),\n write: writer.push,\n read: async () => {\n const res = await source.next();\n if (res.value != null) {\n return res.value;\n }\n }\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-handshake/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-length-prefixed/dist/src/decode.js": +/*!************************************************************!*\ + !*** ./node_modules/it-length-prefixed/dist/src/decode.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_DATA_LENGTH: () => (/* binding */ MAX_DATA_LENGTH),\n/* harmony export */ MAX_LENGTH_LENGTH: () => (/* binding */ MAX_LENGTH_LENGTH),\n/* harmony export */ decode: () => (/* binding */ decode)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var err_code__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! err-code */ \"./node_modules/err-code/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/it-length-prefixed/dist/src/utils.js\");\n/* eslint max-depth: [\"error\", 6] */\n\n\n\n\n// Maximum length of the length section of the message\nconst MAX_LENGTH_LENGTH = 8; // Varint.encode(Number.MAX_SAFE_INTEGER).length\n// Maximum length of the data section of the message\nconst MAX_DATA_LENGTH = 1024 * 1024 * 4;\nvar ReadMode;\n(function (ReadMode) {\n ReadMode[ReadMode[\"LENGTH\"] = 0] = \"LENGTH\";\n ReadMode[ReadMode[\"DATA\"] = 1] = \"DATA\";\n})(ReadMode || (ReadMode = {}));\nconst defaultDecoder = (buf) => {\n const length = uint8_varint__WEBPACK_IMPORTED_MODULE_1__.unsigned.decode(buf);\n defaultDecoder.bytes = uint8_varint__WEBPACK_IMPORTED_MODULE_1__.unsigned.encodingLength(length);\n return length;\n};\ndefaultDecoder.bytes = 0;\nfunction decode(source, options) {\n const buffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n let mode = ReadMode.LENGTH;\n let dataLength = -1;\n const lengthDecoder = options?.lengthDecoder ?? defaultDecoder;\n const maxLengthLength = options?.maxLengthLength ?? MAX_LENGTH_LENGTH;\n const maxDataLength = options?.maxDataLength ?? MAX_DATA_LENGTH;\n function* maybeYield() {\n while (buffer.byteLength > 0) {\n if (mode === ReadMode.LENGTH) {\n // read length, ignore errors for short reads\n try {\n dataLength = lengthDecoder(buffer);\n if (dataLength < 0) {\n throw err_code__WEBPACK_IMPORTED_MODULE_2__(new Error('invalid message length'), 'ERR_INVALID_MSG_LENGTH');\n }\n if (dataLength > maxDataLength) {\n throw err_code__WEBPACK_IMPORTED_MODULE_2__(new Error('message length too long'), 'ERR_MSG_DATA_TOO_LONG');\n }\n const dataLengthLength = lengthDecoder.bytes;\n buffer.consume(dataLengthLength);\n if (options?.onLength != null) {\n options.onLength(dataLength);\n }\n mode = ReadMode.DATA;\n }\n catch (err) {\n if (err instanceof RangeError) {\n if (buffer.byteLength > maxLengthLength) {\n throw err_code__WEBPACK_IMPORTED_MODULE_2__(new Error('message length length too long'), 'ERR_MSG_LENGTH_TOO_LONG');\n }\n break;\n }\n throw err;\n }\n }\n if (mode === ReadMode.DATA) {\n if (buffer.byteLength < dataLength) {\n // not enough data, wait for more\n break;\n }\n const data = buffer.sublist(0, dataLength);\n buffer.consume(dataLength);\n if (options?.onData != null) {\n options.onData(data);\n }\n yield data;\n mode = ReadMode.LENGTH;\n }\n }\n }\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isAsyncIterable)(source)) {\n return (async function* () {\n for await (const buf of source) {\n buffer.append(buf);\n yield* maybeYield();\n }\n if (buffer.byteLength > 0) {\n throw err_code__WEBPACK_IMPORTED_MODULE_2__(new Error('unexpected end of input'), 'ERR_UNEXPECTED_EOF');\n }\n })();\n }\n return (function* () {\n for (const buf of source) {\n buffer.append(buf);\n yield* maybeYield();\n }\n if (buffer.byteLength > 0) {\n throw err_code__WEBPACK_IMPORTED_MODULE_2__(new Error('unexpected end of input'), 'ERR_UNEXPECTED_EOF');\n }\n })();\n}\ndecode.fromReader = (reader, options) => {\n let byteLength = 1; // Read single byte chunks until the length is known\n const varByteSource = (async function* () {\n while (true) {\n try {\n const { done, value } = await reader.next(byteLength);\n if (done === true) {\n return;\n }\n if (value != null) {\n yield value;\n }\n }\n catch (err) {\n if (err.code === 'ERR_UNDER_READ') {\n return { done: true, value: null };\n }\n throw err;\n }\n finally {\n // Reset the byteLength so we continue to check for varints\n byteLength = 1;\n }\n }\n }());\n /**\n * Once the length has been parsed, read chunk for that length\n */\n const onLength = (l) => { byteLength = l; };\n return decode(varByteSource, {\n ...(options ?? {}),\n onLength\n });\n};\n//# sourceMappingURL=decode.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-length-prefixed/dist/src/decode.js?"); + +/***/ }), + +/***/ "./node_modules/it-length-prefixed/dist/src/encode.js": +/*!************************************************************!*\ + !*** ./node_modules/it-length-prefixed/dist/src/encode.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/it-length-prefixed/dist/src/utils.js\");\n\n\n\n\nconst defaultEncoder = (length) => {\n const lengthLength = uint8_varint__WEBPACK_IMPORTED_MODULE_1__.unsigned.encodingLength(length);\n const lengthBuf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.allocUnsafe)(lengthLength);\n uint8_varint__WEBPACK_IMPORTED_MODULE_1__.unsigned.encode(length, lengthBuf);\n defaultEncoder.bytes = lengthLength;\n return lengthBuf;\n};\ndefaultEncoder.bytes = 0;\nfunction encode(source, options) {\n options = options ?? {};\n const encodeLength = options.lengthEncoder ?? defaultEncoder;\n function* maybeYield(chunk) {\n // length + data\n const length = encodeLength(chunk.byteLength);\n // yield only Uint8Arrays\n if (length instanceof Uint8Array) {\n yield length;\n }\n else {\n yield* length;\n }\n // yield only Uint8Arrays\n if (chunk instanceof Uint8Array) {\n yield chunk;\n }\n else {\n yield* chunk;\n }\n }\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isAsyncIterable)(source)) {\n return (async function* () {\n for await (const chunk of source) {\n yield* maybeYield(chunk);\n }\n })();\n }\n return (function* () {\n for (const chunk of source) {\n yield* maybeYield(chunk);\n }\n })();\n}\nencode.single = (chunk, options) => {\n options = options ?? {};\n const encodeLength = options.lengthEncoder ?? defaultEncoder;\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList(encodeLength(chunk.byteLength), chunk);\n};\n//# sourceMappingURL=encode.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-length-prefixed/dist/src/encode.js?"); + +/***/ }), + +/***/ "./node_modules/it-length-prefixed/dist/src/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/it-length-prefixed/dist/src/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* reexport safe */ _decode_js__WEBPACK_IMPORTED_MODULE_1__.decode),\n/* harmony export */ encode: () => (/* reexport safe */ _encode_js__WEBPACK_IMPORTED_MODULE_0__.encode)\n/* harmony export */ });\n/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encode.js */ \"./node_modules/it-length-prefixed/dist/src/encode.js\");\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/it-length-prefixed/dist/src/decode.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-length-prefixed/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-length-prefixed/dist/src/utils.js": +/*!***********************************************************!*\ + !*** ./node_modules/it-length-prefixed/dist/src/utils.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isAsyncIterable: () => (/* binding */ isAsyncIterable)\n/* harmony export */ });\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-length-prefixed/dist/src/utils.js?"); + +/***/ }), + +/***/ "./node_modules/it-map/dist/src/index.js": +/*!***********************************************!*\ + !*** ./node_modules/it-map/dist/src/index.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_peekable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-peekable */ \"./node_modules/it-peekable/dist/src/index.js\");\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction map(source, func) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n for await (const val of source) {\n yield func(val);\n }\n })();\n }\n // if mapping function returns a promise we have to return an async generator\n const peekable = (0,it_peekable__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n const { value, done } = peekable.next();\n if (done === true) {\n return (function* () { }());\n }\n const res = func(value);\n // @ts-expect-error .then is not present on O\n if (typeof res.then === 'function') {\n return (async function* () {\n yield await res;\n for await (const val of peekable) {\n yield func(val);\n }\n })();\n }\n const fn = func;\n return (function* () {\n yield res;\n for (const val of peekable) {\n yield fn(val);\n }\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (map);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-map/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-merge/dist/src/index.js": +/*!*************************************************!*\ + !*** ./node_modules/it-merge/dist/src/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction merge(...sources) {\n const syncSources = [];\n for (const source of sources) {\n if (!isAsyncIterable(source)) {\n syncSources.push(source);\n }\n }\n if (syncSources.length === sources.length) {\n // all sources are synchronous\n return (function* () {\n for (const source of syncSources) {\n yield* source;\n }\n })();\n }\n return (async function* () {\n const output = (0,it_pushable__WEBPACK_IMPORTED_MODULE_0__.pushable)({\n objectMode: true\n });\n void Promise.resolve().then(async () => {\n try {\n await Promise.all(sources.map(async (source) => {\n for await (const item of source) {\n output.push(item);\n }\n }));\n output.end();\n }\n catch (err) {\n output.end(err);\n }\n });\n yield* output;\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (merge);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-merge/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-pair/dist/src/duplex.js": +/*!*************************************************!*\ + !*** ./node_modules/it-pair/dist/src/duplex.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ duplexPair: () => (/* binding */ duplexPair)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/it-pair/dist/src/index.js\");\n\n/**\n * Two duplex streams that are attached to each other\n */\nfunction duplexPair() {\n const a = (0,_index_js__WEBPACK_IMPORTED_MODULE_0__.pair)();\n const b = (0,_index_js__WEBPACK_IMPORTED_MODULE_0__.pair)();\n return [\n {\n source: a.source,\n sink: b.sink\n },\n {\n source: b.source,\n sink: a.sink\n }\n ];\n}\n//# sourceMappingURL=duplex.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-pair/dist/src/duplex.js?"); + +/***/ }), + +/***/ "./node_modules/it-pair/dist/src/index.js": +/*!************************************************!*\ + !*** ./node_modules/it-pair/dist/src/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pair: () => (/* binding */ pair)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n\n/**\n * A pair of streams where one drains from the other\n */\nfunction pair() {\n const deferred = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n let piped = false;\n return {\n sink: async (source) => {\n if (piped) {\n throw new Error('already piped');\n }\n piped = true;\n deferred.resolve(source);\n },\n source: (async function* () {\n const source = await deferred.promise;\n yield* source;\n }())\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-pair/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-pb-stream/dist/src/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/it-pb-stream/dist/src/index.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pbStream: () => (/* binding */ pbStream)\n/* harmony export */ });\n/* harmony import */ var err_code__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! err-code */ \"./node_modules/err-code/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var uint8_varint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uint8-varint */ \"./node_modules/uint8-varint/dist/src/index.js\");\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n/**\n * @packageDocumentation\n *\n * This module makes it easy to send and receive Protobuf encoded messages over\n * streams.\n *\n * @example\n *\n * ```typescript\n * import { pbStream } from 'it-pb-stream'\n * import { MessageType } from './src/my-message-type.js'\n *\n * // RequestType and ResponseType have been generate from `.proto` files and have\n * // `.encode` and `.decode` methods for serialization/deserialization\n *\n * const stream = pbStream(duplex)\n * stream.writePB({\n * foo: 'bar'\n * }, MessageType)\n * const res = await stream.readPB(MessageType)\n * ```\n */\n\n\n\n\n\nconst defaultLengthDecoder = (buf) => {\n return uint8_varint__WEBPACK_IMPORTED_MODULE_3__.unsigned.decode(buf);\n};\ndefaultLengthDecoder.bytes = 0;\nfunction pbStream(duplex, opts) {\n const write = (0,it_pushable__WEBPACK_IMPORTED_MODULE_2__.pushable)();\n duplex.sink(write).catch((err) => {\n write.end(err);\n });\n duplex.sink = async (source) => {\n for await (const buf of source) {\n write.push(buf);\n }\n write.end();\n };\n let source = duplex.source;\n if (duplex.source[Symbol.iterator] != null) {\n source = duplex.source[Symbol.iterator]();\n }\n else if (duplex.source[Symbol.asyncIterator] != null) {\n source = duplex.source[Symbol.asyncIterator]();\n }\n const readBuffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_4__.Uint8ArrayList();\n const W = {\n read: async (bytes) => {\n if (bytes == null) {\n // just read whatever arrives\n const { done, value } = await source.next();\n if (done === true) {\n return new uint8arraylist__WEBPACK_IMPORTED_MODULE_4__.Uint8ArrayList();\n }\n return value;\n }\n while (readBuffer.byteLength < bytes) {\n const { value, done } = await source.next();\n if (done === true) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('unexpected end of input'), 'ERR_UNEXPECTED_EOF');\n }\n readBuffer.append(value);\n }\n const buf = readBuffer.sublist(0, bytes);\n readBuffer.consume(bytes);\n return buf;\n },\n readLP: async () => {\n let dataLength = -1;\n const lengthBuffer = new uint8arraylist__WEBPACK_IMPORTED_MODULE_4__.Uint8ArrayList();\n const decodeLength = opts?.lengthDecoder ?? defaultLengthDecoder;\n while (true) {\n // read one byte at a time until we can decode a varint\n lengthBuffer.append(await W.read(1));\n try {\n dataLength = decodeLength(lengthBuffer);\n }\n catch (err) {\n if (err instanceof RangeError) {\n continue;\n }\n throw err;\n }\n if (dataLength > -1) {\n break;\n }\n if (opts?.maxLengthLength != null && lengthBuffer.byteLength > opts.maxLengthLength) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('message length length too long'), 'ERR_MSG_LENGTH_TOO_LONG');\n }\n }\n if (opts?.maxDataLength != null && dataLength > opts.maxDataLength) {\n throw err_code__WEBPACK_IMPORTED_MODULE_0__(new Error('message length too long'), 'ERR_MSG_DATA_TOO_LONG');\n }\n return W.read(dataLength);\n },\n readPB: async (proto) => {\n // readLP, decode\n const value = await W.readLP();\n if (value == null) {\n throw new Error('Value is null');\n }\n // Is this a buffer?\n const buf = value instanceof Uint8Array ? value : value.subarray();\n return proto.decode(buf);\n },\n write: (data) => {\n // just write\n if (data instanceof Uint8Array) {\n write.push(data);\n }\n else {\n write.push(data.subarray());\n }\n },\n writeLP: (data) => {\n // encode, write\n W.write(it_length_prefixed__WEBPACK_IMPORTED_MODULE_1__.encode.single(data, opts));\n },\n writePB: (data, proto) => {\n // encode, writeLP\n W.writeLP(proto.encode(data));\n },\n pb: (proto) => {\n return {\n read: async () => W.readPB(proto),\n write: (d) => { W.writePB(d, proto); },\n unwrap: () => W\n };\n },\n unwrap: () => {\n const originalStream = duplex.source;\n duplex.source = (async function* () {\n yield* readBuffer;\n yield* originalStream;\n }());\n return duplex;\n }\n };\n return W;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-pb-stream/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-peekable/dist/src/index.js": +/*!****************************************************!*\ + !*** ./node_modules/it-peekable/dist/src/index.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction peekable(iterable) {\n // @ts-expect-error can't use Symbol.asyncIterator to index iterable since it might be Iterable\n const [iterator, symbol] = iterable[Symbol.asyncIterator] != null\n // @ts-expect-error can't use Symbol.asyncIterator to index iterable since it might be Iterable\n ? [iterable[Symbol.asyncIterator](), Symbol.asyncIterator]\n // @ts-expect-error can't use Symbol.iterator to index iterable since it might be AsyncIterable\n : [iterable[Symbol.iterator](), Symbol.iterator];\n const queue = [];\n // @ts-expect-error can't use symbol to index peekable\n return {\n peek: () => {\n return iterator.next();\n },\n push: (value) => {\n queue.push(value);\n },\n next: () => {\n if (queue.length > 0) {\n return {\n done: false,\n value: queue.shift()\n };\n }\n return iterator.next();\n },\n [symbol]() {\n return this;\n }\n };\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (peekable);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-peekable/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-pipe/dist/src/index.js": +/*!************************************************!*\ + !*** ./node_modules/it-pipe/dist/src/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pipe: () => (/* binding */ pipe),\n/* harmony export */ rawPipe: () => (/* binding */ rawPipe)\n/* harmony export */ });\n/* harmony import */ var it_pushable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-pushable */ \"./node_modules/it-pushable/dist/src/index.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n\n\nfunction pipe(first, ...rest) {\n if (first == null) {\n throw new Error('Empty pipeline');\n }\n // Duplex at start: wrap in function and return duplex source\n if (isDuplex(first)) {\n const duplex = first;\n first = () => duplex.source;\n // Iterable at start: wrap in function\n }\n else if (isIterable(first) || isAsyncIterable(first)) {\n const source = first;\n first = () => source;\n }\n const fns = [first, ...rest];\n if (fns.length > 1) {\n // Duplex at end: use duplex sink\n if (isDuplex(fns[fns.length - 1])) {\n fns[fns.length - 1] = fns[fns.length - 1].sink;\n }\n }\n if (fns.length > 2) {\n // Duplex in the middle, consume source with duplex sink and return duplex source\n for (let i = 1; i < fns.length - 1; i++) {\n if (isDuplex(fns[i])) {\n fns[i] = duplexPipelineFn(fns[i]);\n }\n }\n }\n return rawPipe(...fns);\n}\nconst rawPipe = (...fns) => {\n let res;\n while (fns.length > 0) {\n res = fns.shift()(res);\n }\n return res;\n};\nconst isAsyncIterable = (obj) => {\n return obj?.[Symbol.asyncIterator] != null;\n};\nconst isIterable = (obj) => {\n return obj?.[Symbol.iterator] != null;\n};\nconst isDuplex = (obj) => {\n if (obj == null) {\n return false;\n }\n return obj.sink != null && obj.source != null;\n};\nconst duplexPipelineFn = (duplex) => {\n return (source) => {\n const p = duplex.sink(source);\n if (p?.then != null) {\n const stream = (0,it_pushable__WEBPACK_IMPORTED_MODULE_0__.pushable)({\n objectMode: true\n });\n p.then(() => {\n stream.end();\n }, (err) => {\n stream.end(err);\n });\n let sourceWrap;\n const source = duplex.source;\n if (isAsyncIterable(source)) {\n sourceWrap = async function* () {\n yield* source;\n stream.end();\n };\n }\n else if (isIterable(source)) {\n sourceWrap = function* () {\n yield* source;\n stream.end();\n };\n }\n else {\n throw new Error('Unknown duplex source type - must be Iterable or AsyncIterable');\n }\n return (0,it_merge__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(stream, sourceWrap());\n }\n return duplex.source;\n };\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-pipe/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-pushable/dist/src/fifo.js": +/*!***************************************************!*\ + !*** ./node_modules/it-pushable/dist/src/fifo.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FIFO: () => (/* binding */ FIFO)\n/* harmony export */ });\n// ported from https://www.npmjs.com/package/fast-fifo\nclass FixedFIFO {\n buffer;\n mask;\n top;\n btm;\n next;\n constructor(hwm) {\n if (!(hwm > 0) || ((hwm - 1) & hwm) !== 0) {\n throw new Error('Max size for a FixedFIFO should be a power of two');\n }\n this.buffer = new Array(hwm);\n this.mask = hwm - 1;\n this.top = 0;\n this.btm = 0;\n this.next = null;\n }\n push(data) {\n if (this.buffer[this.top] !== undefined) {\n return false;\n }\n this.buffer[this.top] = data;\n this.top = (this.top + 1) & this.mask;\n return true;\n }\n shift() {\n const last = this.buffer[this.btm];\n if (last === undefined) {\n return undefined;\n }\n this.buffer[this.btm] = undefined;\n this.btm = (this.btm + 1) & this.mask;\n return last;\n }\n isEmpty() {\n return this.buffer[this.btm] === undefined;\n }\n}\nclass FIFO {\n size;\n hwm;\n head;\n tail;\n constructor(options = {}) {\n this.hwm = options.splitLimit ?? 16;\n this.head = new FixedFIFO(this.hwm);\n this.tail = this.head;\n this.size = 0;\n }\n calculateSize(obj) {\n if (obj?.byteLength != null) {\n return obj.byteLength;\n }\n return 1;\n }\n push(val) {\n if (val?.value != null) {\n this.size += this.calculateSize(val.value);\n }\n if (!this.head.push(val)) {\n const prev = this.head;\n this.head = prev.next = new FixedFIFO(2 * this.head.buffer.length);\n this.head.push(val);\n }\n }\n shift() {\n let val = this.tail.shift();\n if (val === undefined && (this.tail.next != null)) {\n const next = this.tail.next;\n this.tail.next = null;\n this.tail = next;\n val = this.tail.shift();\n }\n if (val?.value != null) {\n this.size -= this.calculateSize(val.value);\n }\n return val;\n }\n isEmpty() {\n return this.head.isEmpty();\n }\n}\n//# sourceMappingURL=fifo.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-pushable/dist/src/fifo.js?"); + +/***/ }), + +/***/ "./node_modules/it-pushable/dist/src/index.js": +/*!****************************************************!*\ + !*** ./node_modules/it-pushable/dist/src/index.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ pushable: () => (/* binding */ pushable),\n/* harmony export */ pushableV: () => (/* binding */ pushableV)\n/* harmony export */ });\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var _fifo_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fifo.js */ \"./node_modules/it-pushable/dist/src/fifo.js\");\n/**\n * @packageDocumentation\n *\n * An iterable that you can push values into.\n *\n * @example\n *\n * ```js\n * import { pushable } from 'it-pushable'\n *\n * const source = pushable()\n *\n * setTimeout(() => source.push('hello'), 100)\n * setTimeout(() => source.push('world'), 200)\n * setTimeout(() => source.end(), 300)\n *\n * const start = Date.now()\n *\n * for await (const value of source) {\n * console.log(`got \"${value}\" after ${Date.now() - start}ms`)\n * }\n * console.log(`done after ${Date.now() - start}ms`)\n *\n * // Output:\n * // got \"hello\" after 105ms\n * // got \"world\" after 207ms\n * // done after 309ms\n * ```\n *\n * @example\n *\n * ```js\n * import { pushableV } from 'it-pushable'\n * import all from 'it-all'\n *\n * const source = pushableV()\n *\n * source.push(1)\n * source.push(2)\n * source.push(3)\n * source.end()\n *\n * console.info(await all(source))\n *\n * // Output:\n * // [ [1, 2, 3] ]\n * ```\n */\n\n\nclass AbortError extends Error {\n type;\n code;\n constructor(message, code) {\n super(message ?? 'The operation was aborted');\n this.type = 'aborted';\n this.code = code ?? 'ABORT_ERR';\n }\n}\nfunction pushable(options = {}) {\n const getNext = (buffer) => {\n const next = buffer.shift();\n if (next == null) {\n return { done: true };\n }\n if (next.error != null) {\n throw next.error;\n }\n return {\n done: next.done === true,\n // @ts-expect-error if done is false, value will be present\n value: next.value\n };\n };\n return _pushable(getNext, options);\n}\nfunction pushableV(options = {}) {\n const getNext = (buffer) => {\n let next;\n const values = [];\n while (!buffer.isEmpty()) {\n next = buffer.shift();\n if (next == null) {\n break;\n }\n if (next.error != null) {\n throw next.error;\n }\n if (next.done === false) {\n // @ts-expect-error if done is false value should be pushed\n values.push(next.value);\n }\n }\n if (next == null) {\n return { done: true };\n }\n return {\n done: next.done === true,\n value: values\n };\n };\n return _pushable(getNext, options);\n}\nfunction _pushable(getNext, options) {\n options = options ?? {};\n let onEnd = options.onEnd;\n let buffer = new _fifo_js__WEBPACK_IMPORTED_MODULE_1__.FIFO();\n let pushable;\n let onNext;\n let ended;\n let drain = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n const waitNext = async () => {\n try {\n if (!buffer.isEmpty()) {\n return getNext(buffer);\n }\n if (ended) {\n return { done: true };\n }\n return await new Promise((resolve, reject) => {\n onNext = (next) => {\n onNext = null;\n buffer.push(next);\n try {\n resolve(getNext(buffer));\n }\n catch (err) {\n reject(err);\n }\n return pushable;\n };\n });\n }\n finally {\n if (buffer.isEmpty()) {\n // settle promise in the microtask queue to give consumers a chance to\n // await after calling .push\n queueMicrotask(() => {\n drain.resolve();\n drain = (0,p_defer__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n });\n }\n }\n };\n const bufferNext = (next) => {\n if (onNext != null) {\n return onNext(next);\n }\n buffer.push(next);\n return pushable;\n };\n const bufferError = (err) => {\n buffer = new _fifo_js__WEBPACK_IMPORTED_MODULE_1__.FIFO();\n if (onNext != null) {\n return onNext({ error: err });\n }\n buffer.push({ error: err });\n return pushable;\n };\n const push = (value) => {\n if (ended) {\n return pushable;\n }\n // @ts-expect-error `byteLength` is not declared on PushType\n if (options?.objectMode !== true && value?.byteLength == null) {\n throw new Error('objectMode was not true but tried to push non-Uint8Array value');\n }\n return bufferNext({ done: false, value });\n };\n const end = (err) => {\n if (ended)\n return pushable;\n ended = true;\n return (err != null) ? bufferError(err) : bufferNext({ done: true });\n };\n const _return = () => {\n buffer = new _fifo_js__WEBPACK_IMPORTED_MODULE_1__.FIFO();\n end();\n return { done: true };\n };\n const _throw = (err) => {\n end(err);\n return { done: true };\n };\n pushable = {\n [Symbol.asyncIterator]() { return this; },\n next: waitNext,\n return: _return,\n throw: _throw,\n push,\n end,\n get readableLength() {\n return buffer.size;\n },\n onEmpty: async (options) => {\n const signal = options?.signal;\n signal?.throwIfAborted();\n if (buffer.isEmpty()) {\n return;\n }\n let cancel;\n let listener;\n if (signal != null) {\n cancel = new Promise((resolve, reject) => {\n listener = () => {\n reject(new AbortError());\n };\n signal.addEventListener('abort', listener);\n });\n }\n try {\n await Promise.race([\n drain.promise,\n cancel\n ]);\n }\n finally {\n if (listener != null && signal != null) {\n signal?.removeEventListener('abort', listener);\n }\n }\n }\n };\n if (onEnd == null) {\n return pushable;\n }\n const _pushable = pushable;\n pushable = {\n [Symbol.asyncIterator]() { return this; },\n next() {\n return _pushable.next();\n },\n throw(err) {\n _pushable.throw(err);\n if (onEnd != null) {\n onEnd(err);\n onEnd = undefined;\n }\n return { done: true };\n },\n return() {\n _pushable.return();\n if (onEnd != null) {\n onEnd();\n onEnd = undefined;\n }\n return { done: true };\n },\n push,\n end(err) {\n _pushable.end(err);\n if (onEnd != null) {\n onEnd(err);\n onEnd = undefined;\n }\n return pushable;\n },\n get readableLength() {\n return _pushable.readableLength;\n }\n };\n return pushable;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-pushable/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-reader/dist/src/index.js": +/*!**************************************************!*\ + !*** ./node_modules/it-reader/dist/src/index.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ reader: () => (/* binding */ reader)\n/* harmony export */ });\n/* harmony import */ var uint8arraylist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arraylist */ \"./node_modules/uint8arraylist/dist/src/index.js\");\n\n/**\n * Returns an `AsyncGenerator` that allows reading a set number of bytes from the passed source.\n *\n * @example\n *\n * ```javascript\n * import { reader } from 'it-reader'\n *\n * const stream = reader(source)\n *\n * // read 10 bytes from the stream\n * const { done, value } = await stream.next(10)\n *\n * if (done === true) {\n * // stream finished\n * }\n *\n * if (value != null) {\n * // do something with value\n * }\n * ```\n */\nfunction reader(source) {\n const reader = (async function* () {\n // @ts-expect-error first yield in stream is ignored\n let bytes = yield; // Allows us to receive 8 when reader.next(8) is called\n let bl = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n for await (const chunk of source) {\n if (bytes == null) {\n bl.append(chunk);\n bytes = yield bl;\n bl = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n continue;\n }\n bl.append(chunk);\n while (bl.length >= bytes) {\n const data = bl.sublist(0, bytes);\n bl.consume(bytes);\n bytes = yield data;\n // If we no longer want a specific byte length, we yield the rest now\n if (bytes == null) {\n if (bl.length > 0) {\n bytes = yield bl;\n bl = new uint8arraylist__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayList();\n }\n break; // bytes is null and/or no more buffer to yield\n }\n }\n }\n // Consumer wants more bytes but the source has ended and our buffer\n // is not big enough to satisfy.\n if (bytes != null) {\n throw Object.assign(new Error(`stream ended before ${bytes} bytes became available`), { code: 'ERR_UNDER_READ', buffer: bl });\n }\n })();\n void reader.next();\n return reader;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-reader/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-sort/dist/src/index.js": +/*!************************************************!*\ + !*** ./node_modules/it-sort/dist/src/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var it_all__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! it-all */ \"./node_modules/it-all/dist/src/index.js\");\n\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction sort(source, sorter) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n const arr = await (0,it_all__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n yield* arr.sort(sorter);\n })();\n }\n return (function* () {\n const arr = (0,it_all__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(source);\n yield* arr.sort(sorter);\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (sort);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-sort/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-take/dist/src/index.js": +/*!************************************************!*\ + !*** ./node_modules/it-take/dist/src/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction isAsyncIterable(thing) {\n return thing[Symbol.asyncIterator] != null;\n}\nfunction take(source, limit) {\n if (isAsyncIterable(source)) {\n return (async function* () {\n let items = 0;\n if (limit < 1) {\n return;\n }\n for await (const entry of source) {\n yield entry;\n items++;\n if (items === limit) {\n return;\n }\n }\n })();\n }\n return (function* () {\n let items = 0;\n if (limit < 1) {\n return;\n }\n for (const entry of source) {\n yield entry;\n items++;\n if (items === limit) {\n return;\n }\n }\n })();\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (take);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-take/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/client.js": +/*!***********************************************!*\ + !*** ./node_modules/it-ws/dist/src/client.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ connect: () => (/* binding */ connect)\n/* harmony export */ });\n/* harmony import */ var _web_socket_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-socket.js */ \"./node_modules/it-ws/dist/src/web-socket.browser.js\");\n/* harmony import */ var _duplex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./duplex.js */ \"./node_modules/it-ws/dist/src/duplex.js\");\n/* harmony import */ var _ws_url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ws-url.js */ \"./node_modules/it-ws/dist/src/ws-url.js\");\n// load websocket library if we are not in the browser\n\n\n\nfunction connect(addr, opts) {\n const location = typeof window === 'undefined' ? '' : window.location;\n opts = opts ?? {};\n const url = (0,_ws_url_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(addr, location.toString());\n const socket = new _web_socket_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](url, opts.websocket);\n return (0,_duplex_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(socket, opts);\n}\n//# sourceMappingURL=client.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/client.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/duplex.js": +/*!***********************************************!*\ + !*** ./node_modules/it-ws/dist/src/duplex.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _source_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./source.js */ \"./node_modules/it-ws/dist/src/source.js\");\n/* harmony import */ var _sink_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sink.js */ \"./node_modules/it-ws/dist/src/sink.js\");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((socket, options) => {\n options = options ?? {};\n const connectedSource = (0,_source_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(socket);\n let remoteAddress = options.remoteAddress;\n let remotePort = options.remotePort;\n if (socket.url != null) {\n // only client->server sockets have urls, server->client connections do not\n try {\n const url = new URL(socket.url);\n remoteAddress = url.hostname;\n remotePort = parseInt(url.port, 10);\n }\n catch { }\n }\n if (remoteAddress == null || remotePort == null) {\n throw new Error('Remote connection did not have address and/or port');\n }\n const duplex = {\n sink: (0,_sink_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(socket, options),\n source: connectedSource,\n connected: async () => { await connectedSource.connected(); },\n close: async () => {\n if (socket.readyState === socket.CONNECTING || socket.readyState === socket.OPEN) {\n await new Promise((resolve) => {\n socket.addEventListener('close', () => {\n resolve();\n });\n socket.close();\n });\n }\n },\n destroy: () => {\n if (socket.terminate != null) {\n socket.terminate();\n }\n else {\n socket.close();\n }\n },\n remoteAddress,\n remotePort,\n socket\n };\n return duplex;\n});\n//# sourceMappingURL=duplex.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/duplex.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/ready.js": +/*!**********************************************!*\ + !*** ./node_modules/it-ws/dist/src/ready.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (async (socket) => {\n // if the socket is closing or closed, return end\n if (socket.readyState >= 2) {\n throw new Error('socket closed');\n }\n // if open, return\n if (socket.readyState === 1) {\n return;\n }\n await new Promise((resolve, reject) => {\n function cleanup() {\n socket.removeEventListener('open', handleOpen);\n socket.removeEventListener('error', handleErr);\n }\n function handleOpen() {\n cleanup();\n resolve();\n }\n function handleErr(event) {\n cleanup();\n reject(event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`));\n }\n socket.addEventListener('open', handleOpen);\n socket.addEventListener('error', handleErr);\n });\n});\n//# sourceMappingURL=ready.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/ready.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/sink.js": +/*!*********************************************!*\ + !*** ./node_modules/it-ws/dist/src/sink.js ***! + \*********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ready_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ready.js */ \"./node_modules/it-ws/dist/src/ready.js\");\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((socket, options) => {\n options = options ?? {};\n options.closeOnEnd = options.closeOnEnd !== false;\n const sink = async (source) => {\n for await (const data of source) {\n try {\n await (0,_ready_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(socket);\n }\n catch (err) {\n if (err.message === 'socket closed')\n break;\n throw err;\n }\n socket.send(data);\n }\n if (options.closeOnEnd != null && socket.readyState <= 1) {\n await new Promise((resolve, reject) => {\n socket.addEventListener('close', event => {\n if (event.wasClean || event.code === 1006) {\n resolve();\n }\n else {\n const err = Object.assign(new Error('ws error'), { event });\n reject(err);\n }\n });\n setTimeout(() => { socket.close(); });\n });\n }\n };\n return sink;\n});\n//# sourceMappingURL=sink.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/sink.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/source.js": +/*!***********************************************!*\ + !*** ./node_modules/it-ws/dist/src/source.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var event_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! event-iterator */ \"./node_modules/event-iterator/lib/dom.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n\n\n// copied from github.com/feross/buffer\n// Some ArrayBuffers are not passing the instanceof check, so we need to do a bit more work :(\nfunction isArrayBuffer(obj) {\n return (obj instanceof ArrayBuffer) ||\n (obj?.constructor?.name === 'ArrayBuffer' && typeof obj?.byteLength === 'number');\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((socket) => {\n socket.binaryType = 'arraybuffer';\n const connected = async () => {\n await new Promise((resolve, reject) => {\n if (isConnected) {\n resolve();\n return;\n }\n if (connError != null) {\n reject(connError);\n return;\n }\n const cleanUp = (cont) => {\n socket.removeEventListener('open', onOpen);\n socket.removeEventListener('error', onError);\n cont();\n };\n const onOpen = () => { cleanUp(resolve); };\n const onError = (event) => {\n cleanUp(() => { reject(event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`)); });\n };\n socket.addEventListener('open', onOpen);\n socket.addEventListener('error', onError);\n });\n };\n const source = (async function* () {\n const messages = new event_iterator__WEBPACK_IMPORTED_MODULE_0__.EventIterator(({ push, stop, fail }) => {\n const onMessage = (event) => {\n let data = null;\n if (typeof event.data === 'string') {\n data = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_1__.fromString)(event.data);\n }\n if (isArrayBuffer(event.data)) {\n data = new Uint8Array(event.data);\n }\n if (event.data instanceof Uint8Array) {\n data = event.data;\n }\n if (data == null) {\n return;\n }\n push(data);\n };\n const onError = (event) => { fail(event.error ?? new Error('Socket error')); };\n socket.addEventListener('message', onMessage);\n socket.addEventListener('error', onError);\n socket.addEventListener('close', stop);\n return () => {\n socket.removeEventListener('message', onMessage);\n socket.removeEventListener('error', onError);\n socket.removeEventListener('close', stop);\n };\n }, { highWaterMark: Infinity });\n await connected();\n for await (const chunk of messages) {\n yield isArrayBuffer(chunk) ? new Uint8Array(chunk) : chunk;\n }\n }());\n let isConnected = socket.readyState === 1;\n let connError;\n socket.addEventListener('open', () => {\n isConnected = true;\n connError = null;\n });\n socket.addEventListener('close', () => {\n isConnected = false;\n connError = null;\n });\n socket.addEventListener('error', event => {\n if (!isConnected) {\n connError = event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`);\n }\n });\n return Object.assign(source, {\n connected\n });\n});\n//# sourceMappingURL=source.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/source.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/web-socket.browser.js": +/*!***********************************************************!*\ + !*** ./node_modules/it-ws/dist/src/web-socket.browser.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* eslint-env browser */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (WebSocket);\n//# sourceMappingURL=web-socket.browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/web-socket.browser.js?"); + +/***/ }), + +/***/ "./node_modules/it-ws/dist/src/ws-url.js": +/*!***********************************************!*\ + !*** ./node_modules/it-ws/dist/src/ws-url.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var iso_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! iso-url */ \"./node_modules/iso-url/index.js\");\n\nconst map = { http: 'ws', https: 'wss' };\nconst def = 'ws';\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((url, location) => (0,iso_url__WEBPACK_IMPORTED_MODULE_0__.relative)(url, location, map, def));\n//# sourceMappingURL=ws-url.js.map\n\n//# sourceURL=webpack://light/./node_modules/it-ws/dist/src/ws-url.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/address-manager/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/address-manager/index.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultAddressManager: () => (/* binding */ DefaultAddressManager)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/libp2p/dist/src/address-manager/utils.js\");\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:address-manager');\nconst defaultAddressFilter = (addrs) => addrs;\n/**\n * If the passed multiaddr contains the passed peer id, remove it\n */\nfunction stripPeerId(ma, peerId) {\n const observedPeerIdStr = ma.getPeerId();\n // strip our peer id if it has been passed\n if (observedPeerIdStr != null) {\n const observedPeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_1__.peerIdFromString)(observedPeerIdStr);\n // use same encoding for comparison\n if (observedPeerId.equals(peerId)) {\n ma = ma.decapsulate((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(`/p2p/${peerId.toString()}`));\n }\n }\n return ma;\n}\nclass DefaultAddressManager {\n components;\n // this is an array to allow for duplicates, e.g. multiples of `/ip4/0.0.0.0/tcp/0`\n listen;\n announce;\n observed;\n announceFilter;\n /**\n * Responsible for managing the peer addresses.\n * Peers can specify their listen and announce addresses.\n * The listen addresses will be used by the libp2p transports to listen for new connections,\n * while the announce addresses will be used for the peer addresses' to other peers in the network.\n */\n constructor(components, init = {}) {\n const { listen = [], announce = [] } = init;\n this.components = components;\n this.listen = listen.map(ma => ma.toString());\n this.announce = new Set(announce.map(ma => ma.toString()));\n this.observed = new Map();\n this.announceFilter = init.announceFilter ?? defaultAddressFilter;\n // this method gets called repeatedly on startup when transports start listening so\n // debounce it so we don't cause multiple self:peer:update events to be emitted\n this._updatePeerStoreAddresses = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.debounce)(this._updatePeerStoreAddresses.bind(this), 1000);\n // update our stored addresses when new transports listen\n components.events.addEventListener('transport:listening', () => {\n this._updatePeerStoreAddresses();\n });\n // update our stored addresses when existing transports stop listening\n components.events.addEventListener('transport:close', () => {\n this._updatePeerStoreAddresses();\n });\n }\n _updatePeerStoreAddresses() {\n // if announce addresses have been configured, ensure they make it into our peer\n // record for things like identify\n const addrs = this.getAnnounceAddrs()\n .concat(this.components.transportManager.getAddrs())\n .concat([...this.observed.entries()]\n .filter(([_, metadata]) => metadata.confident)\n .map(([str]) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(str))).map(ma => {\n // strip our peer id if it is present\n if (ma.getPeerId() === this.components.peerId.toString()) {\n return ma.decapsulate(`/p2p/${this.components.peerId.toString()}`);\n }\n return ma;\n });\n this.components.peerStore.patch(this.components.peerId, {\n multiaddrs: addrs\n })\n .catch(err => { log.error('error updating addresses', err); });\n }\n /**\n * Get peer listen multiaddrs\n */\n getListenAddrs() {\n return Array.from(this.listen).map((a) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(a));\n }\n /**\n * Get peer announcing multiaddrs\n */\n getAnnounceAddrs() {\n return Array.from(this.announce).map((a) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(a));\n }\n /**\n * Get observed multiaddrs\n */\n getObservedAddrs() {\n return Array.from(this.observed).map(([a]) => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(a));\n }\n /**\n * Add peer observed addresses\n */\n addObservedAddr(addr) {\n addr = stripPeerId(addr, this.components.peerId);\n const addrString = addr.toString();\n // do not trigger the change:addresses event if we already know about this address\n if (this.observed.has(addrString)) {\n return;\n }\n this.observed.set(addrString, {\n confident: false\n });\n }\n confirmObservedAddr(addr) {\n addr = stripPeerId(addr, this.components.peerId);\n const addrString = addr.toString();\n const metadata = this.observed.get(addrString) ?? {\n confident: false\n };\n const startingConfidence = metadata.confident;\n this.observed.set(addrString, {\n confident: true\n });\n // only trigger the 'self:peer:update' event if our confidence in an address has changed\n if (!startingConfidence) {\n this._updatePeerStoreAddresses();\n }\n }\n removeObservedAddr(addr) {\n addr = stripPeerId(addr, this.components.peerId);\n const addrString = addr.toString();\n this.observed.delete(addrString);\n }\n getAddresses() {\n let addrs = this.getAnnounceAddrs().map(ma => ma.toString());\n if (addrs.length === 0) {\n // no configured announce addrs, add configured listen addresses\n addrs = this.components.transportManager.getAddrs().map(ma => ma.toString());\n }\n // add observed addresses we are confident in\n addrs = addrs.concat(Array.from(this.observed)\n .filter(([ma, metadata]) => metadata.confident)\n .map(([ma]) => ma));\n // dedupe multiaddrs\n const addrSet = new Set(addrs);\n // Create advertising list\n return this.announceFilter(Array.from(addrSet)\n .map(str => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(str)))\n .map(ma => {\n // do not append our peer id to a path multiaddr as it will become invalid\n if (ma.protos().pop()?.path === true) {\n return ma;\n }\n if (ma.getPeerId() === this.components.peerId.toString()) {\n return ma;\n }\n return ma.encapsulate(`/p2p/${this.components.peerId.toString()}`);\n });\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/address-manager/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/address-manager/utils.js": +/*!***************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/address-manager/utils.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ debounce: () => (/* binding */ debounce)\n/* harmony export */ });\nfunction debounce(func, wait) {\n let timeout;\n return function () {\n const later = function () {\n timeout = undefined;\n func();\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/address-manager/utils.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/constants.js": +/*!*****************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/constants.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ADVERTISE_BOOT_DELAY: () => (/* binding */ ADVERTISE_BOOT_DELAY),\n/* harmony export */ ADVERTISE_TTL: () => (/* binding */ ADVERTISE_TTL),\n/* harmony export */ CIRCUIT_PROTO_CODE: () => (/* binding */ CIRCUIT_PROTO_CODE),\n/* harmony export */ DEFAULT_ADVERT_BOOT_DELAY: () => (/* binding */ DEFAULT_ADVERT_BOOT_DELAY),\n/* harmony export */ DEFAULT_DATA_LIMIT: () => (/* binding */ DEFAULT_DATA_LIMIT),\n/* harmony export */ DEFAULT_DURATION_LIMIT: () => (/* binding */ DEFAULT_DURATION_LIMIT),\n/* harmony export */ DEFAULT_HOP_TIMEOUT: () => (/* binding */ DEFAULT_HOP_TIMEOUT),\n/* harmony export */ DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL: () => (/* binding */ DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL),\n/* harmony export */ DEFAULT_MAX_RESERVATION_STORE_SIZE: () => (/* binding */ DEFAULT_MAX_RESERVATION_STORE_SIZE),\n/* harmony export */ DEFAULT_MAX_RESERVATION_TTL: () => (/* binding */ DEFAULT_MAX_RESERVATION_TTL),\n/* harmony export */ DEFAULT_RESERVATION_CONCURRENCY: () => (/* binding */ DEFAULT_RESERVATION_CONCURRENCY),\n/* harmony export */ RELAY_RENDEZVOUS_NS: () => (/* binding */ RELAY_RENDEZVOUS_NS),\n/* harmony export */ RELAY_SOURCE_TAG: () => (/* binding */ RELAY_SOURCE_TAG),\n/* harmony export */ RELAY_TAG: () => (/* binding */ RELAY_TAG),\n/* harmony export */ RELAY_V2_HOP_CODEC: () => (/* binding */ RELAY_V2_HOP_CODEC),\n/* harmony export */ RELAY_V2_STOP_CODEC: () => (/* binding */ RELAY_V2_STOP_CODEC)\n/* harmony export */ });\nconst second = 1000;\nconst minute = 60 * second;\n/**\n * Delay before HOP relay service is advertised on the network\n */\nconst ADVERTISE_BOOT_DELAY = 15 * minute;\n/**\n * Delay Between HOP relay service advertisements on the network\n */\nconst ADVERTISE_TTL = 30 * minute;\n/**\n * Multicodec code\n */\nconst CIRCUIT_PROTO_CODE = 290;\n/**\n * Relay HOP relay service namespace for discovery\n */\nconst RELAY_RENDEZVOUS_NS = '/libp2p/relay';\n/**\n * The maximum number of relay reservations the relay server will accept\n */\nconst DEFAULT_MAX_RESERVATION_STORE_SIZE = 15;\n/**\n * How often to check for reservation expiry\n */\nconst DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL = 300 * second;\n/**\n * How often to check for reservation expiry\n */\nconst DEFAULT_MAX_RESERVATION_TTL = 2 * 60 * minute;\nconst DEFAULT_RESERVATION_CONCURRENCY = 1;\nconst RELAY_SOURCE_TAG = 'circuit-relay-source';\nconst RELAY_TAG = 'circuit-relay-relay';\n// circuit v2 connection limits\n// https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/relay/resources.go#L61-L66\n// 2 min is the default connection duration\nconst DEFAULT_DURATION_LIMIT = 2 * minute;\n// 128k is the default data limit\nconst DEFAULT_DATA_LIMIT = BigInt(1 << 17);\n/**\n * The hop protocol\n */\nconst RELAY_V2_HOP_CODEC = '/libp2p/circuit/relay/0.2.0/hop';\n/**\n * the stop protocol\n */\nconst RELAY_V2_STOP_CODEC = '/libp2p/circuit/relay/0.2.0/stop';\n/**\n * Hop messages must be exchanged inside this timeout\n */\nconst DEFAULT_HOP_TIMEOUT = 30 * second;\n/**\n * How long to wait before starting to advertise the relay service\n */\nconst DEFAULT_ADVERT_BOOT_DELAY = 30 * second;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/constants.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ circuitRelayServer: () => (/* reexport safe */ _server_index_js__WEBPACK_IMPORTED_MODULE_0__.circuitRelayServer),\n/* harmony export */ circuitRelayTransport: () => (/* reexport safe */ _transport_index_js__WEBPACK_IMPORTED_MODULE_1__.circuitRelayTransport)\n/* harmony export */ });\n/* harmony import */ var _server_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./server/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/server/index.js\");\n/* harmony import */ var _transport_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transport/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/transport/index.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/pb/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/pb/index.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HopMessage: () => (/* binding */ HopMessage),\n/* harmony export */ Limit: () => (/* binding */ Limit),\n/* harmony export */ Peer: () => (/* binding */ Peer),\n/* harmony export */ Reservation: () => (/* binding */ Reservation),\n/* harmony export */ ReservationVoucher: () => (/* binding */ ReservationVoucher),\n/* harmony export */ Status: () => (/* binding */ Status),\n/* harmony export */ StopMessage: () => (/* binding */ StopMessage)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar HopMessage;\n(function (HopMessage) {\n let Type;\n (function (Type) {\n Type[\"RESERVE\"] = \"RESERVE\";\n Type[\"CONNECT\"] = \"CONNECT\";\n Type[\"STATUS\"] = \"STATUS\";\n })(Type = HopMessage.Type || (HopMessage.Type = {}));\n let __TypeValues;\n (function (__TypeValues) {\n __TypeValues[__TypeValues[\"RESERVE\"] = 0] = \"RESERVE\";\n __TypeValues[__TypeValues[\"CONNECT\"] = 1] = \"CONNECT\";\n __TypeValues[__TypeValues[\"STATUS\"] = 2] = \"STATUS\";\n })(__TypeValues || (__TypeValues = {}));\n (function (Type) {\n Type.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__TypeValues);\n };\n })(Type = HopMessage.Type || (HopMessage.Type = {}));\n let _codec;\n HopMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.type != null) {\n w.uint32(8);\n HopMessage.Type.codec().encode(obj.type, w);\n }\n if (obj.peer != null) {\n w.uint32(18);\n Peer.codec().encode(obj.peer, w);\n }\n if (obj.reservation != null) {\n w.uint32(26);\n Reservation.codec().encode(obj.reservation, w);\n }\n if (obj.limit != null) {\n w.uint32(34);\n Limit.codec().encode(obj.limit, w);\n }\n if (obj.status != null) {\n w.uint32(40);\n Status.codec().encode(obj.status, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.type = HopMessage.Type.codec().decode(reader);\n break;\n case 2:\n obj.peer = Peer.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.reservation = Reservation.codec().decode(reader, reader.uint32());\n break;\n case 4:\n obj.limit = Limit.codec().decode(reader, reader.uint32());\n break;\n case 5:\n obj.status = Status.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n HopMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, HopMessage.codec());\n };\n HopMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, HopMessage.codec());\n };\n})(HopMessage || (HopMessage = {}));\nvar StopMessage;\n(function (StopMessage) {\n let Type;\n (function (Type) {\n Type[\"CONNECT\"] = \"CONNECT\";\n Type[\"STATUS\"] = \"STATUS\";\n })(Type = StopMessage.Type || (StopMessage.Type = {}));\n let __TypeValues;\n (function (__TypeValues) {\n __TypeValues[__TypeValues[\"CONNECT\"] = 0] = \"CONNECT\";\n __TypeValues[__TypeValues[\"STATUS\"] = 1] = \"STATUS\";\n })(__TypeValues || (__TypeValues = {}));\n (function (Type) {\n Type.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__TypeValues);\n };\n })(Type = StopMessage.Type || (StopMessage.Type = {}));\n let _codec;\n StopMessage.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.type != null) {\n w.uint32(8);\n StopMessage.Type.codec().encode(obj.type, w);\n }\n if (obj.peer != null) {\n w.uint32(18);\n Peer.codec().encode(obj.peer, w);\n }\n if (obj.limit != null) {\n w.uint32(26);\n Limit.codec().encode(obj.limit, w);\n }\n if (obj.status != null) {\n w.uint32(32);\n Status.codec().encode(obj.status, w);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.type = StopMessage.Type.codec().decode(reader);\n break;\n case 2:\n obj.peer = Peer.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.limit = Limit.codec().decode(reader, reader.uint32());\n break;\n case 4:\n obj.status = Status.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n StopMessage.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, StopMessage.codec());\n };\n StopMessage.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, StopMessage.codec());\n };\n})(StopMessage || (StopMessage = {}));\nvar Peer;\n(function (Peer) {\n let _codec;\n Peer.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.id != null && obj.id.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.id);\n }\n if (obj.addrs != null) {\n for (const value of obj.addrs) {\n w.uint32(18);\n w.bytes(value);\n }\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n id: new Uint8Array(0),\n addrs: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.id = reader.bytes();\n break;\n case 2:\n obj.addrs.push(reader.bytes());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Peer.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Peer.codec());\n };\n Peer.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Peer.codec());\n };\n})(Peer || (Peer = {}));\nvar Reservation;\n(function (Reservation) {\n let _codec;\n Reservation.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.expire != null && obj.expire !== 0n)) {\n w.uint32(8);\n w.uint64(obj.expire);\n }\n if (obj.addrs != null) {\n for (const value of obj.addrs) {\n w.uint32(18);\n w.bytes(value);\n }\n }\n if (obj.voucher != null) {\n w.uint32(26);\n w.bytes(obj.voucher);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n expire: 0n,\n addrs: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.expire = reader.uint64();\n break;\n case 2:\n obj.addrs.push(reader.bytes());\n break;\n case 3:\n obj.voucher = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Reservation.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Reservation.codec());\n };\n Reservation.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Reservation.codec());\n };\n})(Reservation || (Reservation = {}));\nvar Limit;\n(function (Limit) {\n let _codec;\n Limit.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.duration != null) {\n w.uint32(8);\n w.uint32(obj.duration);\n }\n if (obj.data != null) {\n w.uint32(16);\n w.uint64(obj.data);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {};\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.duration = reader.uint32();\n break;\n case 2:\n obj.data = reader.uint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Limit.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Limit.codec());\n };\n Limit.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Limit.codec());\n };\n})(Limit || (Limit = {}));\nvar Status;\n(function (Status) {\n Status[\"UNUSED\"] = \"UNUSED\";\n Status[\"OK\"] = \"OK\";\n Status[\"RESERVATION_REFUSED\"] = \"RESERVATION_REFUSED\";\n Status[\"RESOURCE_LIMIT_EXCEEDED\"] = \"RESOURCE_LIMIT_EXCEEDED\";\n Status[\"PERMISSION_DENIED\"] = \"PERMISSION_DENIED\";\n Status[\"CONNECTION_FAILED\"] = \"CONNECTION_FAILED\";\n Status[\"NO_RESERVATION\"] = \"NO_RESERVATION\";\n Status[\"MALFORMED_MESSAGE\"] = \"MALFORMED_MESSAGE\";\n Status[\"UNEXPECTED_MESSAGE\"] = \"UNEXPECTED_MESSAGE\";\n})(Status || (Status = {}));\nvar __StatusValues;\n(function (__StatusValues) {\n __StatusValues[__StatusValues[\"UNUSED\"] = 0] = \"UNUSED\";\n __StatusValues[__StatusValues[\"OK\"] = 100] = \"OK\";\n __StatusValues[__StatusValues[\"RESERVATION_REFUSED\"] = 200] = \"RESERVATION_REFUSED\";\n __StatusValues[__StatusValues[\"RESOURCE_LIMIT_EXCEEDED\"] = 201] = \"RESOURCE_LIMIT_EXCEEDED\";\n __StatusValues[__StatusValues[\"PERMISSION_DENIED\"] = 202] = \"PERMISSION_DENIED\";\n __StatusValues[__StatusValues[\"CONNECTION_FAILED\"] = 203] = \"CONNECTION_FAILED\";\n __StatusValues[__StatusValues[\"NO_RESERVATION\"] = 204] = \"NO_RESERVATION\";\n __StatusValues[__StatusValues[\"MALFORMED_MESSAGE\"] = 400] = \"MALFORMED_MESSAGE\";\n __StatusValues[__StatusValues[\"UNEXPECTED_MESSAGE\"] = 401] = \"UNEXPECTED_MESSAGE\";\n})(__StatusValues || (__StatusValues = {}));\n(function (Status) {\n Status.codec = () => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.enumeration)(__StatusValues);\n };\n})(Status || (Status = {}));\nvar ReservationVoucher;\n(function (ReservationVoucher) {\n let _codec;\n ReservationVoucher.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if ((obj.relay != null && obj.relay.byteLength > 0)) {\n w.uint32(10);\n w.bytes(obj.relay);\n }\n if ((obj.peer != null && obj.peer.byteLength > 0)) {\n w.uint32(18);\n w.bytes(obj.peer);\n }\n if ((obj.expiration != null && obj.expiration !== 0n)) {\n w.uint32(24);\n w.uint64(obj.expiration);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n relay: new Uint8Array(0),\n peer: new Uint8Array(0),\n expiration: 0n\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n obj.relay = reader.bytes();\n break;\n case 2:\n obj.peer = reader.bytes();\n break;\n case 3:\n obj.expiration = reader.uint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n ReservationVoucher.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, ReservationVoucher.codec());\n };\n ReservationVoucher.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, ReservationVoucher.codec());\n };\n})(ReservationVoucher || (ReservationVoucher = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/pb/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/server/advert-service.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/server/advert-service.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AdvertService: () => (/* binding */ AdvertService)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var p_retry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! p-retry */ \"./node_modules/p-retry/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils.js */ \"./node_modules/libp2p/dist/src/circuit-relay/utils.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:circuit-relay:advert-service');\nclass AdvertService extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter {\n contentRouting;\n timeout;\n started;\n bootDelay;\n /**\n * Creates an instance of Relay\n */\n constructor(components, init) {\n super();\n this.contentRouting = components.contentRouting;\n this.bootDelay = init?.bootDelay ?? _constants_js__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_ADVERT_BOOT_DELAY;\n this.started = false;\n }\n isStarted() {\n return this.started;\n }\n /**\n * Start Relay service\n */\n start() {\n if (this.started) {\n return;\n }\n // Advertise service if HOP enabled and advertising enabled\n this.timeout = setTimeout(() => {\n this._advertiseService().catch(err => {\n log.error('could not advertise service', err);\n });\n }, this.bootDelay);\n this.started = true;\n }\n /**\n * Stop Relay service\n */\n stop() {\n try {\n clearTimeout(this.timeout);\n }\n catch (err) { }\n this.started = false;\n }\n /**\n * Advertise hop relay service in the network.\n */\n async _advertiseService() {\n await (0,p_retry__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(async () => {\n try {\n const cid = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.namespaceToCid)(_constants_js__WEBPACK_IMPORTED_MODULE_4__.RELAY_RENDEZVOUS_NS);\n await this.contentRouting.provide(cid);\n this.safeDispatchEvent('advert:success', { detail: undefined });\n }\n catch (err) {\n this.safeDispatchEvent('advert:error', { detail: err });\n if (err.code === _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_ROUTERS_AVAILABLE) {\n log.error('a content router, such as a DHT, must be provided in order to advertise the relay service', err);\n this.stop();\n return;\n }\n log.error('could not advertise service', err);\n throw err;\n }\n });\n }\n}\n//# sourceMappingURL=advert-service.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/server/advert-service.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/server/index.js": +/*!********************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/server/index.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ circuitRelayServer: () => (/* binding */ circuitRelayServer)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var it_pb_stream__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! it-pb-stream */ \"./node_modules/it-pb-stream/dist/src/index.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../connection-manager/constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n/* harmony import */ var _pb_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../pb/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/pb/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils.js */ \"./node_modules/libp2p/dist/src/circuit-relay/utils.js\");\n/* harmony import */ var _advert_service_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./advert-service.js */ \"./node_modules/libp2p/dist/src/circuit-relay/server/advert-service.js\");\n/* harmony import */ var _reservation_store_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./reservation-store.js */ \"./node_modules/libp2p/dist/src/circuit-relay/server/reservation-store.js\");\n/* harmony import */ var _reservation_voucher_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./reservation-voucher.js */ \"./node_modules/libp2p/dist/src/circuit-relay/server/reservation-voucher.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:circuit-relay:server');\nconst isRelayAddr = (ma) => ma.protoCodes().includes(_constants_js__WEBPACK_IMPORTED_MODULE_9__.CIRCUIT_PROTO_CODE);\nconst defaults = {\n maxOutboundStopStreams: _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__.MAX_CONNECTIONS\n};\nclass CircuitRelayServer extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter {\n registrar;\n peerStore;\n addressManager;\n peerId;\n connectionManager;\n connectionGater;\n reservationStore;\n advertService;\n started;\n hopTimeout;\n shutdownController;\n maxInboundHopStreams;\n maxOutboundHopStreams;\n maxOutboundStopStreams;\n /**\n * Creates an instance of Relay\n */\n constructor(components, init = {}) {\n super();\n this.registrar = components.registrar;\n this.peerStore = components.peerStore;\n this.addressManager = components.addressManager;\n this.peerId = components.peerId;\n this.connectionManager = components.connectionManager;\n this.connectionGater = components.connectionGater;\n this.started = false;\n this.hopTimeout = init?.hopTimeout ?? _constants_js__WEBPACK_IMPORTED_MODULE_9__.DEFAULT_HOP_TIMEOUT;\n this.shutdownController = new AbortController();\n this.maxInboundHopStreams = init.maxInboundHopStreams;\n this.maxOutboundHopStreams = init.maxOutboundHopStreams;\n this.maxOutboundStopStreams = init.maxOutboundStopStreams ?? defaults.maxOutboundStopStreams;\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, this.shutdownController.signal);\n }\n catch { }\n if (init.advertise != null && init.advertise !== false) {\n this.advertService = new _advert_service_js__WEBPACK_IMPORTED_MODULE_12__.AdvertService(components, init.advertise === true ? undefined : init.advertise);\n this.advertService.addEventListener('advert:success', () => {\n this.safeDispatchEvent('relay:advert:success', {});\n });\n this.advertService.addEventListener('advert:error', (evt) => {\n this.safeDispatchEvent('relay:advert:error', { detail: evt.detail });\n });\n }\n this.reservationStore = new _reservation_store_js__WEBPACK_IMPORTED_MODULE_13__.ReservationStore(init.reservations);\n }\n isStarted() {\n return this.started;\n }\n /**\n * Start Relay service\n */\n async start() {\n if (this.started) {\n return;\n }\n // Advertise service if HOP enabled and advertising enabled\n this.advertService?.start();\n await this.registrar.handle(_constants_js__WEBPACK_IMPORTED_MODULE_9__.RELAY_V2_HOP_CODEC, (data) => {\n void this.onHop(data).catch(err => {\n log.error(err);\n });\n }, {\n maxInboundStreams: this.maxInboundHopStreams,\n maxOutboundStreams: this.maxOutboundHopStreams\n });\n this.reservationStore.start();\n this.started = true;\n }\n /**\n * Stop Relay service\n */\n async stop() {\n this.advertService?.stop();\n this.reservationStore.stop();\n this.shutdownController.abort();\n await this.registrar.unhandle(_constants_js__WEBPACK_IMPORTED_MODULE_9__.RELAY_V2_HOP_CODEC);\n this.started = false;\n }\n async onHop({ connection, stream }) {\n log('received circuit v2 hop protocol stream from %s', connection.remotePeer);\n const hopTimeoutPromise = (0,p_defer__WEBPACK_IMPORTED_MODULE_7__[\"default\"])();\n const timeout = setTimeout(() => {\n hopTimeoutPromise.reject('timed out');\n }, this.hopTimeout);\n const pbstr = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_6__.pbStream)(stream);\n try {\n const request = await Promise.race([\n pbstr.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage).read(),\n hopTimeoutPromise.promise\n ]);\n if (request?.type == null) {\n throw new Error('request was invalid, could not read from stream');\n }\n log('received', request.type);\n await Promise.race([\n this.handleHopProtocol({\n connection,\n stream: pbstr,\n request\n }),\n hopTimeoutPromise.promise\n ]);\n }\n catch (err) {\n log.error('error while handling hop', err);\n pbstr.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage).write({\n type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS,\n status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.MALFORMED_MESSAGE\n });\n stream.abort(err);\n }\n finally {\n clearTimeout(timeout);\n }\n }\n async handleHopProtocol({ stream, request, connection }) {\n log('received hop message');\n switch (request.type) {\n case _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.RESERVE:\n await this.handleReserve({ stream, request, connection });\n break;\n case _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.CONNECT:\n await this.handleConnect({ stream, request, connection });\n break;\n default: {\n log.error('invalid hop request type %s via peer %s', request.type, connection.remotePeer);\n stream.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage).write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.UNEXPECTED_MESSAGE });\n }\n }\n }\n async handleReserve({ stream, request, connection }) {\n const hopstr = stream.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage);\n log('hop reserve request from %s', connection.remotePeer);\n if (isRelayAddr(connection.remoteAddr)) {\n log.error('relay reservation over circuit connection denied for peer: %p', connection.remotePeer);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.PERMISSION_DENIED });\n return;\n }\n if ((await this.connectionGater.denyInboundRelayReservation?.(connection.remotePeer)) === true) {\n log.error('reservation for %p denied by connection gater', connection.remotePeer);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.PERMISSION_DENIED });\n return;\n }\n const result = this.reservationStore.reserve(connection.remotePeer, connection.remoteAddr);\n if (result.status !== _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.OK) {\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: result.status });\n return;\n }\n try {\n // tag relay target peer\n // result.expire is non-null if `ReservationStore.reserve` returns with status == OK\n if (result.expire != null) {\n const ttl = (result.expire * 1000) - Date.now();\n await this.peerStore.merge(connection.remotePeer, {\n tags: {\n [_constants_js__WEBPACK_IMPORTED_MODULE_9__.RELAY_SOURCE_TAG]: { value: 1, ttl }\n }\n });\n }\n hopstr.write({\n type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS,\n status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.OK,\n reservation: await this.makeReservation(connection.remotePeer, BigInt(result.expire ?? 0)),\n limit: this.reservationStore.get(connection.remotePeer)?.limit\n });\n log('sent confirmation response to %s', connection.remotePeer);\n }\n catch (err) {\n log.error('failed to send confirmation response to %p', connection.remotePeer, err);\n this.reservationStore.removeReservation(connection.remotePeer);\n }\n }\n async makeReservation(remotePeer, expire) {\n const addrs = [];\n for (const relayAddr of this.addressManager.getAddresses()) {\n if (relayAddr.toString().includes('/p2p-circuit')) {\n continue;\n }\n addrs.push(relayAddr.bytes);\n }\n const voucher = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.RecordEnvelope.seal(new _reservation_voucher_js__WEBPACK_IMPORTED_MODULE_14__.ReservationVoucherRecord({\n peer: remotePeer,\n relay: this.peerId,\n expiration: Number(expire)\n }), this.peerId);\n return {\n addrs,\n expire,\n voucher: voucher.marshal()\n };\n }\n async handleConnect({ stream, request, connection }) {\n const hopstr = stream.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage);\n if (isRelayAddr(connection.remoteAddr)) {\n log.error('relay reservation over circuit connection denied for peer: %p', connection.remotePeer);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.PERMISSION_DENIED });\n return;\n }\n log('hop connect request from %s', connection.remotePeer);\n let dstPeer;\n try {\n if (request.peer == null) {\n log.error('no peer info in hop connect request');\n throw new Error('no peer info in request');\n }\n request.peer.addrs.forEach(_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr);\n dstPeer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromBytes)(request.peer.id);\n }\n catch (err) {\n log.error('invalid hop connect request via peer %p %s', connection.remotePeer, err);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.MALFORMED_MESSAGE });\n return;\n }\n if (!this.reservationStore.hasReservation(dstPeer)) {\n log.error('hop connect denied for destination peer %p not having a reservation for %p with status %s', dstPeer, connection.remotePeer, _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.NO_RESERVATION);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.NO_RESERVATION });\n return;\n }\n if ((await this.connectionGater.denyOutboundRelayedConnection?.(connection.remotePeer, dstPeer)) === true) {\n log.error('hop connect for %p to %p denied by connection gater', connection.remotePeer, dstPeer);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.PERMISSION_DENIED });\n return;\n }\n const connections = this.connectionManager.getConnections(dstPeer);\n if (connections.length === 0) {\n log('hop connect denied for destination peer %p not having a connection for %p as there is no destination connection', dstPeer, connection.remotePeer);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.NO_RESERVATION });\n return;\n }\n const destinationConnection = connections[0];\n const destinationStream = await this.stopHop({\n connection: destinationConnection,\n request: {\n type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.StopMessage.Type.CONNECT,\n peer: {\n id: connection.remotePeer.toBytes(),\n addrs: []\n }\n }\n });\n if (destinationStream == null) {\n log.error('failed to open stream to destination peer %s', destinationConnection?.remotePeer);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.CONNECTION_FAILED });\n return;\n }\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.HopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.OK });\n const sourceStream = stream.unwrap();\n log('connection from %p to %p established - merging streans', connection.remotePeer, dstPeer);\n const limit = this.reservationStore.get(dstPeer)?.limit;\n // Short circuit the two streams to create the relayed connection\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_11__.createLimitedRelay)(sourceStream, destinationStream, this.shutdownController.signal, limit);\n }\n /**\n * Send a STOP request to the target peer that the dialing peer wants to contact\n */\n async stopHop({ connection, request }) {\n log('starting circuit relay v2 stop request to %s', connection.remotePeer);\n const stream = await connection.newStream([_constants_js__WEBPACK_IMPORTED_MODULE_9__.RELAY_V2_STOP_CODEC], {\n maxOutboundStreams: this.maxOutboundStopStreams\n });\n const pbstr = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_6__.pbStream)(stream);\n const stopstr = pbstr.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_10__.StopMessage);\n stopstr.write(request);\n let response;\n try {\n response = await stopstr.read();\n }\n catch (err) {\n log.error('error parsing stop message response from %s', connection.remotePeer);\n }\n if (response == null) {\n log.error('could not read response from %s', connection.remotePeer);\n stream.close();\n return;\n }\n if (response.status === _pb_index_js__WEBPACK_IMPORTED_MODULE_10__.Status.OK) {\n log('stop request to %s was successful', connection.remotePeer);\n return pbstr.unwrap();\n }\n log('stop request failed with code %d', response.status);\n stream.close();\n }\n get reservations() {\n return this.reservationStore.reservations;\n }\n}\nfunction circuitRelayServer(init = {}) {\n return (components) => {\n return new CircuitRelayServer(components, init);\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/server/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/server/reservation-store.js": +/*!********************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/server/reservation-store.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ReservationStore: () => (/* binding */ ReservationStore)\n/* harmony export */ });\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n/* harmony import */ var _pb_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../pb/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/pb/index.js\");\n\n\n\nclass ReservationStore {\n reservations = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_0__.PeerMap();\n _started = false;\n interval;\n maxReservations;\n reservationClearInterval;\n applyDefaultLimit;\n reservationTtl;\n defaultDurationLimit;\n defaultDataLimit;\n constructor(options = {}) {\n this.maxReservations = options.maxReservations ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_MAX_RESERVATION_STORE_SIZE;\n this.reservationClearInterval = options.reservationClearInterval ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL;\n this.applyDefaultLimit = options.applyDefaultLimit !== false;\n this.reservationTtl = options.reservationTtl ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_MAX_RESERVATION_TTL;\n this.defaultDurationLimit = options.defaultDurationLimit ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_DURATION_LIMIT;\n this.defaultDataLimit = options.defaultDataLimit ?? _constants_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_DATA_LIMIT;\n }\n isStarted() {\n return this._started;\n }\n start() {\n if (this._started) {\n return;\n }\n this._started = true;\n this.interval = setInterval(() => {\n const now = (new Date()).getTime();\n this.reservations.forEach((r, k) => {\n if (r.expire.getTime() < now) {\n this.reservations.delete(k);\n }\n });\n }, this.reservationClearInterval);\n }\n stop() {\n clearInterval(this.interval);\n }\n reserve(peer, addr, limit) {\n if (this.reservations.size >= this.maxReservations && !this.reservations.has(peer)) {\n return { status: _pb_index_js__WEBPACK_IMPORTED_MODULE_2__.Status.RESERVATION_REFUSED };\n }\n const expire = new Date(Date.now() + this.reservationTtl);\n let checkedLimit;\n if (this.applyDefaultLimit) {\n checkedLimit = limit ?? { data: this.defaultDataLimit, duration: this.defaultDurationLimit };\n }\n this.reservations.set(peer, { addr, expire, limit: checkedLimit });\n // return expiry time in seconds\n return { status: _pb_index_js__WEBPACK_IMPORTED_MODULE_2__.Status.OK, expire: Math.round(expire.getTime() / 1000) };\n }\n removeReservation(peer) {\n this.reservations.delete(peer);\n }\n hasReservation(dst) {\n return this.reservations.has(dst);\n }\n get(peer) {\n return this.reservations.get(peer);\n }\n}\n//# sourceMappingURL=reservation-store.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/server/reservation-store.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/server/reservation-voucher.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/server/reservation-voucher.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ReservationVoucherRecord: () => (/* binding */ ReservationVoucherRecord)\n/* harmony export */ });\n/* harmony import */ var _pb_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../pb/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/pb/index.js\");\n\nclass ReservationVoucherRecord {\n domain = 'libp2p-relay-rsvp';\n codec = new Uint8Array([0x03, 0x02]);\n relay;\n peer;\n expiration;\n constructor({ relay, peer, expiration }) {\n this.relay = relay;\n this.peer = peer;\n this.expiration = expiration;\n }\n marshal() {\n return _pb_index_js__WEBPACK_IMPORTED_MODULE_0__.ReservationVoucher.encode({\n relay: this.relay.toBytes(),\n peer: this.peer.toBytes(),\n expiration: BigInt(this.expiration)\n });\n }\n equals(other) {\n if (!(other instanceof ReservationVoucherRecord)) {\n return false;\n }\n if (!this.peer.equals(other.peer)) {\n return false;\n }\n if (!this.relay.equals(other.relay)) {\n return false;\n }\n if (this.expiration !== other.expiration) {\n return false;\n }\n return true;\n }\n}\n//# sourceMappingURL=reservation-voucher.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/server/reservation-voucher.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/transport/discovery.js": +/*!***************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/transport/discovery.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RelayDiscovery: () => (/* binding */ RelayDiscovery)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_topology__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/topology */ \"./node_modules/@libp2p/topology/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils.js */ \"./node_modules/libp2p/dist/src/circuit-relay/utils.js\");\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:circuit-relay:discover-relays');\n/**\n * ReservationManager automatically makes a circuit v2 reservation on any connected\n * peers that support the circuit v2 HOP protocol.\n */\nclass RelayDiscovery extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter {\n peerId;\n peerStore;\n contentRouting;\n registrar;\n started;\n topologyId;\n constructor(components) {\n super();\n this.started = false;\n this.peerId = components.peerId;\n this.peerStore = components.peerStore;\n this.contentRouting = components.contentRouting;\n this.registrar = components.registrar;\n }\n isStarted() {\n return this.started;\n }\n async start() {\n // register a topology listener for when new peers are encountered\n // that support the hop protocol\n this.topologyId = await this.registrar.register(_constants_js__WEBPACK_IMPORTED_MODULE_3__.RELAY_V2_HOP_CODEC, (0,_libp2p_topology__WEBPACK_IMPORTED_MODULE_2__.createTopology)({\n onConnect: (peerId) => {\n this.safeDispatchEvent('relay:discover', { detail: peerId });\n }\n }));\n void this.discover()\n .catch(err => {\n log.error('error listening on relays', err);\n });\n this.started = true;\n }\n stop() {\n if (this.topologyId != null) {\n this.registrar.unregister(this.topologyId);\n }\n this.started = false;\n }\n /**\n * Try to listen on available hop relay connections.\n * The following order will happen while we do not have enough relays:\n *\n * 1. Check the metadata store for known relays, try to listen on the ones we are already connected\n * 2. Dial and try to listen on the peers we know that support hop but are not connected\n * 3. Search the network\n */\n async discover() {\n log('searching peer store for relays');\n const peers = (await this.peerStore.all({\n filters: [\n // filter by a list of peers supporting RELAY_V2_HOP and ones we are not listening on\n (peer) => {\n return peer.protocols.includes(_constants_js__WEBPACK_IMPORTED_MODULE_3__.RELAY_V2_HOP_CODEC);\n }\n ],\n orders: [\n () => Math.random() < 0.5 ? 1 : -1\n ]\n }));\n for (const peer of peers) {\n log('found relay peer %p in content peer store', peer.id);\n this.safeDispatchEvent('relay:discover', { detail: peer.id });\n }\n log('found %d relay peers in peer store', peers.length);\n try {\n log('searching content routing for relays');\n const cid = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.namespaceToCid)(_constants_js__WEBPACK_IMPORTED_MODULE_3__.RELAY_RENDEZVOUS_NS);\n let found = 0;\n for await (const provider of this.contentRouting.findProviders(cid)) {\n if (provider.multiaddrs.length > 0 && !provider.id.equals(this.peerId)) {\n const peerId = provider.id;\n found++;\n await this.peerStore.merge(peerId, {\n multiaddrs: provider.multiaddrs\n });\n log('found relay peer %p in content routing', peerId);\n this.safeDispatchEvent('relay:discover', { detail: peerId });\n }\n }\n log('found %d relay peers in content routing', found);\n }\n catch (err) {\n log.error('failed when finding relays on the network', err);\n }\n }\n}\n//# sourceMappingURL=discovery.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/transport/discovery.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/transport/index.js": +/*!***********************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/transport/index.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ circuitRelayTransport: () => (/* binding */ circuitRelayTransport)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-transport */ \"./node_modules/@libp2p/interface-transport/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_utils_stream_to_ma_conn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/utils/stream-to-ma-conn */ \"./node_modules/@libp2p/utils/dist/src/stream-to-ma-conn.js\");\n/* harmony import */ var _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @multiformats/mafmt */ \"./node_modules/@multiformats/mafmt/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var it_pb_stream__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! it-pb-stream */ \"./node_modules/it-pb-stream/dist/src/index.js\");\n/* harmony import */ var _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../connection-manager/constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n/* harmony import */ var _pb_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../pb/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/pb/index.js\");\n/* harmony import */ var _discovery_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./discovery.js */ \"./node_modules/libp2p/dist/src/circuit-relay/transport/discovery.js\");\n/* harmony import */ var _listener_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./listener.js */ \"./node_modules/libp2p/dist/src/circuit-relay/transport/listener.js\");\n/* harmony import */ var _reservation_store_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./reservation-store.js */ \"./node_modules/libp2p/dist/src/circuit-relay/transport/reservation-store.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:circuit-relay:transport');\nconst isValidStop = (request) => {\n if (request.peer == null) {\n return false;\n }\n try {\n request.peer.addrs.forEach(_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_6__.multiaddr);\n }\n catch {\n return false;\n }\n return true;\n};\nconst defaults = {\n maxInboundStopStreams: _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__.MAX_CONNECTIONS,\n maxOutboundStopStreams: _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__.MAX_CONNECTIONS\n};\nclass CircuitRelayTransport {\n discovery;\n registrar;\n peerStore;\n connectionManager;\n peerId;\n upgrader;\n addressManager;\n connectionGater;\n reservationStore;\n maxInboundStopStreams;\n maxOutboundStopStreams;\n started;\n constructor(components, init) {\n this.registrar = components.registrar;\n this.peerStore = components.peerStore;\n this.connectionManager = components.connectionManager;\n this.peerId = components.peerId;\n this.upgrader = components.upgrader;\n this.addressManager = components.addressManager;\n this.connectionGater = components.connectionGater;\n this.maxInboundStopStreams = init.maxInboundStopStreams ?? defaults.maxInboundStopStreams;\n this.maxOutboundStopStreams = init.maxOutboundStopStreams ?? defaults.maxOutboundStopStreams;\n if (init.discoverRelays != null && init.discoverRelays > 0) {\n this.discovery = new _discovery_js__WEBPACK_IMPORTED_MODULE_12__.RelayDiscovery(components);\n this.discovery.addEventListener('relay:discover', (evt) => {\n this.reservationStore.addRelay(evt.detail, 'discovered')\n .catch(err => {\n log.error('could not add discovered relay %p', evt.detail, err);\n });\n });\n }\n this.reservationStore = new _reservation_store_js__WEBPACK_IMPORTED_MODULE_14__.ReservationStore(components, init);\n this.reservationStore.addEventListener('relay:not-enough-relays', () => {\n this.discovery?.discover()\n .catch(err => {\n log.error('could not discover relays', err);\n });\n });\n this.started = false;\n }\n isStarted() {\n return this.started;\n }\n async start() {\n await this.reservationStore.start();\n await this.discovery?.start();\n await this.registrar.handle(_constants_js__WEBPACK_IMPORTED_MODULE_10__.RELAY_V2_STOP_CODEC, (data) => {\n void this.onStop(data).catch(err => {\n log.error(err);\n });\n }, {\n maxInboundStreams: this.maxInboundStopStreams,\n maxOutboundStreams: this.maxOutboundStopStreams\n });\n this.started = true;\n }\n async stop() {\n this.discovery?.stop();\n await this.reservationStore.stop();\n await this.registrar.unhandle(_constants_js__WEBPACK_IMPORTED_MODULE_10__.RELAY_V2_STOP_CODEC);\n this.started = false;\n }\n [_libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.symbol] = true;\n [Symbol.toStringTag] = 'libp2p/circuit-relay-v2';\n /**\n * Dial a peer over a relay\n */\n async dial(ma, options = {}) {\n if (ma.protoCodes().filter(code => code === _constants_js__WEBPACK_IMPORTED_MODULE_10__.CIRCUIT_PROTO_CODE).length !== 1) {\n const errMsg = 'Invalid circuit relay address';\n log.error(errMsg, ma);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(errMsg, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_RELAYED_DIAL);\n }\n // Check the multiaddr to see if it contains a relay and a destination peer\n const addrs = ma.toString().split('/p2p-circuit');\n const relayAddr = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_6__.multiaddr)(addrs[0]);\n const destinationAddr = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_6__.multiaddr)(addrs[addrs.length - 1]);\n const relayId = relayAddr.getPeerId();\n const destinationId = destinationAddr.getPeerId();\n if (relayId == null || destinationId == null) {\n const errMsg = `Circuit relay dial to ${ma.toString()} failed as address did not have peer ids`;\n log.error(errMsg);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(errMsg, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_RELAYED_DIAL);\n }\n const relayPeer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString)(relayId);\n const destinationPeer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString)(destinationId);\n let disconnectOnFailure = false;\n const relayConnections = this.connectionManager.getConnections(relayPeer);\n let relayConnection = relayConnections[0];\n if (relayConnection == null) {\n await this.peerStore.merge(relayPeer, {\n multiaddrs: [relayAddr]\n });\n relayConnection = await this.connectionManager.openConnection(relayPeer, options);\n disconnectOnFailure = true;\n }\n let stream;\n try {\n stream = await relayConnection.newStream([_constants_js__WEBPACK_IMPORTED_MODULE_10__.RELAY_V2_HOP_CODEC]);\n return await this.connectV2({\n stream,\n connection: relayConnection,\n destinationPeer,\n destinationAddr,\n relayAddr,\n ma,\n disconnectOnFailure\n });\n }\n catch (err) {\n log.error(`Circuit relay dial to destination ${destinationPeer.toString()} via relay ${relayPeer.toString()} failed`, err);\n if (stream != null) {\n stream.abort(err);\n }\n disconnectOnFailure && await relayConnection.close();\n throw err;\n }\n }\n async connectV2({ stream, connection, destinationPeer, destinationAddr, relayAddr, ma, disconnectOnFailure }) {\n try {\n const pbstr = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_7__.pbStream)(stream);\n const hopstr = pbstr.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_11__.HopMessage);\n hopstr.write({\n type: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.HopMessage.Type.CONNECT,\n peer: {\n id: destinationPeer.toBytes(),\n addrs: [(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_6__.multiaddr)(destinationAddr).bytes]\n }\n });\n const status = await hopstr.read();\n if (status.status !== _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.Status.OK) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`failed to connect via relay with status ${status?.status?.toString() ?? 'undefined'}`, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_HOP_REQUEST_FAILED);\n }\n // TODO: do something with limit and transient connection\n const maConn = (0,_libp2p_utils_stream_to_ma_conn__WEBPACK_IMPORTED_MODULE_4__.streamToMaConnection)({\n stream: pbstr.unwrap(),\n remoteAddr: ma,\n localAddr: relayAddr.encapsulate(`/p2p-circuit/p2p/${this.peerId.toString()}`)\n });\n log('new outbound connection %s', maConn.remoteAddr);\n return await this.upgrader.upgradeOutbound(maConn);\n }\n catch (err) {\n log.error(`Circuit relay dial to destination ${destinationPeer.toString()} via relay ${connection.remotePeer.toString()} failed`, err);\n disconnectOnFailure && await connection.close();\n throw err;\n }\n }\n /**\n * Create a listener\n */\n createListener(options) {\n return (0,_listener_js__WEBPACK_IMPORTED_MODULE_13__.createListener)({\n connectionManager: this.connectionManager,\n relayStore: this.reservationStore\n });\n }\n /**\n * Filter check for all Multiaddrs that this transport can dial on\n *\n * @param {Multiaddr[]} multiaddrs\n * @returns {Multiaddr[]}\n */\n filter(multiaddrs) {\n multiaddrs = Array.isArray(multiaddrs) ? multiaddrs : [multiaddrs];\n return multiaddrs.filter((ma) => {\n return _multiformats_mafmt__WEBPACK_IMPORTED_MODULE_5__.Circuit.matches(ma);\n });\n }\n /**\n * An incoming STOP request means a remote peer wants to dial us via a relay\n */\n async onStop({ connection, stream }) {\n const pbstr = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_7__.pbStream)(stream);\n const request = await pbstr.readPB(_pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage);\n log('received circuit v2 stop protocol request from %s', connection.remotePeer);\n if (request?.type === undefined) {\n return;\n }\n const stopstr = pbstr.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage);\n log('new circuit relay v2 stop stream from %s', connection.remotePeer);\n // Validate the STOP request has the required input\n if (request.type !== _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage.Type.CONNECT) {\n log.error('invalid stop connect request via peer %s', connection.remotePeer);\n stopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.Status.UNEXPECTED_MESSAGE });\n return;\n }\n if (!isValidStop(request)) {\n log.error('invalid stop connect request via peer %s', connection.remotePeer);\n stopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.Status.MALFORMED_MESSAGE });\n return;\n }\n const remotePeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromBytes)(request.peer.id);\n if ((await this.connectionGater.denyInboundRelayedConnection?.(connection.remotePeer, remotePeerId)) === true) {\n stopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.Status.PERMISSION_DENIED });\n return;\n }\n stopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.StopMessage.Type.STATUS, status: _pb_index_js__WEBPACK_IMPORTED_MODULE_11__.Status.OK });\n const remoteAddr = connection.remoteAddr.encapsulate(`/p2p-circuit/p2p/${remotePeerId.toString()}`);\n const localAddr = this.addressManager.getAddresses()[0];\n const maConn = (0,_libp2p_utils_stream_to_ma_conn__WEBPACK_IMPORTED_MODULE_4__.streamToMaConnection)({\n stream: pbstr.unwrap(),\n remoteAddr,\n localAddr\n });\n log('new inbound connection %s', maConn.remoteAddr);\n await this.upgrader.upgradeInbound(maConn);\n log('%s connection %s upgraded', 'inbound', maConn.remoteAddr);\n }\n}\nfunction circuitRelayTransport(init = {}) {\n return (components) => {\n return new CircuitRelayTransport(components, init);\n };\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/transport/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/transport/listener.js": +/*!**************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/transport/listener.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createListener: () => (/* binding */ createListener)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:circuit-relay:transport:listener');\nclass CircuitRelayTransportListener extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter {\n connectionManager;\n relayStore;\n listeningAddrs;\n constructor(components) {\n super();\n this.connectionManager = components.connectionManager;\n this.relayStore = components.relayStore;\n this.listeningAddrs = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_3__.PeerMap();\n // remove listening addrs when a relay is removed\n this.relayStore.addEventListener('relay:removed', (evt) => {\n this.#removeRelayPeer(evt.detail);\n });\n }\n async listen(addr) {\n log('listen on %s', addr);\n const relayPeerStr = addr.getPeerId();\n let relayConn;\n // check if we already have a connection to the relay\n if (relayPeerStr != null) {\n const relayPeer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromString)(relayPeerStr);\n const connections = this.connectionManager.getConnectionsMap().get(relayPeer) ?? [];\n if (connections.length > 0) {\n relayConn = connections[0];\n }\n }\n // open a new connection as we don't already have one\n if (relayConn == null) {\n const addrString = addr.toString().split('/p2p-circuit').find(a => a !== '');\n const ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(addrString);\n relayConn = await this.connectionManager.openConnection(ma);\n }\n if (!this.relayStore.hasReservation(relayConn.remotePeer)) {\n // addRelay calls transportManager.listen which calls this listen method\n await this.relayStore.addRelay(relayConn.remotePeer, 'configured');\n return;\n }\n const reservation = this.relayStore.getReservation(relayConn.remotePeer);\n if (reservation == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Did not have reservation after making reservation', 'ERR_NO_RESERVATION');\n }\n if (this.listeningAddrs.has(relayConn.remotePeer)) {\n log('already listening on relay %p', relayConn.remotePeer);\n return;\n }\n // add all addresses from the relay reservation\n this.listeningAddrs.set(relayConn.remotePeer, reservation.addrs.map(buf => {\n return (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(buf).encapsulate('/p2p-circuit');\n }));\n this.safeDispatchEvent('listening', {});\n }\n getAddrs() {\n return [...this.listeningAddrs.values()].flat();\n }\n async close() {\n }\n #removeRelayPeer(peerId) {\n const had = this.listeningAddrs.has(peerId);\n this.listeningAddrs.delete(peerId);\n if (had) {\n // Announce listen addresses change\n this.safeDispatchEvent('close', {});\n }\n }\n}\nfunction createListener(options) {\n return new CircuitRelayTransportListener(options);\n}\n//# sourceMappingURL=listener.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/transport/listener.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/transport/reservation-store.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/transport/reservation-store.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ReservationStore: () => (/* binding */ ReservationStore)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var it_pb_stream__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-pb-stream */ \"./node_modules/it-pb-stream/dist/src/index.js\");\n/* harmony import */ var _utils_peer_job_queue_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/peer-job-queue.js */ \"./node_modules/libp2p/dist/src/utils/peer-job-queue.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n/* harmony import */ var _pb_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../pb/index.js */ \"./node_modules/libp2p/dist/src/circuit-relay/pb/index.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils.js */ \"./node_modules/libp2p/dist/src/circuit-relay/utils.js\");\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:circuit-relay:transport:reservation-store');\n// allow refreshing a relay reservation if it will expire in the next 10 minutes\nconst REFRESH_WINDOW = (60 * 1000) * 10;\n// try to refresh relay reservations 5 minutes before expiry\nconst REFRESH_TIMEOUT = (60 * 1000) * 5;\n// minimum duration before which a reservation must not be refreshed\nconst REFRESH_TIMEOUT_MIN = 30 * 1000;\nclass ReservationStore extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter {\n peerId;\n connectionManager;\n transportManager;\n peerStore;\n events;\n reserveQueue;\n reservations;\n maxDiscoveredRelays;\n maxReservationQueueLength;\n started;\n constructor(components, init) {\n super();\n this.peerId = components.peerId;\n this.connectionManager = components.connectionManager;\n this.transportManager = components.transportManager;\n this.peerStore = components.peerStore;\n this.events = components.events;\n this.reservations = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_2__.PeerMap();\n this.maxDiscoveredRelays = init?.discoverRelays ?? 0;\n this.maxReservationQueueLength = init?.maxReservationQueueLength ?? 100;\n this.started = false;\n // ensure we don't listen on multiple relays simultaneously\n this.reserveQueue = new _utils_peer_job_queue_js__WEBPACK_IMPORTED_MODULE_5__.PeerJobQueue({\n concurrency: init?.reservationConcurrency ?? _constants_js__WEBPACK_IMPORTED_MODULE_6__.DEFAULT_RESERVATION_CONCURRENCY\n });\n // When a peer disconnects, if we had a reservation on that peer\n // remove the reservation and multiaddr and maybe trigger search\n // for new relays\n this.events.addEventListener('peer:disconnect', (evt) => {\n this.#removeRelay(evt.detail);\n });\n }\n isStarted() {\n return this.started;\n }\n async start() {\n this.started = true;\n }\n async stop() {\n this.reservations.forEach(({ timeout }) => {\n clearTimeout(timeout);\n });\n this.reservations.clear();\n this.started = true;\n }\n /**\n * If the number of current relays is beneath the configured `maxReservations`\n * value, and the passed peer id is not our own, and we have a non-relayed connection\n * to the remote, and the remote peer speaks the hop protocol, try to reserve a slot\n * on the remote peer\n */\n async addRelay(peerId, type) {\n if (this.peerId.equals(peerId)) {\n log('not trying to use self as relay');\n return;\n }\n if (this.reserveQueue.size > this.maxReservationQueueLength) {\n log('not adding relay as the queue is full');\n return;\n }\n if (this.reserveQueue.hasJob(peerId)) {\n log('relay peer is already in the reservation queue');\n return;\n }\n log('add relay %p', peerId);\n await this.reserveQueue.add(async () => {\n try {\n // allow refresh of an existing reservation if it is about to expire\n const existingReservation = this.reservations.get(peerId);\n if (existingReservation != null) {\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_8__.getExpirationMilliseconds)(existingReservation.reservation.expire) > REFRESH_WINDOW) {\n log('already have reservation on relay peer %p and it expires in more than 10 minutes', peerId);\n return;\n }\n clearTimeout(existingReservation.timeout);\n this.reservations.delete(peerId);\n }\n if (type === 'discovered' && [...this.reservations.values()].reduce((acc, curr) => {\n if (curr.type === 'discovered') {\n acc++;\n }\n return acc;\n }, 0) >= this.maxDiscoveredRelays) {\n log('already have enough discovered relays');\n return;\n }\n const connection = await this.connectionManager.openConnection(peerId);\n if (connection.remoteAddr.protoNames().includes('p2p-circuit')) {\n log('not creating reservation over relayed connection');\n return;\n }\n const reservation = await this.#createReservation(connection);\n log('created reservation on relay peer %p', peerId);\n const expiration = (0,_utils_js__WEBPACK_IMPORTED_MODULE_8__.getExpirationMilliseconds)(reservation.expire);\n // sets a lower bound on the timeout, and also don't let it go over\n // 2^31 - 1 (setTimeout will only accept signed 32 bit integers)\n const timeoutDuration = Math.min(Math.max(expiration - REFRESH_TIMEOUT, REFRESH_TIMEOUT_MIN), Math.pow(2, 31) - 1);\n const timeout = setTimeout(() => {\n this.addRelay(peerId, type).catch(err => {\n log.error('could not refresh reservation to relay %p', peerId, err);\n });\n }, timeoutDuration);\n // we've managed to create a reservation successfully\n this.reservations.set(peerId, {\n timeout,\n reservation,\n type\n });\n // ensure we don't close the connection to the relay\n await this.peerStore.merge(peerId, {\n tags: {\n [_constants_js__WEBPACK_IMPORTED_MODULE_6__.RELAY_TAG]: {\n value: 1,\n ttl: expiration\n }\n }\n });\n // listen on multiaddr that only the circuit transport is listening for\n await this.transportManager.listen([(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_3__.multiaddr)(`/p2p/${peerId.toString()}/p2p-circuit`)]);\n }\n catch (err) {\n log.error('could not reserve slot on %p', peerId, err);\n // if listening failed, remove the reservation\n this.reservations.delete(peerId);\n }\n }, {\n peerId\n });\n }\n hasReservation(peerId) {\n return this.reservations.has(peerId);\n }\n getReservation(peerId) {\n return this.reservations.get(peerId)?.reservation;\n }\n async #createReservation(connection) {\n log('requesting reservation from %s', connection.remotePeer);\n const stream = await connection.newStream(_constants_js__WEBPACK_IMPORTED_MODULE_6__.RELAY_V2_HOP_CODEC);\n const pbstr = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_4__.pbStream)(stream);\n const hopstr = pbstr.pb(_pb_index_js__WEBPACK_IMPORTED_MODULE_7__.HopMessage);\n hopstr.write({ type: _pb_index_js__WEBPACK_IMPORTED_MODULE_7__.HopMessage.Type.RESERVE });\n let response;\n try {\n response = await hopstr.read();\n }\n catch (err) {\n log.error('error parsing reserve message response from %p because', connection.remotePeer, err);\n throw err;\n }\n finally {\n stream.close();\n }\n if (response.status === _pb_index_js__WEBPACK_IMPORTED_MODULE_7__.Status.OK && (response.reservation != null)) {\n return response.reservation;\n }\n const errMsg = `reservation failed with status ${response.status ?? 'undefined'}`;\n log.error(errMsg);\n throw new Error(errMsg);\n }\n /**\n * Remove listen relay\n */\n #removeRelay(peerId) {\n const existingReservation = this.reservations.get(peerId);\n if (existingReservation == null) {\n return;\n }\n log('connection to relay %p closed, removing reservation from local store', peerId);\n clearTimeout(existingReservation.timeout);\n this.reservations.delete(peerId);\n this.safeDispatchEvent('relay:removed', { detail: peerId });\n if (this.reservations.size < this.maxDiscoveredRelays) {\n log('not enough relays %d/%d', this.reservations.size, this.maxDiscoveredRelays);\n this.safeDispatchEvent('relay:not-enough-relays', {});\n }\n }\n}\n//# sourceMappingURL=reservation-store.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/transport/reservation-store.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/circuit-relay/utils.js": +/*!*************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/circuit-relay/utils.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createLimitedRelay: () => (/* binding */ createLimitedRelay),\n/* harmony export */ getExpirationMilliseconds: () => (/* binding */ getExpirationMilliseconds),\n/* harmony export */ namespaceToCid: () => (/* binding */ namespaceToCid)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var multiformats_cid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multiformats/cid */ \"./node_modules/multiformats/src/cid.js\");\n/* harmony import */ var multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! multiformats/hashes/sha2 */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/circuit-relay/constants.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:circuit-relay:utils');\nasync function* countStreamBytes(source, limit) {\n for await (const buf of source) {\n const len = BigInt(buf.byteLength);\n if ((limit.remaining - len) < 0) {\n // this is a safe downcast since len is guarantee to be in the range for a number\n const remaining = Number(limit.remaining);\n limit.remaining = 0n;\n try {\n if (remaining !== 0) {\n yield buf.subarray(0, remaining);\n }\n }\n catch (err) {\n log.error(err);\n }\n throw new Error('data limit exceeded');\n }\n limit.remaining -= len;\n yield buf;\n }\n}\nconst doRelay = (src, dst, abortSignal, limit) => {\n function abortStreams(err) {\n src.abort(err);\n dst.abort(err);\n clearTimeout(timeout);\n }\n const abortController = new AbortController();\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_2__.anySignal)([abortSignal, abortController.signal]);\n const timeout = setTimeout(() => {\n abortController.abort();\n }, limit.duration);\n let srcDstFinished = false;\n let dstSrcFinished = false;\n const dataLimit = {\n remaining: limit.data\n };\n queueMicrotask(() => {\n void dst.sink(countStreamBytes((0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableSource)(src.source, signal, {\n abortMessage: 'duration limit exceeded'\n }), dataLimit))\n .catch(err => {\n log.error('error while relaying streams src -> dst', err);\n abortStreams(err);\n })\n .finally(() => {\n srcDstFinished = true;\n if (dstSrcFinished) {\n signal.clear();\n clearTimeout(timeout);\n }\n });\n });\n queueMicrotask(() => {\n void src.sink(countStreamBytes((0,abortable_iterator__WEBPACK_IMPORTED_MODULE_1__.abortableSource)(dst.source, signal, {\n abortMessage: 'duration limit exceeded'\n }), dataLimit))\n .catch(err => {\n log.error('error while relaying streams dst -> src', err);\n abortStreams(err);\n })\n .finally(() => {\n dstSrcFinished = true;\n if (srcDstFinished) {\n signal.clear();\n clearTimeout(timeout);\n }\n });\n });\n};\nfunction createLimitedRelay(source, destination, abortSignal, limit) {\n const dataLimit = limit?.data ?? BigInt(_constants_js__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_DATA_LIMIT);\n const durationLimit = limit?.duration ?? _constants_js__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_DURATION_LIMIT;\n doRelay(source, destination, abortSignal, {\n data: dataLimit,\n duration: durationLimit\n });\n}\n/**\n * Convert a namespace string into a cid\n */\nasync function namespaceToCid(namespace) {\n const bytes = new TextEncoder().encode(namespace);\n const hash = await multiformats_hashes_sha2__WEBPACK_IMPORTED_MODULE_4__.sha256.digest(bytes);\n return multiformats_cid__WEBPACK_IMPORTED_MODULE_3__.CID.createV0(hash);\n}\n/**\n * returns number of ms between now and expiration time\n */\nfunction getExpirationMilliseconds(expireTimeSeconds) {\n const expireTimeMillis = expireTimeSeconds * BigInt(1000);\n const currentTime = new Date().getTime();\n // downcast to number to use with setTimeout\n return Number(expireTimeMillis - BigInt(currentTime));\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/circuit-relay/utils.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/components.js": +/*!****************************************************!*\ + !*** ./node_modules/libp2p/dist/src/components.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaultComponents: () => (/* binding */ defaultComponents)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interfaces_startable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/startable */ \"./node_modules/@libp2p/interfaces/dist/src/startable.js\");\n\n\nclass DefaultComponents {\n components = {};\n _started = false;\n constructor(init = {}) {\n this.components = {};\n for (const [key, value] of Object.entries(init)) {\n this.components[key] = value;\n }\n }\n isStarted() {\n return this._started;\n }\n async _invokeStartableMethod(methodName) {\n await Promise.all(Object.values(this.components)\n .filter(obj => (0,_libp2p_interfaces_startable__WEBPACK_IMPORTED_MODULE_1__.isStartable)(obj))\n .map(async (startable) => {\n await startable[methodName]?.();\n }));\n }\n async beforeStart() {\n await this._invokeStartableMethod('beforeStart');\n }\n async start() {\n await this._invokeStartableMethod('start');\n this._started = true;\n }\n async afterStart() {\n await this._invokeStartableMethod('afterStart');\n }\n async beforeStop() {\n await this._invokeStartableMethod('beforeStop');\n }\n async stop() {\n await this._invokeStartableMethod('stop');\n this._started = false;\n }\n async afterStop() {\n await this._invokeStartableMethod('afterStop');\n }\n}\nconst OPTIONAL_SERVICES = [\n 'metrics',\n 'connectionProtector'\n];\nconst NON_SERVICE_PROPERTIES = [\n 'components',\n 'isStarted',\n 'beforeStart',\n 'start',\n 'afterStart',\n 'beforeStop',\n 'stop',\n 'afterStop',\n 'then',\n '_invokeStartableMethod'\n];\nfunction defaultComponents(init = {}) {\n const components = new DefaultComponents(init);\n const proxy = new Proxy(components, {\n get(target, prop, receiver) {\n if (typeof prop === 'string' && !NON_SERVICE_PROPERTIES.includes(prop)) {\n const service = components.components[prop];\n if (service == null && !OPTIONAL_SERVICES.includes(prop)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`${prop} not set`, 'ERR_SERVICE_MISSING');\n }\n return service;\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, value) {\n if (typeof prop === 'string') {\n components.components[prop] = value;\n }\n else {\n Reflect.set(target, prop, value);\n }\n return true;\n }\n });\n // @ts-expect-error component keys are proxied\n return proxy;\n}\n//# sourceMappingURL=components.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/components.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/config.js": +/*!************************************************!*\ + !*** ./node_modules/libp2p/dist/src/config.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ validateConfig: () => (/* binding */ validateConfig)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-transport */ \"./node_modules/@libp2p/interface-transport/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/utils/address-sort */ \"./node_modules/@libp2p/utils/dist/src/address-sort.js\");\n/* harmony import */ var _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @multiformats/multiaddr/resolvers */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js\");\n/* harmony import */ var merge_options__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! merge-options */ \"./node_modules/merge-options/index.mjs\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\n\nconst DefaultConfig = {\n addresses: {\n listen: [],\n announce: [],\n noAnnounce: [],\n announceFilter: (multiaddrs) => multiaddrs\n },\n connectionManager: {\n resolvers: {\n dnsaddr: _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_3__.dnsaddrResolver\n },\n addressSorter: _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_2__.publicAddressesFirst\n },\n transportManager: {\n faultTolerance: _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.FaultTolerance.FATAL_ALL\n }\n};\nfunction validateConfig(opts) {\n const resultingOptions = (0,merge_options__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(DefaultConfig, opts);\n if (resultingOptions.transports == null || resultingOptions.transports.length < 1) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_5__.messages.ERR_TRANSPORTS_REQUIRED, _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_TRANSPORTS_REQUIRED);\n }\n if (resultingOptions.connectionProtector === null && globalThis.process?.env?.LIBP2P_FORCE_PNET != null) { // eslint-disable-line no-undef\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_5__.messages.ERR_PROTECTOR_REQUIRED, _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_PROTECTOR_REQUIRED);\n }\n return resultingOptions;\n}\n//# sourceMappingURL=config.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/config.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/config/connection-gater.browser.js": +/*!*************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/config/connection-gater.browser.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ connectionGater: () => (/* binding */ connectionGater)\n/* harmony export */ });\n/* harmony import */ var private_ip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! private-ip */ \"./node_modules/private-ip/index.js\");\n\n/**\n * Returns a connection gater that disallows dialling private addresses by\n * default. Browsers are severely limited in their resource usage so don't\n * waste time trying to dial undiallable addresses.\n */\nfunction connectionGater(gater = {}) {\n return {\n denyDialPeer: async () => false,\n denyDialMultiaddr: async (multiaddr) => {\n const tuples = multiaddr.stringTuples();\n if (tuples[0][0] === 4 || tuples[0][0] === 41) {\n return Boolean((0,private_ip__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(`${tuples[0][1]}`));\n }\n return false;\n },\n denyInboundConnection: async () => false,\n denyOutboundConnection: async () => false,\n denyInboundEncryptedConnection: async () => false,\n denyOutboundEncryptedConnection: async () => false,\n denyInboundUpgradedConnection: async () => false,\n denyOutboundUpgradedConnection: async () => false,\n filterMultiaddrForPeer: async () => true,\n ...gater\n };\n}\n//# sourceMappingURL=connection-gater.browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/config/connection-gater.browser.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection-manager/auto-dial.js": +/*!**********************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection-manager/auto-dial.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AutoDial: () => (/* binding */ AutoDial)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _utils_peer_job_queue_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/peer-job-queue.js */ \"./node_modules/libp2p/dist/src/utils/peer-job-queue.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:connection-manager:auto-dial');\nconst defaultOptions = {\n minConnections: _constants_js__WEBPACK_IMPORTED_MODULE_3__.MIN_CONNECTIONS,\n maxQueueLength: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_MAX_QUEUE_LENGTH,\n autoDialConcurrency: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_CONCURRENCY,\n autoDialPriority: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_PRIORITY,\n autoDialInterval: _constants_js__WEBPACK_IMPORTED_MODULE_3__.AUTO_DIAL_INTERVAL\n};\nclass AutoDial {\n connectionManager;\n peerStore;\n queue;\n minConnections;\n autoDialPriority;\n autoDialIntervalMs;\n autoDialMaxQueueLength;\n autoDialInterval;\n started;\n running;\n /**\n * Proactively tries to connect to known peers stored in the PeerStore.\n * It will keep the number of connections below the upper limit and sort\n * the peers to connect based on whether we know their keys and protocols.\n */\n constructor(components, init) {\n this.connectionManager = components.connectionManager;\n this.peerStore = components.peerStore;\n this.minConnections = init.minConnections ?? defaultOptions.minConnections;\n this.autoDialPriority = init.autoDialPriority ?? defaultOptions.autoDialPriority;\n this.autoDialIntervalMs = init.autoDialInterval ?? defaultOptions.autoDialInterval;\n this.autoDialMaxQueueLength = init.maxQueueLength ?? defaultOptions.maxQueueLength;\n this.started = false;\n this.running = false;\n this.queue = new _utils_peer_job_queue_js__WEBPACK_IMPORTED_MODULE_2__.PeerJobQueue({\n concurrency: init.autoDialConcurrency ?? defaultOptions.autoDialConcurrency\n });\n this.queue.addListener('error', (err) => {\n log.error('error during auto-dial', err);\n });\n // check the min connection limit whenever a peer disconnects\n components.events.addEventListener('connection:close', () => {\n this.autoDial()\n .catch(err => {\n log.error(err);\n });\n });\n }\n isStarted() {\n return this.started;\n }\n start() {\n this.autoDialInterval = setTimeout(() => {\n this.autoDial()\n .catch(err => {\n log.error('error while autodialing', err);\n });\n }, this.autoDialIntervalMs);\n this.started = true;\n }\n afterStart() {\n this.autoDial()\n .catch(err => {\n log.error('error while autodialing', err);\n });\n }\n stop() {\n // clear the queue\n this.queue.clear();\n clearTimeout(this.autoDialInterval);\n this.started = false;\n this.running = false;\n }\n async autoDial() {\n if (!this.started) {\n return;\n }\n const connections = this.connectionManager.getConnectionsMap();\n const numConnections = connections.size;\n // Already has enough connections\n if (numConnections >= this.minConnections) {\n log.trace('have enough connections %d/%d', numConnections, this.minConnections);\n return;\n }\n if (this.queue.size > this.autoDialMaxQueueLength) {\n log('not enough connections %d/%d but auto dial queue is full', numConnections, this.minConnections);\n return;\n }\n if (this.running) {\n log('not enough connections %d/%d - but skipping autodial as it is already running', numConnections, this.minConnections);\n return;\n }\n this.running = true;\n log('not enough connections %d/%d - will dial peers to increase the number of connections', numConnections, this.minConnections);\n const dialQueue = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__.PeerSet(\n // @ts-expect-error boolean filter removes falsy peer IDs\n this.connectionManager.getDialQueue()\n .map(queue => queue.peerId)\n .filter(Boolean));\n // Sort peers on whether we know protocols or public keys for them\n const peers = await this.peerStore.all({\n filters: [\n // Remove some peers\n (peer) => {\n // Remove peers without addresses\n if (peer.addresses.length === 0) {\n log.trace('not autodialing %p because they have no addresses');\n return false;\n }\n // remove peers we are already connected to\n if (connections.has(peer.id)) {\n log.trace('not autodialing %p because they are already connected');\n return false;\n }\n // remove peers we are already dialling\n if (dialQueue.has(peer.id)) {\n log.trace('not autodialing %p because they are already being dialed');\n return false;\n }\n // remove peers already in the autodial queue\n if (this.queue.hasJob(peer.id)) {\n log.trace('not autodialing %p because they are already being autodialed');\n return false;\n }\n return true;\n }\n ]\n });\n // shuffle the peers - this is so peers with the same tag values will be\n // dialled in a different order each time\n const shuffledPeers = peers.sort(() => Math.random() > 0.5 ? 1 : -1);\n // Sort shuffled peers by tag value\n const peerValues = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__.PeerMap();\n for (const peer of shuffledPeers) {\n if (peerValues.has(peer.id)) {\n continue;\n }\n // sum all tag values\n peerValues.set(peer.id, [...peer.tags.values()].reduce((acc, curr) => {\n return acc + curr.value;\n }, 0));\n }\n // sort by value, highest to lowest\n const sortedPeers = shuffledPeers.sort((a, b) => {\n const peerAValue = peerValues.get(a.id) ?? 0;\n const peerBValue = peerValues.get(b.id) ?? 0;\n if (peerAValue > peerBValue) {\n return -1;\n }\n if (peerAValue < peerBValue) {\n return 1;\n }\n return 0;\n });\n log('selected %d/%d peers to dial', sortedPeers.length, peers.length);\n for (const peer of sortedPeers) {\n this.queue.add(async () => {\n const numConnections = this.connectionManager.getConnectionsMap().size;\n // Check to see if we still need to auto dial\n if (numConnections >= this.minConnections) {\n log('got enough connections now %d/%d', numConnections, this.minConnections);\n this.queue.clear();\n return;\n }\n log('connecting to a peerStore stored peer %p', peer.id);\n await this.connectionManager.openConnection(peer.id, {\n // @ts-expect-error needs adding to the ConnectionManager interface\n priority: this.autoDialPriority\n });\n }, {\n peerId: peer.id\n }).catch(err => {\n log.error('could not connect to peerStore stored peer', err);\n });\n }\n this.running = false;\n if (this.started) {\n this.autoDialInterval = setTimeout(() => {\n this.autoDial()\n .catch(err => {\n log.error('error while autodialing', err);\n });\n }, this.autoDialIntervalMs);\n }\n }\n}\n//# sourceMappingURL=auto-dial.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection-manager/auto-dial.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js": +/*!******************************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionPruner: () => (/* binding */ ConnectionPruner)\n/* harmony export */ });\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_0__.logger)('libp2p:connection-manager:connection-pruner');\nconst defaultOptions = {\n maxConnections: _constants_js__WEBPACK_IMPORTED_MODULE_2__.MAX_CONNECTIONS,\n allow: []\n};\n/**\n * If we go over the max connections limit, choose some connections to close\n */\nclass ConnectionPruner {\n maxConnections;\n connectionManager;\n peerStore;\n allow;\n events;\n constructor(components, init = {}) {\n this.maxConnections = init.maxConnections ?? defaultOptions.maxConnections;\n this.allow = init.allow ?? defaultOptions.allow;\n this.connectionManager = components.connectionManager;\n this.peerStore = components.peerStore;\n this.events = components.events;\n // check the max connection limit whenever a peer connects\n components.events.addEventListener('connection:open', () => {\n this.maybePruneConnections()\n .catch(err => {\n log.error(err);\n });\n });\n }\n /**\n * If we have more connections than our maximum, select some excess connections\n * to prune based on peer value\n */\n async maybePruneConnections() {\n const connections = this.connectionManager.getConnections();\n const numConnections = connections.length;\n const toPrune = Math.max(numConnections - this.maxConnections, 0);\n log('checking max connections limit %d/%d', numConnections, this.maxConnections);\n if (numConnections <= this.maxConnections) {\n return;\n }\n log('max connections limit exceeded %d/%d, pruning %d connection(s)', numConnections, this.maxConnections, toPrune);\n const peerValues = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_1__.PeerMap();\n // work out peer values\n for (const connection of connections) {\n const remotePeer = connection.remotePeer;\n if (peerValues.has(remotePeer)) {\n continue;\n }\n peerValues.set(remotePeer, 0);\n try {\n const peer = await this.peerStore.get(remotePeer);\n // sum all tag values\n peerValues.set(remotePeer, [...peer.tags.values()].reduce((acc, curr) => {\n return acc + curr.value;\n }, 0));\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n log.error('error loading peer tags', err);\n }\n }\n }\n // sort by value, lowest to highest\n const sortedConnections = connections.sort((a, b) => {\n const peerAValue = peerValues.get(a.remotePeer) ?? 0;\n const peerBValue = peerValues.get(b.remotePeer) ?? 0;\n if (peerAValue > peerBValue) {\n return 1;\n }\n if (peerAValue < peerBValue) {\n return -1;\n }\n // if the peers have an equal tag value then we want to close short-lived connections first\n const connectionALifespan = a.stat.timeline.open;\n const connectionBLifespan = b.stat.timeline.open;\n if (connectionALifespan < connectionBLifespan) {\n return 1;\n }\n if (connectionALifespan > connectionBLifespan) {\n return -1;\n }\n return 0;\n });\n // close some connections\n const toClose = [];\n for (const connection of sortedConnections) {\n log('too many connections open - closing a connection to %p', connection.remotePeer);\n // check allow list\n const connectionInAllowList = this.allow.some((ma) => {\n return connection.remoteAddr.toString().startsWith(ma.toString());\n });\n // Connections in the allow list should be excluded from pruning\n if (!connectionInAllowList) {\n toClose.push(connection);\n }\n if (toClose.length === toPrune) {\n break;\n }\n }\n // close connections\n await Promise.all(toClose.map(async (connection) => {\n try {\n await connection.close();\n }\n catch (err) {\n log.error(err);\n }\n }));\n // despatch prune event\n this.events.safeDispatchEvent('connection:prune', { detail: toClose });\n }\n}\n//# sourceMappingURL=connection-pruner.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection-manager/constants.js": +/*!**********************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection-manager/constants.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AUTO_DIAL_CONCURRENCY: () => (/* binding */ AUTO_DIAL_CONCURRENCY),\n/* harmony export */ AUTO_DIAL_INTERVAL: () => (/* binding */ AUTO_DIAL_INTERVAL),\n/* harmony export */ AUTO_DIAL_MAX_QUEUE_LENGTH: () => (/* binding */ AUTO_DIAL_MAX_QUEUE_LENGTH),\n/* harmony export */ AUTO_DIAL_PRIORITY: () => (/* binding */ AUTO_DIAL_PRIORITY),\n/* harmony export */ DIAL_TIMEOUT: () => (/* binding */ DIAL_TIMEOUT),\n/* harmony export */ INBOUND_CONNECTION_THRESHOLD: () => (/* binding */ INBOUND_CONNECTION_THRESHOLD),\n/* harmony export */ INBOUND_UPGRADE_TIMEOUT: () => (/* binding */ INBOUND_UPGRADE_TIMEOUT),\n/* harmony export */ MAX_CONNECTIONS: () => (/* binding */ MAX_CONNECTIONS),\n/* harmony export */ MAX_INCOMING_PENDING_CONNECTIONS: () => (/* binding */ MAX_INCOMING_PENDING_CONNECTIONS),\n/* harmony export */ MAX_PARALLEL_DIALS: () => (/* binding */ MAX_PARALLEL_DIALS),\n/* harmony export */ MAX_PARALLEL_DIALS_PER_PEER: () => (/* binding */ MAX_PARALLEL_DIALS_PER_PEER),\n/* harmony export */ MAX_PEER_ADDRS_TO_DIAL: () => (/* binding */ MAX_PEER_ADDRS_TO_DIAL),\n/* harmony export */ MIN_CONNECTIONS: () => (/* binding */ MIN_CONNECTIONS)\n/* harmony export */ });\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#dialTimeout\n */\nconst DIAL_TIMEOUT = 30e3;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#inboundUpgradeTimeout\n */\nconst INBOUND_UPGRADE_TIMEOUT = 30e3;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxParallelDials\n */\nconst MAX_PARALLEL_DIALS = 100;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxPeerAddrsToDial\n */\nconst MAX_PEER_ADDRS_TO_DIAL = 25;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxParallelDialsPerPeer\n */\nconst MAX_PARALLEL_DIALS_PER_PEER = 10;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#minConnections\n */\nconst MIN_CONNECTIONS = 50;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxConnections\n */\nconst MAX_CONNECTIONS = 300;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialInterval\n */\nconst AUTO_DIAL_INTERVAL = 5000;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialConcurrency\n */\nconst AUTO_DIAL_CONCURRENCY = 25;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialPriority\n */\nconst AUTO_DIAL_PRIORITY = 0;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialMaxQueueLength\n */\nconst AUTO_DIAL_MAX_QUEUE_LENGTH = 100;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#inboundConnectionThreshold\n */\nconst INBOUND_CONNECTION_THRESHOLD = 5;\n/**\n * @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxIncomingPendingConnections\n */\nconst MAX_INCOMING_PENDING_CONNECTIONS = 10;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection-manager/constants.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection-manager/dial-queue.js": +/*!***********************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection-manager/dial-queue.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DialQueue: () => (/* binding */ DialQueue)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/utils/address-sort */ \"./node_modules/@libp2p/utils/dist/src/address-sort.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @multiformats/multiaddr/resolvers */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! p-defer */ \"./node_modules/p-defer/index.js\");\n/* harmony import */ var p_queue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! p-queue */ \"./node_modules/p-queue/dist/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _get_peer_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../get-peer.js */ \"./node_modules/libp2p/dist/src/get-peer.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/libp2p/dist/src/connection-manager/utils.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:connection-manager:dial-queue');\nconst defaultOptions = {\n addressSorter: _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_3__.publicAddressesFirst,\n maxParallelDials: _constants_js__WEBPACK_IMPORTED_MODULE_11__.MAX_PARALLEL_DIALS,\n maxPeerAddrsToDial: _constants_js__WEBPACK_IMPORTED_MODULE_11__.MAX_PEER_ADDRS_TO_DIAL,\n maxParallelDialsPerPeer: _constants_js__WEBPACK_IMPORTED_MODULE_11__.MAX_PARALLEL_DIALS_PER_PEER,\n dialTimeout: _constants_js__WEBPACK_IMPORTED_MODULE_11__.DIAL_TIMEOUT,\n resolvers: {\n dnsaddr: _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_5__.dnsaddrResolver\n }\n};\nclass DialQueue {\n pendingDials;\n queue;\n peerId;\n peerStore;\n connectionGater;\n transportManager;\n addressSorter;\n maxPeerAddrsToDial;\n maxParallelDialsPerPeer;\n dialTimeout;\n inProgressDialCount;\n pendingDialCount;\n shutDownController;\n constructor(components, init = {}) {\n this.addressSorter = init.addressSorter ?? defaultOptions.addressSorter;\n this.maxPeerAddrsToDial = init.maxPeerAddrsToDial ?? defaultOptions.maxPeerAddrsToDial;\n this.maxParallelDialsPerPeer = init.maxParallelDialsPerPeer ?? defaultOptions.maxParallelDialsPerPeer;\n this.dialTimeout = init.dialTimeout ?? defaultOptions.dialTimeout;\n this.peerId = components.peerId;\n this.peerStore = components.peerStore;\n this.connectionGater = components.connectionGater;\n this.transportManager = components.transportManager;\n this.shutDownController = new AbortController();\n try {\n // This emitter gets listened to a lot\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, this.shutDownController.signal);\n }\n catch { }\n this.pendingDialCount = components.metrics?.registerMetric('libp2p_dialler_pending_dials');\n this.inProgressDialCount = components.metrics?.registerMetric('libp2p_dialler_in_progress_dials');\n this.pendingDials = [];\n for (const [key, value] of Object.entries(init.resolvers ?? {})) {\n _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.resolvers.set(key, value);\n }\n // controls dial concurrency\n this.queue = new p_queue__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n concurrency: init.maxParallelDials ?? defaultOptions.maxParallelDials\n });\n // a job was added to the queue\n this.queue.on('add', () => {\n this.pendingDialCount?.update(this.queue.size);\n this.inProgressDialCount?.update(this.queue.pending);\n });\n // a queued job started\n this.queue.on('active', () => {\n this.pendingDialCount?.update(this.queue.size);\n this.inProgressDialCount?.update(this.queue.pending);\n });\n // a started job completed without error\n this.queue.on('completed', () => {\n this.pendingDialCount?.update(this.queue.size);\n this.inProgressDialCount?.update(this.queue.pending);\n });\n // a started job errored\n this.queue.on('error', (err) => {\n log.error('error in dial queue', err);\n this.pendingDialCount?.update(this.queue.size);\n this.inProgressDialCount?.update(this.queue.pending);\n });\n // all queued jobs have been started\n this.queue.on('empty', () => {\n this.pendingDialCount?.update(this.queue.size);\n this.inProgressDialCount?.update(this.queue.pending);\n });\n // add started jobs have run and the queue is empty\n this.queue.on('idle', () => {\n this.pendingDialCount?.update(this.queue.size);\n this.inProgressDialCount?.update(this.queue.pending);\n });\n }\n /**\n * Clears any pending dials\n */\n stop() {\n this.shutDownController.abort();\n }\n /**\n * Connects to a given peer, multiaddr or list of multiaddrs.\n *\n * If a peer is passed, all known multiaddrs will be tried. If a multiaddr or\n * multiaddrs are passed only those will be dialled.\n *\n * Where a list of multiaddrs is passed, if any contain a peer id then all\n * multiaddrs in the list must contain the same peer id.\n *\n * The dial to the first address that is successfully able to upgrade a connection\n * will be used, all other dials will be aborted when that happens.\n */\n async dial(peerIdOrMultiaddr, options = {}) {\n const { peerId, multiaddrs } = (0,_get_peer_js__WEBPACK_IMPORTED_MODULE_10__.getPeerAddress)(peerIdOrMultiaddr);\n const addrs = multiaddrs.map(multiaddr => ({\n multiaddr,\n isCertified: false\n }));\n // create abort conditions - need to do this before `calculateMultiaddrs` as we may be about to\n // resolve a dns addr which can time out\n const signal = this.createDialAbortControllers(options.signal);\n let addrsToDial;\n try {\n // load addresses from address book, resolve and dnsaddrs, filter undiallables, add peer IDs, etc\n addrsToDial = await this.calculateMultiaddrs(peerId, addrs, {\n ...options,\n signal\n });\n }\n catch (err) {\n signal.clear();\n throw err;\n }\n // ready to dial, all async work finished - make sure we don't have any\n // pending dials in progress for this peer or set of multiaddrs\n const existingDial = this.pendingDials.find(dial => {\n // is the dial for the same peer id?\n if (dial.peerId != null && peerId != null && dial.peerId.equals(peerId)) {\n return true;\n }\n // is the dial for the same set of multiaddrs?\n if (addrsToDial.map(({ multiaddr }) => multiaddr.toString()).join() === dial.multiaddrs.map(multiaddr => multiaddr.toString()).join()) {\n return true;\n }\n return false;\n });\n if (existingDial != null) {\n log('joining existing dial target for %p', peerId);\n signal.clear();\n return existingDial.promise;\n }\n log('creating dial target for', addrsToDial.map(({ multiaddr }) => multiaddr.toString()));\n // @ts-expect-error .promise property is set below\n const pendingDial = {\n id: randomId(),\n status: 'queued',\n peerId,\n multiaddrs: addrsToDial.map(({ multiaddr }) => multiaddr)\n };\n pendingDial.promise = this.performDial(pendingDial, {\n ...options,\n signal\n })\n .finally(() => {\n // remove our pending dial entry\n this.pendingDials = this.pendingDials.filter(p => p.id !== pendingDial.id);\n // clean up abort signals/controllers\n signal.clear();\n })\n .catch(err => {\n log.error('dial failed to %s', pendingDial.multiaddrs.map(ma => ma.toString()).join(', '), err);\n // Error is a timeout\n if (signal.aborted) {\n const error = new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(err.message, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_TIMEOUT);\n throw error;\n }\n throw err;\n });\n // let other dials join this one\n this.pendingDials.push(pendingDial);\n return pendingDial.promise;\n }\n createDialAbortControllers(userSignal) {\n // let any signal abort the dial\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_6__.anySignal)([AbortSignal.timeout(this.dialTimeout),\n this.shutDownController.signal,\n userSignal\n ]);\n try {\n // This emitter gets listened to a lot\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n return signal;\n }\n // eslint-disable-next-line complexity\n async calculateMultiaddrs(peerId, addrs = [], options = {}) {\n // if a peer id or multiaddr(s) with a peer id, make sure it isn't our peer id and that we are allowed to dial it\n if (peerId != null) {\n if (this.peerId.equals(peerId)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Tried to dial self', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_DIALED_SELF);\n }\n if ((await this.connectionGater.denyDialPeer?.(peerId)) === true) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('The dial request is blocked by gater.allowDialPeer', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_PEER_DIAL_INTERCEPTED);\n }\n // if just a peer id was passed, load available multiaddrs for this peer from the address book\n if (addrs.length === 0) {\n log('loading multiaddrs for %p', peerId);\n try {\n const peer = await this.peerStore.get(peerId);\n addrs.push(...peer.addresses);\n log('loaded multiaddrs for %p', peerId, addrs.map(({ multiaddr }) => multiaddr.toString()));\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_NOT_FOUND) {\n throw err;\n }\n }\n }\n }\n // resolve addresses - this can result in a one-to-many translation when dnsaddrs are resolved\n const resolvedAddresses = (await Promise.all(addrs.map(async (addr) => {\n const result = await (0,_utils_js__WEBPACK_IMPORTED_MODULE_12__.resolveMultiaddrs)(addr.multiaddr, options);\n if (result.length === 1 && result[0].equals(addr.multiaddr)) {\n return addr;\n }\n return result.map(multiaddr => ({\n multiaddr,\n isCertified: false\n }));\n })))\n .flat();\n // filter out any multiaddrs that we do not have transports for\n const filteredAddrs = resolvedAddresses.filter(addr => Boolean(this.transportManager.transportForMultiaddr(addr.multiaddr)));\n // deduplicate addresses\n const dedupedAddrs = new Map();\n for (const addr of filteredAddrs) {\n const maStr = addr.multiaddr.toString();\n const existing = dedupedAddrs.get(maStr);\n if (existing != null) {\n existing.isCertified = existing.isCertified || addr.isCertified || false;\n continue;\n }\n dedupedAddrs.set(maStr, addr);\n }\n let dedupedMultiaddrs = [...dedupedAddrs.values()];\n if (dedupedMultiaddrs.length === 0 || dedupedMultiaddrs.length > this.maxPeerAddrsToDial) {\n log('addresses for %p before filtering', peerId ?? 'unknown peer', resolvedAddresses.map(({ multiaddr }) => multiaddr.toString()));\n log('addresses for %p after filtering', peerId ?? 'unknown peer', dedupedMultiaddrs.map(({ multiaddr }) => multiaddr.toString()));\n }\n // make sure we actually have some addresses to dial\n if (dedupedMultiaddrs.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('The dial request has no valid addresses', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_NO_VALID_ADDRESSES);\n }\n // make sure we don't have too many addresses to dial\n if (dedupedMultiaddrs.length > this.maxPeerAddrsToDial) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('dial with more addresses than allowed', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_TOO_MANY_ADDRESSES);\n }\n // ensure the peer id is appended to the multiaddr\n if (peerId != null) {\n const peerIdMultiaddr = `/p2p/${peerId.toString()}`;\n dedupedMultiaddrs = dedupedMultiaddrs.map(addr => {\n const addressPeerId = addr.multiaddr.getPeerId();\n const lastProto = addr.multiaddr.protos().pop();\n // do not append peer id to path multiaddrs\n if (lastProto?.path === true) {\n return addr;\n }\n // append peer id to multiaddr if it is not already present\n if (addressPeerId !== peerId.toString()) {\n return {\n multiaddr: addr.multiaddr.encapsulate(peerIdMultiaddr),\n isCertified: addr.isCertified\n };\n }\n return addr;\n });\n }\n const gatedAdrs = [];\n for (const addr of dedupedMultiaddrs) {\n if (this.connectionGater.denyDialMultiaddr != null && await this.connectionGater.denyDialMultiaddr(addr.multiaddr)) {\n continue;\n }\n gatedAdrs.push(addr);\n }\n const sortedGatedAddrs = gatedAdrs.sort(this.addressSorter);\n // make sure we actually have some addresses to dial\n if (sortedGatedAddrs.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('The connection gater denied all addresses in the dial request', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_NO_VALID_ADDRESSES);\n }\n return sortedGatedAddrs;\n }\n async performDial(pendingDial, options = {}) {\n const dialAbortControllers = pendingDial.multiaddrs.map(() => new AbortController());\n try {\n // internal peer dial queue to ensure we only dial the configured number of addresses\n // per peer at the same time to prevent one peer with a lot of addresses swamping\n // the dial queue\n const peerDialQueue = new p_queue__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n concurrency: this.maxParallelDialsPerPeer\n });\n peerDialQueue.on('error', (err) => {\n log.error('error dialling', err);\n });\n const conn = await Promise.any(pendingDial.multiaddrs.map(async (addr, i) => {\n const controller = dialAbortControllers[i];\n if (controller == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('dialAction did not come with an AbortController', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_INVALID_PARAMETERS);\n }\n // let any signal abort the dial\n const signal = (0,_utils_js__WEBPACK_IMPORTED_MODULE_12__.combineSignals)(controller.signal, options.signal);\n signal.addEventListener('abort', () => {\n log('dial to %s aborted', addr);\n });\n const deferred = (0,p_defer__WEBPACK_IMPORTED_MODULE_7__[\"default\"])();\n await peerDialQueue.add(async () => {\n if (signal.aborted) {\n log('dial to %s was aborted before reaching the head of the peer dial queue', addr);\n deferred.reject(new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.AbortError());\n return;\n }\n // add the individual dial to the dial queue so we don't breach maxConcurrentDials\n await this.queue.add(async () => {\n try {\n if (signal.aborted) {\n log('dial to %s was aborted before reaching the head of the dial queue', addr);\n deferred.reject(new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.AbortError());\n return;\n }\n // update dial status\n pendingDial.status = 'active';\n const conn = await this.transportManager.dial(addr, {\n ...options,\n signal\n });\n if (controller.signal.aborted) {\n // another dial succeeded faster than this one\n log('multiple dials succeeded, closing superfluous connection');\n conn.close().catch(err => {\n log.error('error closing superfluous connection', err);\n });\n deferred.reject(new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.AbortError());\n return;\n }\n // remove the successful AbortController so it is not aborted\n dialAbortControllers[i] = undefined;\n // immediately abort any other dials\n dialAbortControllers.forEach(c => {\n if (c !== undefined) {\n c.abort();\n }\n });\n log('dial to %s succeeded', addr);\n // resolve the connection promise\n deferred.resolve(conn);\n }\n catch (err) {\n // something only went wrong if our signal was not aborted\n log.error('error during dial of %s', addr, err);\n deferred.reject(err);\n }\n }, {\n ...options,\n signal\n }).catch(err => {\n deferred.reject(err);\n });\n }, {\n signal\n }).catch(err => {\n deferred.reject(err);\n }).finally(() => {\n signal.clear();\n });\n return deferred.promise;\n }));\n // dial succeeded or failed\n if (conn == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('successful dial led to empty object returned from peer dial queue', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_TRANSPORT_DIAL_FAILED);\n }\n pendingDial.status = 'success';\n return conn;\n }\n catch (err) {\n pendingDial.status = 'error';\n // if we only dialled one address, unwrap the AggregateError to provide more\n // useful feedback to the user\n if (pendingDial.multiaddrs.length === 1 && err.name === 'AggregateError') {\n throw err.errors[0];\n }\n throw err;\n }\n }\n}\n/**\n * Returns a random string\n */\nfunction randomId() {\n return `${(parseInt(String(Math.random() * 1e9), 10)).toString()}${Date.now()}`;\n}\n//# sourceMappingURL=dial-queue.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection-manager/dial-queue.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection-manager/index.js": +/*!******************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection-manager/index.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultConnectionManager: () => (/* binding */ DefaultConnectionManager)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_peer_store_tags__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-peer-store/tags */ \"./node_modules/@libp2p/interface-peer-store/dist/src/tags.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/utils/address-sort */ \"./node_modules/@libp2p/utils/dist/src/address-sort.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @multiformats/multiaddr/resolvers */ \"./node_modules/@multiformats/multiaddr/dist/src/resolvers/index.js\");\n/* harmony import */ var rate_limiter_flexible__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! rate-limiter-flexible */ \"./node_modules/rate-limiter-flexible/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _get_peer_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../get-peer.js */ \"./node_modules/libp2p/dist/src/get-peer.js\");\n/* harmony import */ var _auto_dial_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./auto-dial.js */ \"./node_modules/libp2p/dist/src/connection-manager/auto-dial.js\");\n/* harmony import */ var _connection_pruner_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./connection-pruner.js */ \"./node_modules/libp2p/dist/src/connection-manager/connection-pruner.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n/* harmony import */ var _dial_queue_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./dial-queue.js */ \"./node_modules/libp2p/dist/src/connection-manager/dial-queue.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:connection-manager');\nconst DEFAULT_DIAL_PRIORITY = 50;\nconst defaultOptions = {\n minConnections: _constants_js__WEBPACK_IMPORTED_MODULE_12__.MIN_CONNECTIONS,\n maxConnections: _constants_js__WEBPACK_IMPORTED_MODULE_12__.MAX_CONNECTIONS,\n inboundConnectionThreshold: _constants_js__WEBPACK_IMPORTED_MODULE_12__.INBOUND_CONNECTION_THRESHOLD,\n maxIncomingPendingConnections: _constants_js__WEBPACK_IMPORTED_MODULE_12__.MAX_INCOMING_PENDING_CONNECTIONS,\n autoDialConcurrency: _constants_js__WEBPACK_IMPORTED_MODULE_12__.AUTO_DIAL_CONCURRENCY,\n autoDialPriority: _constants_js__WEBPACK_IMPORTED_MODULE_12__.AUTO_DIAL_PRIORITY,\n autoDialMaxQueueLength: _constants_js__WEBPACK_IMPORTED_MODULE_12__.AUTO_DIAL_MAX_QUEUE_LENGTH\n};\n/**\n * Responsible for managing known connections.\n */\nclass DefaultConnectionManager {\n started;\n connections;\n allow;\n deny;\n maxIncomingPendingConnections;\n incomingPendingConnections;\n maxConnections;\n dialQueue;\n autoDial;\n connectionPruner;\n inboundConnectionRateLimiter;\n peerStore;\n metrics;\n events;\n constructor(components, init = {}) {\n this.maxConnections = init.maxConnections ?? defaultOptions.maxConnections;\n const minConnections = init.minConnections ?? defaultOptions.minConnections;\n if (this.maxConnections < minConnections) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Connection Manager maxConnections must be greater than minConnections', _errors_js__WEBPACK_IMPORTED_MODULE_8__.codes.ERR_INVALID_PARAMETERS);\n }\n /**\n * Map of connections per peer\n */\n this.connections = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_3__.PeerMap();\n this.started = false;\n this.peerStore = components.peerStore;\n this.metrics = components.metrics;\n this.events = components.events;\n this.onConnect = this.onConnect.bind(this);\n this.onDisconnect = this.onDisconnect.bind(this);\n this.events.addEventListener('connection:open', this.onConnect);\n this.events.addEventListener('connection:close', this.onDisconnect);\n // allow/deny lists\n this.allow = (init.allow ?? []).map(ma => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(ma));\n this.deny = (init.deny ?? []).map(ma => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(ma));\n this.incomingPendingConnections = 0;\n this.maxIncomingPendingConnections = init.maxIncomingPendingConnections ?? defaultOptions.maxIncomingPendingConnections;\n // controls individual peers trying to dial us too quickly\n this.inboundConnectionRateLimiter = new rate_limiter_flexible__WEBPACK_IMPORTED_MODULE_7__.RateLimiterMemory({\n points: init.inboundConnectionThreshold ?? defaultOptions.inboundConnectionThreshold,\n duration: 1\n });\n // controls what happens when we don't have enough connections\n this.autoDial = new _auto_dial_js__WEBPACK_IMPORTED_MODULE_10__.AutoDial({\n connectionManager: this,\n peerStore: components.peerStore,\n events: components.events\n }, {\n minConnections,\n autoDialConcurrency: init.autoDialConcurrency ?? defaultOptions.autoDialConcurrency,\n autoDialPriority: init.autoDialPriority ?? defaultOptions.autoDialPriority,\n maxQueueLength: init.autoDialMaxQueueLength ?? defaultOptions.autoDialMaxQueueLength\n });\n // controls what happens when we have too many connections\n this.connectionPruner = new _connection_pruner_js__WEBPACK_IMPORTED_MODULE_11__.ConnectionPruner({\n connectionManager: this,\n peerStore: components.peerStore,\n events: components.events\n }, {\n maxConnections: this.maxConnections,\n allow: this.allow\n });\n this.dialQueue = new _dial_queue_js__WEBPACK_IMPORTED_MODULE_13__.DialQueue({\n peerId: components.peerId,\n metrics: components.metrics,\n peerStore: components.peerStore,\n transportManager: components.transportManager,\n connectionGater: components.connectionGater\n }, {\n addressSorter: init.addressSorter ?? _libp2p_utils_address_sort__WEBPACK_IMPORTED_MODULE_4__.publicAddressesFirst,\n maxParallelDials: init.maxParallelDials ?? _constants_js__WEBPACK_IMPORTED_MODULE_12__.MAX_PARALLEL_DIALS,\n maxPeerAddrsToDial: init.maxPeerAddrsToDial ?? _constants_js__WEBPACK_IMPORTED_MODULE_12__.MAX_PEER_ADDRS_TO_DIAL,\n dialTimeout: init.dialTimeout ?? _constants_js__WEBPACK_IMPORTED_MODULE_12__.DIAL_TIMEOUT,\n resolvers: init.resolvers ?? {\n dnsaddr: _multiformats_multiaddr_resolvers__WEBPACK_IMPORTED_MODULE_6__.dnsaddrResolver\n }\n });\n }\n isStarted() {\n return this.started;\n }\n /**\n * Starts the Connection Manager. If Metrics are not enabled on libp2p\n * only event loop and connection limits will be monitored.\n */\n async start() {\n // track inbound/outbound connections\n this.metrics?.registerMetricGroup('libp2p_connection_manager_connections', {\n calculate: () => {\n const metric = {\n inbound: 0,\n outbound: 0\n };\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n if (conn.stat.direction === 'inbound') {\n metric.inbound++;\n }\n else {\n metric.outbound++;\n }\n }\n }\n return metric;\n }\n });\n // track total number of streams per protocol\n this.metrics?.registerMetricGroup('libp2p_protocol_streams_total', {\n label: 'protocol',\n calculate: () => {\n const metric = {};\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n for (const stream of conn.streams) {\n const key = `${stream.stat.direction} ${stream.stat.protocol ?? 'unnegotiated'}`;\n metric[key] = (metric[key] ?? 0) + 1;\n }\n }\n }\n return metric;\n }\n });\n // track 90th percentile of streams per protocol\n this.metrics?.registerMetricGroup('libp2p_connection_manager_protocol_streams_per_connection_90th_percentile', {\n label: 'protocol',\n calculate: () => {\n const allStreams = {};\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n const streams = {};\n for (const stream of conn.streams) {\n const key = `${stream.stat.direction} ${stream.stat.protocol ?? 'unnegotiated'}`;\n streams[key] = (streams[key] ?? 0) + 1;\n }\n for (const [protocol, count] of Object.entries(streams)) {\n allStreams[protocol] = allStreams[protocol] ?? [];\n allStreams[protocol].push(count);\n }\n }\n }\n const metric = {};\n for (let [protocol, counts] of Object.entries(allStreams)) {\n counts = counts.sort((a, b) => a - b);\n const index = Math.floor(counts.length * 0.9);\n metric[protocol] = counts[index];\n }\n return metric;\n }\n });\n this.autoDial.start();\n this.started = true;\n log('started');\n }\n async afterStart() {\n // re-connect to any peers with the KEEP_ALIVE tag\n void Promise.resolve()\n .then(async () => {\n const keepAlivePeers = await this.peerStore.all({\n filters: [(peer) => {\n return peer.tags.has(_libp2p_interface_peer_store_tags__WEBPACK_IMPORTED_MODULE_0__.KEEP_ALIVE);\n }]\n });\n await Promise.all(keepAlivePeers.map(async (peer) => {\n await this.openConnection(peer.id)\n .catch(err => {\n log.error(err);\n });\n }));\n })\n .catch(err => {\n log.error(err);\n });\n this.autoDial.afterStart();\n }\n /**\n * Stops the Connection Manager\n */\n async stop() {\n this.dialQueue.stop();\n this.autoDial.stop();\n // Close all connections we're tracking\n const tasks = [];\n for (const connectionList of this.connections.values()) {\n for (const connection of connectionList) {\n tasks.push((async () => {\n try {\n await connection.close();\n }\n catch (err) {\n log.error(err);\n }\n })());\n }\n }\n log('closing %d connections', tasks.length);\n await Promise.all(tasks);\n this.connections.clear();\n log('stopped');\n }\n onConnect(evt) {\n void this._onConnect(evt).catch(err => {\n log.error(err);\n });\n }\n /**\n * Tracks the incoming connection and check the connection limit\n */\n async _onConnect(evt) {\n const { detail: connection } = evt;\n if (!this.started) {\n // This can happen when we are in the process of shutting down the node\n await connection.close();\n return;\n }\n const peerId = connection.remotePeer;\n const storedConns = this.connections.get(peerId);\n let isNewPeer = false;\n if (storedConns != null) {\n storedConns.push(connection);\n }\n else {\n isNewPeer = true;\n this.connections.set(peerId, [connection]);\n }\n // only need to store RSA public keys, all other types are embedded in the peer id\n if (peerId.publicKey != null && peerId.type === 'RSA') {\n await this.peerStore.patch(peerId, {\n publicKey: peerId.publicKey\n });\n }\n if (isNewPeer) {\n this.events.safeDispatchEvent('peer:connect', { detail: connection.remotePeer });\n }\n }\n /**\n * Removes the connection from tracking\n */\n onDisconnect(evt) {\n const { detail: connection } = evt;\n if (!this.started) {\n // This can happen when we are in the process of shutting down the node\n return;\n }\n const peerId = connection.remotePeer;\n let storedConn = this.connections.get(peerId);\n if (storedConn != null && storedConn.length > 1) {\n storedConn = storedConn.filter((conn) => conn.id !== connection.id);\n this.connections.set(peerId, storedConn);\n }\n else if (storedConn != null) {\n this.connections.delete(peerId);\n this.events.safeDispatchEvent('peer:disconnect', { detail: connection.remotePeer });\n }\n }\n getConnections(peerId) {\n if (peerId != null) {\n return this.connections.get(peerId) ?? [];\n }\n let conns = [];\n for (const c of this.connections.values()) {\n conns = conns.concat(c);\n }\n return conns;\n }\n getConnectionsMap() {\n return this.connections;\n }\n async openConnection(peerIdOrMultiaddr, options = {}) {\n if (!this.isStarted()) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Not started', _errors_js__WEBPACK_IMPORTED_MODULE_8__.codes.ERR_NODE_NOT_STARTED);\n }\n const { peerId } = (0,_get_peer_js__WEBPACK_IMPORTED_MODULE_9__.getPeerAddress)(peerIdOrMultiaddr);\n if (peerId != null) {\n log('dial %p', peerId);\n const existingConnections = this.getConnections(peerId);\n if (existingConnections.length > 0) {\n log('had an existing connection to %p', peerId);\n return existingConnections[0];\n }\n }\n const connection = await this.dialQueue.dial(peerIdOrMultiaddr, {\n ...options,\n priority: options.priority ?? DEFAULT_DIAL_PRIORITY\n });\n let peerConnections = this.connections.get(connection.remotePeer);\n if (peerConnections == null) {\n peerConnections = [];\n this.connections.set(connection.remotePeer, peerConnections);\n }\n // we get notified of connections via the Upgrader emitting \"connection\"\n // events, double check we aren't already tracking this connection before\n // storing it\n let trackedConnection = false;\n for (const conn of peerConnections) {\n if (conn.id === connection.id) {\n trackedConnection = true;\n }\n }\n if (!trackedConnection) {\n peerConnections.push(connection);\n }\n return connection;\n }\n async closeConnections(peerId) {\n const connections = this.connections.get(peerId) ?? [];\n await Promise.all(connections.map(async (connection) => {\n await connection.close();\n }));\n }\n async acceptIncomingConnection(maConn) {\n // check deny list\n const denyConnection = this.deny.some(ma => {\n return maConn.remoteAddr.toString().startsWith(ma.toString());\n });\n if (denyConnection) {\n log('connection from %s refused - connection remote address was in deny list', maConn.remoteAddr);\n return false;\n }\n // check allow list\n const allowConnection = this.allow.some(ma => {\n return maConn.remoteAddr.toString().startsWith(ma.toString());\n });\n if (allowConnection) {\n this.incomingPendingConnections++;\n return true;\n }\n // check pending connections\n if (this.incomingPendingConnections === this.maxIncomingPendingConnections) {\n log('connection from %s refused - incomingPendingConnections exceeded by peer %s', maConn.remoteAddr);\n return false;\n }\n if (maConn.remoteAddr.isThinWaistAddress()) {\n const host = maConn.remoteAddr.nodeAddress().address;\n try {\n await this.inboundConnectionRateLimiter.consume(host, 1);\n }\n catch {\n log('connection from %s refused - inboundConnectionThreshold exceeded by host %s', host, maConn.remoteAddr);\n return false;\n }\n }\n if (this.getConnections().length < this.maxConnections) {\n this.incomingPendingConnections++;\n return true;\n }\n log('connection from %s refused - maxConnections exceeded', maConn.remoteAddr);\n return false;\n }\n afterUpgradeInbound() {\n this.incomingPendingConnections--;\n }\n getDialQueue() {\n return this.dialQueue.pendingDials;\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection-manager/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection-manager/utils.js": +/*!******************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection-manager/utils.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ combineSignals: () => (/* binding */ combineSignals),\n/* harmony export */ resolveMultiaddrs: () => (/* binding */ resolveMultiaddrs)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:connection-manager:utils');\n/**\n * Resolve multiaddr recursively\n */\nasync function resolveMultiaddrs(ma, options) {\n // TODO: recursive logic should live in multiaddr once dns4/dns6 support is in place\n // Now only supporting resolve for dnsaddr\n const resolvableProto = ma.protoNames().includes('dnsaddr');\n // Multiaddr is not resolvable? End recursion!\n if (!resolvableProto) {\n return [ma];\n }\n const resolvedMultiaddrs = await resolveRecord(ma, options);\n const recursiveMultiaddrs = await Promise.all(resolvedMultiaddrs.map(async (nm) => {\n return resolveMultiaddrs(nm, options);\n }));\n const addrs = recursiveMultiaddrs.flat();\n const output = addrs.reduce((array, newM) => {\n if (array.find(m => m.equals(newM)) == null) {\n array.push(newM);\n }\n return array;\n }, ([]));\n log('resolved %s to', ma, output.map(ma => ma.toString()));\n return output;\n}\n/**\n * Resolve a given multiaddr. If this fails, an empty array will be returned\n */\nasync function resolveRecord(ma, options) {\n try {\n ma = (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_2__.multiaddr)(ma.toString()); // Use current multiaddr module\n const multiaddrs = await ma.resolve(options);\n return multiaddrs;\n }\n catch (err) {\n log.error(`multiaddr ${ma.toString()} could not be resolved`, err);\n return [];\n }\n}\nfunction combineSignals(...signals) {\n const sigs = [];\n for (const sig of signals) {\n if (sig != null) {\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, sig);\n }\n catch { }\n sigs.push(sig);\n }\n }\n // let any signal abort the dial\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_3__.anySignal)(sigs);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n return signal;\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection-manager/utils.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/connection/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/libp2p/dist/src/connection/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ConnectionImpl: () => (/* binding */ ConnectionImpl),\n/* harmony export */ createConnection: () => (/* binding */ createConnection)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_connection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-connection */ \"./node_modules/@libp2p/interface-connection/dist/src/index.js\");\n/* harmony import */ var _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interface-connection/status */ \"./node_modules/@libp2p/interface-connection/dist/src/status.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_3__.logger)('libp2p:connection');\n/**\n * An implementation of the js-libp2p connection.\n * Any libp2p transport should use an upgrader to return this connection.\n */\nclass ConnectionImpl {\n /**\n * Connection identifier.\n */\n id;\n /**\n * Observed multiaddr of the remote peer\n */\n remoteAddr;\n /**\n * Remote peer id\n */\n remotePeer;\n /**\n * Connection metadata\n */\n stat;\n /**\n * User provided tags\n *\n */\n tags;\n /**\n * Reference to the new stream function of the multiplexer\n */\n _newStream;\n /**\n * Reference to the close function of the raw connection\n */\n _close;\n /**\n * Reference to the getStreams function of the muxer\n */\n _getStreams;\n _closing;\n /**\n * An implementation of the js-libp2p connection.\n * Any libp2p transport should use an upgrader to return this connection.\n */\n constructor(init) {\n const { remoteAddr, remotePeer, newStream, close, getStreams, stat } = init;\n this.id = `${(parseInt(String(Math.random() * 1e9))).toString(36)}${Date.now()}`;\n this.remoteAddr = remoteAddr;\n this.remotePeer = remotePeer;\n this.stat = {\n ...stat,\n status: _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__.OPEN\n };\n this._newStream = newStream;\n this._close = close;\n this._getStreams = getStreams;\n this.tags = [];\n this._closing = false;\n }\n [Symbol.toStringTag] = 'Connection';\n [_libp2p_interface_connection__WEBPACK_IMPORTED_MODULE_0__.symbol] = true;\n /**\n * Get all the streams of the muxer\n */\n get streams() {\n return this._getStreams();\n }\n /**\n * Create a new stream from this connection\n */\n async newStream(protocols, options) {\n if (this.stat.status === _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__.CLOSING) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('the connection is being closed', 'ERR_CONNECTION_BEING_CLOSED');\n }\n if (this.stat.status === _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__.CLOSED) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('the connection is closed', 'ERR_CONNECTION_CLOSED');\n }\n if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n const stream = await this._newStream(protocols, options);\n stream.stat.direction = 'outbound';\n return stream;\n }\n /**\n * Add a stream when it is opened to the registry\n */\n addStream(stream) {\n stream.stat.direction = 'inbound';\n }\n /**\n * Remove stream registry after it is closed\n */\n removeStream(id) {\n }\n /**\n * Close the connection\n */\n async close() {\n if (this.stat.status === _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__.CLOSED || this._closing) {\n return;\n }\n this.stat.status = _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__.CLOSING;\n // close all streams - this can throw if we're not multiplexed\n try {\n this.streams.forEach(s => { s.close(); });\n }\n catch (err) {\n log.error(err);\n }\n // Close raw connection\n this._closing = true;\n await this._close();\n this._closing = false;\n this.stat.timeline.close = Date.now();\n this.stat.status = _libp2p_interface_connection_status__WEBPACK_IMPORTED_MODULE_1__.CLOSED;\n }\n}\nfunction createConnection(init) {\n return new ConnectionImpl(init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/connection/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/content-routing/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/content-routing/index.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CompoundContentRouting: () => (/* binding */ CompoundContentRouting)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/libp2p/dist/src/content-routing/utils.js\");\n\n\n\n\n\nclass CompoundContentRouting {\n routers;\n started;\n components;\n constructor(components, init) {\n this.routers = init.routers ?? [];\n this.started = false;\n this.components = components;\n }\n isStarted() {\n return this.started;\n }\n async start() {\n this.started = true;\n }\n async stop() {\n this.started = false;\n }\n /**\n * Iterates over all content routers in parallel to find providers of the given key\n */\n async *findProviders(key, options = {}) {\n if (this.routers.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('No content routers available', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n yield* (0,it_pipe__WEBPACK_IMPORTED_MODULE_2__.pipe)((0,it_merge__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(...this.routers.map(router => router.findProviders(key, options))), (source) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.storeAddresses)(source, this.components.peerStore), (source) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.uniquePeers)(source), (source) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_4__.requirePeers)(source));\n }\n /**\n * Iterates over all content routers in parallel to notify it is\n * a provider of the given key\n */\n async provide(key, options = {}) {\n if (this.routers.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('No content routers available', _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n await Promise.all(this.routers.map(async (router) => { await router.provide(key, options); }));\n }\n /**\n * Store the given key/value pair in the available content routings\n */\n async put(key, value, options) {\n if (!this.isStarted()) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_3__.messages.NOT_STARTED_YET, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.DHT_NOT_STARTED);\n }\n await Promise.all(this.routers.map(async (router) => {\n await router.put(key, value, options);\n }));\n }\n /**\n * Get the value to the given key.\n * Times out after 1 minute by default.\n */\n async get(key, options) {\n if (!this.isStarted()) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_3__.messages.NOT_STARTED_YET, _errors_js__WEBPACK_IMPORTED_MODULE_3__.codes.DHT_NOT_STARTED);\n }\n return Promise.any(this.routers.map(async (router) => {\n return router.get(key, options);\n }));\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/content-routing/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/content-routing/utils.js": +/*!***************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/content-routing/utils.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ requirePeers: () => (/* binding */ requirePeers),\n/* harmony export */ storeAddresses: () => (/* binding */ storeAddresses),\n/* harmony export */ uniquePeers: () => (/* binding */ uniquePeers)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var it_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! it-filter */ \"./node_modules/it-filter/dist/src/index.js\");\n/* harmony import */ var it_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-map */ \"./node_modules/it-map/dist/src/index.js\");\n\n\n\n/**\n * Store the multiaddrs from every peer in the passed peer store\n */\nasync function* storeAddresses(source, peerStore) {\n yield* (0,it_map__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(source, async (peer) => {\n // ensure we have the addresses for a given peer\n await peerStore.merge(peer.id, {\n multiaddrs: peer.multiaddrs\n });\n return peer;\n });\n}\n/**\n * Filter peers by unique peer id\n */\nfunction uniquePeers(source) {\n /** @type Set */\n const seen = new Set();\n return (0,it_filter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(source, (peer) => {\n // dedupe by peer id\n if (seen.has(peer.id.toString())) {\n return false;\n }\n seen.add(peer.id.toString());\n return true;\n });\n}\n/**\n * Require at least `min` peers to be yielded from `source`\n */\nasync function* requirePeers(source, min = 1) {\n let seen = 0;\n for await (const peer of source) {\n seen++;\n yield peer;\n }\n if (seen < min) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(`more peers required, seen: ${seen} min: ${min}`, 'NOT_FOUND');\n }\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/content-routing/utils.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/errors.js": +/*!************************************************!*\ + !*** ./node_modules/libp2p/dist/src/errors.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes),\n/* harmony export */ messages: () => (/* binding */ messages)\n/* harmony export */ });\nvar messages;\n(function (messages) {\n messages[\"NOT_STARTED_YET\"] = \"The libp2p node is not started yet\";\n messages[\"DHT_DISABLED\"] = \"DHT is not available\";\n messages[\"PUBSUB_DISABLED\"] = \"PubSub is not available\";\n messages[\"CONN_ENCRYPTION_REQUIRED\"] = \"At least one connection encryption module is required\";\n messages[\"ERR_TRANSPORTS_REQUIRED\"] = \"At least one transport module is required\";\n messages[\"ERR_PROTECTOR_REQUIRED\"] = \"Private network is enforced, but no protector was provided\";\n messages[\"NOT_FOUND\"] = \"Not found\";\n})(messages || (messages = {}));\nvar codes;\n(function (codes) {\n codes[\"DHT_DISABLED\"] = \"ERR_DHT_DISABLED\";\n codes[\"ERR_PUBSUB_DISABLED\"] = \"ERR_PUBSUB_DISABLED\";\n codes[\"PUBSUB_NOT_STARTED\"] = \"ERR_PUBSUB_NOT_STARTED\";\n codes[\"DHT_NOT_STARTED\"] = \"ERR_DHT_NOT_STARTED\";\n codes[\"CONN_ENCRYPTION_REQUIRED\"] = \"ERR_CONN_ENCRYPTION_REQUIRED\";\n codes[\"ERR_TRANSPORTS_REQUIRED\"] = \"ERR_TRANSPORTS_REQUIRED\";\n codes[\"ERR_PROTECTOR_REQUIRED\"] = \"ERR_PROTECTOR_REQUIRED\";\n codes[\"ERR_PEER_DIAL_INTERCEPTED\"] = \"ERR_PEER_DIAL_INTERCEPTED\";\n codes[\"ERR_CONNECTION_INTERCEPTED\"] = \"ERR_CONNECTION_INTERCEPTED\";\n codes[\"ERR_INVALID_PROTOCOLS_FOR_STREAM\"] = \"ERR_INVALID_PROTOCOLS_FOR_STREAM\";\n codes[\"ERR_CONNECTION_ENDED\"] = \"ERR_CONNECTION_ENDED\";\n codes[\"ERR_CONNECTION_FAILED\"] = \"ERR_CONNECTION_FAILED\";\n codes[\"ERR_NODE_NOT_STARTED\"] = \"ERR_NODE_NOT_STARTED\";\n codes[\"ERR_ALREADY_ABORTED\"] = \"ERR_ALREADY_ABORTED\";\n codes[\"ERR_TOO_MANY_ADDRESSES\"] = \"ERR_TOO_MANY_ADDRESSES\";\n codes[\"ERR_NO_VALID_ADDRESSES\"] = \"ERR_NO_VALID_ADDRESSES\";\n codes[\"ERR_RELAYED_DIAL\"] = \"ERR_RELAYED_DIAL\";\n codes[\"ERR_DIALED_SELF\"] = \"ERR_DIALED_SELF\";\n codes[\"ERR_DISCOVERED_SELF\"] = \"ERR_DISCOVERED_SELF\";\n codes[\"ERR_DUPLICATE_TRANSPORT\"] = \"ERR_DUPLICATE_TRANSPORT\";\n codes[\"ERR_ENCRYPTION_FAILED\"] = \"ERR_ENCRYPTION_FAILED\";\n codes[\"ERR_HOP_REQUEST_FAILED\"] = \"ERR_HOP_REQUEST_FAILED\";\n codes[\"ERR_INVALID_KEY\"] = \"ERR_INVALID_KEY\";\n codes[\"ERR_INVALID_MESSAGE\"] = \"ERR_INVALID_MESSAGE\";\n codes[\"ERR_INVALID_PARAMETERS\"] = \"ERR_INVALID_PARAMETERS\";\n codes[\"ERR_INVALID_PEER\"] = \"ERR_INVALID_PEER\";\n codes[\"ERR_MUXER_UNAVAILABLE\"] = \"ERR_MUXER_UNAVAILABLE\";\n codes[\"ERR_NOT_FOUND\"] = \"ERR_NOT_FOUND\";\n codes[\"ERR_TIMEOUT\"] = \"ERR_TIMEOUT\";\n codes[\"ERR_TRANSPORT_UNAVAILABLE\"] = \"ERR_TRANSPORT_UNAVAILABLE\";\n codes[\"ERR_TRANSPORT_DIAL_FAILED\"] = \"ERR_TRANSPORT_DIAL_FAILED\";\n codes[\"ERR_UNSUPPORTED_PROTOCOL\"] = \"ERR_UNSUPPORTED_PROTOCOL\";\n codes[\"ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED\"] = \"ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED\";\n codes[\"ERR_INVALID_MULTIADDR\"] = \"ERR_INVALID_MULTIADDR\";\n codes[\"ERR_SIGNATURE_NOT_VALID\"] = \"ERR_SIGNATURE_NOT_VALID\";\n codes[\"ERR_FIND_SELF\"] = \"ERR_FIND_SELF\";\n codes[\"ERR_NO_ROUTERS_AVAILABLE\"] = \"ERR_NO_ROUTERS_AVAILABLE\";\n codes[\"ERR_CONNECTION_NOT_MULTIPLEXED\"] = \"ERR_CONNECTION_NOT_MULTIPLEXED\";\n codes[\"ERR_NO_DIAL_TOKENS\"] = \"ERR_NO_DIAL_TOKENS\";\n codes[\"ERR_KEYCHAIN_REQUIRED\"] = \"ERR_KEYCHAIN_REQUIRED\";\n codes[\"ERR_INVALID_CMS\"] = \"ERR_INVALID_CMS\";\n codes[\"ERR_MISSING_KEYS\"] = \"ERR_MISSING_KEYS\";\n codes[\"ERR_NO_KEY\"] = \"ERR_NO_KEY\";\n codes[\"ERR_INVALID_KEY_NAME\"] = \"ERR_INVALID_KEY_NAME\";\n codes[\"ERR_INVALID_KEY_TYPE\"] = \"ERR_INVALID_KEY_TYPE\";\n codes[\"ERR_KEY_ALREADY_EXISTS\"] = \"ERR_KEY_ALREADY_EXISTS\";\n codes[\"ERR_INVALID_KEY_SIZE\"] = \"ERR_INVALID_KEY_SIZE\";\n codes[\"ERR_KEY_NOT_FOUND\"] = \"ERR_KEY_NOT_FOUND\";\n codes[\"ERR_OLD_KEY_NAME_INVALID\"] = \"ERR_OLD_KEY_NAME_INVALID\";\n codes[\"ERR_NEW_KEY_NAME_INVALID\"] = \"ERR_NEW_KEY_NAME_INVALID\";\n codes[\"ERR_PASSWORD_REQUIRED\"] = \"ERR_PASSWORD_REQUIRED\";\n codes[\"ERR_PEM_REQUIRED\"] = \"ERR_PEM_REQUIRED\";\n codes[\"ERR_CANNOT_READ_KEY\"] = \"ERR_CANNOT_READ_KEY\";\n codes[\"ERR_MISSING_PRIVATE_KEY\"] = \"ERR_MISSING_PRIVATE_KEY\";\n codes[\"ERR_MISSING_PUBLIC_KEY\"] = \"ERR_MISSING_PUBLIC_KEY\";\n codes[\"ERR_INVALID_OLD_PASS_TYPE\"] = \"ERR_INVALID_OLD_PASS_TYPE\";\n codes[\"ERR_INVALID_NEW_PASS_TYPE\"] = \"ERR_INVALID_NEW_PASS_TYPE\";\n codes[\"ERR_INVALID_PASS_LENGTH\"] = \"ERR_INVALID_PASS_LENGTH\";\n codes[\"ERR_NOT_IMPLEMENTED\"] = \"ERR_NOT_IMPLEMENTED\";\n codes[\"ERR_WRONG_PING_ACK\"] = \"ERR_WRONG_PING_ACK\";\n codes[\"ERR_INVALID_RECORD\"] = \"ERR_INVALID_RECORD\";\n codes[\"ERR_ALREADY_SUCCEEDED\"] = \"ERR_ALREADY_SUCCEEDED\";\n codes[\"ERR_NO_HANDLER_FOR_PROTOCOL\"] = \"ERR_NO_HANDLER_FOR_PROTOCOL\";\n codes[\"ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS\"] = \"ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS\";\n codes[\"ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS\"] = \"ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS\";\n codes[\"ERR_CONNECTION_DENIED\"] = \"ERR_CONNECTION_DENIED\";\n codes[\"ERR_TRANSFER_LIMIT_EXCEEDED\"] = \"ERR_TRANSFER_LIMIT_EXCEEDED\";\n})(codes || (codes = {}));\n//# sourceMappingURL=errors.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/errors.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/get-peer.js": +/*!**************************************************!*\ + !*** ./node_modules/libp2p/dist/src/get-peer.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getPeerAddress: () => (/* binding */ getPeerAddress)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-peer-id */ \"./node_modules/@libp2p/interface-peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:get-peer');\n/**\n * Extracts a PeerId and/or multiaddr from the passed PeerId or Multiaddr or an array of Multiaddrs\n */\nfunction getPeerAddress(peer) {\n if ((0,_libp2p_interface_peer_id__WEBPACK_IMPORTED_MODULE_0__.isPeerId)(peer)) {\n return { peerId: peer, multiaddrs: [] };\n }\n if (!Array.isArray(peer)) {\n peer = [peer];\n }\n let peerId;\n if (peer.length > 0) {\n const peerIdStr = peer[0].getPeerId();\n peerId = peerIdStr == null ? undefined : (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString)(peerIdStr);\n // ensure PeerId is either not set or is consistent\n peer.forEach(ma => {\n if (!(0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_4__.isMultiaddr)(ma)) {\n log.error('multiaddr %s was invalid', ma);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Invalid Multiaddr', _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_MULTIADDR);\n }\n const maPeerIdStr = ma.getPeerId();\n if (maPeerIdStr == null) {\n if (peerId != null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Multiaddrs must all have the same peer id or have no peer id', _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n else {\n const maPeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromString)(maPeerIdStr);\n if (peerId == null || !peerId.equals(maPeerId)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Multiaddrs must all have the same peer id or have no peer id', _errors_js__WEBPACK_IMPORTED_MODULE_5__.codes.ERR_INVALID_PARAMETERS);\n }\n }\n });\n }\n return {\n peerId,\n multiaddrs: peer\n };\n}\n//# sourceMappingURL=get-peer.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/get-peer.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/identify/consts.js": +/*!*********************************************************!*\ + !*** ./node_modules/libp2p/dist/src/identify/consts.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AGENT_VERSION: () => (/* binding */ AGENT_VERSION),\n/* harmony export */ IDENTIFY_PROTOCOL_VERSION: () => (/* binding */ IDENTIFY_PROTOCOL_VERSION),\n/* harmony export */ MULTICODEC_IDENTIFY: () => (/* binding */ MULTICODEC_IDENTIFY),\n/* harmony export */ MULTICODEC_IDENTIFY_PROTOCOL_NAME: () => (/* binding */ MULTICODEC_IDENTIFY_PROTOCOL_NAME),\n/* harmony export */ MULTICODEC_IDENTIFY_PROTOCOL_VERSION: () => (/* binding */ MULTICODEC_IDENTIFY_PROTOCOL_VERSION),\n/* harmony export */ MULTICODEC_IDENTIFY_PUSH: () => (/* binding */ MULTICODEC_IDENTIFY_PUSH),\n/* harmony export */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME: () => (/* binding */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME),\n/* harmony export */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION: () => (/* binding */ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION),\n/* harmony export */ PROTOCOL_VERSION: () => (/* binding */ PROTOCOL_VERSION)\n/* harmony export */ });\n/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../version.js */ \"./node_modules/libp2p/dist/src/version.js\");\n\nconst PROTOCOL_VERSION = 'ipfs/0.1.0'; // deprecated\nconst AGENT_VERSION = `js-libp2p/${_version_js__WEBPACK_IMPORTED_MODULE_0__.version}`;\nconst MULTICODEC_IDENTIFY = '/ipfs/id/1.0.0'; // deprecated\nconst MULTICODEC_IDENTIFY_PUSH = '/ipfs/id/push/1.0.0'; // deprecated\nconst IDENTIFY_PROTOCOL_VERSION = '0.1.0';\nconst MULTICODEC_IDENTIFY_PROTOCOL_NAME = 'id';\nconst MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME = 'id/push';\nconst MULTICODEC_IDENTIFY_PROTOCOL_VERSION = '1.0.0';\nconst MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION = '1.0.0';\n//# sourceMappingURL=consts.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/identify/consts.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/identify/identify.js": +/*!***********************************************************!*\ + !*** ./node_modules/libp2p/dist/src/identify/identify.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultIdentifyService: () => (/* binding */ DefaultIdentifyService)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-record */ \"./node_modules/@libp2p/peer-record/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var it_first__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! it-first */ \"./node_modules/it-first/dist/src/index.js\");\n/* harmony import */ var it_length_prefixed__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! it-length-prefixed */ \"./node_modules/it-length-prefixed/dist/src/index.js\");\n/* harmony import */ var it_pb_stream__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! it-pb-stream */ \"./node_modules/it-pb-stream/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var wherearewe__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! wherearewe */ \"./node_modules/wherearewe/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./consts.js */ \"./node_modules/libp2p/dist/src/identify/consts.js\");\n/* harmony import */ var _pb_message_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./pb/message.js */ \"./node_modules/libp2p/dist/src/identify/pb/message.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:identify');\n// https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L52\nconst MAX_IDENTIFY_MESSAGE_SIZE = 1024 * 8;\nconst defaultValues = {\n protocolPrefix: 'ipfs',\n agentVersion: _consts_js__WEBPACK_IMPORTED_MODULE_16__.AGENT_VERSION,\n // https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L48\n timeout: 60000,\n maxInboundStreams: 1,\n maxOutboundStreams: 1,\n maxPushIncomingStreams: 1,\n maxPushOutgoingStreams: 1,\n maxObservedAddresses: 10,\n maxIdentifyMessageSize: 8192\n};\nclass DefaultIdentifyService {\n identifyProtocolStr;\n identifyPushProtocolStr;\n host;\n started;\n timeout;\n peerId;\n peerStore;\n registrar;\n connectionManager;\n addressManager;\n maxInboundStreams;\n maxOutboundStreams;\n maxPushIncomingStreams;\n maxPushOutgoingStreams;\n maxIdentifyMessageSize;\n maxObservedAddresses;\n events;\n constructor(components, init) {\n this.started = false;\n this.peerId = components.peerId;\n this.peerStore = components.peerStore;\n this.registrar = components.registrar;\n this.addressManager = components.addressManager;\n this.connectionManager = components.connectionManager;\n this.events = components.events;\n this.identifyProtocolStr = `/${init.protocolPrefix ?? defaultValues.protocolPrefix}/${_consts_js__WEBPACK_IMPORTED_MODULE_16__.MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${_consts_js__WEBPACK_IMPORTED_MODULE_16__.MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`;\n this.identifyPushProtocolStr = `/${init.protocolPrefix ?? defaultValues.protocolPrefix}/${_consts_js__WEBPACK_IMPORTED_MODULE_16__.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME}/${_consts_js__WEBPACK_IMPORTED_MODULE_16__.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION}`;\n this.timeout = init.timeout ?? defaultValues.timeout;\n this.maxInboundStreams = init.maxInboundStreams ?? defaultValues.maxInboundStreams;\n this.maxOutboundStreams = init.maxOutboundStreams ?? defaultValues.maxOutboundStreams;\n this.maxPushIncomingStreams = init.maxPushIncomingStreams ?? defaultValues.maxPushIncomingStreams;\n this.maxPushOutgoingStreams = init.maxPushOutgoingStreams ?? defaultValues.maxPushOutgoingStreams;\n this.maxIdentifyMessageSize = init.maxIdentifyMessageSize ?? defaultValues.maxIdentifyMessageSize;\n this.maxObservedAddresses = init.maxObservedAddresses ?? defaultValues.maxObservedAddresses;\n // Store self host metadata\n this.host = {\n protocolVersion: `${init.protocolPrefix ?? defaultValues.protocolPrefix}/${_consts_js__WEBPACK_IMPORTED_MODULE_16__.IDENTIFY_PROTOCOL_VERSION}`,\n agentVersion: init.agentVersion ?? defaultValues.agentVersion\n };\n // When a new connection happens, trigger identify\n components.events.addEventListener('connection:open', (evt) => {\n const connection = evt.detail;\n this.identify(connection).catch(err => { log.error('error during identify trigged by connection:open', err); });\n });\n // When self peer record changes, trigger identify-push\n components.events.addEventListener('self:peer:update', (evt) => {\n void this.push().catch(err => { log.error(err); });\n });\n // Append user agent version to default AGENT_VERSION depending on the environment\n if (this.host.agentVersion === _consts_js__WEBPACK_IMPORTED_MODULE_16__.AGENT_VERSION) {\n if (wherearewe__WEBPACK_IMPORTED_MODULE_14__.isNode || wherearewe__WEBPACK_IMPORTED_MODULE_14__.isElectronMain) {\n this.host.agentVersion += ` UserAgent=${globalThis.process.version}`;\n }\n else if (wherearewe__WEBPACK_IMPORTED_MODULE_14__.isBrowser || wherearewe__WEBPACK_IMPORTED_MODULE_14__.isWebWorker || wherearewe__WEBPACK_IMPORTED_MODULE_14__.isElectronRenderer || wherearewe__WEBPACK_IMPORTED_MODULE_14__.isReactNative) {\n this.host.agentVersion += ` UserAgent=${globalThis.navigator.userAgent}`;\n }\n }\n }\n isStarted() {\n return this.started;\n }\n async start() {\n if (this.started) {\n return;\n }\n await this.peerStore.merge(this.peerId, {\n metadata: {\n AgentVersion: (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__.fromString)(this.host.agentVersion),\n ProtocolVersion: (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__.fromString)(this.host.protocolVersion)\n }\n });\n await this.registrar.handle(this.identifyProtocolStr, (data) => {\n void this._handleIdentify(data).catch(err => {\n log.error(err);\n });\n }, {\n maxInboundStreams: this.maxInboundStreams,\n maxOutboundStreams: this.maxOutboundStreams\n });\n await this.registrar.handle(this.identifyPushProtocolStr, (data) => {\n void this._handlePush(data).catch(err => {\n log.error(err);\n });\n }, {\n maxInboundStreams: this.maxPushIncomingStreams,\n maxOutboundStreams: this.maxPushOutgoingStreams\n });\n this.started = true;\n }\n async stop() {\n await this.registrar.unhandle(this.identifyProtocolStr);\n await this.registrar.unhandle(this.identifyPushProtocolStr);\n this.started = false;\n }\n /**\n * Send an Identify Push update to the list of connections\n */\n async pushToConnections(connections) {\n const listenAddresses = this.addressManager.getAddresses().map(ma => ma.decapsulateCode((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.protocols)('p2p').code));\n const peerRecord = new _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.PeerRecord({\n peerId: this.peerId,\n multiaddrs: listenAddresses\n });\n const signedPeerRecord = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.RecordEnvelope.seal(peerRecord, this.peerId);\n const supportedProtocols = this.registrar.getProtocols();\n const peer = await this.peerStore.get(this.peerId);\n const agentVersion = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_13__.toString)(peer.metadata.get('AgentVersion') ?? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__.fromString)(this.host.agentVersion));\n const protocolVersion = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_13__.toString)(peer.metadata.get('ProtocolVersion') ?? (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__.fromString)(this.host.protocolVersion));\n const pushes = connections.map(async (connection) => {\n let stream;\n const signal = AbortSignal.timeout(this.timeout);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n try {\n stream = await connection.newStream([this.identifyPushProtocolStr], {\n signal\n });\n // make stream abortable\n const source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_6__.abortableDuplex)(stream, signal);\n await source.sink((0,it_pipe__WEBPACK_IMPORTED_MODULE_11__.pipe)([_pb_message_js__WEBPACK_IMPORTED_MODULE_17__.Identify.encode({\n listenAddrs: listenAddresses.map(ma => ma.bytes),\n signedPeerRecord: signedPeerRecord.marshal(),\n protocols: supportedProtocols,\n agentVersion,\n protocolVersion\n })], (source) => it_length_prefixed__WEBPACK_IMPORTED_MODULE_9__.encode(source)));\n }\n catch (err) {\n // Just log errors\n log.error('could not push identify update to peer', err);\n }\n finally {\n if (stream != null) {\n stream.close();\n }\n }\n });\n await Promise.all(pushes);\n }\n /**\n * Calls `push` on all peer connections\n */\n async push() {\n // Do not try to push if we are not running\n if (!this.isStarted()) {\n return;\n }\n const connections = [];\n await Promise.all(this.connectionManager.getConnections().map(async (conn) => {\n try {\n const peer = await this.peerStore.get(conn.remotePeer);\n if (!peer.protocols.includes(this.identifyPushProtocolStr)) {\n return;\n }\n connections.push(conn);\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_15__.codes.ERR_NOT_FOUND) {\n throw err;\n }\n }\n }));\n await this.pushToConnections(connections);\n }\n async _identify(connection, options = {}) {\n let stream;\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_7__.anySignal)([AbortSignal.timeout(this.timeout), options?.signal]);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n try {\n stream = await connection.newStream([this.identifyProtocolStr], {\n signal\n });\n // make stream abortable\n const source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_6__.abortableDuplex)(stream, signal);\n const data = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_11__.pipe)([], source, (source) => it_length_prefixed__WEBPACK_IMPORTED_MODULE_9__.decode(source, {\n maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n }), async (source) => (0,it_first__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(source));\n if (data == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('No data could be retrieved', _errors_js__WEBPACK_IMPORTED_MODULE_15__.codes.ERR_CONNECTION_ENDED);\n }\n try {\n return _pb_message_js__WEBPACK_IMPORTED_MODULE_17__.Identify.decode(data);\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_15__.codes.ERR_INVALID_MESSAGE);\n }\n }\n finally {\n if (stream != null) {\n stream.close();\n }\n signal.clear();\n }\n }\n async identify(connection, options = {}) {\n const message = await this._identify(connection, options);\n const { publicKey, protocols, observedAddr } = message;\n if (publicKey == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('public key was missing from identify message', _errors_js__WEBPACK_IMPORTED_MODULE_15__.codes.ERR_MISSING_PUBLIC_KEY);\n }\n const id = await (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_3__.peerIdFromKeys)(publicKey);\n if (!connection.remotePeer.equals(id)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('identified peer does not match the expected peer', _errors_js__WEBPACK_IMPORTED_MODULE_15__.codes.ERR_INVALID_PEER);\n }\n if (this.peerId.equals(id)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('identified peer is our own peer id?', _errors_js__WEBPACK_IMPORTED_MODULE_15__.codes.ERR_INVALID_PEER);\n }\n // Get the observedAddr if there is one\n const cleanObservedAddr = getCleanMultiaddr(observedAddr);\n log('identify completed for peer %p and protocols %o', id, protocols);\n log('our observed address is %s', cleanObservedAddr);\n if (cleanObservedAddr != null &&\n this.addressManager.getObservedAddrs().length < (this.maxObservedAddresses ?? Infinity)) {\n log('storing our observed address %s', cleanObservedAddr?.toString());\n this.addressManager.addObservedAddr(cleanObservedAddr);\n }\n const signedPeerRecord = await this.#consumeIdentifyMessage(connection.remotePeer, message);\n const result = {\n peerId: id,\n protocolVersion: message.protocolVersion,\n agentVersion: message.agentVersion,\n publicKey: message.publicKey,\n listenAddrs: message.listenAddrs.map(buf => (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(buf)),\n observedAddr: message.observedAddr == null ? undefined : (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(message.observedAddr),\n protocols: message.protocols,\n signedPeerRecord\n };\n this.events.safeDispatchEvent('peer:identify', { detail: result });\n }\n /**\n * Sends the `Identify` response with the Signed Peer Record\n * to the requesting peer over the given `connection`\n */\n async _handleIdentify(data) {\n const { connection, stream } = data;\n const signal = AbortSignal.timeout(this.timeout);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n try {\n const publicKey = this.peerId.publicKey ?? new Uint8Array(0);\n const peerData = await this.peerStore.get(this.peerId);\n const multiaddrs = this.addressManager.getAddresses().map(ma => ma.decapsulateCode((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.protocols)('p2p').code));\n let signedPeerRecord = peerData.peerRecordEnvelope;\n if (multiaddrs.length > 0 && signedPeerRecord == null) {\n const peerRecord = new _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.PeerRecord({\n peerId: this.peerId,\n multiaddrs\n });\n const envelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.RecordEnvelope.seal(peerRecord, this.peerId);\n signedPeerRecord = envelope.marshal().subarray();\n }\n const message = _pb_message_js__WEBPACK_IMPORTED_MODULE_17__.Identify.encode({\n protocolVersion: this.host.protocolVersion,\n agentVersion: this.host.agentVersion,\n publicKey,\n listenAddrs: multiaddrs.map(addr => addr.bytes),\n signedPeerRecord,\n observedAddr: connection.remoteAddr.bytes,\n protocols: peerData.protocols\n });\n // make stream abortable\n const source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_6__.abortableDuplex)(stream, signal);\n const msgWithLenPrefix = (0,it_pipe__WEBPACK_IMPORTED_MODULE_11__.pipe)([message], (source) => it_length_prefixed__WEBPACK_IMPORTED_MODULE_9__.encode(source));\n await source.sink(msgWithLenPrefix);\n }\n catch (err) {\n log.error('could not respond to identify request', err);\n }\n finally {\n stream.close();\n }\n }\n /**\n * Reads the Identify Push message from the given `connection`\n */\n async _handlePush(data) {\n const { connection, stream } = data;\n try {\n if (this.peerId.equals(connection.remotePeer)) {\n throw new Error('received push from ourselves?');\n }\n // make stream abortable\n const source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_6__.abortableDuplex)(stream, AbortSignal.timeout(this.timeout));\n const pb = (0,it_pb_stream__WEBPACK_IMPORTED_MODULE_10__.pbStream)(source, {\n maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n });\n const message = await pb.readPB(_pb_message_js__WEBPACK_IMPORTED_MODULE_17__.Identify);\n await this.#consumeIdentifyMessage(connection.remotePeer, message);\n }\n catch (err) {\n log.error('received invalid message', err);\n return;\n }\n finally {\n stream.close();\n }\n log('handled push from %p', connection.remotePeer);\n }\n async #consumeIdentifyMessage(remotePeer, message) {\n log('received identify from %p', remotePeer);\n if (message == null) {\n throw new Error('Message was null or undefined');\n }\n const peer = {\n addresses: message.listenAddrs.map(buf => ({\n isCertified: false,\n multiaddr: (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(buf)\n })),\n protocols: message.protocols,\n metadata: new Map(),\n peerRecordEnvelope: message.signedPeerRecord\n };\n let output;\n // if the peer record has been sent, prefer the addresses in the record as they are signed by the remote peer\n if (message.signedPeerRecord != null) {\n log('received signedPeerRecord in push from %p', remotePeer);\n let peerRecordEnvelope = message.signedPeerRecord;\n const envelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.RecordEnvelope.openAndCertify(peerRecordEnvelope, _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.PeerRecord.DOMAIN);\n let peerRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.PeerRecord.createFromProtobuf(envelope.payload);\n // Verify peerId\n if (!peerRecord.peerId.equals(envelope.peerId)) {\n throw new Error('signing key does not match PeerId in the PeerRecord');\n }\n // Make sure remote peer is the one sending the record\n if (!remotePeer.equals(peerRecord.peerId)) {\n throw new Error('signing key does not match remote PeerId');\n }\n let existingPeer;\n try {\n existingPeer = await this.peerStore.get(peerRecord.peerId);\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n if (existingPeer != null) {\n // don't lose any existing metadata\n peer.metadata = existingPeer.metadata;\n // if we have previously received a signed record for this peer, compare it to the incoming one\n if (existingPeer.peerRecordEnvelope != null) {\n const storedEnvelope = await _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.RecordEnvelope.createFromProtobuf(existingPeer.peerRecordEnvelope);\n const storedRecord = _libp2p_peer_record__WEBPACK_IMPORTED_MODULE_4__.PeerRecord.createFromProtobuf(storedEnvelope.payload);\n // ensure seq is greater than, or equal to, the last received\n if (storedRecord.seqNumber >= peerRecord.seqNumber) {\n log('sequence number was lower or equal to existing sequence number - stored: %d received: %d', storedRecord.seqNumber, peerRecord.seqNumber);\n peerRecord = storedRecord;\n peerRecordEnvelope = existingPeer.peerRecordEnvelope;\n }\n }\n }\n // store the signed record for next time\n peer.peerRecordEnvelope = peerRecordEnvelope;\n // override the stored addresses with the signed multiaddrs\n peer.addresses = peerRecord.multiaddrs.map(multiaddr => ({\n isCertified: true,\n multiaddr\n }));\n output = {\n seq: peerRecord.seqNumber,\n addresses: peerRecord.multiaddrs\n };\n }\n else {\n log('%p did not send a signed peer record', remotePeer);\n }\n if (message.agentVersion != null) {\n peer.metadata.set('AgentVersion', (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__.fromString)(message.agentVersion));\n }\n if (message.protocolVersion != null) {\n peer.metadata.set('ProtocolVersion', (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_12__.fromString)(message.protocolVersion));\n }\n await this.peerStore.patch(remotePeer, peer);\n return output;\n }\n}\n/**\n * Takes the `addr` and converts it to a Multiaddr if possible\n */\nfunction getCleanMultiaddr(addr) {\n if (addr != null && addr.length > 0) {\n try {\n return (0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_5__.multiaddr)(addr);\n }\n catch {\n }\n }\n}\n//# sourceMappingURL=identify.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/identify/identify.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/identify/index.js": +/*!********************************************************!*\ + !*** ./node_modules/libp2p/dist/src/identify/index.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Message: () => (/* binding */ Message),\n/* harmony export */ identifyService: () => (/* binding */ identifyService),\n/* harmony export */ multicodecs: () => (/* binding */ multicodecs)\n/* harmony export */ });\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./consts.js */ \"./node_modules/libp2p/dist/src/identify/consts.js\");\n/* harmony import */ var _identify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./identify.js */ \"./node_modules/libp2p/dist/src/identify/identify.js\");\n/* harmony import */ var _pb_message_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pb/message.js */ \"./node_modules/libp2p/dist/src/identify/pb/message.js\");\n\n\n\n/**\n * The protocols the IdentifyService supports\n */\nconst multicodecs = {\n IDENTIFY: _consts_js__WEBPACK_IMPORTED_MODULE_0__.MULTICODEC_IDENTIFY,\n IDENTIFY_PUSH: _consts_js__WEBPACK_IMPORTED_MODULE_0__.MULTICODEC_IDENTIFY_PUSH\n};\nconst Message = { Identify: _pb_message_js__WEBPACK_IMPORTED_MODULE_2__.Identify };\nfunction identifyService(init = {}) {\n return (components) => new _identify_js__WEBPACK_IMPORTED_MODULE_1__.DefaultIdentifyService(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/identify/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/identify/pb/message.js": +/*!*************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/identify/pb/message.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Identify: () => (/* binding */ Identify)\n/* harmony export */ });\n/* harmony import */ var protons_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protons-runtime */ \"./node_modules/protons-runtime/dist/src/index.js\");\n/* eslint-disable import/export */\n/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */\n/* eslint-disable @typescript-eslint/no-empty-interface */\n\nvar Identify;\n(function (Identify) {\n let _codec;\n Identify.codec = () => {\n if (_codec == null) {\n _codec = (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.message)((obj, w, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n w.fork();\n }\n if (obj.protocolVersion != null) {\n w.uint32(42);\n w.string(obj.protocolVersion);\n }\n if (obj.agentVersion != null) {\n w.uint32(50);\n w.string(obj.agentVersion);\n }\n if (obj.publicKey != null) {\n w.uint32(10);\n w.bytes(obj.publicKey);\n }\n if (obj.listenAddrs != null) {\n for (const value of obj.listenAddrs) {\n w.uint32(18);\n w.bytes(value);\n }\n }\n if (obj.observedAddr != null) {\n w.uint32(34);\n w.bytes(obj.observedAddr);\n }\n if (obj.protocols != null) {\n for (const value of obj.protocols) {\n w.uint32(26);\n w.string(value);\n }\n }\n if (obj.signedPeerRecord != null) {\n w.uint32(66);\n w.bytes(obj.signedPeerRecord);\n }\n if (opts.lengthDelimited !== false) {\n w.ldelim();\n }\n }, (reader, length) => {\n const obj = {\n listenAddrs: [],\n protocols: []\n };\n const end = length == null ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 5:\n obj.protocolVersion = reader.string();\n break;\n case 6:\n obj.agentVersion = reader.string();\n break;\n case 1:\n obj.publicKey = reader.bytes();\n break;\n case 2:\n obj.listenAddrs.push(reader.bytes());\n break;\n case 4:\n obj.observedAddr = reader.bytes();\n break;\n case 3:\n obj.protocols.push(reader.string());\n break;\n case 8:\n obj.signedPeerRecord = reader.bytes();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return obj;\n });\n }\n return _codec;\n };\n Identify.encode = (obj) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.encodeMessage)(obj, Identify.codec());\n };\n Identify.decode = (buf) => {\n return (0,protons_runtime__WEBPACK_IMPORTED_MODULE_0__.decodeMessage)(buf, Identify.codec());\n };\n})(Identify || (Identify = {}));\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/identify/pb/message.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/index.js": +/*!***********************************************!*\ + !*** ./node_modules/libp2p/dist/src/index.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createLibp2p: () => (/* binding */ createLibp2p)\n/* harmony export */ });\n/* harmony import */ var _libp2p_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./libp2p.js */ \"./node_modules/libp2p/dist/src/libp2p.js\");\n/**\n * @packageDocumentation\n *\n * Use the `createLibp2p` function to create a libp2p node.\n *\n * @example\n *\n * ```typescript\n * import { createLibp2p } from 'libp2p'\n *\n * const node = await createLibp2p({\n * // ...other options\n * })\n * ```\n */\n\n/**\n * Returns a new instance of the Libp2p interface, generating a new PeerId\n * if one is not passed as part of the options.\n *\n * The node will be started unless `start: false` is passed as an option.\n *\n * @example\n *\n * ```js\n * import { createLibp2p } from 'libp2p'\n * import { tcp } from '@libp2p/tcp'\n * import { mplex } from '@libp2p/mplex'\n * import { noise } from '@chainsafe/libp2p-noise'\n * import { yamux } from '@chainsafe/libp2p-yamux'\n *\n * // specify options\n * const options = {\n * transports: [tcp()],\n * streamMuxers: [yamux(), mplex()],\n * connectionEncryption: [noise()]\n * }\n *\n * // create libp2p\n * const libp2p = await createLibp2p(options)\n * ```\n */\nasync function createLibp2p(options) {\n const node = await (0,_libp2p_js__WEBPACK_IMPORTED_MODULE_0__.createLibp2pNode)(options);\n if (options.start !== false) {\n await node.start();\n }\n return node;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/libp2p.js": +/*!************************************************!*\ + !*** ./node_modules/libp2p/dist/src/libp2p.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Libp2pNode: () => (/* binding */ Libp2pNode),\n/* harmony export */ createLibp2pNode: () => (/* binding */ createLibp2pNode)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/crypto/keys */ \"./node_modules/@libp2p/crypto/dist/src/keys/index.js\");\n/* harmony import */ var _libp2p_interface_content_routing__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interface-content-routing */ \"./node_modules/@libp2p/interface-content-routing/dist/src/index.js\");\n/* harmony import */ var _libp2p_interface_peer_discovery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/interface-peer-discovery */ \"./node_modules/@libp2p/interface-peer-discovery/dist/src/index.js\");\n/* harmony import */ var _libp2p_interface_peer_routing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/interface-peer-routing */ \"./node_modules/@libp2p/interface-peer-routing/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @libp2p/interfaces/events */ \"./node_modules/@libp2p/interfaces/dist/src/events.js\");\n/* harmony import */ var _libp2p_keychain__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @libp2p/keychain */ \"./node_modules/@libp2p/keychain/dist/src/index.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @libp2p/peer-collections */ \"./node_modules/@libp2p/peer-collections/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id_factory__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @libp2p/peer-id-factory */ \"./node_modules/@libp2p/peer-id-factory/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_store__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @libp2p/peer-store */ \"./node_modules/@libp2p/peer-store/dist/src/index.js\");\n/* harmony import */ var _multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @multiformats/multiaddr */ \"./node_modules/@multiformats/multiaddr/dist/src/index.js\");\n/* harmony import */ var datastore_core_memory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! datastore-core/memory */ \"./node_modules/datastore-core/dist/src/memory.js\");\n/* harmony import */ var merge_options__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! merge-options */ \"./node_modules/merge-options/index.mjs\");\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _address_manager_index_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./address-manager/index.js */ \"./node_modules/libp2p/dist/src/address-manager/index.js\");\n/* harmony import */ var _components_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./components.js */ \"./node_modules/libp2p/dist/src/components.js\");\n/* harmony import */ var _config_connection_gater_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./config/connection-gater.js */ \"./node_modules/libp2p/dist/src/config/connection-gater.browser.js\");\n/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./config.js */ \"./node_modules/libp2p/dist/src/config.js\");\n/* harmony import */ var _connection_manager_index_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./connection-manager/index.js */ \"./node_modules/libp2p/dist/src/connection-manager/index.js\");\n/* harmony import */ var _content_routing_index_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./content-routing/index.js */ \"./node_modules/libp2p/dist/src/content-routing/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _peer_routing_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./peer-routing.js */ \"./node_modules/libp2p/dist/src/peer-routing.js\");\n/* harmony import */ var _registrar_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./registrar.js */ \"./node_modules/libp2p/dist/src/registrar.js\");\n/* harmony import */ var _transport_manager_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./transport-manager.js */ \"./node_modules/libp2p/dist/src/transport-manager.js\");\n/* harmony import */ var _upgrader_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./upgrader.js */ \"./node_modules/libp2p/dist/src/upgrader.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_8__.logger)('libp2p');\nclass Libp2pNode extends _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_6__.EventEmitter {\n peerId;\n peerStore;\n contentRouting;\n peerRouting;\n keychain;\n metrics;\n services;\n components;\n #started;\n constructor(init) {\n super();\n // event bus - components can listen to this emitter to be notified of system events\n // and also cause them to be emitted\n const events = new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_6__.EventEmitter();\n const originalDispatch = events.dispatchEvent.bind(events);\n events.dispatchEvent = (evt) => {\n const internalResult = originalDispatch(evt);\n const externalResult = this.dispatchEvent(new _libp2p_interfaces_events__WEBPACK_IMPORTED_MODULE_6__.CustomEvent(evt.type, { detail: evt.detail }));\n return internalResult || externalResult;\n };\n try {\n // This emitter gets listened to a lot\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, events);\n }\n catch { }\n this.#started = false;\n this.peerId = init.peerId;\n // @ts-expect-error {} may not be of type T\n this.services = {};\n const components = this.components = (0,_components_js__WEBPACK_IMPORTED_MODULE_19__.defaultComponents)({\n peerId: init.peerId,\n events,\n datastore: init.datastore ?? new datastore_core_memory__WEBPACK_IMPORTED_MODULE_14__.MemoryDatastore(),\n connectionGater: (0,_config_connection_gater_js__WEBPACK_IMPORTED_MODULE_20__.connectionGater)(init.connectionGater)\n });\n this.peerStore = this.configureComponent('peerStore', new _libp2p_peer_store__WEBPACK_IMPORTED_MODULE_12__.PersistentPeerStore(components, {\n addressFilter: this.components.connectionGater.filterMultiaddrForPeer,\n ...init.peerStore\n }));\n // Create Metrics\n if (init.metrics != null) {\n this.metrics = this.configureComponent('metrics', init.metrics(this.components));\n }\n components.events.addEventListener('peer:update', evt => {\n // if there was no peer previously in the peer store this is a new peer\n if (evt.detail.previous == null) {\n this.safeDispatchEvent('peer:discovery', { detail: evt.detail.peer });\n }\n });\n // Set up connection protector if configured\n if (init.connectionProtector != null) {\n this.configureComponent('connectionProtector', init.connectionProtector(components));\n }\n // Set up the Upgrader\n this.components.upgrader = new _upgrader_js__WEBPACK_IMPORTED_MODULE_28__.DefaultUpgrader(this.components, {\n connectionEncryption: (init.connectionEncryption ?? []).map((fn, index) => this.configureComponent(`connection-encryption-${index}`, fn(this.components))),\n muxers: (init.streamMuxers ?? []).map((fn, index) => this.configureComponent(`stream-muxers-${index}`, fn(this.components))),\n inboundUpgradeTimeout: init.connectionManager.inboundUpgradeTimeout\n });\n // Setup the transport manager\n this.configureComponent('transportManager', new _transport_manager_js__WEBPACK_IMPORTED_MODULE_27__.DefaultTransportManager(this.components, init.transportManager));\n // Create the Connection Manager\n this.configureComponent('connectionManager', new _connection_manager_index_js__WEBPACK_IMPORTED_MODULE_22__.DefaultConnectionManager(this.components, init.connectionManager));\n // Create the Registrar\n this.configureComponent('registrar', new _registrar_js__WEBPACK_IMPORTED_MODULE_26__.DefaultRegistrar(this.components));\n // Addresses {listen, announce, noAnnounce}\n this.configureComponent('addressManager', new _address_manager_index_js__WEBPACK_IMPORTED_MODULE_18__.DefaultAddressManager(this.components, init.addresses));\n // Create keychain\n const keychainOpts = _libp2p_keychain__WEBPACK_IMPORTED_MODULE_7__.DefaultKeyChain.generateOptions();\n this.keychain = this.configureComponent('keyChain', new _libp2p_keychain__WEBPACK_IMPORTED_MODULE_7__.DefaultKeyChain(this.components, {\n ...keychainOpts,\n ...init.keychain\n }));\n // Peer routers\n const peerRouters = (init.peerRouters ?? []).map((fn, index) => this.configureComponent(`peer-router-${index}`, fn(this.components)));\n this.peerRouting = this.components.peerRouting = this.configureComponent('peerRouting', new _peer_routing_js__WEBPACK_IMPORTED_MODULE_25__.DefaultPeerRouting(this.components, {\n routers: peerRouters\n }));\n // Content routers\n const contentRouters = (init.contentRouters ?? []).map((fn, index) => this.configureComponent(`content-router-${index}`, fn(this.components)));\n this.contentRouting = this.components.contentRouting = this.configureComponent('contentRouting', new _content_routing_index_js__WEBPACK_IMPORTED_MODULE_23__.CompoundContentRouting(this.components, {\n routers: contentRouters\n }));\n (init.peerDiscovery ?? []).forEach((fn, index) => {\n const service = this.configureComponent(`peer-discovery-${index}`, fn(this.components));\n service.addEventListener('peer', (evt) => {\n this.#onDiscoveryPeer(evt);\n });\n });\n // Transport modules\n init.transports.forEach((fn, index) => {\n this.components.transportManager.add(this.configureComponent(`transport-${index}`, fn(this.components)));\n });\n // User defined modules\n if (init.services != null) {\n for (const name of Object.keys(init.services)) {\n const createService = init.services[name];\n const service = createService(this.components);\n if (service == null) {\n log.error('service factory %s returned null or undefined instance', name);\n continue;\n }\n this.services[name] = service;\n this.configureComponent(name, service);\n if (service[_libp2p_interface_content_routing__WEBPACK_IMPORTED_MODULE_2__.contentRouting] != null) {\n log('registering service %s for content routing', name);\n contentRouters.push(service[_libp2p_interface_content_routing__WEBPACK_IMPORTED_MODULE_2__.contentRouting]);\n }\n if (service[_libp2p_interface_peer_routing__WEBPACK_IMPORTED_MODULE_4__.peerRouting] != null) {\n log('registering service %s for peer routing', name);\n peerRouters.push(service[_libp2p_interface_peer_routing__WEBPACK_IMPORTED_MODULE_4__.peerRouting]);\n }\n if (service[_libp2p_interface_peer_discovery__WEBPACK_IMPORTED_MODULE_3__.peerDiscovery] != null) {\n log('registering service %s for peer discovery', name);\n service[_libp2p_interface_peer_discovery__WEBPACK_IMPORTED_MODULE_3__.peerDiscovery].addEventListener('peer', (evt) => {\n this.#onDiscoveryPeer(evt);\n });\n }\n }\n }\n }\n configureComponent(name, component) {\n if (component == null) {\n log.error('component %s was null or undefined', name);\n }\n this.components[name] = component;\n return component;\n }\n /**\n * Starts the libp2p node and all its subsystems\n */\n async start() {\n if (this.#started) {\n return;\n }\n this.#started = true;\n log('libp2p is starting');\n const keys = await this.keychain.listKeys();\n if (keys.find(key => key.name === 'self') == null) {\n log('importing self key into keychain');\n await this.keychain.importPeer('self', this.components.peerId);\n }\n try {\n await this.components.beforeStart?.();\n await this.components.start();\n await this.components.afterStart?.();\n this.safeDispatchEvent('start', { detail: this });\n log('libp2p has started');\n }\n catch (err) {\n log.error('An error occurred starting libp2p', err);\n await this.stop();\n throw err;\n }\n }\n /**\n * Stop the libp2p node by closing its listeners and open connections\n */\n async stop() {\n if (!this.#started) {\n return;\n }\n log('libp2p is stopping');\n this.#started = false;\n await this.components.beforeStop?.();\n await this.components.stop();\n await this.components.afterStop?.();\n this.safeDispatchEvent('stop', { detail: this });\n log('libp2p has stopped');\n }\n isStarted() {\n return this.#started;\n }\n getConnections(peerId) {\n return this.components.connectionManager.getConnections(peerId);\n }\n getDialQueue() {\n return this.components.connectionManager.getDialQueue();\n }\n getPeers() {\n const peerSet = new _libp2p_peer_collections__WEBPACK_IMPORTED_MODULE_9__.PeerSet();\n for (const conn of this.components.connectionManager.getConnections()) {\n peerSet.add(conn.remotePeer);\n }\n return Array.from(peerSet);\n }\n async dial(peer, options = {}) {\n return this.components.connectionManager.openConnection(peer, options);\n }\n async dialProtocol(peer, protocols, options = {}) {\n if (protocols == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_5__.CodeError('no protocols were provided to open a stream', _errors_js__WEBPACK_IMPORTED_MODULE_24__.codes.ERR_INVALID_PROTOCOLS_FOR_STREAM);\n }\n protocols = Array.isArray(protocols) ? protocols : [protocols];\n if (protocols.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_5__.CodeError('no protocols were provided to open a stream', _errors_js__WEBPACK_IMPORTED_MODULE_24__.codes.ERR_INVALID_PROTOCOLS_FOR_STREAM);\n }\n const connection = await this.dial(peer, options);\n return connection.newStream(protocols, options);\n }\n getMultiaddrs() {\n return this.components.addressManager.getAddresses();\n }\n getProtocols() {\n return this.components.registrar.getProtocols();\n }\n async hangUp(peer) {\n if ((0,_multiformats_multiaddr__WEBPACK_IMPORTED_MODULE_13__.isMultiaddr)(peer)) {\n peer = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_10__.peerIdFromString)(peer.getPeerId() ?? '');\n }\n await this.components.connectionManager.closeConnections(peer);\n }\n /**\n * Get the public key for the given peer id\n */\n async getPublicKey(peer, options = {}) {\n log('getPublicKey %p', peer);\n if (peer.publicKey != null) {\n return peer.publicKey;\n }\n const peerInfo = await this.peerStore.get(peer);\n if (peerInfo.id.publicKey != null) {\n return peerInfo.id.publicKey;\n }\n const peerKey = (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_16__.concat)([\n (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_17__.fromString)('/pk/'),\n peer.multihash.digest\n ]);\n // search any available content routing methods\n const bytes = await this.contentRouting.get(peerKey, options);\n // ensure the returned key is valid\n (0,_libp2p_crypto_keys__WEBPACK_IMPORTED_MODULE_1__.unmarshalPublicKey)(bytes);\n await this.peerStore.patch(peer, {\n publicKey: bytes\n });\n return bytes;\n }\n async handle(protocols, handler, options) {\n if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n await Promise.all(protocols.map(async (protocol) => {\n await this.components.registrar.handle(protocol, handler, options);\n }));\n }\n async unhandle(protocols) {\n if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n await Promise.all(protocols.map(async (protocol) => {\n await this.components.registrar.unhandle(protocol);\n }));\n }\n async register(protocol, topology) {\n return this.components.registrar.register(protocol, topology);\n }\n unregister(id) {\n this.components.registrar.unregister(id);\n }\n /**\n * Called whenever peer discovery services emit `peer` events and adds peers\n * to the peer store.\n */\n #onDiscoveryPeer(evt) {\n const { detail: peer } = evt;\n if (peer.id.toString() === this.peerId.toString()) {\n log.error(new Error(_errors_js__WEBPACK_IMPORTED_MODULE_24__.codes.ERR_DISCOVERED_SELF));\n return;\n }\n void this.components.peerStore.merge(peer.id, {\n multiaddrs: peer.multiaddrs,\n protocols: peer.protocols\n })\n .catch(err => { log.error(err); });\n }\n}\n/**\n * Returns a new Libp2pNode instance - this exposes more of the internals than the\n * libp2p interface and is useful for testing and debugging.\n */\nasync function createLibp2pNode(options) {\n if (options.peerId == null) {\n const datastore = options.datastore;\n if (datastore != null) {\n try {\n // try load the peer id from the keychain\n const keyChain = new _libp2p_keychain__WEBPACK_IMPORTED_MODULE_7__.DefaultKeyChain({\n datastore\n }, (0,merge_options__WEBPACK_IMPORTED_MODULE_15__[\"default\"])(_libp2p_keychain__WEBPACK_IMPORTED_MODULE_7__.DefaultKeyChain.generateOptions(), options.keychain));\n options.peerId = await keyChain.exportPeerId('self');\n }\n catch (err) {\n if (err.code !== 'ERR_NOT_FOUND') {\n throw err;\n }\n }\n }\n }\n if (options.peerId == null) {\n // no peer id in the keychain, create a new peer id\n options.peerId = await (0,_libp2p_peer_id_factory__WEBPACK_IMPORTED_MODULE_11__.createEd25519PeerId)();\n }\n return new Libp2pNode((0,_config_js__WEBPACK_IMPORTED_MODULE_21__.validateConfig)(options));\n}\n//# sourceMappingURL=libp2p.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/libp2p.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/peer-routing.js": +/*!******************************************************!*\ + !*** ./node_modules/libp2p/dist/src/peer-routing.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultPeerRouting: () => (/* binding */ DefaultPeerRouting)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var it_filter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! it-filter */ \"./node_modules/it-filter/dist/src/index.js\");\n/* harmony import */ var it_first__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! it-first */ \"./node_modules/it-first/dist/src/index.js\");\n/* harmony import */ var it_merge__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! it-merge */ \"./node_modules/it-merge/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var _content_routing_utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./content-routing/utils.js */ \"./node_modules/libp2p/dist/src/content-routing/utils.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_1__.logger)('libp2p:peer-routing');\nclass DefaultPeerRouting {\n components;\n routers;\n constructor(components, init) {\n this.components = components;\n this.routers = init.routers ?? [];\n }\n /**\n * Iterates over all peer routers in parallel to find the given peer\n */\n async findPeer(id, options) {\n if (this.routers.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('No peer routers available', _errors_js__WEBPACK_IMPORTED_MODULE_7__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n if (id.toString() === this.components.peerId.toString()) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('Should not try to find self', _errors_js__WEBPACK_IMPORTED_MODULE_7__.codes.ERR_FIND_SELF);\n }\n const output = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)((0,it_merge__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(...this.routers.map(router => (async function* () {\n try {\n yield await router.findPeer(id, options);\n }\n catch (err) {\n log.error(err);\n }\n })())), (source) => (0,it_filter__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(source, Boolean), (source) => (0,_content_routing_utils_js__WEBPACK_IMPORTED_MODULE_6__.storeAddresses)(source, this.components.peerStore), async (source) => (0,it_first__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(source));\n if (output != null) {\n return output;\n }\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError(_errors_js__WEBPACK_IMPORTED_MODULE_7__.messages.NOT_FOUND, _errors_js__WEBPACK_IMPORTED_MODULE_7__.codes.ERR_NOT_FOUND);\n }\n /**\n * Attempt to find the closest peers on the network to the given key\n */\n async *getClosestPeers(key, options) {\n if (this.routers.length === 0) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('No peer routers available', _errors_js__WEBPACK_IMPORTED_MODULE_7__.codes.ERR_NO_ROUTERS_AVAILABLE);\n }\n yield* (0,it_pipe__WEBPACK_IMPORTED_MODULE_5__.pipe)((0,it_merge__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(...this.routers.map(router => router.getClosestPeers(key, options))), (source) => (0,_content_routing_utils_js__WEBPACK_IMPORTED_MODULE_6__.storeAddresses)(source, this.components.peerStore), (source) => (0,_content_routing_utils_js__WEBPACK_IMPORTED_MODULE_6__.uniquePeers)(source), (source) => (0,_content_routing_utils_js__WEBPACK_IMPORTED_MODULE_6__.requirePeers)(source));\n }\n}\n//# sourceMappingURL=peer-routing.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/peer-routing.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/ping/constants.js": +/*!********************************************************!*\ + !*** ./node_modules/libp2p/dist/src/ping/constants.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MAX_INBOUND_STREAMS: () => (/* binding */ MAX_INBOUND_STREAMS),\n/* harmony export */ MAX_OUTBOUND_STREAMS: () => (/* binding */ MAX_OUTBOUND_STREAMS),\n/* harmony export */ PING_LENGTH: () => (/* binding */ PING_LENGTH),\n/* harmony export */ PROTOCOL: () => (/* binding */ PROTOCOL),\n/* harmony export */ PROTOCOL_NAME: () => (/* binding */ PROTOCOL_NAME),\n/* harmony export */ PROTOCOL_PREFIX: () => (/* binding */ PROTOCOL_PREFIX),\n/* harmony export */ PROTOCOL_VERSION: () => (/* binding */ PROTOCOL_VERSION),\n/* harmony export */ TIMEOUT: () => (/* binding */ TIMEOUT)\n/* harmony export */ });\nconst PROTOCOL = '/ipfs/ping/1.0.0';\nconst PING_LENGTH = 32;\nconst PROTOCOL_VERSION = '1.0.0';\nconst PROTOCOL_NAME = 'ping';\nconst PROTOCOL_PREFIX = 'ipfs';\nconst TIMEOUT = 10000;\n// See https://github.com/libp2p/specs/blob/d4b5fb0152a6bb86cfd9ea/ping/ping.md?plain=1#L38-L43\n// The dialing peer MUST NOT keep more than one outbound stream for the ping protocol per peer.\n// The listening peer SHOULD accept at most two streams per peer since cross-stream behavior is\n// non-linear and stream writes occur asynchronously. The listening peer may perceive the\n// dialing peer closing and opening the wrong streams (for instance, closing stream B and\n// opening stream A even though the dialing peer is opening stream B and closing stream A).\nconst MAX_INBOUND_STREAMS = 2;\nconst MAX_OUTBOUND_STREAMS = 1;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/ping/constants.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/ping/index.js": +/*!****************************************************!*\ + !*** ./node_modules/libp2p/dist/src/ping/index.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pingService: () => (/* binding */ pingService)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/crypto */ \"./node_modules/@libp2p/crypto/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var it_first__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! it-first */ \"./node_modules/it-first/dist/src/index.js\");\n/* harmony import */ var it_pipe__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! it-pipe */ \"./node_modules/it-pipe/dist/src/index.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/libp2p/dist/src/ping/constants.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_3__.logger)('libp2p:ping');\nclass DefaultPingService {\n protocol;\n components;\n started;\n timeout;\n maxInboundStreams;\n maxOutboundStreams;\n constructor(components, init) {\n this.components = components;\n this.started = false;\n this.protocol = `/${init.protocolPrefix ?? _constants_js__WEBPACK_IMPORTED_MODULE_10__.PROTOCOL_PREFIX}/${_constants_js__WEBPACK_IMPORTED_MODULE_10__.PROTOCOL_NAME}/${_constants_js__WEBPACK_IMPORTED_MODULE_10__.PROTOCOL_VERSION}`;\n this.timeout = init.timeout ?? _constants_js__WEBPACK_IMPORTED_MODULE_10__.TIMEOUT;\n this.maxInboundStreams = init.maxInboundStreams ?? _constants_js__WEBPACK_IMPORTED_MODULE_10__.MAX_INBOUND_STREAMS;\n this.maxOutboundStreams = init.maxOutboundStreams ?? _constants_js__WEBPACK_IMPORTED_MODULE_10__.MAX_OUTBOUND_STREAMS;\n }\n async start() {\n await this.components.registrar.handle(this.protocol, this.handleMessage, {\n maxInboundStreams: this.maxInboundStreams,\n maxOutboundStreams: this.maxOutboundStreams\n });\n this.started = true;\n }\n async stop() {\n await this.components.registrar.unhandle(this.protocol);\n this.started = false;\n }\n isStarted() {\n return this.started;\n }\n /**\n * A handler to register with Libp2p to process ping messages\n */\n handleMessage(data) {\n const { stream } = data;\n void (0,it_pipe__WEBPACK_IMPORTED_MODULE_7__.pipe)(stream, stream)\n .catch(err => {\n log.error(err);\n });\n }\n /**\n * Ping a given peer and wait for its response, getting the operation latency.\n *\n * @param {PeerId|Multiaddr} peer\n * @returns {Promise}\n */\n async ping(peer, options = {}) {\n log('dialing %s to %p', this.protocol, peer);\n const start = Date.now();\n const data = (0,_libp2p_crypto__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(_constants_js__WEBPACK_IMPORTED_MODULE_10__.PING_LENGTH);\n const connection = await this.components.connectionManager.openConnection(peer, options);\n let stream;\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_5__.anySignal)([AbortSignal.timeout(this.timeout), options?.signal]);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n try {\n stream = await connection.newStream([this.protocol], {\n signal\n });\n // make stream abortable\n const source = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_4__.abortableDuplex)(stream, signal);\n const result = await (0,it_pipe__WEBPACK_IMPORTED_MODULE_7__.pipe)([data], source, async (source) => (0,it_first__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(source));\n const end = Date.now();\n if (result == null || !(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_8__.equals)(data, result.subarray())) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_2__.CodeError('Received wrong ping ack', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_WRONG_PING_ACK);\n }\n return end - start;\n }\n finally {\n if (stream != null) {\n stream.close();\n }\n signal.clear();\n }\n }\n}\nfunction pingService(init = {}) {\n return (components) => new DefaultPingService(components, init);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/ping/index.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/registrar.js": +/*!***************************************************!*\ + !*** ./node_modules/libp2p/dist/src/registrar.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_MAX_INBOUND_STREAMS: () => (/* binding */ DEFAULT_MAX_INBOUND_STREAMS),\n/* harmony export */ DEFAULT_MAX_OUTBOUND_STREAMS: () => (/* binding */ DEFAULT_MAX_OUTBOUND_STREAMS),\n/* harmony export */ DefaultRegistrar: () => (/* binding */ DefaultRegistrar)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_registrar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-registrar */ \"./node_modules/@libp2p/interface-registrar/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var merge_options__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! merge-options */ \"./node_modules/merge-options/index.mjs\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:registrar');\nconst DEFAULT_MAX_INBOUND_STREAMS = 32;\nconst DEFAULT_MAX_OUTBOUND_STREAMS = 64;\n/**\n * Responsible for notifying registered protocols of events in the network.\n */\nclass DefaultRegistrar {\n topologies;\n handlers;\n components;\n constructor(components) {\n this.topologies = new Map();\n this.handlers = new Map();\n this.components = components;\n this._onDisconnect = this._onDisconnect.bind(this);\n this._onPeerUpdate = this._onPeerUpdate.bind(this);\n this._onConnect = this._onConnect.bind(this);\n this.components.events.addEventListener('peer:disconnect', this._onDisconnect);\n this.components.events.addEventListener('peer:connect', this._onConnect);\n this.components.events.addEventListener('peer:update', this._onPeerUpdate);\n }\n getProtocols() {\n return Array.from(new Set([\n ...this.handlers.keys()\n ])).sort();\n }\n getHandler(protocol) {\n const handler = this.handlers.get(protocol);\n if (handler == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`No handler registered for protocol ${protocol}`, _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_NO_HANDLER_FOR_PROTOCOL);\n }\n return handler;\n }\n getTopologies(protocol) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n return [];\n }\n return [\n ...topologies.values()\n ];\n }\n /**\n * Registers the `handler` for each protocol\n */\n async handle(protocol, handler, opts) {\n if (this.handlers.has(protocol)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`Handler already registered for protocol ${protocol}`, _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);\n }\n const options = merge_options__WEBPACK_IMPORTED_MODULE_3__[\"default\"].bind({ ignoreUndefined: true })({\n maxInboundStreams: DEFAULT_MAX_INBOUND_STREAMS,\n maxOutboundStreams: DEFAULT_MAX_OUTBOUND_STREAMS\n }, opts);\n this.handlers.set(protocol, {\n handler,\n options\n });\n // Add new protocol to self protocols in the peer store\n await this.components.peerStore.merge(this.components.peerId, {\n protocols: [protocol]\n });\n }\n /**\n * Removes the handler for each protocol. The protocol\n * will no longer be supported on streams.\n */\n async unhandle(protocols) {\n const protocolList = Array.isArray(protocols) ? protocols : [protocols];\n protocolList.forEach(protocol => {\n this.handlers.delete(protocol);\n });\n // Update self protocols in the peer store\n await this.components.peerStore.patch(this.components.peerId, {\n protocols: protocolList\n });\n }\n /**\n * Register handlers for a set of multicodecs given\n */\n async register(protocol, topology) {\n if (!(0,_libp2p_interface_registrar__WEBPACK_IMPORTED_MODULE_0__.isTopology)(topology)) {\n log.error('topology must be an instance of interfaces/topology');\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('topology must be an instance of interfaces/topology', _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_INVALID_PARAMETERS);\n }\n // Create topology\n const id = `${(Math.random() * 1e9).toString(36)}${Date.now()}`;\n let topologies = this.topologies.get(protocol);\n if (topologies == null) {\n topologies = new Map();\n this.topologies.set(protocol, topologies);\n }\n topologies.set(id, topology);\n // Set registrar\n await topology.setRegistrar(this);\n return id;\n }\n /**\n * Unregister topology\n */\n unregister(id) {\n for (const [protocol, topologies] of this.topologies.entries()) {\n if (topologies.has(id)) {\n topologies.delete(id);\n if (topologies.size === 0) {\n this.topologies.delete(protocol);\n }\n }\n }\n }\n /**\n * Remove a disconnected peer from the record\n */\n _onDisconnect(evt) {\n const remotePeer = evt.detail;\n void this.components.peerStore.get(remotePeer)\n .then(peer => {\n for (const protocol of peer.protocols) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n topology.onDisconnect(remotePeer);\n }\n }\n })\n .catch(err => {\n if (err.code === _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_NOT_FOUND) {\n // peer has not completed identify so they are not in the peer store\n return;\n }\n log.error('could not inform topologies of disconnecting peer %p', remotePeer, err);\n });\n }\n /**\n * On peer connected if we already have their protocols. Usually used for reconnects\n * as change:protocols event won't be emitted due to identical protocols.\n */\n _onConnect(evt) {\n const remotePeer = evt.detail;\n void this.components.peerStore.get(remotePeer)\n .then(peer => {\n const connection = this.components.connectionManager.getConnections(peer.id)[0];\n if (connection == null) {\n log('peer %p connected but the connection manager did not have a connection', peer);\n // peer disconnected while we were loading their details from the peer store\n return;\n }\n for (const protocol of peer.protocols) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n topology.onConnect(remotePeer, connection);\n }\n }\n })\n .catch(err => {\n if (err.code === _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_NOT_FOUND) {\n // peer has not completed identify so they are not in the peer store\n return;\n }\n log.error('could not inform topologies of connecting peer %p', remotePeer, err);\n });\n }\n /**\n * Check if a new peer support the multicodecs for this topology\n */\n _onPeerUpdate(evt) {\n const { peer, previous } = evt.detail;\n const removed = (previous?.protocols ?? []).filter(protocol => !peer.protocols.includes(protocol));\n const added = peer.protocols.filter(protocol => !(previous?.protocols ?? []).includes(protocol));\n for (const protocol of removed) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n topology.onDisconnect(peer.id);\n }\n }\n for (const protocol of added) {\n const topologies = this.topologies.get(protocol);\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue;\n }\n for (const topology of topologies.values()) {\n const connection = this.components.connectionManager.getConnections(peer.id)[0];\n if (connection == null) {\n continue;\n }\n topology.onConnect(peer.id, connection);\n }\n }\n }\n}\n//# sourceMappingURL=registrar.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/registrar.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/transport-manager.js": +/*!***********************************************************!*\ + !*** ./node_modules/libp2p/dist/src/transport-manager.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultTransportManager: () => (/* binding */ DefaultTransportManager)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interface-transport */ \"./node_modules/@libp2p/interface-transport/dist/src/index.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_tracked_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/tracked-map */ \"./node_modules/@libp2p/tracked-map/dist/src/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:transports');\nclass DefaultTransportManager {\n components;\n transports;\n listeners;\n faultTolerance;\n started;\n constructor(components, init = {}) {\n this.components = components;\n this.started = false;\n this.transports = new Map();\n this.listeners = (0,_libp2p_tracked_map__WEBPACK_IMPORTED_MODULE_3__.trackedMap)({\n name: 'libp2p_transport_manager_listeners',\n metrics: this.components.metrics\n });\n this.faultTolerance = init.faultTolerance ?? _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.FaultTolerance.FATAL_ALL;\n }\n /**\n * Adds a `Transport` to the manager\n */\n add(transport) {\n const tag = transport[Symbol.toStringTag];\n if (tag == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Transport must have a valid tag', _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_INVALID_KEY);\n }\n if (this.transports.has(tag)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`There is already a transport with the tag ${tag}`, _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_DUPLICATE_TRANSPORT);\n }\n log('adding transport %s', tag);\n this.transports.set(tag, transport);\n if (!this.listeners.has(tag)) {\n this.listeners.set(tag, []);\n }\n }\n isStarted() {\n return this.started;\n }\n start() {\n this.started = true;\n }\n async afterStart() {\n // Listen on the provided transports for the provided addresses\n const addrs = this.components.addressManager.getListenAddrs();\n await this.listen(addrs);\n }\n /**\n * Stops all listeners\n */\n async stop() {\n const tasks = [];\n for (const [key, listeners] of this.listeners) {\n log('closing listeners for %s', key);\n while (listeners.length > 0) {\n const listener = listeners.pop();\n if (listener == null) {\n continue;\n }\n tasks.push(listener.close());\n }\n }\n await Promise.all(tasks);\n log('all listeners closed');\n for (const key of this.listeners.keys()) {\n this.listeners.set(key, []);\n }\n this.started = false;\n }\n /**\n * Dials the given Multiaddr over it's supported transport\n */\n async dial(ma, options) {\n const transport = this.transportForMultiaddr(ma);\n if (transport == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`No transport available for address ${String(ma)}`, _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_TRANSPORT_UNAVAILABLE);\n }\n try {\n return await transport.dial(ma, {\n ...options,\n upgrader: this.components.upgrader\n });\n }\n catch (err) {\n if (err.code == null) {\n err.code = _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_TRANSPORT_DIAL_FAILED;\n }\n throw err;\n }\n }\n /**\n * Returns all Multiaddr's the listeners are using\n */\n getAddrs() {\n let addrs = [];\n for (const listeners of this.listeners.values()) {\n for (const listener of listeners) {\n addrs = [...addrs, ...listener.getAddrs()];\n }\n }\n return addrs;\n }\n /**\n * Returns all the transports instances\n */\n getTransports() {\n return Array.of(...this.transports.values());\n }\n /**\n * Returns all the listener instances\n */\n getListeners() {\n return Array.of(...this.listeners.values()).flat();\n }\n /**\n * Finds a transport that matches the given Multiaddr\n */\n transportForMultiaddr(ma) {\n for (const transport of this.transports.values()) {\n const addrs = transport.filter([ma]);\n if (addrs.length > 0) {\n return transport;\n }\n }\n }\n /**\n * Starts listeners for each listen Multiaddr\n */\n async listen(addrs) {\n if (addrs == null || addrs.length === 0) {\n log('no addresses were provided for listening, this node is dial only');\n return;\n }\n const couldNotListen = [];\n for (const [key, transport] of this.transports.entries()) {\n const supportedAddrs = transport.filter(addrs);\n const tasks = [];\n // For each supported multiaddr, create a listener\n for (const addr of supportedAddrs) {\n log('creating listener for %s on %s', key, addr);\n const listener = transport.createListener({\n upgrader: this.components.upgrader\n });\n let listeners = this.listeners.get(key) ?? [];\n if (listeners == null) {\n listeners = [];\n this.listeners.set(key, listeners);\n }\n listeners.push(listener);\n // Track listen/close events\n listener.addEventListener('listening', () => {\n this.components.events.safeDispatchEvent('transport:listening', {\n detail: listener\n });\n });\n listener.addEventListener('close', () => {\n const index = listeners.findIndex(l => l === listener);\n // remove the listener\n listeners.splice(index, 1);\n this.components.events.safeDispatchEvent('transport:close', {\n detail: listener\n });\n });\n // We need to attempt to listen on everything\n tasks.push(listener.listen(addr));\n }\n // Keep track of transports we had no addresses for\n if (tasks.length === 0) {\n couldNotListen.push(key);\n continue;\n }\n const results = await Promise.allSettled(tasks);\n // If we are listening on at least 1 address, succeed.\n // TODO: we should look at adding a retry (`p-retry`) here to better support\n // listening on remote addresses as they may be offline. We could then potentially\n // just wait for any (`p-any`) listener to succeed on each transport before returning\n const isListening = results.find(r => r.status === 'fulfilled');\n if ((isListening == null) && this.faultTolerance !== _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.FaultTolerance.NO_FATAL) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`Transport (${key}) could not listen on any available address`, _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_NO_VALID_ADDRESSES);\n }\n }\n // If no transports were able to listen, throw an error. This likely\n // means we were given addresses we do not have transports for\n if (couldNotListen.length === this.transports.size) {\n const message = `no valid addresses were provided for transports [${couldNotListen.join(', ')}]`;\n if (this.faultTolerance === _libp2p_interface_transport__WEBPACK_IMPORTED_MODULE_0__.FaultTolerance.FATAL_ALL) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(message, _errors_js__WEBPACK_IMPORTED_MODULE_4__.codes.ERR_NO_VALID_ADDRESSES);\n }\n log(`libp2p in dial mode only: ${message}`);\n }\n }\n /**\n * Removes the given transport from the manager.\n * If a transport has any running listeners, they will be closed.\n */\n async remove(key) {\n log('removing %s', key);\n // Close any running listeners\n for (const listener of this.listeners.get(key) ?? []) {\n await listener.close();\n }\n this.transports.delete(key);\n this.listeners.delete(key);\n }\n /**\n * Removes all transports from the manager.\n * If any listeners are running, they will be closed.\n *\n * @async\n */\n async removeAll() {\n const tasks = [];\n for (const key of this.transports.keys()) {\n tasks.push(this.remove(key));\n }\n await Promise.all(tasks);\n }\n}\n//# sourceMappingURL=transport-manager.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/transport-manager.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/upgrader.js": +/*!**************************************************!*\ + !*** ./node_modules/libp2p/dist/src/upgrader.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultUpgrader: () => (/* binding */ DefaultUpgrader)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var _libp2p_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @libp2p/logger */ \"./node_modules/@libp2p/logger/dist/src/index.js\");\n/* harmony import */ var _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @libp2p/multistream-select */ \"./node_modules/@libp2p/multistream-select/dist/src/index.js\");\n/* harmony import */ var _libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @libp2p/peer-id */ \"./node_modules/@libp2p/peer-id/dist/src/index.js\");\n/* harmony import */ var abortable_iterator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! abortable-iterator */ \"./node_modules/abortable-iterator/dist/src/index.js\");\n/* harmony import */ var any_signal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! any-signal */ \"./node_modules/any-signal/dist/src/index.js\");\n/* harmony import */ var _connection_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./connection/index.js */ \"./node_modules/libp2p/dist/src/connection/index.js\");\n/* harmony import */ var _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./connection-manager/constants.js */ \"./node_modules/libp2p/dist/src/connection-manager/constants.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* harmony import */ var _registrar_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./registrar.js */ \"./node_modules/libp2p/dist/src/registrar.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst log = (0,_libp2p_logger__WEBPACK_IMPORTED_MODULE_2__.logger)('libp2p:upgrader');\nfunction findIncomingStreamLimit(protocol, registrar) {\n try {\n const { options } = registrar.getHandler(protocol);\n return options.maxInboundStreams;\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_NO_HANDLER_FOR_PROTOCOL) {\n throw err;\n }\n }\n return _registrar_js__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_MAX_INBOUND_STREAMS;\n}\nfunction findOutgoingStreamLimit(protocol, registrar, options = {}) {\n try {\n const { options } = registrar.getHandler(protocol);\n if (options.maxOutboundStreams != null) {\n return options.maxOutboundStreams;\n }\n }\n catch (err) {\n if (err.code !== _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_NO_HANDLER_FOR_PROTOCOL) {\n throw err;\n }\n }\n return options.maxOutboundStreams ?? _registrar_js__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_MAX_OUTBOUND_STREAMS;\n}\nfunction countStreams(protocol, direction, connection) {\n let streamCount = 0;\n connection.streams.forEach(stream => {\n if (stream.stat.direction === direction && stream.stat.protocol === protocol) {\n streamCount++;\n }\n });\n return streamCount;\n}\nclass DefaultUpgrader {\n components;\n connectionEncryption;\n muxers;\n inboundUpgradeTimeout;\n events;\n constructor(components, init) {\n this.components = components;\n this.connectionEncryption = new Map();\n init.connectionEncryption.forEach(encrypter => {\n this.connectionEncryption.set(encrypter.protocol, encrypter);\n });\n this.muxers = new Map();\n init.muxers.forEach(muxer => {\n this.muxers.set(muxer.protocol, muxer);\n });\n this.inboundUpgradeTimeout = init.inboundUpgradeTimeout ?? _connection_manager_constants_js__WEBPACK_IMPORTED_MODULE_8__.INBOUND_UPGRADE_TIMEOUT;\n this.events = components.events;\n }\n async shouldBlockConnection(remotePeer, maConn, connectionType) {\n const connectionGater = this.components.connectionGater[connectionType];\n if (connectionGater !== undefined) {\n if (await connectionGater(remotePeer, maConn)) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`The multiaddr connection is blocked by gater.${connectionType}`, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_CONNECTION_INTERCEPTED);\n }\n }\n }\n /**\n * Upgrades an inbound connection\n */\n async upgradeInbound(maConn, opts) {\n const accept = await this.components.connectionManager.acceptIncomingConnection(maConn);\n if (!accept) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('connection denied', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_CONNECTION_DENIED);\n }\n let encryptedConn;\n let remotePeer;\n let upgradedConn;\n let muxerFactory;\n let cryptoProtocol;\n const signal = (0,any_signal__WEBPACK_IMPORTED_MODULE_6__.anySignal)([AbortSignal.timeout(this.inboundUpgradeTimeout)]);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, signal);\n }\n catch { }\n try {\n const abortableStream = (0,abortable_iterator__WEBPACK_IMPORTED_MODULE_5__.abortableDuplex)(maConn, signal);\n maConn.source = abortableStream.source;\n maConn.sink = abortableStream.sink;\n if ((await this.components.connectionGater.denyInboundConnection?.(maConn)) === true) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('The multiaddr connection is blocked by gater.acceptConnection', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_CONNECTION_INTERCEPTED);\n }\n this.components.metrics?.trackMultiaddrConnection(maConn);\n log('starting the inbound connection upgrade');\n // Protect\n let protectedConn = maConn;\n if (opts?.skipProtection !== true) {\n const protector = this.components.connectionProtector;\n if (protector != null) {\n log('protecting the inbound connection');\n protectedConn = await protector.protect(maConn);\n }\n }\n try {\n // Encrypt the connection\n encryptedConn = protectedConn;\n if (opts?.skipEncryption !== true) {\n ({\n conn: encryptedConn,\n remotePeer,\n protocol: cryptoProtocol\n } = await this._encryptInbound(protectedConn));\n const maConn = {\n ...protectedConn,\n ...encryptedConn\n };\n await this.shouldBlockConnection(remotePeer, maConn, 'denyInboundEncryptedConnection');\n }\n else {\n const idStr = maConn.remoteAddr.getPeerId();\n if (idStr == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('inbound connection that skipped encryption must have a peer id', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_INVALID_MULTIADDR);\n }\n const remotePeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromString)(idStr);\n cryptoProtocol = 'native';\n remotePeer = remotePeerId;\n }\n upgradedConn = encryptedConn;\n if (opts?.muxerFactory != null) {\n muxerFactory = opts.muxerFactory;\n }\n else if (this.muxers.size > 0) {\n // Multiplex the connection\n const multiplexed = await this._multiplexInbound({\n ...protectedConn,\n ...encryptedConn\n }, this.muxers);\n muxerFactory = multiplexed.muxerFactory;\n upgradedConn = multiplexed.stream;\n }\n }\n catch (err) {\n log.error('Failed to upgrade inbound connection', err);\n throw err;\n }\n await this.shouldBlockConnection(remotePeer, maConn, 'denyInboundUpgradedConnection');\n log('Successfully upgraded inbound connection');\n return this._createConnection({\n cryptoProtocol,\n direction: 'inbound',\n maConn,\n upgradedConn,\n muxerFactory,\n remotePeer\n });\n }\n finally {\n this.components.connectionManager.afterUpgradeInbound();\n signal.clear();\n }\n }\n /**\n * Upgrades an outbound connection\n */\n async upgradeOutbound(maConn, opts) {\n const idStr = maConn.remoteAddr.getPeerId();\n let remotePeerId;\n if (idStr != null) {\n remotePeerId = (0,_libp2p_peer_id__WEBPACK_IMPORTED_MODULE_4__.peerIdFromString)(idStr);\n await this.shouldBlockConnection(remotePeerId, maConn, 'denyOutboundConnection');\n }\n let encryptedConn;\n let remotePeer;\n let upgradedConn;\n let cryptoProtocol;\n let muxerFactory;\n this.components.metrics?.trackMultiaddrConnection(maConn);\n log('Starting the outbound connection upgrade');\n // If the transport natively supports encryption, skip connection\n // protector and encryption\n // Protect\n let protectedConn = maConn;\n if (opts?.skipProtection !== true) {\n const protector = this.components.connectionProtector;\n if (protector != null) {\n protectedConn = await protector.protect(maConn);\n }\n }\n try {\n // Encrypt the connection\n encryptedConn = protectedConn;\n if (opts?.skipEncryption !== true) {\n ({\n conn: encryptedConn,\n remotePeer,\n protocol: cryptoProtocol\n } = await this._encryptOutbound(protectedConn, remotePeerId));\n const maConn = {\n ...protectedConn,\n ...encryptedConn\n };\n await this.shouldBlockConnection(remotePeer, maConn, 'denyOutboundEncryptedConnection');\n }\n else {\n if (remotePeerId == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Encryption was skipped but no peer id was passed', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_INVALID_PEER);\n }\n cryptoProtocol = 'native';\n remotePeer = remotePeerId;\n }\n upgradedConn = encryptedConn;\n if (opts?.muxerFactory != null) {\n muxerFactory = opts.muxerFactory;\n }\n else if (this.muxers.size > 0) {\n // Multiplex the connection\n const multiplexed = await this._multiplexOutbound({\n ...protectedConn,\n ...encryptedConn\n }, this.muxers);\n muxerFactory = multiplexed.muxerFactory;\n upgradedConn = multiplexed.stream;\n }\n }\n catch (err) {\n log.error('Failed to upgrade outbound connection', err);\n await maConn.close(err);\n throw err;\n }\n await this.shouldBlockConnection(remotePeer, maConn, 'denyOutboundUpgradedConnection');\n log('Successfully upgraded outbound connection');\n return this._createConnection({\n cryptoProtocol,\n direction: 'outbound',\n maConn,\n upgradedConn,\n muxerFactory,\n remotePeer\n });\n }\n /**\n * A convenience method for generating a new `Connection`\n */\n _createConnection(opts) {\n const { cryptoProtocol, direction, maConn, upgradedConn, remotePeer, muxerFactory } = opts;\n let muxer;\n let newStream;\n let connection; // eslint-disable-line prefer-const\n if (muxerFactory != null) {\n // Create the muxer\n muxer = muxerFactory.createStreamMuxer({\n direction,\n // Run anytime a remote stream is created\n onIncomingStream: muxedStream => {\n if (connection == null) {\n return;\n }\n void Promise.resolve()\n .then(async () => {\n const protocols = this.components.registrar.getProtocols();\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__.handle(muxedStream, protocols);\n log('%s: incoming stream opened on %s', direction, protocol);\n if (connection == null) {\n return;\n }\n const incomingLimit = findIncomingStreamLimit(protocol, this.components.registrar);\n const streamCount = countStreams(protocol, 'inbound', connection);\n if (streamCount === incomingLimit) {\n const err = new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`Too many inbound protocol streams for protocol \"${protocol}\" - limit ${incomingLimit}`, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);\n muxedStream.abort(err);\n throw err;\n }\n // after the handshake the returned stream can have early data so override\n // the souce/sink\n muxedStream.source = stream.source;\n muxedStream.sink = stream.sink;\n muxedStream.stat.protocol = protocol;\n // If a protocol stream has been successfully negotiated and is to be passed to the application,\n // the peerstore should ensure that the peer is registered with that protocol\n await this.components.peerStore.merge(remotePeer, {\n protocols: [protocol]\n });\n connection.addStream(muxedStream);\n this.components.metrics?.trackProtocolStream(muxedStream, connection);\n this._onStream({ connection, stream: muxedStream, protocol });\n })\n .catch(err => {\n log.error(err);\n if (muxedStream.stat.timeline.close == null) {\n muxedStream.close();\n }\n });\n },\n // Run anytime a stream closes\n onStreamEnd: muxedStream => {\n connection?.removeStream(muxedStream.id);\n }\n });\n newStream = async (protocols, options = {}) => {\n if (muxer == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('Stream is not multiplexed', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_MUXER_UNAVAILABLE);\n }\n log('%s: starting new stream on %s', direction, protocols);\n const muxedStream = await muxer.newStream();\n try {\n if (options.signal == null) {\n log('No abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols);\n options.signal = AbortSignal.timeout(30000);\n try {\n // fails on node < 15.4\n (0,events__WEBPACK_IMPORTED_MODULE_0__.setMaxListeners)?.(Infinity, options.signal);\n }\n catch { }\n }\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__.select(muxedStream, protocols, options);\n const outgoingLimit = findOutgoingStreamLimit(protocol, this.components.registrar, options);\n const streamCount = countStreams(protocol, 'outbound', connection);\n if (streamCount >= outgoingLimit) {\n const err = new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(`Too many outbound protocol streams for protocol \"${protocol}\" - limit ${outgoingLimit}`, _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);\n muxedStream.abort(err);\n throw err;\n }\n // If a protocol stream has been successfully negotiated and is to be passed to the application,\n // the peerstore should ensure that the peer is registered with that protocol\n await this.components.peerStore.merge(remotePeer, {\n protocols: [protocol]\n });\n // after the handshake the returned stream can have early data so override\n // the souce/sink\n muxedStream.source = stream.source;\n muxedStream.sink = stream.sink;\n muxedStream.stat.protocol = protocol;\n this.components.metrics?.trackProtocolStream(muxedStream, connection);\n return muxedStream;\n }\n catch (err) {\n log.error('could not create new stream', err);\n if (muxedStream.stat.timeline.close == null) {\n muxedStream.close();\n }\n if (err.code != null) {\n throw err;\n }\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_UNSUPPORTED_PROTOCOL);\n }\n };\n // Pipe all data through the muxer\n void Promise.all([\n muxer.sink(upgradedConn.source),\n upgradedConn.sink(muxer.source)\n ]).catch(err => {\n log.error(err);\n });\n }\n const _timeline = maConn.timeline;\n maConn.timeline = new Proxy(_timeline, {\n set: (...args) => {\n if (connection != null && args[1] === 'close' && args[2] != null && _timeline.close == null) {\n // Wait for close to finish before notifying of the closure\n (async () => {\n try {\n if (connection.stat.status === 'OPEN') {\n await connection.close();\n }\n }\n catch (err) {\n log.error(err);\n }\n finally {\n this.events.safeDispatchEvent('connection:close', {\n detail: connection\n });\n }\n })().catch(err => {\n log.error(err);\n });\n }\n return Reflect.set(...args);\n }\n });\n maConn.timeline.upgraded = Date.now();\n const errConnectionNotMultiplexed = () => {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError('connection is not multiplexed', _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_CONNECTION_NOT_MULTIPLEXED);\n };\n // Create the connection\n connection = (0,_connection_index_js__WEBPACK_IMPORTED_MODULE_7__.createConnection)({\n remoteAddr: maConn.remoteAddr,\n remotePeer,\n stat: {\n status: 'OPEN',\n direction,\n timeline: maConn.timeline,\n multiplexer: muxer?.protocol,\n encryption: cryptoProtocol\n },\n newStream: newStream ?? errConnectionNotMultiplexed,\n getStreams: () => { if (muxer != null) {\n return muxer.streams;\n }\n else {\n return errConnectionNotMultiplexed();\n } },\n close: async () => {\n await maConn.close();\n // Ensure remaining streams are closed\n if (muxer != null) {\n muxer.close();\n }\n }\n });\n this.events.safeDispatchEvent('connection:open', {\n detail: connection\n });\n return connection;\n }\n /**\n * Routes incoming streams to the correct handler\n */\n _onStream(opts) {\n const { connection, stream, protocol } = opts;\n const { handler } = this.components.registrar.getHandler(protocol);\n handler({ connection, stream });\n }\n /**\n * Attempts to encrypt the incoming `connection` with the provided `cryptos`\n */\n async _encryptInbound(connection) {\n const protocols = Array.from(this.connectionEncryption.keys());\n log('handling inbound crypto protocol selection', protocols);\n try {\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__.handle(connection, protocols, {\n writeBytes: true\n });\n const encrypter = this.connectionEncryption.get(protocol);\n if (encrypter == null) {\n throw new Error(`no crypto module found for ${protocol}`);\n }\n log('encrypting inbound connection...');\n return {\n ...await encrypter.secureInbound(this.components.peerId, stream),\n protocol\n };\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_ENCRYPTION_FAILED);\n }\n }\n /**\n * Attempts to encrypt the given `connection` with the provided connection encrypters.\n * The first `ConnectionEncrypter` module to succeed will be used\n */\n async _encryptOutbound(connection, remotePeerId) {\n const protocols = Array.from(this.connectionEncryption.keys());\n log('selecting outbound crypto protocol', protocols);\n try {\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__.select(connection, protocols, {\n writeBytes: true\n });\n const encrypter = this.connectionEncryption.get(protocol);\n if (encrypter == null) {\n throw new Error(`no crypto module found for ${protocol}`);\n }\n log('encrypting outbound connection to %p', remotePeerId);\n return {\n ...await encrypter.secureOutbound(this.components.peerId, stream, remotePeerId),\n protocol\n };\n }\n catch (err) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_ENCRYPTION_FAILED);\n }\n }\n /**\n * Selects one of the given muxers via multistream-select. That\n * muxer will be used for all future streams on the connection.\n */\n async _multiplexOutbound(connection, muxers) {\n const protocols = Array.from(muxers.keys());\n log('outbound selecting muxer %s', protocols);\n try {\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__.select(connection, protocols, {\n writeBytes: true\n });\n log('%s selected as muxer protocol', protocol);\n const muxerFactory = muxers.get(protocol);\n return { stream, muxerFactory };\n }\n catch (err) {\n log.error('error multiplexing outbound stream', err);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_MUXER_UNAVAILABLE);\n }\n }\n /**\n * Registers support for one of the given muxers via multistream-select. The\n * selected muxer will be used for all future streams on the connection.\n */\n async _multiplexInbound(connection, muxers) {\n const protocols = Array.from(muxers.keys());\n log('inbound handling muxers %s', protocols);\n try {\n const { stream, protocol } = await _libp2p_multistream_select__WEBPACK_IMPORTED_MODULE_3__.handle(connection, protocols, {\n writeBytes: true\n });\n const muxerFactory = muxers.get(protocol);\n return { stream, muxerFactory };\n }\n catch (err) {\n log.error('error multiplexing inbound stream', err);\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_1__.CodeError(String(err), _errors_js__WEBPACK_IMPORTED_MODULE_9__.codes.ERR_MUXER_UNAVAILABLE);\n }\n }\n}\n//# sourceMappingURL=upgrader.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/upgrader.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/utils/peer-job-queue.js": +/*!**************************************************************!*\ + !*** ./node_modules/libp2p/dist/src/utils/peer-job-queue.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PeerJobQueue: () => (/* binding */ PeerJobQueue)\n/* harmony export */ });\n/* harmony import */ var _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @libp2p/interfaces/errors */ \"./node_modules/@libp2p/interfaces/dist/src/errors.js\");\n/* harmony import */ var p_queue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! p-queue */ \"./node_modules/p-queue/dist/index.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../errors.js */ \"./node_modules/libp2p/dist/src/errors.js\");\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\n\n\n// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nfunction lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n/**\n * Port of https://github.com/sindresorhus/p-queue/blob/main/source/priority-queue.ts\n * that adds support for filtering jobs by peer id\n */\nclass PeerPriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const peerId = options?.peerId;\n const priority = options?.priority ?? 0;\n if (peerId == null) {\n throw new _libp2p_interfaces_errors__WEBPACK_IMPORTED_MODULE_0__.CodeError('missing peer id', _errors_js__WEBPACK_IMPORTED_MODULE_2__.codes.ERR_INVALID_PARAMETERS);\n }\n const element = {\n priority,\n peerId,\n run\n };\n if (this.size > 0 && this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n if (options.peerId != null) {\n const peerId = options.peerId;\n return this.#queue.filter((element) => peerId.equals(element.peerId)).map((element) => element.run);\n }\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n/**\n * Extends PQueue to add support for querying queued jobs by peer id\n */\nclass PeerJobQueue extends p_queue__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n constructor(options = {}) {\n super({\n ...options,\n queueClass: PeerPriorityQueue\n });\n }\n /**\n * Returns true if this queue has a job for the passed peer id that has not yet\n * started to run\n */\n hasJob(peerId) {\n return this.sizeBy({\n peerId\n }) > 0;\n }\n}\n//# sourceMappingURL=peer-job-queue.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/utils/peer-job-queue.js?"); + +/***/ }), + +/***/ "./node_modules/libp2p/dist/src/version.js": +/*!*************************************************!*\ + !*** ./node_modules/libp2p/dist/src/version.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ name: () => (/* binding */ name),\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = '0.45.9';\nconst name = 'libp2p';\n//# sourceMappingURL=version.js.map\n\n//# sourceURL=webpack://light/./node_modules/libp2p/dist/src/version.js?"); + +/***/ }), + +/***/ "./node_modules/longbits/dist/src/index.js": +/*!*************************************************!*\ + !*** ./node_modules/longbits/dist/src/index.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LongBits: () => (/* binding */ LongBits)\n/* harmony export */ });\n/* harmony import */ var byte_access__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! byte-access */ \"./node_modules/byte-access/dist/src/index.js\");\n\nconst TWO_32 = 4294967296;\nclass LongBits {\n constructor(hi = 0, lo = 0) {\n this.hi = hi;\n this.lo = lo;\n }\n /**\n * Returns these hi/lo bits as a BigInt\n */\n toBigInt(unsigned) {\n if (unsigned === true) {\n return BigInt(this.lo >>> 0) + (BigInt(this.hi >>> 0) << 32n);\n }\n if ((this.hi >>> 31) !== 0) {\n const lo = ~this.lo + 1 >>> 0;\n let hi = ~this.hi >>> 0;\n if (lo === 0) {\n hi = hi + 1 >>> 0;\n }\n return -(BigInt(lo) + (BigInt(hi) << 32n));\n }\n return BigInt(this.lo >>> 0) + (BigInt(this.hi >>> 0) << 32n);\n }\n /**\n * Returns these hi/lo bits as a Number - this may overflow, toBigInt\n * should be preferred\n */\n toNumber(unsigned) {\n return Number(this.toBigInt(unsigned));\n }\n /**\n * ZigZag decode a LongBits object\n */\n zzDecode() {\n const mask = -(this.lo & 1);\n const lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n const hi = (this.hi >>> 1 ^ mask) >>> 0;\n return new LongBits(hi, lo);\n }\n /**\n * ZigZag encode a LongBits object\n */\n zzEncode() {\n const mask = this.hi >> 31;\n const hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n const lo = (this.lo << 1 ^ mask) >>> 0;\n return new LongBits(hi, lo);\n }\n /**\n * Encode a LongBits object as a varint byte array\n */\n toBytes(buf, offset = 0) {\n const access = (0,byte_access__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(buf);\n while (this.hi > 0) {\n access.set(offset++, this.lo & 127 | 128);\n this.lo = (this.lo >>> 7 | this.hi << 25) >>> 0;\n this.hi >>>= 7;\n }\n while (this.lo > 127) {\n access.set(offset++, this.lo & 127 | 128);\n this.lo = this.lo >>> 7;\n }\n access.set(offset++, this.lo);\n }\n /**\n * Parse a LongBits object from a BigInt\n */\n static fromBigInt(value) {\n if (value === 0n) {\n return new LongBits();\n }\n const negative = value < 0;\n if (negative) {\n value = -value;\n }\n let hi = Number(value >> 32n) | 0;\n let lo = Number(value - (BigInt(hi) << 32n)) | 0;\n if (negative) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > TWO_32) {\n lo = 0;\n if (++hi > TWO_32) {\n hi = 0;\n }\n }\n }\n return new LongBits(hi, lo);\n }\n /**\n * Parse a LongBits object from a Number\n */\n static fromNumber(value) {\n if (value === 0) {\n return new LongBits();\n }\n const sign = value < 0;\n if (sign) {\n value = -value;\n }\n let lo = value >>> 0;\n let hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295) {\n hi = 0;\n }\n }\n }\n return new LongBits(hi, lo);\n }\n /**\n * Parse a LongBits object from a varint byte array\n */\n static fromBytes(buf, offset = 0) {\n const access = (0,byte_access__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(buf);\n // tends to deopt with local vars for octet etc.\n const bits = new LongBits();\n let i = 0;\n if (buf.length - offset > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (access.get(offset) & 127) << i * 7) >>> 0;\n if (access.get(offset++) < 128) {\n return bits;\n }\n }\n // 5th\n bits.lo = (bits.lo | (access.get(offset) & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (access.get(offset) & 127) >> 4) >>> 0;\n if (access.get(offset++) < 128) {\n return bits;\n }\n i = 0;\n }\n else {\n for (; i < 4; ++i) {\n /* istanbul ignore if */\n if (offset >= buf.length) {\n throw RangeError(`index out of range: ${offset} > ${buf.length}`);\n }\n // 1st..4th\n bits.lo = (bits.lo | (access.get(offset) & 127) << i * 7) >>> 0;\n if (access.get(offset++) < 128) {\n return bits;\n }\n }\n }\n if (buf.length - offset > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (access.get(offset) & 127) << i * 7 + 3) >>> 0;\n if (access.get(offset++) < 128) {\n return bits;\n }\n }\n }\n else if (offset < buf.byteLength) {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (offset >= buf.length) {\n throw RangeError(`index out of range: ${offset} > ${buf.length}`);\n }\n // 6th..10th\n bits.hi = (bits.hi | (access.get(offset) & 127) << i * 7 + 3) >>> 0;\n if (access.get(offset++) < 128) {\n return bits;\n }\n }\n }\n /* istanbul ignore next */\n throw RangeError('invalid varint encoding');\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/longbits/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/merge-options/index.mjs": +/*!**********************************************!*\ + !*** ./node_modules/merge-options/index.mjs ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/merge-options/index.js\");\n/**\n * Thin ESM wrapper for CJS named exports.\n *\n * Ref: https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1\n */\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_index_js__WEBPACK_IMPORTED_MODULE_0__);\n\n\n//# sourceURL=webpack://light/./node_modules/merge-options/index.mjs?"); + +/***/ }), + +/***/ "./node_modules/mortice/dist/src/browser.js": +/*!**************************************************!*\ + !*** ./node_modules/mortice/dist/src/browser.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var nanoid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! nanoid */ \"./node_modules/nanoid/index.browser.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/mortice/dist/src/constants.js\");\n/* harmony import */ var observable_webworkers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! observable-webworkers */ \"./node_modules/observable-webworkers/dist/src/index.js\");\n\n\n\nconst handleWorkerLockRequest = (emitter, masterEvent, requestType, releaseType, grantType) => {\n return (worker, event) => {\n if (event.data.type !== requestType) {\n return;\n }\n const requestEvent = {\n type: event.data.type,\n name: event.data.name,\n identifier: event.data.identifier\n };\n emitter.dispatchEvent(new MessageEvent(masterEvent, {\n data: {\n name: requestEvent.name,\n handler: async () => {\n // grant lock to worker\n worker.postMessage({\n type: grantType,\n name: requestEvent.name,\n identifier: requestEvent.identifier\n });\n // wait for worker to finish\n return await new Promise((resolve) => {\n const releaseEventListener = (event) => {\n if (event == null || event.data == null) {\n return;\n }\n const releaseEvent = {\n type: event.data.type,\n name: event.data.name,\n identifier: event.data.identifier\n };\n if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {\n worker.removeEventListener('message', releaseEventListener);\n resolve();\n }\n };\n worker.addEventListener('message', releaseEventListener);\n });\n }\n }\n }));\n };\n};\nconst makeWorkerLockRequest = (name, requestType, grantType, releaseType) => {\n return async () => {\n const id = (0,nanoid__WEBPACK_IMPORTED_MODULE_2__.nanoid)();\n globalThis.postMessage({\n type: requestType,\n identifier: id,\n name\n });\n return await new Promise((resolve) => {\n const listener = (event) => {\n if (event == null || event.data == null) {\n return;\n }\n const responseEvent = {\n type: event.data.type,\n identifier: event.data.identifier\n };\n if (responseEvent.type === grantType && responseEvent.identifier === id) {\n globalThis.removeEventListener('message', listener);\n // grant lock\n resolve(() => {\n // release lock\n globalThis.postMessage({\n type: releaseType,\n identifier: id,\n name\n });\n });\n }\n };\n globalThis.addEventListener('message', listener);\n });\n };\n};\nconst defaultOptions = {\n singleProcess: false\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((options) => {\n options = Object.assign({}, defaultOptions, options);\n const isPrimary = Boolean(globalThis.document) || options.singleProcess;\n if (isPrimary) {\n const emitter = new EventTarget();\n observable_webworkers__WEBPACK_IMPORTED_MODULE_1__[\"default\"].addEventListener('message', handleWorkerLockRequest(emitter, 'requestReadLock', _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_REQUEST_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_RELEASE_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.MASTER_GRANT_READ_LOCK));\n observable_webworkers__WEBPACK_IMPORTED_MODULE_1__[\"default\"].addEventListener('message', handleWorkerLockRequest(emitter, 'requestWriteLock', _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_REQUEST_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_RELEASE_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.MASTER_GRANT_WRITE_LOCK));\n return emitter;\n }\n return {\n isWorker: true,\n readLock: (name) => makeWorkerLockRequest(name, _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_REQUEST_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.MASTER_GRANT_READ_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_RELEASE_READ_LOCK),\n writeLock: (name) => makeWorkerLockRequest(name, _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_REQUEST_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.MASTER_GRANT_WRITE_LOCK, _constants_js__WEBPACK_IMPORTED_MODULE_0__.WORKER_RELEASE_WRITE_LOCK)\n };\n});\n//# sourceMappingURL=browser.js.map\n\n//# sourceURL=webpack://light/./node_modules/mortice/dist/src/browser.js?"); + +/***/ }), + +/***/ "./node_modules/mortice/dist/src/constants.js": +/*!****************************************************!*\ + !*** ./node_modules/mortice/dist/src/constants.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MASTER_GRANT_READ_LOCK: () => (/* binding */ MASTER_GRANT_READ_LOCK),\n/* harmony export */ MASTER_GRANT_WRITE_LOCK: () => (/* binding */ MASTER_GRANT_WRITE_LOCK),\n/* harmony export */ WORKER_RELEASE_READ_LOCK: () => (/* binding */ WORKER_RELEASE_READ_LOCK),\n/* harmony export */ WORKER_RELEASE_WRITE_LOCK: () => (/* binding */ WORKER_RELEASE_WRITE_LOCK),\n/* harmony export */ WORKER_REQUEST_READ_LOCK: () => (/* binding */ WORKER_REQUEST_READ_LOCK),\n/* harmony export */ WORKER_REQUEST_WRITE_LOCK: () => (/* binding */ WORKER_REQUEST_WRITE_LOCK)\n/* harmony export */ });\nconst WORKER_REQUEST_READ_LOCK = 'lock:worker:request-read';\nconst WORKER_RELEASE_READ_LOCK = 'lock:worker:release-read';\nconst MASTER_GRANT_READ_LOCK = 'lock:master:grant-read';\nconst WORKER_REQUEST_WRITE_LOCK = 'lock:worker:request-write';\nconst WORKER_RELEASE_WRITE_LOCK = 'lock:worker:release-write';\nconst MASTER_GRANT_WRITE_LOCK = 'lock:master:grant-write';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://light/./node_modules/mortice/dist/src/constants.js?"); + +/***/ }), + +/***/ "./node_modules/mortice/dist/src/index.js": +/*!************************************************!*\ + !*** ./node_modules/mortice/dist/src/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ createMortice)\n/* harmony export */ });\n/* harmony import */ var p_queue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-queue */ \"./node_modules/p-queue/dist/index.js\");\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-timeout/index.js\");\n/* harmony import */ var _node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node.js */ \"./node_modules/mortice/dist/src/browser.js\");\n\n\n\nconst mutexes = {};\nlet implementation;\nasync function createReleaseable(queue, options) {\n let res;\n const p = new Promise((resolve) => {\n res = resolve;\n });\n void queue.add(async () => await (0,p_timeout__WEBPACK_IMPORTED_MODULE_1__[\"default\"])((async () => {\n return await new Promise((resolve) => {\n res(() => {\n resolve();\n });\n });\n })(), {\n milliseconds: options.timeout\n }));\n return await p;\n}\nconst createMutex = (name, options) => {\n if (implementation.isWorker === true) {\n return {\n readLock: implementation.readLock(name, options),\n writeLock: implementation.writeLock(name, options)\n };\n }\n const masterQueue = new p_queue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({ concurrency: 1 });\n let readQueue;\n return {\n async readLock() {\n // If there's already a read queue, just add the task to it\n if (readQueue != null) {\n return await createReleaseable(readQueue, options);\n }\n // Create a new read queue\n readQueue = new p_queue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n concurrency: options.concurrency,\n autoStart: false\n });\n const localReadQueue = readQueue;\n // Add the task to the read queue\n const readPromise = createReleaseable(readQueue, options);\n void masterQueue.add(async () => {\n // Start the task only once the master queue has completed processing\n // any previous tasks\n localReadQueue.start();\n // Once all the tasks in the read queue have completed, remove it so\n // that the next read lock will occur after any write locks that were\n // started in the interim\n return await localReadQueue.onIdle()\n .then(() => {\n if (readQueue === localReadQueue) {\n readQueue = null;\n }\n });\n });\n return await readPromise;\n },\n async writeLock() {\n // Remove the read queue reference, so that any later read locks will be\n // added to a new queue that starts after this write lock has been\n // released\n readQueue = null;\n return await createReleaseable(masterQueue, options);\n }\n };\n};\nconst defaultOptions = {\n name: 'lock',\n concurrency: Infinity,\n timeout: 84600000,\n singleProcess: false\n};\nfunction createMortice(options) {\n const opts = Object.assign({}, defaultOptions, options);\n if (implementation == null) {\n implementation = (0,_node_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(opts);\n if (implementation.isWorker !== true) {\n // we are master, set up worker requests\n implementation.addEventListener('requestReadLock', (event) => {\n if (mutexes[event.data.name] == null) {\n return;\n }\n void mutexes[event.data.name].readLock()\n .then(async (release) => await event.data.handler().finally(() => release()));\n });\n implementation.addEventListener('requestWriteLock', async (event) => {\n if (mutexes[event.data.name] == null) {\n return;\n }\n void mutexes[event.data.name].writeLock()\n .then(async (release) => await event.data.handler().finally(() => release()));\n });\n }\n }\n if (mutexes[opts.name] == null) {\n mutexes[opts.name] = createMutex(opts.name, opts);\n }\n return mutexes[opts.name];\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/mortice/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base.js": +/*!*****************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Codec: () => (/* binding */ Codec),\n/* harmony export */ baseX: () => (/* binding */ baseX),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ or: () => (/* binding */ or),\n/* harmony export */ rfc4648: () => (/* binding */ rfc4648)\n/* harmony export */ });\n/* harmony import */ var _vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../vendor/base-x.js */ \"./node_modules/multiformats/vendor/base-x.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface.js */ \"./node_modules/multiformats/src/bases/interface.js\");\n\n\n// Linter can't see that API is used in types.\n// eslint-disable-next-line\n\n\n/**\n * Class represents both BaseEncoder and MultibaseEncoder meaning it\n * can be used to encode to multibase or base encode without multibase\n * prefix.\n *\n * @class\n * @template {string} Base\n * @template {string} Prefix\n * @implements {API.MultibaseEncoder}\n * @implements {API.BaseEncoder}\n */\nclass Encoder {\n /**\n * @param {Base} name\n * @param {Prefix} prefix\n * @param {(bytes:Uint8Array) => string} baseEncode\n */\n constructor (name, prefix, baseEncode) {\n this.name = name\n this.prefix = prefix\n this.baseEncode = baseEncode\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {API.Multibase}\n */\n encode (bytes) {\n if (bytes instanceof Uint8Array) {\n return `${this.prefix}${this.baseEncode(bytes)}`\n } else {\n throw Error('Unknown type, must be binary type')\n }\n }\n}\n\n/**\n * @template {string} Prefix\n */\n/**\n * Class represents both BaseDecoder and MultibaseDecoder so it could be used\n * to decode multibases (with matching prefix) or just base decode strings\n * with corresponding base encoding.\n *\n * @class\n * @template {string} Base\n * @template {string} Prefix\n * @implements {API.MultibaseDecoder}\n * @implements {API.UnibaseDecoder}\n * @implements {API.BaseDecoder}\n */\nclass Decoder {\n /**\n * @param {Base} name\n * @param {Prefix} prefix\n * @param {(text:string) => Uint8Array} baseDecode\n */\n constructor (name, prefix, baseDecode) {\n this.name = name\n this.prefix = prefix\n /* c8 ignore next 3 */\n if (prefix.codePointAt(0) === undefined) {\n throw new Error('Invalid prefix character')\n }\n /** @private */\n this.prefixCodePoint = /** @type {number} */ (prefix.codePointAt(0))\n this.baseDecode = baseDecode\n }\n\n /**\n * @param {string} text\n */\n decode (text) {\n if (typeof text === 'string') {\n if (text.codePointAt(0) !== this.prefixCodePoint) {\n throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)\n }\n return this.baseDecode(text.slice(this.prefix.length))\n } else {\n throw Error('Can only multibase decode strings')\n }\n }\n\n /**\n * @template {string} OtherPrefix\n * @param {API.UnibaseDecoder|ComposedDecoder} decoder\n * @returns {ComposedDecoder}\n */\n or (decoder) {\n return or(this, decoder)\n }\n}\n\n/**\n * @template {string} Prefix\n * @typedef {Record>} Decoders\n */\n\n/**\n * @template {string} Prefix\n * @implements {API.MultibaseDecoder}\n * @implements {API.CombobaseDecoder}\n */\nclass ComposedDecoder {\n /**\n * @param {Decoders} decoders\n */\n constructor (decoders) {\n this.decoders = decoders\n }\n\n /**\n * @template {string} OtherPrefix\n * @param {API.UnibaseDecoder|ComposedDecoder} decoder\n * @returns {ComposedDecoder}\n */\n or (decoder) {\n return or(this, decoder)\n }\n\n /**\n * @param {string} input\n * @returns {Uint8Array}\n */\n decode (input) {\n const prefix = /** @type {Prefix} */ (input[0])\n const decoder = this.decoders[prefix]\n if (decoder) {\n return decoder.decode(input)\n } else {\n throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)\n }\n }\n}\n\n/**\n * @template {string} L\n * @template {string} R\n * @param {API.UnibaseDecoder|API.CombobaseDecoder} left\n * @param {API.UnibaseDecoder|API.CombobaseDecoder} right\n * @returns {ComposedDecoder}\n */\nconst or = (left, right) => new ComposedDecoder(/** @type {Decoders} */({\n ...(left.decoders || { [/** @type API.UnibaseDecoder */(left).prefix]: left }),\n ...(right.decoders || { [/** @type API.UnibaseDecoder */(right).prefix]: right })\n}))\n\n/**\n * @class\n * @template {string} Base\n * @template {string} Prefix\n * @implements {API.MultibaseCodec}\n * @implements {API.MultibaseEncoder}\n * @implements {API.MultibaseDecoder}\n * @implements {API.BaseCodec}\n * @implements {API.BaseEncoder}\n * @implements {API.BaseDecoder}\n */\nclass Codec {\n /**\n * @param {Base} name\n * @param {Prefix} prefix\n * @param {(bytes:Uint8Array) => string} baseEncode\n * @param {(text:string) => Uint8Array} baseDecode\n */\n constructor (name, prefix, baseEncode, baseDecode) {\n this.name = name\n this.prefix = prefix\n this.baseEncode = baseEncode\n this.baseDecode = baseDecode\n this.encoder = new Encoder(name, prefix, baseEncode)\n this.decoder = new Decoder(name, prefix, baseDecode)\n }\n\n /**\n * @param {Uint8Array} input\n */\n encode (input) {\n return this.encoder.encode(input)\n }\n\n /**\n * @param {string} input\n */\n decode (input) {\n return this.decoder.decode(input)\n }\n}\n\n/**\n * @template {string} Base\n * @template {string} Prefix\n * @param {object} options\n * @param {Base} options.name\n * @param {Prefix} options.prefix\n * @param {(bytes:Uint8Array) => string} options.encode\n * @param {(input:string) => Uint8Array} options.decode\n * @returns {Codec}\n */\nconst from = ({ name, prefix, encode, decode }) =>\n new Codec(name, prefix, encode, decode)\n\n/**\n * @template {string} Base\n * @template {string} Prefix\n * @param {object} options\n * @param {Base} options.name\n * @param {Prefix} options.prefix\n * @param {string} options.alphabet\n * @returns {Codec}\n */\nconst baseX = ({ prefix, name, alphabet }) => {\n const { encode, decode } = (0,_vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(alphabet, name)\n return from({\n prefix,\n name,\n encode,\n /**\n * @param {string} text\n */\n decode: text => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.coerce)(decode(text))\n })\n}\n\n/**\n * @param {string} string\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @param {string} name\n * @returns {Uint8Array}\n */\nconst decode = (string, alphabet, bitsPerChar, name) => {\n // Build the character lookup table:\n /** @type {Record} */\n const codes = {}\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i\n }\n\n // Count the padding bytes:\n let end = string.length\n while (string[end - 1] === '=') {\n --end\n }\n\n // Allocate the output:\n const out = new Uint8Array((end * bitsPerChar / 8) | 0)\n\n // Parse the data:\n let bits = 0 // Number of bits currently in the buffer\n let buffer = 0 // Bits waiting to be written out, MSB first\n let written = 0 // Next byte to write\n for (let i = 0; i < end; ++i) {\n // Read one character from the string:\n const value = codes[string[i]]\n if (value === undefined) {\n throw new SyntaxError(`Non-${name} character`)\n }\n\n // Append the bits to the buffer:\n buffer = (buffer << bitsPerChar) | value\n bits += bitsPerChar\n\n // Write out some bits if the buffer has a byte's worth:\n if (bits >= 8) {\n bits -= 8\n out[written++] = 0xff & (buffer >> bits)\n }\n }\n\n // Verify that we have received just enough bits:\n if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) {\n throw new SyntaxError('Unexpected end of data')\n }\n\n return out\n}\n\n/**\n * @param {Uint8Array} data\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @returns {string}\n */\nconst encode = (data, alphabet, bitsPerChar) => {\n const pad = alphabet[alphabet.length - 1] === '='\n const mask = (1 << bitsPerChar) - 1\n let out = ''\n\n let bits = 0 // Number of bits currently in the buffer\n let buffer = 0 // Bits waiting to be written out, MSB first\n for (let i = 0; i < data.length; ++i) {\n // Slurp data into the buffer:\n buffer = (buffer << 8) | data[i]\n bits += 8\n\n // Write out as much as we can:\n while (bits > bitsPerChar) {\n bits -= bitsPerChar\n out += alphabet[mask & (buffer >> bits)]\n }\n }\n\n // Partial character:\n if (bits) {\n out += alphabet[mask & (buffer << (bitsPerChar - bits))]\n }\n\n // Add padding characters until we hit a byte boundary:\n if (pad) {\n while ((out.length * bitsPerChar) & 7) {\n out += '='\n }\n }\n\n return out\n}\n\n/**\n * RFC4648 Factory\n *\n * @template {string} Base\n * @template {string} Prefix\n * @param {object} options\n * @param {Base} options.name\n * @param {Prefix} options.prefix\n * @param {string} options.alphabet\n * @param {number} options.bitsPerChar\n */\nconst rfc4648 = ({ name, prefix, bitsPerChar, alphabet }) => {\n return from({\n prefix,\n name,\n encode (input) {\n return encode(input, alphabet, bitsPerChar)\n },\n decode (input) {\n return decode(input, alphabet, bitsPerChar, name)\n }\n })\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base10.js": +/*!*******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base10.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base10: () => (/* binding */ base10)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n\n\nconst base10 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: '9',\n name: 'base10',\n alphabet: '0123456789'\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base10.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base16.js": +/*!*******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base16.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base16: () => (/* binding */ base16),\n/* harmony export */ base16upper: () => (/* binding */ base16upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base16 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'f',\n name: 'base16',\n alphabet: '0123456789abcdef',\n bitsPerChar: 4\n})\n\nconst base16upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'F',\n name: 'base16upper',\n alphabet: '0123456789ABCDEF',\n bitsPerChar: 4\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base16.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base2.js": +/*!******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base2.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base2: () => (/* binding */ base2)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base2 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '0',\n name: 'base2',\n alphabet: '01',\n bitsPerChar: 1\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base2.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base256emoji.js": +/*!*************************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base256emoji.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base256emoji: () => (/* binding */ base256emoji)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n\n\nconst alphabet = Array.from('🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂')\nconst alphabetBytesToChars = /** @type {string[]} */ (alphabet.reduce((p, c, i) => { p[i] = c; return p }, /** @type {string[]} */([])))\nconst alphabetCharsToBytes = /** @type {number[]} */ (alphabet.reduce((p, c, i) => { p[/** @type {number} */ (c.codePointAt(0))] = i; return p }, /** @type {number[]} */([])))\n\n/**\n * @param {Uint8Array} data\n * @returns {string}\n */\nfunction encode (data) {\n return data.reduce((p, c) => {\n p += alphabetBytesToChars[c]\n return p\n }, '')\n}\n\n/**\n * @param {string} str\n * @returns {Uint8Array}\n */\nfunction decode (str) {\n const byts = []\n for (const char of str) {\n const byt = alphabetCharsToBytes[/** @type {number} */ (char.codePointAt(0))]\n if (byt === undefined) {\n throw new Error(`Non-base256emoji character: ${char}`)\n }\n byts.push(byt)\n }\n return new Uint8Array(byts)\n}\n\nconst base256emoji = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '🚀',\n name: 'base256emoji',\n encode,\n decode\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base256emoji.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base32.js": +/*!*******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base32.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base32: () => (/* binding */ base32),\n/* harmony export */ base32hex: () => (/* binding */ base32hex),\n/* harmony export */ base32hexpad: () => (/* binding */ base32hexpad),\n/* harmony export */ base32hexpadupper: () => (/* binding */ base32hexpadupper),\n/* harmony export */ base32hexupper: () => (/* binding */ base32hexupper),\n/* harmony export */ base32pad: () => (/* binding */ base32pad),\n/* harmony export */ base32padupper: () => (/* binding */ base32padupper),\n/* harmony export */ base32upper: () => (/* binding */ base32upper),\n/* harmony export */ base32z: () => (/* binding */ base32z)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n\n\nconst base32 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'b',\n name: 'base32',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567',\n bitsPerChar: 5\n})\n\nconst base32upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'B',\n name: 'base32upper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n bitsPerChar: 5\n})\n\nconst base32pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'c',\n name: 'base32pad',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',\n bitsPerChar: 5\n})\n\nconst base32padupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'C',\n name: 'base32padupper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',\n bitsPerChar: 5\n})\n\nconst base32hex = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'v',\n name: 'base32hex',\n alphabet: '0123456789abcdefghijklmnopqrstuv',\n bitsPerChar: 5\n})\n\nconst base32hexupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'V',\n name: 'base32hexupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',\n bitsPerChar: 5\n})\n\nconst base32hexpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 't',\n name: 'base32hexpad',\n alphabet: '0123456789abcdefghijklmnopqrstuv=',\n bitsPerChar: 5\n})\n\nconst base32hexpadupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'T',\n name: 'base32hexpadupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',\n bitsPerChar: 5\n})\n\nconst base32z = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'h',\n name: 'base32z',\n alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',\n bitsPerChar: 5\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base32.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base36.js": +/*!*******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base36.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base36: () => (/* binding */ base36),\n/* harmony export */ base36upper: () => (/* binding */ base36upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n\n\nconst base36 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'k',\n name: 'base36',\n alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'\n})\n\nconst base36upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'K',\n name: 'base36upper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base36.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base58.js": +/*!*******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base58.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base58btc: () => (/* binding */ base58btc),\n/* harmony export */ base58flickr: () => (/* binding */ base58flickr)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n\n\nconst base58btc = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58btc',\n prefix: 'z',\n alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n})\n\nconst base58flickr = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58flickr',\n prefix: 'Z',\n alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base58.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base64.js": +/*!*******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base64.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64pad: () => (/* binding */ base64pad),\n/* harmony export */ base64url: () => (/* binding */ base64url),\n/* harmony export */ base64urlpad: () => (/* binding */ base64urlpad)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base64 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'm',\n name: 'base64',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n bitsPerChar: 6\n})\n\nconst base64pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'M',\n name: 'base64pad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n bitsPerChar: 6\n})\n\nconst base64url = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'u',\n name: 'base64url',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',\n bitsPerChar: 6\n})\n\nconst base64urlpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'U',\n name: 'base64urlpad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',\n bitsPerChar: 6\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base64.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/base8.js": +/*!******************************************************!*\ + !*** ./node_modules/multiformats/src/bases/base8.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base8: () => (/* binding */ base8)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n// @ts-check\n\n\n\nconst base8 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '7',\n name: 'base8',\n alphabet: '01234567',\n bitsPerChar: 3\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/base8.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/identity.js": +/*!*********************************************************!*\ + !*** ./node_modules/multiformats/src/bases/identity.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/src/bases/base.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n// @ts-check\n\n\n\n\nconst identity = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '\\x00',\n name: 'identity',\n encode: (buf) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.toString)(buf),\n decode: (str) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.fromString)(str)\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/identity.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bases/interface.js": +/*!**********************************************************!*\ + !*** ./node_modules/multiformats/src/bases/interface.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n// this is dummy module overlayed by interface.ts\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bases/interface.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/basics.js": +/*!*************************************************!*\ + !*** ./node_modules/multiformats/src/basics.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.CID),\n/* harmony export */ bases: () => (/* binding */ bases),\n/* harmony export */ bytes: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.bytes),\n/* harmony export */ codecs: () => (/* binding */ codecs),\n/* harmony export */ digest: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.digest),\n/* harmony export */ hasher: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.hasher),\n/* harmony export */ hashes: () => (/* binding */ hashes),\n/* harmony export */ varint: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.varint)\n/* harmony export */ });\n/* harmony import */ var _bases_identity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/identity.js */ \"./node_modules/multiformats/src/bases/identity.js\");\n/* harmony import */ var _bases_base2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base2.js */ \"./node_modules/multiformats/src/bases/base2.js\");\n/* harmony import */ var _bases_base8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base8.js */ \"./node_modules/multiformats/src/bases/base8.js\");\n/* harmony import */ var _bases_base10_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base10.js */ \"./node_modules/multiformats/src/bases/base10.js\");\n/* harmony import */ var _bases_base16_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bases/base16.js */ \"./node_modules/multiformats/src/bases/base16.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var _bases_base36_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bases/base36.js */ \"./node_modules/multiformats/src/bases/base36.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var _bases_base64_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bases/base64.js */ \"./node_modules/multiformats/src/bases/base64.js\");\n/* harmony import */ var _bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bases/base256emoji.js */ \"./node_modules/multiformats/src/bases/base256emoji.js\");\n/* harmony import */ var _hashes_sha2_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./hashes/sha2.js */ \"./node_modules/multiformats/src/hashes/sha2-browser.js\");\n/* harmony import */ var _hashes_identity_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./hashes/identity.js */ \"./node_modules/multiformats/src/hashes/identity.js\");\n/* harmony import */ var _codecs_raw_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./codecs/raw.js */ \"./node_modules/multiformats/src/codecs/raw.js\");\n/* harmony import */ var _codecs_json_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./codecs/json.js */ \"./node_modules/multiformats/src/codecs/json.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./index.js */ \"./node_modules/multiformats/src/index.js\");\n// @ts-check\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bases = { ..._bases_identity_js__WEBPACK_IMPORTED_MODULE_0__, ..._bases_base2_js__WEBPACK_IMPORTED_MODULE_1__, ..._bases_base8_js__WEBPACK_IMPORTED_MODULE_2__, ..._bases_base10_js__WEBPACK_IMPORTED_MODULE_3__, ..._bases_base16_js__WEBPACK_IMPORTED_MODULE_4__, ..._bases_base32_js__WEBPACK_IMPORTED_MODULE_5__, ..._bases_base36_js__WEBPACK_IMPORTED_MODULE_6__, ..._bases_base58_js__WEBPACK_IMPORTED_MODULE_7__, ..._bases_base64_js__WEBPACK_IMPORTED_MODULE_8__, ..._bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_9__ }\nconst hashes = { ..._hashes_sha2_js__WEBPACK_IMPORTED_MODULE_10__, ..._hashes_identity_js__WEBPACK_IMPORTED_MODULE_11__ }\nconst codecs = { raw: _codecs_raw_js__WEBPACK_IMPORTED_MODULE_12__, json: _codecs_json_js__WEBPACK_IMPORTED_MODULE_13__ }\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/basics.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/bytes.js": +/*!************************************************!*\ + !*** ./node_modules/multiformats/src/bytes.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ coerce: () => (/* binding */ coerce),\n/* harmony export */ empty: () => (/* binding */ empty),\n/* harmony export */ equals: () => (/* binding */ equals),\n/* harmony export */ fromHex: () => (/* binding */ fromHex),\n/* harmony export */ fromString: () => (/* binding */ fromString),\n/* harmony export */ isBinary: () => (/* binding */ isBinary),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nconst empty = new Uint8Array(0)\n\n/**\n * @param {Uint8Array} d\n */\nconst toHex = d => d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), '')\n\n/**\n * @param {string} hex\n */\nconst fromHex = hex => {\n const hexes = hex.match(/../g)\n return hexes ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty\n}\n\n/**\n * @param {Uint8Array} aa\n * @param {Uint8Array} bb\n */\nconst equals = (aa, bb) => {\n if (aa === bb) return true\n if (aa.byteLength !== bb.byteLength) {\n return false\n }\n\n for (let ii = 0; ii < aa.byteLength; ii++) {\n if (aa[ii] !== bb[ii]) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * @param {ArrayBufferView|ArrayBuffer|Uint8Array} o\n * @returns {Uint8Array}\n */\nconst coerce = o => {\n if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array') return o\n if (o instanceof ArrayBuffer) return new Uint8Array(o)\n if (ArrayBuffer.isView(o)) {\n return new Uint8Array(o.buffer, o.byteOffset, o.byteLength)\n }\n throw new Error('Unknown type, must be binary type')\n}\n\n/**\n * @param {any} o\n * @returns {o is ArrayBuffer|ArrayBufferView}\n */\nconst isBinary = o =>\n o instanceof ArrayBuffer || ArrayBuffer.isView(o)\n\n/**\n * @param {string} str\n * @returns {Uint8Array}\n */\nconst fromString = str => (new TextEncoder()).encode(str)\n\n/**\n * @param {Uint8Array} b\n * @returns {string}\n */\nconst toString = b => (new TextDecoder()).decode(b)\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/bytes.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/cid.js": +/*!**********************************************!*\ + !*** ./node_modules/multiformats/src/cid.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* binding */ CID),\n/* harmony export */ format: () => (/* binding */ format),\n/* harmony export */ fromJSON: () => (/* binding */ fromJSON),\n/* harmony export */ toJSON: () => (/* binding */ toJSON)\n/* harmony export */ });\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multiformats/src/varint.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multiformats/src/hashes/digest.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multiformats/src/bases/base58.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multiformats/src/bases/base32.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _link_interface_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./link/interface.js */ \"./node_modules/multiformats/src/link/interface.js\");\n\n\n\n\n\n// Linter can see that API is used in types.\n// eslint-disable-next-line\n\n\n// This way TS will also expose all the types from module\n\n\n/**\n * @template {API.Link} T\n * @template {string} Prefix\n * @param {T} link\n * @param {API.MultibaseEncoder} [base]\n * @returns {API.ToString}\n */\nconst format = (link, base) => {\n const { bytes, version } = link\n switch (version) {\n case 0:\n return toStringV0(\n bytes,\n baseCache(link),\n /** @type {API.MultibaseEncoder<\"z\">} */ (base) || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.encoder\n )\n default:\n return toStringV1(\n bytes,\n baseCache(link),\n /** @type {API.MultibaseEncoder} */ (base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.encoder)\n )\n }\n}\n\n/**\n * @template {API.UnknownLink} Link\n * @param {Link} link\n * @returns {API.LinkJSON}\n */\nconst toJSON = (link) => ({\n '/': format(link)\n})\n\n/**\n * @template {API.UnknownLink} Link\n * @param {API.LinkJSON} json\n */\nconst fromJSON = (json) =>\n CID.parse(json['/'])\n\n/** @type {WeakMap>} */\nconst cache = new WeakMap()\n\n/**\n * @param {API.UnknownLink} cid\n * @returns {Map}\n */\nconst baseCache = cid => {\n const baseCache = cache.get(cid)\n if (baseCache == null) {\n const baseCache = new Map()\n cache.set(cid, baseCache)\n return baseCache\n }\n return baseCache\n}\n\n/**\n * @template {unknown} [Data=unknown]\n * @template {number} [Format=number]\n * @template {number} [Alg=number]\n * @template {API.Version} [Version=API.Version]\n * @implements {API.Link}\n */\n\nclass CID {\n /**\n * @param {Version} version - Version of the CID\n * @param {Format} code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv\n * @param {API.MultihashDigest} multihash - (Multi)hash of the of the content.\n * @param {Uint8Array} bytes\n *\n */\n constructor (version, code, multihash, bytes) {\n /** @readonly */\n this.code = code\n /** @readonly */\n this.version = version\n /** @readonly */\n this.multihash = multihash\n /** @readonly */\n this.bytes = bytes\n\n // flag to serializers that this is a CID and\n // should be treated specially\n /** @readonly */\n this['/'] = bytes\n }\n\n /**\n * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`\n * please either use `CID.asCID(cid)` or switch to new signalling mechanism\n *\n * @deprecated\n */\n get asCID () {\n return this\n }\n\n // ArrayBufferView\n get byteOffset () {\n return this.bytes.byteOffset\n }\n\n // ArrayBufferView\n get byteLength () {\n return this.bytes.byteLength\n }\n\n /**\n * @returns {CID}\n */\n toV0 () {\n switch (this.version) {\n case 0: {\n return /** @type {CID} */ (this)\n }\n case 1: {\n const { code, multihash } = this\n\n if (code !== DAG_PB_CODE) {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0')\n }\n\n // sha2-256\n if (multihash.code !== SHA_256_CODE) {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0')\n }\n\n return /** @type {CID} */ (\n CID.createV0(\n /** @type {API.MultihashDigest} */ (multihash)\n )\n )\n }\n default: {\n throw Error(\n `Can not convert CID version ${this.version} to version 0. This is a bug please report`\n )\n }\n }\n }\n\n /**\n * @returns {CID}\n */\n toV1 () {\n switch (this.version) {\n case 0: {\n const { code, digest } = this.multihash\n const multihash = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, digest)\n return /** @type {CID} */ (\n CID.createV1(this.code, multihash)\n )\n }\n case 1: {\n return /** @type {CID} */ (this)\n }\n default: {\n throw Error(\n `Can not convert CID version ${this.version} to version 1. This is a bug please report`\n )\n }\n }\n }\n\n /**\n * @param {unknown} other\n * @returns {other is CID}\n */\n equals (other) {\n return CID.equals(this, other)\n }\n\n /**\n * @template {unknown} Data\n * @template {number} Format\n * @template {number} Alg\n * @template {API.Version} Version\n * @param {API.Link} self\n * @param {unknown} other\n * @returns {other is CID}\n */\n static equals (self, other) {\n const unknown =\n /** @type {{code?:unknown, version?:unknown, multihash?:unknown}} */ (\n other\n )\n return (\n unknown &&\n self.code === unknown.code &&\n self.version === unknown.version &&\n _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.equals(self.multihash, unknown.multihash)\n )\n }\n\n /**\n * @param {API.MultibaseEncoder} [base]\n * @returns {string}\n */\n toString (base) {\n return format(this, base)\n }\n\n toJSON () {\n return { '/': format(this) }\n }\n\n link () {\n return this\n }\n\n get [Symbol.toStringTag] () {\n return 'CID'\n }\n\n // Legacy\n\n [Symbol.for('nodejs.util.inspect.custom')] () {\n return `CID(${this.toString()})`\n }\n\n /**\n * Takes any input `value` and returns a `CID` instance if it was\n * a `CID` otherwise returns `null`. If `value` is instanceof `CID`\n * it will return value back. If `value` is not instance of this CID\n * class, but is compatible CID it will return new instance of this\n * `CID` class. Otherwise returns null.\n *\n * This allows two different incompatible versions of CID library to\n * co-exist and interop as long as binary interface is compatible.\n *\n * @template {unknown} Data\n * @template {number} Format\n * @template {number} Alg\n * @template {API.Version} Version\n * @template {unknown} U\n * @param {API.Link|U} input\n * @returns {CID|null}\n */\n static asCID (input) {\n if (input == null) {\n return null\n }\n\n const value = /** @type {any} */ (input)\n if (value instanceof CID) {\n // If value is instance of CID then we're all set.\n return value\n } else if ((value['/'] != null && value['/'] === value.bytes) || value.asCID === value) {\n // If value isn't instance of this CID class but `this.asCID === this` or\n // `value['/'] === value.bytes` is true it is CID instance coming from a\n // different implementation (diff version or duplicate). In that case we\n // rebase it to this `CID` implementation so caller is guaranteed to get\n // instance with expected API.\n const { version, code, multihash, bytes } = value\n return new CID(\n version,\n code,\n /** @type {API.MultihashDigest} */ (multihash),\n bytes || encodeCID(version, code, multihash.bytes)\n )\n } else if (value[cidSymbol] === true) {\n // If value is a CID from older implementation that used to be tagged via\n // symbol we still rebase it to the this `CID` implementation by\n // delegating that to a constructor.\n const { version, multihash, code } = value\n const digest =\n /** @type {API.MultihashDigest} */\n (_hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.decode(multihash))\n return CID.create(version, code, digest)\n } else {\n // Otherwise value is not a CID (or an incompatible version of it) in\n // which case we return `null`.\n return null\n }\n }\n\n /**\n *\n * @template {unknown} Data\n * @template {number} Format\n * @template {number} Alg\n * @template {API.Version} Version\n * @param {Version} version - Version of the CID\n * @param {Format} code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv\n * @param {API.MultihashDigest} digest - (Multi)hash of the of the content.\n * @returns {CID}\n */\n static create (version, code, digest) {\n if (typeof code !== 'number') {\n throw new Error('String codecs are no longer supported')\n }\n\n if (!(digest.bytes instanceof Uint8Array)) {\n throw new Error('Invalid digest')\n }\n\n switch (version) {\n case 0: {\n if (code !== DAG_PB_CODE) {\n throw new Error(\n `Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`\n )\n } else {\n return new CID(version, code, digest, digest.bytes)\n }\n }\n case 1: {\n const bytes = encodeCID(version, code, digest.bytes)\n return new CID(version, code, digest, bytes)\n }\n default: {\n throw new Error('Invalid version')\n }\n }\n }\n\n /**\n * Simplified version of `create` for CIDv0.\n *\n * @template {unknown} [T=unknown]\n * @param {API.MultihashDigest} digest - Multihash.\n * @returns {CID}\n */\n static createV0 (digest) {\n return CID.create(0, DAG_PB_CODE, digest)\n }\n\n /**\n * Simplified version of `create` for CIDv1.\n *\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @param {Code} code - Content encoding format code.\n * @param {API.MultihashDigest} digest - Miltihash of the content.\n * @returns {CID}\n */\n static createV1 (code, digest) {\n return CID.create(1, code, digest)\n }\n\n /**\n * Decoded a CID from its binary representation. The byte array must contain\n * only the CID with no additional bytes.\n *\n * An error will be thrown if the bytes provided do not contain a valid\n * binary representation of a CID.\n *\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @template {API.Version} Ver\n * @param {API.ByteView>} bytes\n * @returns {CID}\n */\n static decode (bytes) {\n const [cid, remainder] = CID.decodeFirst(bytes)\n if (remainder.length) {\n throw new Error('Incorrect length')\n }\n return cid\n }\n\n /**\n * Decoded a CID from its binary representation at the beginning of a byte\n * array.\n *\n * Returns an array with the first element containing the CID and the second\n * element containing the remainder of the original byte array. The remainder\n * will be a zero-length byte array if the provided bytes only contained a\n * binary CID representation.\n *\n * @template {unknown} T\n * @template {number} C\n * @template {number} A\n * @template {API.Version} V\n * @param {API.ByteView>} bytes\n * @returns {[CID, Uint8Array]}\n */\n static decodeFirst (bytes) {\n const specs = CID.inspectBytes(bytes)\n const prefixSize = specs.size - specs.multihashSize\n const multihashBytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_4__.coerce)(\n bytes.subarray(prefixSize, prefixSize + specs.multihashSize)\n )\n if (multihashBytes.byteLength !== specs.multihashSize) {\n throw new Error('Incorrect length')\n }\n const digestBytes = multihashBytes.subarray(\n specs.multihashSize - specs.digestSize\n )\n const digest = new _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.Digest(\n specs.multihashCode,\n specs.digestSize,\n digestBytes,\n multihashBytes\n )\n const cid =\n specs.version === 0\n ? CID.createV0(/** @type {API.MultihashDigest} */ (digest))\n : CID.createV1(specs.codec, digest)\n return [/** @type {CID} */(cid), bytes.subarray(specs.size)]\n }\n\n /**\n * Inspect the initial bytes of a CID to determine its properties.\n *\n * Involves decoding up to 4 varints. Typically this will require only 4 to 6\n * bytes but for larger multicodec code values and larger multihash digest\n * lengths these varints can be quite large. It is recommended that at least\n * 10 bytes be made available in the `initialBytes` argument for a complete\n * inspection.\n *\n * @template {unknown} T\n * @template {number} C\n * @template {number} A\n * @template {API.Version} V\n * @param {API.ByteView>} initialBytes\n * @returns {{ version:V, codec:C, multihashCode:A, digestSize:number, multihashSize:number, size:number }}\n */\n static inspectBytes (initialBytes) {\n let offset = 0\n const next = () => {\n const [i, length] = _varint_js__WEBPACK_IMPORTED_MODULE_0__.decode(initialBytes.subarray(offset))\n offset += length\n return i\n }\n\n let version = /** @type {V} */ (next())\n let codec = /** @type {C} */ (DAG_PB_CODE)\n if (/** @type {number} */(version) === 18) {\n // CIDv0\n version = /** @type {V} */ (0)\n offset = 0\n } else {\n codec = /** @type {C} */ (next())\n }\n\n if (version !== 0 && version !== 1) {\n throw new RangeError(`Invalid CID version ${version}`)\n }\n\n const prefixSize = offset\n const multihashCode = /** @type {A} */ (next()) // multihash code\n const digestSize = next() // multihash length\n const size = offset + digestSize\n const multihashSize = size - prefixSize\n\n return { version, codec, multihashCode, digestSize, multihashSize, size }\n }\n\n /**\n * Takes cid in a string representation and creates an instance. If `base`\n * decoder is not provided will use a default from the configuration. It will\n * throw an error if encoding of the CID is not compatible with supplied (or\n * a default decoder).\n *\n * @template {string} Prefix\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @template {API.Version} Ver\n * @param {API.ToString, Prefix>} source\n * @param {API.MultibaseDecoder} [base]\n * @returns {CID}\n */\n static parse (source, base) {\n const [prefix, bytes] = parseCIDtoBytes(source, base)\n\n const cid = CID.decode(bytes)\n\n if (cid.version === 0 && source[0] !== 'Q') {\n throw Error('Version 0 CID string must not include multibase prefix')\n }\n\n // Cache string representation to avoid computing it on `this.toString()`\n baseCache(cid).set(prefix, source)\n\n return cid\n }\n}\n\n/**\n * @template {string} Prefix\n * @template {unknown} Data\n * @template {number} Code\n * @template {number} Alg\n * @template {API.Version} Ver\n * @param {API.ToString, Prefix>} source\n * @param {API.MultibaseDecoder} [base]\n * @returns {[Prefix, API.ByteView>]}\n */\nconst parseCIDtoBytes = (source, base) => {\n switch (source[0]) {\n // CIDv0 is parsed differently\n case 'Q': {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc\n return [\n /** @type {Prefix} */ (_bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix),\n decoder.decode(`${_bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix}${source}`)\n ]\n }\n case _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix: {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc\n return [/** @type {Prefix} */(_bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix), decoder.decode(source)]\n }\n case _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.prefix: {\n const decoder = base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32\n return [/** @type {Prefix} */(_bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.prefix), decoder.decode(source)]\n }\n default: {\n if (base == null) {\n throw Error(\n 'To parse non base32 or base58btc encoded CID multibase decoder must be provided'\n )\n }\n return [/** @type {Prefix} */(source[0]), base.decode(source)]\n }\n }\n}\n\n/**\n *\n * @param {Uint8Array} bytes\n * @param {Map} cache\n * @param {API.MultibaseEncoder<'z'>} base\n */\nconst toStringV0 = (bytes, cache, base) => {\n const { prefix } = base\n if (prefix !== _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix) {\n throw Error(`Cannot string encode V0 in ${base.name} encoding`)\n }\n\n const cid = cache.get(prefix)\n if (cid == null) {\n const cid = base.encode(bytes).slice(1)\n cache.set(prefix, cid)\n return cid\n } else {\n return cid\n }\n}\n\n/**\n * @template {string} Prefix\n * @param {Uint8Array} bytes\n * @param {Map} cache\n * @param {API.MultibaseEncoder} base\n */\nconst toStringV1 = (bytes, cache, base) => {\n const { prefix } = base\n const cid = cache.get(prefix)\n if (cid == null) {\n const cid = base.encode(bytes)\n cache.set(prefix, cid)\n return cid\n } else {\n return cid\n }\n}\n\nconst DAG_PB_CODE = 0x70\nconst SHA_256_CODE = 0x12\n\n/**\n * @param {API.Version} version\n * @param {number} code\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n */\nconst encodeCID = (version, code, multihash) => {\n const codeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodingLength(version)\n const hashOffset = codeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodingLength(code)\n const bytes = new Uint8Array(hashOffset + multihash.byteLength)\n _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodeTo(version, bytes, 0)\n _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodeTo(code, bytes, codeOffset)\n bytes.set(multihash, hashOffset)\n return bytes\n}\n\nconst cidSymbol = Symbol.for('@ipld/js-cid/CID')\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/cid.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/codecs/json.js": +/*!******************************************************!*\ + !*** ./node_modules/multiformats/src/codecs/json.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n// @ts-check\n\n/**\n * @template T\n * @typedef {import('./interface.js').ByteView} ByteView\n */\n\nconst textEncoder = new TextEncoder()\nconst textDecoder = new TextDecoder()\n\nconst name = 'json'\nconst code = 0x0200\n\n/**\n * @template T\n * @param {T} node\n * @returns {ByteView}\n */\nconst encode = (node) => textEncoder.encode(JSON.stringify(node))\n\n/**\n * @template T\n * @param {ByteView} data\n * @returns {T}\n */\nconst decode = (data) => JSON.parse(textDecoder.decode(data))\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/codecs/json.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/codecs/raw.js": +/*!*****************************************************!*\ + !*** ./node_modules/multiformats/src/codecs/raw.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n// @ts-check\n\n\n\n/**\n * @template T\n * @typedef {import('./interface.js').ByteView} ByteView\n */\n\nconst name = 'raw'\nconst code = 0x55\n\n/**\n * @param {Uint8Array} node\n * @returns {ByteView}\n */\nconst encode = (node) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(node)\n\n/**\n * @param {ByteView} data\n * @returns {Uint8Array}\n */\nconst decode = (data) => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(data)\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/codecs/raw.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/hashes/digest.js": +/*!********************************************************!*\ + !*** ./node_modules/multiformats/src/hashes/digest.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Digest: () => (/* binding */ Digest),\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../varint.js */ \"./node_modules/multiformats/src/varint.js\");\n\n\n\n/**\n * Creates a multihash digest.\n *\n * @template {number} Code\n * @param {Code} code\n * @param {Uint8Array} digest\n */\nconst create = (code, digest) => {\n const size = digest.byteLength\n const sizeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(code)\n const digestOffset = sizeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(size)\n\n const bytes = new Uint8Array(digestOffset + size)\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(code, bytes, 0)\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(size, bytes, sizeOffset)\n bytes.set(digest, digestOffset)\n\n return new Digest(code, size, digest, bytes)\n}\n\n/**\n * Turns bytes representation of multihash digest into an instance.\n *\n * @param {Uint8Array} multihash\n * @returns {MultihashDigest}\n */\nconst decode = (multihash) => {\n const bytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(multihash)\n const [code, sizeOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes)\n const [size, digestOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes.subarray(sizeOffset))\n const digest = bytes.subarray(sizeOffset + digestOffset)\n\n if (digest.byteLength !== size) {\n throw new Error('Incorrect length')\n }\n\n return new Digest(code, size, digest, bytes)\n}\n\n/**\n * @param {MultihashDigest} a\n * @param {unknown} b\n * @returns {b is MultihashDigest}\n */\nconst equals = (a, b) => {\n if (a === b) {\n return true\n } else {\n const data = /** @type {{code?:unknown, size?:unknown, bytes?:unknown}} */(b)\n\n return (\n a.code === data.code &&\n a.size === data.size &&\n data.bytes instanceof Uint8Array &&\n (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.equals)(a.bytes, data.bytes)\n )\n }\n}\n\n/**\n * @typedef {import('./interface.js').MultihashDigest} MultihashDigest\n */\n\n/**\n * Represents a multihash digest which carries information about the\n * hashing algorithm and an actual hash digest.\n *\n * @template {number} Code\n * @template {number} Size\n * @class\n * @implements {MultihashDigest}\n */\nclass Digest {\n /**\n * Creates a multihash digest.\n *\n * @param {Code} code\n * @param {Size} size\n * @param {Uint8Array} digest\n * @param {Uint8Array} bytes\n */\n constructor (code, size, digest, bytes) {\n this.code = code\n this.size = size\n this.digest = digest\n this.bytes = bytes\n }\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/hashes/digest.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/hashes/hasher.js": +/*!********************************************************!*\ + !*** ./node_modules/multiformats/src/hashes/hasher.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hasher: () => (/* binding */ Hasher),\n/* harmony export */ from: () => (/* binding */ from)\n/* harmony export */ });\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multiformats/src/hashes/digest.js\");\n\n\n/**\n * @template {string} Name\n * @template {number} Code\n * @param {object} options\n * @param {Name} options.name\n * @param {Code} options.code\n * @param {(input: Uint8Array) => Await} options.encode\n */\nconst from = ({ name, code, encode }) => new Hasher(name, code, encode)\n\n/**\n * Hasher represents a hashing algorithm implementation that produces as\n * `MultihashDigest`.\n *\n * @template {string} Name\n * @template {number} Code\n * @class\n * @implements {MultihashHasher}\n */\nclass Hasher {\n /**\n *\n * @param {Name} name\n * @param {Code} code\n * @param {(input: Uint8Array) => Await} encode\n */\n constructor (name, code, encode) {\n this.name = name\n this.code = code\n this.encode = encode\n }\n\n /**\n * @param {Uint8Array} input\n * @returns {Await>}\n */\n digest (input) {\n if (input instanceof Uint8Array) {\n const result = this.encode(input)\n return result instanceof Uint8Array\n ? _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, result)\n /* c8 ignore next 1 */\n : result.then(digest => _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, digest))\n } else {\n throw Error('Unknown type, must be binary type')\n /* c8 ignore next 1 */\n }\n }\n}\n\n/**\n * @template {number} Alg\n * @typedef {import('./interface.js').MultihashHasher} MultihashHasher\n */\n\n/**\n * @template T\n * @typedef {Promise|T} Await\n */\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/hashes/hasher.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/hashes/identity.js": +/*!**********************************************************!*\ + !*** ./node_modules/multiformats/src/hashes/identity.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multiformats/src/hashes/digest.js\");\n\n\n\nconst code = 0x0\nconst name = 'identity'\n\n/** @type {(input:Uint8Array) => Uint8Array} */\nconst encode = _bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce\n\n/**\n * @param {Uint8Array} input\n * @returns {Digest.Digest}\n */\nconst digest = (input) => _digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, encode(input))\n\nconst identity = { code, name, encode, digest }\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/hashes/identity.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/hashes/sha2-browser.js": +/*!**************************************************************!*\ + !*** ./node_modules/multiformats/src/hashes/sha2-browser.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha256: () => (/* binding */ sha256),\n/* harmony export */ sha512: () => (/* binding */ sha512)\n/* harmony export */ });\n/* harmony import */ var _hasher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasher.js */ \"./node_modules/multiformats/src/hashes/hasher.js\");\n/* global crypto */\n\n\n\n/**\n * @param {AlgorithmIdentifier} name\n */\nconst sha = name =>\n /**\n * @param {Uint8Array} data\n */\n async data => new Uint8Array(await crypto.subtle.digest(name, data))\n\nconst sha256 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-256',\n code: 0x12,\n encode: sha('SHA-256')\n})\n\nconst sha512 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-512',\n code: 0x13,\n encode: sha('SHA-512')\n})\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/hashes/sha2-browser.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/index.js": +/*!************************************************!*\ + !*** ./node_modules/multiformats/src/index.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _cid_js__WEBPACK_IMPORTED_MODULE_0__.CID),\n/* harmony export */ bytes: () => (/* reexport module object */ _bytes_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ digest: () => (/* reexport module object */ _hashes_digest_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ hasher: () => (/* reexport module object */ _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ varint: () => (/* reexport module object */ _varint_js__WEBPACK_IMPORTED_MODULE_1__)\n/* harmony export */ });\n/* harmony import */ var _cid_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cid.js */ \"./node_modules/multiformats/src/cid.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multiformats/src/varint.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multiformats/src/bytes.js\");\n/* harmony import */ var _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/hasher.js */ \"./node_modules/multiformats/src/hashes/hasher.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multiformats/src/hashes/digest.js\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interface.js */ \"./node_modules/multiformats/src/interface.js\");\n\n\n\n\n\n// This way TS will also expose all the types from module\n\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/interface.js": +/*!****************************************************!*\ + !*** ./node_modules/multiformats/src/interface.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n// this is dummy module overlayed by interface.ts\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/interface.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/link/interface.js": +/*!*********************************************************!*\ + !*** ./node_modules/multiformats/src/link/interface.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n// this is dummy module overlayed by interface.ts\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/link/interface.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/src/varint.js": +/*!*************************************************!*\ + !*** ./node_modules/multiformats/src/varint.js ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encodeTo: () => (/* binding */ encodeTo),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength)\n/* harmony export */ });\n/* harmony import */ var _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../vendor/varint.js */ \"./node_modules/multiformats/vendor/varint.js\");\n\n\n/**\n * @param {Uint8Array} data\n * @param {number} [offset=0]\n * @returns {[number, number]}\n */\nconst decode = (data, offset = 0) => {\n const code = _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode(data, offset)\n return [code, _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode.bytes]\n}\n\n/**\n * @param {number} int\n * @param {Uint8Array} target\n * @param {number} [offset=0]\n */\nconst encodeTo = (int, target, offset = 0) => {\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encode(int, target, offset)\n return target\n}\n\n/**\n * @param {number} int\n * @returns {number}\n */\nconst encodingLength = (int) => {\n return _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encodingLength(int)\n}\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/src/varint.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/vendor/base-x.js": +/*!****************************************************!*\ + !*** ./node_modules/multiformats/vendor/base-x.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// base-x encoding / decoding\n// Copyright (c) 2018 base-x contributors\n// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)\n// Distributed under the MIT software license, see the accompanying\n// file LICENSE or http://www.opensource.org/licenses/mit-license.php.\nfunction base (ALPHABET, name) {\n if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up\n function encode (source) {\n if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n var b58 = new Uint8Array(size);\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin];\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0;\n b58[it1] = (carry % BASE) >>> 0;\n carry = (carry / BASE) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n pbegin++;\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }\n return str\n }\n function decodeUnsafe (source) {\n if (typeof source !== 'string') { throw new TypeError('Expected String') }\n if (source.length === 0) { return new Uint8Array() }\n var psz = 0;\n // Skip leading spaces.\n if (source[psz] === ' ') { return }\n // Skip and count leading '1's.\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size);\n // Process the characters.\n while (source[psz]) {\n // Decode character\n var carry = BASE_MAP[source.charCodeAt(psz)];\n // Invalid character\n if (carry === 255) { return }\n var i = 0;\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0;\n b256[it3] = (carry % 256) >>> 0;\n carry = (carry / 256) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n psz++;\n }\n // Skip trailing spaces.\n if (source[psz] === ' ') { return }\n // Skip leading zeroes in b256.\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j = zeroes;\n while (it4 !== size) {\n vch[j++] = b256[it4++];\n }\n return vch\n }\n function decode (string) {\n var buffer = decodeUnsafe(string);\n if (buffer) { return buffer }\n throw new Error(`Non-${name} character`)\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n}\nvar src = base;\n\nvar _brrp__multiformats_scope_baseX = src;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp__multiformats_scope_baseX);\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/vendor/base-x.js?"); + +/***/ }), + +/***/ "./node_modules/multiformats/vendor/varint.js": +/*!****************************************************!*\ + !*** ./node_modules/multiformats/vendor/varint.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar encode_1 = encode;\n\nvar MSB = 0x80\n , REST = 0x7F\n , MSBALL = ~REST\n , INT = Math.pow(2, 31);\n\nfunction encode(num, out, offset) {\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n\n while(num >= INT) {\n out[offset++] = (num & 0xFF) | MSB;\n num /= 128;\n }\n while(num & MSBALL) {\n out[offset++] = (num & 0xFF) | MSB;\n num >>>= 7;\n }\n out[offset] = num | 0;\n \n encode.bytes = offset - oldOffset + 1;\n \n return out\n}\n\nvar decode = read;\n\nvar MSB$1 = 0x80\n , REST$1 = 0x7F;\n\nfunction read(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length;\n\n do {\n if (counter >= l) {\n read.bytes = 0;\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++];\n res += shift < 28\n ? (b & REST$1) << shift\n : (b & REST$1) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$1)\n\n read.bytes = counter - offset;\n\n return res\n}\n\nvar N1 = Math.pow(2, 7);\nvar N2 = Math.pow(2, 14);\nvar N3 = Math.pow(2, 21);\nvar N4 = Math.pow(2, 28);\nvar N5 = Math.pow(2, 35);\nvar N6 = Math.pow(2, 42);\nvar N7 = Math.pow(2, 49);\nvar N8 = Math.pow(2, 56);\nvar N9 = Math.pow(2, 63);\n\nvar length = function (value) {\n return (\n value < N1 ? 1\n : value < N2 ? 2\n : value < N3 ? 3\n : value < N4 ? 4\n : value < N5 ? 5\n : value < N6 ? 6\n : value < N7 ? 7\n : value < N8 ? 8\n : value < N9 ? 9\n : 10\n )\n};\n\nvar varint = {\n encode: encode_1\n , decode: decode\n , encodingLength: length\n};\n\nvar _brrp_varint = varint;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp_varint);\n\n\n//# sourceURL=webpack://light/./node_modules/multiformats/vendor/varint.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Codec: () => (/* binding */ Codec),\n/* harmony export */ baseX: () => (/* binding */ baseX),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ or: () => (/* binding */ or),\n/* harmony export */ rfc4648: () => (/* binding */ rfc4648)\n/* harmony export */ });\n/* harmony import */ var _vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../vendor/base-x.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/vendor/base-x.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n\n\nclass Encoder {\n constructor(name, prefix, baseEncode) {\n this.name = name;\n this.prefix = prefix;\n this.baseEncode = baseEncode;\n }\n encode(bytes) {\n if (bytes instanceof Uint8Array) {\n return `${ this.prefix }${ this.baseEncode(bytes) }`;\n } else {\n throw Error('Unknown type, must be binary type');\n }\n }\n}\nclass Decoder {\n constructor(name, prefix, baseDecode) {\n this.name = name;\n this.prefix = prefix;\n if (prefix.codePointAt(0) === undefined) {\n throw new Error('Invalid prefix character');\n }\n this.prefixCodePoint = prefix.codePointAt(0);\n this.baseDecode = baseDecode;\n }\n decode(text) {\n if (typeof text === 'string') {\n if (text.codePointAt(0) !== this.prefixCodePoint) {\n throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`);\n }\n return this.baseDecode(text.slice(this.prefix.length));\n } else {\n throw Error('Can only multibase decode strings');\n }\n }\n or(decoder) {\n return or(this, decoder);\n }\n}\nclass ComposedDecoder {\n constructor(decoders) {\n this.decoders = decoders;\n }\n or(decoder) {\n return or(this, decoder);\n }\n decode(input) {\n const prefix = input[0];\n const decoder = this.decoders[prefix];\n if (decoder) {\n return decoder.decode(input);\n } else {\n throw RangeError(`Unable to decode multibase string ${ JSON.stringify(input) }, only inputs prefixed with ${ Object.keys(this.decoders) } are supported`);\n }\n }\n}\nconst or = (left, right) => new ComposedDecoder({\n ...left.decoders || { [left.prefix]: left },\n ...right.decoders || { [right.prefix]: right }\n});\nclass Codec {\n constructor(name, prefix, baseEncode, baseDecode) {\n this.name = name;\n this.prefix = prefix;\n this.baseEncode = baseEncode;\n this.baseDecode = baseDecode;\n this.encoder = new Encoder(name, prefix, baseEncode);\n this.decoder = new Decoder(name, prefix, baseDecode);\n }\n encode(input) {\n return this.encoder.encode(input);\n }\n decode(input) {\n return this.decoder.decode(input);\n }\n}\nconst from = ({name, prefix, encode, decode}) => new Codec(name, prefix, encode, decode);\nconst baseX = ({prefix, name, alphabet}) => {\n const {encode, decode} = (0,_vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(alphabet, name);\n return from({\n prefix,\n name,\n encode,\n decode: text => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.coerce)(decode(text))\n });\n};\nconst decode = (string, alphabet, bitsPerChar, name) => {\n const codes = {};\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i;\n }\n let end = string.length;\n while (string[end - 1] === '=') {\n --end;\n }\n const out = new Uint8Array(end * bitsPerChar / 8 | 0);\n let bits = 0;\n let buffer = 0;\n let written = 0;\n for (let i = 0; i < end; ++i) {\n const value = codes[string[i]];\n if (value === undefined) {\n throw new SyntaxError(`Non-${ name } character`);\n }\n buffer = buffer << bitsPerChar | value;\n bits += bitsPerChar;\n if (bits >= 8) {\n bits -= 8;\n out[written++] = 255 & buffer >> bits;\n }\n }\n if (bits >= bitsPerChar || 255 & buffer << 8 - bits) {\n throw new SyntaxError('Unexpected end of data');\n }\n return out;\n};\nconst encode = (data, alphabet, bitsPerChar) => {\n const pad = alphabet[alphabet.length - 1] === '=';\n const mask = (1 << bitsPerChar) - 1;\n let out = '';\n let bits = 0;\n let buffer = 0;\n for (let i = 0; i < data.length; ++i) {\n buffer = buffer << 8 | data[i];\n bits += 8;\n while (bits > bitsPerChar) {\n bits -= bitsPerChar;\n out += alphabet[mask & buffer >> bits];\n }\n }\n if (bits) {\n out += alphabet[mask & buffer << bitsPerChar - bits];\n }\n if (pad) {\n while (out.length * bitsPerChar & 7) {\n out += '=';\n }\n }\n return out;\n};\nconst rfc4648 = ({name, prefix, bitsPerChar, alphabet}) => {\n return from({\n prefix,\n name,\n encode(input) {\n return encode(input, alphabet, bitsPerChar);\n },\n decode(input) {\n return decode(input, alphabet, bitsPerChar, name);\n }\n });\n};\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base10.js": +/*!************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base10.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base10: () => (/* binding */ base10)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base10 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: '9',\n name: 'base10',\n alphabet: '0123456789'\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base10.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base16.js": +/*!************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base16.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base16: () => (/* binding */ base16),\n/* harmony export */ base16upper: () => (/* binding */ base16upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base16 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'f',\n name: 'base16',\n alphabet: '0123456789abcdef',\n bitsPerChar: 4\n});\nconst base16upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'F',\n name: 'base16upper',\n alphabet: '0123456789ABCDEF',\n bitsPerChar: 4\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base16.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base2.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base2.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base2: () => (/* binding */ base2)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base2 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '0',\n name: 'base2',\n alphabet: '01',\n bitsPerChar: 1\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base2.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base256emoji.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base256emoji.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base256emoji: () => (/* binding */ base256emoji)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst alphabet = Array.from('\\uD83D\\uDE80\\uD83E\\uDE90\\u2604\\uD83D\\uDEF0\\uD83C\\uDF0C\\uD83C\\uDF11\\uD83C\\uDF12\\uD83C\\uDF13\\uD83C\\uDF14\\uD83C\\uDF15\\uD83C\\uDF16\\uD83C\\uDF17\\uD83C\\uDF18\\uD83C\\uDF0D\\uD83C\\uDF0F\\uD83C\\uDF0E\\uD83D\\uDC09\\u2600\\uD83D\\uDCBB\\uD83D\\uDDA5\\uD83D\\uDCBE\\uD83D\\uDCBF\\uD83D\\uDE02\\u2764\\uD83D\\uDE0D\\uD83E\\uDD23\\uD83D\\uDE0A\\uD83D\\uDE4F\\uD83D\\uDC95\\uD83D\\uDE2D\\uD83D\\uDE18\\uD83D\\uDC4D\\uD83D\\uDE05\\uD83D\\uDC4F\\uD83D\\uDE01\\uD83D\\uDD25\\uD83E\\uDD70\\uD83D\\uDC94\\uD83D\\uDC96\\uD83D\\uDC99\\uD83D\\uDE22\\uD83E\\uDD14\\uD83D\\uDE06\\uD83D\\uDE44\\uD83D\\uDCAA\\uD83D\\uDE09\\u263A\\uD83D\\uDC4C\\uD83E\\uDD17\\uD83D\\uDC9C\\uD83D\\uDE14\\uD83D\\uDE0E\\uD83D\\uDE07\\uD83C\\uDF39\\uD83E\\uDD26\\uD83C\\uDF89\\uD83D\\uDC9E\\u270C\\u2728\\uD83E\\uDD37\\uD83D\\uDE31\\uD83D\\uDE0C\\uD83C\\uDF38\\uD83D\\uDE4C\\uD83D\\uDE0B\\uD83D\\uDC97\\uD83D\\uDC9A\\uD83D\\uDE0F\\uD83D\\uDC9B\\uD83D\\uDE42\\uD83D\\uDC93\\uD83E\\uDD29\\uD83D\\uDE04\\uD83D\\uDE00\\uD83D\\uDDA4\\uD83D\\uDE03\\uD83D\\uDCAF\\uD83D\\uDE48\\uD83D\\uDC47\\uD83C\\uDFB6\\uD83D\\uDE12\\uD83E\\uDD2D\\u2763\\uD83D\\uDE1C\\uD83D\\uDC8B\\uD83D\\uDC40\\uD83D\\uDE2A\\uD83D\\uDE11\\uD83D\\uDCA5\\uD83D\\uDE4B\\uD83D\\uDE1E\\uD83D\\uDE29\\uD83D\\uDE21\\uD83E\\uDD2A\\uD83D\\uDC4A\\uD83E\\uDD73\\uD83D\\uDE25\\uD83E\\uDD24\\uD83D\\uDC49\\uD83D\\uDC83\\uD83D\\uDE33\\u270B\\uD83D\\uDE1A\\uD83D\\uDE1D\\uD83D\\uDE34\\uD83C\\uDF1F\\uD83D\\uDE2C\\uD83D\\uDE43\\uD83C\\uDF40\\uD83C\\uDF37\\uD83D\\uDE3B\\uD83D\\uDE13\\u2B50\\u2705\\uD83E\\uDD7A\\uD83C\\uDF08\\uD83D\\uDE08\\uD83E\\uDD18\\uD83D\\uDCA6\\u2714\\uD83D\\uDE23\\uD83C\\uDFC3\\uD83D\\uDC90\\u2639\\uD83C\\uDF8A\\uD83D\\uDC98\\uD83D\\uDE20\\u261D\\uD83D\\uDE15\\uD83C\\uDF3A\\uD83C\\uDF82\\uD83C\\uDF3B\\uD83D\\uDE10\\uD83D\\uDD95\\uD83D\\uDC9D\\uD83D\\uDE4A\\uD83D\\uDE39\\uD83D\\uDDE3\\uD83D\\uDCAB\\uD83D\\uDC80\\uD83D\\uDC51\\uD83C\\uDFB5\\uD83E\\uDD1E\\uD83D\\uDE1B\\uD83D\\uDD34\\uD83D\\uDE24\\uD83C\\uDF3C\\uD83D\\uDE2B\\u26BD\\uD83E\\uDD19\\u2615\\uD83C\\uDFC6\\uD83E\\uDD2B\\uD83D\\uDC48\\uD83D\\uDE2E\\uD83D\\uDE46\\uD83C\\uDF7B\\uD83C\\uDF43\\uD83D\\uDC36\\uD83D\\uDC81\\uD83D\\uDE32\\uD83C\\uDF3F\\uD83E\\uDDE1\\uD83C\\uDF81\\u26A1\\uD83C\\uDF1E\\uD83C\\uDF88\\u274C\\u270A\\uD83D\\uDC4B\\uD83D\\uDE30\\uD83E\\uDD28\\uD83D\\uDE36\\uD83E\\uDD1D\\uD83D\\uDEB6\\uD83D\\uDCB0\\uD83C\\uDF53\\uD83D\\uDCA2\\uD83E\\uDD1F\\uD83D\\uDE41\\uD83D\\uDEA8\\uD83D\\uDCA8\\uD83E\\uDD2C\\u2708\\uD83C\\uDF80\\uD83C\\uDF7A\\uD83E\\uDD13\\uD83D\\uDE19\\uD83D\\uDC9F\\uD83C\\uDF31\\uD83D\\uDE16\\uD83D\\uDC76\\uD83E\\uDD74\\u25B6\\u27A1\\u2753\\uD83D\\uDC8E\\uD83D\\uDCB8\\u2B07\\uD83D\\uDE28\\uD83C\\uDF1A\\uD83E\\uDD8B\\uD83D\\uDE37\\uD83D\\uDD7A\\u26A0\\uD83D\\uDE45\\uD83D\\uDE1F\\uD83D\\uDE35\\uD83D\\uDC4E\\uD83E\\uDD32\\uD83E\\uDD20\\uD83E\\uDD27\\uD83D\\uDCCC\\uD83D\\uDD35\\uD83D\\uDC85\\uD83E\\uDDD0\\uD83D\\uDC3E\\uD83C\\uDF52\\uD83D\\uDE17\\uD83E\\uDD11\\uD83C\\uDF0A\\uD83E\\uDD2F\\uD83D\\uDC37\\u260E\\uD83D\\uDCA7\\uD83D\\uDE2F\\uD83D\\uDC86\\uD83D\\uDC46\\uD83C\\uDFA4\\uD83D\\uDE47\\uD83C\\uDF51\\u2744\\uD83C\\uDF34\\uD83D\\uDCA3\\uD83D\\uDC38\\uD83D\\uDC8C\\uD83D\\uDCCD\\uD83E\\uDD40\\uD83E\\uDD22\\uD83D\\uDC45\\uD83D\\uDCA1\\uD83D\\uDCA9\\uD83D\\uDC50\\uD83D\\uDCF8\\uD83D\\uDC7B\\uD83E\\uDD10\\uD83E\\uDD2E\\uD83C\\uDFBC\\uD83E\\uDD75\\uD83D\\uDEA9\\uD83C\\uDF4E\\uD83C\\uDF4A\\uD83D\\uDC7C\\uD83D\\uDC8D\\uD83D\\uDCE3\\uD83E\\uDD42');\nconst alphabetBytesToChars = alphabet.reduce((p, c, i) => {\n p[i] = c;\n return p;\n}, []);\nconst alphabetCharsToBytes = alphabet.reduce((p, c, i) => {\n p[c.codePointAt(0)] = i;\n return p;\n}, []);\nfunction encode(data) {\n return data.reduce((p, c) => {\n p += alphabetBytesToChars[c];\n return p;\n }, '');\n}\nfunction decode(str) {\n const byts = [];\n for (const char of str) {\n const byt = alphabetCharsToBytes[char.codePointAt(0)];\n if (byt === undefined) {\n throw new Error(`Non-base256emoji character: ${ char }`);\n }\n byts.push(byt);\n }\n return new Uint8Array(byts);\n}\nconst base256emoji = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '\\uD83D\\uDE80',\n name: 'base256emoji',\n encode,\n decode\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base256emoji.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base32.js": +/*!************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base32.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base32: () => (/* binding */ base32),\n/* harmony export */ base32hex: () => (/* binding */ base32hex),\n/* harmony export */ base32hexpad: () => (/* binding */ base32hexpad),\n/* harmony export */ base32hexpadupper: () => (/* binding */ base32hexpadupper),\n/* harmony export */ base32hexupper: () => (/* binding */ base32hexupper),\n/* harmony export */ base32pad: () => (/* binding */ base32pad),\n/* harmony export */ base32padupper: () => (/* binding */ base32padupper),\n/* harmony export */ base32upper: () => (/* binding */ base32upper),\n/* harmony export */ base32z: () => (/* binding */ base32z)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base32 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'b',\n name: 'base32',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567',\n bitsPerChar: 5\n});\nconst base32upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'B',\n name: 'base32upper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n bitsPerChar: 5\n});\nconst base32pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'c',\n name: 'base32pad',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',\n bitsPerChar: 5\n});\nconst base32padupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'C',\n name: 'base32padupper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',\n bitsPerChar: 5\n});\nconst base32hex = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'v',\n name: 'base32hex',\n alphabet: '0123456789abcdefghijklmnopqrstuv',\n bitsPerChar: 5\n});\nconst base32hexupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'V',\n name: 'base32hexupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',\n bitsPerChar: 5\n});\nconst base32hexpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 't',\n name: 'base32hexpad',\n alphabet: '0123456789abcdefghijklmnopqrstuv=',\n bitsPerChar: 5\n});\nconst base32hexpadupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'T',\n name: 'base32hexpadupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',\n bitsPerChar: 5\n});\nconst base32z = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'h',\n name: 'base32z',\n alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',\n bitsPerChar: 5\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base32.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base36.js": +/*!************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base36.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base36: () => (/* binding */ base36),\n/* harmony export */ base36upper: () => (/* binding */ base36upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base36 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'k',\n name: 'base36',\n alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'\n});\nconst base36upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'K',\n name: 'base36upper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base36.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base58.js": +/*!************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base58.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base58btc: () => (/* binding */ base58btc),\n/* harmony export */ base58flickr: () => (/* binding */ base58flickr)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base58btc = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58btc',\n prefix: 'z',\n alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n});\nconst base58flickr = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58flickr',\n prefix: 'Z',\n alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base58.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base64.js": +/*!************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base64.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64pad: () => (/* binding */ base64pad),\n/* harmony export */ base64url: () => (/* binding */ base64url),\n/* harmony export */ base64urlpad: () => (/* binding */ base64urlpad)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base64 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'm',\n name: 'base64',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n bitsPerChar: 6\n});\nconst base64pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'M',\n name: 'base64pad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n bitsPerChar: 6\n});\nconst base64url = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'u',\n name: 'base64url',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',\n bitsPerChar: 6\n});\nconst base64urlpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'U',\n name: 'base64urlpad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',\n bitsPerChar: 6\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base64.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base8.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base8.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base8: () => (/* binding */ base8)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base8 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '7',\n name: 'base8',\n alphabet: '01234567',\n bitsPerChar: 3\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base8.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bases/identity.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bases/identity.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n\n\nconst identity = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '\\0',\n name: 'identity',\n encode: buf => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.toString)(buf),\n decode: str => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.fromString)(str)\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bases/identity.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/basics.js": +/*!******************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/basics.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.CID),\n/* harmony export */ bases: () => (/* binding */ bases),\n/* harmony export */ bytes: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.bytes),\n/* harmony export */ codecs: () => (/* binding */ codecs),\n/* harmony export */ digest: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.digest),\n/* harmony export */ hasher: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.hasher),\n/* harmony export */ hashes: () => (/* binding */ hashes),\n/* harmony export */ varint: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.varint)\n/* harmony export */ });\n/* harmony import */ var _bases_identity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/identity.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/identity.js\");\n/* harmony import */ var _bases_base2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base2.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base2.js\");\n/* harmony import */ var _bases_base8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base8.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base8.js\");\n/* harmony import */ var _bases_base10_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base10.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base10.js\");\n/* harmony import */ var _bases_base16_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bases/base16.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base16.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base32.js\");\n/* harmony import */ var _bases_base36_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bases/base36.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base36.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base58.js\");\n/* harmony import */ var _bases_base64_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bases/base64.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base64.js\");\n/* harmony import */ var _bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bases/base256emoji.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base256emoji.js\");\n/* harmony import */ var _hashes_sha2_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./hashes/sha2.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/sha2-browser.js\");\n/* harmony import */ var _hashes_identity_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./hashes/identity.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/identity.js\");\n/* harmony import */ var _codecs_raw_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./codecs/raw.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/raw.js\");\n/* harmony import */ var _codecs_json_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./codecs/json.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/json.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./index.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bases = {\n ..._bases_identity_js__WEBPACK_IMPORTED_MODULE_0__,\n ..._bases_base2_js__WEBPACK_IMPORTED_MODULE_1__,\n ..._bases_base8_js__WEBPACK_IMPORTED_MODULE_2__,\n ..._bases_base10_js__WEBPACK_IMPORTED_MODULE_3__,\n ..._bases_base16_js__WEBPACK_IMPORTED_MODULE_4__,\n ..._bases_base32_js__WEBPACK_IMPORTED_MODULE_5__,\n ..._bases_base36_js__WEBPACK_IMPORTED_MODULE_6__,\n ..._bases_base58_js__WEBPACK_IMPORTED_MODULE_7__,\n ..._bases_base64_js__WEBPACK_IMPORTED_MODULE_8__,\n ..._bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_9__\n};\nconst hashes = {\n ..._hashes_sha2_js__WEBPACK_IMPORTED_MODULE_10__,\n ..._hashes_identity_js__WEBPACK_IMPORTED_MODULE_11__\n};\nconst codecs = {\n raw: _codecs_raw_js__WEBPACK_IMPORTED_MODULE_12__,\n json: _codecs_json_js__WEBPACK_IMPORTED_MODULE_13__\n};\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/basics.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ coerce: () => (/* binding */ coerce),\n/* harmony export */ empty: () => (/* binding */ empty),\n/* harmony export */ equals: () => (/* binding */ equals),\n/* harmony export */ fromHex: () => (/* binding */ fromHex),\n/* harmony export */ fromString: () => (/* binding */ fromString),\n/* harmony export */ isBinary: () => (/* binding */ isBinary),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nconst empty = new Uint8Array(0);\nconst toHex = d => d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), '');\nconst fromHex = hex => {\n const hexes = hex.match(/../g);\n return hexes ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty;\n};\nconst equals = (aa, bb) => {\n if (aa === bb)\n return true;\n if (aa.byteLength !== bb.byteLength) {\n return false;\n }\n for (let ii = 0; ii < aa.byteLength; ii++) {\n if (aa[ii] !== bb[ii]) {\n return false;\n }\n }\n return true;\n};\nconst coerce = o => {\n if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array')\n return o;\n if (o instanceof ArrayBuffer)\n return new Uint8Array(o);\n if (ArrayBuffer.isView(o)) {\n return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);\n }\n throw new Error('Unknown type, must be binary type');\n};\nconst isBinary = o => o instanceof ArrayBuffer || ArrayBuffer.isView(o);\nconst fromString = str => new TextEncoder().encode(str);\nconst toString = b => new TextDecoder().decode(b);\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/cid.js": +/*!***************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/cid.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* binding */ CID)\n/* harmony export */ });\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/varint.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base58.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bases/base32.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n\n\n\n\n\nclass CID {\n constructor(version, code, multihash, bytes) {\n this.code = code;\n this.version = version;\n this.multihash = multihash;\n this.bytes = bytes;\n this.byteOffset = bytes.byteOffset;\n this.byteLength = bytes.byteLength;\n this.asCID = this;\n this._baseCache = new Map();\n Object.defineProperties(this, {\n byteOffset: hidden,\n byteLength: hidden,\n code: readonly,\n version: readonly,\n multihash: readonly,\n bytes: readonly,\n _baseCache: hidden,\n asCID: hidden\n });\n }\n toV0() {\n switch (this.version) {\n case 0: {\n return this;\n }\n default: {\n const {code, multihash} = this;\n if (code !== DAG_PB_CODE) {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0');\n }\n if (multihash.code !== SHA_256_CODE) {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0');\n }\n return CID.createV0(multihash);\n }\n }\n }\n toV1() {\n switch (this.version) {\n case 0: {\n const {code, digest} = this.multihash;\n const multihash = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, digest);\n return CID.createV1(this.code, multihash);\n }\n case 1: {\n return this;\n }\n default: {\n throw Error(`Can not convert CID version ${ this.version } to version 0. This is a bug please report`);\n }\n }\n }\n equals(other) {\n return other && this.code === other.code && this.version === other.version && _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.equals(this.multihash, other.multihash);\n }\n toString(base) {\n const {bytes, version, _baseCache} = this;\n switch (version) {\n case 0:\n return toStringV0(bytes, _baseCache, base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.encoder);\n default:\n return toStringV1(bytes, _baseCache, base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.encoder);\n }\n }\n toJSON() {\n return {\n code: this.code,\n version: this.version,\n hash: this.multihash.bytes\n };\n }\n get [Symbol.toStringTag]() {\n return 'CID';\n }\n [Symbol.for('nodejs.util.inspect.custom')]() {\n return 'CID(' + this.toString() + ')';\n }\n static isCID(value) {\n deprecate(/^0\\.0/, IS_CID_DEPRECATION);\n return !!(value && (value[cidSymbol] || value.asCID === value));\n }\n get toBaseEncodedString() {\n throw new Error('Deprecated, use .toString()');\n }\n get codec() {\n throw new Error('\"codec\" property is deprecated, use integer \"code\" property instead');\n }\n get buffer() {\n throw new Error('Deprecated .buffer property, use .bytes to get Uint8Array instead');\n }\n get multibaseName() {\n throw new Error('\"multibaseName\" property is deprecated');\n }\n get prefix() {\n throw new Error('\"prefix\" property is deprecated');\n }\n static asCID(value) {\n if (value instanceof CID) {\n return value;\n } else if (value != null && value.asCID === value) {\n const {version, code, multihash, bytes} = value;\n return new CID(version, code, multihash, bytes || encodeCID(version, code, multihash.bytes));\n } else if (value != null && value[cidSymbol] === true) {\n const {version, multihash, code} = value;\n const digest = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.decode(multihash);\n return CID.create(version, code, digest);\n } else {\n return null;\n }\n }\n static create(version, code, digest) {\n if (typeof code !== 'number') {\n throw new Error('String codecs are no longer supported');\n }\n switch (version) {\n case 0: {\n if (code !== DAG_PB_CODE) {\n throw new Error(`Version 0 CID must use dag-pb (code: ${ DAG_PB_CODE }) block encoding`);\n } else {\n return new CID(version, code, digest, digest.bytes);\n }\n }\n case 1: {\n const bytes = encodeCID(version, code, digest.bytes);\n return new CID(version, code, digest, bytes);\n }\n default: {\n throw new Error('Invalid version');\n }\n }\n }\n static createV0(digest) {\n return CID.create(0, DAG_PB_CODE, digest);\n }\n static createV1(code, digest) {\n return CID.create(1, code, digest);\n }\n static decode(bytes) {\n const [cid, remainder] = CID.decodeFirst(bytes);\n if (remainder.length) {\n throw new Error('Incorrect length');\n }\n return cid;\n }\n static decodeFirst(bytes) {\n const specs = CID.inspectBytes(bytes);\n const prefixSize = specs.size - specs.multihashSize;\n const multihashBytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_4__.coerce)(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));\n if (multihashBytes.byteLength !== specs.multihashSize) {\n throw new Error('Incorrect length');\n }\n const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);\n const digest = new _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);\n const cid = specs.version === 0 ? CID.createV0(digest) : CID.createV1(specs.codec, digest);\n return [\n cid,\n bytes.subarray(specs.size)\n ];\n }\n static inspectBytes(initialBytes) {\n let offset = 0;\n const next = () => {\n const [i, length] = _varint_js__WEBPACK_IMPORTED_MODULE_0__.decode(initialBytes.subarray(offset));\n offset += length;\n return i;\n };\n let version = next();\n let codec = DAG_PB_CODE;\n if (version === 18) {\n version = 0;\n offset = 0;\n } else if (version === 1) {\n codec = next();\n }\n if (version !== 0 && version !== 1) {\n throw new RangeError(`Invalid CID version ${ version }`);\n }\n const prefixSize = offset;\n const multihashCode = next();\n const digestSize = next();\n const size = offset + digestSize;\n const multihashSize = size - prefixSize;\n return {\n version,\n codec,\n multihashCode,\n digestSize,\n multihashSize,\n size\n };\n }\n static parse(source, base) {\n const [prefix, bytes] = parseCIDtoBytes(source, base);\n const cid = CID.decode(bytes);\n cid._baseCache.set(prefix, source);\n return cid;\n }\n}\nconst parseCIDtoBytes = (source, base) => {\n switch (source[0]) {\n case 'Q': {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc;\n return [\n _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix,\n decoder.decode(`${ _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix }${ source }`)\n ];\n }\n case _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix: {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc;\n return [\n _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix,\n decoder.decode(source)\n ];\n }\n case _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.prefix: {\n const decoder = base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32;\n return [\n _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.prefix,\n decoder.decode(source)\n ];\n }\n default: {\n if (base == null) {\n throw Error('To parse non base32 or base58btc encoded CID multibase decoder must be provided');\n }\n return [\n source[0],\n base.decode(source)\n ];\n }\n }\n};\nconst toStringV0 = (bytes, cache, base) => {\n const {prefix} = base;\n if (prefix !== _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix) {\n throw Error(`Cannot string encode V0 in ${ base.name } encoding`);\n }\n const cid = cache.get(prefix);\n if (cid == null) {\n const cid = base.encode(bytes).slice(1);\n cache.set(prefix, cid);\n return cid;\n } else {\n return cid;\n }\n};\nconst toStringV1 = (bytes, cache, base) => {\n const {prefix} = base;\n const cid = cache.get(prefix);\n if (cid == null) {\n const cid = base.encode(bytes);\n cache.set(prefix, cid);\n return cid;\n } else {\n return cid;\n }\n};\nconst DAG_PB_CODE = 112;\nconst SHA_256_CODE = 18;\nconst encodeCID = (version, code, multihash) => {\n const codeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodingLength(version);\n const hashOffset = codeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodingLength(code);\n const bytes = new Uint8Array(hashOffset + multihash.byteLength);\n _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodeTo(version, bytes, 0);\n _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodeTo(code, bytes, codeOffset);\n bytes.set(multihash, hashOffset);\n return bytes;\n};\nconst cidSymbol = Symbol.for('@ipld/js-cid/CID');\nconst readonly = {\n writable: false,\n configurable: false,\n enumerable: true\n};\nconst hidden = {\n writable: false,\n enumerable: false,\n configurable: false\n};\nconst version = '0.0.0-dev';\nconst deprecate = (range, message) => {\n if (range.test(version)) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n};\nconst IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n`;\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/cid.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/json.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/json.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\nconst name = 'json';\nconst code = 512;\nconst encode = node => textEncoder.encode(JSON.stringify(node));\nconst decode = data => JSON.parse(textDecoder.decode(data));\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/json.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/raw.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/raw.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n\nconst name = 'raw';\nconst code = 85;\nconst encode = node => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(node);\nconst decode = data => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(data);\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/codecs/raw.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Digest: () => (/* binding */ Digest),\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../varint.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/varint.js\");\n\n\nconst create = (code, digest) => {\n const size = digest.byteLength;\n const sizeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(code);\n const digestOffset = sizeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(size);\n const bytes = new Uint8Array(digestOffset + size);\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(code, bytes, 0);\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(size, bytes, sizeOffset);\n bytes.set(digest, digestOffset);\n return new Digest(code, size, digest, bytes);\n};\nconst decode = multihash => {\n const bytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(multihash);\n const [code, sizeOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes);\n const [size, digestOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes.subarray(sizeOffset));\n const digest = bytes.subarray(sizeOffset + digestOffset);\n if (digest.byteLength !== size) {\n throw new Error('Incorrect length');\n }\n return new Digest(code, size, digest, bytes);\n};\nconst equals = (a, b) => {\n if (a === b) {\n return true;\n } else {\n return a.code === b.code && a.size === b.size && (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.equals)(a.bytes, b.bytes);\n }\n};\nclass Digest {\n constructor(code, size, digest, bytes) {\n this.code = code;\n this.size = size;\n this.digest = digest;\n this.bytes = bytes;\n }\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/hasher.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/hasher.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hasher: () => (/* binding */ Hasher),\n/* harmony export */ from: () => (/* binding */ from)\n/* harmony export */ });\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js\");\n\nconst from = ({name, code, encode}) => new Hasher(name, code, encode);\nclass Hasher {\n constructor(name, code, encode) {\n this.name = name;\n this.code = code;\n this.encode = encode;\n }\n digest(input) {\n if (input instanceof Uint8Array) {\n const result = this.encode(input);\n return result instanceof Uint8Array ? _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, result) : result.then(digest => _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, digest));\n } else {\n throw Error('Unknown type, must be binary type');\n }\n }\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/hasher.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/identity.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/identity.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js\");\n\n\nconst code = 0;\nconst name = 'identity';\nconst encode = _bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce;\nconst digest = input => _digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, encode(input));\nconst identity = {\n code,\n name,\n encode,\n digest\n};\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/identity.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/sha2-browser.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/sha2-browser.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha256: () => (/* binding */ sha256),\n/* harmony export */ sha512: () => (/* binding */ sha512)\n/* harmony export */ });\n/* harmony import */ var _hasher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasher.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/hasher.js\");\n\nconst sha = name => async data => new Uint8Array(await crypto.subtle.digest(name, data));\nconst sha256 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-256',\n code: 18,\n encode: sha('SHA-256')\n});\nconst sha512 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-512',\n code: 19,\n encode: sha('SHA-512')\n});\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/sha2-browser.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/index.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/index.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _cid_js__WEBPACK_IMPORTED_MODULE_0__.CID),\n/* harmony export */ bytes: () => (/* reexport module object */ _bytes_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ digest: () => (/* reexport module object */ _hashes_digest_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ hasher: () => (/* reexport module object */ _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ varint: () => (/* reexport module object */ _varint_js__WEBPACK_IMPORTED_MODULE_1__)\n/* harmony export */ });\n/* harmony import */ var _cid_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cid.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/cid.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/varint.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/bytes.js\");\n/* harmony import */ var _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/hasher.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/hasher.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/hashes/digest.js\");\n\n\n\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/src/varint.js": +/*!******************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/src/varint.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encodeTo: () => (/* binding */ encodeTo),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength)\n/* harmony export */ });\n/* harmony import */ var _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../vendor/varint.js */ \"./node_modules/multihashes/node_modules/multiformats/esm/vendor/varint.js\");\n\nconst decode = (data, offset = 0) => {\n const code = _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode(data, offset);\n return [\n code,\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode.bytes\n ];\n};\nconst encodeTo = (int, target, offset = 0) => {\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encode(int, target, offset);\n return target;\n};\nconst encodingLength = int => {\n return _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encodingLength(int);\n};\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/src/varint.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/vendor/base-x.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/vendor/base-x.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction base(ALPHABET, name) {\n if (ALPHABET.length >= 255) {\n throw new TypeError('Alphabet too long');\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + ' is ambiguous');\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256);\n var iFACTOR = Math.log(256) / Math.log(BASE);\n function encode(source) {\n if (source instanceof Uint8Array);\n else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError('Expected Uint8Array');\n }\n if (source.length === 0) {\n return '';\n }\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size);\n while (pbegin !== pend) {\n var carry = source[pbegin];\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n pbegin++;\n }\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n function decodeUnsafe(source) {\n if (typeof source !== 'string') {\n throw new TypeError('Expected String');\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n if (source[psz] === ' ') {\n return;\n }\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n var size = (source.length - psz) * FACTOR + 1 >>> 0;\n var b256 = new Uint8Array(size);\n while (source[psz]) {\n var carry = BASE_MAP[source.charCodeAt(psz)];\n if (carry === 255) {\n return;\n }\n var i = 0;\n for (var it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) {\n carry += BASE * b256[it3] >>> 0;\n b256[it3] = carry % 256 >>> 0;\n carry = carry / 256 >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n psz++;\n }\n if (source[psz] === ' ') {\n return;\n }\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j = zeroes;\n while (it4 !== size) {\n vch[j++] = b256[it4++];\n }\n return vch;\n }\n function decode(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error(`Non-${ name } character`);\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n };\n}\nvar src = base;\nvar _brrp__multiformats_scope_baseX = src;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp__multiformats_scope_baseX);\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/vendor/base-x.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/multiformats/esm/vendor/varint.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/multiformats/esm/vendor/varint.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar encode_1 = encode;\nvar MSB = 128, REST = 127, MSBALL = ~REST, INT = Math.pow(2, 31);\nfunction encode(num, out, offset) {\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n while (num >= INT) {\n out[offset++] = num & 255 | MSB;\n num /= 128;\n }\n while (num & MSBALL) {\n out[offset++] = num & 255 | MSB;\n num >>>= 7;\n }\n out[offset] = num | 0;\n encode.bytes = offset - oldOffset + 1;\n return out;\n}\nvar decode = read;\nvar MSB$1 = 128, REST$1 = 127;\nfunction read(buf, offset) {\n var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;\n do {\n if (counter >= l) {\n read.bytes = 0;\n throw new RangeError('Could not decode varint');\n }\n b = buf[counter++];\n res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$1);\n read.bytes = counter - offset;\n return res;\n}\nvar N1 = Math.pow(2, 7);\nvar N2 = Math.pow(2, 14);\nvar N3 = Math.pow(2, 21);\nvar N4 = Math.pow(2, 28);\nvar N5 = Math.pow(2, 35);\nvar N6 = Math.pow(2, 42);\nvar N7 = Math.pow(2, 49);\nvar N8 = Math.pow(2, 56);\nvar N9 = Math.pow(2, 63);\nvar length = function (value) {\n return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;\n};\nvar varint = {\n encode: encode_1,\n decode: decode,\n encodingLength: length\n};\nvar _brrp_varint = varint;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp_varint);\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/multiformats/esm/vendor/varint.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/uint8arrays/esm/src/alloc.js": +/*!****************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/uint8arrays/esm/src/alloc.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\nfunction alloc(size = 0) {\n if (globalThis.Buffer != null && globalThis.Buffer.alloc != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.alloc(size));\n }\n return new Uint8Array(size);\n}\nfunction allocUnsafe(size = 0) {\n if (globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.allocUnsafe(size));\n }\n return new Uint8Array(size);\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/uint8arrays/esm/src/alloc.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/uint8arrays/esm/src/concat.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/uint8arrays/esm/src/concat.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\n\nfunction concat(arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/uint8arrays/esm/src/concat.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/uint8arrays/esm/src/from-string.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/uint8arrays/esm/src/from-string.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/bases.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\n\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (!base) {\n throw new Error(`Unsupported encoding \"${ encoding }\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(globalThis.Buffer.from(string, 'utf-8'));\n }\n return base.decoder.decode(`${ base.prefix }${ string }`);\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/uint8arrays/esm/src/from-string.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/uint8arrays/esm/src/to-string.js": +/*!********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/uint8arrays/esm/src/to-string.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/bases.js\");\n\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (!base) {\n throw new Error(`Unsupported encoding \"${ encoding }\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString('utf8');\n }\n return base.encoder.encode(array).substring(1);\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/uint8arrays/esm/src/to-string.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/as-uint8array.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/as-uint8array.js ***! + \*****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\nfunction asUint8Array(buf) {\n if (globalThis.Buffer != null) {\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n return buf;\n}\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/as-uint8array.js?"); + +/***/ }), + +/***/ "./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/bases.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/bases.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multihashes/node_modules/multiformats/esm/src/basics.js\");\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../alloc.js */ \"./node_modules/multihashes/node_modules/uint8arrays/esm/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: { decode }\n };\n}\nconst string = createCodec('utf8', 'u', buf => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, str => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', buf => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, str => {\n str = str.substring(1);\n const buf = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii: ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n\n//# sourceURL=webpack://light/./node_modules/multihashes/node_modules/uint8arrays/esm/src/util/bases.js?"); + +/***/ }), + +/***/ "./node_modules/nanoid/index.browser.js": +/*!**********************************************!*\ + !*** ./node_modules/nanoid/index.browser.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ customAlphabet: () => (/* binding */ customAlphabet),\n/* harmony export */ customRandom: () => (/* binding */ customRandom),\n/* harmony export */ nanoid: () => (/* binding */ nanoid),\n/* harmony export */ random: () => (/* binding */ random),\n/* harmony export */ urlAlphabet: () => (/* reexport safe */ _url_alphabet_index_js__WEBPACK_IMPORTED_MODULE_0__.urlAlphabet)\n/* harmony export */ });\n/* harmony import */ var _url_alphabet_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url-alphabet/index.js */ \"./node_modules/nanoid/url-alphabet/index.js\");\n\nlet random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nlet customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nlet customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nlet nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\n\n\n//# sourceURL=webpack://light/./node_modules/nanoid/index.browser.js?"); + +/***/ }), + +/***/ "./node_modules/nanoid/url-alphabet/index.js": +/*!***************************************************!*\ + !*** ./node_modules/nanoid/url-alphabet/index.js ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ urlAlphabet: () => (/* binding */ urlAlphabet)\n/* harmony export */ });\nconst urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n\n\n//# sourceURL=webpack://light/./node_modules/nanoid/url-alphabet/index.js?"); + +/***/ }), + +/***/ "./node_modules/native-fetch/esm/src/index.js": +/*!****************************************************!*\ + !*** ./node_modules/native-fetch/esm/src/index.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Headers: () => (/* binding */ globalHeaders),\n/* harmony export */ Request: () => (/* binding */ globalRequest),\n/* harmony export */ Response: () => (/* binding */ globalResponse),\n/* harmony export */ fetch: () => (/* binding */ globalFetch)\n/* harmony export */ });\nconst globalFetch = globalThis.fetch;\nconst globalHeaders = globalThis.Headers;\nconst globalRequest = globalThis.Request;\nconst globalResponse = globalThis.Response;\n\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/native-fetch/esm/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/observable-webworkers/dist/src/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/observable-webworkers/dist/src/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst events = {};\nconst observable = (worker) => {\n worker.addEventListener('message', (event) => {\n observable.dispatchEvent('message', worker, event);\n });\n if (worker.port != null) {\n worker.port.addEventListener('message', (event) => {\n observable.dispatchEvent('message', worker, event);\n });\n }\n};\nobservable.addEventListener = (type, fn) => {\n if (events[type] == null) {\n events[type] = [];\n }\n events[type].push(fn);\n};\nobservable.removeEventListener = (type, fn) => {\n if (events[type] == null) {\n return;\n }\n events[type] = events[type]\n .filter(listener => listener === fn);\n};\nobservable.dispatchEvent = function (type, worker, event) {\n if (events[type] == null) {\n return;\n }\n events[type].forEach(fn => fn(worker, event));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (observable);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/observable-webworkers/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/p-defer/index.js": +/*!***************************************!*\ + !*** ./node_modules/p-defer/index.js ***! + \***************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ pDefer)\n/* harmony export */ });\nfunction pDefer() {\n\tconst deferred = {};\n\n\tdeferred.promise = new Promise((resolve, reject) => {\n\t\tdeferred.resolve = resolve;\n\t\tdeferred.reject = reject;\n\t});\n\n\treturn deferred;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/p-defer/index.js?"); + +/***/ }), + +/***/ "./node_modules/p-event/index.js": +/*!***************************************!*\ + !*** ./node_modules/p-event/index.js ***! + \***************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TimeoutError: () => (/* reexport safe */ p_timeout__WEBPACK_IMPORTED_MODULE_0__.TimeoutError),\n/* harmony export */ pEvent: () => (/* binding */ pEvent),\n/* harmony export */ pEventIterator: () => (/* binding */ pEventIterator),\n/* harmony export */ pEventMultiple: () => (/* binding */ pEventMultiple)\n/* harmony export */ });\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-timeout/index.js\");\n\n\nconst normalizeEmitter = emitter => {\n\tconst addListener = emitter.on || emitter.addListener || emitter.addEventListener;\n\tconst removeListener = emitter.off || emitter.removeListener || emitter.removeEventListener;\n\n\tif (!addListener || !removeListener) {\n\t\tthrow new TypeError('Emitter is not compatible');\n\t}\n\n\treturn {\n\t\taddListener: addListener.bind(emitter),\n\t\tremoveListener: removeListener.bind(emitter),\n\t};\n};\n\nfunction pEventMultiple(emitter, event, options) {\n\tlet cancel;\n\tconst returnValue = new Promise((resolve, reject) => {\n\t\toptions = {\n\t\t\trejectionEvents: ['error'],\n\t\t\tmultiArgs: false,\n\t\t\tresolveImmediately: false,\n\t\t\t...options,\n\t\t};\n\n\t\tif (!(options.count >= 0 && (options.count === Number.POSITIVE_INFINITY || Number.isInteger(options.count)))) {\n\t\t\tthrow new TypeError('The `count` option should be at least 0 or more');\n\t\t}\n\n\t\toptions.signal?.throwIfAborted();\n\n\t\t// Allow multiple events\n\t\tconst events = [event].flat();\n\n\t\tconst items = [];\n\t\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\t\tconst onItem = (...arguments_) => {\n\t\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\t\tif (options.filter && !options.filter(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titems.push(value);\n\n\t\t\tif (options.count === items.length) {\n\t\t\t\tcancel();\n\t\t\t\tresolve(items);\n\t\t\t}\n\t\t};\n\n\t\tconst rejectHandler = error => {\n\t\t\tcancel();\n\t\t\treject(error);\n\t\t};\n\n\t\tcancel = () => {\n\t\t\tfor (const event of events) {\n\t\t\t\tremoveListener(event, onItem);\n\t\t\t}\n\n\t\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t\t}\n\t\t};\n\n\t\tfor (const event of events) {\n\t\t\taddListener(event, onItem);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\taddListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tif (options.signal) {\n\t\t\toptions.signal.addEventListener('abort', () => {\n\t\t\t\trejectHandler(options.signal.reason);\n\t\t\t}, {once: true});\n\t\t}\n\n\t\tif (options.resolveImmediately) {\n\t\t\tresolve(items);\n\t\t}\n\t});\n\n\treturnValue.cancel = cancel;\n\n\tif (typeof options.timeout === 'number') {\n\t\tconst timeout = (0,p_timeout__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(returnValue, {milliseconds: options.timeout});\n\t\ttimeout.cancel = cancel;\n\t\treturn timeout;\n\t}\n\n\treturn returnValue;\n}\n\nfunction pEvent(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\toptions = {\n\t\t...options,\n\t\tcount: 1,\n\t\tresolveImmediately: false,\n\t};\n\n\tconst arrayPromise = pEventMultiple(emitter, event, options);\n\tconst promise = arrayPromise.then(array => array[0]);\n\tpromise.cancel = arrayPromise.cancel;\n\n\treturn promise;\n}\n\nfunction pEventIterator(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\t// Allow multiple events\n\tconst events = [event].flat();\n\n\toptions = {\n\t\trejectionEvents: ['error'],\n\t\tresolutionEvents: [],\n\t\tlimit: Number.POSITIVE_INFINITY,\n\t\tmultiArgs: false,\n\t\t...options,\n\t};\n\n\tconst {limit} = options;\n\tconst isValidLimit = limit >= 0 && (limit === Number.POSITIVE_INFINITY || Number.isInteger(limit));\n\tif (!isValidLimit) {\n\t\tthrow new TypeError('The `limit` option should be a non-negative integer or Infinity');\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tif (limit === 0) {\n\t\t// Return an empty async iterator to avoid any further cost\n\t\treturn {\n\t\t\t[Symbol.asyncIterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tasync next() {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\tlet isDone = false;\n\tlet error;\n\tlet hasPendingError = false;\n\tconst nextQueue = [];\n\tconst valueQueue = [];\n\tlet eventCount = 0;\n\tlet isLimitReached = false;\n\n\tconst valueHandler = (...arguments_) => {\n\t\teventCount++;\n\t\tisLimitReached = eventCount === limit;\n\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\n\t\t\tresolve({done: false, value});\n\n\t\t\tif (isLimitReached) {\n\t\t\t\tcancel();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueQueue.push(value);\n\n\t\tif (isLimitReached) {\n\t\t\tcancel();\n\t\t}\n\t};\n\n\tconst cancel = () => {\n\t\tisDone = true;\n\n\t\tfor (const event of events) {\n\t\t\tremoveListener(event, valueHandler);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\t\tremoveListener(resolutionEvent, resolveHandler);\n\t\t}\n\n\t\twhile (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value: undefined});\n\t\t}\n\t};\n\n\tconst rejectHandler = (...arguments_) => {\n\t\terror = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {reject} = nextQueue.shift();\n\t\t\treject(error);\n\t\t} else {\n\t\t\thasPendingError = true;\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tconst resolveHandler = (...arguments_) => {\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\tif (options.filter && !options.filter(value)) {\n\t\t\tcancel();\n\t\t\treturn;\n\t\t}\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value});\n\t\t} else {\n\t\t\tvalueQueue.push(value);\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tfor (const event of events) {\n\t\taddListener(event, valueHandler);\n\t}\n\n\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\taddListener(rejectionEvent, rejectHandler);\n\t}\n\n\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\taddListener(resolutionEvent, resolveHandler);\n\t}\n\n\tif (options.signal) {\n\t\toptions.signal.addEventListener('abort', () => {\n\t\t\trejectHandler(options.signal.reason);\n\t\t}, {once: true});\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\treturn this;\n\t\t},\n\t\tasync next() {\n\t\t\tif (valueQueue.length > 0) {\n\t\t\t\tconst value = valueQueue.shift();\n\t\t\t\treturn {\n\t\t\t\t\tdone: isDone && valueQueue.length === 0 && !isLimitReached,\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (hasPendingError) {\n\t\t\t\thasPendingError = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (isDone) {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tnextQueue.push({resolve, reject});\n\t\t\t});\n\t\t},\n\t\tasync return(value) {\n\t\t\tcancel();\n\t\t\treturn {\n\t\t\t\tdone: isDone,\n\t\t\t\tvalue,\n\t\t\t};\n\t\t},\n\t};\n}\n\n\n\n\n//# sourceURL=webpack://light/./node_modules/p-event/index.js?"); + +/***/ }), + +/***/ "./node_modules/p-queue/dist/index.js": +/*!********************************************!*\ + !*** ./node_modules/p-queue/dist/index.js ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ \"default\": () => (/* binding */ PQueue)\n/* harmony export */ });\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\");\n/* harmony import */ var p_timeout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! p-timeout */ \"./node_modules/p-queue/node_modules/p-timeout/index.js\");\n/* harmony import */ var _priority_queue_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./priority-queue.js */ \"./node_modules/p-queue/dist/priority-queue.js\");\nvar __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _PQueue_instances, _PQueue_carryoverConcurrencyCount, _PQueue_isIntervalIgnored, _PQueue_intervalCount, _PQueue_intervalCap, _PQueue_interval, _PQueue_intervalEnd, _PQueue_intervalId, _PQueue_timeoutId, _PQueue_queue, _PQueue_queueClass, _PQueue_pending, _PQueue_concurrency, _PQueue_isPaused, _PQueue_throwOnTimeout, _PQueue_doesIntervalAllowAnother_get, _PQueue_doesConcurrentAllowAnother_get, _PQueue_next, _PQueue_onResumeInterval, _PQueue_isIntervalPaused_get, _PQueue_tryToStartAnother, _PQueue_initializeIntervalIfNeeded, _PQueue_onInterval, _PQueue_processQueue, _PQueue_throwOnAbort, _PQueue_onEvent;\n\n\n\n/**\nThe error thrown by `queue.add()` when a job is aborted before it is run. See `signal`.\n*/\nclass AbortError extends Error {\n}\n/**\nPromise queue with concurrency control.\n*/\nclass PQueue extends eventemitter3__WEBPACK_IMPORTED_MODULE_0__ {\n // TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`\n constructor(options) {\n var _a, _b, _c, _d;\n super();\n _PQueue_instances.add(this);\n _PQueue_carryoverConcurrencyCount.set(this, void 0);\n _PQueue_isIntervalIgnored.set(this, void 0);\n _PQueue_intervalCount.set(this, 0);\n _PQueue_intervalCap.set(this, void 0);\n _PQueue_interval.set(this, void 0);\n _PQueue_intervalEnd.set(this, 0);\n _PQueue_intervalId.set(this, void 0);\n _PQueue_timeoutId.set(this, void 0);\n _PQueue_queue.set(this, void 0);\n _PQueue_queueClass.set(this, void 0);\n _PQueue_pending.set(this, 0);\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n _PQueue_concurrency.set(this, void 0);\n _PQueue_isPaused.set(this, void 0);\n _PQueue_throwOnTimeout.set(this, void 0);\n /**\n Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.\n \n Applies to each future operation.\n */\n Object.defineProperty(this, \"timeout\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverConcurrencyCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: _priority_queue_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"],\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${(_b = (_a = options.intervalCap) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${(_d = (_c = options.interval) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ''}\\` (${typeof options.interval})`);\n }\n __classPrivateFieldSet(this, _PQueue_carryoverConcurrencyCount, options.carryoverConcurrencyCount, \"f\");\n __classPrivateFieldSet(this, _PQueue_isIntervalIgnored, options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0, \"f\");\n __classPrivateFieldSet(this, _PQueue_intervalCap, options.intervalCap, \"f\");\n __classPrivateFieldSet(this, _PQueue_interval, options.interval, \"f\");\n __classPrivateFieldSet(this, _PQueue_queue, new options.queueClass(), \"f\");\n __classPrivateFieldSet(this, _PQueue_queueClass, options.queueClass, \"f\");\n this.concurrency = options.concurrency;\n this.timeout = options.timeout;\n __classPrivateFieldSet(this, _PQueue_throwOnTimeout, options.throwOnTimeout === true, \"f\");\n __classPrivateFieldSet(this, _PQueue_isPaused, options.autoStart === false, \"f\");\n }\n get concurrency() {\n return __classPrivateFieldGet(this, _PQueue_concurrency, \"f\");\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n __classPrivateFieldSet(this, _PQueue_concurrency, newConcurrency, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_processQueue).call(this);\n }\n async add(function_, options = {}) {\n options = {\n timeout: this.timeout,\n throwOnTimeout: __classPrivateFieldGet(this, _PQueue_throwOnTimeout, \"f\"),\n ...options,\n };\n return new Promise((resolve, reject) => {\n __classPrivateFieldGet(this, _PQueue_queue, \"f\").enqueue(async () => {\n var _a;\n var _b, _c;\n __classPrivateFieldSet(this, _PQueue_pending, (_b = __classPrivateFieldGet(this, _PQueue_pending, \"f\"), _b++, _b), \"f\");\n __classPrivateFieldSet(this, _PQueue_intervalCount, (_c = __classPrivateFieldGet(this, _PQueue_intervalCount, \"f\"), _c++, _c), \"f\");\n try {\n // TODO: Use options.signal?.throwIfAborted() when targeting Node.js 18\n if ((_a = options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n // TODO: Use ABORT_ERR code when targeting Node.js 16 (https://nodejs.org/docs/latest-v16.x/api/errors.html#abort_err)\n throw new AbortError('The task was aborted.');\n }\n let operation = function_({ signal: options.signal });\n if (options.timeout) {\n operation = (0,p_timeout__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(Promise.resolve(operation), options.timeout);\n }\n if (options.signal) {\n operation = Promise.race([operation, __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_throwOnAbort).call(this, options.signal)]);\n }\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n if (error instanceof p_timeout__WEBPACK_IMPORTED_MODULE_1__.TimeoutError && !options.throwOnTimeout) {\n resolve();\n return;\n }\n reject(error);\n this.emit('error', error);\n }\n finally {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_next).call(this);\n }\n }, options);\n this.emit('add');\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_tryToStartAnother).call(this);\n });\n }\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!__classPrivateFieldGet(this, _PQueue_isPaused, \"f\")) {\n return this;\n }\n __classPrivateFieldSet(this, _PQueue_isPaused, false, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_processQueue).call(this);\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n __classPrivateFieldSet(this, _PQueue_isPaused, true, \"f\");\n }\n /**\n Clear the queue.\n */\n clear() {\n __classPrivateFieldSet(this, _PQueue_queue, new (__classPrivateFieldGet(this, _PQueue_queueClass, \"f\"))(), \"f\");\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (__classPrivateFieldGet(this, _PQueue_queue, \"f\").size === 0) {\n return;\n }\n await __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onEvent).call(this, 'empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (__classPrivateFieldGet(this, _PQueue_queue, \"f\").size < limit) {\n return;\n }\n await __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onEvent).call(this, 'next', () => __classPrivateFieldGet(this, _PQueue_queue, \"f\").size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (__classPrivateFieldGet(this, _PQueue_pending, \"f\") === 0 && __classPrivateFieldGet(this, _PQueue_queue, \"f\").size === 0) {\n return;\n }\n await __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onEvent).call(this, 'idle');\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return __classPrivateFieldGet(this, _PQueue_queue, \"f\").size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return __classPrivateFieldGet(this, _PQueue_queue, \"f\").filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return __classPrivateFieldGet(this, _PQueue_pending, \"f\");\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return __classPrivateFieldGet(this, _PQueue_isPaused, \"f\");\n }\n}\n_PQueue_carryoverConcurrencyCount = new WeakMap(), _PQueue_isIntervalIgnored = new WeakMap(), _PQueue_intervalCount = new WeakMap(), _PQueue_intervalCap = new WeakMap(), _PQueue_interval = new WeakMap(), _PQueue_intervalEnd = new WeakMap(), _PQueue_intervalId = new WeakMap(), _PQueue_timeoutId = new WeakMap(), _PQueue_queue = new WeakMap(), _PQueue_queueClass = new WeakMap(), _PQueue_pending = new WeakMap(), _PQueue_concurrency = new WeakMap(), _PQueue_isPaused = new WeakMap(), _PQueue_throwOnTimeout = new WeakMap(), _PQueue_instances = new WeakSet(), _PQueue_doesIntervalAllowAnother_get = function _PQueue_doesIntervalAllowAnother_get() {\n return __classPrivateFieldGet(this, _PQueue_isIntervalIgnored, \"f\") || __classPrivateFieldGet(this, _PQueue_intervalCount, \"f\") < __classPrivateFieldGet(this, _PQueue_intervalCap, \"f\");\n}, _PQueue_doesConcurrentAllowAnother_get = function _PQueue_doesConcurrentAllowAnother_get() {\n return __classPrivateFieldGet(this, _PQueue_pending, \"f\") < __classPrivateFieldGet(this, _PQueue_concurrency, \"f\");\n}, _PQueue_next = function _PQueue_next() {\n var _a;\n __classPrivateFieldSet(this, _PQueue_pending, (_a = __classPrivateFieldGet(this, _PQueue_pending, \"f\"), _a--, _a), \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_tryToStartAnother).call(this);\n this.emit('next');\n}, _PQueue_onResumeInterval = function _PQueue_onResumeInterval() {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onInterval).call(this);\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_initializeIntervalIfNeeded).call(this);\n __classPrivateFieldSet(this, _PQueue_timeoutId, undefined, \"f\");\n}, _PQueue_isIntervalPaused_get = function _PQueue_isIntervalPaused_get() {\n const now = Date.now();\n if (__classPrivateFieldGet(this, _PQueue_intervalId, \"f\") === undefined) {\n const delay = __classPrivateFieldGet(this, _PQueue_intervalEnd, \"f\") - now;\n if (delay < 0) {\n // Act as the interval was done\n // We don't need to resume it here because it will be resumed on line 160\n __classPrivateFieldSet(this, _PQueue_intervalCount, (__classPrivateFieldGet(this, _PQueue_carryoverConcurrencyCount, \"f\")) ? __classPrivateFieldGet(this, _PQueue_pending, \"f\") : 0, \"f\");\n }\n else {\n // Act as the interval is pending\n if (__classPrivateFieldGet(this, _PQueue_timeoutId, \"f\") === undefined) {\n __classPrivateFieldSet(this, _PQueue_timeoutId, setTimeout(() => {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onResumeInterval).call(this);\n }, delay), \"f\");\n }\n return true;\n }\n }\n return false;\n}, _PQueue_tryToStartAnother = function _PQueue_tryToStartAnother() {\n if (__classPrivateFieldGet(this, _PQueue_queue, \"f\").size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n if (__classPrivateFieldGet(this, _PQueue_intervalId, \"f\")) {\n clearInterval(__classPrivateFieldGet(this, _PQueue_intervalId, \"f\"));\n }\n __classPrivateFieldSet(this, _PQueue_intervalId, undefined, \"f\");\n this.emit('empty');\n if (__classPrivateFieldGet(this, _PQueue_pending, \"f\") === 0) {\n this.emit('idle');\n }\n return false;\n }\n if (!__classPrivateFieldGet(this, _PQueue_isPaused, \"f\")) {\n const canInitializeInterval = !__classPrivateFieldGet(this, _PQueue_instances, \"a\", _PQueue_isIntervalPaused_get);\n if (__classPrivateFieldGet(this, _PQueue_instances, \"a\", _PQueue_doesIntervalAllowAnother_get) && __classPrivateFieldGet(this, _PQueue_instances, \"a\", _PQueue_doesConcurrentAllowAnother_get)) {\n const job = __classPrivateFieldGet(this, _PQueue_queue, \"f\").dequeue();\n if (!job) {\n return false;\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_initializeIntervalIfNeeded).call(this);\n }\n return true;\n }\n }\n return false;\n}, _PQueue_initializeIntervalIfNeeded = function _PQueue_initializeIntervalIfNeeded() {\n if (__classPrivateFieldGet(this, _PQueue_isIntervalIgnored, \"f\") || __classPrivateFieldGet(this, _PQueue_intervalId, \"f\") !== undefined) {\n return;\n }\n __classPrivateFieldSet(this, _PQueue_intervalId, setInterval(() => {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onInterval).call(this);\n }, __classPrivateFieldGet(this, _PQueue_interval, \"f\")), \"f\");\n __classPrivateFieldSet(this, _PQueue_intervalEnd, Date.now() + __classPrivateFieldGet(this, _PQueue_interval, \"f\"), \"f\");\n}, _PQueue_onInterval = function _PQueue_onInterval() {\n if (__classPrivateFieldGet(this, _PQueue_intervalCount, \"f\") === 0 && __classPrivateFieldGet(this, _PQueue_pending, \"f\") === 0 && __classPrivateFieldGet(this, _PQueue_intervalId, \"f\")) {\n clearInterval(__classPrivateFieldGet(this, _PQueue_intervalId, \"f\"));\n __classPrivateFieldSet(this, _PQueue_intervalId, undefined, \"f\");\n }\n __classPrivateFieldSet(this, _PQueue_intervalCount, __classPrivateFieldGet(this, _PQueue_carryoverConcurrencyCount, \"f\") ? __classPrivateFieldGet(this, _PQueue_pending, \"f\") : 0, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_processQueue).call(this);\n}, _PQueue_processQueue = function _PQueue_processQueue() {\n // eslint-disable-next-line no-empty\n while (__classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_tryToStartAnother).call(this)) { }\n}, _PQueue_throwOnAbort = async function _PQueue_throwOnAbort(signal) {\n return new Promise((_resolve, reject) => {\n signal.addEventListener('abort', () => {\n // TODO: Reject with signal.throwIfAborted() when targeting Node.js 18\n // TODO: Use ABORT_ERR code when targeting Node.js 16 (https://nodejs.org/docs/latest-v16.x/api/errors.html#abort_err)\n reject(new AbortError('The task was aborted.'));\n }, { once: true });\n });\n}, _PQueue_onEvent = async function _PQueue_onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n};\n\n\n//# sourceURL=webpack://light/./node_modules/p-queue/dist/index.js?"); + +/***/ }), + +/***/ "./node_modules/p-queue/dist/lower-bound.js": +/*!**************************************************!*\ + !*** ./node_modules/p-queue/dist/lower-bound.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ lowerBound)\n/* harmony export */ });\n// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nfunction lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/p-queue/dist/lower-bound.js?"); + +/***/ }), + +/***/ "./node_modules/p-queue/dist/priority-queue.js": +/*!*****************************************************!*\ + !*** ./node_modules/p-queue/dist/priority-queue.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ PriorityQueue)\n/* harmony export */ });\n/* harmony import */ var _lower_bound_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lower-bound.js */ \"./node_modules/p-queue/dist/lower-bound.js\");\nvar __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _PriorityQueue_queue;\n\nclass PriorityQueue {\n constructor() {\n _PriorityQueue_queue.set(this, []);\n }\n enqueue(run, options) {\n options = {\n priority: 0,\n ...options,\n };\n const element = {\n priority: options.priority,\n run,\n };\n if (this.size && __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\")[this.size - 1].priority >= options.priority) {\n __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").push(element);\n return;\n }\n const index = (0,_lower_bound_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(__classPrivateFieldGet(this, _PriorityQueue_queue, \"f\"), element, (a, b) => b.priority - a.priority);\n __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").splice(index, 0, element);\n }\n dequeue() {\n const item = __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").shift();\n return item === null || item === void 0 ? void 0 : item.run;\n }\n filter(options) {\n return __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").length;\n }\n}\n_PriorityQueue_queue = new WeakMap();\n\n\n//# sourceURL=webpack://light/./node_modules/p-queue/dist/priority-queue.js?"); + +/***/ }), + +/***/ "./node_modules/p-queue/node_modules/p-timeout/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/p-queue/node_modules/p-timeout/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ \"default\": () => (/* binding */ pTimeout)\n/* harmony export */ });\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nclass AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined ?\n\tnew AbortError(errorMessage) :\n\tnew DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined ?\n\t\tgetDOMException('This operation was aborted.') :\n\t\tsignal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nfunction pTimeout(promise, milliseconds, fallback, options) {\n\tlet timer;\n\n\tconst cancelablePromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tresolve(promise);\n\t\t\treturn;\n\t\t}\n\n\t\toptions = {\n\t\t\tcustomTimers: {setTimeout, clearTimeout},\n\t\t\t...options\n\t\t};\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\ttimer = options.customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (typeof fallback === 'function') {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\treject(timeoutError);\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t} finally {\n\t\t\t\toptions.customTimers.clearTimeout.call(undefined, timer);\n\t\t\t}\n\t\t})();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tclearTimeout(timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/p-queue/node_modules/p-timeout/index.js?"); + +/***/ }), + +/***/ "./node_modules/p-retry/index.js": +/*!***************************************!*\ + !*** ./node_modules/p-retry/index.js ***! + \***************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ \"default\": () => (/* binding */ pRetry)\n/* harmony export */ });\n/* harmony import */ var retry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! retry */ \"./node_modules/retry/index.js\");\n\n\nconst networkErrorMsgs = new Set([\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n]);\n\nclass AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nconst decorateErrorWithCounts = (error, attemptNumber, options) => {\n\t// Minus 1 from attemptNumber because the first attempt does not count as a retry\n\tconst retriesLeft = options.retries - (attemptNumber - 1);\n\n\terror.attemptNumber = attemptNumber;\n\terror.retriesLeft = retriesLeft;\n\treturn error;\n};\n\nconst isNetworkError = errorMessage => networkErrorMsgs.has(errorMessage);\n\nconst getDOMException = errorMessage => globalThis.DOMException === undefined\n\t? new Error(errorMessage)\n\t: new DOMException(errorMessage);\n\nasync function pRetry(input, options) {\n\treturn new Promise((resolve, reject) => {\n\t\toptions = {\n\t\t\tonFailedAttempt() {},\n\t\t\tretries: 10,\n\t\t\t...options,\n\t\t};\n\n\t\tconst operation = retry__WEBPACK_IMPORTED_MODULE_0__.operation(options);\n\n\t\toperation.attempt(async attemptNumber => {\n\t\t\ttry {\n\t\t\t\tresolve(await input(attemptNumber));\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof Error)) {\n\t\t\t\t\treject(new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (error instanceof AbortError) {\n\t\t\t\t\toperation.stop();\n\t\t\t\t\treject(error.originalError);\n\t\t\t\t} else if (error instanceof TypeError && !isNetworkError(error.message)) {\n\t\t\t\t\toperation.stop();\n\t\t\t\t\treject(error);\n\t\t\t\t} else {\n\t\t\t\t\tdecorateErrorWithCounts(error, attemptNumber, options);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait options.onFailedAttempt(error);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!operation.retry(error)) {\n\t\t\t\t\t\treject(operation.mainError());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (options.signal && !options.signal.aborted) {\n\t\t\toptions.signal.addEventListener('abort', () => {\n\t\t\t\toperation.stop();\n\t\t\t\tconst reason = options.signal.reason === undefined\n\t\t\t\t\t? getDOMException('The operation was aborted.')\n\t\t\t\t\t: options.signal.reason;\n\t\t\t\treject(reason instanceof Error ? reason : getDOMException(reason));\n\t\t\t}, {\n\t\t\t\tonce: true,\n\t\t\t});\n\t\t}\n\t});\n}\n\n\n//# sourceURL=webpack://light/./node_modules/p-retry/index.js?"); + +/***/ }), + +/***/ "./node_modules/p-timeout/index.js": +/*!*****************************************!*\ + !*** ./node_modules/p-timeout/index.js ***! + \*****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortError: () => (/* binding */ AbortError),\n/* harmony export */ TimeoutError: () => (/* binding */ TimeoutError),\n/* harmony export */ \"default\": () => (/* binding */ pTimeout)\n/* harmony export */ });\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nclass AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined\n\t? new AbortError(errorMessage)\n\t: new DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined\n\t\t? getDOMException('This operation was aborted.')\n\t\t: signal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nfunction pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t} = options;\n\n\tlet timer;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tpromise.then(resolve, reject);\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t})();\n\t});\n\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n\n\n//# sourceURL=webpack://light/./node_modules/p-timeout/index.js?"); + +/***/ }), + +/***/ "./node_modules/private-ip/index.js": +/*!******************************************!*\ + !*** ./node_modules/private-ip/index.js ***! + \******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/index.js */ \"./node_modules/private-ip/lib/index.js\");\n\n\n;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_lib_index_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://light/./node_modules/private-ip/index.js?"); + +/***/ }), + +/***/ "./node_modules/private-ip/lib/index.js": +/*!**********************************************!*\ + !*** ./node_modules/private-ip/lib/index.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var netmask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! netmask */ \"./node_modules/netmask/lib/netmask.js\");\n/* harmony import */ var ip_regex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ip-regex */ \"./node_modules/ip-regex/index.js\");\n/* harmony import */ var _chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @chainsafe/is-ip */ \"./node_modules/@chainsafe/is-ip/lib/is-ip.js\");\n/* harmony import */ var ipaddr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ipaddr.js */ \"./node_modules/ipaddr.js/lib/ipaddr.js\");\n\n\n\n\nconst { isValid: is_valid, parse } = ipaddr_js__WEBPACK_IMPORTED_MODULE_3__;\nconst PRIVATE_IP_RANGES = [\n '0.0.0.0/8',\n '10.0.0.0/8',\n '100.64.0.0/10',\n '127.0.0.0/8',\n '169.254.0.0/16',\n '172.16.0.0/12',\n '192.0.0.0/24',\n '192.0.0.0/29',\n '192.0.0.8/32',\n '192.0.0.9/32',\n '192.0.0.10/32',\n '192.0.0.170/32',\n '192.0.0.171/32',\n '192.0.2.0/24',\n '192.31.196.0/24',\n '192.52.193.0/24',\n '192.88.99.0/24',\n '192.168.0.0/16',\n '192.175.48.0/24',\n '198.18.0.0/15',\n '198.51.100.0/24',\n '203.0.113.0/24',\n '240.0.0.0/4',\n '255.255.255.255/32'\n];\nconst NETMASK_RANGES = PRIVATE_IP_RANGES.map(ip_range => new netmask__WEBPACK_IMPORTED_MODULE_0__.Netmask(ip_range));\nfunction ipv4_check(ip_addr) {\n for (let r of NETMASK_RANGES) {\n if (r.contains(ip_addr))\n return true;\n }\n return false;\n}\nfunction ipv6_check(ip_addr) {\n return /^::$/.test(ip_addr) ||\n /^::1$/.test(ip_addr) ||\n /^::f{4}:([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/.test(ip_addr) ||\n /^::f{4}:0.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/.test(ip_addr) ||\n /^64:ff9b::([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/.test(ip_addr) ||\n /^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) ||\n /^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) ||\n /^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) ||\n /^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) ||\n /^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(ip_addr) ||\n /^f[c-d]([0-9a-fA-F]{2,2}):/i.test(ip_addr) ||\n /^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(ip_addr) ||\n /^ff([0-9a-fA-F]{2,2}):/i.test(ip_addr);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((ip) => {\n if (is_valid(ip)) {\n const parsed = parse(ip);\n if (parsed.kind() === 'ipv4')\n return ipv4_check(parsed.toNormalizedString());\n else if (parsed.kind() === 'ipv6')\n return ipv6_check(ip);\n }\n else if ((0,_chainsafe_is_ip__WEBPACK_IMPORTED_MODULE_2__.isIP)(ip) && ip_regex__WEBPACK_IMPORTED_MODULE_1__[\"default\"].v6().test(ip))\n return ipv6_check(ip);\n return undefined;\n});\n\n\n//# sourceURL=webpack://light/./node_modules/private-ip/lib/index.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/codec.js": +/*!********************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/codec.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CODEC_TYPES: () => (/* binding */ CODEC_TYPES),\n/* harmony export */ createCodec: () => (/* binding */ createCodec)\n/* harmony export */ });\n// https://developers.google.com/protocol-buffers/docs/encoding#structure\nvar CODEC_TYPES;\n(function (CODEC_TYPES) {\n CODEC_TYPES[CODEC_TYPES[\"VARINT\"] = 0] = \"VARINT\";\n CODEC_TYPES[CODEC_TYPES[\"BIT64\"] = 1] = \"BIT64\";\n CODEC_TYPES[CODEC_TYPES[\"LENGTH_DELIMITED\"] = 2] = \"LENGTH_DELIMITED\";\n CODEC_TYPES[CODEC_TYPES[\"START_GROUP\"] = 3] = \"START_GROUP\";\n CODEC_TYPES[CODEC_TYPES[\"END_GROUP\"] = 4] = \"END_GROUP\";\n CODEC_TYPES[CODEC_TYPES[\"BIT32\"] = 5] = \"BIT32\";\n})(CODEC_TYPES || (CODEC_TYPES = {}));\nfunction createCodec(name, type, encode, decode) {\n return {\n name,\n type,\n encode,\n decode\n };\n}\n//# sourceMappingURL=codec.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/codec.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/codecs/enum.js": +/*!**************************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/codecs/enum.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ enumeration: () => (/* binding */ enumeration)\n/* harmony export */ });\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../codec.js */ \"./node_modules/protons-runtime/dist/src/codec.js\");\n\nfunction enumeration(v) {\n function findValue(val) {\n // Use the reverse mapping to look up the enum key for the stored value\n // https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings\n if (v[val.toString()] == null) {\n throw new Error('Invalid enum value');\n }\n return v[val];\n }\n const encode = function enumEncode(val, writer) {\n const enumValue = findValue(val);\n writer.int32(enumValue);\n };\n const decode = function enumDecode(reader) {\n const val = reader.int32();\n return findValue(val);\n };\n // @ts-expect-error yeah yeah\n return (0,_codec_js__WEBPACK_IMPORTED_MODULE_0__.createCodec)('enum', _codec_js__WEBPACK_IMPORTED_MODULE_0__.CODEC_TYPES.VARINT, encode, decode);\n}\n//# sourceMappingURL=enum.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/codecs/enum.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/codecs/message.js": +/*!*****************************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/codecs/message.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ message: () => (/* binding */ message)\n/* harmony export */ });\n/* harmony import */ var _codec_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../codec.js */ \"./node_modules/protons-runtime/dist/src/codec.js\");\n\nfunction message(encode, decode) {\n return (0,_codec_js__WEBPACK_IMPORTED_MODULE_0__.createCodec)('message', _codec_js__WEBPACK_IMPORTED_MODULE_0__.CODEC_TYPES.LENGTH_DELIMITED, encode, decode);\n}\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/codecs/message.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/decode.js": +/*!*********************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/decode.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeMessage: () => (/* binding */ decodeMessage)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/protons-runtime/dist/src/utils.js\");\n\nfunction decodeMessage(buf, codec) {\n const r = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.reader)(buf instanceof Uint8Array ? buf : buf.subarray());\n return codec.decode(r);\n}\n//# sourceMappingURL=decode.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/decode.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/encode.js": +/*!*********************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/encode.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encodeMessage: () => (/* binding */ encodeMessage)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/protons-runtime/dist/src/utils.js\");\n\nfunction encodeMessage(message, codec) {\n const w = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.writer)();\n codec.encode(message, w, {\n lengthDelimited: false\n });\n return w.finish();\n}\n//# sourceMappingURL=encode.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/encode.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/index.js": +/*!********************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/index.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeMessage: () => (/* reexport safe */ _decode_js__WEBPACK_IMPORTED_MODULE_0__.decodeMessage),\n/* harmony export */ encodeMessage: () => (/* reexport safe */ _encode_js__WEBPACK_IMPORTED_MODULE_1__.encodeMessage),\n/* harmony export */ enumeration: () => (/* reexport safe */ _codecs_enum_js__WEBPACK_IMPORTED_MODULE_2__.enumeration),\n/* harmony export */ message: () => (/* reexport safe */ _codecs_message_js__WEBPACK_IMPORTED_MODULE_3__.message),\n/* harmony export */ reader: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_4__.reader),\n/* harmony export */ writer: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_4__.writer)\n/* harmony export */ });\n/* harmony import */ var _decode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decode.js */ \"./node_modules/protons-runtime/dist/src/decode.js\");\n/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encode.js */ \"./node_modules/protons-runtime/dist/src/encode.js\");\n/* harmony import */ var _codecs_enum_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./codecs/enum.js */ \"./node_modules/protons-runtime/dist/src/codecs/enum.js\");\n/* harmony import */ var _codecs_message_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./codecs/message.js */ \"./node_modules/protons-runtime/dist/src/codecs/message.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/protons-runtime/dist/src/utils.js\");\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/protons-runtime/dist/src/utils.js": +/*!********************************************************!*\ + !*** ./node_modules/protons-runtime/dist/src/utils.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ reader: () => (/* binding */ reader),\n/* harmony export */ writer: () => (/* binding */ writer)\n/* harmony export */ });\n/* harmony import */ var protobufjs_src_reader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! protobufjs/src/reader.js */ \"./node_modules/protobufjs/src/reader.js\");\n/* harmony import */ var protobufjs_src_reader_buffer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! protobufjs/src/reader_buffer.js */ \"./node_modules/protobufjs/src/reader_buffer.js\");\n/* harmony import */ var protobufjs_src_util_minimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! protobufjs/src/util/minimal.js */ \"./node_modules/protobufjs/src/util/minimal.js\");\n/* harmony import */ var protobufjs_src_writer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! protobufjs/src/writer.js */ \"./node_modules/protobufjs/src/writer.js\");\n/* harmony import */ var protobufjs_src_writer_buffer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! protobufjs/src/writer_buffer.js */ \"./node_modules/protobufjs/src/writer_buffer.js\");\n// @ts-expect-error no types\n\n// @ts-expect-error no types\n\n// @ts-expect-error no types\n\n// @ts-expect-error no types\n\n// @ts-expect-error no types\n\nfunction configure() {\n protobufjs_src_util_minimal_js__WEBPACK_IMPORTED_MODULE_2__._configure();\n protobufjs_src_reader_js__WEBPACK_IMPORTED_MODULE_0__._configure(protobufjs_src_reader_buffer_js__WEBPACK_IMPORTED_MODULE_1__);\n protobufjs_src_writer_js__WEBPACK_IMPORTED_MODULE_3__._configure(protobufjs_src_writer_buffer_js__WEBPACK_IMPORTED_MODULE_4__);\n}\n// Set up buffer utility according to the environment\nconfigure();\n// monkey patch the reader to add native bigint support\nconst methods = [\n 'uint64', 'int64', 'sint64', 'fixed64', 'sfixed64'\n];\nfunction patchReader(obj) {\n for (const method of methods) {\n if (obj[method] == null) {\n continue;\n }\n const original = obj[method];\n obj[method] = function () {\n return BigInt(original.call(this).toString());\n };\n }\n return obj;\n}\nfunction reader(buf) {\n return patchReader(new protobufjs_src_reader_js__WEBPACK_IMPORTED_MODULE_0__(buf));\n}\nfunction patchWriter(obj) {\n for (const method of methods) {\n if (obj[method] == null) {\n continue;\n }\n const original = obj[method];\n obj[method] = function (val) {\n return original.call(this, val.toString());\n };\n }\n return obj;\n}\nfunction writer() {\n return patchWriter(protobufjs_src_writer_js__WEBPACK_IMPORTED_MODULE_3__.create());\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://light/./node_modules/protons-runtime/dist/src/utils.js?"); + +/***/ }), + +/***/ "./node_modules/uint8-varint/dist/src/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/uint8-varint/dist/src/index.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ signed: () => (/* binding */ signed),\n/* harmony export */ unsigned: () => (/* binding */ unsigned),\n/* harmony export */ zigzag: () => (/* binding */ zigzag)\n/* harmony export */ });\n/* harmony import */ var longbits__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! longbits */ \"./node_modules/longbits/dist/src/index.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nconst N1 = Math.pow(2, 7);\nconst N2 = Math.pow(2, 14);\nconst N3 = Math.pow(2, 21);\nconst N4 = Math.pow(2, 28);\nconst N5 = Math.pow(2, 35);\nconst N6 = Math.pow(2, 42);\nconst N7 = Math.pow(2, 49);\nconst N8 = Math.pow(2, 56);\nconst N9 = Math.pow(2, 63);\nconst unsigned = {\n encodingLength(value) {\n if (value < N1) {\n return 1;\n }\n if (value < N2) {\n return 2;\n }\n if (value < N3) {\n return 3;\n }\n if (value < N4) {\n return 4;\n }\n if (value < N5) {\n return 5;\n }\n if (value < N6) {\n return 6;\n }\n if (value < N7) {\n return 7;\n }\n if (value < N8) {\n return 8;\n }\n if (value < N9) {\n return 9;\n }\n return 10;\n },\n encode(value, buf, offset = 0) {\n if (Number.MAX_SAFE_INTEGER != null && value > Number.MAX_SAFE_INTEGER) {\n throw new RangeError('Could not encode varint');\n }\n if (buf == null) {\n buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(unsigned.encodingLength(value));\n }\n longbits__WEBPACK_IMPORTED_MODULE_0__.LongBits.fromNumber(value).toBytes(buf, offset);\n return buf;\n },\n decode(buf, offset = 0) {\n return longbits__WEBPACK_IMPORTED_MODULE_0__.LongBits.fromBytes(buf, offset).toNumber(true);\n }\n};\nconst signed = {\n encodingLength(value) {\n if (value < 0) {\n return 10; // 10 bytes per spec - https://developers.google.com/protocol-buffers/docs/encoding#signed-ints\n }\n return unsigned.encodingLength(value);\n },\n encode(value, buf, offset) {\n if (buf == null) {\n buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(signed.encodingLength(value));\n }\n if (value < 0) {\n longbits__WEBPACK_IMPORTED_MODULE_0__.LongBits.fromNumber(value).toBytes(buf, offset);\n return buf;\n }\n return unsigned.encode(value, buf, offset);\n },\n decode(buf, offset = 0) {\n return longbits__WEBPACK_IMPORTED_MODULE_0__.LongBits.fromBytes(buf, offset).toNumber(false);\n }\n};\nconst zigzag = {\n encodingLength(value) {\n return unsigned.encodingLength(value >= 0 ? value * 2 : value * -2 - 1);\n },\n // @ts-expect-error\n encode(value, buf, offset) {\n value = value >= 0 ? value * 2 : (value * -2) - 1;\n return unsigned.encode(value, buf, offset);\n },\n decode(buf, offset = 0) {\n const value = unsigned.decode(buf, offset);\n return (value & 1) !== 0 ? (value + 1) / -2 : value / 2;\n }\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8-varint/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arraylist/dist/src/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/uint8arraylist/dist/src/index.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Uint8ArrayList: () => (/* binding */ Uint8ArrayList),\n/* harmony export */ isUint8ArrayList: () => (/* binding */ isUint8ArrayList)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/equals */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/alloc */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n\n\n\nconst symbol = Symbol.for('@achingbrain/uint8arraylist');\nfunction findBufAndOffset(bufs, index) {\n if (index == null || index < 0) {\n throw new RangeError('index is out of bounds');\n }\n let offset = 0;\n for (const buf of bufs) {\n const bufEnd = offset + buf.byteLength;\n if (index < bufEnd) {\n return {\n buf,\n index: index - offset\n };\n }\n offset = bufEnd;\n }\n throw new RangeError('index is out of bounds');\n}\n/**\n * Check if object is a CID instance\n *\n * @example\n *\n * ```js\n * import { isUint8ArrayList, Uint8ArrayList } from 'uint8arraylist'\n *\n * isUint8ArrayList(true) // false\n * isUint8ArrayList([]) // false\n * isUint8ArrayList(new Uint8ArrayList()) // true\n * ```\n */\nfunction isUint8ArrayList(value) {\n return Boolean(value?.[symbol]);\n}\nclass Uint8ArrayList {\n constructor(...data) {\n // Define symbol\n Object.defineProperty(this, symbol, { value: true });\n this.bufs = [];\n this.length = 0;\n if (data.length > 0) {\n this.appendAll(data);\n }\n }\n *[Symbol.iterator]() {\n yield* this.bufs;\n }\n get byteLength() {\n return this.length;\n }\n /**\n * Add one or more `bufs` to the end of this Uint8ArrayList\n */\n append(...bufs) {\n this.appendAll(bufs);\n }\n /**\n * Add all `bufs` to the end of this Uint8ArrayList\n */\n appendAll(bufs) {\n let length = 0;\n for (const buf of bufs) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength;\n this.bufs.push(buf);\n }\n else if (isUint8ArrayList(buf)) {\n length += buf.byteLength;\n this.bufs.push(...buf.bufs);\n }\n else {\n throw new Error('Could not append value, must be an Uint8Array or a Uint8ArrayList');\n }\n }\n this.length += length;\n }\n /**\n * Add one or more `bufs` to the start of this Uint8ArrayList\n */\n prepend(...bufs) {\n this.prependAll(bufs);\n }\n /**\n * Add all `bufs` to the start of this Uint8ArrayList\n */\n prependAll(bufs) {\n let length = 0;\n for (const buf of bufs.reverse()) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength;\n this.bufs.unshift(buf);\n }\n else if (isUint8ArrayList(buf)) {\n length += buf.byteLength;\n this.bufs.unshift(...buf.bufs);\n }\n else {\n throw new Error('Could not prepend value, must be an Uint8Array or a Uint8ArrayList');\n }\n }\n this.length += length;\n }\n /**\n * Read the value at `index`\n */\n get(index) {\n const res = findBufAndOffset(this.bufs, index);\n return res.buf[res.index];\n }\n /**\n * Set the value at `index` to `value`\n */\n set(index, value) {\n const res = findBufAndOffset(this.bufs, index);\n res.buf[res.index] = value;\n }\n /**\n * Copy bytes from `buf` to the index specified by `offset`\n */\n write(buf, offset = 0) {\n if (buf instanceof Uint8Array) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf[i]);\n }\n }\n else if (isUint8ArrayList(buf)) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf.get(i));\n }\n }\n else {\n throw new Error('Could not write value, must be an Uint8Array or a Uint8ArrayList');\n }\n }\n /**\n * Remove bytes from the front of the pool\n */\n consume(bytes) {\n // first, normalize the argument, in accordance with how Buffer does it\n bytes = Math.trunc(bytes);\n // do nothing if not a positive number\n if (Number.isNaN(bytes) || bytes <= 0) {\n return;\n }\n // if consuming all bytes, skip iterating\n if (bytes === this.byteLength) {\n this.bufs = [];\n this.length = 0;\n return;\n }\n while (this.bufs.length > 0) {\n if (bytes >= this.bufs[0].byteLength) {\n bytes -= this.bufs[0].byteLength;\n this.length -= this.bufs[0].byteLength;\n this.bufs.shift();\n }\n else {\n this.bufs[0] = this.bufs[0].subarray(bytes);\n this.length -= bytes;\n break;\n }\n }\n }\n /**\n * Extracts a section of an array and returns a new array.\n *\n * This is a copy operation as it is with Uint8Arrays and Arrays\n * - note this is different to the behaviour of Node Buffers.\n */\n slice(beginInclusive, endExclusive) {\n const { bufs, length } = this._subList(beginInclusive, endExclusive);\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)(bufs, length);\n }\n /**\n * Returns a alloc from the given start and end element index.\n *\n * In the best case where the data extracted comes from a single Uint8Array\n * internally this is a no-copy operation otherwise it is a copy operation.\n */\n subarray(beginInclusive, endExclusive) {\n const { bufs, length } = this._subList(beginInclusive, endExclusive);\n if (bufs.length === 1) {\n return bufs[0];\n }\n return (0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)(bufs, length);\n }\n /**\n * Returns a allocList from the given start and end element index.\n *\n * This is a no-copy operation.\n */\n sublist(beginInclusive, endExclusive) {\n const { bufs, length } = this._subList(beginInclusive, endExclusive);\n const list = new Uint8ArrayList();\n list.length = length;\n // don't loop, just set the bufs\n list.bufs = bufs;\n return list;\n }\n _subList(beginInclusive, endExclusive) {\n beginInclusive = beginInclusive ?? 0;\n endExclusive = endExclusive ?? this.length;\n if (beginInclusive < 0) {\n beginInclusive = this.length + beginInclusive;\n }\n if (endExclusive < 0) {\n endExclusive = this.length + endExclusive;\n }\n if (beginInclusive < 0 || endExclusive > this.length) {\n throw new RangeError('index is out of bounds');\n }\n if (beginInclusive === endExclusive) {\n return { bufs: [], length: 0 };\n }\n if (beginInclusive === 0 && endExclusive === this.length) {\n return { bufs: [...this.bufs], length: this.length };\n }\n const bufs = [];\n let offset = 0;\n for (let i = 0; i < this.bufs.length; i++) {\n const buf = this.bufs[i];\n const bufStart = offset;\n const bufEnd = bufStart + buf.byteLength;\n // for next loop\n offset = bufEnd;\n if (beginInclusive >= bufEnd) {\n // start after this buf\n continue;\n }\n const sliceStartInBuf = beginInclusive >= bufStart && beginInclusive < bufEnd;\n const sliceEndsInBuf = endExclusive > bufStart && endExclusive <= bufEnd;\n if (sliceStartInBuf && sliceEndsInBuf) {\n // slice is wholly contained within this buffer\n if (beginInclusive === bufStart && endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf);\n break;\n }\n // requested part of buffer\n const start = beginInclusive - bufStart;\n bufs.push(buf.subarray(start, start + (endExclusive - beginInclusive)));\n break;\n }\n if (sliceStartInBuf) {\n // slice starts in this buffer\n if (beginInclusive === 0) {\n // requested whole buffer\n bufs.push(buf);\n continue;\n }\n // requested part of buffer\n bufs.push(buf.subarray(beginInclusive - bufStart));\n continue;\n }\n if (sliceEndsInBuf) {\n if (endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf);\n break;\n }\n // requested part of buffer\n bufs.push(buf.subarray(0, endExclusive - bufStart));\n break;\n }\n // slice started before this buffer and ends after it\n bufs.push(buf);\n }\n return { bufs, length: endExclusive - beginInclusive };\n }\n indexOf(search, offset = 0) {\n if (!isUint8ArrayList(search) && !(search instanceof Uint8Array)) {\n throw new TypeError('The \"value\" argument must be a Uint8ArrayList or Uint8Array');\n }\n const needle = search instanceof Uint8Array ? search : search.subarray();\n offset = Number(offset ?? 0);\n if (isNaN(offset)) {\n offset = 0;\n }\n if (offset < 0) {\n offset = this.length + offset;\n }\n if (offset < 0) {\n offset = 0;\n }\n if (search.length === 0) {\n return offset > this.length ? this.length : offset;\n }\n // https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm\n const M = needle.byteLength;\n if (M === 0) {\n throw new TypeError('search must be at least 1 byte long');\n }\n // radix\n const radix = 256;\n const rightmostPositions = new Int32Array(radix);\n // position of the rightmost occurrence of the byte c in the pattern\n for (let c = 0; c < radix; c++) {\n // -1 for bytes not in pattern\n rightmostPositions[c] = -1;\n }\n for (let j = 0; j < M; j++) {\n // rightmost position for bytes in pattern\n rightmostPositions[needle[j]] = j;\n }\n // Return offset of first match, -1 if no match\n const right = rightmostPositions;\n const lastIndex = this.byteLength - needle.byteLength;\n const lastPatIndex = needle.byteLength - 1;\n let skip;\n for (let i = offset; i <= lastIndex; i += skip) {\n skip = 0;\n for (let j = lastPatIndex; j >= 0; j--) {\n const char = this.get(i + j);\n if (needle[j] !== char) {\n skip = Math.max(1, j - right[char]);\n break;\n }\n }\n if (skip === 0) {\n return i;\n }\n }\n return -1;\n }\n getInt8(byteOffset) {\n const buf = this.subarray(byteOffset, byteOffset + 1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getInt8(0);\n }\n setInt8(byteOffset, value) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.allocUnsafe)(1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setInt8(0, value);\n this.write(buf, byteOffset);\n }\n getInt16(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getInt16(0, littleEndian);\n }\n setInt16(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setInt16(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getInt32(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getInt32(0, littleEndian);\n }\n setInt32(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setInt32(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getBigInt64(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getBigInt64(0, littleEndian);\n }\n setBigInt64(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setBigInt64(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getUint8(byteOffset) {\n const buf = this.subarray(byteOffset, byteOffset + 1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getUint8(0);\n }\n setUint8(byteOffset, value) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.allocUnsafe)(1);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setUint8(0, value);\n this.write(buf, byteOffset);\n }\n getUint16(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getUint16(0, littleEndian);\n }\n setUint16(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(2);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setUint16(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getUint32(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getUint32(0, littleEndian);\n }\n setUint32(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setUint32(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getBigUint64(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getBigUint64(0, littleEndian);\n }\n setBigUint64(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setBigUint64(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getFloat32(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getFloat32(0, littleEndian);\n }\n setFloat32(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(4);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setFloat32(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n getFloat64(byteOffset, littleEndian) {\n const buf = this.subarray(byteOffset, byteOffset + 8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n return view.getFloat64(0, littleEndian);\n }\n setFloat64(byteOffset, value, littleEndian) {\n const buf = (0,uint8arrays_alloc__WEBPACK_IMPORTED_MODULE_2__.alloc)(8);\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n view.setFloat64(0, value, littleEndian);\n this.write(buf, byteOffset);\n }\n equals(other) {\n if (other == null) {\n return false;\n }\n if (!(other instanceof Uint8ArrayList)) {\n return false;\n }\n if (other.bufs.length !== this.bufs.length) {\n return false;\n }\n for (let i = 0; i < this.bufs.length; i++) {\n if (!(0,uint8arrays_equals__WEBPACK_IMPORTED_MODULE_1__.equals)(this.bufs[i], other.bufs[i])) {\n return false;\n }\n }\n return true;\n }\n /**\n * Create a Uint8ArrayList from a pre-existing list of Uint8Arrays. Use this\n * method if you know the total size of all the Uint8Arrays ahead of time.\n */\n static fromUint8Arrays(bufs, length) {\n const list = new Uint8ArrayList();\n list.bufs = bufs;\n if (length == null) {\n length = bufs.reduce((acc, curr) => acc + curr.byteLength, 0);\n }\n list.length = length;\n return list;\n }\n}\n/*\nfunction indexOf (needle: Uint8Array, haystack: Uint8Array, offset = 0) {\n for (let i = offset; i < haystack.byteLength; i++) {\n for (let j = 0; j < needle.length; j++) {\n if (haystack[i + j] !== needle[j]) {\n break\n }\n\n if (j === needle.byteLength -1) {\n return i\n }\n }\n\n if (haystack.byteLength - i < needle.byteLength) {\n break\n }\n }\n\n return -1\n}\n*/\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arraylist/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/alloc.js": +/*!****************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/alloc.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nfunction alloc(size = 0) {\n if (globalThis.Buffer?.alloc != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.alloc(size));\n }\n return new Uint8Array(size);\n}\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nfunction allocUnsafe(size = 0) {\n if (globalThis.Buffer?.allocUnsafe != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.allocUnsafe(size));\n }\n return new Uint8Array(size);\n}\n//# sourceMappingURL=alloc.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/alloc.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/compare.js": +/*!******************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/compare.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* binding */ compare)\n/* harmony export */ });\n/**\n * Can be used with Array.sort to sort and array with Uint8Array entries\n */\nfunction compare(a, b) {\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] < b[i]) {\n return -1;\n }\n if (a[i] > b[i]) {\n return 1;\n }\n }\n if (a.byteLength > b.byteLength) {\n return 1;\n }\n if (a.byteLength < b.byteLength) {\n return -1;\n }\n return 0;\n}\n//# sourceMappingURL=compare.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/compare.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/concat.js": +/*!*****************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/concat.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n */\nfunction concat(arrays, length) {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n//# sourceMappingURL=concat.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/concat.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/equals.js": +/*!*****************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/equals.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=equals.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/equals.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/from-string.js": +/*!**********************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/from-string.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/uint8arrays/dist/src/util/bases.js\");\n\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8`, `hex`, and any encoding supported by the multiformats module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.from(string, 'utf-8'));\n }\n // add multibase prefix\n return base.decoder.decode(`${base.prefix}${string}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions\n}\n//# sourceMappingURL=from-string.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/from-string.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/index.js": +/*!****************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/index.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* reexport safe */ _compare_js__WEBPACK_IMPORTED_MODULE_0__.compare),\n/* harmony export */ concat: () => (/* reexport safe */ _concat_js__WEBPACK_IMPORTED_MODULE_1__.concat),\n/* harmony export */ equals: () => (/* reexport safe */ _equals_js__WEBPACK_IMPORTED_MODULE_2__.equals),\n/* harmony export */ fromString: () => (/* reexport safe */ _from_string_js__WEBPACK_IMPORTED_MODULE_3__.fromString),\n/* harmony export */ toString: () => (/* reexport safe */ _to_string_js__WEBPACK_IMPORTED_MODULE_4__.toString),\n/* harmony export */ xor: () => (/* reexport safe */ _xor_js__WEBPACK_IMPORTED_MODULE_5__.xor)\n/* harmony export */ });\n/* harmony import */ var _compare_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compare.js */ \"./node_modules/uint8arrays/dist/src/compare.js\");\n/* harmony import */ var _concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./concat.js */ \"./node_modules/uint8arrays/dist/src/concat.js\");\n/* harmony import */ var _equals_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./equals.js */ \"./node_modules/uint8arrays/dist/src/equals.js\");\n/* harmony import */ var _from_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./from-string.js */ \"./node_modules/uint8arrays/dist/src/from-string.js\");\n/* harmony import */ var _to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./to-string.js */ \"./node_modules/uint8arrays/dist/src/to-string.js\");\n/* harmony import */ var _xor_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./xor.js */ \"./node_modules/uint8arrays/dist/src/xor.js\");\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/to-string.js": +/*!********************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/to-string.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/uint8arrays/dist/src/util/bases.js\");\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n */\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (base == null) {\n throw new Error(`Unsupported encoding \"${encoding}\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString('utf8');\n }\n // strip multibase prefix\n return base.encoder.encode(array).substring(1);\n}\n//# sourceMappingURL=to-string.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/to-string.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/util/as-uint8array.js": +/*!*****************************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/util/as-uint8array.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nfunction asUint8Array(buf) {\n if (globalThis.Buffer != null) {\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n return buf;\n}\n//# sourceMappingURL=as-uint8array.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/util/as-uint8array.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/util/bases.js": +/*!*********************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/util/bases.js ***! + \*********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/src/basics.js\");\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../alloc.js */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: {\n decode\n }\n };\n}\nconst string = createCodec('utf8', 'u', (buf) => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, (str) => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', (buf) => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, (str) => {\n str = str.substring(1);\n const buf = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n//# sourceMappingURL=bases.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/util/bases.js?"); + +/***/ }), + +/***/ "./node_modules/uint8arrays/dist/src/xor.js": +/*!**************************************************!*\ + !*** ./node_modules/uint8arrays/dist/src/xor.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ xor: () => (/* binding */ xor)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/uint8arrays/dist/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/dist/src/util/as-uint8array.js\");\n\n\n/**\n * Returns the xor distance between two arrays\n */\nfunction xor(a, b) {\n if (a.length !== b.length) {\n throw new Error('Inputs should have the same length');\n }\n const result = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(a.length);\n for (let i = 0; i < a.length; i++) {\n result[i] = a[i] ^ b[i];\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(result);\n}\n//# sourceMappingURL=xor.js.map\n\n//# sourceURL=webpack://light/./node_modules/uint8arrays/dist/src/xor.js?"); + +/***/ }), + +/***/ "./node_modules/utf8-codec/index.mjs": +/*!*******************************************!*\ + !*** ./node_modules/utf8-codec/index.mjs ***! + \*******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\nconst SURROGATE_A = 0b1101100000000000\nconst SURROGATE_B = 0b1101110000000000\n\nconst name = 'utf8'\n\nfunction encodingLength (str) {\n let len = 0\n const strLen = str.length\n for (let i = 0; i < strLen; i += 1) {\n const code = str.charCodeAt(i)\n if (code <= 0x7F) {\n len += 1\n } else if (code <= 0x07FF) {\n len += 2\n } else if ((code & 0xF800) !== SURROGATE_A) {\n len += 3\n } else {\n const next = i + 1\n if (next === strLen || code >= SURROGATE_B) {\n len += 3\n } else {\n const nextCode = str.charCodeAt(next)\n if ((nextCode & 0xFC00) !== SURROGATE_B) {\n len += 3\n } else {\n i = next\n len += 4\n }\n }\n }\n }\n return len\n}\n\nfunction encode (str, buf, offset) {\n const strLen = str.length\n if (offset === undefined || offset === null) {\n offset = 0\n }\n if (buf === undefined) {\n buf = new Uint8Array(encodingLength(str) + offset)\n }\n let off = offset\n for (let i = 0; i < strLen; i += 1) {\n let code = str.charCodeAt(i)\n if (code <= 0x7F) {\n buf[off++] = code\n } else if (code <= 0x07FF) {\n buf[off++] = 0b11000000 | ((code & 0b11111000000) >> 6)\n buf[off++] = 0b10000000 | (code & 0b00000111111)\n } else if ((code & 0xF800) !== SURROGATE_A) {\n buf[off++] = 0b11100000 | ((code & 0b1111000000000000) >> 12)\n buf[off++] = 0b10000000 | ((code & 0b0000111111000000) >> 6)\n buf[off++] = 0b10000000 | (code & 0b0000000000111111)\n } else {\n const next = i + 1\n if (next === strLen || code >= SURROGATE_B) {\n // Incorrectly started surrogate pair\n buf[off++] = 0xef\n buf[off++] = 0xbf\n buf[off++] = 0xbd\n } else {\n const nextCode = str.charCodeAt(next)\n if ((nextCode & 0xFC00) !== SURROGATE_B) {\n // Incorrect surrogate pair\n buf[off++] = 0xef\n buf[off++] = 0xbf\n buf[off++] = 0xbd\n } else {\n i = next\n code = 0b000010000000000000000 |\n ((code & 0b1111111111) << 10) |\n (nextCode & 0b1111111111)\n buf[off++] = 0b11110000 | ((code & 0b111000000000000000000) >> 18)\n buf[off++] = 0b10000000 | ((code & 0b000111111000000000000) >> 12)\n buf[off++] = 0b10000000 | ((code & 0b000000000111111000000) >> 6)\n buf[off++] = 0b10000000 | (code & 0b000000000000000111111)\n }\n }\n }\n }\n encode.bytes = off - offset\n return buf\n}\nencode.bytes = 0\n\nfunction decode (buf, start, end) {\n let result = ''\n if (start === undefined || start === null) {\n start = 0\n }\n if (end === undefined || end === null) {\n end = buf.length\n }\n for (let offset = start; offset < end;) {\n const code = buf[offset++]\n let num\n if (code <= 128) {\n num = code\n } else if (code > 191 && code < 224) {\n num = ((code & 0b11111) << 6) | (buf[offset++] & 0b111111)\n } else if (code > 239 && code < 365) {\n num = (\n ((code & 0b111) << 18) |\n ((buf[offset++] & 0b111111) << 12) |\n ((buf[offset++] & 0b111111) << 6) |\n (buf[offset++] & 0b111111)\n ) - 0x10000\n const numA = SURROGATE_A | ((num >> 10) & 0b1111111111)\n result += String.fromCharCode(numA)\n num = SURROGATE_B | (num & 0b1111111111)\n } else {\n num = ((code & 0b1111) << 12) |\n ((buf[offset++] & 0b111111) << 6) |\n (buf[offset++] & 0b111111)\n }\n result += String.fromCharCode(num)\n }\n decode.bytes = end - start\n return result\n}\ndecode.bytes = 0\n\n\n//# sourceURL=webpack://light/./node_modules/utf8-codec/index.mjs?"); + +/***/ }), + +/***/ "./node_modules/wherearewe/src/index.js": +/*!**********************************************!*\ + !*** ./node_modules/wherearewe/src/index.js ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isBrowser: () => (/* binding */ isBrowser),\n/* harmony export */ isElectron: () => (/* binding */ isElectron),\n/* harmony export */ isElectronMain: () => (/* binding */ isElectronMain),\n/* harmony export */ isElectronRenderer: () => (/* binding */ isElectronRenderer),\n/* harmony export */ isEnvWithDom: () => (/* binding */ isEnvWithDom),\n/* harmony export */ isNode: () => (/* binding */ isNode),\n/* harmony export */ isReactNative: () => (/* binding */ isReactNative),\n/* harmony export */ isTest: () => (/* binding */ isTest),\n/* harmony export */ isWebWorker: () => (/* binding */ isWebWorker)\n/* harmony export */ });\n/* harmony import */ var is_electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! is-electron */ \"./node_modules/is-electron/index.js\");\n\n\nconst isEnvWithDom = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9\nconst isElectron = is_electron__WEBPACK_IMPORTED_MODULE_0__()\n\n/**\n * Detects browser main thread **NOT** web worker or service worker\n */\nconst isBrowser = isEnvWithDom && !isElectron\nconst isElectronMain = isElectron && !isEnvWithDom\nconst isElectronRenderer = isElectron && isEnvWithDom\nconst isNode = typeof globalThis.process !== 'undefined' && typeof globalThis.process.release !== 'undefined' && globalThis.process.release.name === 'node' && !isElectron\n// @ts-ignore\n// eslint-disable-next-line no-undef\nconst isWebWorker = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope\n\n// defeat bundlers replacing process.env.NODE_ENV with \"development\" or whatever\nconst isTest = typeof globalThis.process !== 'undefined' && typeof globalThis.process.env !== 'undefined' && globalThis.process.env['NODE' + (() => '_')() + 'ENV'] === 'test'\nconst isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative'\n\n\n//# sourceURL=webpack://light/./node_modules/wherearewe/src/index.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/amd options */ +/******/ (() => { +/******/ __webpack_require__.amdO = {}; +/******/ })(); +/******/ +/******/ /* webpack/runtime/create fake namespace object */ +/******/ (() => { +/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); +/******/ var leafPrototypes; +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 16: return value when it's Promise-like +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = this(value); +/******/ if(mode & 8) return value; +/******/ if(typeof value === 'object' && value) { +/******/ if((mode & 4) && value.__esModule) return value; +/******/ if((mode & 16) && typeof value.then === 'function') return value; +/******/ } +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ var def = {}; +/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; +/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); +/******/ } +/******/ def['default'] = () => (value); +/******/ __webpack_require__.d(ns, def); +/******/ return ns; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./index.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/relay-direct-rtc/manifest.json b/relay-direct-rtc/manifest.json new file mode 100644 index 0000000..0551d62 --- /dev/null +++ b/relay-direct-rtc/manifest.json @@ -0,0 +1,19 @@ +{ + "name": "Relay direct chat", + "description": "Send messages between several users (or just one) using Relay with direct WebRTC connection.", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "favicon.png", + "type": "image/png", + "sizes": "192x192" + } + ], + "display": "standalone", + "theme_color": "#ffffff", + "background_color": "#ffffff" +} diff --git a/relay-direct-rtc/style.css b/relay-direct-rtc/style.css new file mode 100644 index 0000000..77212d7 --- /dev/null +++ b/relay-direct-rtc/style.css @@ -0,0 +1,185 @@ +* { + margin: 0; + padding: 0; + word-wrap: break-word; + box-sizing: border-box; +} + +html, +body { + width: 100%; + height: 100%; + max-width: 100%; + max-height: 100%; +} + +html { + font-size: 16px; + overflow: hidden; +} + +body { + display: flex; + align-items: center; + padding: 10px; + justify-content: center; +} + +h3 + h4, +div + h4, +div + details, +div + div { + margin-top: 20px; +} + +.header div { + display: flex; + justify-content: space-between; +} + +.header div input { + min-width: 300px; + min-height: 30px; + width: 80%; + margin-right: 10px; +} + +.header div button { + min-width: 50px; + min-height: 30px; + width: 10%; + flex-grow: 1; +} + +.header div button + button { + margin-left: 10px; +} + +details { + margin-bottom: 15px; +} + +details p { + margin-bottom: 10px; +} + +summary { + cursor: pointer; + max-width: 100%; + margin-bottom: 5px; +} + +span { + font-weight: 300; +} + +input, +textarea { + line-height: 1rem; + padding: 5px; +} + +textarea { + min-height: 3rem; +} + +h3 { + margin-bottom: 5px; +} + +.content { + width: 800px; + min-width: 300px; + max-width: 800px; + height: 100%; + display: flex; + flex-direction: column; + align-content: space-between; +} + +#messages { + overflow-y: scroll; + overflow-x: hidden; +} + +.message + .message { + margin-top: 15px; +} + +.message :first-child { + font-weight: bold; +} + +.message p + p { + margin-top: 5px; +} + +.message span { + font-size: 0.8rem; +} + +.inputArea { + display: flex; + gap: 10px; + flex-direction: column; + margin-top: 20px; +} + +.controls { + margin-top: 10px; + display: flex; + gap: 10px; +} + +.controls button { + flex-grow: 1; + cursor: pointer; + padding: 10px; +} + +#send { + background-color: #32d1a0; + border: none; + color: white; +} +#send:hover { + background-color: #3abd96; +} +#send:active { + background-color: #3ba183; +} + +#exit { + color: white; + border: none; + background-color: #ff3a31; +} +#exit:hover { + background-color: #e4423a; +} +#exit:active { + background-color: #c84740; +} + +.success { + color: #3ba183; +} + +.progress { + color: #9ea13b; +} + +.terminated { + color: black; +} + +.error { + color: #c84740; +} + +.footer { + display: flex; + width: 100%; + flex-direction: column; + align-self: flex-end; +}