{"version":3,"file":"static/chunks/8567-7b5576f4cb05a4fb.js","mappings":"ibAEA,YAAkB,CAuClB,YACA,WACA,OACA,OACA,iBACA,EA3CA,aAAmB,CAiDnB,YAEA,IADA,EAcA,EAbA,OACA,OACA,OAEA,QATA,CASA,GATA,MASA,GAEA,IAGA,MACA,IACA,EAGA,QAAc,IAAS,KACvB,EACA,uBACA,yBACA,wBACA,qBACA,iBACA,gBACA,aAmBA,OAhBA,QACA,EACA,sBACA,wBACA,cAGA,QACA,EACA,uBACA,wBACA,wBACA,gBACA,cAGA,CACA,EA5FA,eAAqB,CAkHrB,YAQA,QAPA,EACA,WACA,MACA,KAIA,UAA2C,IAAU,GAHrD,MAIA,gBAtBA,OAGA,QAFA,EACA,KACA,IAAsB,IAAS,KAK/B,OAdA,GAUA,EACA,oBACA,kBACA,eAbA,OACA,YACA,WACA,KAWA,EAXA,EAaA,iBACA,EAWA,MAJA,MAIA,MAJA,QAyBA,OAjBA,MAEA,OACA,EAFA,YAEA,GACA,WACA,MAEI,OAEJ,OACA,EAFA,wBAEA,IACA,WACA,WACA,KAIA,UACA,EA1IA,QALA,KACA,KACA,kDAEA,qEACA,eAAmC,IAAS,IAC5C,UACA,qBAQA,cACA,eAEA,SACA,8DAKA,oBACA,eAEA,YACA,EACA,MAEA,WACA,CApBA,wBACA,sDCTA,MAAe,EAAQ,KAAW,EAClC,EAAgB,EAAQ,KAAS,CADX,CAEtB,EACA,QAFuB,IAEvB,6CACA,yCACA,KA8DA,cACA,KAzDA,WA0DA,mEAGA,wBAEA,OADA,qCACA,CACA,CAYA,kBAEA,uBACA,sBACA,gBACA,sEAGA,WACA,CACA,eACA,CAIA,kBACA,sBACA,gBAqHA,KAKA,GAJA,8BACA,WAGA,iBACA,wCAGA,eACA,OAEA,eASA,OAPA,OAIA,iBAGA,CACA,EA3IA,KAGA,yBACA,gBAkJA,GACA,oBACA,wBACA,4CACA,CACA,WACA,EAxJA,GAGA,WACA,gBACA,kHACA,UAIA,qBACA,4BA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,cACA,eACA,gBA+hBA,OACA,mBACA,KAEA,YAAkB,aAAsB,KACxC,wCAEA,QACA,EAviBA,SAEA,SACA,6CACA,uBACA,IACA,CAEA,CAUA,kBACA,UACA,WACA,MACA,CA2IA,0BAk2CA,EAh2CA,0BAmBA,GAhBA,oBACA,IACA,KACI,aACJ,aACI,eACJ,iBAu1CA,EAr1CA,OAu1CA,GAp1CA,mBAIA,oBACA,aACA,eACA,YACA,EAAI,YACJ,MACA,UADA,GAEA,CAQA,GALA,oBACA,gBAIA,qBAEA,aACA,GAEA,aACI,4BAEJ,CADA,OACA,iDACA,EACA,yCAEA,6CAGA,cAGA,wDACA,CAEA,sBACA,IA0BA,EA1BA,IACA,WACA,WAEA,eAEA,UADA,6BACA,aACA,gCACA,0BACA,UAEA,IACA,KACA,KACA,IACA,CAGA,uBACA,MACA,KAEA,mBAEA,CAGA,MACA,SACA,QAAyB,IAAe,IACxC,8BAEA,IADA,cACA,0BAEA,iBACA,IAGA,EAAI,IAEJ,IADA,eACA,IAAyB,KAAQ,KACjC,SACA,YAAsB,IAAe,IACrC,sBACA,KACA,KACA,CAEA,aACA,CAGA,SACA,CA4IA,kBACA,uBACA,SAEA,IACA,WACA,WACA,OACA,QACA,EACA,MACA,EACA,MACA,EACA,EAEA,WACA,YAEA,UACA,OACA,OACA,MAEA,KACA,QAEA,KADA,UACA,QAEA,CADA,kBACA,KACA,MAGA,KACA,QACA,SACA,SACA,4BAEA,CADA,6BACA,0BACA,MAGA,KACA,QACA,SACA,SACA,SACA,0CAEA,CADA,wCACA,kBACA,KAGA,CACA,CAEA,UAGA,QACA,KACM,UAEN,SACA,0BACA,gBAGA,UACA,IACA,CAEA,OAQA,YACA,eACA,MAJA,KAKA,2CAIA,SACA,IACA,UACA,6BACA,OACA,aAdA,OAiBA,QACA,EAxBA,EACA,CAmGA,kBACA,sDACA,kEACA,CAyQA,wBACA,iFACA,kEACA,sDACA,CA+FA,sBACA,eAEA,kCACA,UACA,MACA,SACA,MACA,SACA,MACA,SACA,+CAQA,OAPA,SACA,MACA,SACA,MACA,SACA,MACA,SACA,CACA,CAEA,sBACA,eAEA,kCACA,UACA,MACA,SACA,MACA,SACA,MACA,SACA,+CAQA,OAPA,SACA,MACA,SACA,MACA,SACA,MACA,OACA,GACA,CAkHA,wBACA,iBACA,IADA,sCAEA,CAEA,sBAOA,OANA,KACA,OACA,GACA,sDAEA,sBACA,GACA,CAUA,sBAOA,OANA,KACA,OACA,GACA,wDAEA,sBACA,GACA,CA7nDA,QAAc,GACd,YAAkB,CAyTlB,YAIA,MAHA,OACA,MAEA,CAH2B,CAG3B,SACA,EA7TA,mBAAyB,IAGzB,YAAkB,CADlB,WAiBA,iCAYA,IACA,wBACA,GAAoB,eAAmB,YAGvC,OAFA,8CACA,2BACA,YACA,CAAI,SACJ,QACA,CACA,IAnBA,oDACA,kCACA,cACA,iJAkBA,4CACA,cACA,eACA,oBACA,mBAEA,CAAC,EAED,4CACA,cACA,eACA,oBACA,uBAEA,CAAC,EAmCD,gBA8DA,uBACA,eACA,EAIA,wDACA,oCA8BA,wBACA,OApBA,EAoBA,GAnBA,MACA,EAkBA,GAhBA,SAgBA,EAZA,iBAYA,EAXA,EAWA,GAXA,KAWA,KAVA,EAUA,GAVA,KAUA,GARA,EAQA,EACA,EAUA,0BACA,WACA,EAIA,8BACA,WACA,EA6GA,uBACA,kCACA,iBAGA,wBAGA,GAFA,qDACA,qDACA,+BACA,gBACA,yEAIA,kBAEA,eACA,WAEA,4BAAwC,IAAS,IACjD,gBACA,OACA,OACA,KACA,QAGA,OACA,MACA,CACA,EAEA,yBACA,gCACA,UACA,WACA,YACA,YACA,aACA,aACA,aACA,WACA,YACA,cACA,eACA,QACA,SACA,QACA,CACA,EAEA,2BASA,EARA,qBACA,+DAGA,gBACA,kBAIA,cAEA,QADA,IACgB,WAAiB,IACjC,eAIA,uBACA,IACA,QAAc,WAAiB,KAC/B,WACA,mBACA,qBACA,6BACA,aAEA,8BACA,EACA,EACA,QAGM,iB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,QACA,EApmCA,QA5DA,IA8DA,cAEA,OA7DA,EA6DA,EA7DA,EA6DA,EA5DA,IA4DA,QA5DA,IA8DA,YACA,YACA,cACA,eACA,OA/DA,EA+DA,EA/DA,EA+DA,EA9DA,EA0pCA,kBACA,IACA,SACA,YAAkB,aAClB,WADkC,IAIlC,EADA,qBACA,EAEA,OADA,OAEA,UAGA,QACA,EA1mCA,EA9DA,IA8DA,CA9DA,UA8DA,KA9DA,IAgEA,SACA,6CACA,uBACA,IACA,CAEA,EAEA,8BACA,OACA,cACA,kDACA,CACA,EAwJA,gCACA,kBACA,MACA,mBAEA,IACA,OACA,SACI,KACJ,MAGA,IACA,OACA,SACI,KACJ,MAGA,WAEA,yBAIA,OAFA,qCAEA,CACA,EAUA,uBACA,uCACA,OACA,OACA,sBAEA,cACA,IACA,IACA,sBACA,eAGA,QACA,EAEA,uBACA,uCACA,OACA,OACA,GACA,mBAGA,kBACA,IACA,oBACA,iBAGA,QACA,EAEA,sBACA,oCAGA,OAFA,OACA,sBACA,SAGA,yBACA,uCAGA,OAFA,OACA,sBACA,oBACA,EAEA,yBACA,uCAGA,OAFA,OACA,sBACA,oBACA,EAEA,yBACA,uCAIA,OAHA,OACA,sBAEA,SACA,aACA,eACA,qBAGA,yBACA,uCAIA,OAHA,OACA,sBAEA,kBACA,eACA,aACA,UACA,EAEA,0CAEA,EADA,OACA,UACA,cACA,YACA,0BACA,mBAGA,QACA,cACA,gBACA,oBAEA,YACA,cACA,gBACA,YAEA,wCACA,CAAC,EAED,0CAEA,EADA,OACA,UACA,cACA,YACA,0BACA,mBAGA,kBACA,gBACA,cACA,UAEA,sBACA,gBACA,cACA,EAEA,uCACA,CAAC,EAED,sCACA,OACA,OACA,sBAEA,cACA,IACA,IACA,sBACA,eAMA,OAFA,GAFA,UAEA,qBAEA,CACA,EAEA,sCACA,OACA,OACA,sBAEA,QACA,IACA,cACA,oBACA,iBAMA,OAFA,GAFA,UAEA,qBAEA,CACA,EAEA,yCAGA,CAFA,OACA,sBACA,aACA,qBADA,SAIA,sCACA,OACA,sBACA,2BACA,6BACA,EAEA,sCACA,OACA,sBACA,2BACA,6BACA,EAEA,sCAIA,OAHA,OACA,sBAEA,QACA,aACA,cACA,aACA,EAEA,sCAIA,OAHA,OACA,sBAEA,YACA,cACA,aACA,WAGA,yCAEA,EADA,OACA,UACA,cACA,YAUA,MATA,0BACA,mBAQA,QALA,UACA,cACA,gBACA,UAEA,YACA,SACA,cACA,gBACA,oBACA,CAAC,EAED,yCAEA,EADA,OACA,UACA,cACA,YAUA,MATA,0BACA,mBAQA,QALA,QACA,gBACA,cACA,YAEA,YACA,2BACA,gBACA,cACA,EACA,CAAC,EAED,sCAGA,OAFA,OACA,sBACA,sBACA,EAEA,sCAGA,OAFA,OACA,sBACA,sBACA,EAEA,uCAGA,OAFA,OACA,sBACA,sBACA,EAEA,uCAGA,OAFA,OACA,sBACA,sBACA,EAQA,wBACA,0CAIA,GAHA,KACA,OACA,OACA,IACA,wBACA,iBACA,CAEA,QACA,IAEA,IADA,cACA,iBACA,kBAGA,UACA,EAEA,wBACA,0CAIA,GAHA,KACA,OACA,OACA,IACA,wBACA,iBACA,CAEA,UACA,IAEA,IADA,gBACA,kBACA,kBAGA,UACA,EAEA,uBACA,uCAKA,OAJA,KACA,OACA,uBACA,cACA,GACA,EAEA,0BACA,0CAMA,OALA,KACA,OACA,yBACA,cACA,gBACA,GACA,EAEA,0BACA,0CAMA,OALA,KACA,OACA,yBACA,cACA,gBACA,GACA,EAEA,0BACA,0CAQA,OAPA,KACA,OACA,8BACA,iBACA,iBACA,gBACA,cACA,GACA,EAEA,0BACA,0CAQA,OAPA,KACA,OACA,8BACA,eACA,iBACA,gBACA,gBACA,GACA,EA8CA,+CACA,yDACA,CAAC,EAED,+CACA,yDACA,CAAC,EAED,yCAGA,GAFA,KACA,OACA,IACA,wBAEA,oBACA,CAEA,QACA,IACA,IAEA,IADA,cACA,iBACA,6BACA,MAEA,yBAGA,UACA,EAEA,yCAGA,GAFA,KACA,OACA,IACA,wBAEA,oBACA,CAEA,UACA,IACA,IAEA,IADA,gBACA,kBACA,6BACA,MAEA,yBAGA,UACA,EAEA,sCAMA,OALA,KACA,OACA,0BACA,iBACA,cACA,GACA,EAEA,yCAMA,OALA,KACA,OACA,8BACA,cACA,gBACA,GACA,EAEA,yCAMA,OALA,KACA,OACA,8BACA,cACA,gBACA,GACA,EAEA,yCAQA,OAPA,KACA,OACA,wCACA,cACA,gBACA,iBACA,iBACA,GACA,EAEA,yCASA,OARA,KACA,OACA,wCACA,wBACA,eACA,iBACA,gBACA,gBACA,GACA,EAEA,8CACA,6EACA,CAAC,EAED,8CACA,6EACA,CAAC,EAiBD,yCACA,uBACA,EAEA,yCACA,uBACA,EAYA,0CACA,uBACA,EAEA,0CACA,uBACA,EAGA,mCACA,iEAQA,GAPA,SACA,0BACA,0BACA,SACA,gBAGA,OACA,8BADA,SAIA,OACA,8CAEA,8DACA,mDAGA,+BACA,gBACA,iBAGA,UAaA,OAXA,6DAEA,uBAEA,8BACA,EACA,mBACA,GAIA,CACA,EAMA,uCA6CA,EA3CA,uBASA,GARA,oBACA,IACA,IACA,eACM,qBACN,IACA,eAEA,+BACA,6CAEA,wCACA,wCAEA,iBACA,sBACA,oBACA,eAEA,KAEA,CACA,EAAI,sBACJ,OACI,qBACJ,cAIA,qCACA,uCAGA,QACA,YASA,GANA,OACA,+BAEA,SAGA,mBACA,QAAoB,IAAS,IAC7B,cAEI,CACJ,oBACA,EACA,YACA,WACA,SACA,gCACA,qCAEA,QAAgB,MAAiB,IACjC,iBAIA,aAOA,SACA,kBACA,qBACA,cACA,QAEA,sCACA,8BACA,YACA,eACA,CAAO,EAGP,aAAqB,WAAW,GAAG,EAAI,GAGvC,WAEA,gBACA,CAEA,WACA,QACA,CAEA,YACA,mCACA,gBACA,cACA,QACA,WACA,CAAO,CACP,CAEA,WACA,SAAgB,WAAW,GAAG,EAAI,KAAK,aAAa,EAEpD,CACA,CA+BA,cACA,SACA,WACA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sBAEA,kBAEA,oBACA,OAEA,QACA,EA4GA,GACA,CAEA,oBACA,MACA,QAAc,MACd,gCAD0B,IAE1B,YAEA,QACA,CAKA,gBACA,uBACA,wDACA,4BASA,iBACA,yBACA,aACA,YAAkB,KAAQ,KAC1B,WACA,YAAoB,KAAQ,IAC5B,iBAGA,QACA,CAAC,GAGD,cACA,oCACA,CAEA,aACA,mCACA,iBCxjEA,MAAY,qBAEZ,IADA,IACA,UACA,WACA,OACA,KACA,UACA,SACA,SAOA,IALA,KAEA,cACA,OACA,KACS,IAAW,0BAKpB,IAHA,cACA,OACA,KACS,IAAW,0BAEpB,SACA,WACI,SACJ,0BAEA,iBACA,KAEA,gCACA,EAEA,OAAa,uBAEb,IADA,MACA,UACA,WACA,OACA,gCACA,UACA,SACA,wBAmCA,IA/BA,MAFA,gBAEA,SACA,eACA,MAEA,mCACA,yBACA,IACA,MAEA,OACA,OAEA,qBAEA,SACA,IACA,MAGA,QACA,IACA,KACM,QACN,wBACA,OAEA,kCACA,MAIS,KAAW,+BAIpB,IAFA,SACA,KACS,IAAU,+BAEnB,eACA,4nECpFO,kCACP,iBACA,OACA,mBAEA,GADA,mBACA,MACA,IACA,MACA,CACA,wBACA,EACA,KACA,wBACA,CAAC,EACM,2BACP,eACA,CAAC,ECfM,GACP,UACA,gBACA,aACA,cACA,aACA,aACA,WACA,sBACA,EAAK,CACL,iBACA,gBACA,aACA,cACA,aACA,aACA,WACA,sBACA,EAAK,CACL,cACA,gBACA,aACA,cACA,aACA,aACA,WACA,sBACA,EAAK,CACL,aACA,gBACA,aACA,cACA,aACA,aACA,QACA,sBACA,EACA,EACO,WACP,oBACA,UACA,UACA,IACA,MACA,CACA,IACA,SAA4B,EAAO,IACnC,CADmC,GACnC,aACA,QACA,EACA,IACA,CAAK,CCpDE,SACP,aACA,iBACA,QACA,wBACA,KACA,eACA,KAIA,gCACA,gCACA,GAEA,4BACA,CACA,CACA,sBAKA,CAJA,mBACA,uBAGA,+BACA,QAGA,0BAEA,iCACA,oDACA,CAAS,EACT,CACA,EChCA,YAEA,4DACA,CAAC,UAA4B,ECJ7B,uCACA,2BACA,UACA,eACA,iBACA,iBACA,wBACA,CAAC,EACD,mBAGA,EAFA,SACA,KAEA,4BACA,WAEA,QADA,aACA,CACA,UACA,iBACA,qBACA,WAEA,CACA,CAEA,kCACA,MAKA,EAJA,EAGA,mBACA,EAEA,mBACA,mBACA,UAGA,kBAGA,qBACA,GAA6B,OAAW,mBAExC,mBACA,UAAoC,aAAiB,GAGrD,aApBA,OAsBA,mBAAyC,EAAI,IAC7C,CACA,GACA,OAAsB,EAAS,IAAI,GAAQ,EAG3C,eACA,cAEA,OADA,cACA,CAAa,0BACb,EACA,sBACA,KAEA,YAEA,IADA,cAAuB,mBAAsB,EAC7C,SAHA,KAIA,SAEA,EACA,MACA,OACA,eACA,iBACA,qBAAoB,UAAyB,eAC7C,oBACA,kBAAkC,YAAkB,IAAI,EAAiB,KAEzE,cACA,CAAS,CACT,gBACA,qBAAoB,UAAyB,eAC7C,oBACA,iBAAiC,YAAkB,IAAI,EAAiB,KAExE,aACA,CAAS,CACT,gBACA,qBAAoB,UAAyB,eAC7C,oBACA,iBAAiC,YAAkB,IAAI,EAAiB,KAExE,aACA,CAAS,CACT,iBACA,qBAAoB,UAAyB,eAC7C,oBACA,kBAAkC,YAAkB,IAAI,EAAiB,KAEzE,cACA,CAAS,EAET,QACA,EAOO,QACA,MACA,MACP,WAEA,OADA,8BACA,CACA,EClHM,EAAS,EAAW,OAAd,EAAc,OACnB,MACP,aACA,MACA,+BAGA,UACA,eACA,6BACA,cAGY,EAAM,qFAIlB,WACA,OACA,6BACA,OACA,uBACA,yBACA,2BACA,QACA,oBACA,oBACA,oBACA,gBACA,oBACA,oBACA,aACA,WACA,OACA,OACA,CACA,EACO,MACP,aACA,SAEA,2BACA,eACA,kBAEA,QACA,EACO,MACP,qBACA,SAEA,IACA,kCACA,CACA,SAEA,OADQ,EAAM,+BAAgC,gBAAsB,GACpE,EACA,CACA,ECvDO,GACP,gBACA,QACA,WAAgB,CAChB,OAAY,CAEL,SACP,QACA,QACA,QACA,QAAc,EAAQ,MACtB,qBACA,gBAAsB,CAAU,aAChC,KACA,eACA,eAEA,aAA2B,EAAQ,yDACnC,CACA,aACA,oBAEA,WACA,kBAEA,kBACA,uBACA,aAA2B,EAAQ,aACnC,kCACA,iCACA,SACA,WAA6B,EAAO,GACpC,EADoC,EACpC,8BACA,aAA+B,EAAQ,SACvC,CAAa,EACb,UACA,aAA+B,EAAQ,UACvC,CAAa,EACb,aACA,yBACA,CAAa,GAEb,qBAEA,kBACA,uCACA,yBACA,uBACA,2BACA,oBACa,CACb,CAAS,GACT,EACA,YACA,gCACA,ECnCA,YACA,iCACA,qCACA,2BACA,4BACA,CAAC,UAA4C,EC5BtC,WACP,OACA,aACA,0BACA,sBACA,eACA,wBAEA,CAAS,EAET,QACA,CACO,uBACP,KACA,mBACA,UACA,SAAiB,EAAK,GAAG,QAAQ;AAAA,EAAI,YAAqB,UAAU;AAAA,EAAI,QAAQ,gBAAgB,GAChG,YACA,aACA,CACA,CACO,QACP,MACA,iBAAsB,CAAU,aAChC,GACA,aAEA,CACA,yBACA,aACA,kBAGA,cACA,8BACA,CACA,UACA,gCACA,CCpCO,QACP,aACA,cAAoB,EAAa,EAAQ,OACzC,CADgC,aAChC,IAAwB,EAAY,GACpC,OADoC,aACpC,EACA,gBACA,mBAEA,CACA,eACA,sBAEA,mBACA,0BAEA,eACA,wBAAgC,EAAQ,cACxC,IACA,6BAAyC,EAAe,gBACxD,sDACA,CAAa,EACb,CACA,SACA,wBAAoC,EAAQ,YAC5C,MACA,CACA,CACA,yBACA,wBAAgC,EAAQ,WAExC,iCACA,mCACA,iCAIA,oDACA,gCACA,8BACA,CACA,CC1CO,QACP,QACA,UACA,gBACA,GACA,WACA,iBAA2B,EAAY,CACvC,SADuC,QAEvC,yBACA,QAAqB,CACrB,CAAS,EACT,mBAA6B,EAAY,CACzC,SADyC,QAEzC,yBACA,QAAqB,CACrB,CAAS,CACT,CACA,gBACA,qDAAoE,EACpE,cACA,qBAEA,iCACA,sCACA,CACA,4BACA,gDACA,OACA,QACA,KACA,CAAS,EACT,cACA,qBAEA,iCACA,sCACA,CACA,uBACA,iDAAgE,EAChE,cACA,qBAEA,iCACA,sCACA,CACA,EC7CA,YACA,eACA,2BACA,yBACA,2CACA,6CACA,6BACA,uCACA,6CACA,+CACA,iDACA,0BACA,oCACA,sCACA,4BACA,kCACA,8BACA,0CACA,sCACA,kCACA,wBACA,CAAC,WCpBM,SACP,iBACA,GACA,WAEA,CACA,kBACA,mDAAwE,sBAA4B,EACpG,cACA,UAAsB,EAAW,EAAc,MAAf,EAAe,UAE/C,OACA,oBACA,kBAEA,CACA,aACA,oDACA,SACA,CAAS,EACT,cACA,UAAsB,EAAW,EAAc,MAAf,EAAe,UAE/C,eAEA,CC1BA,IAAM,EAAS,EAAW,UAAd,SACL,SACP,iBACA,GACA,WAEA,CACA,gBACQ,EAAM,qDACd,8CACA,KACA,UACA,CAAS,EACT,cACA,qBAEA,OACA,kBACA,0BAEA,CACA,mBACQ,EAAM,wDACd,kDACA,KACA,UACA,CAAS,EACT,cACA,qBAEA,OACA,kBAEA,CACA,CChCA,IAAM,EAAS,EAAW,UAAd,WACL,SACP,WACA,MACA,gBAAsB,CAAU,aAChC,OACA,kBACA,aACA,4BAAoC,EAAe,IAEnD,MAAoB,GAAI,WADxB,oCAEA,0BACA,CAAS,CACT,CACA,cACA,2BAEA,gBACA,uCACA,CACA,iBACQ,EAAM,gCACd,wBACA,CACA,gBACA,wBACA,IACA,6DACA,CACA,SAEA,CACA,CACA,OAEA,CACA,CCvCO,UACP,UAAY,2BAA6B,EACzC,OACA,QACA,mBACA,mBACA,eACA,CACA,ECJM,EAAS,EAAW,mBACnB,GADK,IACL,EACP,IACA,KACA,WACA,oBAA0B,EAAY,MACtC,IADsC,SACtC,IAAuB,EAAY,IACnC,MADmC,IACnB,EAAY,MAC5B,IAD4B,cAC5B,IAA4B,EAAY,MACxC,IADwC,iBACxC,IAA+B,EAAY,GAC3C,OAD2C,EAC3C,KACA,cACA,aACA,cACA,uBACA,OACA,WACA,YACA,iBAEA,CACA,eACA,sBAEA,SACA,YACA,EACA,eACA,cACA,+BAGA,6BAAmC,SAAc,CAEjD,QACA,kBAEA,aAAgB,wDADhB,gDAAsE,eAAiB,CAEvF,8BACA,oCACA,kBACA,EAQA,CACA,KACA,kBACA,sBACA,qBACA,EAZA,CACA,KACA,WACA,aACA,qBACA,CAQA,CAAS,EACT,qCACA,CACA,uBACA,oCACA,+BACA,0BACA,mCACA,sDAAsE,iBAAsB,EAC5F,cACA,qBAEA,oBAAgB,eAA6B,EAE7C,MACA,mBAAoB,qCAAiD,EACrE,KACA,eACA,UAEA,eACA,aAEA,8BACA,kCACA,CACA,gCACA,CACA,2BACA,gBAAgB,mGAAyG,EACzH,kCACA,MACA,mCAGA,mCAEA,GADQ,EAAM,yDACd,cACA,IA6BA,EA7BA,EACA,cACA,UAAwB,2BAA6B,EAA2B,GAEhF,GACA,IAEA,IACA,SANgF,GAMhF,iBACA,QACA,SACA,SACA,KACA,CAAqB,CACrB,CACA,SAIA,MAHA,GACA,KAEA,CACA,CACA,GACA,IAEA,CAEA,GACA,IAGA,IACA,oDACA,KACA,YACA,WACA,CAAiB,CACjB,CACA,SAIA,MAHA,GACA,KAEA,CACA,CACA,cAIA,MAHA,GACA,kBAEA,gCAEA,2CACA,GACA,GAEA,CAGA,aADA,+BAEA,IACA,qBAAwC,YAA4B,MACpE,KACA,CACA,SACgB,EAAM,0CACtB,CAEA,0BAIA,MAHA,GACA,iCAEA,6BAEA,CACA,gCAA8C,oBAA8B,EAAI,QAChF,GACA,IAEA,2BACA,wCACA,uBACA,GACA,IAEA,kBAA4B,EAAY,8BACxC,oCAEA,+BAEA,eAAqB,UAAe,EADpC,yBACoC,GACpC,8BAEA,EACA,QACA,8BACA,CACA,YACA,4BACA,MACA,wBAEA,uDACA,CACA,CCtMO,SACP,IA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EAPA,iBAGA,OAFA,MAAkB,EAAO,EAAY,EAAb,EACxB,MADqC,IACrC,WACA,mBAGA,iDAEA,IACA,sCACA,CACA,SAEA,MADY,EAAM,yDAClB,CACA,CAGA,OAFA,gBACA,kBACA,CACA,CAGA,cACA,iBACA,IACA,4CACA,CACA,SACgB,EAAM,yDACtB,CAEA,mBACA,oBACA,CAGA,gCACA,OACA,iCAGA,iBAGA,OAFA,MAAkB,EAAO,EAAY,EAAb,EACxB,MADqC,IACrC,WACA,+BAEQ,EAAM,6DACd,IACA,wCACA,CACA,SACA,yDAIA,OAFgB,EAAM,2FAEtB,8BAOA,OAJgB,EAAM,8DAItB,CAEA,CACA,CACA,oBACA,OACA,iCAEA,kBAGA,OAFA,MAAkB,EAAO,EAAY,EAAb,EACxB,MADqC,IACrC,WACA,mBAEA,IACA,0CACA,CACA,SACA,yDAIA,OAFgB,EAAM,wFAEtB,kBAOA,OAJgB,EAAM,2DAItB,CAEA,CACA,CAGA,oCASA,EARA,QACA,MAAuB,EAAY,GACvB,EAAM,KADiB,WACjB,yBAClB,MAAkB,EAAM,EACxB,CACA,CAFwB,EAExB,YACA,yBAGA,IACA,0DACA,CACA,SAEA,OADY,EAAM,iFAClB,8BACA,CACA,eACA,yBAEA,gDACA,IACA,qBACA,CACA,SAEA,OADY,EAAM,oCAClB,8BACA,CACA,eAEA,MADA,iBACA,mBAsBA,GAnBA,6BACA,iDACA,qBACA,uBACA,YACA,kBACA,0BACA,QACA,wBACA,sBACA,kBACa,CACb,EAEA,eACA,gBAEA,kBAEA,eACY,EAAM,iDAClB,IACA,8DACA,CACA,SACA,YAEoB,EAAM,+FAC1B,mBACA,sBAKoB,EAAM,+FAE1B,CACA,MAEY,EAAM,oCAEV,EAAM,kBACd,CAEA,uBACA,MACA,IACA,kDACA,CACA,SAEA,OADY,EAAM,6CAClB,EACA,CAEA,OADA,gBACA,EACA,CAIA,mBACA,oBAIA,GAFA,MAAkB,EAAM,KAExB,YAEA,OAGA,kBAEA,i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,SAC/B,CACA,ECpFA,YACA,yBACA,wCACA,qCACA,CAAC,UAA4C,CACtC,wBACP,iBACA,4BACA,SACA,WACA,CACA,EAEA,YACA,2BACA,cACA,oDACA,sBACA,kBACA,CAAC,UAA8B,CACxB,UACP,GACA,GACA,qBACA,QACA,UACA,eAEA,GACA,UACA,UACA,oBAEA,aACA,oBAEA,WACA,kBAEA,YACA,kBACA,CACA,kBACA,kCAEA,OACA,oBAEA,UACA,sCAEA,WACA,yBACA,YACA,CACA,QACA,sBACA,aACA,CACA,aAEA,CACA,CC/DA,yBACO,YACP,EAGA,iBAFA,GAIO,OACP,UACA,iBAGA,mBACA,iBACA,UACA,oBAEA,mCACA,oBACA,wBACA,kBACA,EACO,MACP,KAAgB,eAAmB,ECvBnC,GAAe,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,GAAG,8EAA8E,CEIlK,QACP,uCAKA,OAJA,GDLA,SAAiB,GACjB,QCIwB,MDLP,EACjB,UAAqC,GAAK,OAC1C,ECGwB,KACxB,EAAa,IACb,UADe,GACf,uBAEA,CACA,CCVO,UACP,QACA,cACA,WACA,KACA,YACA,IACA,aACA,QACA,OACA,KACA,wBACA,uBACA,eACA,qBACA,kBACA,YACA,mBACA,WACA,oBACA,eACA,cACA,aACA,iBAEA,CACA,mBACA,qBAA6B,MAC7B,KADwC,CACxC,0BACA,4BACA,CACA,gBC/BO,OAAuB,oBAAa,SCU9B,GAAS,KACtB,MAAoB,MADE,UACF,CAAU,CAAC,IAC/B,MACA,IAF6C,EAE7C,8DASA,QACA,EAUO,OACI,2BAAoB,CAE/B,SAAoB,CAAE,GAEtB,QAFiC,ECpC1B,OAAoC,KAAS,YAC7C,GAD6C,IACT,KAAS,yFCGpD,iBAAqC,IAAY,CACjD,EACA,YACA,GACA,cACA,KACA,QACA,UACA,mBACA,mBACA,SACA,CACA,cACA,mCACA,gCACA,CACA,cACA,mBACA,+CACS,SAAmB,kBAC5B,mCACA,8BACA,iB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AI,YAE3C,QACA,CAAK,QACL,MAAW,QAAQ,EACnB,wBACA,UACA,oBACK,CACL,EACO,WACP,MAAe,KAAS,YACxB,EAAe,CADS,EACT,eAAW,WAC1B,yBACA,8BACK,SACL,MAAW,QAAQ,EACnB,kCACA,UACA,QACA,CAAK,CACL,EACO,QACP,MAAe,KAAS,YAExB,GAFwB,IAEb,GAAW,CACtB,mBADsB,QACtB,mBACA,WAHe,kBAAW,gBAAU,iBAA6B,oCAIjE,CAAK,CACL,EACO,QACP,MAAe,KAAS,YACxB,GADwB,GACb,2BAAoB,+EAC/B,EACO,QACP,MAAe,KAAS,YACxB,GADwB,GACb,2BAAoB,sEAC/B,EACO,QACP,MAAe,KAAS,YACxB,EAAgB,CADQ,EACR,eAAW,MAC3B,yBACA,MACA,YAEA,aAAgB,GAAW,EAC3B,QACA,CAAK,MACL,MAAW,2BAAoB,mBAC/B,EACO,QACP,MAAe,KAAS,YACxB,GADwB,GACb,2BAAoB,qFAC/B,EACO,QACP,MAAe,KAAS,YACxB,GADwB,GACb,kBAAW,8BACtB,EC/EO,WACP,MAAmB,KAAS,cACxB,CADwB,EACxB,aAAS,+BACb,ECRO,OACP,MAAmB,KACnB,EAAe,aADa,IACb,CAAW,WAC1B,wCAA0D,EAAI,EAC9D,cACA,qBAEA,OACA,kBACA,kBACA,kBACA,gBAEA,CAAK,QACL,MAAW,QAAQ,EACnB,uBACA,SACA,CAAK,CACL,EACO,OACP,MAAmB,KACnB,EAAwB,SAAc,GActC,CAf4B,MAejB,GAAW,CACtB,mBADsB,IACtB,YACA,WAfe,kBAAW,iBAAU,eAAsB,IAC1D,0CACA,WACA,YACA,CAAS,EACT,cACA,qBAKA,OAHA,2BACA,qBACS,EACT,UACK,OAIL,CAAK,CACL,ECvCO,OACP,MAAmB,KAAS,OAC5B,EAAkB,MADU,WACV,CAAW,WAC7B,kBACA,mCACA,aAAiB,0BACjB,CAAK,MACL,MAAW,QAAQ,EACnB,qBACA,SACA,CAAK,CACL,EACO,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AAK,CACL,CACA,cACA,cAEA,UACA,eAEA,CACA,UACA,uBACA,2BACA,IACA,CAAK,CACL,CACA,kBACA,0BACA,QAEA,+CACA,CACA,8FCzDA,gBAA6B,GAAS,CACtC,IACA,GACA,cACA,GACA,QACA,6BACA,wBACA,WACA,wBACA,2BACA,iBACA,CACA,cACA,eACA,sCACA,CACA,WACA,yBAEA,eACA,sBACA,gBACA,sBACA,gBACA,qBACA,cACA,UACA,CAAO,EAEP,CACA,kBACA,iCACA,kBACA,gBACA,uBACA,cACA,UACA,CAAK,CACL,CACA,iBACA,iBACA,8BACA,kBAEA,qBAGA,CACA,WACA,4BACA,kCACA,CACA,iBACA,QAAoB,QAAa,EACjC,OACA,wBAGA,2BAFA,6CAIA,eACA,SAAyB,qCAAqC,CAC9D,CAAO,CACP,aACA,SAAyB,aAAe,CACxC,CAAO,CACP,gBACA,SAAyB,gBAAkB,CAC3C,CAAO,CACP,4BACA,mCACA,qCACA,+BACA,CAAK,EACL,oCACA,sBACA,IACA,OACA,SAAyB,sCAAsC,EAC/D,gCACA,EACA,MAEA,uCACA,wBACA,SACA,eACA,UACA,YACA,UACA,CAAW,CAEX,CACA,4BAiBA,OAhBA,iCACA,EACA,EACA,mBACA,MAEA,uDACA,iCACA,EACA,KACA,qBACA,mBACA,MAEA,4DACA,SAAuB,sBAAuB,EAC9C,CACA,CAAM,SACN,IAyBA,MAxBA,+BACA,EACA,EACA,mBACA,MAEA,6BACA,EACA,EACA,oBAEA,iCACA,OACA,EACA,qBACA,mBACA,MAEA,+BACA,OACA,EACA,EACA,oBAEA,CACA,EAAQ,OACR,SAAyB,qBAAsB,CAC/C,CACA,EAAM,OACN,qBACA,CACA,CACA,MAsDA,YArDA,IACA,eACA,aACA,OACA,KACA,4BACA,sBAEA,aACA,OACA,KACA,WACA,CACA,gBACA,OACA,KACA,WACA,CACA,eACA,OACA,KACA,kBACA,YACA,eACA,mBACA,WACA,oBACA,iBACA,sBACA,sBACA,CACA,eACA,OACA,KACA,YACA,eACA,mBACA,WACA,iBACA,WACA,CACA,aACA,OACA,KACA,YACA,cACA,8BACA,sBACA,YACA,cACA,CACA,CACA,GACA,YACI,GAAa,YACjB,oBACA,qBACA,CAAO,EACP,gBACA,cACA,eACA,QACA,CAAO,CACP,CAAK,CACL,CACA,EACA,aACA,OACA,eACA,YACA,WACA,eACA,mBACA,YACA,cACA,iBACA,aACA,CACA,iDCxJA,iBA3EA,SACA,IACA,MACA,GACA,EACA,MACA,GACA,EACA,qBACA,MACA,EACA,UAEA,OACA,IACA,CAAO,CAEP,EACA,OACA,QACA,KACA,UACA,OACA,OACA,cACA,IACA,CAAW,CACX,CAAS,CACT,CAAO,CAEP,EACA,OACA,UACA,KACA,KACA,IACA,KACA,EAAQ,SAER,GACA,GAEA,CACA,QACA,CAAK,CAIL,cACA,SACA,OACA,OACA,CAAS,CACT,EAEA,WAKA,sBACA,GACA,CAAK,CAKL,2BACA,GACA,CAAK,CACL,iBACA,GACA,CACA,CACA,6ECxBA,MAjDA,cAAkC,GAAY,CAC9C,OACA,GACA,eACA,CACA,QACA,YACA,IAAW,IAAQ,2BACnB,gBACA,YAGA,OAFA,uCACA,wCACA,KACA,uCACA,uCACA,CACA,CAEA,CACA,CACA,cACA,SACA,8BAEA,CACA,gBACA,sBACA,YACA,eAEA,CACA,oBACA,UACA,YACA,oCACA,CACA,aACA,cAEA,UACA,2BACA,IACA,CAAO,EAEP,CACA,WACA,eAEA,yGCvCA,gBAA0B,GAAS,CACnC,EACA,KACA,GACA,GACA,GACA,cACA,GACA,QACA,WACA,yBACA,2BACA,kBACA,gBACA,yBACA,2BACA,iBA2UA,GACA,qEACA,aACA,gGACA,OACA,OACA,kBACA,gCACA,WACA,mBACA,iBACA,oBACA,wBACA,eACA,iBACA,6BACA,kBACA,CACA,EA7VA,cACA,4BACA,iBACA,CACA,WACA,yBAEA,cACA,uBACA,CACA,cACA,cAAqB,iBACrB,sCACA,CACA,iBACA,wDACA,oBAEA,CACA,aACA,MAAiB,QAAW,iCAO5B,OANA,SACA,OACA,eACA,2BACA,gBACA,CAAK,EACL,CACA,CACA,cACA,SAAqB,0CAA0C,CAC/D,CACA,UACA,uBAEA,OADA,mBACA,SAAkC,IAAI,QAAQ,IAAI,mBAClD,CACA,UACA,gBACA,aAAkB,UAAc,CAChC,CACA,QACA,eACA,sBACA,CACA,WACA,2BACA,GAAkC,KAAd,QAAc,yBAElC,CACA,oBACA,2BACA,iBAEA,uBAAoC,IAAS,4DAC7C,CACA,gBACA,6BAGA,2BACA,oBACA,iCAGA,yBACA,CACA,mBACA,4DAAsE,QAAc,4BACpF,CACA,UACA,2DACA,YAAwB,iBAAsB,EAC9C,mBACA,CACA,WACA,yDACA,YAAwB,iBAAsB,EAC9C,mBACA,CACA,eACA,6BACA,uBACA,sBACA,gBAA2B,2CAA8C,EAEzE,CACA,kBACA,6BACA,+CACA,wBACA,UACA,QACA,gBAAmC,UAAc,EAEjD,uBAGA,mBAEA,gBAA2B,6CAAgD,EAE3E,CACA,oBACA,6BAEA,aACA,0BACA,SAAuB,kBAAoB,CAE3C,CACA,WACA,oCACA,8CACA,aAAsB,UAAc,OAC5B,WAER,OADA,wBACA,gBAMA,GAHA,GACA,mBAEA,uBACA,gDACA,GACA,0BAEA,CAQA,0BACA,MACA,kCACA,cACA,SACA,WACA,SAEA,CAAO,CACP,EAkBA,GACA,eACA,qBACA,uBACA,iBACA,QAtBA,KACA,MAAsB,QAAa,iBACnC,GACA,uBACA,sBAIA,CAFA,KACA,WACA,wBACA,uBACA,EACA,EACA,MAGA,IACA,CAOA,EACA,KACA,+BACA,EACA,MAEA,mBACA,gFACA,SAAuB,uCAAiD,EAExE,UACY,QAAgB,eAC5B,SACA,aACA,OACA,CAAS,EAEE,QAAgB,MAC3B,yBACA,EACA,MAEA,2BACA,gBACA,EACA,OAGA,iBACA,EA4CA,OA3CA,QAAoB,QAAa,EACjC,iCACA,aACA,sBACA,cACA,eAMA,WAA+B,gBAAgB,qBAC/C,MACA,CACA,IACA,eACA,CAAU,SACV,KACA,MACA,CACA,mCACA,2BACA,EACA,iBACA,MAEA,iBACA,CAAO,CACP,UACA,eACA,SAAyB,qCAAqC,CAC9D,CAAO,CACP,aACA,SAAyB,aAAe,CACxC,CAAO,CACP,gBACA,SAAyB,gBAAkB,CAC3C,CAAO,CACP,sBACA,gCACA,kCACA,aACA,CAAK,EACL,eACA,CACA,MAmEA,YAlEA,IACA,eACA,aACA,OACA,KACA,iCACA,2BAEA,aACA,OACA,KACA,oBACA,CACA,gBACA,OACA,KACA,sBACA,CACA,aACA,OACA,KACA,0BACA,sBACA,CACA,eACA,OACA,KACA,YACA,oCACA,0CACA,WACA,iBACA,iBACA,eACA,mBACA,oBACA,uBACA,EAEA,aACA,cACA,GAAc,QAAgB,uBAC9B,OAAqB,+BAErB,OACA,KACA,QACA,sCACA,0BACA,wCACA,qBACA,mBACA,cACA,CACA,kBACA,OACA,KACA,gBACA,CACA,gBACA,OACA,KACA,WAEA,CACA,GACA,YACI,GAAa,YACjB,2BACA,iBACA,CAAO,EACP,gBAA2B,mCAAsC,CACjE,CAAK,CACL,CACA,EACA,gBACA,OACA,oBACA,wBACA,YAAiB,QAAQ,oCACzB,gBACA,WACA,gBACA,EAEA,gECpWA,QACA,GACA,UACA,qBACA,CACA,aACA,sBACQ,QAAc,eACtB,yBACA,qBACA,CAAO,cAEP,CACA,gBACA,qBACA,eACA,IAAoB,IAAQ,UAE5B,CACA,iBACA,UACA,sBACA,eAEA,CACA,oHCtBA,cACA,6BACA,CACA,cACA,gCAAkD,GAAa,WAC/D,CACA,0BACA,eACA,wBACA,sBACA,qBACA,CACA,EACA,cACA,qBACA,CACA,cACA,IAGA,EAHA,KACA,IACA,KAEA,EAAmB,OAAe,GAalC,MAA4B,GAAY,yCAAoD,GAAa,yBACzG,mCACA,MACA,IACA,KACA,iBACA,MACA,aAEA,EACA,MACA,IACA,KACA,eACA,MACA,YAEA,EACA,MACA,gBACA,MACA,UACA,IAEA,EACA,aACA,CAAK,YACL,SACA,GACA,gBAEA,CAAK,EAEL,WAIA,EAHA,KACA,OAGA,oCACA,IACA,WACA,CAAM,SACN,mBACA,CACA,qCACA,KACA,OAEA,gBAAqC,IAAQ,MAC7C,kBACA,gCACA,gEACA,UACA,KACA,MACA,CACA,IACA,gBACM,QAAK,aACX,gBACO,UACP,EACA,KAEA,GAEA,CAAO,CACP,CAAK,CACL,EACA,OACA,UACA,OAnFA,IACA,IACA,YACA,YAEA,EA+EA,cACA,MACA,GAEA,YAlFA,KACA,IACA,EAiFA,cAhFA,KACA,IACA,EA+EA,WACA,WACA,IACA,IAEA,YAEA,EAEA,CACA,iDC9HA,YACA,cACA,uBACA,wCACA,CACA,aAGA,OAFA,sBACA,mBACA,KACA,yBACA,oBACA,CACA,CACA,eACA,4BACA,CACA,cACA,CACA,gBACA,CACA,gCCpBA,iBACA,EACA,EACA,0BACA,IACA,GACA,CAAG,EAIH,cACA,mBACA,iBACA,gBAgBA,OAtBA,mBACA,aACA,CAAG,EAMH,cACA,GACA,mBACA,OACA,CAAK,EACL,IACA,EACA,aACA,GACA,kBACA,QACA,CAAK,EACL,IACA,EACA,CACA,oOC9BA,sDACA,aACA,CACA,gBACA,iCACA,CACA,cACA,uCACA,CACA,gBACA,sCACA,CACA,gBACA,iCACA,CACA,gBACA,iCACA,CACA,gBACA,IACA,aACA,QACA,cACA,YACA,WACA,QACA,CAAI,EACJ,MACA,KACA,iCACA,QACA,MACM,oBACN,SAGA,cACA,mBACA,qBAGA,kBAFA,QAKA,OACA,wCAGA,+BAGA,YAIA,CACA,gBACA,UAAU,sCAAwC,EAClD,MACA,0BACA,SAEA,KACA,oCACA,QACA,MACM,+BACN,QAEA,OACA,0BAGA,YAIA,CACA,gBAEA,OADA,sBACA,EACA,CACA,cACA,sBACA,EACA,iDACA,UACA,GACK,EAAI,IAET,CACA,uBACA,OAGA,oBAGA,kDACA,sCAGA,CA6BA,gBACA,qDACA,SAEA,eACA,eACA,SAGA,QACA,CACA,cACA,0DAEA,cACA,SACA,SAEA,oBACA,cACA,SAEA,2BACA,MAGA,oCAGA,4CAKA,cACA,2DACA,CACA,cACA,uBACA,eACA,CAAG,CACH,CACA,wBACA,uCACA,yBACI,yBAzEJ,gBACA,SACA,SAEA,iBACA,kBACA,yBACA,WACA,qBACA,WACA,UACA,IACA,YAAoB,IAAW,KAC/B,eACA,sDACA,YACA,MAEA,kBACA,4BACA,IAGA,CACA,uBACA,CACA,QACA,EAwDA,KAEA,CACA,CAIA,oBACA,eACA,iCACA,CACA,oBACA,eACA,oCACA,CACA,eACA,sBAQA,8BACA,qBAEA,yBAGA,UAFA,8CAA+D,YAAkB,IAGjF,oFCrNa,EAA2B,gBACtC,QAGW,EAAiB,IAC5B,IAAM,EAAe,aAAW,GAEhC,GAAI,EACF,OAAO,EAGT,CANkD,CAEjC,CAIb,CAAC,EACH,MADW,MACK,wDAAwD,EAG1E,OAAO,CACT,EAOa,EAAsB,OAAC,QAClC,WACA,EACF,GAAmD,OAC3C,YAAU,KACd,EAAO,MAAM,EACN,KACL,EAAO,QAAQ,CACjB,GACC,CAAC,EAAO,EAGT,EAHQ,CAGR,OAAC,EAAmB,SAAnB,CAA4B,MAAO,WACjC,EACH,CAEJ,uHC5BA,gBAAkC,GAAY,CAC9C,iBACA,QACA,eACA,UACA,aACA,QAA4B,OAAe,GAC3C,4CACA,eACA,oEAGA,mBACA,kBACA,CACA,IACA,UACA,UACA,QACA,KACA,GACA,GACA,GACA,GACA,GAGA,GACA,CACA,KACA,GACA,UACA,cACA,oCACA,CACA,cACA,0BACA,0BACA,wBACA,UAEA,oBAEA,UAEA,CACA,gBACA,qBACA,cAEA,CACA,yBACA,SACA,QACA,aACA,gCAEA,CACA,2BACA,SACA,QACA,aACA,kCAEA,CACA,UACA,uBACA,UACA,UACA,4BACA,CACA,gBACA,mBACA,UAEA,GADA,4CACA,gHAA2J,WAA3J,MAA6I,QAAc,+BAC3J,YACA,yEAGA,UACA,iCACA,eAAmC,QAAmB,kBACtD,gCACA,8BACA,cACA,cACO,EAEP,0BACA,KACA,QACA,EACA,aACA,IAEA,UAEA,qBACA,iBAAwD,QAAc,iCAA+C,QAAc,qBAA6C,QAAgB,mCAAiD,QAAgB,wBACjQ,UAEA,gBACA,iBAAwD,QAAc,iCAA+C,QAAc,mCACnI,UAEA,CACA,uBACA,+CACA,yBAMA,MAoVO,QAAmB,CAzV1B,KAyV0B,mBAzV1B,KACA,UACA,qBACA,uBAEA,CACA,CACA,mBACA,eAEA,iBACA,SAYA,OAXA,2BACA,2BACA,gBACA,cACA,SACA,kBACA,OACA,KAEA,CAAO,CACP,CAAK,EACL,CACA,CACA,aACA,cACA,CACA,kBACA,eAEA,SAAY,MAAa,EAAI,EAC7B,mBACA,KACK,CACL,CACA,mBACA,qCACA,2CACA,iDACA,CACA,SACA,gBACA,KACA,iCACA,CAAK,YACL,oBACA,SAEA,CACA,MACA,UACA,oBACA,aACA,GAKA,OAHA,iBACA,WAA8B,KAAI,EAElC,CACA,CACA,KACA,UACA,MAAsB,QAAgB,CACtC,uBACA,SAEA,GAAQ,IAAQ,oBAAoC,QAAc,IAClE,OAEA,MAAiB,QAAc,yBAE/B,yBACA,iBACA,mBAEA,CAAK,CALL,IAMA,CACA,KACA,8HACA,CACA,MACA,UACA,WACQ,IAAQ,EAAkB,KAAd,QAAc,gCAAyD,QAAc,wBAGzG,0BACA,2CAAsD,GAAY,eAClE,SAEA,CAAK,UACL,CACA,KACA,UACA,kBACA,CACA,KACA,UACA,sBACA,eAEA,CACA,KACA,UACA,uBACA,eAEA,CACA,sBAWA,EAVA,cACA,eACA,UACA,UACA,UAEA,EADA,MACA,gBACA,OAAY,GAAQ,EACpB,GAAqB,MACrB,KAEA,yBACA,0BACA,aACA,gBACA,QACA,IACA,KACA,GAAa,OAAU,mBACvB,EAEA,sCACA,sBAEA,CACA,UAAU,6BAAgC,EAC1C,8BACA,2CACA,eAEA,IACA,iBACA,mBACA,EAAiB,QAAW,cAC5B,UACA,YACA,CAAU,SACV,SACA,OAGA,SAEA,0DACA,MACA,gEACA,cAMA,GAJA,yDACA,oBACA,SACA,kBACA,qBACA,IACA,cACA,YACA,CAAY,SACZ,SACA,CAGA,aACA,YACA,EAAe,QAAW,CAC1B,QACA,EACA,GAEA,KAEA,CACA,UACA,UACA,UACA,aACA,WAEA,iCACA,gBACA,cACA,OACA,aACA,GACA,SACA,0BACA,YACA,wBACA,UACA,mBACA,YACA,OACA,8BACA,QACA,iBACA,iCACA,mCACA,oCACA,oDACA,+FACA,aACA,mBACA,qBACA,kCACA,oBACA,oBACA,eACA,qBACA,iBAGA,+CACA,UACA,UAHA,EAGA,OACA,SAJA,EAIA,OACU,SALV,EAKU,MACV,iBAEA,EACA,OAEA,EADA,QAVA,EAUA,QAAqE,OAAe,GAEpF,EACA,UACA,iBACA,cACA,2BACA,KAEA,KACA,iBACA,WArBA,EAqBA,2BACA,IAEA,KACA,gBACA,WA1BA,EA0BA,QA1BA,EA0BA,mBACA,GAGA,CACA,CACA,OAhCA,CAiCA,CACA,gBACA,cACA,0CAMA,GALA,sBACA,qBACA,uBACA,kBAEQ,QAAmB,MAC3B,MAEA,WACA,SAsBA,oBArBA,KACA,MACA,SAEA,wBAAc,GAAsB,aACpC,6BACA,gCACA,SAEA,cACA,YAKA,OAHA,2BACA,eAEA,6BAGA,IADA,IADA,EACA,KADA,EACA,EACA,MAFA,GAIA,MAEA,iBAEA,SAAmB,UAA2C,CAC9D,CACA,KACA,0DACA,eACA,OAEA,cACA,UACA,gBACA,sBACA,wBACA,oBAEA,CACA,gBACA,oBACA,qBACA,SAEA,CACA,MACI,GAAa,YACjB,aACA,2BACA,UACA,CAAS,EAET,gCACA,cACA,6BACA,CAAO,CACP,CAAK,CACL,CACA,EAIA,gBACA,OAHuB,IAAd,QAAc,CAGvB,EAHuB,QAGvB,IAHuB,wDAGvB,EAHuB,eAGvB,8CACA,CACA,kBACA,GAAoB,KAAd,QAAc,eACpB,kCACA,kCACA,CACA,QACA,CACA,oBACA,cAA+C,KAAd,QA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node_modules/buffer/index.js","webpack://_N_E/./node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/util/time.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/util/async.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/shared/dispatcher.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/shared/message.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/util/logger.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/account/util.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/account/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/multiplayer/types.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/shared/types.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/clock/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/compliance/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/shared/errors.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/history/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/leaderboards/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/multiplayer/context.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/multiplayer/util.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/multiplayer/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/util/net.js","webpack://_N_E/./node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/native.js","webpack://_N_E/./node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/rng.js","webpack://_N_E/./node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/stringify.js","webpack://_N_E/./node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/v4.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/net/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/notifications/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/vault/service.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/web3/types.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/web3/helpers.js","webpack://_N_E/./node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/regex.js","webpack://_N_E/./node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/validate.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/util.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/core/client.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/client-provider.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-client.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-services.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","webpack://_N_E/../../src/useMutation.ts","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-account.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-clock.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-compliance.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-connection.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-discord.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-rpc.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-elo.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-history.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-leaderboards.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-multiplayer.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-notifications.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-raffle.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-vaults.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/react/hooks/use-web3.js","webpack://_N_E/./node_modules/.pnpm/@spyre-io+js@0.3.20_@heroiclabs+nakama-js@2.7.1_@tanstack+react-query@5.64.1_react@19.0_a500ffec955855250c6992b216d50b7e/node_modules/@spyre-io/js/dist/index.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/focusManager.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/mutation.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/notifyManager.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/onlineManager.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/query.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/removable.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/retryer.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/subscribable.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/thenable.js","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/utils.js","webpack://_N_E/../../src/QueryClientProvider.tsx","webpack://_N_E/./node_modules/.pnpm/@tanstack+query-core@5.64.1/node_modules/@tanstack/query-core/build/modern/queryObserver.js","webpack://_N_E/../../src/QueryErrorResetBoundary.tsx","webpack://_N_E/../../src/errorBoundaryUtils.ts","webpack://_N_E/../../src/isRestoring.ts","webpack://_N_E/./node_modules/.pnpm/@tanstack+react-query@5.64.1_react@19.0.0/node_modules/@tanstack/react-query/build/modern/suspense.js","webpack://_N_E/../../src/useBaseQuery.ts","webpack://_N_E/../../src/useQuery.ts","webpack://_N_E/./node_modules/.pnpm/@tanstack+react-query@5.64.1_react@19.0.0/node_modules/@tanstack/react-query/build/modern/utils.js"],"sourcesContent":["'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","export const runFor = async (cb, ms) => new Promise((resolve) => {\n const now = Date.now();\n const frame = () => {\n const totalMs = Date.now() - now;\n cb(Math.min(1, totalMs / ms));\n if (totalMs >= ms) {\n resolve();\n return;\n }\n requestAnimationFrame(frame);\n };\n cb(0);\n requestAnimationFrame(frame);\n});\nexport const waitFor = async (ms) => new Promise((resolve) => {\n setTimeout(resolve, ms);\n});\n","import { waitFor } from \"./time\";\nexport const asyncOps = {\n new: () => ({\n isInProgress: false,\n isStarted: false,\n isComplete: false,\n isSuccess: false,\n isFailure: false,\n error: null,\n lastUpdated: Date.now(),\n }),\n inProgress: () => ({\n isInProgress: true,\n isStarted: true,\n isComplete: false,\n isSuccess: false,\n isFailure: false,\n error: null,\n lastUpdated: Date.now(),\n }),\n success: () => ({\n isInProgress: false,\n isStarted: true,\n isComplete: true,\n isSuccess: true,\n isFailure: false,\n error: null,\n lastUpdated: Date.now(),\n }),\n failure: (error) => ({\n isInProgress: false,\n isStarted: true,\n isComplete: true,\n isSuccess: false,\n isFailure: true,\n error,\n lastUpdated: Date.now(),\n }),\n};\nexport const repeatAsync = (fn, times, delayMs) => {\n return new Promise((resolve, reject) => {\n const loop = (n) => {\n if (n === 0) {\n resolve();\n return;\n }\n fn()\n .then(() => waitFor(delayMs))\n .then(() => loop(n - 1))\n .catch(reject);\n };\n loop(times);\n });\n};\n","export class Dispatcher {\n _handlers = {};\n _removalQueue = [];\n on(code, payload) {\n const handlers = this._handlers[code];\n if (handlers) {\n for (const handler of handlers) {\n handler(payload);\n }\n }\n // remove any queued handlers\n if (this._removalQueue.length > 0) {\n for (const remove of this._removalQueue) {\n remove();\n }\n this._removalQueue.length = 0;\n }\n }\n addHandler(code, handler) {\n if (!this._handlers[code]) {\n this._handlers[code] = [];\n }\n // ensure it's not already in the list\n if (this._handlers[code].includes(handler)) {\n return () => { };\n }\n // add to the list\n this._handlers[code].push(handler);\n // queue for removal\n return () => this._removalQueue.push(() => {\n this._handlers[code] = this._handlers[code].filter((h) => h !== handler);\n });\n }\n}\n","export var Messages;\n(function (Messages) {\n // account\n Messages[Messages[\"ACCOUNT_WALLET_CONNECTED\"] = 100] = \"ACCOUNT_WALLET_CONNECTED\";\n})(Messages || (Messages = {}));\nexport const VoidMessage = {};\n","const dtf = new Intl.DateTimeFormat(\"en-US\", {\n timeZone: \"America/Chicago\",\n hour12: false,\n hour: \"numeric\",\n minute: \"numeric\",\n second: \"numeric\",\n fractionalSecondDigits: 3,\n});\nconst format = (category, message, ...replacements) => {\n const meta = {};\n const uniqueTokens = [];\n let results;\n while ((results = _tokenSub.exec(message)) !== null) {\n const tokenName = results[1];\n const index = uniqueTokens.indexOf(tokenName);\n if (index === -1) {\n uniqueTokens.push(tokenName);\n const index = uniqueTokens.length - 1;\n if (replacements && replacements.length > index && replacements[index]) {\n meta[tokenName] = replacements[index];\n }\n }\n }\n // replace\n for (const [key, value] of Object.entries(meta)) {\n let stringValue;\n if (!value) {\n stringValue = \"null\";\n }\n else if (typeof value === \"string\") {\n stringValue = value;\n }\n else if (typeof value === \"object\") {\n if (value instanceof Error) {\n stringValue = value.message;\n }\n else {\n stringValue = JSON.stringify(value);\n }\n }\n else if (typeof value === \"function\") {\n stringValue = `${value.name}()` || \"anonymous()\";\n }\n else if (typeof value === \"bigint\") {\n stringValue = `BigInt(${value.toString()})`;\n }\n else {\n stringValue = value.toString();\n }\n message = message.replaceAll(`@${key}`, stringValue);\n }\n if (category) {\n message = `[${category}] ${message}`;\n }\n // timestamp\n const now = new Date();\n const timestamp = dtf.format(now);\n meta[\"timestamp\"] = timestamp;\n return { formattedMessage: message, meta };\n};\nconst _tokenSub = /@([a-zA-Z0-9_]+)/g;\nconst _logHistory = [];\nconst _logHistoryMax = 100;\nconst addToHistory = (level, message, meta) => {\n _logHistory.push({ level, message, meta });\n while (_logHistory.length > _logHistoryMax) {\n _logHistory.shift();\n }\n};\nconst createLogger = (category) => {\n const instance = {\n consoleLevel: 4,\n debug: (message, ...replacements) => {\n const { formattedMessage, meta } = format(category || \"\", message, ...replacements);\n if (instance.consoleLevel >= 4) {\n console.debug(`[${meta[\"timestamp\"]}] ${formattedMessage}`, meta);\n }\n addToHistory(\"debug\", formattedMessage, meta);\n },\n info: (message, ...replacements) => {\n const { formattedMessage, meta } = format(category || \"\", message, ...replacements);\n if (instance.consoleLevel >= 3) {\n console.info(`[${meta[\"timestamp\"]}] ${formattedMessage}`, meta);\n }\n addToHistory(\"info\", formattedMessage, meta);\n },\n warn: (message, ...replacements) => {\n const { formattedMessage, meta } = format(category || \"\", message, ...replacements);\n if (instance.consoleLevel >= 2) {\n console.warn(`[${meta[\"timestamp\"]}] ${formattedMessage}`, meta);\n }\n addToHistory(\"warn\", formattedMessage, meta);\n },\n error: (message, ...replacements) => {\n const { formattedMessage, meta } = format(category || \"\", message, ...replacements);\n if (instance.consoleLevel >= 1) {\n console.error(`[${meta[\"timestamp\"]}] ${formattedMessage}`, meta);\n }\n addToHistory(\"error\", formattedMessage, meta);\n },\n };\n return instance;\n};\nexport class ConsoleLogTarget {\n debug = console.debug;\n info = console.info;\n warn = console.warn;\n error = console.error;\n}\nexport const getHistory = () => _logHistory;\nexport const logger = createLogger();\nexport const childLogger = (name) => {\n const child = createLogger(name);\n child.consoleLevel = logger.consoleLevel;\n return child;\n};\n","import { childLogger } from \"../../core/util/logger\";\nconst logger = childLogger(\"core:account\");\nexport const getUser = (account) => {\n const user = account.user;\n if (!user) {\n throw new Error(\"Invalid account\");\n }\n // verified address\n let walletAddr = null;\n if (account.custom_id) {\n if (account.custom_id.startsWith(\"0x\")) {\n walletAddr = account.custom_id;\n }\n else {\n logger.warn(\"Invalid wallet address, '@WalletAddress' for user @UserId.\", account.custom_id, user.id);\n }\n }\n // get derived\n const balances = getBalances(account);\n const meta = getMeta(account);\n const coins = Number(balances[\"coins\"] || BigInt(0));\n return {\n avatarUrl: user.avatar_url,\n createTime: user.create_time,\n displayName: user.display_name,\n id: user.id,\n lang_tag: user.lang_tag,\n location: user.location,\n metadata: user.metadata,\n online: user.online,\n timezone: user.timezone,\n username: user.username,\n walletAddr: walletAddr,\n balances,\n meta,\n coins,\n };\n};\nexport const getBalances = (account) => {\n if (!account.wallet) {\n return {};\n }\n const parsed = JSON.parse(account.wallet);\n for (const key in parsed) {\n parsed[key] = BigInt(parsed[key]);\n }\n return parsed;\n};\nexport const getMeta = (account) => {\n if (!account.user?.metadata) {\n return {};\n }\n try {\n return JSON.parse(account.user.metadata);\n }\n catch (error) {\n logger.warn(`Invalid user metadata: ${account.user.metadata}`);\n return {};\n }\n};\n","import { asyncOps } from \"../../core/util/async\";\nimport { Dispatcher } from \"../../core/shared/dispatcher\";\nimport { Messages } from \"../../core/shared/message\";\nimport { getUser } from \"./util\";\nexport const NullUser = {\n walletAddr: null,\n coins: 0,\n balances: {},\n meta: {},\n};\nexport class AccountService {\n _nakama;\n _events;\n _user = NullUser;\n _status = asyncOps.new();\n _refreshPromise = null;\n _dispatcher = new Dispatcher();\n constructor(_nakama, _events) {\n this._nakama = _nakama;\n this._events = _events;\n // listen for updates\n _events.addHandler(Messages.ACCOUNT_WALLET_CONNECTED, (msg) => (this._user.walletAddr = msg.addr));\n }\n get status() {\n return this._status;\n }\n get user() {\n return this._user;\n }\n refresh = async () => {\n if (!this._refreshPromise) {\n this._status = asyncOps.inProgress();\n this._refreshPromise = this._nakama\n .getApi((client, session) => client.getAccount(session), 3)\n .then((account) => {\n this._user = getUser(account);\n this._dispatcher.on(0, this._user);\n this._status = asyncOps.success();\n })\n .catch((err) => {\n this._status = asyncOps.failure(err);\n })\n .finally(() => {\n this._refreshPromise = null;\n });\n }\n return this._refreshPromise;\n };\n update = async (user) => {\n await this._nakama.getApi(async (client, session) => {\n await client.updateAccount(session, {\n avatar_url: user.avatarUrl,\n display_name: user.displayName,\n username: user.username,\n });\n }, 0);\n };\n onUpdate = (fn) => {\n return this._dispatcher.addHandler(0, fn);\n };\n}\n","export const OpCodeInitClock = 1;\nexport const OpCodeInitNoop = 2;\nexport class MatchUserState {\n userId;\n constructor(userId) {\n this.userId = userId;\n //\n }\n}\nexport class MatchStartEvent {\n startTime;\n constructor(startTime) {\n this.startTime = startTime;\n //\n }\n}\nexport class MatchEndEvent {\n endTime;\n constructor(endTime) {\n this.endTime = endTime;\n //\n }\n}\nexport var DisconnectReason;\n(function (DisconnectReason) {\n DisconnectReason[DisconnectReason[\"MatchIsOver\"] = 0] = \"MatchIsOver\";\n DisconnectReason[DisconnectReason[\"UserRequested\"] = 1] = \"UserRequested\";\n DisconnectReason[DisconnectReason[\"Disposal\"] = 2] = \"Disposal\";\n DisconnectReason[DisconnectReason[\"Exception\"] = 3] = \"Exception\";\n})(DisconnectReason || (DisconnectReason = {}));\n","import { Dispatcher } from \"./dispatcher\";\nexport const newCancelToken = () => {\n const token = {\n cancelled: false,\n cancel: () => (token.cancelled = true),\n throwIfCancelled: () => {\n if (token.cancelled) {\n throw new Error(\"Cancelled\");\n }\n },\n };\n return token;\n};\nexport class SpyreError extends Error {\n code;\n errors;\n constructor(code, message, errors = []) {\n super(`${code}:${message}\\n${errors.map((e) => `${e.message}\\n${e.stack}`).join(\"\\n\\n\")}`);\n this.code = code;\n this.errors = errors;\n }\n}\nexport class WatchedValue {\n _value;\n _dispatcher = new Dispatcher();\n constructor(_value) {\n this._value = _value;\n //\n }\n getValue = () => this._value;\n setValue = (value) => {\n if (value === this._value) {\n return;\n }\n this._value = value;\n this._dispatcher.on(0, undefined);\n };\n watch = (listener) => {\n return this._dispatcher.addHandler(0, listener);\n };\n}\n","import { OpCodeInitClock } from \"../multiplayer/types\";\nimport { WatchedValue } from \"../shared/types\";\nimport { asyncOps } from \"../util/async\";\nexport class ClockService {\n _multiplayer;\n _sampling = new WatchedValue(asyncOps.new());\n _offsetMillis = new WatchedValue(0);\n _offsetMeasurements = [];\n constructor(_multiplayer) {\n this._multiplayer = _multiplayer;\n //\n }\n get sampling() {\n return this._sampling;\n }\n get offsetMillis() {\n return this._offsetMillis;\n }\n async update() {\n this._sampling.setValue(asyncOps.inProgress());\n try {\n await this._multiplayer.send(OpCodeInitClock, JSON.stringify({\n s: Math.floor(Date.now() + this._offsetMillis.getValue()),\n }));\n }\n catch (error) {\n this._sampling.setValue(asyncOps.failure(error));\n return;\n }\n }\n addLatencyMeasurement(measurement) {\n this._sampling.setValue(asyncOps.success());\n // \"ring buffer\"\n this._offsetMeasurements.push(measurement);\n if (this._offsetMeasurements.length > 5) {\n this._offsetMeasurements.shift();\n }\n // take the average\n // TODO: take out outliers because these are probably TCP rebroadcast\n const average = this._offsetMeasurements.reduce((acc, cur) => acc + cur, 0) /\n this._offsetMeasurements.length;\n this._offsetMillis.setValue(average);\n }\n}\n","import { WatchedValue } from \"../../core/shared/types.js\";\nexport class ComplianceService {\n raffles;\n cashGames;\n rpc;\n constructor(rpc) {\n this.rpc = rpc;\n this.raffles = new WatchedValue({\n status: \"unknown\",\n ineligibilityType: \"none\",\n meta: \"{}\",\n });\n this.cashGames = new WatchedValue({\n status: \"unknown\",\n ineligibilityType: \"none\",\n meta: \"{}\",\n });\n }\n async refresh() {\n const res = await this.rpc.call(\"account/get-compliance\", {});\n if (!res.success) {\n throw new Error(res.error);\n }\n this.raffles.setValue(res.raffles);\n this.cashGames.setValue(res.cashMatches);\n }\n async updateBirthday(year, month, day) {\n const res = await this.rpc.call(\"account/submit-age\", {\n year,\n month,\n day,\n });\n if (!res.success) {\n throw new Error(res.error);\n }\n this.raffles.setValue(res.raffles);\n this.cashGames.setValue(res.cashMatches);\n }\n async updateLocation() {\n const res = await this.rpc.call(\"account/refresh-ip\", {});\n if (!res.success) {\n throw new Error(res.error);\n }\n this.raffles.setValue(res.raffles);\n this.cashGames.setValue(res.cashMatches);\n }\n}\n","export var SpyreErrorCode;\n(function (SpyreErrorCode) {\n SpyreErrorCode[SpyreErrorCode[\"OK\"] = 0] = \"OK\";\n SpyreErrorCode[SpyreErrorCode[\"CANCELED\"] = 1] = \"CANCELED\";\n SpyreErrorCode[SpyreErrorCode[\"UNKNOWN\"] = 2] = \"UNKNOWN\";\n SpyreErrorCode[SpyreErrorCode[\"INVALID_ARGUMENT\"] = 3] = \"INVALID_ARGUMENT\";\n SpyreErrorCode[SpyreErrorCode[\"DEADLINE_EXCEEDED\"] = 4] = \"DEADLINE_EXCEEDED\";\n SpyreErrorCode[SpyreErrorCode[\"NOT_FOUND\"] = 5] = \"NOT_FOUND\";\n SpyreErrorCode[SpyreErrorCode[\"ALREADY_EXISTS\"] = 6] = \"ALREADY_EXISTS\";\n SpyreErrorCode[SpyreErrorCode[\"PERMISSION_DENIED\"] = 7] = \"PERMISSION_DENIED\";\n SpyreErrorCode[SpyreErrorCode[\"RESOURCE_EXHAUSTED\"] = 8] = \"RESOURCE_EXHAUSTED\";\n SpyreErrorCode[SpyreErrorCode[\"FAILED_PRECONDITION\"] = 9] = \"FAILED_PRECONDITION\";\n SpyreErrorCode[SpyreErrorCode[\"ABORTED\"] = 10] = \"ABORTED\";\n SpyreErrorCode[SpyreErrorCode[\"OUT_OF_RANGE\"] = 11] = \"OUT_OF_RANGE\";\n SpyreErrorCode[SpyreErrorCode[\"UNIMPLEMENTED\"] = 12] = \"UNIMPLEMENTED\";\n SpyreErrorCode[SpyreErrorCode[\"INTERNAL\"] = 13] = \"INTERNAL\";\n SpyreErrorCode[SpyreErrorCode[\"UNAVAILABLE\"] = 14] = \"UNAVAILABLE\";\n SpyreErrorCode[SpyreErrorCode[\"DATA_LOSS\"] = 15] = \"DATA_LOSS\";\n SpyreErrorCode[SpyreErrorCode[\"UNAUTHENTICATED\"] = 16] = \"UNAUTHENTICATED\";\n SpyreErrorCode[SpyreErrorCode[\"UNMARSHALLING\"] = 17] = \"UNMARSHALLING\";\n SpyreErrorCode[SpyreErrorCode[\"MARSHALLING\"] = 18] = \"MARSHALLING\";\n SpyreErrorCode[SpyreErrorCode[\"PLUGIN\"] = 100] = \"PLUGIN\";\n})(SpyreErrorCode || (SpyreErrorCode = {}));\n","import { SpyreErrorCode } from \"../../core/shared/errors\";\nimport { SpyreError } from \"../../core/shared/types\";\nexport class HistoryService {\n _rpc;\n constructor(_rpc) {\n this._rpc = _rpc;\n //\n }\n async find(criteria, cursor, count) {\n const response = await this._rpc.call(\"hangman/history/list\", { cursor, count, ...criteria });\n if (!response.success) {\n throw new SpyreError(SpyreErrorCode.INTERNAL, response.error);\n }\n return {\n cursor: response.nextCursor,\n matches: response.matches,\n };\n }\n async get(matchId) {\n const response = await this._rpc.call(\"hangman/history/match\", {\n matchId,\n });\n if (!response.success) {\n throw new SpyreError(SpyreErrorCode.INTERNAL, response.error);\n }\n return response.match;\n }\n}\n","import { childLogger } from \"../util/logger\";\nconst logger = childLogger(\"core:leaderboard\");\nexport class LeaderboardService {\n _rpc;\n constructor(_rpc) {\n this._rpc = _rpc;\n //\n }\n async list(ns, interval) {\n logger.debug(\"LeaderboardService.list(@Ns, @Interval)\", ns, interval);\n const res = await this._rpc.call(\"leaderboard/get\", {\n ns,\n interval,\n });\n if (!res.success) {\n throw new Error(res.error);\n }\n return {\n records: res.records,\n nextRewards: res.nextRewards,\n };\n }\n async winners(ns, interval) {\n logger.debug(\"LeaderboardService.winners(@Ns, @Interval)\", ns, interval);\n const res = await this._rpc.call(\"leaderboard/winners\", {\n ns,\n interval,\n });\n if (!res.success) {\n throw new Error(res.error);\n }\n return {\n records: res.records,\n };\n }\n}\n","import { Dispatcher } from \"../../core/shared/dispatcher\";\nimport { OpCodeInitClock } from \"./types\";\nimport { childLogger } from \"../../core/util/logger\";\nconst logger = childLogger(\"core:match-context\");\nexport class MatchContext {\n connection;\n match;\n _dispatcher = new Dispatcher();\n constructor(connection, clock, match) {\n this.connection = connection;\n this.match = match;\n this._dispatcher.addHandler(OpCodeInitClock, (message) => {\n const raw = new TextDecoder(\"utf-8\").decode(message);\n const { d } = JSON.parse(raw);\n clock.addLatencyMeasurement(d);\n });\n }\n get matchId() {\n return this.match.match_id;\n }\n addHandler(opCode, handler) {\n return this._dispatcher.addHandler(opCode, handler);\n }\n onMatchData(opCode, payload) {\n logger.debug(\"onMatchData(@OpCode)\", opCode);\n this._dispatcher.on(opCode, payload);\n }\n async send(opCode, payload) {\n const json = JSON.stringify(payload);\n try {\n await this.connection.sendMatchState(this.match.match_id, opCode, json);\n }\n catch (error) {\n //\n }\n }\n quit() {\n //\n }\n}\n","export const getMatchmakingBracketInfo = (info) => {\n const { nonce, expiry, amount, fee } = info;\n return {\n nonce,\n expiry: parseInt(expiry),\n amount: parseInt(amount),\n fee: parseInt(fee),\n };\n};\n","import { WatchedValue } from \"../../core/shared/types\";\nimport { childLogger } from \"../../core/util/logger\";\nimport { MatchContext } from \"./context\";\nimport { getMatchmakingBracketInfo } from \"./util\";\nconst logger = childLogger(\"core:multiplayer\");\nexport class MultiplayerService {\n rpc;\n web3;\n connection;\n matchmakingInfo = new WatchedValue(null);\n matchJoinIds = new WatchedValue([]);\n match = new WatchedValue(null);\n matchBracketDefId = new WatchedValue(null);\n bracketRefreshSecUTC = new WatchedValue(0);\n _context = null;\n _handler = null;\n _brackets = [];\n _dataQueue = [];\n clock = null;\n constructor(rpc, web3, connection) {\n this.rpc = rpc;\n this.web3 = web3;\n this.connection = connection;\n //\n }\n get brackets() {\n return this._brackets;\n }\n init = (clock) => {\n this.clock = clock;\n };\n onData = (opCode, data) => {\n if (this._context) {\n this._context.onMatchData(opCode, data);\n }\n else {\n this._dataQueue.push({ opCode, data });\n }\n };\n async refreshBrackets() {\n const res = await this.rpc.call(\"matchmaking/get-brackets\", { game: \"hangman\" });\n const { brackets, dictionaries, missingRequirements, refreshSecUTC } = res;\n this._brackets = brackets.map((b, i) => {\n const dict = dictionaries.find((d) => d.bracketId === b.id);\n const req = missingRequirements[i] || [];\n if (!dict) {\n return {\n ...b,\n dictIds: [],\n dictNames: [],\n missingRequirements: req,\n };\n }\n return {\n ...b,\n dictIds: dict.dictIds,\n dictNames: dict.dictNames,\n missingRequirements: req,\n };\n });\n this.bracketRefreshSecUTC.setValue(refreshSecUTC);\n }\n async findMatches(bracketId, params) {\n this.matchmakingInfo.setValue(null);\n this.matchJoinIds.setValue([]);\n this.match.setValue(null);\n this.matchBracketDefId.setValue(bracketId);\n const res = await this.rpc.call(\"hangman/matchmaking/find\", { ...params, bracketId });\n if (!res.success) {\n throw new Error(res.error);\n }\n const { matchmakingInfo, matchInfo } = res;\n // we might already be in a match!\n if (matchInfo) {\n const { creatorMatchId, opponentMatchIds, bracketDefId } = matchInfo;\n const ids = [];\n if (creatorMatchId && creatorMatchId.length > 0) {\n ids.push(creatorMatchId);\n }\n if (opponentMatchIds && opponentMatchIds.length > 0) {\n ids.push(...opponentMatchIds);\n }\n this.matchJoinIds.setValue(ids);\n this.matchBracketDefId.setValue(bracketDefId);\n }\n this.matchmakingInfo.setValue(matchmakingInfo);\n }\n async acceptAndJoin(factory, signals, params) {\n const { onSignStart, onSignComplete, onSignError, onAcceptStart, onAcceptComplete, onAcceptError, onJoinError, } = signals;\n const matchmakingInfo = this.matchmakingInfo.getValue();\n if (!matchmakingInfo) {\n throw new Error(\"No matchmaking info\");\n }\n // if we do not have any match join ids, we need to accept\n let matchJoinIds = this.matchJoinIds.getValue();\n logger.info(\"Accept and join, ids: @MatchJoinIds\", matchJoinIds.join(\", \"));\n if (matchJoinIds.length === 0) {\n let sig = undefined;\n if (matchmakingInfo.onChain) {\n const { nonce, expiry, amount, fee } = getMatchmakingBracketInfo(matchmakingInfo);\n // first, sign the stake\n if (onSignStart) {\n onSignStart();\n }\n try {\n sig = await this.web3.signStake({\n nonce,\n expiry,\n amount,\n fee,\n });\n }\n catch (error) {\n if (onSignError) {\n onSignError(error);\n }\n throw error;\n }\n if (onSignComplete) {\n onSignComplete(sig);\n }\n }\n // submit to backend\n if (onAcceptStart) {\n onAcceptStart();\n }\n let res;\n try {\n res = await this.rpc.call(\"hangman/matchmaking/accept\", {\n ...params,\n mmId: matchmakingInfo.mmId,\n signature: sig,\n });\n }\n catch (error) {\n if (onAcceptError) {\n onAcceptError(error);\n }\n throw error;\n }\n if (!res.success) {\n if (onAcceptError) {\n onAcceptError(new Error(res.error));\n }\n throw new Error(\"Failed to accept match\");\n }\n this.matchJoinIds.setValue(res.matchJoinIds);\n if (onAcceptComplete) {\n onAcceptComplete();\n }\n }\n // iterate through match join ids and try to join one\n matchJoinIds = this.matchJoinIds.getValue();\n for (const id of matchJoinIds) {\n try {\n await this.rejoin(id, { mmId: matchmakingInfo.mmId }, factory, signals);\n break;\n }\n catch (error) {\n logger.info(\"Couldn't join match @MatchId: \" + error, id);\n }\n }\n if (!this.match.getValue()) {\n if (onJoinError) {\n onJoinError(new Error(\"Failed to join match\"));\n }\n throw new Error(\"Failed to join match\");\n }\n }\n rejoin = async (matchId, meta, factory, { onJoinStart, onJoinComplete } = {}, retries = 3) => {\n if (onJoinStart) {\n onJoinStart();\n }\n this._handler = factory.instance();\n const match = await this.connection.join(matchId, meta, retries);\n this.match.setValue(match);\n if (onJoinComplete) {\n onJoinComplete();\n }\n this._context = new MatchContext(this.connection, this.clock, match);\n this._handler.joined(this._context);\n // process any queued data\n const queue = this._dataQueue.concat();\n this._dataQueue.length = 0;\n for (const { opCode, data } of queue) {\n this._context.onMatchData(opCode, data);\n }\n };\n leave() {\n return this.connection.leave();\n }\n send(opCode, payload, retries) {\n const match = this.match.getValue();\n if (!match) {\n throw new Error(\"No match\");\n }\n return this.connection.sendMatchState(match.match_id, opCode, payload, retries);\n }\n}\n","export const getBackoffMs = (retries) => {\n const min = 500;\n const base = 100;\n const max = 10000;\n const factor = 2;\n const backoff = Math.min(max, base * Math.pow(factor, retries));\n // add jitter\n return min + Math.random() * backoff;\n};\nexport const waitMs = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n","var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\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()).\n\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function 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 if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n return getRandomValues(rnds8);\n}","import validate from './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 */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function 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 //\n // Note to future-self: No, you can't remove the `toLowerCase()` call.\n // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351\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}\nfunction stringify(arr, offset = 0) {\n var uuid = unsafeStringify(arr, offset);\n // 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 if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n offset = offset || 0;\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;","import { SpyreErrorCode } from \"../../core/shared/errors\";\nimport { newCancelToken, SpyreError } from \"../../core/shared/types\";\nimport { childLogger } from \"../../core/util/logger\";\nimport { getBackoffMs, waitMs } from \"../../core/util/net\";\nimport { Client } from \"@heroiclabs/nakama-js\";\nimport { v4 } from \"uuid\";\nconst logger = childLogger(\"core:connection\");\nexport class ConnectionService {\n notifs;\n // set on construction\n _isSecure;\n _client;\n // set on connection\n _session = null;\n _socket = null;\n // set in connect\n _connectCancel = null;\n _connectPromise = null;\n // set in init\n _deviceId = null;\n // set in heartbeat\n _runtimeId = null;\n _lastHeartbeat = 0;\n // set in join\n _matchId = null;\n _matchMeta = null;\n // handles match data\n _matchDataHandler = null;\n // used in rpcWithRetry to dedupe requests\n _requestCache = {};\n get isConnected() {\n return !!this._socket;\n }\n get lastHeartbeat() {\n return this._lastHeartbeat;\n }\n constructor(notifs) {\n this.notifs = notifs;\n this._isSecure = process.env.NEXT_PUBLIC_NAKAMA_SSL_ENABLED === \"true\";\n this._client = new Client(process.env.NEXT_PUBLIC_NAKAMA_SERVER_KEY, process.env.NEXT_PUBLIC_NAKAMA_HOST, process.env.NEXT_PUBLIC_NAKAMA_PORT, this._isSecure, 3000, false);\n }\n setMatchDataHandler(handler) {\n this._matchDataHandler = handler;\n if (this._socket) {\n if (handler) {\n this._socket.onmatchdata = ({ op_code, data }) => handler.onData(op_code, data);\n }\n else {\n this._socket.onmatchdata = ({ op_code, data }) => logger.warn(\"Unhandled match data! @OpCode -> @Payload\", op_code, new TextDecoder().decode(data));\n }\n }\n }\n init(deviceId) {\n if (this._deviceId) {\n // safely return if already initialized with the same parameters\n if (this._deviceId === deviceId) {\n return;\n }\n throw new Error(`Already initialized, current deviceId '${this._deviceId}' != '${deviceId}'.`);\n }\n this._deviceId = deviceId;\n }\n // Connects to the server. This is safe to call at any time, as it will\n // only connect if not already connected.\n connect() {\n if (!this._deviceId) {\n throw new Error(\"Not initialized.\");\n }\n if (!this._connectPromise) {\n this._connectCancel = newCancelToken();\n this._connectPromise = this.connectWithRetries(this._connectCancel);\n }\n return this._connectPromise;\n }\n // Disconnects from the server.\n disconnect() {\n if (!this._deviceId) {\n throw new Error(\"Not initialized.\");\n }\n if (this._connectCancel) {\n this._connectCancel.cancel();\n this._connectCancel = null;\n }\n if (this._socket) {\n this._socket.disconnect(true);\n this._socket = null;\n }\n this._session = null;\n this._connectPromise = null;\n }\n // The RPC interface. This both deduplicates requests and auto-reconnects if\n // there is a connection failure.\n call(id, input) {\n const payload = JSON.stringify(input);\n const key = id + payload;\n let req = this._requestCache[key];\n if (!req) {\n const uuid = v4();\n logger.debug(\"Rpc start [@Uuid] --> @RPC\", uuid, id);\n req = this._requestCache[key] = this.rpcWithRetry(id, payload)\n .then((res) => {\n // deletes the cache entry\n delete this._requestCache[key];\n logger.debug(\"Rpc end [@Uuid] <-- @RPC: @Response\", uuid, id, res.payload);\n const payload = JSON.parse(res.payload || \"{}\");\n if (payload.error) {\n throw new SpyreError(SpyreErrorCode.INTERNAL, payload.error);\n }\n return {\n id: res.id,\n ...payload,\n };\n })\n .catch((error) => {\n logger.debug(\"Rpc error [@Uuid] <-- @RPC: @Error\", uuid, id, error);\n // deletes the cache entry-- note that this cannot go in onFinally as\n // this would break retry logic\n delete this._requestCache[key];\n throw error;\n });\n }\n return req;\n }\n // Joins a match with the given match ID and metadata. This should be used\n // rather than the socket directly, as it handles reconnects.\n async join(matchId, meta, retries) {\n if (!this._socket) {\n await waitMs(getBackoffMs(retries));\n await this.connect();\n return this.join(matchId, meta, retries + 1);\n }\n // add handler first\n this.setMatchDataHandler(this._matchDataHandler);\n let match;\n try {\n match = await this._socket.joinMatch(matchId, \"\", meta);\n }\n catch (error) {\n logger.debug(`Failed joinMatch for unhandled reason: @Error`, error);\n throw error;\n }\n this._matchId = matchId;\n this._matchMeta = meta;\n return match;\n }\n // Leaves the current match. This should be used when a match is complete\n // so that reconnects don't attempt to rejoin matches.\n async leave() {\n if (this._matchId) {\n try {\n await this._socket.leaveMatch(this._matchId);\n }\n catch (error) {\n logger.debug(`Failed leaveMatch for unhandled reason: @Error`, error);\n }\n }\n this._matchId = null;\n this._matchMeta = null;\n }\n // Sends a match state update. This should be used rather than the socket\n // directly, as it handles reconnects.\n async sendMatchState(matchId, opCode, payload, retries = 0) {\n if (retries > 5) {\n throw new Error(\"Too many retries.\");\n }\n // reconnect if necessary\n if (!this._socket) {\n await waitMs(getBackoffMs(retries));\n await this.connect();\n return this.sendMatchState(matchId, opCode, payload, retries + 1);\n }\n logger.debug(\"Sending match state @MatchId @OpCode @Payload\", matchId, opCode, payload);\n try {\n await this._socket.sendMatchState(matchId, opCode, payload);\n }\n catch (error) {\n if (error === \"Socket connection has not been established yet.\") {\n // reconnect and retry\n logger.debug(`Retrying failed sendMatchState (retry number @Retries) due to connection issue.`, retries);\n // todo: clear socket?\n return this.sendMatchState(matchId, opCode, payload, retries + 1);\n }\n else {\n logger.debug(`Failed sendMatchState for unhandled reason: @Error`, error);\n // unknown\n // TODO: SENTRY\n //Sentry.captureException(error);\n throw error;\n }\n }\n }\n async getApi(fn, retries = 0) {\n if (retries > 5) {\n throw new Error(\"Too many retries.\");\n }\n if (!this._session) {\n await waitMs(getBackoffMs(retries));\n await this.connect();\n return this.getApi(fn, retries + 1);\n }\n try {\n return await fn(this._client, this._session);\n }\n catch (error) {\n if (error === \"Socket connection has not been established yet.\") {\n // reconnect and retry\n logger.debug(`Retrying failed API request (retry number @Retries) due to connection issue.`, retries);\n // todo: clear session?\n return this.getApi(fn, retries + 1);\n }\n else {\n logger.debug(`Failed API request for unhandled reason: @Error`, error);\n // unknown\n //Sentry.captureException(error);\n // TODO: SENTRY\n throw error;\n }\n }\n }\n // Connects in a loop with exponential backoff. Doesn't quit until\n // the connection is established or the cancel token is cancelled.\n async connectWithRetries(cancelToken, retries = 0) {\n if (retries > 0) {\n const ms = getBackoffMs(retries);\n logger.info(\"Retrying connection in @Ms ms.\", ms);\n await waitMs(ms);\n }\n if (cancelToken.cancelled) {\n throw new Error(\"cancelled\");\n }\n let session;\n try {\n session = await this._client.authenticateDevice(this._deviceId, true);\n }\n catch (error) {\n logger.info(\"Failed to authenticate with device ID @DeviceId: @Error\", this._deviceId, error);\n return this.connectWithRetries(cancelToken, retries + 1);\n }\n if (cancelToken.cancelled) {\n throw new Error(\"cancelled\");\n }\n const socket = this._client.createSocket(this._isSecure);\n try {\n await socket.connect(session, true);\n }\n catch (error) {\n logger.info(\"Failed to connect: @Error\", error);\n return this.connectWithRetries(cancelToken, retries + 1);\n }\n if (cancelToken.cancelled) {\n socket.disconnect(false);\n throw new Error(\"cancelled\");\n }\n // set high -- though this doesn't appear to do anything\n socket.setHeartbeatTimeoutMs(30000);\n this.setMatchDataHandler(this._matchDataHandler);\n socket.onnotification = (message) => {\n this.notifs.on(message.code, {\n code: message.code,\n content: message.content,\n create_time: message.create_time,\n id: message.id,\n persistent: message.persistent,\n sender_id: message.sender_id,\n subject: message.subject,\n });\n };\n // save connection objects\n this._socket = socket;\n this._session = session;\n // kick-off heartbeat\n this.heartbeat(cancelToken);\n // check for active match\n if (this._matchId) {\n logger.debug(\"Rejoining match @MatchId.\", this._matchId);\n try {\n await this._socket.joinMatch(this._matchId, \"\", this._matchMeta);\n }\n catch (error) {\n if (error.code === 4) {\n // this is a match not found error, which means the match is no longer active\n logger.debug(\"Failed joinMatch on connect() for match not found! Redirecting user to match results.\");\n this._matchId = null;\n this._matchMeta = null;\n // TODO: WHAT DO WE DO HERE\n //window.location.href = `/results/${_matchId}`;\n }\n else {\n logger.debug(`Failed joinMatch on connect() for unhandled reason, progressing to connected: @Error`, error);\n }\n }\n }\n else {\n logger.debug(\"No active match to rejoin.\");\n }\n logger.info(\"Connected.\");\n }\n // Attempts to refresh the session. Returns true iff successful.\n async refreshSession() {\n let session;\n try {\n session = await this._client.sessionRefresh(this._session);\n }\n catch (error) {\n logger.error(\"Failed to refresh session: @Error\", error);\n return false;\n }\n this._session = session;\n return true;\n }\n // The heartbeat loop. This will refresh the session if it is about to expire\n // and ping the server every 5 seconds. If the runtime ID changes, it will\n // trigger a full refresh.\n async heartbeat(cancelToken) {\n while (!cancelToken.cancelled) {\n // first, wait\n await waitMs(1000);\n // check cancel\n if (cancelToken.cancelled) {\n // nothing is handling this, just return\n return;\n }\n // only heartbeat if we have a session\n if (this._session) {\n // check expiry (five minutes before expiry)\n const now = Date.now();\n if (this._session.isexpired(now / 1000 + 600)) {\n logger.debug(\"Session is going to expire!\");\n // Refresh the session. If it can't be refreshed, we need to\n // do a full disconnect/reconnect..\n const isRefreshed = await this.refreshSession();\n if (cancelToken.cancelled) {\n // nothing is handling this, just return\n return;\n }\n if (!isRefreshed) {\n this.disconnect();\n // ignore async nature, but catch errors\n this.connect().catch(() => { });\n }\n }\n else if (this._socket) {\n // ping with keep alive\n let res;\n try {\n res = await this._socket.rpc(\"heartbeat/ping\", \"{}\");\n }\n catch (error) {\n logger.debug(\"Heartbeat failed!\");\n if (cancelToken.cancelled) {\n // nothing is handling this, just return\n return;\n }\n this.disconnect();\n this.connect().catch(() => { });\n continue;\n }\n this._lastHeartbeat = Date.now();\n if (cancelToken.cancelled) {\n // nothing is handling this, just return\n return;\n }\n const { payload } = res;\n const { runtimeId } = JSON.parse(payload || \"{}\");\n if (this._runtimeId === null) {\n this._runtimeId = runtimeId;\n }\n else if (this._runtimeId !== runtimeId) {\n // full refresh\n logger.info(\"Runtime ID mismatch! Full refresh.\");\n window.location.reload();\n return;\n }\n }\n // wait here after successful heartbeat\n await waitMs(2000);\n }\n }\n }\n // Calls an RPC with retries.\n async rpcWithRetry(id, payload, retries = 0) {\n if (retries > 5) {\n throw new Error(\"Too many retries.\");\n }\n if (!this._socket) {\n await this.connect();\n await waitMs(getBackoffMs(retries));\n return await this.rpcWithRetry(id, payload, retries + 1);\n }\n let res;\n try {\n res = await this._socket.rpc(id, payload);\n }\n catch (error) {\n if (error === \"Socket connection has not been established yet.\" ||\n error === \"The socket timed out while waiting for a response.\" ||\n error.status === 401) {\n logger.debug(`Retrying failed RPC '@Rpc' (retry number @Retries) due to connection issue.`, id, retries);\n // wait + retry\n await waitMs(getBackoffMs(retries));\n return await this.rpcWithRetry(id, payload, retries + 1);\n }\n else {\n // unknown\n // TODO: SENTRY\n //Sentry.captureException(error);\n }\n throw error;\n }\n return res;\n }\n}\n","import { Dispatcher } from \"../../core/shared/dispatcher\";\nexport class NotificationService extends Dispatcher {\n nakama = null;\n // TODO: fix circular dependency\n init(nakama) {\n this.nakama = nakama;\n }\n async list(count) {\n if (!this.nakama) {\n throw new Error(\"NotificationService not initialized\");\n }\n return this.nakama.getApi(async (client, session) => {\n const res = await client.listNotifications(session, count);\n return res.notifications || [];\n }, 3);\n }\n async delete(ids) {\n if (!this.nakama) {\n throw new Error(\"NotificationService not initialized\");\n }\n return this.nakama.getApi(async (client, session) => {\n await client.deleteNotifications(session, ids);\n }, 3);\n }\n}\n","import { asyncOps } from \"../../core/util/async\";\nexport class VaultService {\n _rpc;\n _status = asyncOps.new();\n _vaults = [];\n constructor(_rpc) {\n this._rpc = _rpc;\n //\n }\n get status() {\n return this._status;\n }\n get vaults() {\n return this._vaults;\n }\n async refresh() {\n this._status = asyncOps.inProgress();\n try {\n const res = await this._rpc.call(\"vaults/get\", {});\n this._vaults = res.vaults;\n }\n catch (error) {\n this._status = asyncOps.failure(error);\n return;\n }\n this._status = asyncOps.success();\n }\n isFull(vault) {\n if (!vault) {\n return true;\n }\n return this.getValue(vault) >= vault.maxCapacity;\n }\n getValue(vault) {\n if (!vault) {\n return 0;\n }\n const { type, startedAt, startingValue, parameters, maxCapacity, isEnabled } = vault;\n if (!isEnabled) {\n return 0;\n }\n const time = Date.now();\n const deltaMillis = time - startedAt;\n if (deltaMillis < 0) {\n return 0;\n }\n switch (type) {\n case \"linear\": {\n // requires a parameter for the rate of change\n if (parameters.length != 1) {\n return 0;\n }\n // calculate\n const m = parameters[0];\n if (m <= 0) {\n return 0;\n }\n const deltaHours = deltaMillis / 1000 / 60 / 60;\n const val = Math.max(0, Math.min(m * deltaHours + startingValue, maxCapacity));\n return Math.floor(val);\n }\n default: {\n return 0;\n }\n }\n }\n async collect(vault) {\n this._status = asyncOps.inProgress();\n let res;\n try {\n res = await this._rpc.call(\"vaults/collect\", {\n name: vault.name,\n });\n }\n catch (error) {\n this._status = asyncOps.failure(error);\n return;\n }\n const updatedVault = res.vault;\n const index = this._vaults.findIndex((v) => v.name === updatedVault.name);\n if (index !== -1) {\n this._vaults[index] = updatedVault;\n }\n this._status = asyncOps.success();\n }\n}\n","export var SigningErrorType;\n(function (SigningErrorType) {\n SigningErrorType[SigningErrorType[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n SigningErrorType[SigningErrorType[\"USER_CANCELED\"] = 4001] = \"USER_CANCELED\";\n SigningErrorType[SigningErrorType[\"WRONG_CHAIN\"] = -32603] = \"WRONG_CHAIN\";\n})(SigningErrorType || (SigningErrorType = {}));\nexport class SigningError extends Error {\n type;\n constructor(type, message = \"Could not sign data.\") {\n super(message);\n this.type = type;\n }\n}\nexport var TxnStatus;\n(function (TxnStatus) {\n TxnStatus[\"NotStarted\"] = \"not-started\";\n TxnStatus[\"Sent\"] = \"sent\";\n TxnStatus[\"WaitingForConfirmation\"] = \"waiting-for-confirmation\";\n TxnStatus[\"Confirmed\"] = \"success\";\n TxnStatus[\"Failed\"] = \"failure\";\n})(TxnStatus || (TxnStatus = {}));\nexport class Txn {\n id;\n ns;\n _status = TxnStatus.NotStarted;\n _hash = \"\";\n _error = \"\";\n constructor(id, \n // todo: this is obviously not right\n ns) {\n this.id = id;\n this.ns = ns;\n this._status = TxnStatus.Sent;\n }\n get status() {\n return this._status;\n }\n get hash() {\n return this._hash;\n }\n get error() {\n return this._error;\n }\n get isConfirmed() {\n return this._status === TxnStatus.Confirmed;\n }\n sent() {\n this._status = TxnStatus.Sent;\n }\n waiting() {\n this._status = TxnStatus.WaitingForConfirmation;\n }\n confirm(hash) {\n this._status = TxnStatus.Confirmed;\n this._hash = hash;\n }\n fail(error) {\n this._status = TxnStatus.Failed;\n this._error = error;\n }\n onResolve(cb) {\n // TODO\n }\n}\n","const weiPer = BigInt(\"1000000\");\nexport const fromWei = (wad, decimals = 6) => {\n if (!wad) {\n return 0n;\n }\n return wad / 10n ** BigInt(decimals);\n};\nexport const toWei = (wad) => {\n if (wad === 0n) {\n return BigInt(0);\n }\n // get the decimal out\n const str = wad.toString();\n const decimalIndex = str.indexOf(\".\");\n if (decimalIndex === -1) {\n return BigInt(wad) * weiPer;\n }\n const tens = Math.max(0, 6 - (str.length - 1 - decimalIndex));\n const val = str.replace(\".\", \"\");\n const weiMultiplier = BigInt(10) ** BigInt(tens);\n return BigInt(val) * weiMultiplier;\n};\nexport const bigIntToString = (value) => {\n return `0x${value.toString(16)}`;\n};\n","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;","import REGEX from './regex.js';\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\nexport default validate;","import { v4, validate } from \"uuid\";\n/**\n * Retrieves the device ID from local storage. A device ID is a unique GUID that is stored in local storage. If one does not exist, a new one is generated.\n */\nexport const getDeviceId = () => {\n let id = localStorage.getItem(\"deviceId\");\n if (!id || !validate(id)) {\n id = v4();\n localStorage.setItem(\"deviceId\", id);\n }\n return id;\n};\n","import { getDeviceId } from \"./util\";\nexport class SpyreClient {\n account;\n notifications;\n connection;\n web3;\n multiplayer;\n rpc;\n leaderboards;\n history;\n vaults;\n clock;\n compliance;\n constructor(account, notifications, connection, web3, multiplayer, rpc, leaderboards, history, vaults, clock, compliance) {\n this.account = account;\n this.notifications = notifications;\n this.connection = connection;\n this.web3 = web3;\n this.multiplayer = multiplayer;\n this.rpc = rpc;\n this.leaderboards = leaderboards;\n this.history = history;\n this.vaults = vaults;\n this.clock = clock;\n this.compliance = compliance;\n //\n }\n async initialize() {\n this.connection.init(getDeviceId());\n await this.connection.connect();\n await this.account.refresh();\n }\n}\n","import { createContext } from \"react\";\nexport const SpyreClientCtx = createContext(undefined);\n","import { useContext, useSyncExternalStore } from \"react\";\nimport { getDeviceId } from \"../../core/util\";\nimport { SpyreClientCtx } from \"../../react/client-provider\";\n/**\n * Returns the current {@link ISpyreClient} implementaion.\n *\n * ```ts\n * const client = useClient();\n * await client.account.refresh();\n * ```\n */\nexport const useClient = () => {\n const context = useContext(SpyreClientCtx);\n if (!context) {\n throw new Error(\"useClient must be used within a SpyreClientProvider.\");\n }\n /*\n const queryClient = useQueryClient();\n const invalidateMatches = useCallback(() => {\n // Invalidate match + matches query\n }, [context, queryClient]);\n //useNotifHandler(NotificationCodes.BlockchainStakeStatus, invalidateMatches);\n */\n return context;\n};\n/**\n * Returns the current device ID. A device ID is a unique GUID that is stored in local storage.\n *\n * ```ts\n * const deviceId = useDeviceId();\n *\n * console.log(\"My device ID is:\", deviceId);\n * ```\n */\nexport const useDeviceId = () => {\n return useSyncExternalStore(\n // never changes\n (_) => () => { }, getDeviceId, \n // client only\n () => null);\n};\n","import { useClient } from \"./use-client\";\nexport const useMultiplayerService = () => useClient().multiplayer;\nexport const useLeaderboardService = () => useClient().leaderboards;\n","// src/mutationObserver.ts\nimport { getDefaultState } from \"./mutation.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { hashKey, shallowEqualObjects } from \"./utils.js\";\nvar MutationObserver = class extends Subscribable {\n #client;\n #currentResult = void 0;\n #currentMutation;\n #mutateOptions;\n constructor(client, options) {\n super();\n this.#client = client;\n this.setOptions(options);\n this.bindMethods();\n this.#updateResult();\n }\n bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n }\n setOptions(options) {\n const prevOptions = this.options;\n this.options = this.#client.defaultMutationOptions(options);\n if (!shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getMutationCache().notify({\n type: \"observerOptionsUpdated\",\n mutation: this.#currentMutation,\n observer: this\n });\n }\n if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {\n this.reset();\n } else if (this.#currentMutation?.state.status === \"pending\") {\n this.#currentMutation.setOptions(this.options);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#currentMutation?.removeObserver(this);\n }\n }\n onMutationUpdate(action) {\n this.#updateResult();\n this.#notify(action);\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n reset() {\n this.#currentMutation?.removeObserver(this);\n this.#currentMutation = void 0;\n this.#updateResult();\n this.#notify();\n }\n mutate(variables, options) {\n this.#mutateOptions = options;\n this.#currentMutation?.removeObserver(this);\n this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n this.#currentMutation.addObserver(this);\n return this.#currentMutation.execute(variables);\n }\n #updateResult() {\n const state = this.#currentMutation?.state ?? getDefaultState();\n this.#currentResult = {\n ...state,\n isPending: state.status === \"pending\",\n isSuccess: state.status === \"success\",\n isError: state.status === \"error\",\n isIdle: state.status === \"idle\",\n mutate: this.mutate,\n reset: this.reset\n };\n }\n #notify(action) {\n notifyManager.batch(() => {\n if (this.#mutateOptions && this.hasListeners()) {\n const variables = this.#currentResult.variables;\n const context = this.#currentResult.context;\n if (action?.type === \"success\") {\n this.#mutateOptions.onSuccess?.(action.data, variables, context);\n this.#mutateOptions.onSettled?.(action.data, null, variables, context);\n } else if (action?.type === \"error\") {\n this.#mutateOptions.onError?.(action.error, variables, context);\n this.#mutateOptions.onSettled?.(\n void 0,\n action.error,\n variables,\n context\n );\n }\n }\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n });\n }\n};\nexport {\n MutationObserver\n};\n//# sourceMappingURL=mutationObserver.js.map","'use client'\nimport * as React from 'react'\nimport { MutationObserver, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { noop, shouldThrowError } from './utils'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n>(\n options: UseMutationOptions,\n queryClient?: QueryClient,\n): UseMutationResult {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver(\n client,\n options,\n ),\n )\n\n React.useEffect(() => {\n observer.setOptions(options)\n }, [observer, options])\n\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n const mutate = React.useCallback<\n UseMutateFunction\n >(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n },\n [observer],\n )\n\n if (\n result.error &&\n shouldThrowError(observer.options.throwOnError, [result.error])\n ) {\n throw result.error\n }\n\n return { ...result, mutate, mutateAsync: result.mutate }\n}\n","import { useCallback } from \"react\";\nimport { useClient } from \"./use-client\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\n/**\n * Returns a Tanstack [`useQuery`](https://tanstack.com/query/latest/docs/framework/react/guides/queries) object for fetching the current user's {@link User | Account}.\n *\n * ```\n * const { isPending, data: user } = useAccount();\n * ```\n */\nexport const useAccount = () => {\n const account = useClient().account;\n const query = useCallback(async () => {\n await account.refresh();\n return account.user;\n }, [account]);\n return useQuery({\n queryKey: [\"account\"],\n queryFn: query,\n });\n};\n/**\n * Returns a Tanstack [`useMutation`](https://tanstack.com/query/latest/docs/framework/react/guides/mutations) object for re-fetching the current user's {@link User | Account}.\n *\n * ```\n * const { isPending, data: user } = useAccount();\n * const { mutate } = useAccountRefresh();\n *\n * ...\n *\n * useEffect(() => {\n * mutate();\n * }, [foo, bar]);\n *\n * ```\n */\nexport const useAccountRefresh = () => {\n const queryClient = useQueryClient();\n return useCallback(() => queryClient.invalidateQueries({ queryKey: [\"account\"] }), [queryClient]);\n};\n/**\n * Returns a Tanstack [`useMutation`](https://tanstack.com/query/latest/docs/framework/react/guides/mutations) object for updating the current user's {@link User | Account} information.\n */\nexport const useAccountUpdate = () => {\n const client = useClient();\n const queryClient = useQueryClient();\n const query = useCallback(async (user) => {\n await client.account.update(user);\n await queryClient.invalidateQueries({ queryKey: [\"account\"] });\n }, [client]);\n return useMutation({\n mutationFn: query,\n });\n};\n/**\n * Returns a Tanstack [`useMutation`](https://tanstack.com/query/latest/docs/framework/react/guides/mutations) object for updating the current user's username.\n *\n */\nexport const useAccountUpdateUsername = () => {\n const client = useClient();\n const queryClient = useQueryClient();\n const query = useCallback(async (username) => {\n const current = client.account.user;\n await client.account.update({ ...current, username });\n await queryClient.invalidateQueries({ queryKey: [\"account\"] });\n }, [client]);\n return useMutation({\n mutationFn: query,\n });\n};\n","import { useSyncExternalStore } from \"react\";\nimport { useClient } from \"./use-client\";\nexport const useClockOffsetMillis = () => {\n const client = useClient();\n return useSyncExternalStore(client.clock.offsetMillis.watch, client.clock.offsetMillis.getValue, client.clock.offsetMillis.getValue);\n};\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useClient } from \"./use-client.js\";\nimport { useCallback, useSyncExternalStore } from \"react\";\nexport const useComplianceRefresh = (feature) => {\n const { compliance } = useClient();\n return useQuery({\n queryKey: [\"compliance\"],\n queryFn: async () => {\n await compliance.refresh();\n if (feature === \"raffles\") {\n return compliance.raffles.getValue();\n }\n return compliance.cashGames.getValue();\n },\n });\n};\nexport const useComplianceRaffles = () => {\n const { compliance } = useClient();\n return useSyncExternalStore(compliance.raffles.watch, compliance.raffles.getValue, compliance.raffles.getValue);\n};\nexport const useComplianceCashGames = () => {\n const { compliance } = useClient();\n return useSyncExternalStore(compliance.cashGames.watch, compliance.cashGames.getValue, compliance.cashGames.getValue);\n};\nexport const useComplianceUpdateBirthday = () => {\n const { compliance } = useClient();\n const client = useQueryClient();\n const fn = useCallback(async ({ year, month, day }) => {\n await compliance.updateBirthday(year, month, day);\n await client.invalidateQueries({\n queryKey: [\"compliance\"],\n });\n }, [client, compliance]);\n return useMutation({\n mutationKey: [\"compliance\", \"update-birthday\"],\n mutationFn: fn,\n });\n};\nexport const useComplianceUpdateLocation = (feature) => {\n const { compliance } = useClient();\n const client = useQueryClient();\n const fn = useCallback(async () => {\n await compliance.updateLocation();\n await client.invalidateQueries({\n queryKey: [\"compliance\"],\n });\n if (feature === \"raffles\") {\n return compliance.raffles.getValue();\n }\n return compliance.cashGames.getValue();\n }, [client, compliance, feature]);\n return useMutation({\n mutationKey: [\"compliance\", \"refresh-ip\"],\n mutationFn: fn,\n });\n};\n","import { useClient } from \"./use-client\";\nexport const useConnectionService = () => useClient().connection;\nexport const useIsConnected = () => {\n const client = useClient();\n return client.connection.isConnected;\n};\n","import { useCallback, useMemo } from \"react\";\nimport { useAccount } from \"./use-account\";\nimport { useClient } from \"./use-client\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nexport const useDiscordConnectionStatus = () => {\n const { isPending, data: account } = useAccount();\n const metadata = useMemo(() => JSON.parse(account?.metadata || \"{}\"), [account]);\n if (isPending) {\n return \"connecting\";\n }\n return metadata.discordUserId ? \"connected\" : \"disconnected\";\n};\nexport const useDiscordUserId = () => {\n const { data: account } = useAccount();\n const metadata = useMemo(() => JSON.parse(account?.metadata || \"{}\"), [account]);\n return metadata.discordUserId;\n};\nexport const useDiscordUsername = () => {\n const { data: account } = useAccount();\n const metadata = useMemo(() => JSON.parse(account?.metadata || \"{}\"), [account]);\n return metadata.discordUserName;\n};\nexport const useDiscordUnlink = () => {\n const { rpc } = useClient();\n const client = useQueryClient();\n const fn = useCallback(async () => {\n await rpc.call(\"auth/discord/unlink\", {});\n await client.invalidateQueries({\n queryKey: [\"account\"],\n });\n }, [rpc]);\n return useMutation({\n mutationKey: [\"discord\", \"unlink\"],\n mutationFn: fn,\n });\n};\nexport const useDiscordIsGuildMember = () => {\n const { data: account } = useAccount();\n const metadata = useMemo(() => JSON.parse(account?.metadata || \"{}\"), [account]);\n return metadata.discordGuildIsMember === true;\n};\n","import { useCallback } from \"react\";\nimport { useClient } from \"./use-client\";\nimport { useMutation } from \"@tanstack/react-query\";\nexport const useRpcCall = (id) => {\n const client = useClient();\n const fn = useCallback(async (input) => {\n return await client.rpc.call(id, input);\n }, [client, id]);\n return useMutation({\n mutationFn: fn,\n mutationKey: [id],\n });\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useRpcCall } from \"./use-rpc\";\nexport const useElo = (ns, cohort) => {\n const rpc = useRpcCall(\"elo/get-rating\");\n return useQuery({\n queryKey: [\"elo\", ns, cohort],\n queryFn: async () => {\n const res = (await rpc.mutateAsync({ ns, cohort }));\n if (!res.success) {\n throw new Error(res.error);\n }\n return res.rating;\n },\n });\n};\nexport const useEloHistory = (ns, cohort) => {\n const rpc = useRpcCall(\"elo/get-rating-history\");\n return useQuery({\n queryKey: [\"elo\", \"history\", ns, cohort],\n queryFn: async () => {\n const res = (await rpc.mutateAsync({ ns, cohort }));\n if (!res.success) {\n throw new Error(res.error);\n }\n return res.ratings;\n },\n });\n};\n","import { useClient } from \"./use-client\";\nimport { useQuery } from \"@tanstack/react-query\";\n/**\n * Returns a Tanstack [`useQuery`](https://tanstack.com/query/latest/docs/framework/react/guides/queries) object for fetching a user's game history, given the {@link HistorySearchCriteria}.\n *\n * ```ts\n * const { isPending, data: matches } = useHistoryFind();\n * ```\n *\n * @param criteria (optional) - The search criteria to filter the history.\n * @param cursor (optional) - The cursor for pagination.\n * @param count (optional) - The number of items to return.\n */\nexport const useHistoryFind = (criteria, cursor, count) => {\n const history = useClient().history;\n return useQuery({\n queryKey: [\"history\", \"find\", criteria, cursor, count],\n queryFn: async () => await history.find(criteria, cursor, count),\n });\n};\n/**\n * Returns a Tanstack [`useQuery`](https://tanstack.com/query/latest/docs/framework/react/guides/queries) object for fetching a specific match by its ID.\n *\n * ```ts\n * const { isPending, data: match } = useHistoryGet(\"1234\");\n * ```\n *\n * @param matchId - The ID of the match.\n */\nexport const useHistoryGet = (matchId) => {\n const history = useClient().history;\n return useQuery({\n queryKey: [\"history\", \"get\", matchId],\n queryFn: async () => await history.get(matchId),\n });\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useClient } from \"./use-client\";\nexport const useLbGet = (ns, interval) => {\n const client = useClient();\n return useQuery({\n queryKey: [\"leaderboard-get\", ns, interval],\n queryFn: async () => await client.leaderboards.list(ns, interval),\n });\n};\nexport const useLbWinners = (ns, interval) => {\n const client = useClient();\n return useQuery({\n queryKey: [\"leaderboard-winners\", ns, interval],\n queryFn: async () => await client.leaderboards.winners(ns, interval),\n });\n};\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback, useSyncExternalStore } from \"react\";\nimport { useClient } from \"./use-client\";\nexport const useMpBrackets = () => {\n const client = useQueryClient();\n const mp = useClient().multiplayer;\n const fn = useCallback(async () => {\n await mp.refreshBrackets();\n const refreshSecUTC = mp.bracketRefreshSecUTC.getValue();\n const currentSecUTC = Date.now() / 1000;\n // set a timeout to invalidate\n setTimeout(() => client.invalidateQueries({ queryKey: [\"brackets\"] }), Math.max(1000, (refreshSecUTC - currentSecUTC) * 1000));\n return mp.brackets;\n }, [mp]);\n return useQuery({\n queryKey: [\"brackets\"],\n queryFn: fn,\n refetchOnWindowFocus: \"always\",\n });\n};\nexport const useMpBracketRefreshSecUTC = () => {\n const mp = useClient().multiplayer;\n return useSyncExternalStore(mp.bracketRefreshSecUTC.watch, mp.bracketRefreshSecUTC.getValue, mp.bracketRefreshSecUTC.getValue);\n};\nexport const useMpBracket = (id) => {\n const mp = useClient().multiplayer;\n const brackets = useMpBrackets();\n const fn = useCallback(async () => {\n const data = brackets.data?.find((b) => b.id === id);\n if (!data) {\n throw new Error(`Bracket ${id} not found`);\n }\n return data;\n }, [mp, brackets]);\n return useQuery({\n queryKey: [\"brackets\", id],\n queryFn: fn,\n enabled: brackets.isSuccess,\n });\n};\nexport const useMpMatchmakingFind = (bracketId, params) => {\n const mp = useClient().multiplayer;\n const fn = useCallback(async () => {\n await mp.findMatches(bracketId, params);\n return mp.matchmakingInfo.getValue();\n }, [mp, bracketId, params]);\n return useQuery({\n queryKey: [\"matchmaking\", \"find\", bracketId],\n queryFn: fn,\n retry: false,\n });\n};\nexport const useMpMatchmakingAcceptAndJoin = () => {\n const mp = useClient().multiplayer;\n const fn = useCallback(async ({ factory, signals, ...params }) => await mp.acceptAndJoin(factory, signals, params), [mp]);\n return useMutation({\n mutationKey: [\"matchmaking\", \"accept-and-join\"],\n mutationFn: fn,\n });\n};\nexport const useMpMatchmakingInfo = () => {\n const mp = useClient().multiplayer;\n return useSyncExternalStore(mp.matchmakingInfo.watch, mp.matchmakingInfo.getValue, mp.matchmakingInfo.getValue);\n};\nexport const useMpMatchmakingJoinIds = () => {\n const mp = useClient().multiplayer;\n return useSyncExternalStore(mp.matchJoinIds.watch, mp.matchJoinIds.getValue, mp.matchJoinIds.getValue);\n};\nexport const useMpMatchId = () => {\n const mp = useClient().multiplayer;\n const get = useCallback(() => {\n const match = mp.match.getValue();\n if (!match) {\n return null;\n }\n const { match_id } = match;\n return match_id;\n }, [mp]);\n return useSyncExternalStore(mp.match.watch, get, get);\n};\nexport const useMpMatchBracketDefId = () => {\n const mp = useClient().multiplayer;\n return useSyncExternalStore(mp.matchBracketDefId.watch, mp.matchBracketDefId.getValue, mp.matchBracketDefId.getValue);\n};\nexport const useMpSend = () => {\n const mp = useClient().multiplayer;\n return useCallback((opCode, payload, retries = 1) => mp.send(opCode, payload, retries), [mp]);\n};\n","import { useClient } from \"./use-client\";\nimport { useEffect } from \"react\";\n/**\n * Subscribes a handler to a type of notification.\n *\n * @param code The notification code.\n * @param fn The function to subscribe.\n */\nexport const useNotifHandler = (code, fn) => {\n const notifs = useClient().notifications;\n useEffect(() => notifs.addHandler(code, fn), [notifs, code, fn]);\n};\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport { useClient } from \"./use-client\";\nexport const useRaffles = (ns) => {\n const client = useClient();\n const fn = useCallback(async () => {\n const res = await client.rpc.call(\"raffle/get\", { ns });\n if (!res.success) {\n throw new Error(res.error);\n }\n return {\n raffles: res.raffles,\n winners: res.winners,\n entries: res.entries,\n totals: res.totals,\n };\n }, [client, ns]);\n return useQuery({\n queryKey: [\"raffles\", ns],\n queryFn: fn,\n });\n};\nexport const useRaffleSubmit = (ns) => {\n const client = useClient();\n const queryClient = useQueryClient();\n const fn = useCallback(async ({ raffleId, numTickets }) => {\n const res = await client.rpc.call(\"raffle/register\", {\n raffleId,\n numTickets,\n });\n if (!res.success) {\n throw new Error(res.error);\n }\n await queryClient.invalidateQueries({\n queryKey: [\"account\"],\n });\n return res.tickets;\n }, [queryClient, client]);\n return useMutation({\n mutationKey: [\"raffles\", ns, \"submit\"],\n mutationFn: fn,\n });\n};\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useClient } from \"./use-client\";\nimport { useCallback } from \"react\";\nexport const useVault = (name) => {\n const vaults = useClient().vaults;\n const query = useCallback(async () => {\n await vaults.refresh();\n const vault = vaults.vaults.find((v) => v.name === name);\n return { vault, value: vault ? vaults.getValue(vault) : 0 };\n }, [vaults]);\n return useQuery({\n queryKey: [\"vault\", name],\n queryFn: query,\n });\n};\nexport const useVaultCollect = (name) => {\n const client = useClient();\n const queryClient = useQueryClient();\n const vault = client.vaults.vaults.find((v) => v.name === name);\n const fn = useCallback(async () => {\n if (!vault) {\n throw new Error(\"Vault not found\");\n }\n await client.vaults.collect(vault);\n // invalidate\n await queryClient.invalidateQueries({ queryKey: [\"vault\", name] });\n await queryClient.invalidateQueries({ queryKey: [\"account\"] });\n return vault;\n }, [client.vaults, vault]);\n return useMutation({\n mutationFn: fn,\n });\n};\n","\"use client\";\nimport { useAccount } from \"./use-account\";\nimport { useClient } from \"./use-client\";\nimport { useCallback, useSyncExternalStore } from \"react\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { childLogger } from \"../../core/util/logger\";\nconst logger = childLogger(\"core:hooks:use-web3\");\n/**\n * Retrieves the current {@link Web3Config} object from the {@link IWeb3Service}.\n *\n * ```ts\n * const config = useWeb3Config();\n *\n * console.log(\"Current chain:\", config.network.id);\n * ```\n */\nexport const useWeb3Config = () => {\n const web3 = useClient().web3;\n return web3.config;\n};\nexport const useWeb3ConnectionStatus = () => {\n const web3 = useClient().web3;\n return useSyncExternalStore(web3.status.watch, web3.status.getValue, web3.status.getValue);\n};\nexport const useWeb3IsWalletConnected = () => {\n const status = useWeb3ConnectionStatus();\n return status === \"connected\";\n};\nexport const useWeb3IsWalletConnectedAndLinked = () => {\n const status = useWeb3ConnectionStatus();\n const connectedAddress = useWeb3ActiveAddress();\n const { data: account } = useAccount();\n return (status === \"connected\" &&\n connectedAddress &&\n account &&\n connectedAddress === account.walletAddr);\n};\nexport const useWeb3ActiveAddress = () => {\n const address = useClient().web3.activeAddress;\n return useSyncExternalStore(address.watch, address.getValue, address.getValue);\n};\nexport const useWeb3LinkedAddress = () => {\n const address = useClient().web3.linkedAddress;\n return useSyncExternalStore(address.watch, address.getValue, address.getValue);\n};\nexport const useWeb3StakingBalance = () => {\n const web3 = useClient().web3;\n const addr = web3.linkedAddress.getValue();\n const balance = web3.stakingBalance;\n const query = useCallback(async () => {\n await balance.refresh();\n return balance.value.getValue();\n }, [balance]);\n return useQuery({\n queryKey: [\"balance\", \"staking\", addr],\n queryFn: query,\n });\n};\nexport const useWeb3UsdcBalance = () => {\n const web3 = useClient().web3;\n const addr = web3.linkedAddress.getValue();\n const balance = web3.usdcBalance;\n const query = useCallback(async () => {\n logger.debug(\"Refreshing balances.\");\n await balance.refresh();\n logger.debug(\"Balances refreshed: @Value\", balance.value.getValue());\n return balance.value.getValue();\n }, [balance]);\n return useQuery({\n queryKey: [\"balance\", \"usdc\", addr],\n queryFn: query,\n });\n};\nexport const useWeb3UsdcPermitAmount = () => {\n const web3 = useClient().web3;\n const addr = web3.linkedAddress.getValue();\n const amount = web3.usdcPermitAmount;\n const query = useCallback(async () => {\n logger.debug(\"Refreshing permit amount.\");\n await amount.refresh();\n logger.debug(\"Permit amount refreshed: @Value\", amount.value.getValue());\n return amount.value.getValue();\n }, [amount]);\n return useQuery({\n queryKey: [\"web3\", \"usdc\", \"permit\", addr],\n queryFn: query,\n });\n};\nexport const useWeb3RefreshBalances = () => {\n const web3 = useClient().web3;\n const queryClient = useQueryClient();\n return useCallback(async () => {\n // invalidate\n queryClient.invalidateQueries({\n queryKey: [\"balance\"],\n });\n await Promise.all([\n web3.stakingBalance.refresh(),\n web3.usdcBalance.refresh(),\n ]);\n }, [web3.stakingBalance, web3.usdcBalance]);\n};\nexport const useWeb3NeedsSwitchChain = () => {\n const web3 = useClient().web3;\n return useSyncExternalStore(web3.needsToSwitchChains.watch, web3.needsToSwitchChains.getValue, web3.needsToSwitchChains.getValue);\n};\nexport const useWeb3IsInAppWallet = () => {\n const web3 = useClient().web3;\n return useSyncExternalStore(web3.isInAppWallet.watch, web3.isInAppWallet.getValue, web3.isInAppWallet.getValue);\n};\nexport const useWeb3Link = () => {\n const web3 = useClient().web3;\n const fn = useCallback(async () => await web3.link(), [web3]);\n return useMutation({\n mutationFn: fn,\n });\n};\nexport const useWeb3SwitchChain = () => {\n const web3 = useClient().web3;\n return web3.switchChain;\n};\nexport const useWeb3ApproveAndWatch = (ns) => {\n const web3 = useClient().web3;\n const addr = web3.linkedAddress.getValue();\n const queryClient = useQueryClient();\n const mutationFn = useCallback(async (wad) => {\n const txn = await web3.approve(ns, wad);\n // after txn resolves, invalidate the allowance\n txn.onResolve(() => queryClient.invalidateQueries({\n queryKey: [\"allowance\", addr],\n }));\n await web3.watch(txn);\n return txn;\n }, [web3, addr]);\n return useMutation({\n mutationFn,\n });\n};\nexport const useWeb3DepositAndWatch = (ns) => {\n const web3 = useClient().web3;\n const addr = web3.linkedAddress.getValue();\n const queryClient = useQueryClient();\n const mutationFn = useCallback(async (wad) => {\n const txn = await web3.deposit(ns, wad);\n // after txn resolves, invalidate the balances\n txn.onResolve(() => queryClient.invalidateQueries({\n queryKey: [\"balance\"],\n }));\n await web3.watch(txn);\n return txn;\n }, [web3, addr]);\n return useMutation({\n mutationFn,\n });\n};\nexport const useWeb3WatchTxn = () => {\n const web3 = useClient().web3;\n const fn = useCallback(async (txn) => await web3.watch(txn), [web3]);\n return useMutation({\n mutationFn: fn,\n mutationKey: [\"web3\", \"watch\"],\n });\n};\nexport const useWeb3Sign = () => {\n const web3 = useClient().web3;\n const mutationFn = useCallback(async (signParams) => {\n return await web3.signStake(signParams);\n }, [web3]);\n return useMutation({\n mutationFn,\n });\n};\n","////////////////////////////////////////////////////////////////////////// core\nexport { AccountService } from \"./core/account/service\";\nexport { ClockService } from \"./core/clock/service\";\nexport { ComplianceService } from \"./core/compliance/service\";\nexport { HistoryService } from \"./core/history/service\";\nexport { LeaderboardService } from \"./core/leaderboards/service\";\nexport { MultiplayerService } from \"./core/multiplayer/service\";\nexport { ConnectionService } from \"./core/net/service\";\nexport { NotificationService } from \"./core/notifications/service\";\nexport { WatchedValue, SpyreError } from \"./core/shared/types\";\nexport { Dispatcher } from \"./core/shared/dispatcher\";\nexport { Messages } from \"./core/shared/message\";\nexport { SpyreErrorCode } from \"./core/shared/errors\";\n// core/util\nexport { logger, childLogger, getHistory } from \"./core/util/logger\";\nexport { runFor, waitFor } from \"./core/util/time\";\nexport { asyncOps, repeatAsync } from \"./core/util/async\";\nexport { getBackoffMs, waitMs } from \"./core/util/net\";\nexport { VaultService } from \"./core/vault/service\";\nexport { SigningError, SigningErrorType, Txn } from \"./core/web3/types\";\nexport { bigIntToString, toWei, fromWei } from \"./core/web3/helpers\";\n// client\nexport { SpyreClient } from \"./core/client\";\n///////////////////////////////////////////////////////////////////////// react\nexport { SpyreClientCtx } from \"./react/client-provider\";\n// react/hooks\nexport { useClient, useDeviceId } from \"./react/hooks/use-client\";\nexport { useMultiplayerService, useLeaderboardService, } from \"./react/hooks/use-services\";\n// react/hooks/account\nexport { useAccount, useAccountRefresh, useAccountUpdate, useAccountUpdateUsername, } from \"./react/hooks/use-account\";\n// react/hooks/clock\nexport { useClockOffsetMillis } from \"./react/hooks/use-clock\";\n// reac/hooks/compliance\nexport { useComplianceRefresh, useComplianceRaffles, useComplianceCashGames, useComplianceUpdateBirthday, useComplianceUpdateLocation, } from \"./react/hooks/use-compliance\";\n// react/hooks/connection\nexport { useConnectionService, useIsConnected, } from \"./react/hooks/use-connection\";\n// react/hooks/discord\nexport { useDiscordConnectionStatus, useDiscordUserId, useDiscordUsername, useDiscordUnlink, useDiscordIsGuildMember, } from \"./react/hooks/use-discord\";\n// react/hooks/elo\nexport { useElo, useEloHistory } from \"./react/hooks/use-elo\";\n// react/hooks/history\nexport { useHistoryFind, useHistoryGet } from \"./react/hooks/use-history\";\n// react/hooks/leaderboard\nexport { useLbGet, useLbWinners } from \"./react/hooks/use-leaderboards\";\n// react/hooks/multiplayer\nexport { useMpBrackets, useMpBracketRefreshSecUTC, useMpBracket, useMpMatchmakingFind, useMpMatchmakingAcceptAndJoin, useMpMatchmakingInfo, useMpMatchmakingJoinIds, useMpMatchId, useMpMatchBracketDefId, useMpSend, } from \"./react/hooks/use-multiplayer\";\n// react/hooks/notifications\nexport { useNotifHandler } from \"./react/hooks/use-notifications\";\n// react/hooks/raffle\nexport { useRaffles, useRaffleSubmit } from \"./react/hooks/use-raffle\";\n// react/hooks/rpc\nexport { useRpcCall } from \"./react/hooks/use-rpc\";\n// react/hooks/vault\nexport { useVaultCollect, useVault } from \"./react/hooks/use-vaults\";\n// react/hooks/web3\nexport { useWeb3Config, useWeb3ConnectionStatus, useWeb3IsWalletConnected, useWeb3IsWalletConnectedAndLinked, useWeb3ActiveAddress, useWeb3LinkedAddress, useWeb3StakingBalance, useWeb3UsdcBalance, useWeb3NeedsSwitchChain, useWeb3SwitchChain, useWeb3RefreshBalances, useWeb3UsdcPermitAmount, useWeb3ApproveAndWatch, useWeb3DepositAndWatch, useWeb3Sign, useWeb3IsInAppWallet, useWeb3Link, } from \"./react/hooks/use-web3\";\n// redux?\n","// src/focusManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar FocusManager = class extends Subscribable {\n #focused;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onFocus) => {\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus();\n window.addEventListener(\"visibilitychange\", listener, false);\n return () => {\n window.removeEventListener(\"visibilitychange\", listener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup((focused) => {\n if (typeof focused === \"boolean\") {\n this.setFocused(focused);\n } else {\n this.onFocus();\n }\n });\n }\n setFocused(focused) {\n const changed = this.#focused !== focused;\n if (changed) {\n this.#focused = focused;\n this.onFocus();\n }\n }\n onFocus() {\n const isFocused = this.isFocused();\n this.listeners.forEach((listener) => {\n listener(isFocused);\n });\n }\n isFocused() {\n if (typeof this.#focused === \"boolean\") {\n return this.#focused;\n }\n return globalThis.document?.visibilityState !== \"hidden\";\n }\n};\nvar focusManager = new FocusManager();\nexport {\n FocusManager,\n focusManager\n};\n//# sourceMappingURL=focusManager.js.map","// src/mutation.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Removable } from \"./removable.js\";\nimport { createRetryer } from \"./retryer.js\";\nvar Mutation = class extends Removable {\n #observers;\n #mutationCache;\n #retryer;\n constructor(config) {\n super();\n this.mutationId = config.mutationId;\n this.#mutationCache = config.mutationCache;\n this.#observers = [];\n this.state = config.state || getDefaultState();\n this.setOptions(config.options);\n this.scheduleGc();\n }\n setOptions(options) {\n this.options = options;\n this.updateGcTime(this.options.gcTime);\n }\n get meta() {\n return this.options.meta;\n }\n addObserver(observer) {\n if (!this.#observers.includes(observer)) {\n this.#observers.push(observer);\n this.clearGcTimeout();\n this.#mutationCache.notify({\n type: \"observerAdded\",\n mutation: this,\n observer\n });\n }\n }\n removeObserver(observer) {\n this.#observers = this.#observers.filter((x) => x !== observer);\n this.scheduleGc();\n this.#mutationCache.notify({\n type: \"observerRemoved\",\n mutation: this,\n observer\n });\n }\n optionalRemove() {\n if (!this.#observers.length) {\n if (this.state.status === \"pending\") {\n this.scheduleGc();\n } else {\n this.#mutationCache.remove(this);\n }\n }\n }\n continue() {\n return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before\n this.execute(this.state.variables);\n }\n async execute(variables) {\n this.#retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject(new Error(\"No mutationFn found\"));\n }\n return this.options.mutationFn(variables);\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: this.options.retry ?? 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode,\n canRun: () => this.#mutationCache.canRun(this)\n });\n const restored = this.state.status === \"pending\";\n const isPaused = !this.#retryer.canStart();\n try {\n if (!restored) {\n this.#dispatch({ type: \"pending\", variables, isPaused });\n await this.#mutationCache.config.onMutate?.(\n variables,\n this\n );\n const context = await this.options.onMutate?.(variables);\n if (context !== this.state.context) {\n this.#dispatch({\n type: \"pending\",\n context,\n variables,\n isPaused\n });\n }\n }\n const data = await this.#retryer.start();\n await this.#mutationCache.config.onSuccess?.(\n data,\n variables,\n this.state.context,\n this\n );\n await this.options.onSuccess?.(data, variables, this.state.context);\n await this.#mutationCache.config.onSettled?.(\n data,\n null,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(data, null, variables, this.state.context);\n this.#dispatch({ type: \"success\", data });\n return data;\n } catch (error) {\n try {\n await this.#mutationCache.config.onError?.(\n error,\n variables,\n this.state.context,\n this\n );\n await this.options.onError?.(\n error,\n variables,\n this.state.context\n );\n await this.#mutationCache.config.onSettled?.(\n void 0,\n error,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(\n void 0,\n error,\n variables,\n this.state.context\n );\n throw error;\n } finally {\n this.#dispatch({ type: \"error\", error });\n }\n } finally {\n this.#mutationCache.runNext(this);\n }\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n failureCount: action.failureCount,\n failureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n isPaused: true\n };\n case \"continue\":\n return {\n ...state,\n isPaused: false\n };\n case \"pending\":\n return {\n ...state,\n context: action.context,\n data: void 0,\n failureCount: 0,\n failureReason: null,\n error: null,\n isPaused: action.isPaused,\n status: \"pending\",\n variables: action.variables,\n submittedAt: Date.now()\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n failureCount: 0,\n failureReason: null,\n error: null,\n status: \"success\",\n isPaused: false\n };\n case \"error\":\n return {\n ...state,\n data: void 0,\n error: action.error,\n failureCount: state.failureCount + 1,\n failureReason: action.error,\n isPaused: false,\n status: \"error\"\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.#observers.forEach((observer) => {\n observer.onMutationUpdate(action);\n });\n this.#mutationCache.notify({\n mutation: this,\n type: \"updated\",\n action\n });\n });\n }\n};\nfunction getDefaultState() {\n return {\n context: void 0,\n data: void 0,\n error: null,\n failureCount: 0,\n failureReason: null,\n isPaused: false,\n status: \"idle\",\n variables: void 0,\n submittedAt: 0\n };\n}\nexport {\n Mutation,\n getDefaultState\n};\n//# sourceMappingURL=mutation.js.map","// src/notifyManager.ts\nfunction createNotifyManager() {\n let queue = [];\n let transactions = 0;\n let notifyFn = (callback) => {\n callback();\n };\n let batchNotifyFn = (callback) => {\n callback();\n };\n let scheduleFn = (cb) => setTimeout(cb, 0);\n const schedule = (callback) => {\n if (transactions) {\n queue.push(callback);\n } else {\n scheduleFn(() => {\n notifyFn(callback);\n });\n }\n };\n const flush = () => {\n const originalQueue = queue;\n queue = [];\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback);\n });\n });\n });\n }\n };\n return {\n batch: (callback) => {\n let result;\n transactions++;\n try {\n result = callback();\n } finally {\n transactions--;\n if (!transactions) {\n flush();\n }\n }\n return result;\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: (callback) => {\n return (...args) => {\n schedule(() => {\n callback(...args);\n });\n };\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn) => {\n notifyFn = fn;\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn) => {\n batchNotifyFn = fn;\n },\n setScheduler: (fn) => {\n scheduleFn = fn;\n }\n };\n}\nvar notifyManager = createNotifyManager();\nexport {\n createNotifyManager,\n notifyManager\n};\n//# sourceMappingURL=notifyManager.js.map","// src/onlineManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar OnlineManager = class extends Subscribable {\n #online = true;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onOnline) => {\n if (!isServer && window.addEventListener) {\n const onlineListener = () => onOnline(true);\n const offlineListener = () => onOnline(false);\n window.addEventListener(\"online\", onlineListener, false);\n window.addEventListener(\"offline\", offlineListener, false);\n return () => {\n window.removeEventListener(\"online\", onlineListener);\n window.removeEventListener(\"offline\", offlineListener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup(this.setOnline.bind(this));\n }\n setOnline(online) {\n const changed = this.#online !== online;\n if (changed) {\n this.#online = online;\n this.listeners.forEach((listener) => {\n listener(online);\n });\n }\n }\n isOnline() {\n return this.#online;\n }\n};\nvar onlineManager = new OnlineManager();\nexport {\n OnlineManager,\n onlineManager\n};\n//# sourceMappingURL=onlineManager.js.map","// src/query.ts\nimport {\n ensureQueryFn,\n noop,\n replaceData,\n resolveEnabled,\n skipToken,\n timeUntilStale\n} from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { canFetch, createRetryer, isCancelledError } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nvar Query = class extends Removable {\n #initialState;\n #revertState;\n #cache;\n #retryer;\n #defaultOptions;\n #abortSignalConsumed;\n constructor(config) {\n super();\n this.#abortSignalConsumed = false;\n this.#defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.#cache = config.cache;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.#initialState = getDefaultState(this.options);\n this.state = config.state ?? this.#initialState;\n this.scheduleGc();\n }\n get meta() {\n return this.options.meta;\n }\n get promise() {\n return this.#retryer?.promise;\n }\n setOptions(options) {\n this.options = { ...this.#defaultOptions, ...options };\n this.updateGcTime(this.options.gcTime);\n }\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === \"idle\") {\n this.#cache.remove(this);\n }\n }\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options);\n this.#dispatch({\n data,\n type: \"success\",\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual\n });\n return data;\n }\n setState(state, setStateOptions) {\n this.#dispatch({ type: \"setState\", state, setStateOptions });\n }\n cancel(options) {\n const promise = this.#retryer?.promise;\n this.#retryer?.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n destroy() {\n super.destroy();\n this.cancel({ silent: true });\n }\n reset() {\n this.destroy();\n this.setState(this.#initialState);\n }\n isActive() {\n return this.observers.some(\n (observer) => resolveEnabled(observer.options.enabled, this) !== false\n );\n }\n isDisabled() {\n if (this.getObserversCount() > 0) {\n return !this.isActive();\n }\n return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;\n }\n isStale() {\n if (this.state.isInvalidated) {\n return true;\n }\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => observer.getCurrentResult().isStale\n );\n }\n return this.state.data === void 0;\n }\n isStaleByTime(staleTime = 0) {\n return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n onFocus() {\n const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n onOnline() {\n const observer = this.observers.find((x) => x.shouldFetchOnReconnect());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n addObserver(observer) {\n if (!this.observers.includes(observer)) {\n this.observers.push(observer);\n this.clearGcTimeout();\n this.#cache.notify({ type: \"observerAdded\", query: this, observer });\n }\n }\n removeObserver(observer) {\n if (this.observers.includes(observer)) {\n this.observers = this.observers.filter((x) => x !== observer);\n if (!this.observers.length) {\n if (this.#retryer) {\n if (this.#abortSignalConsumed) {\n this.#retryer.cancel({ revert: true });\n } else {\n this.#retryer.cancelRetry();\n }\n }\n this.scheduleGc();\n }\n this.#cache.notify({ type: \"observerRemoved\", query: this, observer });\n }\n }\n getObserversCount() {\n return this.observers.length;\n }\n invalidate() {\n if (!this.state.isInvalidated) {\n this.#dispatch({ type: \"invalidate\" });\n }\n }\n fetch(options, fetchOptions) {\n if (this.state.fetchStatus !== \"idle\") {\n if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {\n this.cancel({ silent: true });\n } else if (this.#retryer) {\n this.#retryer.continueRetry();\n return this.#retryer.promise;\n }\n }\n if (options) {\n this.setOptions(options);\n }\n if (!this.options.queryFn) {\n const observer = this.observers.find((x) => x.options.queryFn);\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(\n `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`\n );\n }\n }\n const abortController = new AbortController();\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true;\n return abortController.signal;\n }\n });\n };\n const fetchFn = () => {\n const queryFn = ensureQueryFn(this.options, fetchOptions);\n const queryFnContext = {\n queryKey: this.queryKey,\n meta: this.meta\n };\n addSignalProperty(queryFnContext);\n this.#abortSignalConsumed = false;\n if (this.options.persister) {\n return this.options.persister(\n queryFn,\n queryFnContext,\n this\n );\n }\n return queryFn(queryFnContext);\n };\n const context = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn\n };\n addSignalProperty(context);\n this.options.behavior?.onFetch(\n context,\n this\n );\n this.#revertState = this.state;\n if (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) {\n this.#dispatch({ type: \"fetch\", meta: context.fetchOptions?.meta });\n }\n const onError = (error) => {\n if (!(isCancelledError(error) && error.silent)) {\n this.#dispatch({\n type: \"error\",\n error\n });\n }\n if (!isCancelledError(error)) {\n this.#cache.config.onError?.(\n error,\n this\n );\n this.#cache.config.onSettled?.(\n this.state.data,\n error,\n this\n );\n }\n this.scheduleGc();\n };\n this.#retryer = createRetryer({\n initialPromise: fetchOptions?.initialPromise,\n fn: context.fetchFn,\n abort: abortController.abort.bind(abortController),\n onSuccess: (data) => {\n if (data === void 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\n `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`\n );\n }\n onError(new Error(`${this.queryHash} data is undefined`));\n return;\n }\n try {\n this.setData(data);\n } catch (error) {\n onError(error);\n return;\n }\n this.#cache.config.onSuccess?.(data, this);\n this.#cache.config.onSettled?.(\n data,\n this.state.error,\n this\n );\n this.scheduleGc();\n },\n onError,\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n canRun: () => true\n });\n return this.#retryer.start();\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n fetchStatus: \"paused\"\n };\n case \"continue\":\n return {\n ...state,\n fetchStatus: \"fetching\"\n };\n case \"fetch\":\n return {\n ...state,\n ...fetchState(state.data, this.options),\n fetchMeta: action.meta ?? null\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: \"success\",\n ...!action.manual && {\n fetchStatus: \"idle\",\n fetchFailureCount: 0,\n fetchFailureReason: null\n }\n };\n case \"error\":\n const error = action.error;\n if (isCancelledError(error) && error.revert && this.#revertState) {\n return { ...this.#revertState, fetchStatus: \"idle\" };\n }\n return {\n ...state,\n error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: \"idle\",\n status: \"error\"\n };\n case \"invalidate\":\n return {\n ...state,\n isInvalidated: true\n };\n case \"setState\":\n return {\n ...state,\n ...action.state\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach((observer) => {\n observer.onQueryUpdate();\n });\n this.#cache.notify({ query: this, type: \"updated\", action });\n });\n }\n};\nfunction fetchState(data, options) {\n return {\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n ...data === void 0 && {\n error: null,\n status: \"pending\"\n }\n };\n}\nfunction getDefaultState(options) {\n const data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n const hasData = data !== void 0;\n const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? \"success\" : \"pending\",\n fetchStatus: \"idle\"\n };\n}\nexport {\n Query,\n fetchState\n};\n//# sourceMappingURL=query.js.map","// src/removable.ts\nimport { isServer, isValidTimeout } from \"./utils.js\";\nvar Removable = class {\n #gcTimeout;\n destroy() {\n this.clearGcTimeout();\n }\n scheduleGc() {\n this.clearGcTimeout();\n if (isValidTimeout(this.gcTime)) {\n this.#gcTimeout = setTimeout(() => {\n this.optionalRemove();\n }, this.gcTime);\n }\n }\n updateGcTime(newGcTime) {\n this.gcTime = Math.max(\n this.gcTime || 0,\n newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)\n );\n }\n clearGcTimeout() {\n if (this.#gcTimeout) {\n clearTimeout(this.#gcTimeout);\n this.#gcTimeout = void 0;\n }\n }\n};\nexport {\n Removable\n};\n//# sourceMappingURL=removable.js.map","// src/retryer.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport { isServer, sleep } from \"./utils.js\";\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n return (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\nvar CancelledError = class extends Error {\n constructor(options) {\n super(\"CancelledError\");\n this.revert = options?.revert;\n this.silent = options?.silent;\n }\n};\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let isResolved = false;\n let continueFn;\n const thenable = pendingThenable();\n const cancel = (cancelOptions) => {\n if (!isResolved) {\n reject(new CancelledError(cancelOptions));\n config.abort?.();\n }\n };\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n const canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n const canStart = () => canFetch(config.networkMode) && config.canRun();\n const resolve = (value) => {\n if (!isResolved) {\n isResolved = true;\n config.onSuccess?.(value);\n continueFn?.();\n thenable.resolve(value);\n }\n };\n const reject = (value) => {\n if (!isResolved) {\n isResolved = true;\n config.onError?.(value);\n continueFn?.();\n thenable.reject(value);\n }\n };\n const pause = () => {\n return new Promise((continueResolve) => {\n continueFn = (value) => {\n if (isResolved || canContinue()) {\n continueResolve(value);\n }\n };\n config.onPause?.();\n }).then(() => {\n continueFn = void 0;\n if (!isResolved) {\n config.onContinue?.();\n }\n });\n };\n const run = () => {\n if (isResolved) {\n return;\n }\n let promiseOrValue;\n const initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n try {\n promiseOrValue = initialPromise ?? config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n Promise.resolve(promiseOrValue).then(resolve).catch((error) => {\n if (isResolved) {\n return;\n }\n const retry = config.retry ?? (isServer ? 0 : 3);\n const retryDelay = config.retryDelay ?? defaultRetryDelay;\n const delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n if (isRetryCancelled || !shouldRetry) {\n reject(error);\n return;\n }\n failureCount++;\n config.onFail?.(failureCount, error);\n sleep(delay).then(() => {\n return canContinue() ? void 0 : pause();\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n };\n return {\n promise: thenable,\n cancel,\n continue: () => {\n continueFn?.();\n return thenable;\n },\n cancelRetry,\n continueRetry,\n canStart,\n start: () => {\n if (canStart()) {\n run();\n } else {\n pause().then(run);\n }\n return thenable;\n }\n };\n}\nexport {\n CancelledError,\n canFetch,\n createRetryer,\n isCancelledError\n};\n//# sourceMappingURL=retryer.js.map","// src/subscribable.ts\nvar Subscribable = class {\n constructor() {\n this.listeners = /* @__PURE__ */ new Set();\n this.subscribe = this.subscribe.bind(this);\n }\n subscribe(listener) {\n this.listeners.add(listener);\n this.onSubscribe();\n return () => {\n this.listeners.delete(listener);\n this.onUnsubscribe();\n };\n }\n hasListeners() {\n return this.listeners.size > 0;\n }\n onSubscribe() {\n }\n onUnsubscribe() {\n }\n};\nexport {\n Subscribable\n};\n//# sourceMappingURL=subscribable.js.map","// src/thenable.ts\nfunction pendingThenable() {\n let resolve;\n let reject;\n const thenable = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n thenable.status = \"pending\";\n thenable.catch(() => {\n });\n function finalize(data) {\n Object.assign(thenable, data);\n delete thenable.resolve;\n delete thenable.reject;\n }\n thenable.resolve = (value) => {\n finalize({\n status: \"fulfilled\",\n value\n });\n resolve(value);\n };\n thenable.reject = (reason) => {\n finalize({\n status: \"rejected\",\n reason\n });\n reject(reason);\n };\n return thenable;\n}\nexport {\n pendingThenable\n};\n//# sourceMappingURL=thenable.js.map","// src/utils.ts\nvar isServer = typeof window === \"undefined\" || \"Deno\" in globalThis;\nfunction noop() {\n}\nfunction functionalUpdate(updater, input) {\n return typeof updater === \"function\" ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n return typeof value === \"number\" && value >= 0 && value !== Infinity;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction resolveStaleTime(staleTime, query) {\n return typeof staleTime === \"function\" ? staleTime(query) : staleTime;\n}\nfunction resolveEnabled(enabled, query) {\n return typeof enabled === \"function\" ? enabled(query) : enabled;\n}\nfunction matchQuery(filters, query) {\n const {\n type = \"all\",\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale\n } = filters;\n if (queryKey) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n if (type !== \"all\") {\n const isActive = query.isActive();\n if (type === \"active\" && !isActive) {\n return false;\n }\n if (type === \"inactive\" && isActive) {\n return false;\n }\n }\n if (typeof stale === \"boolean\" && query.isStale() !== stale) {\n return false;\n }\n if (fetchStatus && fetchStatus !== query.state.fetchStatus) {\n return false;\n }\n if (predicate && !predicate(query)) {\n return false;\n }\n return true;\n}\nfunction matchMutation(filters, mutation) {\n const { exact, status, predicate, mutationKey } = filters;\n if (mutationKey) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n if (exact) {\n if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n if (status && mutation.state.status !== status) {\n return false;\n }\n if (predicate && !predicate(mutation)) {\n return false;\n }\n return true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n const hashFn = options?.queryKeyHashFn || hashKey;\n return hashFn(queryKey);\n}\nfunction hashKey(queryKey) {\n return JSON.stringify(\n queryKey,\n (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n result[key] = val[key];\n return result;\n }, {}) : val\n );\n}\nfunction partialMatchKey(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (a && b && typeof a === \"object\" && typeof b === \"object\") {\n return !Object.keys(b).some((key) => !partialMatchKey(a[key], b[key]));\n }\n return false;\n}\nfunction replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n const array = isPlainArray(a) && isPlainArray(b);\n if (array || isPlainObject(a) && isPlainObject(b)) {\n const aItems = array ? a : Object.keys(a);\n const aSize = aItems.length;\n const bItems = array ? b : Object.keys(b);\n const bSize = bItems.length;\n const copy = array ? [] : {};\n let equalItems = 0;\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i];\n if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {\n copy[key] = void 0;\n equalItems++;\n } else {\n copy[key] = replaceEqualDeep(a[key], b[key]);\n if (copy[key] === a[key] && a[key] !== void 0) {\n equalItems++;\n }\n }\n }\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n return b;\n}\nfunction shallowEqualObjects(a, b) {\n if (!b || Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n return true;\n}\nfunction isPlainArray(value) {\n return Array.isArray(value) && value.length === Object.keys(value).length;\n}\nfunction isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n }\n const ctor = o.constructor;\n if (ctor === void 0) {\n return true;\n }\n const prot = ctor.prototype;\n if (!hasObjectPrototype(prot)) {\n return false;\n }\n if (!prot.hasOwnProperty(\"isPrototypeOf\")) {\n return false;\n }\n if (Object.getPrototypeOf(o) !== Object.prototype) {\n return false;\n }\n return true;\n}\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === \"[object Object]\";\n}\nfunction sleep(timeout) {\n return new Promise((resolve) => {\n setTimeout(resolve, timeout);\n });\n}\nfunction replaceData(prevData, data, options) {\n if (typeof options.structuralSharing === \"function\") {\n return options.structuralSharing(prevData, data);\n } else if (options.structuralSharing !== false) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n return replaceEqualDeep(prevData, data);\n } catch (error) {\n console.error(\n `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`\n );\n }\n }\n return replaceEqualDeep(prevData, data);\n }\n return data;\n}\nfunction keepPreviousData(previousData) {\n return previousData;\n}\nfunction addToEnd(items, item, max = 0) {\n const newItems = [...items, item];\n return max && newItems.length > max ? newItems.slice(1) : newItems;\n}\nfunction addToStart(items, item, max = 0) {\n const newItems = [item, ...items];\n return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n}\nvar skipToken = Symbol();\nfunction ensureQueryFn(options, fetchOptions) {\n if (process.env.NODE_ENV !== \"production\") {\n if (options.queryFn === skipToken) {\n console.error(\n `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`\n );\n }\n }\n if (!options.queryFn && fetchOptions?.initialPromise) {\n return () => fetchOptions.initialPromise;\n }\n if (!options.queryFn || options.queryFn === skipToken) {\n return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));\n }\n return options.queryFn;\n}\nexport {\n addToEnd,\n addToStart,\n ensureQueryFn,\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n isPlainArray,\n isPlainObject,\n isServer,\n isValidTimeout,\n keepPreviousData,\n matchMutation,\n matchQuery,\n noop,\n partialMatchKey,\n replaceData,\n replaceEqualDeep,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n skipToken,\n sleep,\n timeUntilStale\n};\n//# sourceMappingURL=utils.js.map","'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n \n {children}\n \n )\n}\n","// src/queryObserver.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { fetchState } from \"./query.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport {\n isServer,\n isValidTimeout,\n noop,\n replaceData,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n timeUntilStale\n} from \"./utils.js\";\nvar QueryObserver = class extends Subscribable {\n constructor(client, options) {\n super();\n this.options = options;\n this.#client = client;\n this.#selectError = null;\n this.#currentThenable = pendingThenable();\n if (!this.options.experimental_prefetchInRender) {\n this.#currentThenable.reject(\n new Error(\"experimental_prefetchInRender feature flag is not enabled\")\n );\n }\n this.bindMethods();\n this.setOptions(options);\n }\n #client;\n #currentQuery = void 0;\n #currentQueryInitialState = void 0;\n #currentResult = void 0;\n #currentResultState;\n #currentResultOptions;\n #currentThenable;\n #selectError;\n #selectFn;\n #selectResult;\n // This property keeps track of the last query with defined data.\n // It will be used to pass the previous data and query to the placeholder function between renders.\n #lastQueryWithDefinedData;\n #staleTimeoutId;\n #refetchIntervalId;\n #currentRefetchInterval;\n #trackedProps = /* @__PURE__ */ new Set();\n bindMethods() {\n this.refetch = this.refetch.bind(this);\n }\n onSubscribe() {\n if (this.listeners.size === 1) {\n this.#currentQuery.addObserver(this);\n if (shouldFetchOnMount(this.#currentQuery, this.options)) {\n this.#executeFetch();\n } else {\n this.updateResult();\n }\n this.#updateTimers();\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.destroy();\n }\n }\n shouldFetchOnReconnect() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnReconnect\n );\n }\n shouldFetchOnWindowFocus() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnWindowFocus\n );\n }\n destroy() {\n this.listeners = /* @__PURE__ */ new Set();\n this.#clearStaleTimeout();\n this.#clearRefetchInterval();\n this.#currentQuery.removeObserver(this);\n }\n setOptions(options, notifyOptions) {\n const prevOptions = this.options;\n const prevQuery = this.#currentQuery;\n this.options = this.#client.defaultQueryOptions(options);\n if (this.options.enabled !== void 0 && typeof this.options.enabled !== \"boolean\" && typeof this.options.enabled !== \"function\" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== \"boolean\") {\n throw new Error(\n \"Expected enabled to be a boolean or a callback that returns a boolean\"\n );\n }\n this.#updateQuery();\n this.#currentQuery.setOptions(this.options);\n if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getQueryCache().notify({\n type: \"observerOptionsUpdated\",\n query: this.#currentQuery,\n observer: this\n });\n }\n const mounted = this.hasListeners();\n if (mounted && shouldFetchOptionally(\n this.#currentQuery,\n prevQuery,\n this.options,\n prevOptions\n )) {\n this.#executeFetch();\n }\n this.updateResult(notifyOptions);\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {\n this.#updateStaleTimeout();\n }\n const nextRefetchInterval = this.#computeRefetchInterval();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {\n this.#updateRefetchInterval(nextRefetchInterval);\n }\n }\n getOptimisticResult(options) {\n const query = this.#client.getQueryCache().build(this.#client, options);\n const result = this.createResult(query, options);\n if (shouldAssignObserverCurrentProperties(this, result)) {\n this.#currentResult = result;\n this.#currentResultOptions = this.options;\n this.#currentResultState = this.#currentQuery.state;\n }\n return result;\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n trackResult(result, onPropTracked) {\n const trackedResult = {};\n Object.keys(result).forEach((key) => {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: () => {\n this.trackProp(key);\n onPropTracked?.(key);\n return result[key];\n }\n });\n });\n return trackedResult;\n }\n trackProp(key) {\n this.#trackedProps.add(key);\n }\n getCurrentQuery() {\n return this.#currentQuery;\n }\n refetch({ ...options } = {}) {\n return this.fetch({\n ...options\n });\n }\n fetchOptimistic(options) {\n const defaultedOptions = this.#client.defaultQueryOptions(options);\n const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);\n return query.fetch().then(() => this.createResult(query, defaultedOptions));\n }\n fetch(fetchOptions) {\n return this.#executeFetch({\n ...fetchOptions,\n cancelRefetch: fetchOptions.cancelRefetch ?? true\n }).then(() => {\n this.updateResult();\n return this.#currentResult;\n });\n }\n #executeFetch(fetchOptions) {\n this.#updateQuery();\n let promise = this.#currentQuery.fetch(\n this.options,\n fetchOptions\n );\n if (!fetchOptions?.throwOnError) {\n promise = promise.catch(noop);\n }\n return promise;\n }\n #updateStaleTimeout() {\n this.#clearStaleTimeout();\n const staleTime = resolveStaleTime(\n this.options.staleTime,\n this.#currentQuery\n );\n if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {\n return;\n }\n const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);\n const timeout = time + 1;\n this.#staleTimeoutId = setTimeout(() => {\n if (!this.#currentResult.isStale) {\n this.updateResult();\n }\n }, timeout);\n }\n #computeRefetchInterval() {\n return (typeof this.options.refetchInterval === \"function\" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;\n }\n #updateRefetchInterval(nextInterval) {\n this.#clearRefetchInterval();\n this.#currentRefetchInterval = nextInterval;\n if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {\n return;\n }\n this.#refetchIntervalId = setInterval(() => {\n if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {\n this.#executeFetch();\n }\n }, this.#currentRefetchInterval);\n }\n #updateTimers() {\n this.#updateStaleTimeout();\n this.#updateRefetchInterval(this.#computeRefetchInterval());\n }\n #clearStaleTimeout() {\n if (this.#staleTimeoutId) {\n clearTimeout(this.#staleTimeoutId);\n this.#staleTimeoutId = void 0;\n }\n }\n #clearRefetchInterval() {\n if (this.#refetchIntervalId) {\n clearInterval(this.#refetchIntervalId);\n this.#refetchIntervalId = void 0;\n }\n }\n createResult(query, options) {\n const prevQuery = this.#currentQuery;\n const prevOptions = this.options;\n const prevResult = this.#currentResult;\n const prevResultState = this.#currentResultState;\n const prevResultOptions = this.#currentResultOptions;\n const queryChange = query !== prevQuery;\n const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;\n const { state } = query;\n let newState = { ...state };\n let isPlaceholderData = false;\n let data;\n if (options._optimisticResults) {\n const mounted = this.hasListeners();\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n if (fetchOnMount || fetchOptionally) {\n newState = {\n ...newState,\n ...fetchState(state.data, query.options)\n };\n }\n if (options._optimisticResults === \"isRestoring\") {\n newState.fetchStatus = \"idle\";\n }\n }\n let { error, errorUpdatedAt, status } = newState;\n if (options.select && newState.data !== void 0) {\n if (prevResult && newState.data === prevResultState?.data && options.select === this.#selectFn) {\n data = this.#selectResult;\n } else {\n try {\n this.#selectFn = options.select;\n data = options.select(newState.data);\n data = replaceData(prevResult?.data, data, options);\n this.#selectResult = data;\n this.#selectError = null;\n } catch (selectError) {\n this.#selectError = selectError;\n }\n }\n } else {\n data = newState.data;\n }\n if (options.placeholderData !== void 0 && data === void 0 && status === \"pending\") {\n let placeholderData;\n if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {\n placeholderData = prevResult.data;\n } else {\n placeholderData = typeof options.placeholderData === \"function\" ? options.placeholderData(\n this.#lastQueryWithDefinedData?.state.data,\n this.#lastQueryWithDefinedData\n ) : options.placeholderData;\n if (options.select && placeholderData !== void 0) {\n try {\n placeholderData = options.select(placeholderData);\n this.#selectError = null;\n } catch (selectError) {\n this.#selectError = selectError;\n }\n }\n }\n if (placeholderData !== void 0) {\n status = \"success\";\n data = replaceData(\n prevResult?.data,\n placeholderData,\n options\n );\n isPlaceholderData = true;\n }\n }\n if (this.#selectError) {\n error = this.#selectError;\n data = this.#selectResult;\n errorUpdatedAt = Date.now();\n status = \"error\";\n }\n const isFetching = newState.fetchStatus === \"fetching\";\n const isPending = status === \"pending\";\n const isError = status === \"error\";\n const isLoading = isPending && isFetching;\n const hasData = data !== void 0;\n const result = {\n status,\n fetchStatus: newState.fetchStatus,\n isPending,\n isSuccess: status === \"success\",\n isError,\n isInitialLoading: isLoading,\n isLoading,\n data,\n dataUpdatedAt: newState.dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: newState.fetchFailureCount,\n failureReason: newState.fetchFailureReason,\n errorUpdateCount: newState.errorUpdateCount,\n isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,\n isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isPending,\n isLoadingError: isError && !hasData,\n isPaused: newState.fetchStatus === \"paused\",\n isPlaceholderData,\n isRefetchError: isError && hasData,\n isStale: isStale(query, options),\n refetch: this.refetch,\n promise: this.#currentThenable\n };\n const nextResult = result;\n if (this.options.experimental_prefetchInRender) {\n const finalizeThenableIfPossible = (thenable) => {\n if (nextResult.status === \"error\") {\n thenable.reject(nextResult.error);\n } else if (nextResult.data !== void 0) {\n thenable.resolve(nextResult.data);\n }\n };\n const recreateThenable = () => {\n const pending = this.#currentThenable = nextResult.promise = pendingThenable();\n finalizeThenableIfPossible(pending);\n };\n const prevThenable = this.#currentThenable;\n switch (prevThenable.status) {\n case \"pending\":\n if (query.queryHash === prevQuery.queryHash) {\n finalizeThenableIfPossible(prevThenable);\n }\n break;\n case \"fulfilled\":\n if (nextResult.status === \"error\" || nextResult.data !== prevThenable.value) {\n recreateThenable();\n }\n break;\n case \"rejected\":\n if (nextResult.status !== \"error\" || nextResult.error !== prevThenable.reason) {\n recreateThenable();\n }\n break;\n }\n }\n return nextResult;\n }\n updateResult(notifyOptions) {\n const prevResult = this.#currentResult;\n const nextResult = this.createResult(this.#currentQuery, this.options);\n this.#currentResultState = this.#currentQuery.state;\n this.#currentResultOptions = this.options;\n if (this.#currentResultState.data !== void 0) {\n this.#lastQueryWithDefinedData = this.#currentQuery;\n }\n if (shallowEqualObjects(nextResult, prevResult)) {\n return;\n }\n this.#currentResult = nextResult;\n const defaultNotifyOptions = {};\n const shouldNotifyListeners = () => {\n if (!prevResult) {\n return true;\n }\n const { notifyOnChangeProps } = this.options;\n const notifyOnChangePropsValue = typeof notifyOnChangeProps === \"function\" ? notifyOnChangeProps() : notifyOnChangeProps;\n if (notifyOnChangePropsValue === \"all\" || !notifyOnChangePropsValue && !this.#trackedProps.size) {\n return true;\n }\n const includedProps = new Set(\n notifyOnChangePropsValue ?? this.#trackedProps\n );\n if (this.options.throwOnError) {\n includedProps.add(\"error\");\n }\n return Object.keys(this.#currentResult).some((key) => {\n const typedKey = key;\n const changed = this.#currentResult[typedKey] !== prevResult[typedKey];\n return changed && includedProps.has(typedKey);\n });\n };\n if (notifyOptions?.listeners !== false && shouldNotifyListeners()) {\n defaultNotifyOptions.listeners = true;\n }\n this.#notify({ ...defaultNotifyOptions, ...notifyOptions });\n }\n #updateQuery() {\n const query = this.#client.getQueryCache().build(this.#client, this.options);\n if (query === this.#currentQuery) {\n return;\n }\n const prevQuery = this.#currentQuery;\n this.#currentQuery = query;\n this.#currentQueryInitialState = query.state;\n if (this.hasListeners()) {\n prevQuery?.removeObserver(this);\n query.addObserver(this);\n }\n }\n onQueryUpdate() {\n this.updateResult();\n if (this.hasListeners()) {\n this.#updateTimers();\n }\n }\n #notify(notifyOptions) {\n notifyManager.batch(() => {\n if (notifyOptions.listeners) {\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n }\n this.#client.getQueryCache().notify({\n query: this.#currentQuery,\n type: \"observerResultsUpdated\"\n });\n });\n }\n};\nfunction shouldLoadOnMount(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === \"error\" && options.retryOnMount === false);\n}\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\nfunction shouldFetchOn(query, options, field) {\n if (resolveEnabled(options.enabled, query) !== false) {\n const value = typeof field === \"function\" ? field(query) : field;\n return value === \"always\" || value !== false && isStale(query, options);\n }\n return false;\n}\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== \"error\") && isStale(query, options);\n}\nfunction isStale(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));\n}\nfunction shouldAssignObserverCurrentProperties(observer, optimisticResult) {\n if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {\n return true;\n }\n return false;\n}\nexport {\n QueryObserver\n};\n//# sourceMappingURL=queryObserver.js.map","'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n \n {typeof children === 'function' ? children(value) : children}\n \n )\n}\n","'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from './utils'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n if (\n options.suspense ||\n options.throwOnError ||\n options.experimental_prefetchInRender\n ) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n}: {\n result: QueryObserverResult\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError\n query: Query | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n shouldThrowError(throwOnError, [result.error, query])\n )\n}\n","'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n","// src/suspense.ts\nvar defaultThrowOnError = (_error, query) => query.state.data === void 0;\nvar ensureSuspenseTimers = (defaultedOptions) => {\n const originalStaleTime = defaultedOptions.staleTime;\n if (defaultedOptions.suspense) {\n defaultedOptions.staleTime = typeof originalStaleTime === \"function\" ? (...args) => Math.max(originalStaleTime(...args), 1e3) : Math.max(originalStaleTime ?? 1e3, 1e3);\n if (typeof defaultedOptions.gcTime === \"number\") {\n defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3);\n }\n }\n};\nvar willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;\nvar shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;\nvar fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset();\n});\nexport {\n defaultThrowOnError,\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch\n};\n//# sourceMappingURL=suspense.js.map","'use client'\nimport * as React from 'react'\n\nimport { isServer, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport { useIsRestoring } from './isRestoring'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch,\n} from './suspense'\nimport { noop } from './utils'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryOptions } from './types'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const client = useQueryClient(queryClient)\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const defaultedOptions = client.defaultQueryOptions(options)\n\n ;(client.getDefaultOptions().queries as any)?._experimental_beforeQuery?.(\n defaultedOptions,\n )\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary)\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n // this needs to be invoked before creating the Observer because that can create a cache entry\n const isNewCacheEntry = !client\n .getQueryCache()\n .get(defaultedOptions.queryHash)\n\n const [observer] = React.useState(\n () =>\n new Observer(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n observer.setOptions(defaultedOptions, { listeners: false })\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query: client\n .getQueryCache()\n .get<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey\n >(defaultedOptions.queryHash),\n })\n ) {\n throw result.error\n }\n\n ;(client.getDefaultOptions().queries as any)?._experimental_afterQuery?.(\n defaultedOptions,\n result,\n )\n\n if (\n defaultedOptions.experimental_prefetchInRender &&\n !isServer &&\n willFetch(result, isRestoring)\n ) {\n const promise = isNewCacheEntry\n ? // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n : // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n client.getQueryCache().get(defaultedOptions.queryHash)?.promise\n\n promise?.catch(noop).finally(() => {\n // `.updateResult()` will trigger `.#currentThenable` to finalize\n observer.updateResult()\n })\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n","'use client'\nimport { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './queryOptions'\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions,\n queryClient?: QueryClient,\n): DefinedUseQueryResult\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions,\n queryClient?: QueryClient,\n): UseQueryResult\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions,\n queryClient?: QueryClient,\n): UseQueryResult\n\nexport function useQuery(options: UseQueryOptions, queryClient?: QueryClient) {\n return useBaseQuery(options, QueryObserver, queryClient)\n}\n","// src/utils.ts\nfunction shouldThrowError(throwError, params) {\n if (typeof throwError === \"function\") {\n return throwError(...params);\n }\n return !!throwError;\n}\nfunction noop() {\n}\nexport {\n noop,\n shouldThrowError\n};\n//# sourceMappingURL=utils.js.map"],"names":["logger","childLogger","useWeb3Config","useClient","web3","config","useWeb3ConnectionStatus","useSyncExternalStore","status","watch","getValue","useWeb3IsWalletConnectedAndLinked","connectedAddress","useWeb3ActiveAddress","data","account","useAccount","walletAddr","address","activeAddress","linkedAddress","addr","balance","stakingBalance","query","useCallback","refresh","value","useQuery","queryKey","queryFn","usdcBalance","debug","useWeb3UsdcPermitAmount","amount","usdcPermitAmount","queryClient","useQueryClient","invalidateQueries","Promise","all","needsToSwitchChains","isInAppWallet","useMutation","mutationFn","link","switchChain","useWeb3ApproveAndWatch","wad","txn","approve","ns","onResolve","deposit","signParams","signStake"],"sourceRoot":"","ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,69,72]}