@ar.io/sdk 3.21.1-alpha.1 → 3.22.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,7 +57,7 @@ ${JSON.stringify(Ft.from(a))},${JSON.stringify(Ft.from(l))},${c} => ${JSON.strin
57
57
  `)}static register(e,a){if(a||(a=e.locale),$ie)try{let l=window;l._ethers&&l._ethers.wordlists&&(l._ethers.wordlists[a]||$r(l._ethers.wordlists,a,e))}catch{}}};Et();Rt();At();Et();Rt();At();var Uie="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",zy=null;function u5t(r){if(zy==null&&(zy=Uie.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),rg.check(r)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw zy=null,new Error("BIP39 Wordlist for en (English) FAILED")}var ZF=class extends rg{constructor(){super("en")}getWord(e){return u5t(this),zy[e]}getWordIndex(e){return u5t(this),zy.indexOf(e)}},WF=new ZF;rg.register(WF);var wS={en:WF};Et();Rt();At();var l5t="hdnode/5.8.0";var _S=new Br(l5t),jie=Ha.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),zie=df("Bitcoin seed"),Fy=2147483648;function c5t(r){return(1<<r)-1<<8-r}function Fie(r){return(1<<r)-1}function MS(r){return Ys(Lr(r),32)}function d5t(r){return HF.encode(Sh([r,Ac(nv(nv(r)),0,4)]))}function GF(r){if(r==null)return wS.en;if(typeof r=="string"){let e=wS[r];return e==null&&_S.throwArgumentError("unknown locale","wordlist",r),e}return r}var ig={},sv="m/44'/60'/0'/0/0",kp=class r{constructor(e,a,l,i,c,b,g,M){if(e!==ig)throw new Error("HDNode constructor cannot be called directly");if(a){let y=new vd(a);$r(this,"privateKey",y.privateKey),$r(this,"publicKey",y.compressedPublicKey)}else $r(this,"privateKey",null),$r(this,"publicKey",Lr(l));$r(this,"parentFingerprint",i),$r(this,"fingerprint",Ac(KF(nv(this.publicKey)),0,4)),$r(this,"address",L0(this.publicKey)),$r(this,"chainCode",c),$r(this,"index",b),$r(this,"depth",g),M==null?($r(this,"mnemonic",null),$r(this,"path",null)):typeof M=="string"?($r(this,"mnemonic",null),$r(this,"path",M)):($r(this,"mnemonic",M),$r(this,"path",M.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return d5t(Sh([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",Lr(this.depth),this.parentFingerprint,Ys(Lr(this.index),4),this.chainCode,this.privateKey!=null?Sh(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new r(ig,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let a=this.path;a&&(a+="/"+(e&~Fy));let l=new Uint8Array(37);if(e&Fy){if(!this.privateKey)throw new Error("cannot derive child of neutered node");l.set(br(this.privateKey),1),a&&(a+="'")}else l.set(br(this.publicKey));for(let S=24;S>=0;S-=8)l[33+(S>>3)]=e>>24-S&255;let i=br(av(Ip.sha512,this.chainCode,l)),c=i.slice(0,32),b=i.slice(32),g=null,M=null;this.privateKey?g=MS(Ha.from(c).add(this.privateKey).mod(jie)):M=new vd(Lr(c))._addPoint(this.publicKey);let y=a,w=this.mnemonic;return w&&(y=Object.freeze({phrase:w.phrase,path:a,locale:w.locale||"en"})),new r(ig,g,M,this.fingerprint,MS(b),e,this.depth+1,y)}derivePath(e){let a=e.split("/");if(a.length===0||a[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);a[0]==="m"&&a.shift();let l=this;for(let i=0;i<a.length;i++){let c=a[i];if(c.match(/^[0-9]+'$/)){let b=parseInt(c.substring(0,c.length-1));if(b>=Fy)throw new Error("invalid path index - "+c);l=l._derive(Fy+b)}else if(c.match(/^[0-9]+$/)){let b=parseInt(c);if(b>=Fy)throw new Error("invalid path index - "+c);l=l._derive(b)}else throw new Error("invalid path component - "+c)}return l}static _fromSeed(e,a){let l=br(e);if(l.length<16||l.length>64)throw new Error("invalid seed");let i=br(av(Ip.sha512,zie,l));return new r(ig,MS(i.slice(0,32)),null,"0x00000000",MS(i.slice(32)),0,0,a)}static fromMnemonic(e,a,l){return l=GF(l),e=Hy(VF(e,l),l),r._fromSeed(Hie(e,a),{phrase:e,path:"m",locale:l.locale})}static fromSeed(e){return r._fromSeed(e,null)}static fromExtendedKey(e){let a=HF.decode(e);(a.length!==82||d5t(a.slice(0,78))!==e)&&_S.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let l=a[4],i=Lr(a.slice(5,9)),c=parseInt(Lr(a.slice(9,13)).substring(2),16),b=Lr(a.slice(13,45)),g=a.slice(45,78);switch(Lr(a.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new r(ig,null,Lr(g),i,b,c,l,null);case"0x0488ade4":case"0x04358394 ":if(g[0]!==0)break;return new r(ig,Lr(g.slice(1)),null,i,b,c,l,null)}return _S.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function Hie(r,e){e||(e="");let a=df("mnemonic"+e,sd.NFKD);return ov(df(r,sd.NFKD),a,2048,64,"sha512")}function VF(r,e){e=GF(e),_S.checkNormalize();let a=e.split(r);if(a.length%3!==0)throw new Error("invalid mnemonic");let l=br(new Uint8Array(Math.ceil(11*a.length/8))),i=0;for(let y=0;y<a.length;y++){let w=e.getWordIndex(a[y].normalize("NFKD"));if(w===-1)throw new Error("invalid mnemonic");for(let S=0;S<11;S++)w&1<<10-S&&(l[i>>3]|=1<<7-i%8),i++}let c=32*a.length/3,b=a.length/3,g=c5t(b);if((br(nv(l.slice(0,c/8)))[0]&g)!==(l[l.length-1]&g))throw new Error("invalid checksum");return Lr(l.slice(0,c/8))}function Hy(r,e){if(e=GF(e),r=br(r),r.length%4!==0||r.length<16||r.length>32)throw new Error("invalid entropy");let a=[0],l=11;for(let b=0;b<r.length;b++)l>8?(a[a.length-1]<<=8,a[a.length-1]|=r[b],l-=8):(a[a.length-1]<<=l,a[a.length-1]|=r[b]>>8-l,a.push(r[b]&Fie(8-l)),l+=3);let i=r.length/4,c=br(nv(r))[0]&c5t(i);return a[a.length-1]<<=i,a[a.length-1]|=c>>8-i,e.join(a.map(b=>e.getWord(b)))}Et();Rt();At();Et();Rt();At();Et();Rt();At();var p5t="random/5.8.0";var YF=new Br(p5t);function Kie(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var m5t=Kie(),SS=m5t.crypto||m5t.msCrypto;(!SS||!SS.getRandomValues)&&(YF.warn("WARNING: Missing strong random number source"),SS={getRandomValues:function(r){return YF.throwError("no secure random source avaialble",Br.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function Tp(r){(r<=0||r>1024||r%1||r!=r)&&YF.throwArgumentError("invalid length","length",r);let e=new Uint8Array(r);return SS.getRandomValues(e),br(e)}Et();Rt();At();Et();Rt();At();var QF=An(XF());Et();Rt();At();var xS="json-wallets/5.8.0";Et();Rt();At();function Pc(r){return typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),br(r)}function ng(r,e){for(r=String(r);r.length<e;)r="0"+r;return r}function Ky(r){return typeof r=="string"?df(r,sd.NFKC):br(r)}function Za(r,e){let a=r,l=e.toLowerCase().split("/");for(let i=0;i<l.length;i++){let c=null;for(let b in a)if(b.toLowerCase()===l[i]){c=a[b];break}if(c===null)return null;a=c}return a}function b5t(r){let e=br(r);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let a=Lr(e);return[a.substring(2,10),a.substring(10,14),a.substring(14,18),a.substring(18,22),a.substring(22,34)].join("-")}var Zie=new Br(xS),tH=class extends Q2{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function eH(r,e){let a=JSON.parse(r);e=Ky(e);let l=Js(Za(a,"ethaddr")),i=Pc(Za(a,"encseed"));(!i||i.length%16!==0)&&Zie.throwArgumentError("invalid encseed","json",r);let c=br(ov(e,e,2e3,32,"sha256")).slice(0,16),b=i.slice(0,16),g=i.slice(16),M=new QF.default.ModeOfOperation.cbc(c,b),y=QF.default.padding.pkcs7.strip(br(M.decrypt(g))),w="";for(let x=0;x<y.length;x++)w+=String.fromCharCode(y[x]);let S=df(w),_=Fa(S);return new tH({_isCrowdsaleAccount:!0,address:l,privateKey:_})}Et();Rt();At();function rH(r){let e=null;try{e=JSON.parse(r)}catch{return!1}return e.encseed&&e.ethaddr}function iH(r){let e=null;try{e=JSON.parse(r)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}Et();Rt();At();var Nc=An(XF()),ES=An(y5t());var Wie=function(r,e,a,l){function i(c){return c instanceof a?c:new a(function(b){b(c)})}return new(a||(a=Promise))(function(c,b){function g(w){try{y(l.next(w))}catch(S){b(S)}}function M(w){try{y(l.throw(w))}catch(S){b(S)}}function y(w){w.done?c(w.value):i(w.value).then(g,M)}y((l=l.apply(r,e||[])).next())})},aH=new Br(xS);function w5t(r){return r!=null&&r.mnemonic&&r.mnemonic.phrase}var oH=class extends Q2{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function Gie(r,e,a){if(Za(r,"crypto/cipher")==="aes-128-ctr"){let i=Pc(Za(r,"crypto/cipherparams/iv")),c=new Nc.default.Counter(i),b=new Nc.default.ModeOfOperation.ctr(e,c);return br(b.decrypt(a))}return null}function M5t(r,e){let a=Pc(Za(r,"crypto/ciphertext"));if(Lr(Fa(Sh([e.slice(16,32),a]))).substring(2)!==Za(r,"crypto/mac").toLowerCase())throw new Error("invalid password");let i=Gie(r,e.slice(0,16),a);i||aH.throwError("unsupported cipher",Br.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let c=e.slice(32,64),b=L0(i);if(r.address){let M=r.address.toLowerCase();if(M.substring(0,2)!=="0x"&&(M="0x"+M),Js(M)!==b)throw new Error("address mismatch")}let g={_isKeystoreAccount:!0,address:b,privateKey:Lr(i)};if(Za(r,"x-ethers/version")==="0.1"){let M=Pc(Za(r,"x-ethers/mnemonicCiphertext")),y=Pc(Za(r,"x-ethers/mnemonicCounter")),w=new Nc.default.Counter(y),S=new Nc.default.ModeOfOperation.ctr(c,w),_=Za(r,"x-ethers/path")||sv,x=Za(r,"x-ethers/locale")||"en",A=br(S.decrypt(M));try{let I=Hy(A,x),B=kp.fromMnemonic(I,null,x).derivePath(_);if(B.privateKey!=g.privateKey)throw new Error("mnemonic mismatch");g.mnemonic=B.mnemonic}catch(I){if(I.code!==Br.errors.INVALID_ARGUMENT||I.argument!=="wordlist")throw I}}return new oH(g)}function _5t(r,e,a,l,i){return br(ov(r,e,a,l,i))}function Vie(r,e,a,l,i){return Promise.resolve(_5t(r,e,a,l,i))}function S5t(r,e,a,l,i){let c=Ky(e),b=Za(r,"crypto/kdf");if(b&&typeof b=="string"){let g=function(M,y){return aH.throwArgumentError("invalid key-derivation function parameters",M,y)};if(b.toLowerCase()==="scrypt"){let M=Pc(Za(r,"crypto/kdfparams/salt")),y=parseInt(Za(r,"crypto/kdfparams/n")),w=parseInt(Za(r,"crypto/kdfparams/r")),S=parseInt(Za(r,"crypto/kdfparams/p"));(!y||!w||!S)&&g("kdf",b),(y&y-1)!==0&&g("N",y);let _=parseInt(Za(r,"crypto/kdfparams/dklen"));return _!==32&&g("dklen",_),l(c,M,y,w,S,64,i)}else if(b.toLowerCase()==="pbkdf2"){let M=Pc(Za(r,"crypto/kdfparams/salt")),y=null,w=Za(r,"crypto/kdfparams/prf");w==="hmac-sha256"?y="sha256":w==="hmac-sha512"?y="sha512":g("prf",w);let S=parseInt(Za(r,"crypto/kdfparams/c")),_=parseInt(Za(r,"crypto/kdfparams/dklen"));return _!==32&&g("dklen",_),a(c,M,S,_,y)}}return aH.throwArgumentError("unsupported key-derivation function","kdf",b)}function x5t(r,e){let a=JSON.parse(r),l=S5t(a,e,_5t,ES.default.syncScrypt);return M5t(a,l)}function E5t(r,e,a){return Wie(this,void 0,void 0,function*(){let l=JSON.parse(r),i=yield S5t(l,e,Vie,ES.default.scrypt,a);return M5t(l,i)})}function sH(r,e,a,l){try{if(Js(r.address)!==L0(r.privateKey))throw new Error("address/privateKey mismatch");if(w5t(r)){let B=r.mnemonic;if(kp.fromMnemonic(B.phrase,null,B.locale).derivePath(B.path||sv).privateKey!=r.privateKey)throw new Error("mnemonic mismatch")}}catch(B){return Promise.reject(B)}typeof a=="function"&&!l&&(l=a,a={}),a||(a={});let i=br(r.privateKey),c=Ky(e),b=null,g=null,M=null;if(w5t(r)){let B=r.mnemonic;b=br(VF(B.phrase,B.locale||"en")),g=B.path||sv,M=B.locale||"en"}let y=a.client;y||(y="ethers.js");let w=null;a.salt?w=br(a.salt):w=Tp(32);let S=null;if(a.iv){if(S=br(a.iv),S.length!==16)throw new Error("invalid iv")}else S=Tp(16);let _=null;if(a.uuid){if(_=br(a.uuid),_.length!==16)throw new Error("invalid uuid")}else _=Tp(16);let x=1<<17,A=8,I=1;return a.scrypt&&(a.scrypt.N&&(x=a.scrypt.N),a.scrypt.r&&(A=a.scrypt.r),a.scrypt.p&&(I=a.scrypt.p)),ES.default.scrypt(c,w,x,A,I,64,l).then(B=>{B=br(B);let P=B.slice(0,16),O=B.slice(16,32),C=B.slice(32,64),K=new Nc.default.Counter(S),W=new Nc.default.ModeOfOperation.ctr(P,K),J=br(W.encrypt(i)),U=Fa(Sh([O,J])),q={address:r.address.substring(2).toLowerCase(),id:b5t(_),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Lr(S).substring(2)},ciphertext:Lr(J).substring(2),kdf:"scrypt",kdfparams:{salt:Lr(w).substring(2),n:x,dklen:32,p:I,r:A},mac:U.substring(2)}};if(b){let V=Tp(16),h=new Nc.default.Counter(V),t=new Nc.default.ModeOfOperation.ctr(C,h),n=br(t.encrypt(b)),s=new Date,u=s.getUTCFullYear()+"-"+ng(s.getUTCMonth()+1,2)+"-"+ng(s.getUTCDate(),2)+"T"+ng(s.getUTCHours(),2)+"-"+ng(s.getUTCMinutes(),2)+"-"+ng(s.getUTCSeconds(),2)+".0Z";q["x-ethers"]={client:y,gethFilename:"UTC--"+u+"--"+q.address,mnemonicCounter:Lr(V).substring(2),mnemonicCiphertext:Lr(n).substring(2),path:g,locale:M,version:"0.1"}}return JSON.stringify(q)})}function A5t(r,e,a){if(rH(r)){a&&a(0);let l=eH(r,e);return a&&a(1),Promise.resolve(l)}return iH(r)?E5t(r,e,a):Promise.reject(new Error("invalid JSON wallet"))}function R5t(r,e){if(rH(r))return eH(r,e);if(iH(r))return x5t(r,e);throw new Error("invalid JSON wallet")}Et();Rt();At();var I5t="wallet/5.8.0";var k5t=function(r,e,a,l){function i(c){return c instanceof a?c:new a(function(b){b(c)})}return new(a||(a=Promise))(function(c,b){function g(w){try{y(l.next(w))}catch(S){b(S)}}function M(w){try{y(l.throw(w))}catch(S){b(S)}}function y(w){w.done?c(w.value):i(w.value).then(g,M)}y((l=l.apply(r,e||[])).next())})},ag=new Br(I5t);function Yie(r){return r!=null&&Ho(r.privateKey,32)&&r.address!=null}function Jie(r){let e=r.mnemonic;return e&&e.phrase}var og=class r extends gS{constructor(e,a){if(super(),Yie(e)){let l=new vd(e.privateKey);if($r(this,"_signingKey",()=>l),$r(this,"address",L0(this.publicKey)),this.address!==Js(e.address)&&ag.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),Jie(e)){let i=e.mnemonic;$r(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||sv,locale:i.locale||"en"}));let c=this.mnemonic,b=kp.fromMnemonic(c.phrase,null,c.locale).derivePath(c.path);L0(b.privateKey)!==this.address&&ag.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else $r(this,"_mnemonic",()=>null)}else{if(vd.isSigningKey(e))e.curve!=="secp256k1"&&ag.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),$r(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let l=new vd(e);$r(this,"_signingKey",()=>l)}$r(this,"_mnemonic",()=>null),$r(this,"address",L0(this.publicKey))}a&&!bS.isProvider(a)&&ag.throwArgumentError("invalid provider","provider",a),$r(this,"provider",a||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new r(this,e)}signTransaction(e){return Ic(e).then(a=>{a.from!=null&&(Js(a.from)!==this.address&&ag.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete a.from);let l=this._signingKey().signDigest(Fa(FF(a)));return FF(a,l)})}signMessage(e){return k5t(this,void 0,void 0,function*(){return vF(this._signingKey().signDigest(xp(e)))})}_signTypedData(e,a,l){return k5t(this,void 0,void 0,function*(){let i=yield tv.resolveNames(e,a,l,c=>(this.provider==null&&ag.throwError("cannot resolve ENS names without a provider",Br.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:c}),this.provider.resolveName(c)));return vF(this._signingKey().signDigest(tv.hash(i.domain,a,i.value)))})}encrypt(e,a,l){if(typeof a=="function"&&!l&&(l=a,a={}),l&&typeof l!="function")throw new Error("invalid callback");return a||(a={}),sH(this,e,a,l)}static createRandom(e){let a=Tp(16);e||(e={}),e.extraEntropy&&(a=br(Ac(Fa(Sh([a,e.extraEntropy])),0,16)));let l=Hy(a,e.locale);return r.fromMnemonic(l,e.path,e.locale)}static fromEncryptedJson(e,a,l){return A5t(e,a,l).then(i=>new r(i))}static fromEncryptedJsonSync(e,a){return new r(R5t(e,a))}static fromMnemonic(e,a,l){return a||(a=sv),new r(kp.fromMnemonic(e,null,l).derivePath(a))}};function T5t(r,e){return zF(xp(r),e)}function AS(r,e,a,l){return zF(tv.hash(r,e,a),l)}var fv=class{signer;publicKey;ownerLength=Zi[Hr.ETHEREUM].pubLength;signatureLength=Zi[Hr.ETHEREUM].sigLength;signatureType=Hr.ETHEREUM;constructor(e){this.signer=e.getSigner()}async setPublicKey(){let e="sign this message to connect to Bundlr.Network",a=await this.signer.signMessage(e),l=await xp(e),i=vS(br(l),a);this.publicKey=Ft.from(br(i))}async sign(e){this.publicKey||await this.setPublicKey();let a=await this.signer.signMessage(e);return Ft.from(a.slice(2),"hex")}static verify(e,a,l){let i=L0(e);return T5t(a,l)===i}};Et();Rt();At();var sg=An(D5t(),1),Oc=class extends wh{get publicKey(){return sg.default.decode(this.pk)}get key(){return sg.default.decode(this._key)}constructor(e){let a=sg.default.decode(e);super(sg.default.encode(a.subarray(0,32)),sg.default.encode(a.subarray(32,64)))}};Et();Rt();At();Et();Rt();At();Et();Rt();At();var U9t=An(Wh(),1),jK=An(EH(),1);Et();Rt();At();nh();var N9t=An(P9t(),1);function UK(r){return r=O9t(r),(0,N9t.default)("keccak256").update(r).digest()}function O9t(r){if(!Ft.isBuffer(r))if(Array.isArray(r))r=Ft.from(r);else if(typeof r=="string")C9t(r)?r=Ft.from(ux(L9t(r)),"hex"):r=Ft.from(r);else if(typeof r=="number")r=$9t(r);else if(typeof r=="bigint")r=qse(r);else if(r==null)r=Ft.allocUnsafe(0);else throw new Error("invalid type");return r}function C9t(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}function ux(r){if(typeof r!="string")throw new Error(`while padding to even, value must be string, is currently ${typeof r}, while padToEven.`);return r.length%2&&(r=`0${r}`),r}function L9t(r){return typeof r!="string"?r:D9t(r)?r.slice(2):r}function D9t(r){if(typeof r!="string")throw new Error("value must be type 'string', is currently type "+typeof r+", while checking isHexPrefixed.");return r.startsWith("0x")}function $9t(r){let e=q9t(r);return Ft.from(ux(e.slice(2)),"hex")}function q9t(r){return`0x${r.toString(16)}`}function qse(r){let e=r.toString(16);return Ft.from(ux(e),"hex")}typeof window<"u"&&(window.keccak256=UK);var a4=UK,Use={intToBuffer:$9t,intToHex:q9t,isHexPrefixed:D9t,stripHexPrefix:L9t,padToEven:ux,isHexString:C9t,toBuffer:O9t};var Sv=class{_key;ownerLength=Zi[Hr.ETHEREUM].pubLength;signatureLength=Zi[Hr.ETHEREUM].sigLength;signatureType=Hr.ETHEREUM;pk;constructor(e,a){this._key=e,this.pk=a.toString("hex")}get publicKey(){throw new Error("You must implement `publicKey`")}get key(){return Ft.from(this._key,"hex")}static async verify(e,a,l){let i=e;typeof e=="string"&&(i=U9t.default.toBuffer(e));let c=!1;try{c=jK.default.ecdsaVerify(l,a4(Ft.from(a)),i)}catch{}return c}async sign(e){return jK.default.ecdsaSign(a4(Ft.from(e)),Ft.from(this.key)).signature}};var zK=An(EH(),1),j9t=An(Wh(),1);var ks=class extends Sv{get publicKey(){return Ft.from(this.pk,"hex")}constructor(e){e.startsWith("0x")&&(e=e.slice(2));let a=Ft.from(e,"hex"),l=zK.default.publicKeyCreate(a,!1);super(e,Ft.from(l))}async sign(e){return new og(this._key).signMessage(e).then(l=>Ft.from(l.slice(2),"hex"))}static async verify(e,a,l){return zK.default.ecdsaVerify(l.length===65?l.slice(0,-1):l,br(xp(a)),typeof e=="string"?j9t.default.toBuffer(e):e)}};var o4=class extends ks{};Et();Rt();At();var s4=class extends Oc{constructor(e){super(e.replace("ed25519:",""))}};Et();Rt();At();var f4=class extends wh{get publicKey(){return Ft.from(this.pk)}get key(){return Ft.from(this._key)}constructor(e,a){super(e.subarray(0,32),a)}};Et();Rt();At();var xv=class extends J2{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(Ft.from(Ft.from(e).toString("hex")))}static async verify(e,a,l){return super.verify(e,Ft.from(Ft.from(a).toString("hex")),l)}};Et();Rt();At();var h4=class extends Oc{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(Ft.from(Ft.from(e).toString("hex")))}static async verify(e,a,l){return super.verify(e,Ft.from(Ft.from(a).toString("hex")),l)}};Et();Rt();At();var u4=class extends wh{constructor(e,a){super(e,a)}get publicKey(){return Ft.from(this.pk.slice(2),"hex")}get key(){return Ft.from(this._key.slice(2),"hex")}};Et();Rt();At();var Ev=class{_publicKey;ownerLength=Zi[Hr.INJECTEDAPTOS].pubLength;signatureLength=Zi[Hr.INJECTEDAPTOS].sigLength;signatureType=Hr.INJECTEDAPTOS;pem;provider;constructor(e,a){this.provider=e,this._publicKey=a}get publicKey(){return this._publicKey}async sign(e){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");let l=(await this.provider.signMessage({message:Ft.from(e).toString("hex"),nonce:"bundlr"})).signature;return typeof l=="string"?Ft.from(l,"hex"):l.data.toUint8Array()}static async verify(e,a,l){let i=e;return vp(Ft.from(l),Ft.from(`APTOS
58
58
  message: ${Ft.from(a).toString("hex")}
59
59
  nonce: bundlr`),Ft.from(i))}};Et();Rt();At();var Av=class{_publicKey;ownerLength=Zi[Hr.MULTIAPTOS].pubLength;signatureLength=Zi[Hr.MULTIAPTOS].sigLength;signatureType=Hr.MULTIAPTOS;collectSignatures;provider;constructor(e,a){this._publicKey=e,this.collectSignatures=a}get publicKey(){return this._publicKey}async sign(e){let{signatures:a,bitmap:l}=await this.collectSignatures(e),i=128,c=new Uint8Array([0,0,0,0]),b=new Set;l.forEach(y=>{if(y>=32)throw new Error(`Invalid bit value ${y}.`);if(b.has(y))throw new Error("Duplicated bits detected.");b.add(y);let w=Math.floor(y/8),S=c[w];S|=i>>y%8,c[w]=S});let g=Ft.alloc(this.signatureLength),M=0;for(let y=0;y<32;y++)l.includes(y)&&g.set(a[M++],y*64);return g.set(c,this.signatureLength-4),g}static async verify(e,a,l){let c=Zi[Hr.MULTIAPTOS].sigLength-4,b=l.slice(0,c),g=l.slice(c),M=!1;for(let y=0;y<32;y++){let w=Math.floor(y/8),S=y-w*8;if((g[w]&128>>S)!==0){let x=b.slice(y*64,(y+1)*64),A=e.slice(y*32,(y+1)*32);await vp(Ft.from(x),Ft.from(a),Ft.from(A))||(M=!0)}}return!M}};Et();Rt();At();var Rv=class extends ks{ownerLength=Zi[Hr.TYPEDETHEREUM].pubLength;signatureLength=Zi[Hr.TYPEDETHEREUM].sigLength;signatureType=Hr.TYPEDETHEREUM;address;signer;constructor(e){super(e),this.address="0x"+a4(super.publicKey.slice(1)).slice(-20).toString("hex"),this.signer=new og(e)}get publicKey(){return Ft.from(this.address)}async sign(e){let a=await this.signer._signTypedData(l4,d4,{address:this.address,"Transaction hash":e});return Ft.from(a.slice(2),"hex")}static async verify(e,a,l){let i=e.toString(),c=AS(l4,d4,{address:i,"Transaction hash":a},l);return i.toLowerCase()===c.toLowerCase()}},l4={name:"Bundlr",version:"1"},d4={Bundlr:[{name:"Transaction hash",type:"bytes"},{name:"address",type:"address"}]};Et();Rt();At();var FK=class{ownerLength=Zi[Hr.TYPEDETHEREUM].pubLength;signatureLength=Zi[Hr.TYPEDETHEREUM].sigLength;signatureType=Hr.TYPEDETHEREUM;address;signer;publicKey;constructor(e){this.signer=e.getSigner()}async ready(){this.address=(await this.signer.getAddress()).toString().toLowerCase(),this.publicKey=Ft.from(this.address)}async sign(e){let a=await this.signer._signTypedData(l4,d4,{address:this.address,"Transaction hash":e});return Ft.from(a.slice(2),"hex")}static verify(e,a,l){let i=e.toString(),c=AS(l4,d4,{address:i,"Transaction hash":a},l);return i.toLowerCase()===c.toLowerCase()}};Et();Rt();At();var z9t=An(Wh(),1);var sl=class{signer;publicKey;ownerLength=Zi[Hr.ARWEAVE].pubLength;signatureLength=Zi[Hr.ARWEAVE].sigLength;signatureType=Hr.ARWEAVE;constructor(e){this.signer=e}async setPublicKey(){let e=await this.signer.getActivePublicKey();this.publicKey=z9t.default.toBuffer(e)}async sign(e){this.publicKey||await this.setPublicKey();let a={name:"RSA-PSS",saltLength:32},l=await this.signer.signature(e,a);return new Uint8Array(Object.values(l).map(c=>+c))}static async verify(e,a,l){return await go().verify(e,a,l)}};Et();Rt();At();var c4=class extends ks{signatureType=Hr.KYVE};var p4={1:Vu,2:wh,3:ks,4:xv,5:Ev,6:Av,7:Rv};Et();Rt();At();Et();Rt();At();async function jse(r){return bp([(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(r.signatureType.toString()),r.rawOwner,r.rawTarget,r.rawAnchor,r.rawTags,r.rawData])}var m4=jse;Et();Rt();At();Et();Rt();At();function v4(r,e){let a=new Uint8Array(r);if(e<0)throw new Error("Array is unsigned, cannot represent -ve numbers");if(e>2**(r*8)-1)throw new Error(`Number ${e} is too large for an array of ${r} bytes`);for(let l=0;l<a.length;l++){let i=e&255;a[l]=i,e=(e-i)/256}return a}function lx(r){return v4(8,r)}function HK(r){return v4(2,r)}function zse(r){return v4(16,r)}function dx(r){return v4(32,r)}function lo(r){let e=0;for(let a=r.length-1;a>=0;a--)e=e*256+r[a];return e}Et();Rt();At();var g4=An(Wh(),1);Et();Rt();At();var F0=An(Wh(),1);nh();Et();Rt();At();var b4=class{buf;pos;constructor(e=Ft.alloc(cx),a=0){this.buf=e,this.pos=a}writeTags(e){if(!Array.isArray(e))throw new Error("input must be array");let a=e.length,l;if(a)for(this.writeLong(a),l=0;l<a;l++){let i=e[l];if(typeof i?.name!="string"||typeof i?.value!="string")throw new Error(`Invalid tag format for ${i}, expected {name:string, value: string}`);this.writeString(i.name),this.writeString(i.value)}this.writeLong(0)}toBuffer(){let e=Ft.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(e,0,0,this.pos),e}writeLong(e){let a=this.buf,l,i;if(e>=-1073741824&&e<1073741824){i=e>=0?e<<1:~e<<1|1;do a[this.pos]=i&127,i>>=7;while(i&&(a[this.pos++]|=128))}else{l=e>=0?e*2:-e*2-1;do a[this.pos]=l&127,l/=128;while(l>=1&&(a[this.pos++]|=128))}this.pos++,this.buf=a}writeString(e){let a=Ft.byteLength(e),l=this.buf;this.writeLong(a);let i=this.pos;if(this.pos+=a,!(this.pos>l.length)){if(a>64)this.buf.write(e,this.pos-a,a,"utf8");else{let c,b,g,M;for(c=0,b=a;c<b;c++)g=e.charCodeAt(c),g<128?l[i++]=g:g<2048?(l[i++]=g>>6|192,l[i++]=g&63|128):(g&64512)===55296&&((M=e.charCodeAt(c+1))&64512)===56320?(g=65536+((g&1023)<<10)+(M&1023),c++,l[i++]=g>>18|240,l[i++]=g>>12&63|128,l[i++]=g>>6&63|128,l[i++]=g&63|128):(l[i++]=g>>12|224,l[i++]=g>>6&63|128,l[i++]=g&63|128)}this.buf=l}}readLong(){let e=0,a=0,l=this.buf,i,c,b,g;do i=l[this.pos++],c=i&128,e|=(i&127)<<a,a+=7;while(c&&a<28);if(c){b=e,g=268435456;do i=l[this.pos++],b+=(i&127)*g,g*=128;while(i&128);return(b%2?-(b+1):b)/2}return e>>1^-(e&1)}skipLong(){let e=this.buf;for(;e[this.pos++]&128;);}readTags(){let e=[],a;for(;a=this.readLong();)for(a<0&&(a=-a,this.skipLong());a--;){let l=this.readString(),i=this.readString();e.push({name:l,value:i})}return e}readString(){let e=this.readLong(),a=this.pos,l=this.buf;if(this.pos+=e,this.pos>l.length)throw new Error("TAP Position out of range");return this.buf.slice(a,a+e).toString()}};function KK(r){if(r?.length===0)return Ft.allocUnsafe(0);let e=new b4;return e.writeTags(r),e.toBuffer()}function yg(r){return new b4(r).readTags()}rd();var px=80,cx=4096,wg=class r{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=lo(this.binary.subarray(0,2));if(Hr?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return r.verify(this.binary)}get id(){return F0.default.encode(this.rawId)}set id(e){this._id=F0.default.toBuffer(e)}get rawId(){return Zu("sha256").update(this.rawSignature).digest()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return F0.default.encode(this.rawSignature)}set rawOwner(e){if(e.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${e.byteLength} bytes.`);this.binary.set(e,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Zi[this.signatureType].sigLength}get owner(){return F0.default.encode(this.rawOwner)}get ownerLength(){return Zi[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):Ft.alloc(0)}get target(){return F0.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):Ft.alloc(0)}get anchor(){return F0.default.encode(this.rawAnchor)}get rawTags(){let e=this.getTagsStart(),a=lo(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+a)}get tags(){let e=this.getTagsStart();if(lo(this.binary.subarray(e,e+8))==0)return[];let l=lo(this.binary.subarray(e+8,e+16));return yg(Ft.from(this.binary.subarray(e+16,e+16+l)))}get tagsB64Url(){return this.tags.map(a=>({name:F0.default.encode(a.name),value:F0.default.encode(a.value)}))}getStartOfData(){let e=this.getTagsStart(),a=this.binary.subarray(e+8,e+16),l=lo(a);return e+16+l}get rawData(){let e=this.getTagsStart(),a=this.binary.subarray(e+8,e+16),l=lo(a),i=e+16+l;return this.binary.subarray(i,this.binary.length)}get data(){return F0.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await mx(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=Ft.from(await go().hash(e))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(e=>({name:F0.default.encode(e.name),value:F0.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<px)return!1;let a=new r(e),l=a.signatureType,i=a.getTagsStart(),c=lo(e.subarray(i,i+8)),b=e.subarray(i+8,i+16),g=lo(b);if(g>cx)return!1;if(c>0)try{if(yg(Ft.from(e.subarray(i+16,i+16+g))).length!==c)return!1}catch{return!1}let M=p4[l],y=await m4(a);return await M.verify(a.rawOwner,y,a.rawSignature)}async getSignatureData(){return m4(this)}getTagsStart(){let e=this.getTargetStart(),a=this.binary[e]==1,l=e+(a?33:1),i=this.binary[l]==1;return l+=i?33:1,l}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let e=this.getTargetStart()+1,a=this.binary[this.getTargetStart()]==1;return e+=a?32:0,e}},Mg=wg;rd();var Sd=32,vx=class{length;items;binary;constructor(e){this.binary=e,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(e){if(typeof e=="number"){if(e>=this.length)throw new RangeError("Index out of range");return this.getByIndex(e)}else return this.getById(e)}getSizes(){let e=[];for(let a=Sd;a<Sd+64*this.length;a+=64)e.push(lo(this.binary.subarray(a,a+32)));return e}getIds(){let e=[];for(let a=Sd;a<Sd+64*this.length;a+=64){let l=this.binary.subarray(a+32,a+64);if(l.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");e.push(g4.default.encode(l))}return e}getIdBy(e){if(e>this.length-1)throw new RangeError("Index of bundle out of range");let a=64+64*e;return g4.default.encode(this.binary.subarray(a,a+32))}async toTransaction(e,a,l){let i=await a.createTransaction({data:this.binary,...e},l);return i.addTag("Bundle-Format","binary"),i.addTag("Bundle-Version","2.0.0"),i}async verify(){for(let e of this.items){let a=await e.isValid(),l=(0,g4.default)(Zu("sha256").update(e.rawSignature).digest());if(!(a&&e.id===l))return!1}return!0}getOffset(e){let a=0;for(let l=Sd;l<Sd+64*this.length;l+=64){let i=lo(this.binary.subarray(l,l+32));a+=i;let c=this.binary.subarray(l+32,l+64);if(Ft.compare(c,e)===0)return{startOffset:a,size:i}}return{startOffset:-1,size:-1}}getByIndex(e){let a=0,l=this.getBundleStart(),i=0,c,b;for(let w=Sd;w<Sd+64*this.length;w+=64){if(c=lo(this.binary.subarray(w,w+32)),i++===e){b=this.binary.subarray(w+32,w+64);break}a+=c}let g=l+a,M=this.binary.subarray(g,g+c),y=new Mg(M);return y.rawId=b,y}getById(e){let a=g4.default.toBuffer(e),l=this.getOffset(a);if(l.startOffset===-1)throw new Error("Transaction not found");let c=this.getBundleStart()+l.startOffset;return new Mg(this.binary.subarray(c,c+l.size))}getDataItemCount(){return lo(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){let e=new Array(this.length),a=0,l=this.getBundleStart(),i=0;for(let c=Sd;c<Sd+64*this.length;c+=64){let b=lo(this.binary.subarray(c,c+32)),g=this.binary.subarray(c+32,c+64);if(g.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");let M=l+a,y=this.binary.subarray(M,M+b);a+=b;let w=new Mg(y);w.rawId=g,e[i]=w,i++}return e}},ZK=vx;function Fse(r){return new ZK(r)}async function Hse(r,e){let a=new Uint8Array(64*r.length),l=await Promise.all(r.map(async(c,b)=>{let g=c.isSigned()?c.rawId:await mx(c,e),M=new Uint8Array(64);return M.set(dx(c.getRaw().byteLength),0),M.set(g,32),a.set(M,64*b),c.getRaw()})).then(c=>Ft.concat(c)),i=Ft.concat([Ft.from(dx(r.length)),Ft.from(a),l]);return new ZK(i)}async function F9t(r,e){let a=await m4(r),l=await e.sign(a),i=await go().hash(l);return{signature:Ft.from(l),id:Ft.from(i)}}async function mx(r,e){let{signature:a,id:l}=await F9t(r,e);return r.getRaw().set(a,2),l}Et();Rt();At();var H9t=An(Wh(),1);function y4(r,e,a){let l=e.publicKey,i=a?.target?H9t.default.toBuffer(a.target):null,c=1+(i?.byteLength??0),b=a?.anchor?Ft.from(a.anchor):null,g=1+(b?.byteLength??0),M=(a?.tags?.length??0)>0?KK(a?.tags):null,y=16+(M?M.byteLength:0),w=typeof r=="string"?Ft.from(r):Ft.from(r),S=w.byteLength,_=2+e.signatureLength+e.ownerLength+c+g+y+S,x=Ft.alloc(_);if(x.set(HK(e.signatureType),0),x.set(new Uint8Array(e.signatureLength).fill(0),2),l.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${l.byteLength}`);x.set(l,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(x[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);x.set(i,A+1)}let I=A+c,B=I+1;if(x[I]=b?1:0,b){if(B+=b.byteLength,b.byteLength!==32)throw new Error("Anchor must be 32 bytes");x.set(b,I+1)}x.set(lx(a?.tags?.length??0),B);let P=lx(M?.byteLength??0);x.set(P,B+8),M&&x.set(M,B+16);let O=B+y;return x.set(w,O),new Mg(x)}Et();Rt();At();Et();Rt();At();var WK=class{signatureType;rawSignature;signature;signatureLength;rawOwner;owner;ownerLength;rawTarget;target;rawAnchor;anchor;rawTags;tags;rawData;data;static async verify(...e){throw new Error("You must implement `verify`")}};Et();Rt();At();Et();Rt();At();var bZ={};I1(bZ,{default:()=>Yse,processStream:()=>AMt,streamExportForTesting:()=>Jse,streamSigner:()=>Vse});Et();Rt();At();Et();Rt();At();X3();FS();Ww();xP();WS();QH();Vw();var VK={},K9t=!1;function po(){return K9t||(K9t=!0,VK={ArrayIsArray(r){return Array.isArray(r)},ArrayPrototypeIncludes(r,e){return r.includes(e)},ArrayPrototypeIndexOf(r,e){return r.indexOf(e)},ArrayPrototypeJoin(r,e){return r.join(e)},ArrayPrototypeMap(r,e){return r.map(e)},ArrayPrototypePop(r,e){return r.pop(e)},ArrayPrototypePush(r,e){return r.push(e)},ArrayPrototypeSlice(r,e,a){return r.slice(e,a)},Error,FunctionPrototypeCall(r,e,...a){return r.call(e,...a)},FunctionPrototypeSymbolHasInstance(r,e){return Function.prototype[Symbol.hasInstance].call(r,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(r,e){return Object.defineProperties(r,e)},ObjectDefineProperty(r,e,a){return Object.defineProperty(r,e,a)},ObjectGetOwnPropertyDescriptor(r,e){return Object.getOwnPropertyDescriptor(r,e)},ObjectKeys(r){return Object.keys(r)},ObjectSetPrototypeOf(r,e){return Object.setPrototypeOf(r,e)},Promise,PromisePrototypeCatch(r,e){return r.catch(e)},PromisePrototypeThen(r,e,a){return r.then(e,a)},PromiseReject(r){return Promise.reject(r)},PromiseResolve(r){return Promise.resolve(r)},ReflectApply:Reflect.apply,RegExpPrototypeTest(r,e){return r.test(e)},SafeSet:Set,String,StringPrototypeSlice(r,e,a){return r.slice(e,a)},StringPrototypeToLowerCase(r){return r.toLowerCase()},StringPrototypeToUpperCase(r){return r.toUpperCase()},StringPrototypeTrim(r){return r.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(r,e,a){return r.set(e,a)},Boolean,Uint8Array}),VK}var w4={},Z9t=!1;function _4(){if(Z9t)return w4;Z9t=!0;let{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return w4=r,w4.AbortSignal=e,w4.default=r,w4}var bx={},W9t=!1;function cf(){if(W9t)return bx;W9t=!0;let r=Rn(),{kResistStopPropagation:e,SymbolDispose:a}=po(),l=globalThis.AbortSignal||_4().AbortSignal,i=globalThis.AbortController||_4().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,b=globalThis.Blob||r.Blob,g=typeof b<"u"?function(_){return _ instanceof b}:function(_){return!1},M=(S,_)=>{if(S!==void 0&&(S===null||typeof S!="object"||!("aborted"in S)))throw new ERR_INVALID_ARG_TYPE(_,"AbortSignal",S)},y=(S,_)=>{if(typeof S!="function")throw new ERR_INVALID_ARG_TYPE(_,"Function",S)};class w extends Error{constructor(_){if(!Array.isArray(_))throw new TypeError(`Expected input to be an Array, got ${typeof _}`);let x="";for(let A=0;A<_.length;A++)x+=` ${_[A].stack}
60
- `;super(x),this.name="AggregateError",this.errors=_}}return bx={AggregateError:w,kEmptyObject:Object.freeze({}),once(S){let _=!1;return function(...x){_||(_=!0,S.apply(this,x))}},createDeferredPromise:function(){let S,_;return{promise:new Promise((A,I)=>{S=A,_=I}),resolve:S,reject:_}},promisify(S){return new Promise((_,x)=>{S((A,...I)=>A?x(A):_(...I))})},debuglog(){return function(){}},format(S,..._){return S.replace(/%([sdifj])/g,function(...[x,A]){let I=_.shift();return A==="f"?I.toFixed(6):A==="j"?JSON.stringify(I):A==="s"&&typeof I=="object"?`${I.constructor!==Object?I.constructor.name:""} {}`.trim():I.toString()})},inspect(S){switch(typeof S){case"string":if(S.includes("'"))if(S.includes('"')){if(!S.includes("`")&&!S.includes("${"))return`\`${S}\``}else return`"${S}"`;return`'${S}'`;case"number":return isNaN(S)?"NaN":Object.is(S,-0)?String(S):S;case"bigint":return`${String(S)}n`;case"boolean":case"undefined":return String(S);case"object":return"{}"}},types:{isAsyncFunction(S){return S instanceof c},isArrayBufferView(S){return ArrayBuffer.isView(S)}},isBlob:g,deprecate(S,_){return S},addAbortListener:wd.addAbortListener||function(_,x){if(_===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",_);M(_,"signal"),y(x,"listener");let A;return _.aborted?queueMicrotask(()=>x()):(_.addEventListener("abort",x,{__proto__:null,once:!0,[e]:!0}),A=()=>{_.removeEventListener("abort",x)}),{__proto__:null,[a](){var I;(I=A)===null||I===void 0||I()}}},AbortSignalAny:l.any||function(_){if(_.length===1)return _[0];let x=new i,A=()=>x.abort();return _.forEach(I=>{M(I,"signals"),I.addEventListener("abort",A,{once:!0})}),x.signal.addEventListener("abort",()=>{_.forEach(I=>I.removeEventListener("abort",A))},{once:!0}),x.signal}},bx.promisify.custom=Symbol.for("nodejs.util.promisify.custom"),bx}var YK={},G9t=!1;function $f(){if(G9t)return YK;G9t=!0;let{format:r,inspect:e,AggregateError:a}=cf(),l=globalThis.AggregateError||a,i=Symbol("kIsNodeError"),c=["string","function","number","object","Function","Object","boolean","bigint","symbol"],b=/^([A-Z][a-z0-9]*)+$/,g="__node_internal_",M={};function y(B,P){if(!B)throw new M.ERR_INTERNAL_ASSERTION(P)}function w(B){let P="",O=B.length,C=B[0]==="-"?1:0;for(;O>=C+4;O-=3)P=`_${B.slice(O-3,O)}${P}`;return`${B.slice(0,O)}${P}`}function S(B,P,O){if(typeof P=="function")return y(P.length<=O.length,`Code: ${B}; The provided arguments length (${O.length}) does not match the required ones (${P.length}).`),P(...O);let C=(P.match(/%[dfijoOs]/g)||[]).length;return y(C===O.length,`Code: ${B}; The provided arguments length (${O.length}) does not match the required ones (${C}).`),O.length===0?P:r(P,...O)}function _(B,P,O){O||(O=Error);class C extends O{constructor(...W){super(S(B,P,W))}toString(){return`${this.name} [${B}]: ${this.message}`}}Object.defineProperties(C.prototype,{name:{value:O.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${B}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),C.prototype.code=B,C.prototype[i]=!0,M[B]=C}function x(B){let P=g+B.name;return Object.defineProperty(B,"name",{value:P}),B}function A(B,P){if(B&&P&&B!==P){if(Array.isArray(P.errors))return P.errors.push(B),P;let O=new l([P,B],P.message);return O.code=P.code,O}return B||P}class I extends Error{constructor(P="The operation was aborted",O=void 0){if(O!==void 0&&typeof O!="object")throw new M.ERR_INVALID_ARG_TYPE("options","Object",O);super(P,O),this.code="ABORT_ERR",this.name="AbortError"}}return _("ERR_ASSERTION","%s",Error),_("ERR_INVALID_ARG_TYPE",(B,P,O)=>{y(typeof B=="string","'name' must be a string"),Array.isArray(P)||(P=[P]);let C="The ";B.endsWith(" argument")?C+=`${B} `:C+=`"${B}" ${B.includes(".")?"property":"argument"} `,C+="must be ";let K=[],W=[],J=[];for(let q of P)y(typeof q=="string","All expected entries have to be of type string"),c.includes(q)?K.push(q.toLowerCase()):b.test(q)?W.push(q):(y(q!=="object",'The value "object" should be written as "Object"'),J.push(q));if(W.length>0){let q=K.indexOf("object");q!==-1&&(K.splice(K,q,1),W.push("Object"))}if(K.length>0){switch(K.length){case 1:C+=`of type ${K[0]}`;break;case 2:C+=`one of type ${K[0]} or ${K[1]}`;break;default:{let q=K.pop();C+=`one of type ${K.join(", ")}, or ${q}`}}(W.length>0||J.length>0)&&(C+=" or ")}if(W.length>0){switch(W.length){case 1:C+=`an instance of ${W[0]}`;break;case 2:C+=`an instance of ${W[0]} or ${W[1]}`;break;default:{let q=W.pop();C+=`an instance of ${W.join(", ")}, or ${q}`}}J.length>0&&(C+=" or ")}switch(J.length){case 0:break;case 1:J[0].toLowerCase()!==J[0]&&(C+="an "),C+=`${J[0]}`;break;case 2:C+=`one of ${J[0]} or ${J[1]}`;break;default:{let q=J.pop();C+=`one of ${J.join(", ")}, or ${q}`}}if(O==null)C+=`. Received ${O}`;else if(typeof O=="function"&&O.name)C+=`. Received function ${O.name}`;else if(typeof O=="object"){var U;if((U=O.constructor)!==null&&U!==void 0&&U.name)C+=`. Received an instance of ${O.constructor.name}`;else{let q=e(O,{depth:-1});C+=`. Received ${q}`}}else{let q=e(O,{colors:!1});q.length>25&&(q=`${q.slice(0,25)}...`),C+=`. Received type ${typeof O} (${q})`}return C},TypeError),_("ERR_INVALID_ARG_VALUE",(B,P,O="is invalid")=>{let C=e(P);return C.length>128&&(C=C.slice(0,128)+"..."),`The ${B.includes(".")?"property":"argument"} '${B}' ${O}. Received ${C}`},TypeError),_("ERR_INVALID_RETURN_VALUE",(B,P,O)=>{var C;let K=O!=null&&(C=O.constructor)!==null&&C!==void 0&&C.name?`instance of ${O.constructor.name}`:`type ${typeof O}`;return`Expected ${B} to be returned from the "${P}" function but got ${K}.`},TypeError),_("ERR_MISSING_ARGS",(...B)=>{y(B.length>0,"At least one arg needs to be specified");let P,O=B.length;switch(B=(Array.isArray(B)?B:[B]).map(C=>`"${C}"`).join(" or "),O){case 1:P+=`The ${B[0]} argument`;break;case 2:P+=`The ${B[0]} and ${B[1]} arguments`;break;default:{let C=B.pop();P+=`The ${B.join(", ")}, and ${C} arguments`}break}return`${P} must be specified`},TypeError),_("ERR_OUT_OF_RANGE",(B,P,O)=>{y(P,'Missing "range" argument');let C;return Number.isInteger(O)&&Math.abs(O)>2**32?C=w(String(O)):typeof O=="bigint"?(C=String(O),(O>2n**32n||O<-(2n**32n))&&(C=w(C)),C+="n"):C=e(O),`The value of "${B}" is out of range. It must be ${P}. Received ${C}`},RangeError),_("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),_("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),_("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),_("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),_("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),_("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),_("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),_("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),_("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),_("ERR_STREAM_WRITE_AFTER_END","write after end",Error),_("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),YK={AbortError:I,aggregateTwoErrors:x(A),hideStackFrames:x,codes:M},YK}var JK={},V9t=!1;function S4(){if(V9t)return JK;V9t=!0;let{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:a,ArrayPrototypeMap:l,NumberIsInteger:i,NumberIsNaN:c,NumberMAX_SAFE_INTEGER:b,NumberMIN_SAFE_INTEGER:g,NumberParseInt:M,ObjectPrototypeHasOwnProperty:y,RegExpPrototypeExec:w,String:S,StringPrototypeToUpperCase:_,StringPrototypeTrim:x}=po(),{hideStackFrames:A,codes:{ERR_SOCKET_BAD_PORT:I,ERR_INVALID_ARG_TYPE:B,ERR_INVALID_ARG_VALUE:P,ERR_OUT_OF_RANGE:O,ERR_UNKNOWN_SIGNAL:C}}=$f(),{normalizeEncoding:K}=cf(),{isAsyncFunction:W,isArrayBufferView:J}=cf().types,U={};function q(ct){return ct===(ct|0)}function V(ct){return ct===ct>>>0}let h=/^[0-7]+$/,t="must be a 32-bit unsigned integer or an octal string";function n(ct,st,wt){if(typeof ct>"u"&&(ct=wt),typeof ct=="string"){if(w(h,ct)===null)throw new P(st,ct,t);ct=M(ct,8)}return d(ct,st),ct}let s=A((ct,st,wt=g,St=b)=>{if(typeof ct!="number")throw new B(st,"number",ct);if(!i(ct))throw new O(st,"an integer",ct);if(ct<wt||ct>St)throw new O(st,`>= ${wt} && <= ${St}`,ct)}),u=A((ct,st,wt=-2147483648,St=2147483647)=>{if(typeof ct!="number")throw new B(st,"number",ct);if(!i(ct))throw new O(st,"an integer",ct);if(ct<wt||ct>St)throw new O(st,`>= ${wt} && <= ${St}`,ct)}),d=A((ct,st,wt=!1)=>{if(typeof ct!="number")throw new B(st,"number",ct);if(!i(ct))throw new O(st,"an integer",ct);let St=wt?1:0,ut=4294967295;if(ct<St||ct>ut)throw new O(st,`>= ${St} && <= ${ut}`,ct)});function v(ct,st){if(typeof ct!="string")throw new B(st,"string",ct)}function p(ct,st,wt=void 0,St){if(typeof ct!="number")throw new B(st,"number",ct);if(wt!=null&&ct<wt||St!=null&&ct>St||(wt!=null||St!=null)&&c(ct))throw new O(st,`${wt!=null?`>= ${wt}`:""}${wt!=null&&St!=null?" && ":""}${St!=null?`<= ${St}`:""}`,ct)}let f=A((ct,st,wt)=>{if(!e(wt,ct)){let ut="must be one of: "+a(l(wt,It=>typeof It=="string"?`'${It}'`:S(It)),", ");throw new P(st,ct,ut)}});function o(ct,st){if(typeof ct!="boolean")throw new B(st,"boolean",ct)}function m(ct,st,wt){return ct==null||!y(ct,st)?wt:ct[st]}let E=A((ct,st,wt=null)=>{let St=m(wt,"allowArray",!1),ut=m(wt,"allowFunction",!1);if(!m(wt,"nullable",!1)&&ct===null||!St&&r(ct)||typeof ct!="object"&&(!ut||typeof ct!="function"))throw new B(st,"Object",ct)}),R=A((ct,st)=>{if(ct!=null&&typeof ct!="object"&&typeof ct!="function")throw new B(st,"a dictionary",ct)}),k=A((ct,st,wt=0)=>{if(!r(ct))throw new B(st,"Array",ct);if(ct.length<wt){let St=`must be longer than ${wt}`;throw new P(st,ct,St)}});function L(ct,st){k(ct,st);for(let wt=0;wt<ct.length;wt++)v(ct[wt],`${st}[${wt}]`)}function z(ct,st){k(ct,st);for(let wt=0;wt<ct.length;wt++)o(ct[wt],`${st}[${wt}]`)}function it(ct,st){k(ct,st);for(let wt=0;wt<ct.length;wt++){let St=ct[wt],ut=`${st}[${wt}]`;if(St==null)throw new B(ut,"AbortSignal",St);Q(St,ut)}}function G(ct,st="signal"){if(v(ct,st),U[ct]===void 0)throw U[_(ct)]!==void 0?new C(ct+" (signals must use all capital letters)"):new C(ct)}let $=A((ct,st="buffer")=>{if(!J(ct))throw new B(st,["Buffer","TypedArray","DataView"],ct)});function Z(ct,st){let wt=K(st),St=ct.length;if(wt==="hex"&&St%2!==0)throw new P("encoding",st,`is invalid for data of length ${St}`)}function rt(ct,st="Port",wt=!0){if(typeof ct!="number"&&typeof ct!="string"||typeof ct=="string"&&x(ct).length===0||+ct!==+ct>>>0||ct>65535||ct===0&&!wt)throw new I(st,ct,wt);return ct|0}let Q=A((ct,st)=>{if(ct!==void 0&&(ct===null||typeof ct!="object"||!("aborted"in ct)))throw new B(st,"AbortSignal",ct)}),H=A((ct,st)=>{if(typeof ct!="function")throw new B(st,"Function",ct)}),F=A((ct,st)=>{if(typeof ct!="function"||W(ct))throw new B(st,"Function",ct)}),Y=A((ct,st)=>{if(ct!==void 0)throw new B(st,"undefined",ct)});function at(ct,st,wt){if(!e(wt,ct))throw new B(st,`('${a(wt,"|")}')`,ct)}let ht=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function et(ct,st){if(typeof ct>"u"||!w(ht,ct))throw new P(st,ct,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ft(ct){if(typeof ct=="string")return et(ct,"hints"),ct;if(r(ct)){let st=ct.length,wt="";if(st===0)return wt;for(let St=0;St<st;St++){let ut=ct[St];et(ut,"hints"),wt+=ut,St!==st-1&&(wt+=", ")}return wt}throw new P("hints",ct,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return JK={isInt32:q,isUint32:V,parseFileMode:n,validateArray:k,validateStringArray:L,validateBooleanArray:z,validateAbortSignalArray:it,validateBoolean:o,validateBuffer:$,validateDictionary:R,validateEncoding:Z,validateFunction:H,validateInt32:u,validateInteger:s,validateNumber:p,validateObject:E,validateOneOf:f,validatePlainFunction:F,validatePort:rt,validateSignalName:G,validateString:v,validateUint32:d,validateUndefined:Y,validateUnion:at,validateAbortSignal:Q,validateLinkHeaderValue:ft},JK}var XK={},Y9t=!1;function $c(){if(Y9t)return XK;Y9t=!0;let{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:a}=po(),l=a("nodejs.stream.destroyed"),i=a("nodejs.stream.errored"),c=a("nodejs.stream.readable"),b=a("nodejs.stream.writable"),g=a("nodejs.stream.disturbed"),M=a("nodejs.webstream.isClosedPromise"),y=a("nodejs.webstream.controllerErrorFunction");function w(m,E=!1){var R;return!!(m&&typeof m.pipe=="function"&&typeof m.on=="function"&&(!E||typeof m.pause=="function"&&typeof m.resume=="function")&&(!m._writableState||((R=m._readableState)===null||R===void 0?void 0:R.readable)!==!1)&&(!m._writableState||m._readableState))}function S(m){var E;return!!(m&&typeof m.write=="function"&&typeof m.on=="function"&&(!m._readableState||((E=m._writableState)===null||E===void 0?void 0:E.writable)!==!1))}function _(m){return!!(m&&typeof m.pipe=="function"&&m._readableState&&typeof m.on=="function"&&typeof m.write=="function")}function x(m){return m&&(m._readableState||m._writableState||typeof m.write=="function"&&typeof m.on=="function"||typeof m.pipe=="function"&&typeof m.on=="function")}function A(m){return!!(m&&!x(m)&&typeof m.pipeThrough=="function"&&typeof m.getReader=="function"&&typeof m.cancel=="function")}function I(m){return!!(m&&!x(m)&&typeof m.getWriter=="function"&&typeof m.abort=="function")}function B(m){return!!(m&&!x(m)&&typeof m.readable=="object"&&typeof m.writable=="object")}function P(m){return A(m)||I(m)||B(m)}function O(m,E){return m==null?!1:E===!0?typeof m[r]=="function":E===!1?typeof m[e]=="function":typeof m[r]=="function"||typeof m[e]=="function"}function C(m){if(!x(m))return null;let E=m._writableState,R=m._readableState,k=E||R;return!!(m.destroyed||m[l]||k!=null&&k.destroyed)}function K(m){if(!S(m))return null;if(m.writableEnded===!0)return!0;let E=m._writableState;return E!=null&&E.errored?!1:typeof E?.ended!="boolean"?null:E.ended}function W(m,E){if(!S(m))return null;if(m.writableFinished===!0)return!0;let R=m._writableState;return R!=null&&R.errored?!1:typeof R?.finished!="boolean"?null:!!(R.finished||E===!1&&R.ended===!0&&R.length===0)}function J(m){if(!w(m))return null;if(m.readableEnded===!0)return!0;let E=m._readableState;return!E||E.errored?!1:typeof E?.ended!="boolean"?null:E.ended}function U(m,E){if(!w(m))return null;let R=m._readableState;return R!=null&&R.errored?!1:typeof R?.endEmitted!="boolean"?null:!!(R.endEmitted||E===!1&&R.ended===!0&&R.length===0)}function q(m){return m&&m[c]!=null?m[c]:typeof m?.readable!="boolean"?null:C(m)?!1:w(m)&&m.readable&&!U(m)}function V(m){return m&&m[b]!=null?m[b]:typeof m?.writable!="boolean"?null:C(m)?!1:S(m)&&m.writable&&!K(m)}function h(m,E){return x(m)?C(m)?!0:!(E?.readable!==!1&&q(m)||E?.writable!==!1&&V(m)):null}function t(m){var E,R;return x(m)?m.writableErrored?m.writableErrored:(E=(R=m._writableState)===null||R===void 0?void 0:R.errored)!==null&&E!==void 0?E:null:null}function n(m){var E,R;return x(m)?m.readableErrored?m.readableErrored:(E=(R=m._readableState)===null||R===void 0?void 0:R.errored)!==null&&E!==void 0?E:null:null}function s(m){if(!x(m))return null;if(typeof m.closed=="boolean")return m.closed;let E=m._writableState,R=m._readableState;return typeof E?.closed=="boolean"||typeof R?.closed=="boolean"?E?.closed||R?.closed:typeof m._closed=="boolean"&&u(m)?m._closed:null}function u(m){return typeof m._closed=="boolean"&&typeof m._defaultKeepAlive=="boolean"&&typeof m._removedConnection=="boolean"&&typeof m._removedContLen=="boolean"}function d(m){return typeof m._sent100=="boolean"&&u(m)}function v(m){var E;return typeof m._consuming=="boolean"&&typeof m._dumped=="boolean"&&((E=m.req)===null||E===void 0?void 0:E.upgradeOrConnect)===void 0}function p(m){if(!x(m))return null;let E=m._writableState,R=m._readableState,k=E||R;return!k&&d(m)||!!(k&&k.autoDestroy&&k.emitClose&&k.closed===!1)}function f(m){var E;return!!(m&&((E=m[g])!==null&&E!==void 0?E:m.readableDidRead||m.readableAborted))}function o(m){var E,R,k,L,z,it,G,$,Z,rt;return!!(m&&((E=(R=(k=(L=(z=(it=m[i])!==null&&it!==void 0?it:m.readableErrored)!==null&&z!==void 0?z:m.writableErrored)!==null&&L!==void 0?L:(G=m._readableState)===null||G===void 0?void 0:G.errorEmitted)!==null&&k!==void 0?k:($=m._writableState)===null||$===void 0?void 0:$.errorEmitted)!==null&&R!==void 0?R:(Z=m._readableState)===null||Z===void 0?void 0:Z.errored)!==null&&E!==void 0?E:!((rt=m._writableState)===null||rt===void 0)&&rt.errored))}return XK={isDestroyed:C,kIsDestroyed:l,isDisturbed:f,kIsDisturbed:g,isErrored:o,kIsErrored:i,isReadable:q,kIsReadable:c,kIsClosedPromise:M,kControllerErrorFunction:y,kIsWritable:b,isClosed:s,isDuplexNodeStream:_,isFinished:h,isIterable:O,isReadableNodeStream:w,isReadableStream:A,isReadableEnded:J,isReadableFinished:U,isReadableErrored:n,isNodeStream:x,isWebStream:P,isWritable:V,isWritableNodeStream:S,isWritableStream:I,isWritableEnded:K,isWritableFinished:W,isWritableErrored:t,isServerRequest:v,isServerResponse:d,willEmitClose:p,isTransformStream:B},XK}var gx={},J9t=!1;function jp(){if(J9t)return gx;J9t=!0;let r=Jo,{AbortError:e,codes:a}=$f(),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_PREMATURE_CLOSE:i}=a,{kEmptyObject:c,once:b}=cf(),{validateAbortSignal:g,validateFunction:M,validateObject:y,validateBoolean:w}=S4(),{Promise:S,PromisePrototypeThen:_,SymbolDispose:x}=po(),{isClosed:A,isReadable:I,isReadableNodeStream:B,isReadableStream:P,isReadableFinished:O,isReadableErrored:C,isWritable:K,isWritableNodeStream:W,isWritableStream:J,isWritableFinished:U,isWritableErrored:q,isNodeStream:V,willEmitClose:h,kIsClosedPromise:t}=$c(),n;function s(f){return f.setHeader&&typeof f.abort=="function"}let u=()=>{};function d(f,o,m){var E,R;if(arguments.length===2?(m=o,o=c):o==null?o=c:y(o,"options"),M(m,"callback"),g(o.signal,"options.signal"),m=b(m),P(f)||J(f))return v(f,o,m);if(!V(f))throw new l("stream",["ReadableStream","WritableStream","Stream"],f);let k=(E=o.readable)!==null&&E!==void 0?E:B(f),L=(R=o.writable)!==null&&R!==void 0?R:W(f),z=f._writableState,it=f._readableState,G=()=>{f.writable||rt()},$=h(f)&&B(f)===k&&W(f)===L,Z=U(f,!1),rt=()=>{Z=!0,f.destroyed&&($=!1),!($&&(!f.readable||k))&&(!k||Q)&&m.call(f)},Q=O(f,!1),H=()=>{Q=!0,f.destroyed&&($=!1),!($&&(!f.writable||L))&&(!L||Z)&&m.call(f)},F=ct=>{m.call(f,ct)},Y=A(f),at=()=>{Y=!0;let ct=q(f)||C(f);if(ct&&typeof ct!="boolean")return m.call(f,ct);if(k&&!Q&&B(f,!0)&&!O(f,!1))return m.call(f,new i);if(L&&!Z&&!U(f,!1))return m.call(f,new i);m.call(f)},ht=()=>{Y=!0;let ct=q(f)||C(f);if(ct&&typeof ct!="boolean")return m.call(f,ct);m.call(f)},et=()=>{f.req.on("finish",rt)};s(f)?(f.on("complete",rt),$||f.on("abort",at),f.req?et():f.on("request",et)):L&&!z&&(f.on("end",G),f.on("close",G)),!$&&typeof f.aborted=="boolean"&&f.on("aborted",at),f.on("end",H),f.on("finish",rt),o.error!==!1&&f.on("error",F),f.on("close",at),Y?r.nextTick(at):z!=null&&z.errorEmitted||it!=null&&it.errorEmitted?$||r.nextTick(ht):(!k&&(!$||I(f))&&(Z||K(f)===!1)||!L&&(!$||K(f))&&(Q||I(f)===!1)||it&&f.req&&f.aborted)&&r.nextTick(ht);let ft=()=>{m=u,f.removeListener("aborted",at),f.removeListener("complete",rt),f.removeListener("abort",at),f.removeListener("request",et),f.req&&f.req.removeListener("finish",rt),f.removeListener("end",G),f.removeListener("close",G),f.removeListener("finish",rt),f.removeListener("end",H),f.removeListener("error",F),f.removeListener("close",at)};if(o.signal&&!Y){let ct=()=>{let st=m;ft(),st.call(f,new e(void 0,{cause:o.signal.reason}))};if(o.signal.aborted)r.nextTick(ct);else{n=n||cf().addAbortListener;let st=n(o.signal,ct),wt=m;m=b((...St)=>{st[x](),wt.apply(f,St)})}}return ft}function v(f,o,m){let E=!1,R=u;if(o.signal)if(R=()=>{E=!0,m.call(f,new e(void 0,{cause:o.signal.reason}))},o.signal.aborted)r.nextTick(R);else{n=n||cf().addAbortListener;let L=n(o.signal,R),z=m;m=b((...it)=>{L[x](),z.apply(f,it)})}let k=(...L)=>{E||r.nextTick(()=>m.apply(f,L))};return _(f[t].promise,k,k),u}function p(f,o){var m;let E=!1;return o===null&&(o=c),(m=o)!==null&&m!==void 0&&m.cleanup&&(w(o.cleanup,"cleanup"),E=o.cleanup),new S((R,k)=>{let L=d(f,o,z=>{E&&L(),z?k(z):R()})})}return gx=d,gx.finished=p,gx}var QK={},X9t=!1;function _g(){if(X9t)return QK;X9t=!0;let r=Jo,{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:a},AbortError:l}=$f(),{Symbol:i}=po(),{kIsDestroyed:c,isDestroyed:b,isFinished:g,isServerRequest:M}=$c(),y=i("kDestroy"),w=i("kConstruct");function S(h,t,n){h&&(h.stack,t&&!t.errored&&(t.errored=h),n&&!n.errored&&(n.errored=h))}function _(h,t){let n=this._readableState,s=this._writableState,u=s||n;return s!=null&&s.destroyed||n!=null&&n.destroyed?(typeof t=="function"&&t(),this):(S(h,s,n),s&&(s.destroyed=!0),n&&(n.destroyed=!0),u.constructed?x(this,h,t):this.once(y,function(d){x(this,e(d,h),t)}),this)}function x(h,t,n){let s=!1;function u(d){if(s)return;s=!0;let v=h._readableState,p=h._writableState;S(d,p,v),p&&(p.closed=!0),v&&(v.closed=!0),typeof n=="function"&&n(d),d?r.nextTick(A,h,d):r.nextTick(I,h)}try{h._destroy(t||null,u)}catch(d){u(d)}}function A(h,t){B(h,t),I(h)}function I(h){let t=h._readableState,n=h._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&h.emit("close")}function B(h,t){let n=h._readableState,s=h._writableState;s!=null&&s.errorEmitted||n!=null&&n.errorEmitted||(s&&(s.errorEmitted=!0),n&&(n.errorEmitted=!0),h.emit("error",t))}function P(){let h=this._readableState,t=this._writableState;h&&(h.constructed=!0,h.closed=!1,h.closeEmitted=!1,h.destroyed=!1,h.errored=null,h.errorEmitted=!1,h.reading=!1,h.ended=h.readable===!1,h.endEmitted=h.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function O(h,t,n){let s=h._readableState,u=h._writableState;if(u!=null&&u.destroyed||s!=null&&s.destroyed)return this;s!=null&&s.autoDestroy||u!=null&&u.autoDestroy?h.destroy(t):t&&(t.stack,u&&!u.errored&&(u.errored=t),s&&!s.errored&&(s.errored=t),n?r.nextTick(B,h,t):B(h,t))}function C(h,t){if(typeof h._construct!="function")return;let n=h._readableState,s=h._writableState;n&&(n.constructed=!1),s&&(s.constructed=!1),h.once(w,t),!(h.listenerCount(w)>1)&&r.nextTick(K,h)}function K(h){let t=!1;function n(s){if(t){O(h,s??new a);return}t=!0;let u=h._readableState,d=h._writableState,v=d||u;u&&(u.constructed=!0),d&&(d.constructed=!0),v.destroyed?h.emit(y,s):s?O(h,s,!0):r.nextTick(W,h)}try{h._construct(s=>{r.nextTick(n,s)})}catch(s){r.nextTick(n,s)}}function W(h){h.emit(w)}function J(h){return h?.setHeader&&typeof h.abort=="function"}function U(h){h.emit("close")}function q(h,t){h.emit("error",t),r.nextTick(U,h)}function V(h,t){!h||b(h)||(!t&&!g(h)&&(t=new l),M(h)?(h.socket=null,h.destroy(t)):J(h)?h.abort():J(h.req)?h.req.abort():typeof h.destroy=="function"?h.destroy(t):typeof h.close=="function"?h.close():t?r.nextTick(q,h,t):r.nextTick(U,h),h.destroyed||(h[c]=!0))}return QK={construct:C,destroyer:V,destroy:_,undestroy:P,errorOrDestroy:O},QK}var tZ={},Q9t=!1;function pZ(){if(Q9t)return tZ;Q9t=!0;let{ArrayIsArray:r,ObjectSetPrototypeOf:e}=po(),{EventEmitter:a}=wd;function l(c){a.call(this,c)}e(l.prototype,a.prototype),e(l,a),l.prototype.pipe=function(c,b){let g=this;function M(I){c.writable&&c.write(I)===!1&&g.pause&&g.pause()}g.on("data",M);function y(){g.readable&&g.resume&&g.resume()}c.on("drain",y),!c._isStdio&&(!b||b.end!==!1)&&(g.on("end",S),g.on("close",_));let w=!1;function S(){w||(w=!0,c.end())}function _(){w||(w=!0,typeof c.destroy=="function"&&c.destroy())}function x(I){A(),a.listenerCount(this,"error")===0&&this.emit("error",I)}i(g,"error",x),i(c,"error",x);function A(){g.removeListener("data",M),c.removeListener("drain",y),g.removeListener("end",S),g.removeListener("close",_),g.removeListener("error",x),c.removeListener("error",x),g.removeListener("end",A),g.removeListener("close",A),c.removeListener("close",A)}return g.on("end",A),g.on("close",A),c.on("close",A),c.emit("pipe",g),c};function i(c,b,g){if(typeof c.prependListener=="function")return c.prependListener(b,g);!c._events||!c._events[b]?c.on(b,g):r(c._events[b])?c._events[b].unshift(g):c._events[b]=[g,c._events[b]]}return tZ={Stream:l,prependListener:i},tZ}var M4={},tMt=!1;function wx(){if(tMt)return M4;tMt=!0;let{SymbolDispose:r}=po(),{AbortError:e,codes:a}=$f(),{isNodeStream:l,isWebStream:i,kControllerErrorFunction:c}=$c(),b=jp(),{ERR_INVALID_ARG_TYPE:g}=a,M,y=(w,S)=>{if(typeof w!="object"||!("aborted"in w))throw new g(S,"AbortSignal",w)};return M4.addAbortSignal=function(S,_){if(y(S,"signal"),!l(_)&&!i(_))throw new g("stream",["ReadableStream","WritableStream","Stream"],_);return M4.addAbortSignalNoValidate(S,_)},M4.addAbortSignalNoValidate=function(w,S){if(typeof w!="object"||!("aborted"in w))return S;let _=l(S)?()=>{S.destroy(new e(void 0,{cause:w.reason}))}:()=>{S[c](new e(void 0,{cause:w.reason}))};if(w.aborted)_();else{M=M||cf().addAbortListener;let x=M(w,_);b(S,x[r])}return S},M4}var eZ={},eMt=!1;function Kse(){if(eMt)return eZ;eMt=!0;let{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:a,Uint8Array:l}=po(),{Buffer:i}=Rn(),{inspect:c}=cf();return eZ=class{constructor(){this.head=null,this.tail=null,this.length=0}push(g){let M={data:g,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length}unshift(g){let M={data:g,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}shift(){if(this.length===0)return;let g=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,g}clear(){this.head=this.tail=null,this.length=0}join(g){if(this.length===0)return"";let M=this.head,y=""+M.data;for(;(M=M.next)!==null;)y+=g+M.data;return y}concat(g){if(this.length===0)return i.alloc(0);let M=i.allocUnsafe(g>>>0),y=this.head,w=0;for(;y;)a(M,y.data,w),w+=y.data.length,y=y.next;return M}consume(g,M){let y=this.head.data;if(g<y.length){let w=y.slice(0,g);return this.head.data=y.slice(g),w}return g===y.length?this.shift():M?this._getString(g):this._getBuffer(g)}first(){return this.head.data}*[e](){for(let g=this.head;g;g=g.next)yield g.data}_getString(g){let M="",y=this.head,w=0;do{let S=y.data;if(g>S.length)M+=S,g-=S.length;else{g===S.length?(M+=S,++w,y.next?this.head=y.next:this.head=this.tail=null):(M+=r(S,0,g),this.head=y,y.data=r(S,g));break}++w}while((y=y.next)!==null);return this.length-=w,M}_getBuffer(g){let M=i.allocUnsafe(g),y=g,w=this.head,S=0;do{let _=w.data;if(g>_.length)a(M,_,y-g),g-=_.length;else{g===_.length?(a(M,_,y-g),++S,w.next?this.head=w.next:this.head=this.tail=null):(a(M,new l(_.buffer,_.byteOffset,g),y-g),this.head=w,w.data=_.slice(g));break}++S}while((w=w.next)!==null);return this.length-=S,M}[Symbol.for("nodejs.util.inspect.custom")](g,M){return c(this,{...M,depth:0,customInspect:!1})}},eZ}var rZ={},rMt=!1;function Mx(){if(rMt)return rZ;rMt=!0;let{MathFloor:r,NumberIsInteger:e}=po(),{validateInteger:a}=S4(),{ERR_INVALID_ARG_VALUE:l}=$f().codes,i=16*1024,c=16;function b(w,S,_){return w.highWaterMark!=null?w.highWaterMark:S?w[_]:null}function g(w){return w?c:i}function M(w,S){a(S,"value",0),w?c=S:i=S}function y(w,S,_,x){let A=b(S,x,_);if(A!=null){if(!e(A)||A<0){let I=x?`options.${_}`:"options.highWaterMark";throw new l(I,A)}return r(A)}return g(w.objectMode)}return rZ={getHighWaterMark:y,getDefaultHighWaterMark:g,setDefaultHighWaterMark:M},rZ}var iZ={},iMt=!1;function gMt(){if(iMt)return iZ;iMt=!0;let r=Jo,{PromisePrototypeThen:e,SymbolAsyncIterator:a,SymbolIterator:l}=po(),{Buffer:i}=Rn(),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:b}=$f().codes;function g(M,y,w){let S;if(typeof y=="string"||y instanceof i)return new M({objectMode:!0,...w,read(){this.push(y),this.push(null)}});let _;if(y&&y[a])_=!0,S=y[a]();else if(y&&y[l])_=!1,S=y[l]();else throw new c("iterable",["Iterable"],y);let x=new M({objectMode:!0,highWaterMark:1,...w}),A=!1;x._read=function(){A||(A=!0,B())},x._destroy=function(P,O){e(I(P),()=>r.nextTick(O,P),C=>r.nextTick(O,C||P))};async function I(P){let O=P!=null,C=typeof S.throw=="function";if(O&&C){let{value:K,done:W}=await S.throw(P);if(await K,W)return}if(typeof S.return=="function"){let{value:K}=await S.return();await K}}async function B(){for(;;){try{let{value:P,done:O}=_?await S.next():S.next();if(O)x.push(null);else{let C=P&&typeof P.then=="function"?await P:P;if(C===null)throw A=!1,new b;if(x.push(C))continue;A=!1}}catch(P){x.destroy(P)}break}}return x}return iZ=g,iZ}var nZ={},nMt=!1,er=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function _x(){if(nMt)return nZ;nMt=!0;let r=Jo,{ArrayPrototypeIndexOf:e,NumberIsInteger:a,NumberIsNaN:l,NumberParseInt:i,ObjectDefineProperties:c,ObjectKeys:b,ObjectSetPrototypeOf:g,Promise:M,SafeSet:y,SymbolAsyncDispose:w,SymbolAsyncIterator:S,Symbol:_}=po();nZ=St,St.ReadableState=wt;let{EventEmitter:x}=wd,{Stream:A,prependListener:I}=pZ(),{Buffer:B}=Rn(),{addAbortSignal:P}=wx(),O=jp(),C=cf().debuglog("stream",ot=>{C=ot}),K=Kse(),W=_g(),{getHighWaterMark:J,getDefaultHighWaterMark:U}=Mx(),{aggregateTwoErrors:q,codes:{ERR_INVALID_ARG_TYPE:V,ERR_METHOD_NOT_IMPLEMENTED:h,ERR_OUT_OF_RANGE:t,ERR_STREAM_PUSH_AFTER_EOF:n,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:s},AbortError:u}=$f(),{validateObject:d}=S4(),v=_("kPaused"),{StringDecoder:p}=e2,f=gMt();g(St.prototype,A.prototype),g(St,A);let o=()=>{},{errorOrDestroy:m}=W,E=1,R=2,k=4,L=8,z=16,it=32,G=64,$=128,Z=256,rt=512,Q=1024,H=2048,F=4096,Y=8192,at=16384,ht=32768,et=65536,ft=1<<17,ct=1<<18;function st(ot){return{enumerable:!1,get(){return((this||er).state&ot)!==0},set(Mt){Mt?(this||er).state|=ot:(this||er).state&=~ot}}}c(wt.prototype,{objectMode:st(E),ended:st(R),endEmitted:st(k),reading:st(L),constructed:st(z),sync:st(it),needReadable:st(G),emittedReadable:st($),readableListening:st(Z),resumeScheduled:st(rt),errorEmitted:st(Q),emitClose:st(H),autoDestroy:st(F),destroyed:st(Y),closed:st(at),closeEmitted:st(ht),multiAwaitDrain:st(et),readingMore:st(ft),dataEmitted:st(ct)});function wt(ot,Mt,Ot){typeof Ot!="boolean"&&(Ot=Mt instanceof Dc()),(this||er).state=H|F|z|it,ot&&ot.objectMode&&((this||er).state|=E),Ot&&ot&&ot.readableObjectMode&&((this||er).state|=E),(this||er).highWaterMark=ot?J(this||er,ot,"readableHighWaterMark",Ot):U(!1),(this||er).buffer=new K,(this||er).length=0,(this||er).pipes=[],(this||er).flowing=null,(this||er)[v]=null,ot&&ot.emitClose===!1&&((this||er).state&=~H),ot&&ot.autoDestroy===!1&&((this||er).state&=~F),(this||er).errored=null,(this||er).defaultEncoding=ot&&ot.defaultEncoding||"utf8",(this||er).awaitDrainWriters=null,(this||er).decoder=null,(this||er).encoding=null,ot&&ot.encoding&&((this||er).decoder=new p(ot.encoding),(this||er).encoding=ot.encoding)}function St(ot){if(!((this||er)instanceof St))return new St(ot);let Mt=(this||er)instanceof Dc();(this||er)._readableState=new wt(ot,this||er,Mt),ot&&(typeof ot.read=="function"&&((this||er)._read=ot.read),typeof ot.destroy=="function"&&((this||er)._destroy=ot.destroy),typeof ot.construct=="function"&&((this||er)._construct=ot.construct),ot.signal&&!Mt&&P(ot.signal,this||er)),A.call(this||er,ot),W.construct(this||er,()=>{(this||er)._readableState.needReadable&&nt(this||er,(this||er)._readableState)})}St.prototype.destroy=W.destroy,St.prototype._undestroy=W.undestroy,St.prototype._destroy=function(ot,Mt){Mt(ot)},St.prototype[x.captureRejectionSymbol]=function(ot){this.destroy(ot)},St.prototype[w]=function(){let ot;return(this||er).destroyed||(ot=(this||er).readableEnded?null:new u,this.destroy(ot)),new M((Mt,Ot)=>O(this||er,dt=>dt&&dt!==ot?Ot(dt):Mt(null)))},St.prototype.push=function(ot,Mt){return ut(this||er,ot,Mt,!1)},St.prototype.unshift=function(ot,Mt){return ut(this||er,ot,Mt,!0)};function ut(ot,Mt,Ot,dt){C("readableAddChunk",Mt);let Bt=ot._readableState,Ut;if((Bt.state&E)===0&&(typeof Mt=="string"?(Ot=Ot||Bt.defaultEncoding,Bt.encoding!==Ot&&(dt&&Bt.encoding?Mt=B.from(Mt,Ot).toString(Bt.encoding):(Mt=B.from(Mt,Ot),Ot=""))):Mt instanceof B?Ot="":A._isUint8Array(Mt)?(Mt=A._uint8ArrayToBuffer(Mt),Ot=""):Mt!=null&&(Ut=new V("chunk",["string","Buffer","Uint8Array"],Mt))),Ut)m(ot,Ut);else if(Mt===null)Bt.state&=~L,N(ot,Bt);else if((Bt.state&E)!==0||Mt&&Mt.length>0)if(dt)if((Bt.state&k)!==0)m(ot,new s);else{if(Bt.destroyed||Bt.errored)return!1;It(ot,Bt,Mt,!0)}else if(Bt.ended)m(ot,new n);else{if(Bt.destroyed||Bt.errored)return!1;Bt.state&=~L,Bt.decoder&&!Ot?(Mt=Bt.decoder.write(Mt),Bt.objectMode||Mt.length!==0?It(ot,Bt,Mt,!1):nt(ot,Bt)):It(ot,Bt,Mt,!1)}else dt||(Bt.state&=~L,nt(ot,Bt));return!Bt.ended&&(Bt.length<Bt.highWaterMark||Bt.length===0)}function It(ot,Mt,Ot,dt){Mt.flowing&&Mt.length===0&&!Mt.sync&&ot.listenerCount("data")>0?((Mt.state&et)!==0?Mt.awaitDrainWriters.clear():Mt.awaitDrainWriters=null,Mt.dataEmitted=!0,ot.emit("data",Ot)):(Mt.length+=Mt.objectMode?1:Ot.length,dt?Mt.buffer.unshift(Ot):Mt.buffer.push(Ot),(Mt.state&G)!==0&&D(ot)),nt(ot,Mt)}St.prototype.isPaused=function(){let ot=(this||er)._readableState;return ot[v]===!0||ot.flowing===!1},St.prototype.setEncoding=function(ot){let Mt=new p(ot);(this||er)._readableState.decoder=Mt,(this||er)._readableState.encoding=(this||er)._readableState.decoder.encoding;let Ot=(this||er)._readableState.buffer,dt="";for(let Bt of Ot)dt+=Mt.write(Bt);return Ot.clear(),dt!==""&&Ot.push(dt),(this||er)._readableState.length=dt.length,this||er};let Pt=1073741824;function j(ot){if(ot>Pt)throw new t("size","<= 1GiB",ot);return ot--,ot|=ot>>>1,ot|=ot>>>2,ot|=ot>>>4,ot|=ot>>>8,ot|=ot>>>16,ot++,ot}function T(ot,Mt){return ot<=0||Mt.length===0&&Mt.ended?0:(Mt.state&E)!==0?1:l(ot)?Mt.flowing&&Mt.length?Mt.buffer.first().length:Mt.length:ot<=Mt.length?ot:Mt.ended?Mt.length:0}St.prototype.read=function(ot){C("read",ot),ot===void 0?ot=NaN:a(ot)||(ot=i(ot,10));let Mt=(this||er)._readableState,Ot=ot;if(ot>Mt.highWaterMark&&(Mt.highWaterMark=j(ot)),ot!==0&&(Mt.state&=~$),ot===0&&Mt.needReadable&&((Mt.highWaterMark!==0?Mt.length>=Mt.highWaterMark:Mt.length>0)||Mt.ended))return C("read: emitReadable",Mt.length,Mt.ended),Mt.length===0&&Mt.ended?Ct(this||er):D(this||er),null;if(ot=T(ot,Mt),ot===0&&Mt.ended)return Mt.length===0&&Ct(this||er),null;let dt=(Mt.state&G)!==0;if(C("need readable",dt),(Mt.length===0||Mt.length-ot<Mt.highWaterMark)&&(dt=!0,C("length less than watermark",dt)),Mt.ended||Mt.reading||Mt.destroyed||Mt.errored||!Mt.constructed)dt=!1,C("reading, ended or constructing",dt);else if(dt){C("do read"),Mt.state|=L|it,Mt.length===0&&(Mt.state|=G);try{this._read(Mt.highWaterMark)}catch(Ut){m(this||er,Ut)}Mt.state&=~it,Mt.reading||(ot=T(Ot,Mt))}let Bt;return ot>0?Bt=bt(ot,Mt):Bt=null,Bt===null?(Mt.needReadable=Mt.length<=Mt.highWaterMark,ot=0):(Mt.length-=ot,Mt.multiAwaitDrain?Mt.awaitDrainWriters.clear():Mt.awaitDrainWriters=null),Mt.length===0&&(Mt.ended||(Mt.needReadable=!0),Ot!==ot&&Mt.ended&&Ct(this||er)),Bt!==null&&!Mt.errorEmitted&&!Mt.closeEmitted&&(Mt.dataEmitted=!0,this.emit("data",Bt)),Bt};function N(ot,Mt){if(C("onEofChunk"),!Mt.ended){if(Mt.decoder){let Ot=Mt.decoder.end();Ot&&Ot.length&&(Mt.buffer.push(Ot),Mt.length+=Mt.objectMode?1:Ot.length)}Mt.ended=!0,Mt.sync?D(ot):(Mt.needReadable=!1,Mt.emittedReadable=!0,X(ot))}}function D(ot){let Mt=ot._readableState;C("emitReadable",Mt.needReadable,Mt.emittedReadable),Mt.needReadable=!1,Mt.emittedReadable||(C("emitReadable",Mt.flowing),Mt.emittedReadable=!0,r.nextTick(X,ot))}function X(ot){let Mt=ot._readableState;C("emitReadable_",Mt.destroyed,Mt.length,Mt.ended),!Mt.destroyed&&!Mt.errored&&(Mt.length||Mt.ended)&&(ot.emit("readable"),Mt.emittedReadable=!1),Mt.needReadable=!Mt.flowing&&!Mt.ended&&Mt.length<=Mt.highWaterMark,pt(ot)}function nt(ot,Mt){!Mt.readingMore&&Mt.constructed&&(Mt.readingMore=!0,r.nextTick(tt,ot,Mt))}function tt(ot,Mt){for(;!Mt.reading&&!Mt.ended&&(Mt.length<Mt.highWaterMark||Mt.flowing&&Mt.length===0);){let Ot=Mt.length;if(C("maybeReadMore read 0"),ot.read(0),Ot===Mt.length)break}Mt.readingMore=!1}St.prototype._read=function(ot){throw new h("_read()")},St.prototype.pipe=function(ot,Mt){let Ot=this||er,dt=(this||er)._readableState;dt.pipes.length===1&&(dt.multiAwaitDrain||(dt.multiAwaitDrain=!0,dt.awaitDrainWriters=new y(dt.awaitDrainWriters?[dt.awaitDrainWriters]:[]))),dt.pipes.push(ot),C("pipe count=%d opts=%j",dt.pipes.length,Mt);let Ut=(!Mt||Mt.end!==!1)&&ot!==r.stdout&&ot!==r.stderr?qt:Oe;dt.endEmitted?r.nextTick(Ut):Ot.once("end",Ut),ot.on("unpipe",vt);function vt(De,Le){C("onunpipe"),De===Ot&&Le&&Le.hasUnpiped===!1&&(Le.hasUnpiped=!0,Dt())}function qt(){C("onend"),ot.end()}let jt,gt=!1;function Dt(){C("cleanup"),ot.removeListener("close",Ne),ot.removeListener("finish",Pe),jt&&ot.removeListener("drain",jt),ot.removeListener("error",Nt),ot.removeListener("unpipe",vt),Ot.removeListener("end",qt),Ot.removeListener("end",Oe),Ot.removeListener("data",_t),gt=!0,jt&&dt.awaitDrainWriters&&(!ot._writableState||ot._writableState.needDrain)&&jt()}function ke(){gt||(dt.pipes.length===1&&dt.pipes[0]===ot?(C("false write response, pause",0),dt.awaitDrainWriters=ot,dt.multiAwaitDrain=!1):dt.pipes.length>1&&dt.pipes.includes(ot)&&(C("false write response, pause",dt.awaitDrainWriters.size),dt.awaitDrainWriters.add(ot)),Ot.pause()),jt||(jt=mt(Ot,ot),ot.on("drain",jt))}Ot.on("data",_t);function _t(De){C("ondata");let Le=ot.write(De);C("dest.write",Le),Le===!1&&ke()}function Nt(De){if(C("onerror",De),Oe(),ot.removeListener("error",Nt),ot.listenerCount("error")===0){let Le=ot._writableState||ot._readableState;Le&&!Le.errorEmitted?m(ot,De):ot.emit("error",De)}}I(ot,"error",Nt);function Ne(){ot.removeListener("finish",Pe),Oe()}ot.once("close",Ne);function Pe(){C("onfinish"),ot.removeListener("close",Ne),Oe()}ot.once("finish",Pe);function Oe(){C("unpipe"),Ot.unpipe(ot)}return ot.emit("pipe",Ot),ot.writableNeedDrain===!0?ke():dt.flowing||(C("pipe resume"),Ot.resume()),ot};function mt(ot,Mt){return function(){let dt=ot._readableState;dt.awaitDrainWriters===Mt?(C("pipeOnDrain",1),dt.awaitDrainWriters=null):dt.multiAwaitDrain&&(C("pipeOnDrain",dt.awaitDrainWriters.size),dt.awaitDrainWriters.delete(Mt)),(!dt.awaitDrainWriters||dt.awaitDrainWriters.size===0)&&ot.listenerCount("data")&&ot.resume()}}St.prototype.unpipe=function(ot){let Mt=(this||er)._readableState,Ot={hasUnpiped:!1};if(Mt.pipes.length===0)return this||er;if(!ot){let Bt=Mt.pipes;Mt.pipes=[],this.pause();for(let Ut=0;Ut<Bt.length;Ut++)Bt[Ut].emit("unpipe",this||er,{hasUnpiped:!1});return this||er}let dt=e(Mt.pipes,ot);return dt===-1?this||er:(Mt.pipes.splice(dt,1),Mt.pipes.length===0&&this.pause(),ot.emit("unpipe",this||er,Ot),this||er)},St.prototype.on=function(ot,Mt){let Ot=A.prototype.on.call(this||er,ot,Mt),dt=(this||er)._readableState;return ot==="data"?(dt.readableListening=this.listenerCount("readable")>0,dt.flowing!==!1&&this.resume()):ot==="readable"&&!dt.endEmitted&&!dt.readableListening&&(dt.readableListening=dt.needReadable=!0,dt.flowing=!1,dt.emittedReadable=!1,C("on readable",dt.length,dt.reading),dt.length?D(this||er):dt.reading||r.nextTick(lt,this||er)),Ot},St.prototype.addListener=St.prototype.on,St.prototype.removeListener=function(ot,Mt){let Ot=A.prototype.removeListener.call(this||er,ot,Mt);return ot==="readable"&&r.nextTick(kt,this||er),Ot},St.prototype.off=St.prototype.removeListener,St.prototype.removeAllListeners=function(ot){let Mt=A.prototype.removeAllListeners.apply(this||er,arguments);return(ot==="readable"||ot===void 0)&&r.nextTick(kt,this||er),Mt};function kt(ot){let Mt=ot._readableState;Mt.readableListening=ot.listenerCount("readable")>0,Mt.resumeScheduled&&Mt[v]===!1?Mt.flowing=!0:ot.listenerCount("data")>0?ot.resume():Mt.readableListening||(Mt.flowing=null)}function lt(ot){C("readable nexttick read 0"),ot.read(0)}St.prototype.resume=function(){let ot=(this||er)._readableState;return ot.flowing||(C("resume"),ot.flowing=!ot.readableListening,xt(this||er,ot)),ot[v]=!1,this||er};function xt(ot,Mt){Mt.resumeScheduled||(Mt.resumeScheduled=!0,r.nextTick(Tt,ot,Mt))}function Tt(ot,Mt){C("resume",Mt.reading),Mt.reading||ot.read(0),Mt.resumeScheduled=!1,ot.emit("resume"),pt(ot),Mt.flowing&&!Mt.reading&&ot.read(0)}St.prototype.pause=function(){return C("call pause flowing=%j",(this||er)._readableState.flowing),(this||er)._readableState.flowing!==!1&&(C("pause"),(this||er)._readableState.flowing=!1,this.emit("pause")),(this||er)._readableState[v]=!0,this||er};function pt(ot){let Mt=ot._readableState;for(C("flow",Mt.flowing);Mt.flowing&&ot.read()!==null;);}St.prototype.wrap=function(ot){let Mt=!1;ot.on("data",dt=>{!this.push(dt)&&ot.pause&&(Mt=!0,ot.pause())}),ot.on("end",()=>{this.push(null)}),ot.on("error",dt=>{m(this||er,dt)}),ot.on("close",()=>{this.destroy()}),ot.on("destroy",()=>{this.destroy()}),(this||er)._read=()=>{Mt&&ot.resume&&(Mt=!1,ot.resume())};let Ot=b(ot);for(let dt=1;dt<Ot.length;dt++){let Bt=Ot[dt];(this||er)[Bt]===void 0&&typeof ot[Bt]=="function"&&((this||er)[Bt]=ot[Bt].bind(ot))}return this||er},St.prototype[S]=function(){return $t(this||er)},St.prototype.iterator=function(ot){return ot!==void 0&&d(ot,"options"),$t(this||er,ot)};function $t(ot,Mt){typeof ot.read!="function"&&(ot=St.wrap(ot,{objectMode:!0}));let Ot=Ht(ot,Mt);return Ot.stream=ot,Ot}async function*Ht(ot,Mt){let Ot=o;function dt(vt){(this||er)===ot?(Ot(),Ot=o):Ot=vt}ot.on("readable",dt);let Bt,Ut=O(ot,{writable:!1},vt=>{Bt=vt?q(Bt,vt):null,Ot(),Ot=o});try{for(;;){let vt=ot.destroyed?null:ot.read();if(vt!==null)yield vt;else{if(Bt)throw Bt;if(Bt===null)return;await new M(dt)}}}catch(vt){throw Bt=q(Bt,vt),Bt}finally{(Bt||Mt?.destroyOnReturn!==!1)&&(Bt===void 0||ot._readableState.autoDestroy)?W.destroyer(ot,null):(ot.off("readable",dt),Ut())}}c(St.prototype,{readable:{__proto__:null,get(){let ot=(this||er)._readableState;return!!ot&&ot.readable!==!1&&!ot.destroyed&&!ot.errorEmitted&&!ot.endEmitted},set(ot){(this||er)._readableState&&((this||er)._readableState.readable=!!ot)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||er)._readableState.readable!==!1&&((this||er)._readableState.destroyed||(this||er)._readableState.errored)&&!(this||er)._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState&&(this||er)._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState.flowing},set:function(ot){(this||er)._readableState&&((this||er)._readableState.flowing=ot)}},readableLength:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.errored:null}},closed:{__proto__:null,get(){return(this||er)._readableState?(this||er)._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.destroyed:!1},set(ot){(this||er)._readableState&&((this||er)._readableState.destroyed=ot)}},readableEnded:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.endEmitted:!1}}}),c(wt.prototype,{pipesCount:{__proto__:null,get(){return(this||er).pipes.length}},paused:{__proto__:null,get(){return(this||er)[v]!==!1},set(ot){(this||er)[v]=!!ot}}}),St._fromList=bt;function bt(ot,Mt){if(Mt.length===0)return null;let Ot;return Mt.objectMode?Ot=Mt.buffer.shift():!ot||ot>=Mt.length?(Mt.decoder?Ot=Mt.buffer.join(""):Mt.buffer.length===1?Ot=Mt.buffer.first():Ot=Mt.buffer.concat(Mt.length),Mt.buffer.clear()):Ot=Mt.buffer.consume(ot,Mt.decoder),Ot}function Ct(ot){let Mt=ot._readableState;C("endReadable",Mt.endEmitted),Mt.endEmitted||(Mt.ended=!0,r.nextTick(Kt,Mt,ot))}function Kt(ot,Mt){if(C("endReadableNT",ot.endEmitted,ot.length),!ot.errored&&!ot.closeEmitted&&!ot.endEmitted&&ot.length===0){if(ot.endEmitted=!0,Mt.emit("end"),Mt.writable&&Mt.allowHalfOpen===!1)r.nextTick(yt,Mt);else if(ot.autoDestroy){let Ot=Mt._writableState;(!Ot||Ot.autoDestroy&&(Ot.finished||Ot.writable===!1))&&Mt.destroy()}}}function yt(ot){ot.writable&&!ot.writableEnded&&!ot.destroyed&&ot.end()}St.from=function(ot,Mt){return f(St,ot,Mt)};let Lt;function zt(){return Lt===void 0&&(Lt={}),Lt}return St.fromWeb=function(ot,Mt){return zt().newStreamReadableFromReadableStream(ot,Mt)},St.toWeb=function(ot,Mt){return zt().newReadableStreamFromStreamReadable(ot,Mt)},St.wrap=function(ot,Mt){var Ot,dt;return new St({objectMode:(Ot=(dt=ot.readableObjectMode)!==null&&dt!==void 0?dt:ot.objectMode)!==null&&Ot!==void 0?Ot:!0,...Mt,destroy(Bt,Ut){W.destroyer(ot,Bt),Ut(Bt)}}).wrap(ot)},nZ}var aZ={},aMt=!1,ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function mZ(){if(aMt)return aZ;aMt=!0;let r=Jo,{ArrayPrototypeSlice:e,Error:a,FunctionPrototypeSymbolHasInstance:l,ObjectDefineProperty:i,ObjectDefineProperties:c,ObjectSetPrototypeOf:b,StringPrototypeToLowerCase:g,Symbol:M,SymbolHasInstance:y}=po();aZ=d,d.WritableState=s;let{EventEmitter:w}=wd,S=pZ().Stream,{Buffer:_}=Rn(),x=_g(),{addAbortSignal:A}=wx(),{getHighWaterMark:I,getDefaultHighWaterMark:B}=Mx(),{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_MULTIPLE_CALLBACK:C,ERR_STREAM_CANNOT_PIPE:K,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:J,ERR_STREAM_NULL_VALUES:U,ERR_STREAM_WRITE_AFTER_END:q,ERR_UNKNOWN_ENCODING:V}=$f().codes,{errorOrDestroy:h}=x;b(d.prototype,S.prototype),b(d,S);function t(){}let n=M("kOnFinished");function s(F,Y,at){typeof at!="boolean"&&(at=Y instanceof Dc()),(this||ar).objectMode=!!(F&&F.objectMode),at&&((this||ar).objectMode=(this||ar).objectMode||!!(F&&F.writableObjectMode)),(this||ar).highWaterMark=F?I(this||ar,F,"writableHighWaterMark",at):B(!1),(this||ar).finalCalled=!1,(this||ar).needDrain=!1,(this||ar).ending=!1,(this||ar).ended=!1,(this||ar).finished=!1,(this||ar).destroyed=!1;let ht=!!(F&&F.decodeStrings===!1);(this||ar).decodeStrings=!ht,(this||ar).defaultEncoding=F&&F.defaultEncoding||"utf8",(this||ar).length=0,(this||ar).writing=!1,(this||ar).corked=0,(this||ar).sync=!0,(this||ar).bufferProcessing=!1,(this||ar).onwrite=m.bind(void 0,Y),(this||ar).writecb=null,(this||ar).writelen=0,(this||ar).afterWriteTickInfo=null,u(this||ar),(this||ar).pendingcb=0,(this||ar).constructed=!0,(this||ar).prefinished=!1,(this||ar).errorEmitted=!1,(this||ar).emitClose=!F||F.emitClose!==!1,(this||ar).autoDestroy=!F||F.autoDestroy!==!1,(this||ar).errored=null,(this||ar).closed=!1,(this||ar).closeEmitted=!1,(this||ar)[n]=[]}function u(F){F.buffered=[],F.bufferedIndex=0,F.allBuffers=!0,F.allNoop=!0}s.prototype.getBuffer=function(){return e((this||ar).buffered,(this||ar).bufferedIndex)},i(s.prototype,"bufferedRequestCount",{__proto__:null,get(){return(this||ar).buffered.length-(this||ar).bufferedIndex}});function d(F){let Y=(this||ar)instanceof Dc();if(!Y&&!l(d,this||ar))return new d(F);(this||ar)._writableState=new s(F,this||ar,Y),F&&(typeof F.write=="function"&&((this||ar)._write=F.write),typeof F.writev=="function"&&((this||ar)._writev=F.writev),typeof F.destroy=="function"&&((this||ar)._destroy=F.destroy),typeof F.final=="function"&&((this||ar)._final=F.final),typeof F.construct=="function"&&((this||ar)._construct=F.construct),F.signal&&A(F.signal,this||ar)),S.call(this||ar,F),x.construct(this||ar,()=>{let at=(this||ar)._writableState;at.writing||L(this||ar,at),$(this||ar,at)})}i(d,y,{__proto__:null,value:function(F){return l(this||ar,F)?!0:(this||ar)!==d?!1:F&&F._writableState instanceof s}}),d.prototype.pipe=function(){h(this||ar,new K)};function v(F,Y,at,ht){let et=F._writableState;if(typeof at=="function")ht=at,at=et.defaultEncoding;else{if(!at)at=et.defaultEncoding;else if(at!=="buffer"&&!_.isEncoding(at))throw new V(at);typeof ht!="function"&&(ht=t)}if(Y===null)throw new U;if(!et.objectMode)if(typeof Y=="string")et.decodeStrings!==!1&&(Y=_.from(Y,at),at="buffer");else if(Y instanceof _)at="buffer";else if(S._isUint8Array(Y))Y=S._uint8ArrayToBuffer(Y),at="buffer";else throw new P("chunk",["string","Buffer","Uint8Array"],Y);let ft;return et.ending?ft=new q:et.destroyed&&(ft=new W("write")),ft?(r.nextTick(ht,ft),h(F,ft,!0),ft):(et.pendingcb++,p(F,et,Y,at,ht))}d.prototype.write=function(F,Y,at){return v(this||ar,F,Y,at)===!0},d.prototype.cork=function(){(this||ar)._writableState.corked++},d.prototype.uncork=function(){let F=(this||ar)._writableState;F.corked&&(F.corked--,F.writing||L(this||ar,F))},d.prototype.setDefaultEncoding=function(Y){if(typeof Y=="string"&&(Y=g(Y)),!_.isEncoding(Y))throw new V(Y);return(this||ar)._writableState.defaultEncoding=Y,this||ar};function p(F,Y,at,ht,et){let ft=Y.objectMode?1:at.length;Y.length+=ft;let ct=Y.length<Y.highWaterMark;return ct||(Y.needDrain=!0),Y.writing||Y.corked||Y.errored||!Y.constructed?(Y.buffered.push({chunk:at,encoding:ht,callback:et}),Y.allBuffers&&ht!=="buffer"&&(Y.allBuffers=!1),Y.allNoop&&et!==t&&(Y.allNoop=!1)):(Y.writelen=ft,Y.writecb=et,Y.writing=!0,Y.sync=!0,F._write(at,ht,Y.onwrite),Y.sync=!1),ct&&!Y.errored&&!Y.destroyed}function f(F,Y,at,ht,et,ft,ct){Y.writelen=ht,Y.writecb=ct,Y.writing=!0,Y.sync=!0,Y.destroyed?Y.onwrite(new W("write")):at?F._writev(et,Y.onwrite):F._write(et,ft,Y.onwrite),Y.sync=!1}function o(F,Y,at,ht){--Y.pendingcb,ht(at),k(Y),h(F,at)}function m(F,Y){let at=F._writableState,ht=at.sync,et=at.writecb;if(typeof et!="function"){h(F,new C);return}at.writing=!1,at.writecb=null,at.length-=at.writelen,at.writelen=0,Y?(Y.stack,at.errored||(at.errored=Y),F._readableState&&!F._readableState.errored&&(F._readableState.errored=Y),ht?r.nextTick(o,F,at,Y,et):o(F,at,Y,et)):(at.buffered.length>at.bufferedIndex&&L(F,at),ht?at.afterWriteTickInfo!==null&&at.afterWriteTickInfo.cb===et?at.afterWriteTickInfo.count++:(at.afterWriteTickInfo={count:1,cb:et,stream:F,state:at},r.nextTick(E,at.afterWriteTickInfo)):R(F,at,1,et))}function E({stream:F,state:Y,count:at,cb:ht}){return Y.afterWriteTickInfo=null,R(F,Y,at,ht)}function R(F,Y,at,ht){for(!Y.ending&&!F.destroyed&&Y.length===0&&Y.needDrain&&(Y.needDrain=!1,F.emit("drain"));at-- >0;)Y.pendingcb--,ht();Y.destroyed&&k(Y),$(F,Y)}function k(F){if(F.writing)return;for(let et=F.bufferedIndex;et<F.buffered.length;++et){var Y;let{chunk:ft,callback:ct}=F.buffered[et],st=F.objectMode?1:ft.length;F.length-=st,ct((Y=F.errored)!==null&&Y!==void 0?Y:new W("write"))}let at=F[n].splice(0);for(let et=0;et<at.length;et++){var ht;at[et]((ht=F.errored)!==null&&ht!==void 0?ht:new W("end"))}u(F)}function L(F,Y){if(Y.corked||Y.bufferProcessing||Y.destroyed||!Y.constructed)return;let{buffered:at,bufferedIndex:ht,objectMode:et}=Y,ft=at.length-ht;if(!ft)return;let ct=ht;if(Y.bufferProcessing=!0,ft>1&&F._writev){Y.pendingcb-=ft-1;let st=Y.allNoop?t:St=>{for(let ut=ct;ut<at.length;++ut)at[ut].callback(St)},wt=Y.allNoop&&ct===0?at:e(at,ct);wt.allBuffers=Y.allBuffers,f(F,Y,!0,Y.length,wt,"",st),u(Y)}else{do{let{chunk:st,encoding:wt,callback:St}=at[ct];at[ct++]=null;let ut=et?1:st.length;f(F,Y,!1,ut,st,wt,St)}while(ct<at.length&&!Y.writing);ct===at.length?u(Y):ct>256?(at.splice(0,ct),Y.bufferedIndex=0):Y.bufferedIndex=ct}Y.bufferProcessing=!1}d.prototype._write=function(F,Y,at){if((this||ar)._writev)this._writev([{chunk:F,encoding:Y}],at);else throw new O("_write()")},d.prototype._writev=null,d.prototype.end=function(F,Y,at){let ht=(this||ar)._writableState;typeof F=="function"?(at=F,F=null,Y=null):typeof Y=="function"&&(at=Y,Y=null);let et;if(F!=null){let ft=v(this||ar,F,Y);ft instanceof a&&(et=ft)}return ht.corked&&(ht.corked=1,this.uncork()),et||(!ht.errored&&!ht.ending?(ht.ending=!0,$(this||ar,ht,!0),ht.ended=!0):ht.finished?et=new J("end"):ht.destroyed&&(et=new W("end"))),typeof at=="function"&&(et||ht.finished?r.nextTick(at,et):ht[n].push(at)),this||ar};function z(F){return F.ending&&!F.destroyed&&F.constructed&&F.length===0&&!F.errored&&F.buffered.length===0&&!F.finished&&!F.writing&&!F.errorEmitted&&!F.closeEmitted}function it(F,Y){let at=!1;function ht(et){if(at){h(F,et??C());return}if(at=!0,Y.pendingcb--,et){let ft=Y[n].splice(0);for(let ct=0;ct<ft.length;ct++)ft[ct](et);h(F,et,Y.sync)}else z(Y)&&(Y.prefinished=!0,F.emit("prefinish"),Y.pendingcb++,r.nextTick(Z,F,Y))}Y.sync=!0,Y.pendingcb++;try{F._final(ht)}catch(et){ht(et)}Y.sync=!1}function G(F,Y){!Y.prefinished&&!Y.finalCalled&&(typeof F._final=="function"&&!Y.destroyed?(Y.finalCalled=!0,it(F,Y)):(Y.prefinished=!0,F.emit("prefinish")))}function $(F,Y,at){z(Y)&&(G(F,Y),Y.pendingcb===0&&(at?(Y.pendingcb++,r.nextTick((ht,et)=>{z(et)?Z(ht,et):et.pendingcb--},F,Y)):z(Y)&&(Y.pendingcb++,Z(F,Y))))}function Z(F,Y){Y.pendingcb--,Y.finished=!0;let at=Y[n].splice(0);for(let ht=0;ht<at.length;ht++)at[ht]();if(F.emit("finish"),Y.autoDestroy){let ht=F._readableState;(!ht||ht.autoDestroy&&(ht.endEmitted||ht.readable===!1))&&F.destroy()}}c(d.prototype,{closed:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.closed:!1}},destroyed:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.destroyed:!1},set(F){(this||ar)._writableState&&((this||ar)._writableState.destroyed=F)}},writable:{__proto__:null,get(){let F=(this||ar)._writableState;return!!F&&F.writable!==!1&&!F.destroyed&&!F.errored&&!F.ending&&!F.ended},set(F){(this||ar)._writableState&&((this||ar)._writableState.writable=!!F)}},writableFinished:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return(this||ar)._writableState&&(this||ar)._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let F=(this||ar)._writableState;return F?!F.destroyed&&!F.ending&&F.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return(this||ar)._writableState&&(this||ar)._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.corked:0}},writableLength:{__proto__:null,get(){return(this||ar)._writableState&&(this||ar)._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return(this||ar)._writableState?(this||ar)._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||ar)._writableState.writable!==!1&&((this||ar)._writableState.destroyed||(this||ar)._writableState.errored)&&!(this||ar)._writableState.finished)}}});let rt=x.destroy;d.prototype.destroy=function(F,Y){let at=(this||ar)._writableState;return!at.destroyed&&(at.bufferedIndex<at.buffered.length||at[n].length)&&r.nextTick(k,at),rt.call(this||ar,F,Y),this||ar},d.prototype._undestroy=x.undestroy,d.prototype._destroy=function(F,Y){Y(F)},d.prototype[w.captureRejectionSymbol]=function(F){this.destroy(F)};let Q;function H(){return Q===void 0&&(Q={}),Q}return d.fromWeb=function(F,Y){return H().newStreamWritableFromWritableStream(F,Y)},d.toWeb=function(F){return H().newWritableStreamFromStreamWritable(F)},aZ}var oZ={},oMt=!1;function Zse(){if(oMt)return oZ;oMt=!0;let r=Jo,e=Rn(),{isReadable:a,isWritable:l,isIterable:i,isNodeStream:c,isReadableNodeStream:b,isWritableNodeStream:g,isDuplexNodeStream:M,isReadableStream:y,isWritableStream:w}=$c(),S=jp(),{AbortError:_,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:A}}=$f(),{destroyer:I}=_g(),B=Dc(),P=_x(),O=mZ(),{createDeferredPromise:C}=cf(),K=gMt(),W=globalThis.Blob||e.Blob,J=typeof W<"u"?function(s){return s instanceof W}:function(s){return!1},U=globalThis.AbortController||_4().AbortController,{FunctionPrototypeCall:q}=po();class V extends B{constructor(s){super(s),s?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),s?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}oZ=function n(s,u){if(M(s))return s;if(b(s))return t({readable:s});if(g(s))return t({writable:s});if(c(s))return t({writable:!1,readable:!1});if(y(s))return t({readable:P.fromWeb(s)});if(w(s))return t({writable:O.fromWeb(s)});if(typeof s=="function"){let{value:v,write:p,final:f,destroy:o}=h(s);if(i(v))return K(V,v,{objectMode:!0,write:p,final:f,destroy:o});let m=v?.then;if(typeof m=="function"){let E,R=q(m,v,k=>{if(k!=null)throw new A("nully","body",k)},k=>{I(E,k)});return E=new V({objectMode:!0,readable:!1,write:p,final(k){f(async()=>{try{await R,r.nextTick(k,null)}catch(L){r.nextTick(k,L)}})},destroy:o})}throw new A("Iterable, AsyncIterable or AsyncFunction",u,v)}if(J(s))return n(s.arrayBuffer());if(i(s))return K(V,s,{objectMode:!0,writable:!1});if(y(s?.readable)&&w(s?.writable))return V.fromWeb(s);if(typeof s?.writable=="object"||typeof s?.readable=="object"){let v=s!=null&&s.readable?b(s?.readable)?s?.readable:n(s.readable):void 0,p=s!=null&&s.writable?g(s?.writable)?s?.writable:n(s.writable):void 0;return t({readable:v,writable:p})}let d=s?.then;if(typeof d=="function"){let v;return q(d,s,p=>{p!=null&&v.push(p),v.push(null)},p=>{I(v,p)}),v=new V({objectMode:!0,writable:!1,read(){}})}throw new x(u,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],s)};function h(n){let{promise:s,resolve:u}=C(),d=new U,v=d.signal;return{value:n((async function*(){for(;;){let f=s;s=null;let{chunk:o,done:m,cb:E}=await f;if(r.nextTick(E),m)return;if(v.aborted)throw new _(void 0,{cause:v.reason});({promise:s,resolve:u}=C()),yield o}})(),{signal:v}),write(f,o,m){let E=u;u=null,E({chunk:f,done:!1,cb:m})},final(f){let o=u;u=null,o({done:!0,cb:f})},destroy(f,o){d.abort(),o(f)}}}function t(n){let s=n.readable&&typeof n.readable.read!="function"?P.wrap(n.readable):n.readable,u=n.writable,d=!!a(s),v=!!l(u),p,f,o,m,E;function R(k){let L=m;m=null,L?L(k):k&&E.destroy(k)}return E=new V({readableObjectMode:!!(s!=null&&s.readableObjectMode),writableObjectMode:!!(u!=null&&u.writableObjectMode),readable:d,writable:v}),v&&(S(u,k=>{v=!1,k&&I(s,k),R(k)}),E._write=function(k,L,z){u.write(k,L)?z():p=z},E._final=function(k){u.end(),f=k},u.on("drain",function(){if(p){let k=p;p=null,k()}}),u.on("finish",function(){if(f){let k=f;f=null,k()}})),d&&(S(s,k=>{d=!1,k&&I(s,k),R(k)}),s.on("readable",function(){if(o){let k=o;o=null,k()}}),s.on("end",function(){E.push(null)}),E._read=function(){for(;;){let k=s.read();if(k===null){o=E._read;return}if(!E.push(k))return}}),E._destroy=function(k,L){!k&&m!==null&&(k=new _),o=null,p=null,f=null,m===null?L(k):(m=L,I(u,k),I(s,k))},E}return oZ}var sZ={},sMt=!1;function Dc(){if(sMt)return sZ;sMt=!0;let{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:a,ObjectSetPrototypeOf:l}=po();sZ=b;let i=_x(),c=mZ();l(b.prototype,i.prototype),l(b,i);{let w=a(c.prototype);for(let S=0;S<w.length;S++){let _=w[S];b.prototype[_]||(b.prototype[_]=c.prototype[_])}}function b(w){if(!(this instanceof b))return new b(w);i.call(this,w),c.call(this,w),w?(this.allowHalfOpen=w.allowHalfOpen!==!1,w.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),w.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(b.prototype,{writable:{__proto__:null,...e(c.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(c.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(c.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(c.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(c.prototype,"writableLength")},writableFinished:{__proto__:null,...e(c.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(c.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(c.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(c.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(w){this._readableState&&this._writableState&&(this._readableState.destroyed=w,this._writableState.destroyed=w)}}});let g;function M(){return g===void 0&&(g={}),g}b.fromWeb=function(w,S){return M().newStreamDuplexFromReadableWritablePair(w,S)},b.toWeb=function(w){return M().newReadableWritablePairFromDuplex(w)};let y;return b.from=function(w){return y||(y=Zse()),y(w,"body")},sZ}var fZ={},fMt=!1;function yMt(){if(fMt)return fZ;fMt=!0;let{ObjectSetPrototypeOf:r,Symbol:e}=po();fZ=b;let{ERR_METHOD_NOT_IMPLEMENTED:a}=$f().codes,l=Dc(),{getHighWaterMark:i}=Mx();r(b.prototype,l.prototype),r(b,l);let c=e("kCallback");function b(y){if(!(this instanceof b))return new b(y);let w=y?i(this,y,"readableHighWaterMark",!0):null;w===0&&(y={...y,highWaterMark:null,readableHighWaterMark:w,writableHighWaterMark:y.writableHighWaterMark||0}),l.call(this,y),this._readableState.sync=!1,this[c]=null,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",M)}function g(y){typeof this._flush=="function"&&!this.destroyed?this._flush((w,S)=>{if(w){y?y(w):this.destroy(w);return}S!=null&&this.push(S),this.push(null),y&&y()}):(this.push(null),y&&y())}function M(){this._final!==g&&g.call(this)}return b.prototype._final=g,b.prototype._transform=function(y,w,S){throw new a("_transform()")},b.prototype._write=function(y,w,S){let _=this._readableState,x=this._writableState,A=_.length;this._transform(y,w,(I,B)=>{if(I){S(I);return}B!=null&&this.push(B),x.ended||A===_.length||_.length<_.highWaterMark?S():this[c]=S})},b.prototype._read=function(){if(this[c]){let y=this[c];this[c]=null,y()}},fZ}var hZ={},hMt=!1;function wMt(){if(hMt)return hZ;hMt=!0;let{ObjectSetPrototypeOf:r}=po();hZ=a;let e=yMt();r(a.prototype,e.prototype),r(a,e);function a(l){if(!(this instanceof a))return new a(l);e.call(this,l)}return a.prototype._transform=function(l,i,c){c(null,l)},hZ}var uZ={},uMt=!1;function vZ(){if(uMt)return uZ;uMt=!0;let r=Jo,{ArrayIsArray:e,Promise:a,SymbolAsyncIterator:l,SymbolDispose:i}=po(),c=jp(),{once:b}=cf(),g=_g(),M=Dc(),{aggregateTwoErrors:y,codes:{ERR_INVALID_ARG_TYPE:w,ERR_INVALID_RETURN_VALUE:S,ERR_MISSING_ARGS:_,ERR_STREAM_DESTROYED:x,ERR_STREAM_PREMATURE_CLOSE:A},AbortError:I}=$f(),{validateFunction:B,validateAbortSignal:P}=S4(),{isIterable:O,isReadable:C,isReadableNodeStream:K,isNodeStream:W,isTransformStream:J,isWebStream:U,isReadableStream:q,isReadableFinished:V}=$c(),h=globalThis.AbortController||_4().AbortController,t,n,s;function u(k,L,z){let it=!1;k.on("close",()=>{it=!0});let G=c(k,{readable:L,writable:z},$=>{it=!$});return{destroy:$=>{it||(it=!0,g.destroyer(k,$||new x("pipe")))},cleanup:G}}function d(k){return B(k[k.length-1],"streams[stream.length - 1]"),k.pop()}function v(k){if(O(k))return k;if(K(k))return p(k);throw new w("val",["Readable","Iterable","AsyncIterable"],k)}async function*p(k){n||(n=_x()),yield*n.prototype[l].call(k)}async function f(k,L,z,{end:it}){let G,$=null,Z=H=>{if(H&&(G=H),$){let F=$;$=null,F()}},rt=()=>new a((H,F)=>{G?F(G):$=()=>{G?F(G):H()}});L.on("drain",Z);let Q=c(L,{readable:!1},Z);try{L.writableNeedDrain&&await rt();for await(let H of k)L.write(H)||await rt();it&&(L.end(),await rt()),z()}catch(H){z(G!==H?y(G,H):H)}finally{Q(),L.off("drain",Z)}}async function o(k,L,z,{end:it}){J(L)&&(L=L.writable);let G=L.getWriter();try{for await(let $ of k)await G.ready,G.write($).catch(()=>{});await G.ready,it&&await G.close(),z()}catch($){try{await G.abort($),z($)}catch(Z){z(Z)}}}function m(...k){return E(k,b(d(k)))}function E(k,L,z){if(k.length===1&&e(k[0])&&(k=k[0]),k.length<2)throw new _("streams");let it=new h,G=it.signal,$=z?.signal,Z=[];P($,"options.signal");function rt(){et(new I)}s=s||cf().addAbortListener;let Q;$&&(Q=s($,rt));let H,F,Y=[],at=0;function ht(St){et(St,--at===0)}function et(St,ut){var It;if(St&&(!H||H.code==="ERR_STREAM_PREMATURE_CLOSE")&&(H=St),!(!H&&!ut)){for(;Y.length;)Y.shift()(H);(It=Q)===null||It===void 0||It[i](),it.abort(),ut&&(H||Z.forEach(Pt=>Pt()),r.nextTick(L,H,F))}}let ft;for(let St=0;St<k.length;St++){let ut=k[St],It=St<k.length-1,Pt=St>0,j=It||z?.end!==!1,T=St===k.length-1;if(W(ut)){let N=function(D){D&&D.name!=="AbortError"&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ht(D)};var wt=N;if(j){let{destroy:D,cleanup:X}=u(ut,It,Pt);Y.push(D),C(ut)&&T&&Z.push(X)}ut.on("error",N),C(ut)&&T&&Z.push(()=>{ut.removeListener("error",N)})}if(St===0)if(typeof ut=="function"){if(ft=ut({signal:G}),!O(ft))throw new S("Iterable, AsyncIterable or Stream","source",ft)}else O(ut)||K(ut)||J(ut)?ft=ut:ft=M.from(ut);else if(typeof ut=="function"){if(J(ft)){var ct;ft=v((ct=ft)===null||ct===void 0?void 0:ct.readable)}else ft=v(ft);if(ft=ut(ft,{signal:G}),It){if(!O(ft,!0))throw new S("AsyncIterable",`transform[${St-1}]`,ft)}else{var st;t||(t=wMt());let N=new t({objectMode:!0}),D=(st=ft)===null||st===void 0?void 0:st.then;if(typeof D=="function")at++,D.call(ft,tt=>{F=tt,tt!=null&&N.write(tt),j&&N.end(),r.nextTick(ht)},tt=>{N.destroy(tt),r.nextTick(ht,tt)});else if(O(ft,!0))at++,f(ft,N,ht,{end:j});else if(q(ft)||J(ft)){let tt=ft.readable||ft;at++,f(tt,N,ht,{end:j})}else throw new S("AsyncIterable or Promise","destination",ft);ft=N;let{destroy:X,cleanup:nt}=u(ft,!1,!0);Y.push(X),T&&Z.push(nt)}}else if(W(ut)){if(K(ft)){at+=2;let N=R(ft,ut,ht,{end:j});C(ut)&&T&&Z.push(N)}else if(J(ft)||q(ft)){let N=ft.readable||ft;at++,f(N,ut,ht,{end:j})}else if(O(ft))at++,f(ft,ut,ht,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ft);ft=ut}else if(U(ut)){if(K(ft))at++,o(v(ft),ut,ht,{end:j});else if(q(ft)||O(ft))at++,o(ft,ut,ht,{end:j});else if(J(ft))at++,o(ft.readable,ut,ht,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ft);ft=ut}else ft=M.from(ut)}return(G!=null&&G.aborted||$!=null&&$.aborted)&&r.nextTick(rt),ft}function R(k,L,z,{end:it}){let G=!1;if(L.on("close",()=>{G||z(new A)}),k.pipe(L,{end:!1}),it){let Z=function(){G=!0,L.end()};var $=Z;V(k)?r.nextTick(Z):k.once("end",Z)}else z();return c(k,{readable:!0,writable:!1},Z=>{let rt=k._readableState;Z&&Z.code==="ERR_STREAM_PREMATURE_CLOSE"&&rt&&rt.ended&&!rt.errored&&!rt.errorEmitted?k.once("end",z).once("error",z):z(Z)}),c(L,{readable:!1,writable:!0},z)}return uZ={pipelineImpl:E,pipeline:m},uZ}var lZ={},lMt=!1;function MMt(){if(lMt)return lZ;lMt=!0;let{pipeline:r}=vZ(),e=Dc(),{destroyer:a}=_g(),{isNodeStream:l,isReadable:i,isWritable:c,isWebStream:b,isTransformStream:g,isWritableStream:M,isReadableStream:y}=$c(),{AbortError:w,codes:{ERR_INVALID_ARG_VALUE:S,ERR_MISSING_ARGS:_}}=$f(),x=jp();return lZ=function(...I){if(I.length===0)throw new _("streams");if(I.length===1)return e.from(I[0]);let B=[...I];if(typeof I[0]=="function"&&(I[0]=e.from(I[0])),typeof I[I.length-1]=="function"){let t=I.length-1;I[t]=e.from(I[t])}for(let t=0;t<I.length;++t)if(!(!l(I[t])&&!b(I[t]))){if(t<I.length-1&&!(i(I[t])||y(I[t])||g(I[t])))throw new S(`streams[${t}]`,B[t],"must be readable");if(t>0&&!(c(I[t])||M(I[t])||g(I[t])))throw new S(`streams[${t}]`,B[t],"must be writable")}let P,O,C,K,W;function J(t){let n=K;K=null,n?n(t):t?W.destroy(t):!h&&!V&&W.destroy()}let U=I[0],q=r(I,J),V=!!(c(U)||M(U)||g(U)),h=!!(i(q)||y(q)||g(q));if(W=new e({writableObjectMode:!!(U!=null&&U.writableObjectMode),readableObjectMode:!!(q!=null&&q.readableObjectMode),writable:V,readable:h}),V){if(l(U))W._write=function(n,s,u){U.write(n,s)?u():P=u},W._final=function(n){U.end(),O=n},U.on("drain",function(){if(P){let n=P;P=null,n()}});else if(b(U)){let s=(g(U)?U.writable:U).getWriter();W._write=async function(u,d,v){try{await s.ready,s.write(u).catch(()=>{}),v()}catch(p){v(p)}},W._final=async function(u){try{await s.ready,s.close().catch(()=>{}),O=u}catch(d){u(d)}}}let t=g(q)?q.readable:q;x(t,()=>{if(O){let n=O;O=null,n()}})}if(h){if(l(q))q.on("readable",function(){if(C){let t=C;C=null,t()}}),q.on("end",function(){W.push(null)}),W._read=function(){for(;;){let t=q.read();if(t===null){C=W._read;return}if(!W.push(t))return}};else if(b(q)){let n=(g(q)?q.readable:q).getReader();W._read=async function(){for(;;)try{let{value:s,done:u}=await n.read();if(!W.push(s))return;if(u){W.push(null);return}}catch{return}}}}return W._destroy=function(t,n){!t&&K!==null&&(t=new w),C=null,P=null,O=null,K===null?n(t):(K=n,l(q)&&a(q,t))},W},lZ}var yx={},dMt=!1;function Wse(){if(dMt)return yx;dMt=!0;let r=globalThis.AbortController||_4().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:a,ERR_MISSING_ARGS:l,ERR_OUT_OF_RANGE:i},AbortError:c}=$f(),{validateAbortSignal:b,validateInteger:g,validateObject:M}=S4(),y=po().Symbol("kWeak"),w=po().Symbol("kResistStopPropagation"),{finished:S}=jp(),_=MMt(),{addAbortSignalNoValidate:x}=wx(),{isWritable:A,isNodeStream:I}=$c(),{deprecate:B}=cf(),{ArrayPrototypePush:P,Boolean:O,MathFloor:C,Number:K,NumberIsNaN:W,Promise:J,PromiseReject:U,PromiseResolve:q,PromisePrototypeThen:V,Symbol:h}=po(),t=h("kEmpty"),n=h("kEof");function s($,Z){if(Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal"),I($)&&!A($))throw new e("stream",$,"must be writable");let rt=_(this,$);return Z!=null&&Z.signal&&x(Z.signal,rt),rt}function u($,Z){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal");let rt=1;Z?.concurrency!=null&&(rt=C(Z.concurrency));let Q=rt-1;return Z?.highWaterMark!=null&&(Q=C(Z.highWaterMark)),g(rt,"options.concurrency",1),g(Q,"options.highWaterMark",0),Q+=rt,async function*(){let F=cf().AbortSignalAny([Z?.signal].filter(O)),Y=this,at=[],ht={signal:F},et,ft,ct=!1,st=0;function wt(){ct=!0,St()}function St(){st-=1,ut()}function ut(){ft&&!ct&&st<rt&&at.length<Q&&(ft(),ft=null)}async function It(){try{for await(let Pt of Y){if(ct)return;if(F.aborted)throw new c;try{if(Pt=$(Pt,ht),Pt===t)continue;Pt=q(Pt)}catch(j){Pt=U(j)}st+=1,V(Pt,St,wt),at.push(Pt),et&&(et(),et=null),!ct&&(at.length>=Q||st>=rt)&&await new J(j=>{ft=j})}at.push(n)}catch(Pt){let j=U(Pt);V(j,St,wt),at.push(j)}finally{ct=!0,et&&(et(),et=null)}}It();try{for(;;){for(;at.length>0;){let Pt=await at[0];if(Pt===n)return;if(F.aborted)throw new c;Pt!==t&&(yield Pt),at.shift(),ut()}await new J(Pt=>{et=Pt})}}finally{ct=!0,ft&&(ft(),ft=null)}}.call(this)}function d($=void 0){return $!=null&&M($,"options"),$?.signal!=null&&b($.signal,"options.signal"),async function*(){let rt=0;for await(let H of this){var Q;if($!=null&&(Q=$.signal)!==null&&Q!==void 0&&Q.aborted)throw new c({cause:$.signal.reason});yield[rt++,H]}}.call(this)}async function v($,Z=void 0){for await(let rt of m.call(this,$,Z))return!0;return!1}async function p($,Z=void 0){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);return!await v.call(this,async(...rt)=>!await $(...rt),Z)}async function f($,Z){for await(let rt of m.call(this,$,Z))return rt}async function o($,Z){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);async function rt(Q,H){return await $(Q,H),t}for await(let Q of u.call(this,rt,Z));}function m($,Z){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);async function rt(Q,H){return await $(Q,H)?Q:t}return u.call(this,rt,Z)}class E extends l{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function R($,Z,rt){var Q;if(typeof $!="function")throw new a("reducer",["Function","AsyncFunction"],$);rt!=null&&M(rt,"options"),rt?.signal!=null&&b(rt.signal,"options.signal");let H=arguments.length>1;if(rt!=null&&(Q=rt.signal)!==null&&Q!==void 0&&Q.aborted){let et=new c(void 0,{cause:rt.signal.reason});throw this.once("error",()=>{}),await S(this.destroy(et)),et}let F=new r,Y=F.signal;if(rt!=null&&rt.signal){let et={once:!0,[y]:this,[w]:!0};rt.signal.addEventListener("abort",()=>F.abort(),et)}let at=!1;try{for await(let et of this){var ht;if(at=!0,rt!=null&&(ht=rt.signal)!==null&&ht!==void 0&&ht.aborted)throw new c;H?Z=await $(Z,et,{signal:Y}):(Z=et,H=!0)}if(!at&&!H)throw new E}finally{F.abort()}return Z}async function k($){$!=null&&M($,"options"),$?.signal!=null&&b($.signal,"options.signal");let Z=[];for await(let Q of this){var rt;if($!=null&&(rt=$.signal)!==null&&rt!==void 0&&rt.aborted)throw new c(void 0,{cause:$.signal.reason});P(Z,Q)}return Z}function L($,Z){let rt=u.call(this,$,Z);return async function*(){for await(let H of rt)yield*H}.call(this)}function z($){if($=K($),W($))return 0;if($<0)throw new i("number",">= 0",$);return $}function it($,Z=void 0){return Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal"),$=z($),async function*(){var Q;if(Z!=null&&(Q=Z.signal)!==null&&Q!==void 0&&Q.aborted)throw new c;for await(let F of this){var H;if(Z!=null&&(H=Z.signal)!==null&&H!==void 0&&H.aborted)throw new c;$--<=0&&(yield F)}}.call(this)}function G($,Z=void 0){return Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal"),$=z($),async function*(){var Q;if(Z!=null&&(Q=Z.signal)!==null&&Q!==void 0&&Q.aborted)throw new c;for await(let F of this){var H;if(Z!=null&&(H=Z.signal)!==null&&H!==void 0&&H.aborted)throw new c;if($-- >0&&(yield F),$<=0)return}}.call(this)}return yx.streamReturningOperators={asIndexedPairs:B(d,"readable.asIndexedPairs will be removed in a future version."),drop:it,filter:m,flatMap:L,map:u,take:G,compose:s},yx.promiseReturningOperators={every:p,forEach:o,reduce:R,toArray:k,some:v,find:f},yx}var dZ={},cMt=!1;function _Mt(){if(cMt)return dZ;cMt=!0;let{ArrayPrototypePop:r,Promise:e}=po(),{isIterable:a,isNodeStream:l,isWebStream:i}=$c(),{pipelineImpl:c}=vZ(),{finished:b}=jp();SMt();function g(...M){return new e((y,w)=>{let S,_,x=M[M.length-1];if(x&&typeof x=="object"&&!l(x)&&!a(x)&&!i(x)){let A=r(M);S=A.signal,_=A.end}c(M,(A,I)=>{A?w(A):y(I)},{signal:S,end:_})})}return dZ={finished:b,pipeline:g},dZ}var cZ={},pMt=!1,mMt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function SMt(){if(pMt)return cZ;pMt=!0;let{Buffer:r}=Rn(),{ObjectDefineProperty:e,ObjectKeys:a,ReflectApply:l}=po(),{promisify:{custom:i}}=cf(),{streamReturningOperators:c,promiseReturningOperators:b}=Wse(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:g}}=$f(),M=MMt(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:w}=Mx(),{pipeline:S}=vZ(),{destroyer:_}=_g(),x=jp(),A=_Mt(),I=$c(),B=cZ=pZ().Stream;B.isDestroyed=I.isDestroyed,B.isDisturbed=I.isDisturbed,B.isErrored=I.isErrored,B.isReadable=I.isReadable,B.isWritable=I.isWritable,B.Readable=_x();for(let C of a(c)){let W=function(...J){if(new.target)throw g();return B.Readable.from(l(K,this||mMt,J))};var O=W;let K=c[C];e(W,"name",{__proto__:null,value:K.name}),e(W,"length",{__proto__:null,value:K.length}),e(B.Readable.prototype,C,{__proto__:null,value:W,enumerable:!1,configurable:!0,writable:!0})}for(let C of a(b)){let W=function(...U){if(new.target)throw g();return l(K,this||mMt,U)};var O=W;let K=b[C];e(W,"name",{__proto__:null,value:K.name}),e(W,"length",{__proto__:null,value:K.length}),e(B.Readable.prototype,C,{__proto__:null,value:W,enumerable:!1,configurable:!0,writable:!0})}B.Writable=mZ(),B.Duplex=Dc(),B.Transform=yMt(),B.PassThrough=wMt(),B.pipeline=S;let{addAbortSignal:P}=wx();return B.addAbortSignal=P,B.finished=x,B.destroy=_,B.compose=M,B.setDefaultHighWaterMark=y,B.getDefaultHighWaterMark=w,e(B,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return A}}),e(S,i,{__proto__:null,enumerable:!0,get(){return A.pipeline}}),e(x,i,{__proto__:null,enumerable:!0,get(){return A.finished}}),B.Stream=B,B._isUint8Array=function(K){return K instanceof Uint8Array},B._uint8ArrayToBuffer=function(K){return r.from(K.buffer,K.byteOffset,K.byteLength)},cZ}var co={},vMt=!1;function Gse(){if(vMt)return co;vMt=!0;let r=SMt(),e=_Mt(),a=r.Readable.destroy;return co=r.Readable,co._uint8ArrayToBuffer=r._uint8ArrayToBuffer,co._isUint8Array=r._isUint8Array,co.isDisturbed=r.isDisturbed,co.isErrored=r.isErrored,co.isReadable=r.isReadable,co.Readable=r.Readable,co.Writable=r.Writable,co.Duplex=r.Duplex,co.Transform=r.Transform,co.PassThrough=r.PassThrough,co.addAbortSignal=r.addAbortSignal,co.finished=r.finished,co.destroy=r.destroy,co.destroy=a,co.pipeline=r.pipeline,co.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get(){return e}}),co.Stream=r.Stream,co.default=co,co}var Sa=Gse();Sa._uint8ArrayToBuffer;Sa._isUint8Array;Sa.isDisturbed;Sa.isErrored;Sa.isReadable;Sa.Readable;Sa.Writable;Sa.Duplex;Sa.Transform;Sa.PassThrough;Sa.addAbortSignal;Sa.finished;Sa.destroy;Sa.pipeline;Sa.compose;Sa.Stream;var bMt=Sa.Readable;bMt.wrap=function(r,e){return e=Object.assign({objectMode:r.readableObjectMode!=null||r.objectMode!=null||!0},e),e.destroy=function(a,l){r.destroy(a),l(a)},new bMt(e).wrap(r)};var dDe=Sa.Writable,cDe=Sa.Duplex,xMt=Sa.Transform,EMt=Sa.PassThrough,pDe=Sa.finished,mDe=Sa.pipeline,vDe=Sa.Stream,bDe={finished:ZS(Sa.finished),pipeline:ZS(Sa.pipeline)};var Iv=An(Wh(),1);rd();async function AMt(r){let e=RMt(r),a=(await e.next()).value;a=await pf(e,a,32);let l=lo(a.subarray(0,32));a=a.subarray(32);let i=64*l;a=await pf(e,a,i);let c=new Array(l);for(let M=0;M<i;M+=64)c[M/64]=[lo(a.subarray(M,M+32)),(0,Iv.default)(Ft.from(a.subarray(M+32,M+64)))];a=a.subarray(i);let b=32+i,g=[];for(let[M,y]of c){a=await pf(e,a,px),a=await pf(e,a,2);let w=lo(a.subarray(0,2));a=a.subarray(2);let{sigLength:S,pubLength:_,sigName:x}=Zi[w];a=await pf(e,a,S);let A=a.subarray(0,S);a=a.subarray(S),a=await pf(e,a,_);let I=a.subarray(0,_);a=a.subarray(_),a=await pf(e,a,1);let B=a[0]===1;B&&(a=await pf(e,a,33));let P=B?a.subarray(1,33):Ft.allocUnsafe(0);a=a.subarray(B?33:1),a=await pf(e,a,1);let O=a[0]===1;O&&(a=await pf(e,a,33));let C=O?a.subarray(1,33):Ft.allocUnsafe(0);a=a.subarray(O?33:1),a=await pf(e,a,8);let K=lo(a.subarray(0,8));a=a.subarray(8),a=await pf(e,a,8);let W=lo(a.subarray(0,8));a=a.subarray(8),a=await pf(e,a,W);let J=a.subarray(0,W),U=K!==0&&W!==0?yg(Ft.from(J)):[];if(U.length!==K)throw new Error("Tags lengths don't match");a=a.subarray(W);let q=new xMt;q._transform=function(s,u,d){this.push(s),d()};let V=bp([(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(w.toString()),I,P,C,J,q]),h=2+S+_+(B?33:1)+(O?33:1)+16+W,t=M-h;if(a.byteLength>t)q.write(a.subarray(0,t)),a=a.subarray(t);else{let s=a.byteLength;for(q.write(a);t>s;){if(a=(await e.next()).value,!a)throw new Error(`Not enough data bytes expected: ${t} received: ${s}`);s+=a.byteLength,s>t?q.write(a.subarray(0,a.byteLength-(s-t))):q.write(a)}a=a.subarray(a.byteLength-(s-t))}if(q.end(),y!==(0,Iv.default)(Zu("sha256").update(A).digest()))throw new Error("ID doesn't match signature");if(!await p4[w].verify(I,await V,A))throw new Error("Invalid signature");g.push({id:y,sigName:x,signature:(0,Iv.default)(Ft.from(A)),target:(0,Iv.default)(Ft.from(P)),anchor:(0,Iv.default)(Ft.from(C)),owner:(0,Iv.default)(Ft.from(I)),tags:U,dataOffset:b+h,dataSize:t}),b+=h+t}return g}async function Vse(r,e,a,l){let i=y4("",a,l),c=new EMt,b=[(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,r],g=await bp(b),M=Ft.from(await a.sign(g));return i.setSignature(M),c.write(i.getRaw()),e.pipe(c)}async function pf(r,e,a){if(e.byteLength>=a)return e;let{done:l,value:i}=await r.next();if(l&&!i)throw new Error("Invalid buffer");return pf(r,Ft.concat([Ft.from(e),Ft.from(i)]),a)}async function*RMt(r){for await(let e of r)yield e}var Yse=AMt,Jse={readBytes:pf,getReader:RMt};var Xse={...GK,stream:bZ};globalThis.arbundles??=Xse;Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var ln;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function a(i){throw new Error}r.assertNever=a,r.arrayToEnum=i=>{let c={};for(let b of i)c[b]=b;return c},r.getValidEnumValues=i=>{let c=r.objectKeys(i).filter(g=>typeof i[i[g]]!="number"),b={};for(let g of c)b[g]=i[g];return r.objectValues(b)},r.objectValues=i=>r.objectKeys(i).map(function(c){return i[c]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let c=[];for(let b in i)Object.prototype.hasOwnProperty.call(i,b)&&c.push(b);return c},r.find=(i,c)=>{for(let b of i)if(c(b))return b},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function l(i,c=" | "){return i.map(b=>typeof b=="string"?`'${b}'`:b).join(c)}r.joinValues=l,r.jsonStringifyReplacer=(i,c)=>typeof c=="bigint"?c.toString():c})(ln||(ln={}));var yZ;(function(r){r.mergeShapes=(e,a)=>({...e,...a})})(yZ||(yZ={}));var Er=ln.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Uc=r=>{switch(typeof r){case"undefined":return Er.undefined;case"string":return Er.string;case"number":return isNaN(r)?Er.nan:Er.number;case"boolean":return Er.boolean;case"function":return Er.function;case"bigint":return Er.bigint;case"symbol":return Er.symbol;case"object":return Array.isArray(r)?Er.array:r===null?Er.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Er.promise:typeof Map<"u"&&r instanceof Map?Er.map:typeof Set<"u"&&r instanceof Set?Er.set:typeof Date<"u"&&r instanceof Date?Er.date:Er.object;default:return Er.unknown}},sr=ln.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Qse=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),Rh=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){let a=e||function(c){return c.message},l={_errors:[]},i=c=>{for(let b of c.issues)if(b.code==="invalid_union")b.unionErrors.map(i);else if(b.code==="invalid_return_type")i(b.returnTypeError);else if(b.code==="invalid_arguments")i(b.argumentsError);else if(b.path.length===0)l._errors.push(a(b));else{let g=l,M=0;for(;M<b.path.length;){let y=b.path[M];M===b.path.length-1?(g[y]=g[y]||{_errors:[]},g[y]._errors.push(a(b))):g[y]=g[y]||{_errors:[]},g=g[y],M++}}};return i(this),l}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ln.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){let a={},l=[];for(let i of this.issues)i.path.length>0?(a[i.path[0]]=a[i.path[0]]||[],a[i.path[0]].push(e(i))):l.push(e(i));return{formErrors:l,fieldErrors:a}}get formErrors(){return this.flatten()}};Rh.create=r=>new Rh(r);var Eg=(r,e)=>{let a;switch(r.code){case sr.invalid_type:r.received===Er.undefined?a="Required":a=`Expected ${r.expected}, received ${r.received}`;break;case sr.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(r.expected,ln.jsonStringifyReplacer)}`;break;case sr.unrecognized_keys:a=`Unrecognized key(s) in object: ${ln.joinValues(r.keys,", ")}`;break;case sr.invalid_union:a="Invalid input";break;case sr.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ln.joinValues(r.options)}`;break;case sr.invalid_enum_value:a=`Invalid enum value. Expected ${ln.joinValues(r.options)}, received '${r.received}'`;break;case sr.invalid_arguments:a="Invalid function arguments";break;case sr.invalid_return_type:a="Invalid function return type";break;case sr.invalid_date:a="Invalid date";break;case sr.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(a=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?a=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?a=`Invalid input: must end with "${r.validation.endsWith}"`:ln.assertNever(r.validation):r.validation!=="regex"?a=`Invalid ${r.validation}`:a="Invalid";break;case sr.too_small:r.type==="array"?a=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?a=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?a=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?a=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:a="Invalid input";break;case sr.too_big:r.type==="array"?a=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?a=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?a=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?a=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?a=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:a="Invalid input";break;case sr.custom:a="Invalid input";break;case sr.invalid_intersection_types:a="Intersection results could not be merged";break;case sr.not_multiple_of:a=`Number must be a multiple of ${r.multipleOf}`;break;case sr.not_finite:a="Number must be finite";break;default:a=e.defaultError,ln.assertNever(r)}return{message:a}},BMt=Eg;function tfe(r){BMt=r}function Sx(){return BMt}var xx=r=>{let{data:e,path:a,errorMaps:l,issueData:i}=r,c=[...a,...i.path||[]],b={...i,path:c};if(i.message!==void 0)return{...i,path:c,message:i.message};let g="",M=l.filter(y=>!!y).slice().reverse();for(let y of M)g=y(b,{data:e,defaultError:g}).message;return{...i,path:c,message:g}},efe=[];function _r(r,e){let a=Sx(),l=xx({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a,a===Eg?void 0:Eg].filter(i=>!!i)});r.common.issues.push(l)}var tf=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){let l=[];for(let i of a){if(i.status==="aborted")return Kr;i.status==="dirty"&&e.dirty(),l.push(i.value)}return{status:e.value,value:l}}static async mergeObjectAsync(e,a){let l=[];for(let i of a){let c=await i.key,b=await i.value;l.push({key:c,value:b})}return r.mergeObjectSync(e,l)}static mergeObjectSync(e,a){let l={};for(let i of a){let{key:c,value:b}=i;if(c.status==="aborted"||b.status==="aborted")return Kr;c.status==="dirty"&&e.dirty(),b.status==="dirty"&&e.dirty(),c.value!=="__proto__"&&(typeof b.value<"u"||i.alwaysSet)&&(l[c.value]=b.value)}return{status:e.value,value:l}}},Kr=Object.freeze({status:"aborted"}),xg=r=>({status:"dirty",value:r}),mf=r=>({status:"valid",value:r}),wZ=r=>r.status==="aborted",MZ=r=>r.status==="dirty",kv=r=>r.status==="valid",A4=r=>typeof Promise<"u"&&r instanceof Promise;function Ex(r,e,a,l){if(a==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!l:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?l:a==="a"?l.call(r):l?l.value:e.get(r)}function PMt(r,e,a,l,i){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?i.call(r,a):i?i.value=a:e.set(r,a),a}var kr;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(kr||(kr={}));var x4,E4,K0=class{constructor(e,a,l,i){this._cachedPath=[],this.parent=e,this.data=a,this._path=l,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},IMt=(r,e)=>{if(kv(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let a=new Rh(r.common.issues);return this._error=a,this._error}}};function gi(r){if(!r)return{};let{errorMap:e,invalid_type_error:a,required_error:l,description:i}=r;if(e&&(a||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(b,g)=>{var M,y;let{message:w}=r;return b.code==="invalid_enum_value"?{message:w??g.defaultError}:typeof g.data>"u"?{message:(M=w??l)!==null&&M!==void 0?M:g.defaultError}:b.code!=="invalid_type"?{message:g.defaultError}:{message:(y=w??a)!==null&&y!==void 0?y:g.defaultError}},description:i}}var yi=class{get description(){return this._def.description}_getType(e){return Uc(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:Uc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tf,ctx:{common:e.parent.common,data:e.data,parsedType:Uc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let a=this._parse(e);if(A4(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){let a=this._parse(e);return Promise.resolve(a)}parse(e,a){let l=this.safeParse(e,a);if(l.success)return l.data;throw l.error}safeParse(e,a){var l;let i={common:{issues:[],async:(l=a?.async)!==null&&l!==void 0?l:!1,contextualErrorMap:a?.errorMap},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Uc(e)},c=this._parseSync({data:e,path:i.path,parent:i});return IMt(i,c)}"~validate"(e){var a,l;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Uc(e)};if(!this["~standard"].async)try{let c=this._parseSync({data:e,path:[],parent:i});return kv(c)?{value:c.value}:{issues:i.common.issues}}catch(c){!((l=(a=c?.message)===null||a===void 0?void 0:a.toLowerCase())===null||l===void 0)&&l.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(c=>kv(c)?{value:c.value}:{issues:i.common.issues})}async parseAsync(e,a){let l=await this.safeParseAsync(e,a);if(l.success)return l.data;throw l.error}async safeParseAsync(e,a){let l={common:{issues:[],contextualErrorMap:a?.errorMap,async:!0},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Uc(e)},i=this._parse({data:e,path:l.path,parent:l}),c=await(A4(i)?i:Promise.resolve(i));return IMt(l,c)}refine(e,a){let l=i=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(i):a;return this._refinement((i,c)=>{let b=e(i),g=()=>c.addIssue({code:sr.custom,...l(i)});return typeof Promise<"u"&&b instanceof Promise?b.then(M=>M?!0:(g(),!1)):b?!0:(g(),!1)})}refinement(e,a){return this._refinement((l,i)=>e(l)?!0:(i.addIssue(typeof a=="function"?a(l,i):a),!1))}_refinement(e){return new Ih({schema:this,typeName:Ur.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return H0.create(this,this._def)}nullable(){return Ed.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zc.create(this)}promise(){return Hp.create(this,this._def)}or(e){return Lv.create([this,e],this._def)}and(e){return Dv.create(this,e,this._def)}transform(e){return new Ih({...gi(this._def),schema:this,typeName:Ur.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let a=typeof e=="function"?e:()=>e;return new zv({...gi(this._def),innerType:this,defaultValue:a,typeName:Ur.ZodDefault})}brand(){return new R4({typeName:Ur.ZodBranded,type:this,...gi(this._def)})}catch(e){let a=typeof e=="function"?e:()=>e;return new Fv({...gi(this._def),innerType:this,catchValue:a,typeName:Ur.ZodCatch})}describe(e){let a=this.constructor;return new a({...this._def,description:e})}pipe(e){return I4.create(this,e)}readonly(){return Hv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},rfe=/^c[^\s-]{8,}$/i,ife=/^[0-9a-z]+$/,nfe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,afe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ofe=/^[a-z0-9_-]{21}$/i,sfe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ffe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,hfe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ufe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gZ,lfe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dfe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cfe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,pfe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mfe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vfe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,NMt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",bfe=new RegExp(`^${NMt}$`);function OMt(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function gfe(r){return new RegExp(`^${OMt(r)}$`)}function CMt(r){let e=`${NMt}T${OMt(r)}`,a=[];return a.push(r.local?"Z?":"Z"),r.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function yfe(r,e){return!!((e==="v4"||!e)&&lfe.test(r)||(e==="v6"||!e)&&cfe.test(r))}function wfe(r,e){if(!sfe.test(r))return!1;try{let[a]=r.split("."),l=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),i=JSON.parse(atob(l));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function Mfe(r,e){return!!((e==="v4"||!e)&&dfe.test(r)||(e==="v6"||!e)&&pfe.test(r))}var zp=class r extends yi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Er.string){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_type,expected:Er.string,received:c.parsedType}),Kr}let l=new tf,i;for(let c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),l.dirty());else if(c.kind==="max")e.data.length>c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),l.dirty());else if(c.kind==="length"){let b=e.data.length>c.value,g=e.data.length<c.value;(b||g)&&(i=this._getOrReturnCtx(e,i),b?_r(i,{code:sr.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):g&&_r(i,{code:sr.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),l.dirty())}else if(c.kind==="email")hfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"email",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="emoji")gZ||(gZ=new RegExp(ufe,"u")),gZ.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"emoji",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="uuid")afe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"uuid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="nanoid")ofe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"nanoid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="cuid")rfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"cuid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="cuid2")ife.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"cuid2",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="ulid")nfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"ulid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),_r(i,{validation:"url",code:sr.invalid_string,message:c.message}),l.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"regex",code:sr.invalid_string,message:c.message}),l.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="includes"?e.data.includes(c.value,c.position)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),l.dirty()):c.kind==="toLowerCase"?e.data=e.data.toLowerCase():c.kind==="toUpperCase"?e.data=e.data.toUpperCase():c.kind==="startsWith"?e.data.startsWith(c.value)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:{startsWith:c.value},message:c.message}),l.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:{endsWith:c.value},message:c.message}),l.dirty()):c.kind==="datetime"?CMt(c).test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"datetime",message:c.message}),l.dirty()):c.kind==="date"?bfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"date",message:c.message}),l.dirty()):c.kind==="time"?gfe(c).test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"time",message:c.message}),l.dirty()):c.kind==="duration"?ffe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"duration",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="ip"?yfe(e.data,c.version)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"ip",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="jwt"?wfe(e.data,c.alg)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"jwt",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="cidr"?Mfe(e.data,c.version)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"cidr",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="base64"?mfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"base64",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="base64url"?vfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"base64url",code:sr.invalid_string,message:c.message}),l.dirty()):ln.assertNever(c);return{status:l.value,value:e.data}}_regex(e,a,l){return this.refinement(i=>e.test(i),{validation:a,code:sr.invalid_string,...kr.errToObj(l)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...kr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...kr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...kr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...kr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...kr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...kr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...kr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...kr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...kr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...kr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...kr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...kr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...kr.errToObj(e)})}datetime(e){var a,l;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(a=e?.offset)!==null&&a!==void 0?a:!1,local:(l=e?.local)!==null&&l!==void 0?l:!1,...kr.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...kr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...kr.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...kr.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a?.position,...kr.errToObj(a?.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...kr.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...kr.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...kr.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...kr.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...kr.errToObj(a)})}nonempty(e){return this.min(1,kr.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};zp.create=r=>{var e;return new zp({checks:[],typeName:Ur.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...gi(r)})};function _fe(r,e){let a=(r.toString().split(".")[1]||"").length,l=(e.toString().split(".")[1]||"").length,i=a>l?a:l,c=parseInt(r.toFixed(i).replace(".","")),b=parseInt(e.toFixed(i).replace(".",""));return c%b/Math.pow(10,i)}var Tv=class r extends yi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Er.number){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_type,expected:Er.number,received:c.parsedType}),Kr}let l,i=new tf;for(let c of this._def.checks)c.kind==="int"?ln.isInteger(e.data)||(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.invalid_type,expected:"integer",received:"float",message:c.message}),i.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),i.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),i.dirty()):c.kind==="multipleOf"?_fe(e.data,c.value)!==0&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.not_multiple_of,multipleOf:c.value,message:c.message}),i.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.not_finite,message:c.message}),i.dirty()):ln.assertNever(c);return{status:i.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,kr.toString(a))}gt(e,a){return this.setLimit("min",e,!1,kr.toString(a))}lte(e,a){return this.setLimit("max",e,!0,kr.toString(a))}lt(e,a){return this.setLimit("max",e,!1,kr.toString(a))}setLimit(e,a,l,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:l,message:kr.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:kr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kr.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:kr.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:kr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kr.toString(e)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ln.isInteger(e.value))}get isFinite(){let e=null,a=null;for(let l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(a===null||l.value>a)&&(a=l.value):l.kind==="max"&&(e===null||l.value<e)&&(e=l.value)}return Number.isFinite(a)&&Number.isFinite(e)}};Tv.create=r=>new Tv({checks:[],typeName:Ur.ZodNumber,coerce:r?.coerce||!1,...gi(r)});var Bv=class r extends yi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Er.bigint)return this._getInvalidInput(e);let l,i=new tf;for(let c of this._def.checks)c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),i.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),i.dirty()):c.kind==="multipleOf"?e.data%c.value!==BigInt(0)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.not_multiple_of,multipleOf:c.value,message:c.message}),i.dirty()):ln.assertNever(c);return{status:i.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return _r(a,{code:sr.invalid_type,expected:Er.bigint,received:a.parsedType}),Kr}gte(e,a){return this.setLimit("min",e,!0,kr.toString(a))}gt(e,a){return this.setLimit("min",e,!1,kr.toString(a))}lte(e,a){return this.setLimit("max",e,!0,kr.toString(a))}lt(e,a){return this.setLimit("max",e,!1,kr.toString(a))}setLimit(e,a,l,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:l,message:kr.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:kr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kr.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:kr.toString(a)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};Bv.create=r=>{var e;return new Bv({checks:[],typeName:Ur.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...gi(r)})};var Pv=class extends yi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Er.boolean){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.boolean,received:l.parsedType}),Kr}return mf(e.data)}};Pv.create=r=>new Pv({typeName:Ur.ZodBoolean,coerce:r?.coerce||!1,...gi(r)});var Nv=class r extends yi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Er.date){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_type,expected:Er.date,received:c.parsedType}),Kr}if(isNaN(e.data.getTime())){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_date}),Kr}let l=new tf,i;for(let c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),l.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),l.dirty()):ln.assertNever(c);return{status:l.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:kr.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:kr.toString(a)})}get minDate(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}};Nv.create=r=>new Nv({checks:[],coerce:r?.coerce||!1,typeName:Ur.ZodDate,...gi(r)});var Ag=class extends yi{_parse(e){if(this._getType(e)!==Er.symbol){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.symbol,received:l.parsedType}),Kr}return mf(e.data)}};Ag.create=r=>new Ag({typeName:Ur.ZodSymbol,...gi(r)});var Ov=class extends yi{_parse(e){if(this._getType(e)!==Er.undefined){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.undefined,received:l.parsedType}),Kr}return mf(e.data)}};Ov.create=r=>new Ov({typeName:Ur.ZodUndefined,...gi(r)});var Cv=class extends yi{_parse(e){if(this._getType(e)!==Er.null){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.null,received:l.parsedType}),Kr}return mf(e.data)}};Cv.create=r=>new Cv({typeName:Ur.ZodNull,...gi(r)});var Fp=class extends yi{constructor(){super(...arguments),this._any=!0}_parse(e){return mf(e.data)}};Fp.create=r=>new Fp({typeName:Ur.ZodAny,...gi(r)});var jc=class extends yi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return mf(e.data)}};jc.create=r=>new jc({typeName:Ur.ZodUnknown,...gi(r)});var fl=class extends yi{_parse(e){let a=this._getOrReturnCtx(e);return _r(a,{code:sr.invalid_type,expected:Er.never,received:a.parsedType}),Kr}};fl.create=r=>new fl({typeName:Ur.ZodNever,...gi(r)});var Rg=class extends yi{_parse(e){if(this._getType(e)!==Er.undefined){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.void,received:l.parsedType}),Kr}return mf(e.data)}};Rg.create=r=>new Rg({typeName:Ur.ZodVoid,...gi(r)});var zc=class r extends yi{_parse(e){let{ctx:a,status:l}=this._processInputParams(e),i=this._def;if(a.parsedType!==Er.array)return _r(a,{code:sr.invalid_type,expected:Er.array,received:a.parsedType}),Kr;if(i.exactLength!==null){let b=a.data.length>i.exactLength.value,g=a.data.length<i.exactLength.value;(b||g)&&(_r(a,{code:b?sr.too_big:sr.too_small,minimum:g?i.exactLength.value:void 0,maximum:b?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),l.dirty())}if(i.minLength!==null&&a.data.length<i.minLength.value&&(_r(a,{code:sr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),l.dirty()),i.maxLength!==null&&a.data.length>i.maxLength.value&&(_r(a,{code:sr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),l.dirty()),a.common.async)return Promise.all([...a.data].map((b,g)=>i.type._parseAsync(new K0(a,b,a.path,g)))).then(b=>tf.mergeArray(l,b));let c=[...a.data].map((b,g)=>i.type._parseSync(new K0(a,b,a.path,g)));return tf.mergeArray(l,c)}get element(){return this._def.type}min(e,a){return new r({...this._def,minLength:{value:e,message:kr.toString(a)}})}max(e,a){return new r({...this._def,maxLength:{value:e,message:kr.toString(a)}})}length(e,a){return new r({...this._def,exactLength:{value:e,message:kr.toString(a)}})}nonempty(e){return this.min(1,e)}};zc.create=(r,e)=>new zc({type:r,minLength:null,maxLength:null,exactLength:null,typeName:Ur.ZodArray,...gi(e)});function Sg(r){if(r instanceof qf){let e={};for(let a in r.shape){let l=r.shape[a];e[a]=H0.create(Sg(l))}return new qf({...r._def,shape:()=>e})}else return r instanceof zc?new zc({...r._def,type:Sg(r.element)}):r instanceof H0?H0.create(Sg(r.unwrap())):r instanceof Ed?Ed.create(Sg(r.unwrap())):r instanceof xd?xd.create(r.items.map(e=>Sg(e))):r}var qf=class r extends yi{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),a=ln.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==Er.object){let y=this._getOrReturnCtx(e);return _r(y,{code:sr.invalid_type,expected:Er.object,received:y.parsedType}),Kr}let{status:l,ctx:i}=this._processInputParams(e),{shape:c,keys:b}=this._getCached(),g=[];if(!(this._def.catchall instanceof fl&&this._def.unknownKeys==="strip"))for(let y in i.data)b.includes(y)||g.push(y);let M=[];for(let y of b){let w=c[y],S=i.data[y];M.push({key:{status:"valid",value:y},value:w._parse(new K0(i,S,i.path,y)),alwaysSet:y in i.data})}if(this._def.catchall instanceof fl){let y=this._def.unknownKeys;if(y==="passthrough")for(let w of g)M.push({key:{status:"valid",value:w},value:{status:"valid",value:i.data[w]}});else if(y==="strict")g.length>0&&(_r(i,{code:sr.unrecognized_keys,keys:g}),l.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let y=this._def.catchall;for(let w of g){let S=i.data[w];M.push({key:{status:"valid",value:w},value:y._parse(new K0(i,S,i.path,w)),alwaysSet:w in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let y=[];for(let w of M){let S=await w.key,_=await w.value;y.push({key:S,value:_,alwaysSet:w.alwaysSet})}return y}).then(y=>tf.mergeObjectSync(l,y)):tf.mergeObjectSync(l,M)}get shape(){return this._def.shape()}strict(e){return kr.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,l)=>{var i,c,b,g;let M=(b=(c=(i=this._def).errorMap)===null||c===void 0?void 0:c.call(i,a,l).message)!==null&&b!==void 0?b:l.defaultError;return a.code==="unrecognized_keys"?{message:(g=kr.errToObj(e).message)!==null&&g!==void 0?g:M}:{message:M}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ur.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let a={};return ln.objectKeys(e).forEach(l=>{e[l]&&this.shape[l]&&(a[l]=this.shape[l])}),new r({...this._def,shape:()=>a})}omit(e){let a={};return ln.objectKeys(this.shape).forEach(l=>{e[l]||(a[l]=this.shape[l])}),new r({...this._def,shape:()=>a})}deepPartial(){return Sg(this)}partial(e){let a={};return ln.objectKeys(this.shape).forEach(l=>{let i=this.shape[l];e&&!e[l]?a[l]=i:a[l]=i.optional()}),new r({...this._def,shape:()=>a})}required(e){let a={};return ln.objectKeys(this.shape).forEach(l=>{if(e&&!e[l])a[l]=this.shape[l];else{let c=this.shape[l];for(;c instanceof H0;)c=c._def.innerType;a[l]=c}}),new r({...this._def,shape:()=>a})}keyof(){return LMt(ln.objectKeys(this.shape))}};qf.create=(r,e)=>new qf({shape:()=>r,unknownKeys:"strip",catchall:fl.create(),typeName:Ur.ZodObject,...gi(e)});qf.strictCreate=(r,e)=>new qf({shape:()=>r,unknownKeys:"strict",catchall:fl.create(),typeName:Ur.ZodObject,...gi(e)});qf.lazycreate=(r,e)=>new qf({shape:r,unknownKeys:"strip",catchall:fl.create(),typeName:Ur.ZodObject,...gi(e)});var Lv=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l=this._def.options;function i(c){for(let g of c)if(g.result.status==="valid")return g.result;for(let g of c)if(g.result.status==="dirty")return a.common.issues.push(...g.ctx.common.issues),g.result;let b=c.map(g=>new Rh(g.ctx.common.issues));return _r(a,{code:sr.invalid_union,unionErrors:b}),Kr}if(a.common.async)return Promise.all(l.map(async c=>{let b={...a,common:{...a.common,issues:[]},parent:null};return{result:await c._parseAsync({data:a.data,path:a.path,parent:b}),ctx:b}})).then(i);{let c,b=[];for(let M of l){let y={...a,common:{...a.common,issues:[]},parent:null},w=M._parseSync({data:a.data,path:a.path,parent:y});if(w.status==="valid")return w;w.status==="dirty"&&!c&&(c={result:w,ctx:y}),y.common.issues.length&&b.push(y.common.issues)}if(c)return a.common.issues.push(...c.ctx.common.issues),c.result;let g=b.map(M=>new Rh(M));return _r(a,{code:sr.invalid_union,unionErrors:g}),Kr}}get options(){return this._def.options}};Lv.create=(r,e)=>new Lv({options:r,typeName:Ur.ZodUnion,...gi(e)});var qc=r=>r instanceof $v?qc(r.schema):r instanceof Ih?qc(r.innerType()):r instanceof qv?[r.value]:r instanceof Uv?r.options:r instanceof jv?ln.objectValues(r.enum):r instanceof zv?qc(r._def.innerType):r instanceof Ov?[void 0]:r instanceof Cv?[null]:r instanceof H0?[void 0,...qc(r.unwrap())]:r instanceof Ed?[null,...qc(r.unwrap())]:r instanceof R4||r instanceof Hv?qc(r.unwrap()):r instanceof Fv?qc(r._def.innerType):[],Ax=class r extends yi{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==Er.object)return _r(a,{code:sr.invalid_type,expected:Er.object,received:a.parsedType}),Kr;let l=this.discriminator,i=a.data[l],c=this.optionsMap.get(i);return c?a.common.async?c._parseAsync({data:a.data,path:a.path,parent:a}):c._parseSync({data:a.data,path:a.path,parent:a}):(_r(a,{code:sr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),Kr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,l){let i=new Map;for(let c of a){let b=qc(c.shape[e]);if(!b.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let g of b){if(i.has(g))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(g)}`);i.set(g,c)}}return new r({typeName:Ur.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:i,...gi(l)})}};function _Z(r,e){let a=Uc(r),l=Uc(e);if(r===e)return{valid:!0,data:r};if(a===Er.object&&l===Er.object){let i=ln.objectKeys(e),c=ln.objectKeys(r).filter(g=>i.indexOf(g)!==-1),b={...r,...e};for(let g of c){let M=_Z(r[g],e[g]);if(!M.valid)return{valid:!1};b[g]=M.data}return{valid:!0,data:b}}else if(a===Er.array&&l===Er.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let c=0;c<r.length;c++){let b=r[c],g=e[c],M=_Z(b,g);if(!M.valid)return{valid:!1};i.push(M.data)}return{valid:!0,data:i}}else return a===Er.date&&l===Er.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Dv=class extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e),i=(c,b)=>{if(wZ(c)||wZ(b))return Kr;let g=_Z(c.value,b.value);return g.valid?((MZ(c)||MZ(b))&&a.dirty(),{status:a.value,value:g.data}):(_r(l,{code:sr.invalid_intersection_types}),Kr)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([c,b])=>i(c,b)):i(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}};Dv.create=(r,e,a)=>new Dv({left:r,right:e,typeName:Ur.ZodIntersection,...gi(a)});var xd=class r extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.array)return _r(l,{code:sr.invalid_type,expected:Er.array,received:l.parsedType}),Kr;if(l.data.length<this._def.items.length)return _r(l,{code:sr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Kr;!this._def.rest&&l.data.length>this._def.items.length&&(_r(l,{code:sr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());let c=[...l.data].map((b,g)=>{let M=this._def.items[g]||this._def.rest;return M?M._parse(new K0(l,b,l.path,g)):null}).filter(b=>!!b);return l.common.async?Promise.all(c).then(b=>tf.mergeArray(a,b)):tf.mergeArray(a,c)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};xd.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xd({items:r,typeName:Ur.ZodTuple,rest:null,...gi(e)})};var Rx=class r extends yi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.object)return _r(l,{code:sr.invalid_type,expected:Er.object,received:l.parsedType}),Kr;let i=[],c=this._def.keyType,b=this._def.valueType;for(let g in l.data)i.push({key:c._parse(new K0(l,g,l.path,g)),value:b._parse(new K0(l,l.data[g],l.path,g)),alwaysSet:g in l.data});return l.common.async?tf.mergeObjectAsync(a,i):tf.mergeObjectSync(a,i)}get element(){return this._def.valueType}static create(e,a,l){return a instanceof yi?new r({keyType:e,valueType:a,typeName:Ur.ZodRecord,...gi(l)}):new r({keyType:zp.create(),valueType:e,typeName:Ur.ZodRecord,...gi(a)})}},Ig=class extends yi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.map)return _r(l,{code:sr.invalid_type,expected:Er.map,received:l.parsedType}),Kr;let i=this._def.keyType,c=this._def.valueType,b=[...l.data.entries()].map(([g,M],y)=>({key:i._parse(new K0(l,g,l.path,[y,"key"])),value:c._parse(new K0(l,M,l.path,[y,"value"]))}));if(l.common.async){let g=new Map;return Promise.resolve().then(async()=>{for(let M of b){let y=await M.key,w=await M.value;if(y.status==="aborted"||w.status==="aborted")return Kr;(y.status==="dirty"||w.status==="dirty")&&a.dirty(),g.set(y.value,w.value)}return{status:a.value,value:g}})}else{let g=new Map;for(let M of b){let y=M.key,w=M.value;if(y.status==="aborted"||w.status==="aborted")return Kr;(y.status==="dirty"||w.status==="dirty")&&a.dirty(),g.set(y.value,w.value)}return{status:a.value,value:g}}}};Ig.create=(r,e,a)=>new Ig({valueType:e,keyType:r,typeName:Ur.ZodMap,...gi(a)});var kg=class r extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.set)return _r(l,{code:sr.invalid_type,expected:Er.set,received:l.parsedType}),Kr;let i=this._def;i.minSize!==null&&l.data.size<i.minSize.value&&(_r(l,{code:sr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),a.dirty()),i.maxSize!==null&&l.data.size>i.maxSize.value&&(_r(l,{code:sr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),a.dirty());let c=this._def.valueType;function b(M){let y=new Set;for(let w of M){if(w.status==="aborted")return Kr;w.status==="dirty"&&a.dirty(),y.add(w.value)}return{status:a.value,value:y}}let g=[...l.data.values()].map((M,y)=>c._parse(new K0(l,M,l.path,y)));return l.common.async?Promise.all(g).then(M=>b(M)):b(g)}min(e,a){return new r({...this._def,minSize:{value:e,message:kr.toString(a)}})}max(e,a){return new r({...this._def,maxSize:{value:e,message:kr.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};kg.create=(r,e)=>new kg({valueType:r,minSize:null,maxSize:null,typeName:Ur.ZodSet,...gi(e)});var Ix=class r extends yi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==Er.function)return _r(a,{code:sr.invalid_type,expected:Er.function,received:a.parsedType}),Kr;function l(g,M){return xx({data:g,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Sx(),Eg].filter(y=>!!y),issueData:{code:sr.invalid_arguments,argumentsError:M}})}function i(g,M){return xx({data:g,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Sx(),Eg].filter(y=>!!y),issueData:{code:sr.invalid_return_type,returnTypeError:M}})}let c={errorMap:a.common.contextualErrorMap},b=a.data;if(this._def.returns instanceof Hp){let g=this;return mf(async function(...M){let y=new Rh([]),w=await g._def.args.parseAsync(M,c).catch(x=>{throw y.addIssue(l(M,x)),y}),S=await Reflect.apply(b,this,w);return await g._def.returns._def.type.parseAsync(S,c).catch(x=>{throw y.addIssue(i(S,x)),y})})}else{let g=this;return mf(function(...M){let y=g._def.args.safeParse(M,c);if(!y.success)throw new Rh([l(M,y.error)]);let w=Reflect.apply(b,this,y.data),S=g._def.returns.safeParse(w,c);if(!S.success)throw new Rh([i(w,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:xd.create(e).rest(jc.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,l){return new r({args:e||xd.create([]).rest(jc.create()),returns:a||jc.create(),typeName:Ur.ZodFunction,...gi(l)})}},$v=class extends yi{get schema(){return this._def.getter()}_parse(e){let{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}};$v.create=(r,e)=>new $v({getter:r,typeName:Ur.ZodLazy,...gi(e)});var qv=class extends yi{_parse(e){if(e.data!==this._def.value){let a=this._getOrReturnCtx(e);return _r(a,{received:a.data,code:sr.invalid_literal,expected:this._def.value}),Kr}return{status:"valid",value:e.data}}get value(){return this._def.value}};qv.create=(r,e)=>new qv({value:r,typeName:Ur.ZodLiteral,...gi(e)});function LMt(r,e){return new Uv({values:r,typeName:Ur.ZodEnum,...gi(e)})}var Uv=class r extends yi{constructor(){super(...arguments),x4.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),l=this._def.values;return _r(a,{expected:ln.joinValues(l),received:a.parsedType,code:sr.invalid_type}),Kr}if(Ex(this,x4,"f")||PMt(this,x4,new Set(this._def.values),"f"),!Ex(this,x4,"f").has(e.data)){let a=this._getOrReturnCtx(e),l=this._def.values;return _r(a,{received:a.data,code:sr.invalid_enum_value,options:l}),Kr}return mf(e.data)}get options(){return this._def.values}get enum(){let e={};for(let a of this._def.values)e[a]=a;return e}get Values(){let e={};for(let a of this._def.values)e[a]=a;return e}get Enum(){let e={};for(let a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return r.create(e,{...this._def,...a})}exclude(e,a=this._def){return r.create(this.options.filter(l=>!e.includes(l)),{...this._def,...a})}};x4=new WeakMap;Uv.create=LMt;var jv=class extends yi{constructor(){super(...arguments),E4.set(this,void 0)}_parse(e){let a=ln.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(e);if(l.parsedType!==Er.string&&l.parsedType!==Er.number){let i=ln.objectValues(a);return _r(l,{expected:ln.joinValues(i),received:l.parsedType,code:sr.invalid_type}),Kr}if(Ex(this,E4,"f")||PMt(this,E4,new Set(ln.getValidEnumValues(this._def.values)),"f"),!Ex(this,E4,"f").has(e.data)){let i=ln.objectValues(a);return _r(l,{received:l.data,code:sr.invalid_enum_value,options:i}),Kr}return mf(e.data)}get enum(){return this._def.values}};E4=new WeakMap;jv.create=(r,e)=>new jv({values:r,typeName:Ur.ZodNativeEnum,...gi(e)});var Hp=class extends yi{unwrap(){return this._def.type}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==Er.promise&&a.common.async===!1)return _r(a,{code:sr.invalid_type,expected:Er.promise,received:a.parsedType}),Kr;let l=a.parsedType===Er.promise?a.data:Promise.resolve(a.data);return mf(l.then(i=>this._def.type.parseAsync(i,{path:a.path,errorMap:a.common.contextualErrorMap})))}};Hp.create=(r,e)=>new Hp({type:r,typeName:Ur.ZodPromise,...gi(e)});var Ih=class extends yi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ur.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:a,ctx:l}=this._processInputParams(e),i=this._def.effect||null,c={addIssue:b=>{_r(l,b),b.fatal?a.abort():a.dirty()},get path(){return l.path}};if(c.addIssue=c.addIssue.bind(c),i.type==="preprocess"){let b=i.transform(l.data,c);if(l.common.async)return Promise.resolve(b).then(async g=>{if(a.value==="aborted")return Kr;let M=await this._def.schema._parseAsync({data:g,path:l.path,parent:l});return M.status==="aborted"?Kr:M.status==="dirty"||a.value==="dirty"?xg(M.value):M});{if(a.value==="aborted")return Kr;let g=this._def.schema._parseSync({data:b,path:l.path,parent:l});return g.status==="aborted"?Kr:g.status==="dirty"||a.value==="dirty"?xg(g.value):g}}if(i.type==="refinement"){let b=g=>{let M=i.refinement(g,c);if(l.common.async)return Promise.resolve(M);if(M instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return g};if(l.common.async===!1){let g=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return g.status==="aborted"?Kr:(g.status==="dirty"&&a.dirty(),b(g.value),{status:a.value,value:g.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(g=>g.status==="aborted"?Kr:(g.status==="dirty"&&a.dirty(),b(g.value).then(()=>({status:a.value,value:g.value}))))}if(i.type==="transform")if(l.common.async===!1){let b=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!kv(b))return b;let g=i.transform(b.value,c);if(g instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:g}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(b=>kv(b)?Promise.resolve(i.transform(b.value,c)).then(g=>({status:a.value,value:g})):b);ln.assertNever(i)}};Ih.create=(r,e,a)=>new Ih({schema:r,typeName:Ur.ZodEffects,effect:e,...gi(a)});Ih.createWithPreprocess=(r,e,a)=>new Ih({schema:e,effect:{type:"preprocess",transform:r},typeName:Ur.ZodEffects,...gi(a)});var H0=class extends yi{_parse(e){return this._getType(e)===Er.undefined?mf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};H0.create=(r,e)=>new H0({innerType:r,typeName:Ur.ZodOptional,...gi(e)});var Ed=class extends yi{_parse(e){return this._getType(e)===Er.null?mf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ed.create=(r,e)=>new Ed({innerType:r,typeName:Ur.ZodNullable,...gi(e)});var zv=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l=a.data;return a.parsedType===Er.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:a.path,parent:a})}removeDefault(){return this._def.innerType}};zv.create=(r,e)=>new zv({innerType:r,typeName:Ur.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...gi(e)});var Fv=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l={...a,common:{...a.common,issues:[]}},i=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return A4(i)?i.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Rh(l.common.issues)},input:l.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Rh(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}};Fv.create=(r,e)=>new Fv({innerType:r,typeName:Ur.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...gi(e)});var Tg=class extends yi{_parse(e){if(this._getType(e)!==Er.nan){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.nan,received:l.parsedType}),Kr}return{status:"valid",value:e.data}}};Tg.create=r=>new Tg({typeName:Ur.ZodNaN,...gi(r)});var Sfe=Symbol("zod_brand"),R4=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l=a.data;return this._def.type._parse({data:l,path:a.path,parent:a})}unwrap(){return this._def.type}},I4=class r extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.common.async)return(async()=>{let c=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return c.status==="aborted"?Kr:c.status==="dirty"?(a.dirty(),xg(c.value)):this._def.out._parseAsync({data:c.value,path:l.path,parent:l})})();{let i=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return i.status==="aborted"?Kr:i.status==="dirty"?(a.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:l.path,parent:l})}}static create(e,a){return new r({in:e,out:a,typeName:Ur.ZodPipeline})}},Hv=class extends yi{_parse(e){let a=this._def.innerType._parse(e),l=i=>(kv(i)&&(i.value=Object.freeze(i.value)),i);return A4(a)?a.then(i=>l(i)):l(a)}unwrap(){return this._def.innerType}};Hv.create=(r,e)=>new Hv({innerType:r,typeName:Ur.ZodReadonly,...gi(e)});function kMt(r,e){let a=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof a=="string"?{message:a}:a}function DMt(r,e={},a){return r?Fp.create().superRefine((l,i)=>{var c,b;let g=r(l);if(g instanceof Promise)return g.then(M=>{var y,w;if(!M){let S=kMt(e,l),_=(w=(y=S.fatal)!==null&&y!==void 0?y:a)!==null&&w!==void 0?w:!0;i.addIssue({code:"custom",...S,fatal:_})}});if(!g){let M=kMt(e,l),y=(b=(c=M.fatal)!==null&&c!==void 0?c:a)!==null&&b!==void 0?b:!0;i.addIssue({code:"custom",...M,fatal:y})}}):Fp.create()}var xfe={object:qf.lazycreate},Ur;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(Ur||(Ur={}));var Efe=(r,e={message:`Input not instance of ${r.name}`})=>DMt(a=>a instanceof r,e),$Mt=zp.create,qMt=Tv.create,Afe=Tg.create,Rfe=Bv.create,UMt=Pv.create,Ife=Nv.create,kfe=Ag.create,Tfe=Ov.create,Bfe=Cv.create,Pfe=Fp.create,Nfe=jc.create,Ofe=fl.create,Cfe=Rg.create,Lfe=zc.create,Dfe=qf.create,$fe=qf.strictCreate,qfe=Lv.create,Ufe=Ax.create,jfe=Dv.create,zfe=xd.create,Ffe=Rx.create,Hfe=Ig.create,Kfe=kg.create,Zfe=Ix.create,Wfe=$v.create,Gfe=qv.create,Vfe=Uv.create,Yfe=jv.create,Jfe=Hp.create,TMt=Ih.create,Xfe=H0.create,Qfe=Ed.create,the=Ih.createWithPreprocess,ehe=I4.create,rhe=()=>$Mt().optional(),ihe=()=>qMt().optional(),nhe=()=>UMt().optional(),ahe={string:(r=>zp.create({...r,coerce:!0})),number:(r=>Tv.create({...r,coerce:!0})),boolean:(r=>Pv.create({...r,coerce:!0})),bigint:(r=>Bv.create({...r,coerce:!0})),date:(r=>Nv.create({...r,coerce:!0}))},ohe=Kr,Ir=Object.freeze({__proto__:null,defaultErrorMap:Eg,setErrorMap:tfe,getErrorMap:Sx,makeIssue:xx,EMPTY_PATH:efe,addIssueToContext:_r,ParseStatus:tf,INVALID:Kr,DIRTY:xg,OK:mf,isAborted:wZ,isDirty:MZ,isValid:kv,isAsync:A4,get util(){return ln},get objectUtil(){return yZ},ZodParsedType:Er,getParsedType:Uc,ZodType:yi,datetimeRegex:CMt,ZodString:zp,ZodNumber:Tv,ZodBigInt:Bv,ZodBoolean:Pv,ZodDate:Nv,ZodSymbol:Ag,ZodUndefined:Ov,ZodNull:Cv,ZodAny:Fp,ZodUnknown:jc,ZodNever:fl,ZodVoid:Rg,ZodArray:zc,ZodObject:qf,ZodUnion:Lv,ZodDiscriminatedUnion:Ax,ZodIntersection:Dv,ZodTuple:xd,ZodRecord:Rx,ZodMap:Ig,ZodSet:kg,ZodFunction:Ix,ZodLazy:$v,ZodLiteral:qv,ZodEnum:Uv,ZodNativeEnum:jv,ZodPromise:Hp,ZodEffects:Ih,ZodTransformer:Ih,ZodOptional:H0,ZodNullable:Ed,ZodDefault:zv,ZodCatch:Fv,ZodNaN:Tg,BRAND:Sfe,ZodBranded:R4,ZodPipeline:I4,ZodReadonly:Hv,custom:DMt,Schema:yi,ZodSchema:yi,late:xfe,get ZodFirstPartyTypeKind(){return Ur},coerce:ahe,any:Pfe,array:Lfe,bigint:Rfe,boolean:UMt,date:Ife,discriminatedUnion:Ufe,effect:TMt,enum:Vfe,function:Zfe,instanceof:Efe,intersection:jfe,lazy:Wfe,literal:Gfe,map:Hfe,nan:Afe,nativeEnum:Yfe,never:Ofe,null:Bfe,nullable:Qfe,number:qMt,object:Dfe,oboolean:nhe,onumber:ihe,optional:Xfe,ostring:rhe,pipeline:ehe,preprocess:the,promise:Jfe,record:Ffe,set:Kfe,strictObject:$fe,string:$Mt,symbol:kfe,transformer:TMt,tuple:zfe,undefined:Tfe,union:qfe,unknown:Nfe,void:Cfe,NEVER:ohe,ZodIssueCode:sr,quotelessJson:Qse,ZodError:Rh});Et();Rt();At();var kx=new RegExp("^[a-zA-Z0-9_-]{43}$"),WDe=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),she="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",GDe=she,SZ="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",ef="qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE",VDe="RR0vheYqtsKuJCWh6xj0beE35tjaEug5cejMw9n2aa8",kh="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",xZ=1e6,YDe="nEjlSFA_8narJlVHApbczDPkMc9znSqYtqtf1iOdoxM",jMt="sOW9Sdm1yoPRrzerC5iu1nsupp4e6I-HnJyYVHzvzQo",zMt="fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",FMt="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var Bg=Ir.string({description:"Arweave Transaction ID"}).refine(r=>kx.test(r),{message:"Must be an Arweave Transaction ID"}),k4=Ir.string({description:"AO Address"}),HMt=Ir.string({description:"Integer String"}).refine(r=>{let e=parseInt(r);return Number.isInteger(e)&&e>=0},{message:"Must be a non negative integer string"}),fhe=Ir.string(),EZ=Ir.array(Ir.string()),Tx=Ir.object({transactionId:Bg.describe("The Target ID of the undername"),ttlSeconds:Ir.number(),priority:Ir.number().optional(),owner:k4.describe("The owner address of the record").optional(),displayName:Ir.string().max(61).describe("Display name of the record (max 61 chars)").optional(),logo:Bg.describe("Logo transaction ID for the record").optional(),description:Ir.string().max(512).describe("Description of the record (max 512 chars)").optional(),keywords:Ir.array(Ir.string().max(32)).max(16).describe("Keywords array (max 16, each max 32 chars)").optional()}),Bx=Ir.record(Ir.string(),Tx),Px=Ir.array(k4.describe("Controller address")),Nx=Ir.record(k4.describe("Holder address"),Ir.number()),AZ=Ir.object({Name:Ir.string().describe("The name of the ANT."),Ticker:Ir.string().describe("The ticker symbol for the ANT."),Description:Ir.string().describe("The description for the ANT."),Keywords:EZ.describe("The keywords for the ANT."),Denomination:Ir.number().describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.").min(0,{message:"Denomination must be a non-negative number"}),Owner:k4.describe("The Owners address."),Controllers:Px.describe("Controllers of the ANT who have administrative privileges."),Records:Bx.describe("Records associated with the ANT."),Balances:Nx.describe("Balance details for each address holding the ANT."),Logo:Bg.describe("Transaction ID of the ANT logo."),TotalSupply:Ir.number().describe("Total supply of the ANT in circulation.").min(0,{message:"Total supply must be a non-negative number"}),Initialized:Ir.boolean().describe("Flag indicating whether the ANT has been initialized.")}),ZMt=Ir.object({name:Ir.string().describe("The name of the ANT."),ticker:Ir.string().describe("The ticker symbol for the ANT."),description:Ir.string().describe("The description for the ANT."),keywords:EZ.describe("The keywords for the ANT."),owner:k4.describe("The Owners address."),controllers:Px.describe("Controllers of the ANT who have administrative privileges."),records:Bx.describe("Records associated with the ANT."),balances:Nx.describe("Balance details for each address holding the ANT."),logo:Bg.describe("Transaction ID of the ANT logo.")}),hhe=["balance","balances","totalSupply","info","controllers","record","records","state"],uhe=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames","transferRecordOwnership"],lhe=[...hhe,...uhe],KMt=Ir.array(Ir.string({description:"Handler Name"})).refine(r=>lhe.every(e=>r.includes(e)),{message:"ANT is missing required handlers"}),WMt=Ir.object({Name:Ir.string().describe("The name of the ANT."),Owner:Bg.describe("The Owners address."),Ticker:Ir.string().describe("The ticker symbol for the ANT."),"Total-Supply":HMt.describe("Total supply of the ANT in circulation."),Description:fhe.describe("The description for the ANT."),Keywords:EZ.describe("The keywords for the ANT."),Logo:Bg.describe("Transaction ID of the ANT logo."),Denomination:HMt.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:KMt.optional().describe("List of handlers for the ANT."),HandlerNames:KMt.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function i$e(r){return AZ.safeParse(r).success}Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var Kp="3.21.0";var $a=class r{level="info";levels={debug:0,info:1,warn:2,error:3,none:999};static default=new r;constructor({level:e="info"}={}){this.level=e}formatMessage(e,a,...l){let c={timestamp:new Date().toISOString(),level:e,message:a,name:"ar-io-sdk",version:Kp};return l.length>0?JSON.stringify({...c,args:l}):JSON.stringify(c)}log(e,a,...l){if(this.levels[e]<this.levels[this.level])return;let i=this.formatMessage(e,a,...l);switch(e){case"debug":console.debug(i);break;case"info":console.info(i);break;case"warn":console.warn(i);break;case"error":console.error(i);break}}info(e,...a){this.log("info",e,...a)}warn(e,...a){this.log("warn",e,...a)}error(e,...a){this.log("error",e,...a)}debug(e,...a){this.log("debug",e,...a)}setLogLevel(e){this.level=e}};Et();Rt();At();Et();Rt();At();var dhe=Object.create,oB=Object.defineProperty,che=Object.getOwnPropertyDescriptor,phe=Object.getOwnPropertyNames,mhe=Object.getPrototypeOf,vhe=Object.prototype.hasOwnProperty,wu=(r,e)=>()=>(r&&(e=r(r=0)),e),Ea=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),sB=(r,e)=>{for(var a in e)oB(r,a,{get:e[a],enumerable:!0})},PIt=(r,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of phe(e))!vhe.call(r,i)&&i!==a&&oB(r,i,{get:()=>e[i],enumerable:!(l=che(e,i))||l.enumerable});return r},fB=(r,e,a)=>(a=r!=null?dhe(mhe(r)):{},PIt(e||!r||!r.__esModule?oB(a,"default",{value:r,enumerable:!0}):a,r)),GMt=r=>PIt(oB({},"__esModule",{value:!0}),r),bhe=Ea(r=>{"use strict";r.byteLength=M,r.toByteArray=w,r.fromByteArray=x;var e=[],a=[],l=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c=0,b=i.length;c<b;++c)e[c]=i[c],a[i.charCodeAt(c)]=c;var c,b;a[45]=62,a[95]=63;function g(A){var I=A.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=I);var P=B===I?0:4-B%4;return[B,P]}function M(A){var I=g(A),B=I[0],P=I[1];return(B+P)*3/4-P}function y(A,I,B){return(I+B)*3/4-B}function w(A){var I,B=g(A),P=B[0],O=B[1],C=new l(y(A,P,O)),K=0,W=O>0?P-4:P,J;for(J=0;J<W;J+=4)I=a[A.charCodeAt(J)]<<18|a[A.charCodeAt(J+1)]<<12|a[A.charCodeAt(J+2)]<<6|a[A.charCodeAt(J+3)],C[K++]=I>>16&255,C[K++]=I>>8&255,C[K++]=I&255;return O===2&&(I=a[A.charCodeAt(J)]<<2|a[A.charCodeAt(J+1)]>>4,C[K++]=I&255),O===1&&(I=a[A.charCodeAt(J)]<<10|a[A.charCodeAt(J+1)]<<4|a[A.charCodeAt(J+2)]>>2,C[K++]=I>>8&255,C[K++]=I&255),C}function S(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function _(A,I,B){for(var P,O=[],C=I;C<B;C+=3)P=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),O.push(S(P));return O.join("")}function x(A){for(var I,B=A.length,P=B%3,O=[],C=16383,K=0,W=B-P;K<W;K+=C)O.push(_(A,K,K+C>W?W:K+C));return P===1?(I=A[B-1],O.push(e[I>>2]+e[I<<4&63]+"==")):P===2&&(I=(A[B-2]<<8)+A[B-1],O.push(e[I>>10]+e[I>>4&63]+e[I<<2&63]+"=")),O.join("")}}),ghe=Ea(r=>{r.read=function(e,a,l,i,c){var b,g,M=c*8-i-1,y=(1<<M)-1,w=y>>1,S=-7,_=l?c-1:0,x=l?-1:1,A=e[a+_];for(_+=x,b=A&(1<<-S)-1,A>>=-S,S+=M;S>0;b=b*256+e[a+_],_+=x,S-=8);for(g=b&(1<<-S)-1,b>>=-S,S+=i;S>0;g=g*256+e[a+_],_+=x,S-=8);if(b===0)b=1-w;else{if(b===y)return g?NaN:(A?-1:1)*(1/0);g=g+Math.pow(2,i),b=b-w}return(A?-1:1)*g*Math.pow(2,b-i)},r.write=function(e,a,l,i,c,b){var g,M,y,w=b*8-c-1,S=(1<<w)-1,_=S>>1,x=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:b-1,I=i?1:-1,B=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(M=isNaN(a)?1:0,g=S):(g=Math.floor(Math.log(a)/Math.LN2),a*(y=Math.pow(2,-g))<1&&(g--,y*=2),g+_>=1?a+=x/y:a+=x*Math.pow(2,1-_),a*y>=2&&(g++,y/=2),g+_>=S?(M=0,g=S):g+_>=1?(M=(a*y-1)*Math.pow(2,c),g=g+_):(M=a*Math.pow(2,_-1)*Math.pow(2,c),g=0));c>=8;e[l+A]=M&255,A+=I,M/=256,c-=8);for(g=g<<c|M,w+=c;w>0;e[l+A]=g&255,A+=I,g/=256,w-=8);e[l+A-I]|=B*128}}),NIt=Ea(r=>{"use strict";var e=bhe(),a=ghe(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=g,r.SlowBuffer=O,r.INSPECT_MAX_BYTES=50;var i=2147483647;r.kMaxLength=i,g.TYPED_ARRAY_SUPPORT=c(),!g.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let T=new Uint8Array(1),N={foo:function(){return 42}};return Object.setPrototypeOf(N,Uint8Array.prototype),Object.setPrototypeOf(T,N),T.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}}),Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function b(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let N=new Uint8Array(T);return Object.setPrototypeOf(N,g.prototype),N}function g(T,N,D){if(typeof T=="number"){if(typeof N=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(T)}return M(T,N,D)}g.poolSize=8192;function M(T,N,D){if(typeof T=="string")return _(T,N);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(St(T,ArrayBuffer)||T&&St(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(St(T,SharedArrayBuffer)||T&&St(T.buffer,SharedArrayBuffer)))return I(T,N,D);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let X=T.valueOf&&T.valueOf();if(X!=null&&X!==T)return g.from(X,N,D);let nt=B(T);if(nt)return nt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return g.from(T[Symbol.toPrimitive]("string"),N,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}g.from=function(T,N,D){return M(T,N,D)},Object.setPrototypeOf(g.prototype,Uint8Array.prototype),Object.setPrototypeOf(g,Uint8Array);function y(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function w(T,N,D){return y(T),T<=0?b(T):N!==void 0?typeof D=="string"?b(T).fill(N,D):b(T).fill(N):b(T)}g.alloc=function(T,N,D){return w(T,N,D)};function S(T){return y(T),b(T<0?0:P(T)|0)}g.allocUnsafe=function(T){return S(T)},g.allocUnsafeSlow=function(T){return S(T)};function _(T,N){if((typeof N!="string"||N==="")&&(N="utf8"),!g.isEncoding(N))throw new TypeError("Unknown encoding: "+N);let D=C(T,N)|0,X=b(D),nt=X.write(T,N);return nt!==D&&(X=X.slice(0,nt)),X}function x(T){let N=T.length<0?0:P(T.length)|0,D=b(N);for(let X=0;X<N;X+=1)D[X]=T[X]&255;return D}function A(T){if(St(T,Uint8Array)){let N=new Uint8Array(T);return I(N.buffer,N.byteOffset,N.byteLength)}return x(T)}function I(T,N,D){if(N<0||T.byteLength<N)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<N+(D||0))throw new RangeError('"length" is outside of buffer bounds');let X;return N===void 0&&D===void 0?X=new Uint8Array(T):D===void 0?X=new Uint8Array(T,N):X=new Uint8Array(T,N,D),Object.setPrototypeOf(X,g.prototype),X}function B(T){if(g.isBuffer(T)){let N=P(T.length)|0,D=b(N);return D.length===0||T.copy(D,0,0,N),D}if(T.length!==void 0)return typeof T.length!="number"||ut(T.length)?b(0):x(T);if(T.type==="Buffer"&&Array.isArray(T.data))return x(T.data)}function P(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function O(T){return+T!=T&&(T=0),g.alloc(+T)}g.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==g.prototype},g.compare=function(T,N){if(St(T,Uint8Array)&&(T=g.from(T,T.offset,T.byteLength)),St(N,Uint8Array)&&(N=g.from(N,N.offset,N.byteLength)),!g.isBuffer(T)||!g.isBuffer(N))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===N)return 0;let D=T.length,X=N.length;for(let nt=0,tt=Math.min(D,X);nt<tt;++nt)if(T[nt]!==N[nt]){D=T[nt],X=N[nt];break}return D<X?-1:X<D?1:0},g.isEncoding=function(T){switch(String(T).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},g.concat=function(T,N){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return g.alloc(0);let D;if(N===void 0)for(N=0,D=0;D<T.length;++D)N+=T[D].length;let X=g.allocUnsafe(N),nt=0;for(D=0;D<T.length;++D){let tt=T[D];if(St(tt,Uint8Array))nt+tt.length>X.length?(g.isBuffer(tt)||(tt=g.from(tt)),tt.copy(X,nt)):Uint8Array.prototype.set.call(X,tt,nt);else if(g.isBuffer(tt))tt.copy(X,nt);else throw new TypeError('"list" argument must be an Array of Buffers');nt+=tt.length}return X};function C(T,N){if(g.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||St(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let D=T.length,X=arguments.length>2&&arguments[2]===!0;if(!X&&D===0)return 0;let nt=!1;for(;;)switch(N){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return et(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return st(T).length;default:if(nt)return X?-1:et(T).length;N=(""+N).toLowerCase(),nt=!0}}g.byteLength=C;function K(T,N,D){let X=!1;if((N===void 0||N<0)&&(N=0),N>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,N>>>=0,D<=N))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,N,D);case"utf8":case"utf-8":return u(this,N,D);case"ascii":return p(this,N,D);case"latin1":case"binary":return f(this,N,D);case"base64":return s(this,N,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,N,D);default:if(X)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),X=!0}}g.prototype._isBuffer=!0;function W(T,N,D){let X=T[N];T[N]=T[D],T[D]=X}g.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let N=0;N<T;N+=2)W(this,N,N+1);return this},g.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let N=0;N<T;N+=4)W(this,N,N+3),W(this,N+1,N+2);return this},g.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let N=0;N<T;N+=8)W(this,N,N+7),W(this,N+1,N+6),W(this,N+2,N+5),W(this,N+3,N+4);return this},g.prototype.toString=function(){let T=this.length;return T===0?"":arguments.length===0?u(this,0,T):K.apply(this,arguments)},g.prototype.toLocaleString=g.prototype.toString,g.prototype.equals=function(T){if(!g.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:g.compare(this,T)===0},g.prototype.inspect=function(){let T="",N=r.INSPECT_MAX_BYTES;return T=this.toString("hex",0,N).replace(/(.{2})/g,"$1 ").trim(),this.length>N&&(T+=" ... "),"<Buffer "+T+">"},l&&(g.prototype[l]=g.prototype.inspect),g.prototype.compare=function(T,N,D,X,nt){if(St(T,Uint8Array)&&(T=g.from(T,T.offset,T.byteLength)),!g.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(N===void 0&&(N=0),D===void 0&&(D=T?T.length:0),X===void 0&&(X=0),nt===void 0&&(nt=this.length),N<0||D>T.length||X<0||nt>this.length)throw new RangeError("out of range index");if(X>=nt&&N>=D)return 0;if(X>=nt)return-1;if(N>=D)return 1;if(N>>>=0,D>>>=0,X>>>=0,nt>>>=0,this===T)return 0;let tt=nt-X,mt=D-N,kt=Math.min(tt,mt),lt=this.slice(X,nt),xt=T.slice(N,D);for(let Tt=0;Tt<kt;++Tt)if(lt[Tt]!==xt[Tt]){tt=lt[Tt],mt=xt[Tt];break}return tt<mt?-1:mt<tt?1:0};function J(T,N,D,X,nt){if(T.length===0)return-1;if(typeof D=="string"?(X=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,ut(D)&&(D=nt?0:T.length-1),D<0&&(D=T.length+D),D>=T.length){if(nt)return-1;D=T.length-1}else if(D<0)if(nt)D=0;else return-1;if(typeof N=="string"&&(N=g.from(N,X)),g.isBuffer(N))return N.length===0?-1:U(T,N,D,X,nt);if(typeof N=="number")return N=N&255,typeof Uint8Array.prototype.indexOf=="function"?nt?Uint8Array.prototype.indexOf.call(T,N,D):Uint8Array.prototype.lastIndexOf.call(T,N,D):U(T,[N],D,X,nt);throw new TypeError("val must be string, number or Buffer")}function U(T,N,D,X,nt){let tt=1,mt=T.length,kt=N.length;if(X!==void 0&&(X=String(X).toLowerCase(),X==="ucs2"||X==="ucs-2"||X==="utf16le"||X==="utf-16le")){if(T.length<2||N.length<2)return-1;tt=2,mt/=2,kt/=2,D/=2}function lt(Tt,pt){return tt===1?Tt[pt]:Tt.readUInt16BE(pt*tt)}let xt;if(nt){let Tt=-1;for(xt=D;xt<mt;xt++)if(lt(T,xt)===lt(N,Tt===-1?0:xt-Tt)){if(Tt===-1&&(Tt=xt),xt-Tt+1===kt)return Tt*tt}else Tt!==-1&&(xt-=xt-Tt),Tt=-1}else for(D+kt>mt&&(D=mt-kt),xt=D;xt>=0;xt--){let Tt=!0;for(let pt=0;pt<kt;pt++)if(lt(T,xt+pt)!==lt(N,pt)){Tt=!1;break}if(Tt)return xt}return-1}g.prototype.includes=function(T,N,D){return this.indexOf(T,N,D)!==-1},g.prototype.indexOf=function(T,N,D){return J(this,T,N,D,!0)},g.prototype.lastIndexOf=function(T,N,D){return J(this,T,N,D,!1)};function q(T,N,D,X){D=Number(D)||0;let nt=T.length-D;X?(X=Number(X),X>nt&&(X=nt)):X=nt;let tt=N.length;X>tt/2&&(X=tt/2);let mt;for(mt=0;mt<X;++mt){let kt=parseInt(N.substr(mt*2,2),16);if(ut(kt))return mt;T[D+mt]=kt}return mt}function V(T,N,D,X){return wt(et(N,T.length-D),T,D,X)}function h(T,N,D,X){return wt(ft(N),T,D,X)}function t(T,N,D,X){return wt(st(N),T,D,X)}function n(T,N,D,X){return wt(ct(N,T.length-D),T,D,X)}g.prototype.write=function(T,N,D,X){if(N===void 0)X="utf8",D=this.length,N=0;else if(D===void 0&&typeof N=="string")X=N,D=this.length,N=0;else if(isFinite(N))N=N>>>0,isFinite(D)?(D=D>>>0,X===void 0&&(X="utf8")):(X=D,D=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let nt=this.length-N;if((D===void 0||D>nt)&&(D=nt),T.length>0&&(D<0||N<0)||N>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let tt=!1;for(;;)switch(X){case"hex":return q(this,T,N,D);case"utf8":case"utf-8":return V(this,T,N,D);case"ascii":case"latin1":case"binary":return h(this,T,N,D);case"base64":return t(this,T,N,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n(this,T,N,D);default:if(tt)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),tt=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(T,N,D){return N===0&&D===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(N,D))}function u(T,N,D){D=Math.min(T.length,D);let X=[],nt=N;for(;nt<D;){let tt=T[nt],mt=null,kt=tt>239?4:tt>223?3:tt>191?2:1;if(nt+kt<=D){let lt,xt,Tt,pt;switch(kt){case 1:tt<128&&(mt=tt);break;case 2:lt=T[nt+1],(lt&192)===128&&(pt=(tt&31)<<6|lt&63,pt>127&&(mt=pt));break;case 3:lt=T[nt+1],xt=T[nt+2],(lt&192)===128&&(xt&192)===128&&(pt=(tt&15)<<12|(lt&63)<<6|xt&63,pt>2047&&(pt<55296||pt>57343)&&(mt=pt));break;case 4:lt=T[nt+1],xt=T[nt+2],Tt=T[nt+3],(lt&192)===128&&(xt&192)===128&&(Tt&192)===128&&(pt=(tt&15)<<18|(lt&63)<<12|(xt&63)<<6|Tt&63,pt>65535&&pt<1114112&&(mt=pt))}}mt===null?(mt=65533,kt=1):mt>65535&&(mt-=65536,X.push(mt>>>10&1023|55296),mt=56320|mt&1023),X.push(mt),nt+=kt}return v(X)}var d=4096;function v(T){let N=T.length;if(N<=d)return String.fromCharCode.apply(String,T);let D="",X=0;for(;X<N;)D+=String.fromCharCode.apply(String,T.slice(X,X+=d));return D}function p(T,N,D){let X="";D=Math.min(T.length,D);for(let nt=N;nt<D;++nt)X+=String.fromCharCode(T[nt]&127);return X}function f(T,N,D){let X="";D=Math.min(T.length,D);for(let nt=N;nt<D;++nt)X+=String.fromCharCode(T[nt]);return X}function o(T,N,D){let X=T.length;(!N||N<0)&&(N=0),(!D||D<0||D>X)&&(D=X);let nt="";for(let tt=N;tt<D;++tt)nt+=It[T[tt]];return nt}function m(T,N,D){let X=T.slice(N,D),nt="";for(let tt=0;tt<X.length-1;tt+=2)nt+=String.fromCharCode(X[tt]+X[tt+1]*256);return nt}g.prototype.slice=function(T,N){let D=this.length;T=~~T,N=N===void 0?D:~~N,T<0?(T+=D,T<0&&(T=0)):T>D&&(T=D),N<0?(N+=D,N<0&&(N=0)):N>D&&(N=D),N<T&&(N=T);let X=this.subarray(T,N);return Object.setPrototypeOf(X,g.prototype),X};function E(T,N,D){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+N>D)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=this[T],nt=1,tt=0;for(;++tt<N&&(nt*=256);)X+=this[T+tt]*nt;return X},g.prototype.readUintBE=g.prototype.readUIntBE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=this[T+--N],nt=1;for(;N>0&&(nt*=256);)X+=this[T+--N]*nt;return X},g.prototype.readUint8=g.prototype.readUInt8=function(T,N){return T=T>>>0,N||E(T,1,this.length),this[T]},g.prototype.readUint16LE=g.prototype.readUInt16LE=function(T,N){return T=T>>>0,N||E(T,2,this.length),this[T]|this[T+1]<<8},g.prototype.readUint16BE=g.prototype.readUInt16BE=function(T,N){return T=T>>>0,N||E(T,2,this.length),this[T]<<8|this[T+1]},g.prototype.readUint32LE=g.prototype.readUInt32LE=function(T,N){return T=T>>>0,N||E(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},g.prototype.readUint32BE=g.prototype.readUInt32BE=function(T,N){return T=T>>>0,N||E(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},g.prototype.readBigUInt64LE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=N+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,nt=this[++T]+this[++T]*2**8+this[++T]*2**16+D*2**24;return BigInt(X)+(BigInt(nt)<<BigInt(32))}),g.prototype.readBigUInt64BE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=N*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],nt=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+D;return(BigInt(X)<<BigInt(32))+BigInt(nt)}),g.prototype.readIntLE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=this[T],nt=1,tt=0;for(;++tt<N&&(nt*=256);)X+=this[T+tt]*nt;return nt*=128,X>=nt&&(X-=Math.pow(2,8*N)),X},g.prototype.readIntBE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=N,nt=1,tt=this[T+--X];for(;X>0&&(nt*=256);)tt+=this[T+--X]*nt;return nt*=128,tt>=nt&&(tt-=Math.pow(2,8*N)),tt},g.prototype.readInt8=function(T,N){return T=T>>>0,N||E(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},g.prototype.readInt16LE=function(T,N){T=T>>>0,N||E(T,2,this.length);let D=this[T]|this[T+1]<<8;return D&32768?D|4294901760:D},g.prototype.readInt16BE=function(T,N){T=T>>>0,N||E(T,2,this.length);let D=this[T+1]|this[T]<<8;return D&32768?D|4294901760:D},g.prototype.readInt32LE=function(T,N){return T=T>>>0,N||E(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},g.prototype.readInt32BE=function(T,N){return T=T>>>0,N||E(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},g.prototype.readBigInt64LE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(D<<24);return(BigInt(X)<<BigInt(32))+BigInt(N+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),g.prototype.readBigInt64BE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=(N<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(X)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+D)}),g.prototype.readFloatLE=function(T,N){return T=T>>>0,N||E(T,4,this.length),a.read(this,T,!0,23,4)},g.prototype.readFloatBE=function(T,N){return T=T>>>0,N||E(T,4,this.length),a.read(this,T,!1,23,4)},g.prototype.readDoubleLE=function(T,N){return T=T>>>0,N||E(T,8,this.length),a.read(this,T,!0,52,8)},g.prototype.readDoubleBE=function(T,N){return T=T>>>0,N||E(T,8,this.length),a.read(this,T,!1,52,8)};function R(T,N,D,X,nt,tt){if(!g.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(N>nt||N<tt)throw new RangeError('"value" argument is out of bounds');if(D+X>T.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(T,N,D,X){if(T=+T,N=N>>>0,D=D>>>0,!X){let mt=Math.pow(2,8*D)-1;R(this,T,N,D,mt,0)}let nt=1,tt=0;for(this[N]=T&255;++tt<D&&(nt*=256);)this[N+tt]=T/nt&255;return N+D},g.prototype.writeUintBE=g.prototype.writeUIntBE=function(T,N,D,X){if(T=+T,N=N>>>0,D=D>>>0,!X){let mt=Math.pow(2,8*D)-1;R(this,T,N,D,mt,0)}let nt=D-1,tt=1;for(this[N+nt]=T&255;--nt>=0&&(tt*=256);)this[N+nt]=T/tt&255;return N+D},g.prototype.writeUint8=g.prototype.writeUInt8=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,1,255,0),this[N]=T&255,N+1},g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,65535,0),this[N]=T&255,this[N+1]=T>>>8,N+2},g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,65535,0),this[N]=T>>>8,this[N+1]=T&255,N+2},g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,4294967295,0),this[N+3]=T>>>24,this[N+2]=T>>>16,this[N+1]=T>>>8,this[N]=T&255,N+4},g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,4294967295,0),this[N]=T>>>24,this[N+1]=T>>>16,this[N+2]=T>>>8,this[N+3]=T&255,N+4};function k(T,N,D,X,nt){H(N,X,nt,T,D,7);let tt=Number(N&BigInt(4294967295));T[D++]=tt,tt=tt>>8,T[D++]=tt,tt=tt>>8,T[D++]=tt,tt=tt>>8,T[D++]=tt;let mt=Number(N>>BigInt(32)&BigInt(4294967295));return T[D++]=mt,mt=mt>>8,T[D++]=mt,mt=mt>>8,T[D++]=mt,mt=mt>>8,T[D++]=mt,D}function L(T,N,D,X,nt){H(N,X,nt,T,D,7);let tt=Number(N&BigInt(4294967295));T[D+7]=tt,tt=tt>>8,T[D+6]=tt,tt=tt>>8,T[D+5]=tt,tt=tt>>8,T[D+4]=tt;let mt=Number(N>>BigInt(32)&BigInt(4294967295));return T[D+3]=mt,mt=mt>>8,T[D+2]=mt,mt=mt>>8,T[D+1]=mt,mt=mt>>8,T[D]=mt,D+8}g.prototype.writeBigUInt64LE=Pt(function(T,N=0){return k(this,T,N,BigInt(0),BigInt("0xffffffffffffffff"))}),g.prototype.writeBigUInt64BE=Pt(function(T,N=0){return L(this,T,N,BigInt(0),BigInt("0xffffffffffffffff"))}),g.prototype.writeIntLE=function(T,N,D,X){if(T=+T,N=N>>>0,!X){let kt=Math.pow(2,8*D-1);R(this,T,N,D,kt-1,-kt)}let nt=0,tt=1,mt=0;for(this[N]=T&255;++nt<D&&(tt*=256);)T<0&&mt===0&&this[N+nt-1]!==0&&(mt=1),this[N+nt]=(T/tt>>0)-mt&255;return N+D},g.prototype.writeIntBE=function(T,N,D,X){if(T=+T,N=N>>>0,!X){let kt=Math.pow(2,8*D-1);R(this,T,N,D,kt-1,-kt)}let nt=D-1,tt=1,mt=0;for(this[N+nt]=T&255;--nt>=0&&(tt*=256);)T<0&&mt===0&&this[N+nt+1]!==0&&(mt=1),this[N+nt]=(T/tt>>0)-mt&255;return N+D},g.prototype.writeInt8=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,1,127,-128),T<0&&(T=255+T+1),this[N]=T&255,N+1},g.prototype.writeInt16LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,32767,-32768),this[N]=T&255,this[N+1]=T>>>8,N+2},g.prototype.writeInt16BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,32767,-32768),this[N]=T>>>8,this[N+1]=T&255,N+2},g.prototype.writeInt32LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,2147483647,-2147483648),this[N]=T&255,this[N+1]=T>>>8,this[N+2]=T>>>16,this[N+3]=T>>>24,N+4},g.prototype.writeInt32BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[N]=T>>>24,this[N+1]=T>>>16,this[N+2]=T>>>8,this[N+3]=T&255,N+4},g.prototype.writeBigInt64LE=Pt(function(T,N=0){return k(this,T,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),g.prototype.writeBigInt64BE=Pt(function(T,N=0){return L(this,T,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function z(T,N,D,X,nt,tt){if(D+X>T.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function it(T,N,D,X,nt){return N=+N,D=D>>>0,nt||z(T,N,D,4,34028234663852886e22,-34028234663852886e22),a.write(T,N,D,X,23,4),D+4}g.prototype.writeFloatLE=function(T,N,D){return it(this,T,N,!0,D)},g.prototype.writeFloatBE=function(T,N,D){return it(this,T,N,!1,D)};function G(T,N,D,X,nt){return N=+N,D=D>>>0,nt||z(T,N,D,8,17976931348623157e292,-17976931348623157e292),a.write(T,N,D,X,52,8),D+8}g.prototype.writeDoubleLE=function(T,N,D){return G(this,T,N,!0,D)},g.prototype.writeDoubleBE=function(T,N,D){return G(this,T,N,!1,D)},g.prototype.copy=function(T,N,D,X){if(!g.isBuffer(T))throw new TypeError("argument should be a Buffer");if(D||(D=0),!X&&X!==0&&(X=this.length),N>=T.length&&(N=T.length),N||(N=0),X>0&&X<D&&(X=D),X===D||T.length===0||this.length===0)return 0;if(N<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),T.length-N<X-D&&(X=T.length-N+D);let nt=X-D;return this===T&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(N,D,X):Uint8Array.prototype.set.call(T,this.subarray(D,X),N),nt},g.prototype.fill=function(T,N,D,X){if(typeof T=="string"){if(typeof N=="string"?(X=N,N=0,D=this.length):typeof D=="string"&&(X=D,D=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!g.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(T.length===1){let tt=T.charCodeAt(0);(X==="utf8"&&tt<128||X==="latin1")&&(T=tt)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(N<0||this.length<N||this.length<D)throw new RangeError("Out of range index");if(D<=N)return this;N=N>>>0,D=D===void 0?this.length:D>>>0,T||(T=0);let nt;if(typeof T=="number")for(nt=N;nt<D;++nt)this[nt]=T;else{let tt=g.isBuffer(T)?T:g.from(T,X),mt=tt.length;if(mt===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(nt=0;nt<D-N;++nt)this[nt+N]=tt[nt%mt]}return this};var $={};function Z(T,N,D){$[T]=class extends D{constructor(){super(),Object.defineProperty(this,"message",{value:N.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}Z("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Z("ERR_INVALID_ARG_TYPE",function(T,N){return`The "${T}" argument must be of type number. Received type ${typeof N}`},TypeError),Z("ERR_OUT_OF_RANGE",function(T,N,D){let X=`The value of "${T}" is out of range.`,nt=D;return Number.isInteger(D)&&Math.abs(D)>2**32?nt=rt(String(D)):typeof D=="bigint"&&(nt=String(D),(D>BigInt(2)**BigInt(32)||D<-(BigInt(2)**BigInt(32)))&&(nt=rt(nt)),nt+="n"),X+=` It must be ${N}. Received ${nt}`,X},RangeError);function rt(T){let N="",D=T.length,X=T[0]==="-"?1:0;for(;D>=X+4;D-=3)N=`_${T.slice(D-3,D)}${N}`;return`${T.slice(0,D)}${N}`}function Q(T,N,D){F(N,"offset"),(T[N]===void 0||T[N+D]===void 0)&&Y(N,T.length-(D+1))}function H(T,N,D,X,nt,tt){if(T>D||T<N){let mt=typeof N=="bigint"?"n":"",kt;throw tt>3?N===0||N===BigInt(0)?kt=`>= 0${mt} and < 2${mt} ** ${(tt+1)*8}${mt}`:kt=`>= -(2${mt} ** ${(tt+1)*8-1}${mt}) and < 2 ** ${(tt+1)*8-1}${mt}`:kt=`>= ${N}${mt} and <= ${D}${mt}`,new $.ERR_OUT_OF_RANGE("value",kt,T)}Q(X,nt,tt)}function F(T,N){if(typeof T!="number")throw new $.ERR_INVALID_ARG_TYPE(N,"number",T)}function Y(T,N,D){throw Math.floor(T)!==T?(F(T,D),new $.ERR_OUT_OF_RANGE(D||"offset","an integer",T)):N<0?new $.ERR_BUFFER_OUT_OF_BOUNDS:new $.ERR_OUT_OF_RANGE(D||"offset",`>= ${D?1:0} and <= ${N}`,T)}var at=/[^+/0-9A-Za-z-_]/g;function ht(T){if(T=T.split("=")[0],T=T.trim().replace(at,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function et(T,N){N=N||1/0;let D,X=T.length,nt=null,tt=[];for(let mt=0;mt<X;++mt){if(D=T.charCodeAt(mt),D>55295&&D<57344){if(!nt){if(D>56319){(N-=3)>-1&&tt.push(239,191,189);continue}else if(mt+1===X){(N-=3)>-1&&tt.push(239,191,189);continue}nt=D;continue}if(D<56320){(N-=3)>-1&&tt.push(239,191,189),nt=D;continue}D=(nt-55296<<10|D-56320)+65536}else nt&&(N-=3)>-1&&tt.push(239,191,189);if(nt=null,D<128){if((N-=1)<0)break;tt.push(D)}else if(D<2048){if((N-=2)<0)break;tt.push(D>>6|192,D&63|128)}else if(D<65536){if((N-=3)<0)break;tt.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((N-=4)<0)break;tt.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return tt}function ft(T){let N=[];for(let D=0;D<T.length;++D)N.push(T.charCodeAt(D)&255);return N}function ct(T,N){let D,X,nt,tt=[];for(let mt=0;mt<T.length&&!((N-=2)<0);++mt)D=T.charCodeAt(mt),X=D>>8,nt=D%256,tt.push(nt),tt.push(X);return tt}function st(T){return e.toByteArray(ht(T))}function wt(T,N,D,X){let nt;for(nt=0;nt<X&&!(nt+D>=N.length||nt>=T.length);++nt)N[nt+D]=T[nt];return nt}function St(T,N){return T instanceof N||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===N.name}function ut(T){return T!==T}var It=(function(){let T="0123456789abcdef",N=new Array(256);for(let D=0;D<16;++D){let X=D*16;for(let nt=0;nt<16;++nt)N[X+nt]=T[D]+T[nt]}return N})();function Pt(T){return typeof BigInt>"u"?j:T}function j(){throw new Error("BigInt not supported")}}),yhe=Ea((r,e)=>{var a=1e3,l=a*60,i=l*60,c=i*24,b=c*7,g=c*365.25;e.exports=function(_,x){x=x||{};var A=typeof _;if(A==="string"&&_.length>0)return M(_);if(A==="number"&&isFinite(_))return x.long?w(_):y(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function M(_){if(_=String(_),!(_.length>100)){var x=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(x){var A=parseFloat(x[1]),I=(x[2]||"ms").toLowerCase();switch(I){case"years":case"year":case"yrs":case"yr":case"y":return A*g;case"weeks":case"week":case"w":return A*b;case"days":case"day":case"d":return A*c;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*l;case"seconds":case"second":case"secs":case"sec":case"s":return A*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function y(_){var x=Math.abs(_);return x>=c?Math.round(_/c)+"d":x>=i?Math.round(_/i)+"h":x>=l?Math.round(_/l)+"m":x>=a?Math.round(_/a)+"s":_+"ms"}function w(_){var x=Math.abs(_);return x>=c?S(_,x,c,"day"):x>=i?S(_,x,i,"hour"):x>=l?S(_,x,l,"minute"):x>=a?S(_,x,a,"second"):_+" ms"}function S(_,x,A,I){var B=x>=A*1.5;return Math.round(_/A)+" "+I+(B?"s":"")}}),whe=Ea((r,e)=>{function a(l){c.debug=c,c.default=c,c.coerce=S,c.disable=y,c.enable=g,c.enabled=w,c.humanize=yhe(),c.destroy=_,Object.keys(l).forEach(x=>{c[x]=l[x]}),c.names=[],c.skips=[],c.formatters={};function i(x){let A=0;for(let I=0;I<x.length;I++)A=(A<<5)-A+x.charCodeAt(I),A|=0;return c.colors[Math.abs(A)%c.colors.length]}c.selectColor=i;function c(x){let A,I=null,B,P;function O(...C){if(!O.enabled)return;let K=O,W=Number(new Date),J=W-(A||W);K.diff=J,K.prev=A,K.curr=W,A=W,C[0]=c.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let U=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(q,V)=>{if(q==="%%")return"%";U++;let h=c.formatters[V];if(typeof h=="function"){let t=C[U];q=h.call(K,t),C.splice(U,1),U--}return q}),c.formatArgs.call(K,C),(K.log||c.log).apply(K,C)}return O.namespace=x,O.useColors=c.useColors(),O.color=c.selectColor(x),O.extend=b,O.destroy=c.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>I!==null?I:(B!==c.namespaces&&(B=c.namespaces,P=c.enabled(x)),P),set:C=>{I=C}}),typeof c.init=="function"&&c.init(O),O}function b(x,A){let I=c(this.namespace+(typeof A>"u"?":":A)+x);return I.log=this.log,I}function g(x){c.save(x),c.namespaces=x,c.names=[],c.skips=[];let A=(typeof x=="string"?x:"").trim().replace(" ",",").split(",").filter(Boolean);for(let I of A)I[0]==="-"?c.skips.push(I.slice(1)):c.names.push(I)}function M(x,A){let I=0,B=0,P=-1,O=0;for(;I<x.length;)if(B<A.length&&(A[B]===x[I]||A[B]==="*"))A[B]==="*"?(P=B,O=I,B++):(I++,B++);else if(P!==-1)B=P+1,O++,I=O;else return!1;for(;B<A.length&&A[B]==="*";)B++;return B===A.length}function y(){let x=[...c.names,...c.skips.map(A=>"-"+A)].join(",");return c.enable(""),x}function w(x){for(let A of c.skips)if(M(x,A))return!1;for(let A of c.names)if(M(x,A))return!0;return!1}function S(x){return x instanceof Error?x.stack||x.message:x}function _(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return c.enable(c.load()),c}e.exports=a}),Mhe=Ea((r,e)=>{r.formatArgs=l,r.save=i,r.load=c,r.useColors=a,r.storage=b(),r.destroy=(()=>{let M=!1;return()=>{M||(M=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function a(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let M;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(M=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(M[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(M){if(M[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+M[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let y="color: "+this.color;M.splice(1,0,y,"color: inherit");let w=0,S=0;M[0].replace(/%[a-zA-Z%]/g,_=>{_!=="%%"&&(w++,_==="%c"&&(S=w))}),M.splice(S,0,y)}r.log=console.debug||console.log||(()=>{});function i(M){try{M?r.storage.setItem("debug",M):r.storage.removeItem("debug")}catch{}}function c(){let M;try{M=r.storage.getItem("debug")}catch{}return!M&&typeof Te<"u"&&"env"in Te&&(M=Te.env.DEBUG),M}function b(){try{return localStorage}catch{}}e.exports=whe()(r);var{formatters:g}=e.exports;g.j=function(M){try{return JSON.stringify(M)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}});function fa(){fa.init.call(this)}function NE(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}function OIt(r){return r._maxListeners===void 0?fa.defaultMaxListeners:r._maxListeners}function VMt(r,e,a,l){var i,c,b,g;if(NE(a),(c=r._events)===void 0?(c=r._events=Object.create(null),r._eventsCount=0):(c.newListener!==void 0&&(r.emit("newListener",e,a.listener?a.listener:a),c=r._events),b=c[e]),b===void 0)b=c[e]=a,++r._eventsCount;else if(typeof b=="function"?b=c[e]=l?[a,b]:[b,a]:l?b.unshift(a):b.push(a),(i=OIt(r))>0&&b.length>i&&!b.warned){b.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+b.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=r,M.type=e,M.count=b.length,g=M,console&&console.warn&&console.warn(g)}return r}function _he(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function YMt(r,e,a){var l={fired:!1,wrapFn:void 0,target:r,type:e,listener:a},i=_he.bind(l);return i.listener=a,l.wrapFn=i,i}function JMt(r,e,a){var l=r._events;if(l===void 0)return[];var i=l[e];return i===void 0?[]:typeof i=="function"?a?[i.listener||i]:[i]:a?(function(c){for(var b=new Array(c.length),g=0;g<b.length;++g)b[g]=c[g].listener||c[g];return b})(i):CIt(i,i.length)}function XMt(r){var e=this._events;if(e!==void 0){var a=e[r];if(typeof a=="function")return 1;if(a!==void 0)return a.length}return 0}function CIt(r,e){for(var a=new Array(e),l=0;l<e;++l)a[l]=r[l];return a}var QMt,t_t,Kv,RZ,IZ,kZ,gs,LIt=wu(()=>{Kv=typeof Reflect=="object"?Reflect:null,RZ=Kv&&typeof Kv.apply=="function"?Kv.apply:function(r,e,a){return Function.prototype.apply.call(r,e,a)},t_t=Kv&&typeof Kv.ownKeys=="function"?Kv.ownKeys:Object.getOwnPropertySymbols?function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:function(r){return Object.getOwnPropertyNames(r)},IZ=Number.isNaN||function(r){return r!=r},QMt=fa,fa.EventEmitter=fa,fa.prototype._events=void 0,fa.prototype._eventsCount=0,fa.prototype._maxListeners=void 0,kZ=10,Object.defineProperty(fa,"defaultMaxListeners",{enumerable:!0,get:function(){return kZ},set:function(r){if(typeof r!="number"||r<0||IZ(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");kZ=r}}),fa.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},fa.prototype.setMaxListeners=function(r){if(typeof r!="number"||r<0||IZ(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this},fa.prototype.getMaxListeners=function(){return OIt(this)},fa.prototype.emit=function(r){for(var e=[],a=1;a<arguments.length;a++)e.push(arguments[a]);var l=r==="error",i=this._events;if(i!==void 0)l=l&&i.error===void 0;else if(!l)return!1;if(l){var c;if(e.length>0&&(c=e[0]),c instanceof Error)throw c;var b=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw b.context=c,b}var g=i[r];if(g===void 0)return!1;if(typeof g=="function")RZ(g,this,e);else{var M=g.length,y=CIt(g,M);for(a=0;a<M;++a)RZ(y[a],this,e)}return!0},fa.prototype.addListener=function(r,e){return VMt(this,r,e,!1)},fa.prototype.on=fa.prototype.addListener,fa.prototype.prependListener=function(r,e){return VMt(this,r,e,!0)},fa.prototype.once=function(r,e){return NE(e),this.on(r,YMt(this,r,e)),this},fa.prototype.prependOnceListener=function(r,e){return NE(e),this.prependListener(r,YMt(this,r,e)),this},fa.prototype.removeListener=function(r,e){var a,l,i,c,b;if(NE(e),(l=this._events)===void 0)return this;if((a=l[r])===void 0)return this;if(a===e||a.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete l[r],l.removeListener&&this.emit("removeListener",r,a.listener||e));else if(typeof a!="function"){for(i=-1,c=a.length-1;c>=0;c--)if(a[c]===e||a[c].listener===e){b=a[c].listener,i=c;break}if(i<0)return this;i===0?a.shift():(function(g,M){for(;M+1<g.length;M++)g[M]=g[M+1];g.pop()})(a,i),a.length===1&&(l[r]=a[0]),l.removeListener!==void 0&&this.emit("removeListener",r,b||e)}return this},fa.prototype.off=fa.prototype.removeListener,fa.prototype.removeAllListeners=function(r){var e,a,l;if((a=this._events)===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[r]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete a[r]),this;if(arguments.length===0){var i,c=Object.keys(a);for(l=0;l<c.length;++l)(i=c[l])!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=a[r])=="function")this.removeListener(r,e);else if(e!==void 0)for(l=e.length-1;l>=0;l--)this.removeListener(r,e[l]);return this},fa.prototype.listeners=function(r){return JMt(this,r,!0)},fa.prototype.rawListeners=function(r){return JMt(this,r,!1)},fa.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):XMt.call(r,e)},fa.prototype.listenerCount=XMt,fa.prototype.eventNames=function(){return this._eventsCount>0?t_t(this._events):[]},gs=QMt,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount});function KG(){throw new Error("setTimeout has not been defined")}function ZG(){throw new Error("clearTimeout has not been defined")}function DIt(r){if(t1===setTimeout)return setTimeout(r,0);if((t1===KG||!t1)&&setTimeout)return t1=setTimeout,setTimeout(r,0);try{return t1(r,0)}catch{try{return t1.call(null,r,0)}catch{return t1.call(this||A6,r,0)}}}function She(){R6&&M6&&(R6=!1,M6.length?$d=M6.concat($d):n7=-1,$d.length&&$It())}function $It(){if(!R6){var r=DIt(She);R6=!0;for(var e=$d.length;e;){for(M6=$d,$d=[];++n7<e;)M6&&M6[n7].run();n7=-1,e=$d.length}M6=null,R6=!1,(function(a){if(e1===clearTimeout)return clearTimeout(a);if((e1===ZG||!e1)&&clearTimeout)return e1=clearTimeout,clearTimeout(a);try{e1(a)}catch{try{return e1.call(null,a)}catch{return e1.call(this||A6,a)}}})(r)}}function e_t(r,e){(this||A6).fun=r,(this||A6).array=e}function Fc(){}var r_t,t1,e1,A6,mo,M6,$d,R6,n7,ti,$rt=wu(()=>{A6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis,mo=r_t={},(function(){try{t1=typeof setTimeout=="function"?setTimeout:KG}catch{t1=KG}try{e1=typeof clearTimeout=="function"?clearTimeout:ZG}catch{e1=ZG}})(),$d=[],R6=!1,n7=-1,mo.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)e[a-1]=arguments[a];$d.push(new e_t(r,e)),$d.length!==1||R6||DIt($It)},e_t.prototype.run=function(){(this||A6).fun.apply(null,(this||A6).array)},mo.title="browser",mo.browser=!0,mo.env={},mo.argv=[],mo.version="",mo.versions={},mo.on=Fc,mo.addListener=Fc,mo.once=Fc,mo.off=Fc,mo.removeListener=Fc,mo.removeAllListeners=Fc,mo.emit=Fc,mo.prependListener=Fc,mo.prependOnceListener=Fc,mo.listeners=function(r){return[]},mo.binding=function(r){throw new Error("process.binding is not supported")},mo.cwd=function(){return"/"},mo.chdir=function(r){throw new Error("process.chdir is not supported")},mo.umask=function(){return 0},ti=r_t,ti.addListener,ti.argv,ti.binding,ti.browser,ti.chdir,ti.cwd,ti.emit,ti.env,ti.listeners,ti.nextTick,ti.off,ti.on,ti.once,ti.prependListener,ti.prependOnceListener,ti.removeAllListeners,ti.removeListener,ti.title,ti.umask,ti.version,ti.versions});function Zv(r){return r.call.bind(r)}function iw(r,e){if(typeof r!="object")return!1;try{return e(r),!0}catch{return!1}}function i_t(r){return Mf&&th?qn(r)!==void 0:qIt(r)||UIt(r)||jIt(r)||zIt(r)||FIt(r)||HIt(r)||KIt(r)||ZIt(r)||WIt(r)||GIt(r)||VIt(r)}function qIt(r){return Mf&&th?qn(r)==="Uint8Array":qa(r)==="[object Uint8Array]"||QIt(r)&&r.buffer!==void 0}function UIt(r){return Mf&&th?qn(r)==="Uint8ClampedArray":qa(r)==="[object Uint8ClampedArray]"}function jIt(r){return Mf&&th?qn(r)==="Uint16Array":qa(r)==="[object Uint16Array]"}function zIt(r){return Mf&&th?qn(r)==="Uint32Array":qa(r)==="[object Uint32Array]"}function FIt(r){return Mf&&th?qn(r)==="Int8Array":qa(r)==="[object Int8Array]"}function HIt(r){return Mf&&th?qn(r)==="Int16Array":qa(r)==="[object Int16Array]"}function KIt(r){return Mf&&th?qn(r)==="Int32Array":qa(r)==="[object Int32Array]"}function ZIt(r){return Mf&&th?qn(r)==="Float32Array":qa(r)==="[object Float32Array]"}function WIt(r){return Mf&&th?qn(r)==="Float64Array":qa(r)==="[object Float64Array]"}function GIt(r){return Mf&&th?qn(r)==="BigInt64Array":qa(r)==="[object BigInt64Array]"}function VIt(r){return Mf&&th?qn(r)==="BigUint64Array":qa(r)==="[object BigUint64Array]"}function Ox(r){return qa(r)==="[object Map]"}function Cx(r){return qa(r)==="[object Set]"}function Lx(r){return qa(r)==="[object WeakMap]"}function TZ(r){return qa(r)==="[object WeakSet]"}function bT(r){return qa(r)==="[object ArrayBuffer]"}function n_t(r){return typeof ArrayBuffer<"u"&&(bT.working?bT(r):r instanceof ArrayBuffer)}function gT(r){return qa(r)==="[object DataView]"}function a_t(r){return typeof DataView<"u"&&(gT.working?gT(r):r instanceof DataView)}function yT(r){return qa(r)==="[object SharedArrayBuffer]"}function o_t(r){return typeof SharedArrayBuffer<"u"&&(yT.working?yT(r):r instanceof SharedArrayBuffer)}function s_t(r){return iw(r,tkt)}function f_t(r){return iw(r,ekt)}function h_t(r){return iw(r,rkt)}function u_t(r){return WG&&iw(r,pU)}function l_t(r){return CE&&iw(r,vU)}function Tm(r,e){var a={seen:[],stylize:Ehe};return arguments.length>=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),qrt(e)?a.showHidden=e:e&&fr._extend(a,e),_6(a.showHidden)&&(a.showHidden=!1),_6(a.depth)&&(a.depth=2),_6(a.colors)&&(a.colors=!1),_6(a.customInspect)&&(a.customInspect=!0),a.colors&&(a.stylize=xhe),wT(a,r,a.depth)}function xhe(r,e){var a=Tm.styles[e];return a?"\x1B["+Tm.colors[a][0]+"m"+r+"\x1B["+Tm.colors[a][1]+"m":r}function Ehe(r,e){return r}function wT(r,e,a){if(r.customInspect&&e&&OE(e.inspect)&&e.inspect!==fr.inspect&&(!e.constructor||e.constructor.prototype!==e)){var l=e.inspect(a,r);return _T(l)||(l=wT(r,l,a)),l}var i=(function(_,x){if(_6(x))return _.stylize("undefined","undefined");if(_T(x)){var A="'"+JSON.stringify(x).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return _.stylize(A,"string")}if(JIt(x))return _.stylize(""+x,"number");if(qrt(x))return _.stylize(""+x,"boolean");if(MT(x))return _.stylize("null","null")})(r,e);if(i)return i;var c=Object.keys(e),b=(function(_){var x={};return _.forEach(function(A,I){x[A]=!0}),x})(c);if(r.showHidden&&(c=Object.getOwnPropertyNames(e)),o7(e)&&(c.indexOf("message")>=0||c.indexOf("description")>=0))return BZ(e);if(c.length===0){if(OE(e)){var g=e.name?": "+e.name:"";return r.stylize("[Function"+g+"]","special")}if(a7(e))return r.stylize(RegExp.prototype.toString.call(e),"regexp");if(ST(e))return r.stylize(Date.prototype.toString.call(e),"date");if(o7(e))return BZ(e)}var M,y="",w=!1,S=["{","}"];return YIt(e)&&(w=!0,S=["[","]"]),OE(e)&&(y=" [Function"+(e.name?": "+e.name:"")+"]"),a7(e)&&(y=" "+RegExp.prototype.toString.call(e)),ST(e)&&(y=" "+Date.prototype.toUTCString.call(e)),o7(e)&&(y=" "+BZ(e)),c.length!==0||w&&e.length!=0?a<0?a7(e)?r.stylize(RegExp.prototype.toString.call(e),"regexp"):r.stylize("[Object]","special"):(r.seen.push(e),M=w?(function(_,x,A,I,B){for(var P=[],O=0,C=x.length;O<C;++O)XIt(x,String(O))?P.push(PZ(_,x,A,I,String(O),!0)):P.push("");return B.forEach(function(K){K.match(/^\d+$/)||P.push(PZ(_,x,A,I,K,!0))}),P})(r,e,a,b,c):c.map(function(_){return PZ(r,e,a,b,_,w)}),r.seen.pop(),(function(_,x,A){var I=0;return _.reduce(function(B,P){return I++,P.indexOf(`
60
+ `;super(x),this.name="AggregateError",this.errors=_}}return bx={AggregateError:w,kEmptyObject:Object.freeze({}),once(S){let _=!1;return function(...x){_||(_=!0,S.apply(this,x))}},createDeferredPromise:function(){let S,_;return{promise:new Promise((A,I)=>{S=A,_=I}),resolve:S,reject:_}},promisify(S){return new Promise((_,x)=>{S((A,...I)=>A?x(A):_(...I))})},debuglog(){return function(){}},format(S,..._){return S.replace(/%([sdifj])/g,function(...[x,A]){let I=_.shift();return A==="f"?I.toFixed(6):A==="j"?JSON.stringify(I):A==="s"&&typeof I=="object"?`${I.constructor!==Object?I.constructor.name:""} {}`.trim():I.toString()})},inspect(S){switch(typeof S){case"string":if(S.includes("'"))if(S.includes('"')){if(!S.includes("`")&&!S.includes("${"))return`\`${S}\``}else return`"${S}"`;return`'${S}'`;case"number":return isNaN(S)?"NaN":Object.is(S,-0)?String(S):S;case"bigint":return`${String(S)}n`;case"boolean":case"undefined":return String(S);case"object":return"{}"}},types:{isAsyncFunction(S){return S instanceof c},isArrayBufferView(S){return ArrayBuffer.isView(S)}},isBlob:g,deprecate(S,_){return S},addAbortListener:wd.addAbortListener||function(_,x){if(_===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",_);M(_,"signal"),y(x,"listener");let A;return _.aborted?queueMicrotask(()=>x()):(_.addEventListener("abort",x,{__proto__:null,once:!0,[e]:!0}),A=()=>{_.removeEventListener("abort",x)}),{__proto__:null,[a](){var I;(I=A)===null||I===void 0||I()}}},AbortSignalAny:l.any||function(_){if(_.length===1)return _[0];let x=new i,A=()=>x.abort();return _.forEach(I=>{M(I,"signals"),I.addEventListener("abort",A,{once:!0})}),x.signal.addEventListener("abort",()=>{_.forEach(I=>I.removeEventListener("abort",A))},{once:!0}),x.signal}},bx.promisify.custom=Symbol.for("nodejs.util.promisify.custom"),bx}var YK={},G9t=!1;function $f(){if(G9t)return YK;G9t=!0;let{format:r,inspect:e,AggregateError:a}=cf(),l=globalThis.AggregateError||a,i=Symbol("kIsNodeError"),c=["string","function","number","object","Function","Object","boolean","bigint","symbol"],b=/^([A-Z][a-z0-9]*)+$/,g="__node_internal_",M={};function y(B,P){if(!B)throw new M.ERR_INTERNAL_ASSERTION(P)}function w(B){let P="",O=B.length,C=B[0]==="-"?1:0;for(;O>=C+4;O-=3)P=`_${B.slice(O-3,O)}${P}`;return`${B.slice(0,O)}${P}`}function S(B,P,O){if(typeof P=="function")return y(P.length<=O.length,`Code: ${B}; The provided arguments length (${O.length}) does not match the required ones (${P.length}).`),P(...O);let C=(P.match(/%[dfijoOs]/g)||[]).length;return y(C===O.length,`Code: ${B}; The provided arguments length (${O.length}) does not match the required ones (${C}).`),O.length===0?P:r(P,...O)}function _(B,P,O){O||(O=Error);class C extends O{constructor(...W){super(S(B,P,W))}toString(){return`${this.name} [${B}]: ${this.message}`}}Object.defineProperties(C.prototype,{name:{value:O.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${B}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),C.prototype.code=B,C.prototype[i]=!0,M[B]=C}function x(B){let P=g+B.name;return Object.defineProperty(B,"name",{value:P}),B}function A(B,P){if(B&&P&&B!==P){if(Array.isArray(P.errors))return P.errors.push(B),P;let O=new l([P,B],P.message);return O.code=P.code,O}return B||P}class I extends Error{constructor(P="The operation was aborted",O=void 0){if(O!==void 0&&typeof O!="object")throw new M.ERR_INVALID_ARG_TYPE("options","Object",O);super(P,O),this.code="ABORT_ERR",this.name="AbortError"}}return _("ERR_ASSERTION","%s",Error),_("ERR_INVALID_ARG_TYPE",(B,P,O)=>{y(typeof B=="string","'name' must be a string"),Array.isArray(P)||(P=[P]);let C="The ";B.endsWith(" argument")?C+=`${B} `:C+=`"${B}" ${B.includes(".")?"property":"argument"} `,C+="must be ";let K=[],W=[],J=[];for(let q of P)y(typeof q=="string","All expected entries have to be of type string"),c.includes(q)?K.push(q.toLowerCase()):b.test(q)?W.push(q):(y(q!=="object",'The value "object" should be written as "Object"'),J.push(q));if(W.length>0){let q=K.indexOf("object");q!==-1&&(K.splice(K,q,1),W.push("Object"))}if(K.length>0){switch(K.length){case 1:C+=`of type ${K[0]}`;break;case 2:C+=`one of type ${K[0]} or ${K[1]}`;break;default:{let q=K.pop();C+=`one of type ${K.join(", ")}, or ${q}`}}(W.length>0||J.length>0)&&(C+=" or ")}if(W.length>0){switch(W.length){case 1:C+=`an instance of ${W[0]}`;break;case 2:C+=`an instance of ${W[0]} or ${W[1]}`;break;default:{let q=W.pop();C+=`an instance of ${W.join(", ")}, or ${q}`}}J.length>0&&(C+=" or ")}switch(J.length){case 0:break;case 1:J[0].toLowerCase()!==J[0]&&(C+="an "),C+=`${J[0]}`;break;case 2:C+=`one of ${J[0]} or ${J[1]}`;break;default:{let q=J.pop();C+=`one of ${J.join(", ")}, or ${q}`}}if(O==null)C+=`. Received ${O}`;else if(typeof O=="function"&&O.name)C+=`. Received function ${O.name}`;else if(typeof O=="object"){var U;if((U=O.constructor)!==null&&U!==void 0&&U.name)C+=`. Received an instance of ${O.constructor.name}`;else{let q=e(O,{depth:-1});C+=`. Received ${q}`}}else{let q=e(O,{colors:!1});q.length>25&&(q=`${q.slice(0,25)}...`),C+=`. Received type ${typeof O} (${q})`}return C},TypeError),_("ERR_INVALID_ARG_VALUE",(B,P,O="is invalid")=>{let C=e(P);return C.length>128&&(C=C.slice(0,128)+"..."),`The ${B.includes(".")?"property":"argument"} '${B}' ${O}. Received ${C}`},TypeError),_("ERR_INVALID_RETURN_VALUE",(B,P,O)=>{var C;let K=O!=null&&(C=O.constructor)!==null&&C!==void 0&&C.name?`instance of ${O.constructor.name}`:`type ${typeof O}`;return`Expected ${B} to be returned from the "${P}" function but got ${K}.`},TypeError),_("ERR_MISSING_ARGS",(...B)=>{y(B.length>0,"At least one arg needs to be specified");let P,O=B.length;switch(B=(Array.isArray(B)?B:[B]).map(C=>`"${C}"`).join(" or "),O){case 1:P+=`The ${B[0]} argument`;break;case 2:P+=`The ${B[0]} and ${B[1]} arguments`;break;default:{let C=B.pop();P+=`The ${B.join(", ")}, and ${C} arguments`}break}return`${P} must be specified`},TypeError),_("ERR_OUT_OF_RANGE",(B,P,O)=>{y(P,'Missing "range" argument');let C;return Number.isInteger(O)&&Math.abs(O)>2**32?C=w(String(O)):typeof O=="bigint"?(C=String(O),(O>2n**32n||O<-(2n**32n))&&(C=w(C)),C+="n"):C=e(O),`The value of "${B}" is out of range. It must be ${P}. Received ${C}`},RangeError),_("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),_("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),_("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),_("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),_("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),_("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),_("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),_("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),_("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),_("ERR_STREAM_WRITE_AFTER_END","write after end",Error),_("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),YK={AbortError:I,aggregateTwoErrors:x(A),hideStackFrames:x,codes:M},YK}var JK={},V9t=!1;function S4(){if(V9t)return JK;V9t=!0;let{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:a,ArrayPrototypeMap:l,NumberIsInteger:i,NumberIsNaN:c,NumberMAX_SAFE_INTEGER:b,NumberMIN_SAFE_INTEGER:g,NumberParseInt:M,ObjectPrototypeHasOwnProperty:y,RegExpPrototypeExec:w,String:S,StringPrototypeToUpperCase:_,StringPrototypeTrim:x}=po(),{hideStackFrames:A,codes:{ERR_SOCKET_BAD_PORT:I,ERR_INVALID_ARG_TYPE:B,ERR_INVALID_ARG_VALUE:P,ERR_OUT_OF_RANGE:O,ERR_UNKNOWN_SIGNAL:C}}=$f(),{normalizeEncoding:K}=cf(),{isAsyncFunction:W,isArrayBufferView:J}=cf().types,U={};function q(ct){return ct===(ct|0)}function V(ct){return ct===ct>>>0}let h=/^[0-7]+$/,t="must be a 32-bit unsigned integer or an octal string";function n(ct,st,wt){if(typeof ct>"u"&&(ct=wt),typeof ct=="string"){if(w(h,ct)===null)throw new P(st,ct,t);ct=M(ct,8)}return d(ct,st),ct}let s=A((ct,st,wt=g,St=b)=>{if(typeof ct!="number")throw new B(st,"number",ct);if(!i(ct))throw new O(st,"an integer",ct);if(ct<wt||ct>St)throw new O(st,`>= ${wt} && <= ${St}`,ct)}),u=A((ct,st,wt=-2147483648,St=2147483647)=>{if(typeof ct!="number")throw new B(st,"number",ct);if(!i(ct))throw new O(st,"an integer",ct);if(ct<wt||ct>St)throw new O(st,`>= ${wt} && <= ${St}`,ct)}),d=A((ct,st,wt=!1)=>{if(typeof ct!="number")throw new B(st,"number",ct);if(!i(ct))throw new O(st,"an integer",ct);let St=wt?1:0,ut=4294967295;if(ct<St||ct>ut)throw new O(st,`>= ${St} && <= ${ut}`,ct)});function v(ct,st){if(typeof ct!="string")throw new B(st,"string",ct)}function p(ct,st,wt=void 0,St){if(typeof ct!="number")throw new B(st,"number",ct);if(wt!=null&&ct<wt||St!=null&&ct>St||(wt!=null||St!=null)&&c(ct))throw new O(st,`${wt!=null?`>= ${wt}`:""}${wt!=null&&St!=null?" && ":""}${St!=null?`<= ${St}`:""}`,ct)}let f=A((ct,st,wt)=>{if(!e(wt,ct)){let ut="must be one of: "+a(l(wt,It=>typeof It=="string"?`'${It}'`:S(It)),", ");throw new P(st,ct,ut)}});function o(ct,st){if(typeof ct!="boolean")throw new B(st,"boolean",ct)}function m(ct,st,wt){return ct==null||!y(ct,st)?wt:ct[st]}let E=A((ct,st,wt=null)=>{let St=m(wt,"allowArray",!1),ut=m(wt,"allowFunction",!1);if(!m(wt,"nullable",!1)&&ct===null||!St&&r(ct)||typeof ct!="object"&&(!ut||typeof ct!="function"))throw new B(st,"Object",ct)}),R=A((ct,st)=>{if(ct!=null&&typeof ct!="object"&&typeof ct!="function")throw new B(st,"a dictionary",ct)}),k=A((ct,st,wt=0)=>{if(!r(ct))throw new B(st,"Array",ct);if(ct.length<wt){let St=`must be longer than ${wt}`;throw new P(st,ct,St)}});function L(ct,st){k(ct,st);for(let wt=0;wt<ct.length;wt++)v(ct[wt],`${st}[${wt}]`)}function z(ct,st){k(ct,st);for(let wt=0;wt<ct.length;wt++)o(ct[wt],`${st}[${wt}]`)}function it(ct,st){k(ct,st);for(let wt=0;wt<ct.length;wt++){let St=ct[wt],ut=`${st}[${wt}]`;if(St==null)throw new B(ut,"AbortSignal",St);Q(St,ut)}}function G(ct,st="signal"){if(v(ct,st),U[ct]===void 0)throw U[_(ct)]!==void 0?new C(ct+" (signals must use all capital letters)"):new C(ct)}let $=A((ct,st="buffer")=>{if(!J(ct))throw new B(st,["Buffer","TypedArray","DataView"],ct)});function Z(ct,st){let wt=K(st),St=ct.length;if(wt==="hex"&&St%2!==0)throw new P("encoding",st,`is invalid for data of length ${St}`)}function rt(ct,st="Port",wt=!0){if(typeof ct!="number"&&typeof ct!="string"||typeof ct=="string"&&x(ct).length===0||+ct!==+ct>>>0||ct>65535||ct===0&&!wt)throw new I(st,ct,wt);return ct|0}let Q=A((ct,st)=>{if(ct!==void 0&&(ct===null||typeof ct!="object"||!("aborted"in ct)))throw new B(st,"AbortSignal",ct)}),H=A((ct,st)=>{if(typeof ct!="function")throw new B(st,"Function",ct)}),F=A((ct,st)=>{if(typeof ct!="function"||W(ct))throw new B(st,"Function",ct)}),Y=A((ct,st)=>{if(ct!==void 0)throw new B(st,"undefined",ct)});function at(ct,st,wt){if(!e(wt,ct))throw new B(st,`('${a(wt,"|")}')`,ct)}let ht=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function et(ct,st){if(typeof ct>"u"||!w(ht,ct))throw new P(st,ct,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ft(ct){if(typeof ct=="string")return et(ct,"hints"),ct;if(r(ct)){let st=ct.length,wt="";if(st===0)return wt;for(let St=0;St<st;St++){let ut=ct[St];et(ut,"hints"),wt+=ut,St!==st-1&&(wt+=", ")}return wt}throw new P("hints",ct,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return JK={isInt32:q,isUint32:V,parseFileMode:n,validateArray:k,validateStringArray:L,validateBooleanArray:z,validateAbortSignalArray:it,validateBoolean:o,validateBuffer:$,validateDictionary:R,validateEncoding:Z,validateFunction:H,validateInt32:u,validateInteger:s,validateNumber:p,validateObject:E,validateOneOf:f,validatePlainFunction:F,validatePort:rt,validateSignalName:G,validateString:v,validateUint32:d,validateUndefined:Y,validateUnion:at,validateAbortSignal:Q,validateLinkHeaderValue:ft},JK}var XK={},Y9t=!1;function $c(){if(Y9t)return XK;Y9t=!0;let{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:a}=po(),l=a("nodejs.stream.destroyed"),i=a("nodejs.stream.errored"),c=a("nodejs.stream.readable"),b=a("nodejs.stream.writable"),g=a("nodejs.stream.disturbed"),M=a("nodejs.webstream.isClosedPromise"),y=a("nodejs.webstream.controllerErrorFunction");function w(m,E=!1){var R;return!!(m&&typeof m.pipe=="function"&&typeof m.on=="function"&&(!E||typeof m.pause=="function"&&typeof m.resume=="function")&&(!m._writableState||((R=m._readableState)===null||R===void 0?void 0:R.readable)!==!1)&&(!m._writableState||m._readableState))}function S(m){var E;return!!(m&&typeof m.write=="function"&&typeof m.on=="function"&&(!m._readableState||((E=m._writableState)===null||E===void 0?void 0:E.writable)!==!1))}function _(m){return!!(m&&typeof m.pipe=="function"&&m._readableState&&typeof m.on=="function"&&typeof m.write=="function")}function x(m){return m&&(m._readableState||m._writableState||typeof m.write=="function"&&typeof m.on=="function"||typeof m.pipe=="function"&&typeof m.on=="function")}function A(m){return!!(m&&!x(m)&&typeof m.pipeThrough=="function"&&typeof m.getReader=="function"&&typeof m.cancel=="function")}function I(m){return!!(m&&!x(m)&&typeof m.getWriter=="function"&&typeof m.abort=="function")}function B(m){return!!(m&&!x(m)&&typeof m.readable=="object"&&typeof m.writable=="object")}function P(m){return A(m)||I(m)||B(m)}function O(m,E){return m==null?!1:E===!0?typeof m[r]=="function":E===!1?typeof m[e]=="function":typeof m[r]=="function"||typeof m[e]=="function"}function C(m){if(!x(m))return null;let E=m._writableState,R=m._readableState,k=E||R;return!!(m.destroyed||m[l]||k!=null&&k.destroyed)}function K(m){if(!S(m))return null;if(m.writableEnded===!0)return!0;let E=m._writableState;return E!=null&&E.errored?!1:typeof E?.ended!="boolean"?null:E.ended}function W(m,E){if(!S(m))return null;if(m.writableFinished===!0)return!0;let R=m._writableState;return R!=null&&R.errored?!1:typeof R?.finished!="boolean"?null:!!(R.finished||E===!1&&R.ended===!0&&R.length===0)}function J(m){if(!w(m))return null;if(m.readableEnded===!0)return!0;let E=m._readableState;return!E||E.errored?!1:typeof E?.ended!="boolean"?null:E.ended}function U(m,E){if(!w(m))return null;let R=m._readableState;return R!=null&&R.errored?!1:typeof R?.endEmitted!="boolean"?null:!!(R.endEmitted||E===!1&&R.ended===!0&&R.length===0)}function q(m){return m&&m[c]!=null?m[c]:typeof m?.readable!="boolean"?null:C(m)?!1:w(m)&&m.readable&&!U(m)}function V(m){return m&&m[b]!=null?m[b]:typeof m?.writable!="boolean"?null:C(m)?!1:S(m)&&m.writable&&!K(m)}function h(m,E){return x(m)?C(m)?!0:!(E?.readable!==!1&&q(m)||E?.writable!==!1&&V(m)):null}function t(m){var E,R;return x(m)?m.writableErrored?m.writableErrored:(E=(R=m._writableState)===null||R===void 0?void 0:R.errored)!==null&&E!==void 0?E:null:null}function n(m){var E,R;return x(m)?m.readableErrored?m.readableErrored:(E=(R=m._readableState)===null||R===void 0?void 0:R.errored)!==null&&E!==void 0?E:null:null}function s(m){if(!x(m))return null;if(typeof m.closed=="boolean")return m.closed;let E=m._writableState,R=m._readableState;return typeof E?.closed=="boolean"||typeof R?.closed=="boolean"?E?.closed||R?.closed:typeof m._closed=="boolean"&&u(m)?m._closed:null}function u(m){return typeof m._closed=="boolean"&&typeof m._defaultKeepAlive=="boolean"&&typeof m._removedConnection=="boolean"&&typeof m._removedContLen=="boolean"}function d(m){return typeof m._sent100=="boolean"&&u(m)}function v(m){var E;return typeof m._consuming=="boolean"&&typeof m._dumped=="boolean"&&((E=m.req)===null||E===void 0?void 0:E.upgradeOrConnect)===void 0}function p(m){if(!x(m))return null;let E=m._writableState,R=m._readableState,k=E||R;return!k&&d(m)||!!(k&&k.autoDestroy&&k.emitClose&&k.closed===!1)}function f(m){var E;return!!(m&&((E=m[g])!==null&&E!==void 0?E:m.readableDidRead||m.readableAborted))}function o(m){var E,R,k,L,z,it,G,$,Z,rt;return!!(m&&((E=(R=(k=(L=(z=(it=m[i])!==null&&it!==void 0?it:m.readableErrored)!==null&&z!==void 0?z:m.writableErrored)!==null&&L!==void 0?L:(G=m._readableState)===null||G===void 0?void 0:G.errorEmitted)!==null&&k!==void 0?k:($=m._writableState)===null||$===void 0?void 0:$.errorEmitted)!==null&&R!==void 0?R:(Z=m._readableState)===null||Z===void 0?void 0:Z.errored)!==null&&E!==void 0?E:!((rt=m._writableState)===null||rt===void 0)&&rt.errored))}return XK={isDestroyed:C,kIsDestroyed:l,isDisturbed:f,kIsDisturbed:g,isErrored:o,kIsErrored:i,isReadable:q,kIsReadable:c,kIsClosedPromise:M,kControllerErrorFunction:y,kIsWritable:b,isClosed:s,isDuplexNodeStream:_,isFinished:h,isIterable:O,isReadableNodeStream:w,isReadableStream:A,isReadableEnded:J,isReadableFinished:U,isReadableErrored:n,isNodeStream:x,isWebStream:P,isWritable:V,isWritableNodeStream:S,isWritableStream:I,isWritableEnded:K,isWritableFinished:W,isWritableErrored:t,isServerRequest:v,isServerResponse:d,willEmitClose:p,isTransformStream:B},XK}var gx={},J9t=!1;function jp(){if(J9t)return gx;J9t=!0;let r=Jo,{AbortError:e,codes:a}=$f(),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_PREMATURE_CLOSE:i}=a,{kEmptyObject:c,once:b}=cf(),{validateAbortSignal:g,validateFunction:M,validateObject:y,validateBoolean:w}=S4(),{Promise:S,PromisePrototypeThen:_,SymbolDispose:x}=po(),{isClosed:A,isReadable:I,isReadableNodeStream:B,isReadableStream:P,isReadableFinished:O,isReadableErrored:C,isWritable:K,isWritableNodeStream:W,isWritableStream:J,isWritableFinished:U,isWritableErrored:q,isNodeStream:V,willEmitClose:h,kIsClosedPromise:t}=$c(),n;function s(f){return f.setHeader&&typeof f.abort=="function"}let u=()=>{};function d(f,o,m){var E,R;if(arguments.length===2?(m=o,o=c):o==null?o=c:y(o,"options"),M(m,"callback"),g(o.signal,"options.signal"),m=b(m),P(f)||J(f))return v(f,o,m);if(!V(f))throw new l("stream",["ReadableStream","WritableStream","Stream"],f);let k=(E=o.readable)!==null&&E!==void 0?E:B(f),L=(R=o.writable)!==null&&R!==void 0?R:W(f),z=f._writableState,it=f._readableState,G=()=>{f.writable||rt()},$=h(f)&&B(f)===k&&W(f)===L,Z=U(f,!1),rt=()=>{Z=!0,f.destroyed&&($=!1),!($&&(!f.readable||k))&&(!k||Q)&&m.call(f)},Q=O(f,!1),H=()=>{Q=!0,f.destroyed&&($=!1),!($&&(!f.writable||L))&&(!L||Z)&&m.call(f)},F=ct=>{m.call(f,ct)},Y=A(f),at=()=>{Y=!0;let ct=q(f)||C(f);if(ct&&typeof ct!="boolean")return m.call(f,ct);if(k&&!Q&&B(f,!0)&&!O(f,!1))return m.call(f,new i);if(L&&!Z&&!U(f,!1))return m.call(f,new i);m.call(f)},ht=()=>{Y=!0;let ct=q(f)||C(f);if(ct&&typeof ct!="boolean")return m.call(f,ct);m.call(f)},et=()=>{f.req.on("finish",rt)};s(f)?(f.on("complete",rt),$||f.on("abort",at),f.req?et():f.on("request",et)):L&&!z&&(f.on("end",G),f.on("close",G)),!$&&typeof f.aborted=="boolean"&&f.on("aborted",at),f.on("end",H),f.on("finish",rt),o.error!==!1&&f.on("error",F),f.on("close",at),Y?r.nextTick(at):z!=null&&z.errorEmitted||it!=null&&it.errorEmitted?$||r.nextTick(ht):(!k&&(!$||I(f))&&(Z||K(f)===!1)||!L&&(!$||K(f))&&(Q||I(f)===!1)||it&&f.req&&f.aborted)&&r.nextTick(ht);let ft=()=>{m=u,f.removeListener("aborted",at),f.removeListener("complete",rt),f.removeListener("abort",at),f.removeListener("request",et),f.req&&f.req.removeListener("finish",rt),f.removeListener("end",G),f.removeListener("close",G),f.removeListener("finish",rt),f.removeListener("end",H),f.removeListener("error",F),f.removeListener("close",at)};if(o.signal&&!Y){let ct=()=>{let st=m;ft(),st.call(f,new e(void 0,{cause:o.signal.reason}))};if(o.signal.aborted)r.nextTick(ct);else{n=n||cf().addAbortListener;let st=n(o.signal,ct),wt=m;m=b((...St)=>{st[x](),wt.apply(f,St)})}}return ft}function v(f,o,m){let E=!1,R=u;if(o.signal)if(R=()=>{E=!0,m.call(f,new e(void 0,{cause:o.signal.reason}))},o.signal.aborted)r.nextTick(R);else{n=n||cf().addAbortListener;let L=n(o.signal,R),z=m;m=b((...it)=>{L[x](),z.apply(f,it)})}let k=(...L)=>{E||r.nextTick(()=>m.apply(f,L))};return _(f[t].promise,k,k),u}function p(f,o){var m;let E=!1;return o===null&&(o=c),(m=o)!==null&&m!==void 0&&m.cleanup&&(w(o.cleanup,"cleanup"),E=o.cleanup),new S((R,k)=>{let L=d(f,o,z=>{E&&L(),z?k(z):R()})})}return gx=d,gx.finished=p,gx}var QK={},X9t=!1;function _g(){if(X9t)return QK;X9t=!0;let r=Jo,{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:a},AbortError:l}=$f(),{Symbol:i}=po(),{kIsDestroyed:c,isDestroyed:b,isFinished:g,isServerRequest:M}=$c(),y=i("kDestroy"),w=i("kConstruct");function S(h,t,n){h&&(h.stack,t&&!t.errored&&(t.errored=h),n&&!n.errored&&(n.errored=h))}function _(h,t){let n=this._readableState,s=this._writableState,u=s||n;return s!=null&&s.destroyed||n!=null&&n.destroyed?(typeof t=="function"&&t(),this):(S(h,s,n),s&&(s.destroyed=!0),n&&(n.destroyed=!0),u.constructed?x(this,h,t):this.once(y,function(d){x(this,e(d,h),t)}),this)}function x(h,t,n){let s=!1;function u(d){if(s)return;s=!0;let v=h._readableState,p=h._writableState;S(d,p,v),p&&(p.closed=!0),v&&(v.closed=!0),typeof n=="function"&&n(d),d?r.nextTick(A,h,d):r.nextTick(I,h)}try{h._destroy(t||null,u)}catch(d){u(d)}}function A(h,t){B(h,t),I(h)}function I(h){let t=h._readableState,n=h._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&h.emit("close")}function B(h,t){let n=h._readableState,s=h._writableState;s!=null&&s.errorEmitted||n!=null&&n.errorEmitted||(s&&(s.errorEmitted=!0),n&&(n.errorEmitted=!0),h.emit("error",t))}function P(){let h=this._readableState,t=this._writableState;h&&(h.constructed=!0,h.closed=!1,h.closeEmitted=!1,h.destroyed=!1,h.errored=null,h.errorEmitted=!1,h.reading=!1,h.ended=h.readable===!1,h.endEmitted=h.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function O(h,t,n){let s=h._readableState,u=h._writableState;if(u!=null&&u.destroyed||s!=null&&s.destroyed)return this;s!=null&&s.autoDestroy||u!=null&&u.autoDestroy?h.destroy(t):t&&(t.stack,u&&!u.errored&&(u.errored=t),s&&!s.errored&&(s.errored=t),n?r.nextTick(B,h,t):B(h,t))}function C(h,t){if(typeof h._construct!="function")return;let n=h._readableState,s=h._writableState;n&&(n.constructed=!1),s&&(s.constructed=!1),h.once(w,t),!(h.listenerCount(w)>1)&&r.nextTick(K,h)}function K(h){let t=!1;function n(s){if(t){O(h,s??new a);return}t=!0;let u=h._readableState,d=h._writableState,v=d||u;u&&(u.constructed=!0),d&&(d.constructed=!0),v.destroyed?h.emit(y,s):s?O(h,s,!0):r.nextTick(W,h)}try{h._construct(s=>{r.nextTick(n,s)})}catch(s){r.nextTick(n,s)}}function W(h){h.emit(w)}function J(h){return h?.setHeader&&typeof h.abort=="function"}function U(h){h.emit("close")}function q(h,t){h.emit("error",t),r.nextTick(U,h)}function V(h,t){!h||b(h)||(!t&&!g(h)&&(t=new l),M(h)?(h.socket=null,h.destroy(t)):J(h)?h.abort():J(h.req)?h.req.abort():typeof h.destroy=="function"?h.destroy(t):typeof h.close=="function"?h.close():t?r.nextTick(q,h,t):r.nextTick(U,h),h.destroyed||(h[c]=!0))}return QK={construct:C,destroyer:V,destroy:_,undestroy:P,errorOrDestroy:O},QK}var tZ={},Q9t=!1;function pZ(){if(Q9t)return tZ;Q9t=!0;let{ArrayIsArray:r,ObjectSetPrototypeOf:e}=po(),{EventEmitter:a}=wd;function l(c){a.call(this,c)}e(l.prototype,a.prototype),e(l,a),l.prototype.pipe=function(c,b){let g=this;function M(I){c.writable&&c.write(I)===!1&&g.pause&&g.pause()}g.on("data",M);function y(){g.readable&&g.resume&&g.resume()}c.on("drain",y),!c._isStdio&&(!b||b.end!==!1)&&(g.on("end",S),g.on("close",_));let w=!1;function S(){w||(w=!0,c.end())}function _(){w||(w=!0,typeof c.destroy=="function"&&c.destroy())}function x(I){A(),a.listenerCount(this,"error")===0&&this.emit("error",I)}i(g,"error",x),i(c,"error",x);function A(){g.removeListener("data",M),c.removeListener("drain",y),g.removeListener("end",S),g.removeListener("close",_),g.removeListener("error",x),c.removeListener("error",x),g.removeListener("end",A),g.removeListener("close",A),c.removeListener("close",A)}return g.on("end",A),g.on("close",A),c.on("close",A),c.emit("pipe",g),c};function i(c,b,g){if(typeof c.prependListener=="function")return c.prependListener(b,g);!c._events||!c._events[b]?c.on(b,g):r(c._events[b])?c._events[b].unshift(g):c._events[b]=[g,c._events[b]]}return tZ={Stream:l,prependListener:i},tZ}var M4={},tMt=!1;function wx(){if(tMt)return M4;tMt=!0;let{SymbolDispose:r}=po(),{AbortError:e,codes:a}=$f(),{isNodeStream:l,isWebStream:i,kControllerErrorFunction:c}=$c(),b=jp(),{ERR_INVALID_ARG_TYPE:g}=a,M,y=(w,S)=>{if(typeof w!="object"||!("aborted"in w))throw new g(S,"AbortSignal",w)};return M4.addAbortSignal=function(S,_){if(y(S,"signal"),!l(_)&&!i(_))throw new g("stream",["ReadableStream","WritableStream","Stream"],_);return M4.addAbortSignalNoValidate(S,_)},M4.addAbortSignalNoValidate=function(w,S){if(typeof w!="object"||!("aborted"in w))return S;let _=l(S)?()=>{S.destroy(new e(void 0,{cause:w.reason}))}:()=>{S[c](new e(void 0,{cause:w.reason}))};if(w.aborted)_();else{M=M||cf().addAbortListener;let x=M(w,_);b(S,x[r])}return S},M4}var eZ={},eMt=!1;function Kse(){if(eMt)return eZ;eMt=!0;let{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:a,Uint8Array:l}=po(),{Buffer:i}=Rn(),{inspect:c}=cf();return eZ=class{constructor(){this.head=null,this.tail=null,this.length=0}push(g){let M={data:g,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length}unshift(g){let M={data:g,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}shift(){if(this.length===0)return;let g=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,g}clear(){this.head=this.tail=null,this.length=0}join(g){if(this.length===0)return"";let M=this.head,y=""+M.data;for(;(M=M.next)!==null;)y+=g+M.data;return y}concat(g){if(this.length===0)return i.alloc(0);let M=i.allocUnsafe(g>>>0),y=this.head,w=0;for(;y;)a(M,y.data,w),w+=y.data.length,y=y.next;return M}consume(g,M){let y=this.head.data;if(g<y.length){let w=y.slice(0,g);return this.head.data=y.slice(g),w}return g===y.length?this.shift():M?this._getString(g):this._getBuffer(g)}first(){return this.head.data}*[e](){for(let g=this.head;g;g=g.next)yield g.data}_getString(g){let M="",y=this.head,w=0;do{let S=y.data;if(g>S.length)M+=S,g-=S.length;else{g===S.length?(M+=S,++w,y.next?this.head=y.next:this.head=this.tail=null):(M+=r(S,0,g),this.head=y,y.data=r(S,g));break}++w}while((y=y.next)!==null);return this.length-=w,M}_getBuffer(g){let M=i.allocUnsafe(g),y=g,w=this.head,S=0;do{let _=w.data;if(g>_.length)a(M,_,y-g),g-=_.length;else{g===_.length?(a(M,_,y-g),++S,w.next?this.head=w.next:this.head=this.tail=null):(a(M,new l(_.buffer,_.byteOffset,g),y-g),this.head=w,w.data=_.slice(g));break}++S}while((w=w.next)!==null);return this.length-=S,M}[Symbol.for("nodejs.util.inspect.custom")](g,M){return c(this,{...M,depth:0,customInspect:!1})}},eZ}var rZ={},rMt=!1;function Mx(){if(rMt)return rZ;rMt=!0;let{MathFloor:r,NumberIsInteger:e}=po(),{validateInteger:a}=S4(),{ERR_INVALID_ARG_VALUE:l}=$f().codes,i=16*1024,c=16;function b(w,S,_){return w.highWaterMark!=null?w.highWaterMark:S?w[_]:null}function g(w){return w?c:i}function M(w,S){a(S,"value",0),w?c=S:i=S}function y(w,S,_,x){let A=b(S,x,_);if(A!=null){if(!e(A)||A<0){let I=x?`options.${_}`:"options.highWaterMark";throw new l(I,A)}return r(A)}return g(w.objectMode)}return rZ={getHighWaterMark:y,getDefaultHighWaterMark:g,setDefaultHighWaterMark:M},rZ}var iZ={},iMt=!1;function gMt(){if(iMt)return iZ;iMt=!0;let r=Jo,{PromisePrototypeThen:e,SymbolAsyncIterator:a,SymbolIterator:l}=po(),{Buffer:i}=Rn(),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:b}=$f().codes;function g(M,y,w){let S;if(typeof y=="string"||y instanceof i)return new M({objectMode:!0,...w,read(){this.push(y),this.push(null)}});let _;if(y&&y[a])_=!0,S=y[a]();else if(y&&y[l])_=!1,S=y[l]();else throw new c("iterable",["Iterable"],y);let x=new M({objectMode:!0,highWaterMark:1,...w}),A=!1;x._read=function(){A||(A=!0,B())},x._destroy=function(P,O){e(I(P),()=>r.nextTick(O,P),C=>r.nextTick(O,C||P))};async function I(P){let O=P!=null,C=typeof S.throw=="function";if(O&&C){let{value:K,done:W}=await S.throw(P);if(await K,W)return}if(typeof S.return=="function"){let{value:K}=await S.return();await K}}async function B(){for(;;){try{let{value:P,done:O}=_?await S.next():S.next();if(O)x.push(null);else{let C=P&&typeof P.then=="function"?await P:P;if(C===null)throw A=!1,new b;if(x.push(C))continue;A=!1}}catch(P){x.destroy(P)}break}}return x}return iZ=g,iZ}var nZ={},nMt=!1,er=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function _x(){if(nMt)return nZ;nMt=!0;let r=Jo,{ArrayPrototypeIndexOf:e,NumberIsInteger:a,NumberIsNaN:l,NumberParseInt:i,ObjectDefineProperties:c,ObjectKeys:b,ObjectSetPrototypeOf:g,Promise:M,SafeSet:y,SymbolAsyncDispose:w,SymbolAsyncIterator:S,Symbol:_}=po();nZ=St,St.ReadableState=wt;let{EventEmitter:x}=wd,{Stream:A,prependListener:I}=pZ(),{Buffer:B}=Rn(),{addAbortSignal:P}=wx(),O=jp(),C=cf().debuglog("stream",ot=>{C=ot}),K=Kse(),W=_g(),{getHighWaterMark:J,getDefaultHighWaterMark:U}=Mx(),{aggregateTwoErrors:q,codes:{ERR_INVALID_ARG_TYPE:V,ERR_METHOD_NOT_IMPLEMENTED:h,ERR_OUT_OF_RANGE:t,ERR_STREAM_PUSH_AFTER_EOF:n,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:s},AbortError:u}=$f(),{validateObject:d}=S4(),v=_("kPaused"),{StringDecoder:p}=e2,f=gMt();g(St.prototype,A.prototype),g(St,A);let o=()=>{},{errorOrDestroy:m}=W,E=1,R=2,k=4,L=8,z=16,it=32,G=64,$=128,Z=256,rt=512,Q=1024,H=2048,F=4096,Y=8192,at=16384,ht=32768,et=65536,ft=1<<17,ct=1<<18;function st(ot){return{enumerable:!1,get(){return((this||er).state&ot)!==0},set(Mt){Mt?(this||er).state|=ot:(this||er).state&=~ot}}}c(wt.prototype,{objectMode:st(E),ended:st(R),endEmitted:st(k),reading:st(L),constructed:st(z),sync:st(it),needReadable:st(G),emittedReadable:st($),readableListening:st(Z),resumeScheduled:st(rt),errorEmitted:st(Q),emitClose:st(H),autoDestroy:st(F),destroyed:st(Y),closed:st(at),closeEmitted:st(ht),multiAwaitDrain:st(et),readingMore:st(ft),dataEmitted:st(ct)});function wt(ot,Mt,Ot){typeof Ot!="boolean"&&(Ot=Mt instanceof Dc()),(this||er).state=H|F|z|it,ot&&ot.objectMode&&((this||er).state|=E),Ot&&ot&&ot.readableObjectMode&&((this||er).state|=E),(this||er).highWaterMark=ot?J(this||er,ot,"readableHighWaterMark",Ot):U(!1),(this||er).buffer=new K,(this||er).length=0,(this||er).pipes=[],(this||er).flowing=null,(this||er)[v]=null,ot&&ot.emitClose===!1&&((this||er).state&=~H),ot&&ot.autoDestroy===!1&&((this||er).state&=~F),(this||er).errored=null,(this||er).defaultEncoding=ot&&ot.defaultEncoding||"utf8",(this||er).awaitDrainWriters=null,(this||er).decoder=null,(this||er).encoding=null,ot&&ot.encoding&&((this||er).decoder=new p(ot.encoding),(this||er).encoding=ot.encoding)}function St(ot){if(!((this||er)instanceof St))return new St(ot);let Mt=(this||er)instanceof Dc();(this||er)._readableState=new wt(ot,this||er,Mt),ot&&(typeof ot.read=="function"&&((this||er)._read=ot.read),typeof ot.destroy=="function"&&((this||er)._destroy=ot.destroy),typeof ot.construct=="function"&&((this||er)._construct=ot.construct),ot.signal&&!Mt&&P(ot.signal,this||er)),A.call(this||er,ot),W.construct(this||er,()=>{(this||er)._readableState.needReadable&&nt(this||er,(this||er)._readableState)})}St.prototype.destroy=W.destroy,St.prototype._undestroy=W.undestroy,St.prototype._destroy=function(ot,Mt){Mt(ot)},St.prototype[x.captureRejectionSymbol]=function(ot){this.destroy(ot)},St.prototype[w]=function(){let ot;return(this||er).destroyed||(ot=(this||er).readableEnded?null:new u,this.destroy(ot)),new M((Mt,Ot)=>O(this||er,dt=>dt&&dt!==ot?Ot(dt):Mt(null)))},St.prototype.push=function(ot,Mt){return ut(this||er,ot,Mt,!1)},St.prototype.unshift=function(ot,Mt){return ut(this||er,ot,Mt,!0)};function ut(ot,Mt,Ot,dt){C("readableAddChunk",Mt);let Bt=ot._readableState,Ut;if((Bt.state&E)===0&&(typeof Mt=="string"?(Ot=Ot||Bt.defaultEncoding,Bt.encoding!==Ot&&(dt&&Bt.encoding?Mt=B.from(Mt,Ot).toString(Bt.encoding):(Mt=B.from(Mt,Ot),Ot=""))):Mt instanceof B?Ot="":A._isUint8Array(Mt)?(Mt=A._uint8ArrayToBuffer(Mt),Ot=""):Mt!=null&&(Ut=new V("chunk",["string","Buffer","Uint8Array"],Mt))),Ut)m(ot,Ut);else if(Mt===null)Bt.state&=~L,N(ot,Bt);else if((Bt.state&E)!==0||Mt&&Mt.length>0)if(dt)if((Bt.state&k)!==0)m(ot,new s);else{if(Bt.destroyed||Bt.errored)return!1;It(ot,Bt,Mt,!0)}else if(Bt.ended)m(ot,new n);else{if(Bt.destroyed||Bt.errored)return!1;Bt.state&=~L,Bt.decoder&&!Ot?(Mt=Bt.decoder.write(Mt),Bt.objectMode||Mt.length!==0?It(ot,Bt,Mt,!1):nt(ot,Bt)):It(ot,Bt,Mt,!1)}else dt||(Bt.state&=~L,nt(ot,Bt));return!Bt.ended&&(Bt.length<Bt.highWaterMark||Bt.length===0)}function It(ot,Mt,Ot,dt){Mt.flowing&&Mt.length===0&&!Mt.sync&&ot.listenerCount("data")>0?((Mt.state&et)!==0?Mt.awaitDrainWriters.clear():Mt.awaitDrainWriters=null,Mt.dataEmitted=!0,ot.emit("data",Ot)):(Mt.length+=Mt.objectMode?1:Ot.length,dt?Mt.buffer.unshift(Ot):Mt.buffer.push(Ot),(Mt.state&G)!==0&&D(ot)),nt(ot,Mt)}St.prototype.isPaused=function(){let ot=(this||er)._readableState;return ot[v]===!0||ot.flowing===!1},St.prototype.setEncoding=function(ot){let Mt=new p(ot);(this||er)._readableState.decoder=Mt,(this||er)._readableState.encoding=(this||er)._readableState.decoder.encoding;let Ot=(this||er)._readableState.buffer,dt="";for(let Bt of Ot)dt+=Mt.write(Bt);return Ot.clear(),dt!==""&&Ot.push(dt),(this||er)._readableState.length=dt.length,this||er};let Pt=1073741824;function j(ot){if(ot>Pt)throw new t("size","<= 1GiB",ot);return ot--,ot|=ot>>>1,ot|=ot>>>2,ot|=ot>>>4,ot|=ot>>>8,ot|=ot>>>16,ot++,ot}function T(ot,Mt){return ot<=0||Mt.length===0&&Mt.ended?0:(Mt.state&E)!==0?1:l(ot)?Mt.flowing&&Mt.length?Mt.buffer.first().length:Mt.length:ot<=Mt.length?ot:Mt.ended?Mt.length:0}St.prototype.read=function(ot){C("read",ot),ot===void 0?ot=NaN:a(ot)||(ot=i(ot,10));let Mt=(this||er)._readableState,Ot=ot;if(ot>Mt.highWaterMark&&(Mt.highWaterMark=j(ot)),ot!==0&&(Mt.state&=~$),ot===0&&Mt.needReadable&&((Mt.highWaterMark!==0?Mt.length>=Mt.highWaterMark:Mt.length>0)||Mt.ended))return C("read: emitReadable",Mt.length,Mt.ended),Mt.length===0&&Mt.ended?Ct(this||er):D(this||er),null;if(ot=T(ot,Mt),ot===0&&Mt.ended)return Mt.length===0&&Ct(this||er),null;let dt=(Mt.state&G)!==0;if(C("need readable",dt),(Mt.length===0||Mt.length-ot<Mt.highWaterMark)&&(dt=!0,C("length less than watermark",dt)),Mt.ended||Mt.reading||Mt.destroyed||Mt.errored||!Mt.constructed)dt=!1,C("reading, ended or constructing",dt);else if(dt){C("do read"),Mt.state|=L|it,Mt.length===0&&(Mt.state|=G);try{this._read(Mt.highWaterMark)}catch(Ut){m(this||er,Ut)}Mt.state&=~it,Mt.reading||(ot=T(Ot,Mt))}let Bt;return ot>0?Bt=bt(ot,Mt):Bt=null,Bt===null?(Mt.needReadable=Mt.length<=Mt.highWaterMark,ot=0):(Mt.length-=ot,Mt.multiAwaitDrain?Mt.awaitDrainWriters.clear():Mt.awaitDrainWriters=null),Mt.length===0&&(Mt.ended||(Mt.needReadable=!0),Ot!==ot&&Mt.ended&&Ct(this||er)),Bt!==null&&!Mt.errorEmitted&&!Mt.closeEmitted&&(Mt.dataEmitted=!0,this.emit("data",Bt)),Bt};function N(ot,Mt){if(C("onEofChunk"),!Mt.ended){if(Mt.decoder){let Ot=Mt.decoder.end();Ot&&Ot.length&&(Mt.buffer.push(Ot),Mt.length+=Mt.objectMode?1:Ot.length)}Mt.ended=!0,Mt.sync?D(ot):(Mt.needReadable=!1,Mt.emittedReadable=!0,X(ot))}}function D(ot){let Mt=ot._readableState;C("emitReadable",Mt.needReadable,Mt.emittedReadable),Mt.needReadable=!1,Mt.emittedReadable||(C("emitReadable",Mt.flowing),Mt.emittedReadable=!0,r.nextTick(X,ot))}function X(ot){let Mt=ot._readableState;C("emitReadable_",Mt.destroyed,Mt.length,Mt.ended),!Mt.destroyed&&!Mt.errored&&(Mt.length||Mt.ended)&&(ot.emit("readable"),Mt.emittedReadable=!1),Mt.needReadable=!Mt.flowing&&!Mt.ended&&Mt.length<=Mt.highWaterMark,pt(ot)}function nt(ot,Mt){!Mt.readingMore&&Mt.constructed&&(Mt.readingMore=!0,r.nextTick(tt,ot,Mt))}function tt(ot,Mt){for(;!Mt.reading&&!Mt.ended&&(Mt.length<Mt.highWaterMark||Mt.flowing&&Mt.length===0);){let Ot=Mt.length;if(C("maybeReadMore read 0"),ot.read(0),Ot===Mt.length)break}Mt.readingMore=!1}St.prototype._read=function(ot){throw new h("_read()")},St.prototype.pipe=function(ot,Mt){let Ot=this||er,dt=(this||er)._readableState;dt.pipes.length===1&&(dt.multiAwaitDrain||(dt.multiAwaitDrain=!0,dt.awaitDrainWriters=new y(dt.awaitDrainWriters?[dt.awaitDrainWriters]:[]))),dt.pipes.push(ot),C("pipe count=%d opts=%j",dt.pipes.length,Mt);let Ut=(!Mt||Mt.end!==!1)&&ot!==r.stdout&&ot!==r.stderr?qt:Oe;dt.endEmitted?r.nextTick(Ut):Ot.once("end",Ut),ot.on("unpipe",vt);function vt(De,Le){C("onunpipe"),De===Ot&&Le&&Le.hasUnpiped===!1&&(Le.hasUnpiped=!0,Dt())}function qt(){C("onend"),ot.end()}let jt,gt=!1;function Dt(){C("cleanup"),ot.removeListener("close",Ne),ot.removeListener("finish",Pe),jt&&ot.removeListener("drain",jt),ot.removeListener("error",Nt),ot.removeListener("unpipe",vt),Ot.removeListener("end",qt),Ot.removeListener("end",Oe),Ot.removeListener("data",_t),gt=!0,jt&&dt.awaitDrainWriters&&(!ot._writableState||ot._writableState.needDrain)&&jt()}function ke(){gt||(dt.pipes.length===1&&dt.pipes[0]===ot?(C("false write response, pause",0),dt.awaitDrainWriters=ot,dt.multiAwaitDrain=!1):dt.pipes.length>1&&dt.pipes.includes(ot)&&(C("false write response, pause",dt.awaitDrainWriters.size),dt.awaitDrainWriters.add(ot)),Ot.pause()),jt||(jt=mt(Ot,ot),ot.on("drain",jt))}Ot.on("data",_t);function _t(De){C("ondata");let Le=ot.write(De);C("dest.write",Le),Le===!1&&ke()}function Nt(De){if(C("onerror",De),Oe(),ot.removeListener("error",Nt),ot.listenerCount("error")===0){let Le=ot._writableState||ot._readableState;Le&&!Le.errorEmitted?m(ot,De):ot.emit("error",De)}}I(ot,"error",Nt);function Ne(){ot.removeListener("finish",Pe),Oe()}ot.once("close",Ne);function Pe(){C("onfinish"),ot.removeListener("close",Ne),Oe()}ot.once("finish",Pe);function Oe(){C("unpipe"),Ot.unpipe(ot)}return ot.emit("pipe",Ot),ot.writableNeedDrain===!0?ke():dt.flowing||(C("pipe resume"),Ot.resume()),ot};function mt(ot,Mt){return function(){let dt=ot._readableState;dt.awaitDrainWriters===Mt?(C("pipeOnDrain",1),dt.awaitDrainWriters=null):dt.multiAwaitDrain&&(C("pipeOnDrain",dt.awaitDrainWriters.size),dt.awaitDrainWriters.delete(Mt)),(!dt.awaitDrainWriters||dt.awaitDrainWriters.size===0)&&ot.listenerCount("data")&&ot.resume()}}St.prototype.unpipe=function(ot){let Mt=(this||er)._readableState,Ot={hasUnpiped:!1};if(Mt.pipes.length===0)return this||er;if(!ot){let Bt=Mt.pipes;Mt.pipes=[],this.pause();for(let Ut=0;Ut<Bt.length;Ut++)Bt[Ut].emit("unpipe",this||er,{hasUnpiped:!1});return this||er}let dt=e(Mt.pipes,ot);return dt===-1?this||er:(Mt.pipes.splice(dt,1),Mt.pipes.length===0&&this.pause(),ot.emit("unpipe",this||er,Ot),this||er)},St.prototype.on=function(ot,Mt){let Ot=A.prototype.on.call(this||er,ot,Mt),dt=(this||er)._readableState;return ot==="data"?(dt.readableListening=this.listenerCount("readable")>0,dt.flowing!==!1&&this.resume()):ot==="readable"&&!dt.endEmitted&&!dt.readableListening&&(dt.readableListening=dt.needReadable=!0,dt.flowing=!1,dt.emittedReadable=!1,C("on readable",dt.length,dt.reading),dt.length?D(this||er):dt.reading||r.nextTick(lt,this||er)),Ot},St.prototype.addListener=St.prototype.on,St.prototype.removeListener=function(ot,Mt){let Ot=A.prototype.removeListener.call(this||er,ot,Mt);return ot==="readable"&&r.nextTick(kt,this||er),Ot},St.prototype.off=St.prototype.removeListener,St.prototype.removeAllListeners=function(ot){let Mt=A.prototype.removeAllListeners.apply(this||er,arguments);return(ot==="readable"||ot===void 0)&&r.nextTick(kt,this||er),Mt};function kt(ot){let Mt=ot._readableState;Mt.readableListening=ot.listenerCount("readable")>0,Mt.resumeScheduled&&Mt[v]===!1?Mt.flowing=!0:ot.listenerCount("data")>0?ot.resume():Mt.readableListening||(Mt.flowing=null)}function lt(ot){C("readable nexttick read 0"),ot.read(0)}St.prototype.resume=function(){let ot=(this||er)._readableState;return ot.flowing||(C("resume"),ot.flowing=!ot.readableListening,xt(this||er,ot)),ot[v]=!1,this||er};function xt(ot,Mt){Mt.resumeScheduled||(Mt.resumeScheduled=!0,r.nextTick(Tt,ot,Mt))}function Tt(ot,Mt){C("resume",Mt.reading),Mt.reading||ot.read(0),Mt.resumeScheduled=!1,ot.emit("resume"),pt(ot),Mt.flowing&&!Mt.reading&&ot.read(0)}St.prototype.pause=function(){return C("call pause flowing=%j",(this||er)._readableState.flowing),(this||er)._readableState.flowing!==!1&&(C("pause"),(this||er)._readableState.flowing=!1,this.emit("pause")),(this||er)._readableState[v]=!0,this||er};function pt(ot){let Mt=ot._readableState;for(C("flow",Mt.flowing);Mt.flowing&&ot.read()!==null;);}St.prototype.wrap=function(ot){let Mt=!1;ot.on("data",dt=>{!this.push(dt)&&ot.pause&&(Mt=!0,ot.pause())}),ot.on("end",()=>{this.push(null)}),ot.on("error",dt=>{m(this||er,dt)}),ot.on("close",()=>{this.destroy()}),ot.on("destroy",()=>{this.destroy()}),(this||er)._read=()=>{Mt&&ot.resume&&(Mt=!1,ot.resume())};let Ot=b(ot);for(let dt=1;dt<Ot.length;dt++){let Bt=Ot[dt];(this||er)[Bt]===void 0&&typeof ot[Bt]=="function"&&((this||er)[Bt]=ot[Bt].bind(ot))}return this||er},St.prototype[S]=function(){return $t(this||er)},St.prototype.iterator=function(ot){return ot!==void 0&&d(ot,"options"),$t(this||er,ot)};function $t(ot,Mt){typeof ot.read!="function"&&(ot=St.wrap(ot,{objectMode:!0}));let Ot=Ht(ot,Mt);return Ot.stream=ot,Ot}async function*Ht(ot,Mt){let Ot=o;function dt(vt){(this||er)===ot?(Ot(),Ot=o):Ot=vt}ot.on("readable",dt);let Bt,Ut=O(ot,{writable:!1},vt=>{Bt=vt?q(Bt,vt):null,Ot(),Ot=o});try{for(;;){let vt=ot.destroyed?null:ot.read();if(vt!==null)yield vt;else{if(Bt)throw Bt;if(Bt===null)return;await new M(dt)}}}catch(vt){throw Bt=q(Bt,vt),Bt}finally{(Bt||Mt?.destroyOnReturn!==!1)&&(Bt===void 0||ot._readableState.autoDestroy)?W.destroyer(ot,null):(ot.off("readable",dt),Ut())}}c(St.prototype,{readable:{__proto__:null,get(){let ot=(this||er)._readableState;return!!ot&&ot.readable!==!1&&!ot.destroyed&&!ot.errorEmitted&&!ot.endEmitted},set(ot){(this||er)._readableState&&((this||er)._readableState.readable=!!ot)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||er)._readableState.readable!==!1&&((this||er)._readableState.destroyed||(this||er)._readableState.errored)&&!(this||er)._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState&&(this||er)._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return(this||er)._readableState.flowing},set:function(ot){(this||er)._readableState&&((this||er)._readableState.flowing=ot)}},readableLength:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.errored:null}},closed:{__proto__:null,get(){return(this||er)._readableState?(this||er)._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.destroyed:!1},set(ot){(this||er)._readableState&&((this||er)._readableState.destroyed=ot)}},readableEnded:{__proto__:null,enumerable:!1,get(){return(this||er)._readableState?(this||er)._readableState.endEmitted:!1}}}),c(wt.prototype,{pipesCount:{__proto__:null,get(){return(this||er).pipes.length}},paused:{__proto__:null,get(){return(this||er)[v]!==!1},set(ot){(this||er)[v]=!!ot}}}),St._fromList=bt;function bt(ot,Mt){if(Mt.length===0)return null;let Ot;return Mt.objectMode?Ot=Mt.buffer.shift():!ot||ot>=Mt.length?(Mt.decoder?Ot=Mt.buffer.join(""):Mt.buffer.length===1?Ot=Mt.buffer.first():Ot=Mt.buffer.concat(Mt.length),Mt.buffer.clear()):Ot=Mt.buffer.consume(ot,Mt.decoder),Ot}function Ct(ot){let Mt=ot._readableState;C("endReadable",Mt.endEmitted),Mt.endEmitted||(Mt.ended=!0,r.nextTick(Kt,Mt,ot))}function Kt(ot,Mt){if(C("endReadableNT",ot.endEmitted,ot.length),!ot.errored&&!ot.closeEmitted&&!ot.endEmitted&&ot.length===0){if(ot.endEmitted=!0,Mt.emit("end"),Mt.writable&&Mt.allowHalfOpen===!1)r.nextTick(yt,Mt);else if(ot.autoDestroy){let Ot=Mt._writableState;(!Ot||Ot.autoDestroy&&(Ot.finished||Ot.writable===!1))&&Mt.destroy()}}}function yt(ot){ot.writable&&!ot.writableEnded&&!ot.destroyed&&ot.end()}St.from=function(ot,Mt){return f(St,ot,Mt)};let Lt;function zt(){return Lt===void 0&&(Lt={}),Lt}return St.fromWeb=function(ot,Mt){return zt().newStreamReadableFromReadableStream(ot,Mt)},St.toWeb=function(ot,Mt){return zt().newReadableStreamFromStreamReadable(ot,Mt)},St.wrap=function(ot,Mt){var Ot,dt;return new St({objectMode:(Ot=(dt=ot.readableObjectMode)!==null&&dt!==void 0?dt:ot.objectMode)!==null&&Ot!==void 0?Ot:!0,...Mt,destroy(Bt,Ut){W.destroyer(ot,Bt),Ut(Bt)}}).wrap(ot)},nZ}var aZ={},aMt=!1,ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function mZ(){if(aMt)return aZ;aMt=!0;let r=Jo,{ArrayPrototypeSlice:e,Error:a,FunctionPrototypeSymbolHasInstance:l,ObjectDefineProperty:i,ObjectDefineProperties:c,ObjectSetPrototypeOf:b,StringPrototypeToLowerCase:g,Symbol:M,SymbolHasInstance:y}=po();aZ=d,d.WritableState=s;let{EventEmitter:w}=wd,S=pZ().Stream,{Buffer:_}=Rn(),x=_g(),{addAbortSignal:A}=wx(),{getHighWaterMark:I,getDefaultHighWaterMark:B}=Mx(),{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_MULTIPLE_CALLBACK:C,ERR_STREAM_CANNOT_PIPE:K,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:J,ERR_STREAM_NULL_VALUES:U,ERR_STREAM_WRITE_AFTER_END:q,ERR_UNKNOWN_ENCODING:V}=$f().codes,{errorOrDestroy:h}=x;b(d.prototype,S.prototype),b(d,S);function t(){}let n=M("kOnFinished");function s(F,Y,at){typeof at!="boolean"&&(at=Y instanceof Dc()),(this||ar).objectMode=!!(F&&F.objectMode),at&&((this||ar).objectMode=(this||ar).objectMode||!!(F&&F.writableObjectMode)),(this||ar).highWaterMark=F?I(this||ar,F,"writableHighWaterMark",at):B(!1),(this||ar).finalCalled=!1,(this||ar).needDrain=!1,(this||ar).ending=!1,(this||ar).ended=!1,(this||ar).finished=!1,(this||ar).destroyed=!1;let ht=!!(F&&F.decodeStrings===!1);(this||ar).decodeStrings=!ht,(this||ar).defaultEncoding=F&&F.defaultEncoding||"utf8",(this||ar).length=0,(this||ar).writing=!1,(this||ar).corked=0,(this||ar).sync=!0,(this||ar).bufferProcessing=!1,(this||ar).onwrite=m.bind(void 0,Y),(this||ar).writecb=null,(this||ar).writelen=0,(this||ar).afterWriteTickInfo=null,u(this||ar),(this||ar).pendingcb=0,(this||ar).constructed=!0,(this||ar).prefinished=!1,(this||ar).errorEmitted=!1,(this||ar).emitClose=!F||F.emitClose!==!1,(this||ar).autoDestroy=!F||F.autoDestroy!==!1,(this||ar).errored=null,(this||ar).closed=!1,(this||ar).closeEmitted=!1,(this||ar)[n]=[]}function u(F){F.buffered=[],F.bufferedIndex=0,F.allBuffers=!0,F.allNoop=!0}s.prototype.getBuffer=function(){return e((this||ar).buffered,(this||ar).bufferedIndex)},i(s.prototype,"bufferedRequestCount",{__proto__:null,get(){return(this||ar).buffered.length-(this||ar).bufferedIndex}});function d(F){let Y=(this||ar)instanceof Dc();if(!Y&&!l(d,this||ar))return new d(F);(this||ar)._writableState=new s(F,this||ar,Y),F&&(typeof F.write=="function"&&((this||ar)._write=F.write),typeof F.writev=="function"&&((this||ar)._writev=F.writev),typeof F.destroy=="function"&&((this||ar)._destroy=F.destroy),typeof F.final=="function"&&((this||ar)._final=F.final),typeof F.construct=="function"&&((this||ar)._construct=F.construct),F.signal&&A(F.signal,this||ar)),S.call(this||ar,F),x.construct(this||ar,()=>{let at=(this||ar)._writableState;at.writing||L(this||ar,at),$(this||ar,at)})}i(d,y,{__proto__:null,value:function(F){return l(this||ar,F)?!0:(this||ar)!==d?!1:F&&F._writableState instanceof s}}),d.prototype.pipe=function(){h(this||ar,new K)};function v(F,Y,at,ht){let et=F._writableState;if(typeof at=="function")ht=at,at=et.defaultEncoding;else{if(!at)at=et.defaultEncoding;else if(at!=="buffer"&&!_.isEncoding(at))throw new V(at);typeof ht!="function"&&(ht=t)}if(Y===null)throw new U;if(!et.objectMode)if(typeof Y=="string")et.decodeStrings!==!1&&(Y=_.from(Y,at),at="buffer");else if(Y instanceof _)at="buffer";else if(S._isUint8Array(Y))Y=S._uint8ArrayToBuffer(Y),at="buffer";else throw new P("chunk",["string","Buffer","Uint8Array"],Y);let ft;return et.ending?ft=new q:et.destroyed&&(ft=new W("write")),ft?(r.nextTick(ht,ft),h(F,ft,!0),ft):(et.pendingcb++,p(F,et,Y,at,ht))}d.prototype.write=function(F,Y,at){return v(this||ar,F,Y,at)===!0},d.prototype.cork=function(){(this||ar)._writableState.corked++},d.prototype.uncork=function(){let F=(this||ar)._writableState;F.corked&&(F.corked--,F.writing||L(this||ar,F))},d.prototype.setDefaultEncoding=function(Y){if(typeof Y=="string"&&(Y=g(Y)),!_.isEncoding(Y))throw new V(Y);return(this||ar)._writableState.defaultEncoding=Y,this||ar};function p(F,Y,at,ht,et){let ft=Y.objectMode?1:at.length;Y.length+=ft;let ct=Y.length<Y.highWaterMark;return ct||(Y.needDrain=!0),Y.writing||Y.corked||Y.errored||!Y.constructed?(Y.buffered.push({chunk:at,encoding:ht,callback:et}),Y.allBuffers&&ht!=="buffer"&&(Y.allBuffers=!1),Y.allNoop&&et!==t&&(Y.allNoop=!1)):(Y.writelen=ft,Y.writecb=et,Y.writing=!0,Y.sync=!0,F._write(at,ht,Y.onwrite),Y.sync=!1),ct&&!Y.errored&&!Y.destroyed}function f(F,Y,at,ht,et,ft,ct){Y.writelen=ht,Y.writecb=ct,Y.writing=!0,Y.sync=!0,Y.destroyed?Y.onwrite(new W("write")):at?F._writev(et,Y.onwrite):F._write(et,ft,Y.onwrite),Y.sync=!1}function o(F,Y,at,ht){--Y.pendingcb,ht(at),k(Y),h(F,at)}function m(F,Y){let at=F._writableState,ht=at.sync,et=at.writecb;if(typeof et!="function"){h(F,new C);return}at.writing=!1,at.writecb=null,at.length-=at.writelen,at.writelen=0,Y?(Y.stack,at.errored||(at.errored=Y),F._readableState&&!F._readableState.errored&&(F._readableState.errored=Y),ht?r.nextTick(o,F,at,Y,et):o(F,at,Y,et)):(at.buffered.length>at.bufferedIndex&&L(F,at),ht?at.afterWriteTickInfo!==null&&at.afterWriteTickInfo.cb===et?at.afterWriteTickInfo.count++:(at.afterWriteTickInfo={count:1,cb:et,stream:F,state:at},r.nextTick(E,at.afterWriteTickInfo)):R(F,at,1,et))}function E({stream:F,state:Y,count:at,cb:ht}){return Y.afterWriteTickInfo=null,R(F,Y,at,ht)}function R(F,Y,at,ht){for(!Y.ending&&!F.destroyed&&Y.length===0&&Y.needDrain&&(Y.needDrain=!1,F.emit("drain"));at-- >0;)Y.pendingcb--,ht();Y.destroyed&&k(Y),$(F,Y)}function k(F){if(F.writing)return;for(let et=F.bufferedIndex;et<F.buffered.length;++et){var Y;let{chunk:ft,callback:ct}=F.buffered[et],st=F.objectMode?1:ft.length;F.length-=st,ct((Y=F.errored)!==null&&Y!==void 0?Y:new W("write"))}let at=F[n].splice(0);for(let et=0;et<at.length;et++){var ht;at[et]((ht=F.errored)!==null&&ht!==void 0?ht:new W("end"))}u(F)}function L(F,Y){if(Y.corked||Y.bufferProcessing||Y.destroyed||!Y.constructed)return;let{buffered:at,bufferedIndex:ht,objectMode:et}=Y,ft=at.length-ht;if(!ft)return;let ct=ht;if(Y.bufferProcessing=!0,ft>1&&F._writev){Y.pendingcb-=ft-1;let st=Y.allNoop?t:St=>{for(let ut=ct;ut<at.length;++ut)at[ut].callback(St)},wt=Y.allNoop&&ct===0?at:e(at,ct);wt.allBuffers=Y.allBuffers,f(F,Y,!0,Y.length,wt,"",st),u(Y)}else{do{let{chunk:st,encoding:wt,callback:St}=at[ct];at[ct++]=null;let ut=et?1:st.length;f(F,Y,!1,ut,st,wt,St)}while(ct<at.length&&!Y.writing);ct===at.length?u(Y):ct>256?(at.splice(0,ct),Y.bufferedIndex=0):Y.bufferedIndex=ct}Y.bufferProcessing=!1}d.prototype._write=function(F,Y,at){if((this||ar)._writev)this._writev([{chunk:F,encoding:Y}],at);else throw new O("_write()")},d.prototype._writev=null,d.prototype.end=function(F,Y,at){let ht=(this||ar)._writableState;typeof F=="function"?(at=F,F=null,Y=null):typeof Y=="function"&&(at=Y,Y=null);let et;if(F!=null){let ft=v(this||ar,F,Y);ft instanceof a&&(et=ft)}return ht.corked&&(ht.corked=1,this.uncork()),et||(!ht.errored&&!ht.ending?(ht.ending=!0,$(this||ar,ht,!0),ht.ended=!0):ht.finished?et=new J("end"):ht.destroyed&&(et=new W("end"))),typeof at=="function"&&(et||ht.finished?r.nextTick(at,et):ht[n].push(at)),this||ar};function z(F){return F.ending&&!F.destroyed&&F.constructed&&F.length===0&&!F.errored&&F.buffered.length===0&&!F.finished&&!F.writing&&!F.errorEmitted&&!F.closeEmitted}function it(F,Y){let at=!1;function ht(et){if(at){h(F,et??C());return}if(at=!0,Y.pendingcb--,et){let ft=Y[n].splice(0);for(let ct=0;ct<ft.length;ct++)ft[ct](et);h(F,et,Y.sync)}else z(Y)&&(Y.prefinished=!0,F.emit("prefinish"),Y.pendingcb++,r.nextTick(Z,F,Y))}Y.sync=!0,Y.pendingcb++;try{F._final(ht)}catch(et){ht(et)}Y.sync=!1}function G(F,Y){!Y.prefinished&&!Y.finalCalled&&(typeof F._final=="function"&&!Y.destroyed?(Y.finalCalled=!0,it(F,Y)):(Y.prefinished=!0,F.emit("prefinish")))}function $(F,Y,at){z(Y)&&(G(F,Y),Y.pendingcb===0&&(at?(Y.pendingcb++,r.nextTick((ht,et)=>{z(et)?Z(ht,et):et.pendingcb--},F,Y)):z(Y)&&(Y.pendingcb++,Z(F,Y))))}function Z(F,Y){Y.pendingcb--,Y.finished=!0;let at=Y[n].splice(0);for(let ht=0;ht<at.length;ht++)at[ht]();if(F.emit("finish"),Y.autoDestroy){let ht=F._readableState;(!ht||ht.autoDestroy&&(ht.endEmitted||ht.readable===!1))&&F.destroy()}}c(d.prototype,{closed:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.closed:!1}},destroyed:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.destroyed:!1},set(F){(this||ar)._writableState&&((this||ar)._writableState.destroyed=F)}},writable:{__proto__:null,get(){let F=(this||ar)._writableState;return!!F&&F.writable!==!1&&!F.destroyed&&!F.errored&&!F.ending&&!F.ended},set(F){(this||ar)._writableState&&((this||ar)._writableState.writable=!!F)}},writableFinished:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return(this||ar)._writableState&&(this||ar)._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let F=(this||ar)._writableState;return F?!F.destroyed&&!F.ending&&F.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return(this||ar)._writableState&&(this||ar)._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return(this||ar)._writableState?(this||ar)._writableState.corked:0}},writableLength:{__proto__:null,get(){return(this||ar)._writableState&&(this||ar)._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return(this||ar)._writableState?(this||ar)._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||ar)._writableState.writable!==!1&&((this||ar)._writableState.destroyed||(this||ar)._writableState.errored)&&!(this||ar)._writableState.finished)}}});let rt=x.destroy;d.prototype.destroy=function(F,Y){let at=(this||ar)._writableState;return!at.destroyed&&(at.bufferedIndex<at.buffered.length||at[n].length)&&r.nextTick(k,at),rt.call(this||ar,F,Y),this||ar},d.prototype._undestroy=x.undestroy,d.prototype._destroy=function(F,Y){Y(F)},d.prototype[w.captureRejectionSymbol]=function(F){this.destroy(F)};let Q;function H(){return Q===void 0&&(Q={}),Q}return d.fromWeb=function(F,Y){return H().newStreamWritableFromWritableStream(F,Y)},d.toWeb=function(F){return H().newWritableStreamFromStreamWritable(F)},aZ}var oZ={},oMt=!1;function Zse(){if(oMt)return oZ;oMt=!0;let r=Jo,e=Rn(),{isReadable:a,isWritable:l,isIterable:i,isNodeStream:c,isReadableNodeStream:b,isWritableNodeStream:g,isDuplexNodeStream:M,isReadableStream:y,isWritableStream:w}=$c(),S=jp(),{AbortError:_,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:A}}=$f(),{destroyer:I}=_g(),B=Dc(),P=_x(),O=mZ(),{createDeferredPromise:C}=cf(),K=gMt(),W=globalThis.Blob||e.Blob,J=typeof W<"u"?function(s){return s instanceof W}:function(s){return!1},U=globalThis.AbortController||_4().AbortController,{FunctionPrototypeCall:q}=po();class V extends B{constructor(s){super(s),s?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),s?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}oZ=function n(s,u){if(M(s))return s;if(b(s))return t({readable:s});if(g(s))return t({writable:s});if(c(s))return t({writable:!1,readable:!1});if(y(s))return t({readable:P.fromWeb(s)});if(w(s))return t({writable:O.fromWeb(s)});if(typeof s=="function"){let{value:v,write:p,final:f,destroy:o}=h(s);if(i(v))return K(V,v,{objectMode:!0,write:p,final:f,destroy:o});let m=v?.then;if(typeof m=="function"){let E,R=q(m,v,k=>{if(k!=null)throw new A("nully","body",k)},k=>{I(E,k)});return E=new V({objectMode:!0,readable:!1,write:p,final(k){f(async()=>{try{await R,r.nextTick(k,null)}catch(L){r.nextTick(k,L)}})},destroy:o})}throw new A("Iterable, AsyncIterable or AsyncFunction",u,v)}if(J(s))return n(s.arrayBuffer());if(i(s))return K(V,s,{objectMode:!0,writable:!1});if(y(s?.readable)&&w(s?.writable))return V.fromWeb(s);if(typeof s?.writable=="object"||typeof s?.readable=="object"){let v=s!=null&&s.readable?b(s?.readable)?s?.readable:n(s.readable):void 0,p=s!=null&&s.writable?g(s?.writable)?s?.writable:n(s.writable):void 0;return t({readable:v,writable:p})}let d=s?.then;if(typeof d=="function"){let v;return q(d,s,p=>{p!=null&&v.push(p),v.push(null)},p=>{I(v,p)}),v=new V({objectMode:!0,writable:!1,read(){}})}throw new x(u,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],s)};function h(n){let{promise:s,resolve:u}=C(),d=new U,v=d.signal;return{value:n((async function*(){for(;;){let f=s;s=null;let{chunk:o,done:m,cb:E}=await f;if(r.nextTick(E),m)return;if(v.aborted)throw new _(void 0,{cause:v.reason});({promise:s,resolve:u}=C()),yield o}})(),{signal:v}),write(f,o,m){let E=u;u=null,E({chunk:f,done:!1,cb:m})},final(f){let o=u;u=null,o({done:!0,cb:f})},destroy(f,o){d.abort(),o(f)}}}function t(n){let s=n.readable&&typeof n.readable.read!="function"?P.wrap(n.readable):n.readable,u=n.writable,d=!!a(s),v=!!l(u),p,f,o,m,E;function R(k){let L=m;m=null,L?L(k):k&&E.destroy(k)}return E=new V({readableObjectMode:!!(s!=null&&s.readableObjectMode),writableObjectMode:!!(u!=null&&u.writableObjectMode),readable:d,writable:v}),v&&(S(u,k=>{v=!1,k&&I(s,k),R(k)}),E._write=function(k,L,z){u.write(k,L)?z():p=z},E._final=function(k){u.end(),f=k},u.on("drain",function(){if(p){let k=p;p=null,k()}}),u.on("finish",function(){if(f){let k=f;f=null,k()}})),d&&(S(s,k=>{d=!1,k&&I(s,k),R(k)}),s.on("readable",function(){if(o){let k=o;o=null,k()}}),s.on("end",function(){E.push(null)}),E._read=function(){for(;;){let k=s.read();if(k===null){o=E._read;return}if(!E.push(k))return}}),E._destroy=function(k,L){!k&&m!==null&&(k=new _),o=null,p=null,f=null,m===null?L(k):(m=L,I(u,k),I(s,k))},E}return oZ}var sZ={},sMt=!1;function Dc(){if(sMt)return sZ;sMt=!0;let{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:a,ObjectSetPrototypeOf:l}=po();sZ=b;let i=_x(),c=mZ();l(b.prototype,i.prototype),l(b,i);{let w=a(c.prototype);for(let S=0;S<w.length;S++){let _=w[S];b.prototype[_]||(b.prototype[_]=c.prototype[_])}}function b(w){if(!(this instanceof b))return new b(w);i.call(this,w),c.call(this,w),w?(this.allowHalfOpen=w.allowHalfOpen!==!1,w.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),w.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(b.prototype,{writable:{__proto__:null,...e(c.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(c.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(c.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(c.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(c.prototype,"writableLength")},writableFinished:{__proto__:null,...e(c.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(c.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(c.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(c.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(w){this._readableState&&this._writableState&&(this._readableState.destroyed=w,this._writableState.destroyed=w)}}});let g;function M(){return g===void 0&&(g={}),g}b.fromWeb=function(w,S){return M().newStreamDuplexFromReadableWritablePair(w,S)},b.toWeb=function(w){return M().newReadableWritablePairFromDuplex(w)};let y;return b.from=function(w){return y||(y=Zse()),y(w,"body")},sZ}var fZ={},fMt=!1;function yMt(){if(fMt)return fZ;fMt=!0;let{ObjectSetPrototypeOf:r,Symbol:e}=po();fZ=b;let{ERR_METHOD_NOT_IMPLEMENTED:a}=$f().codes,l=Dc(),{getHighWaterMark:i}=Mx();r(b.prototype,l.prototype),r(b,l);let c=e("kCallback");function b(y){if(!(this instanceof b))return new b(y);let w=y?i(this,y,"readableHighWaterMark",!0):null;w===0&&(y={...y,highWaterMark:null,readableHighWaterMark:w,writableHighWaterMark:y.writableHighWaterMark||0}),l.call(this,y),this._readableState.sync=!1,this[c]=null,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",M)}function g(y){typeof this._flush=="function"&&!this.destroyed?this._flush((w,S)=>{if(w){y?y(w):this.destroy(w);return}S!=null&&this.push(S),this.push(null),y&&y()}):(this.push(null),y&&y())}function M(){this._final!==g&&g.call(this)}return b.prototype._final=g,b.prototype._transform=function(y,w,S){throw new a("_transform()")},b.prototype._write=function(y,w,S){let _=this._readableState,x=this._writableState,A=_.length;this._transform(y,w,(I,B)=>{if(I){S(I);return}B!=null&&this.push(B),x.ended||A===_.length||_.length<_.highWaterMark?S():this[c]=S})},b.prototype._read=function(){if(this[c]){let y=this[c];this[c]=null,y()}},fZ}var hZ={},hMt=!1;function wMt(){if(hMt)return hZ;hMt=!0;let{ObjectSetPrototypeOf:r}=po();hZ=a;let e=yMt();r(a.prototype,e.prototype),r(a,e);function a(l){if(!(this instanceof a))return new a(l);e.call(this,l)}return a.prototype._transform=function(l,i,c){c(null,l)},hZ}var uZ={},uMt=!1;function vZ(){if(uMt)return uZ;uMt=!0;let r=Jo,{ArrayIsArray:e,Promise:a,SymbolAsyncIterator:l,SymbolDispose:i}=po(),c=jp(),{once:b}=cf(),g=_g(),M=Dc(),{aggregateTwoErrors:y,codes:{ERR_INVALID_ARG_TYPE:w,ERR_INVALID_RETURN_VALUE:S,ERR_MISSING_ARGS:_,ERR_STREAM_DESTROYED:x,ERR_STREAM_PREMATURE_CLOSE:A},AbortError:I}=$f(),{validateFunction:B,validateAbortSignal:P}=S4(),{isIterable:O,isReadable:C,isReadableNodeStream:K,isNodeStream:W,isTransformStream:J,isWebStream:U,isReadableStream:q,isReadableFinished:V}=$c(),h=globalThis.AbortController||_4().AbortController,t,n,s;function u(k,L,z){let it=!1;k.on("close",()=>{it=!0});let G=c(k,{readable:L,writable:z},$=>{it=!$});return{destroy:$=>{it||(it=!0,g.destroyer(k,$||new x("pipe")))},cleanup:G}}function d(k){return B(k[k.length-1],"streams[stream.length - 1]"),k.pop()}function v(k){if(O(k))return k;if(K(k))return p(k);throw new w("val",["Readable","Iterable","AsyncIterable"],k)}async function*p(k){n||(n=_x()),yield*n.prototype[l].call(k)}async function f(k,L,z,{end:it}){let G,$=null,Z=H=>{if(H&&(G=H),$){let F=$;$=null,F()}},rt=()=>new a((H,F)=>{G?F(G):$=()=>{G?F(G):H()}});L.on("drain",Z);let Q=c(L,{readable:!1},Z);try{L.writableNeedDrain&&await rt();for await(let H of k)L.write(H)||await rt();it&&(L.end(),await rt()),z()}catch(H){z(G!==H?y(G,H):H)}finally{Q(),L.off("drain",Z)}}async function o(k,L,z,{end:it}){J(L)&&(L=L.writable);let G=L.getWriter();try{for await(let $ of k)await G.ready,G.write($).catch(()=>{});await G.ready,it&&await G.close(),z()}catch($){try{await G.abort($),z($)}catch(Z){z(Z)}}}function m(...k){return E(k,b(d(k)))}function E(k,L,z){if(k.length===1&&e(k[0])&&(k=k[0]),k.length<2)throw new _("streams");let it=new h,G=it.signal,$=z?.signal,Z=[];P($,"options.signal");function rt(){et(new I)}s=s||cf().addAbortListener;let Q;$&&(Q=s($,rt));let H,F,Y=[],at=0;function ht(St){et(St,--at===0)}function et(St,ut){var It;if(St&&(!H||H.code==="ERR_STREAM_PREMATURE_CLOSE")&&(H=St),!(!H&&!ut)){for(;Y.length;)Y.shift()(H);(It=Q)===null||It===void 0||It[i](),it.abort(),ut&&(H||Z.forEach(Pt=>Pt()),r.nextTick(L,H,F))}}let ft;for(let St=0;St<k.length;St++){let ut=k[St],It=St<k.length-1,Pt=St>0,j=It||z?.end!==!1,T=St===k.length-1;if(W(ut)){let N=function(D){D&&D.name!=="AbortError"&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ht(D)};var wt=N;if(j){let{destroy:D,cleanup:X}=u(ut,It,Pt);Y.push(D),C(ut)&&T&&Z.push(X)}ut.on("error",N),C(ut)&&T&&Z.push(()=>{ut.removeListener("error",N)})}if(St===0)if(typeof ut=="function"){if(ft=ut({signal:G}),!O(ft))throw new S("Iterable, AsyncIterable or Stream","source",ft)}else O(ut)||K(ut)||J(ut)?ft=ut:ft=M.from(ut);else if(typeof ut=="function"){if(J(ft)){var ct;ft=v((ct=ft)===null||ct===void 0?void 0:ct.readable)}else ft=v(ft);if(ft=ut(ft,{signal:G}),It){if(!O(ft,!0))throw new S("AsyncIterable",`transform[${St-1}]`,ft)}else{var st;t||(t=wMt());let N=new t({objectMode:!0}),D=(st=ft)===null||st===void 0?void 0:st.then;if(typeof D=="function")at++,D.call(ft,tt=>{F=tt,tt!=null&&N.write(tt),j&&N.end(),r.nextTick(ht)},tt=>{N.destroy(tt),r.nextTick(ht,tt)});else if(O(ft,!0))at++,f(ft,N,ht,{end:j});else if(q(ft)||J(ft)){let tt=ft.readable||ft;at++,f(tt,N,ht,{end:j})}else throw new S("AsyncIterable or Promise","destination",ft);ft=N;let{destroy:X,cleanup:nt}=u(ft,!1,!0);Y.push(X),T&&Z.push(nt)}}else if(W(ut)){if(K(ft)){at+=2;let N=R(ft,ut,ht,{end:j});C(ut)&&T&&Z.push(N)}else if(J(ft)||q(ft)){let N=ft.readable||ft;at++,f(N,ut,ht,{end:j})}else if(O(ft))at++,f(ft,ut,ht,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ft);ft=ut}else if(U(ut)){if(K(ft))at++,o(v(ft),ut,ht,{end:j});else if(q(ft)||O(ft))at++,o(ft,ut,ht,{end:j});else if(J(ft))at++,o(ft.readable,ut,ht,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ft);ft=ut}else ft=M.from(ut)}return(G!=null&&G.aborted||$!=null&&$.aborted)&&r.nextTick(rt),ft}function R(k,L,z,{end:it}){let G=!1;if(L.on("close",()=>{G||z(new A)}),k.pipe(L,{end:!1}),it){let Z=function(){G=!0,L.end()};var $=Z;V(k)?r.nextTick(Z):k.once("end",Z)}else z();return c(k,{readable:!0,writable:!1},Z=>{let rt=k._readableState;Z&&Z.code==="ERR_STREAM_PREMATURE_CLOSE"&&rt&&rt.ended&&!rt.errored&&!rt.errorEmitted?k.once("end",z).once("error",z):z(Z)}),c(L,{readable:!1,writable:!0},z)}return uZ={pipelineImpl:E,pipeline:m},uZ}var lZ={},lMt=!1;function MMt(){if(lMt)return lZ;lMt=!0;let{pipeline:r}=vZ(),e=Dc(),{destroyer:a}=_g(),{isNodeStream:l,isReadable:i,isWritable:c,isWebStream:b,isTransformStream:g,isWritableStream:M,isReadableStream:y}=$c(),{AbortError:w,codes:{ERR_INVALID_ARG_VALUE:S,ERR_MISSING_ARGS:_}}=$f(),x=jp();return lZ=function(...I){if(I.length===0)throw new _("streams");if(I.length===1)return e.from(I[0]);let B=[...I];if(typeof I[0]=="function"&&(I[0]=e.from(I[0])),typeof I[I.length-1]=="function"){let t=I.length-1;I[t]=e.from(I[t])}for(let t=0;t<I.length;++t)if(!(!l(I[t])&&!b(I[t]))){if(t<I.length-1&&!(i(I[t])||y(I[t])||g(I[t])))throw new S(`streams[${t}]`,B[t],"must be readable");if(t>0&&!(c(I[t])||M(I[t])||g(I[t])))throw new S(`streams[${t}]`,B[t],"must be writable")}let P,O,C,K,W;function J(t){let n=K;K=null,n?n(t):t?W.destroy(t):!h&&!V&&W.destroy()}let U=I[0],q=r(I,J),V=!!(c(U)||M(U)||g(U)),h=!!(i(q)||y(q)||g(q));if(W=new e({writableObjectMode:!!(U!=null&&U.writableObjectMode),readableObjectMode:!!(q!=null&&q.readableObjectMode),writable:V,readable:h}),V){if(l(U))W._write=function(n,s,u){U.write(n,s)?u():P=u},W._final=function(n){U.end(),O=n},U.on("drain",function(){if(P){let n=P;P=null,n()}});else if(b(U)){let s=(g(U)?U.writable:U).getWriter();W._write=async function(u,d,v){try{await s.ready,s.write(u).catch(()=>{}),v()}catch(p){v(p)}},W._final=async function(u){try{await s.ready,s.close().catch(()=>{}),O=u}catch(d){u(d)}}}let t=g(q)?q.readable:q;x(t,()=>{if(O){let n=O;O=null,n()}})}if(h){if(l(q))q.on("readable",function(){if(C){let t=C;C=null,t()}}),q.on("end",function(){W.push(null)}),W._read=function(){for(;;){let t=q.read();if(t===null){C=W._read;return}if(!W.push(t))return}};else if(b(q)){let n=(g(q)?q.readable:q).getReader();W._read=async function(){for(;;)try{let{value:s,done:u}=await n.read();if(!W.push(s))return;if(u){W.push(null);return}}catch{return}}}}return W._destroy=function(t,n){!t&&K!==null&&(t=new w),C=null,P=null,O=null,K===null?n(t):(K=n,l(q)&&a(q,t))},W},lZ}var yx={},dMt=!1;function Wse(){if(dMt)return yx;dMt=!0;let r=globalThis.AbortController||_4().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:a,ERR_MISSING_ARGS:l,ERR_OUT_OF_RANGE:i},AbortError:c}=$f(),{validateAbortSignal:b,validateInteger:g,validateObject:M}=S4(),y=po().Symbol("kWeak"),w=po().Symbol("kResistStopPropagation"),{finished:S}=jp(),_=MMt(),{addAbortSignalNoValidate:x}=wx(),{isWritable:A,isNodeStream:I}=$c(),{deprecate:B}=cf(),{ArrayPrototypePush:P,Boolean:O,MathFloor:C,Number:K,NumberIsNaN:W,Promise:J,PromiseReject:U,PromiseResolve:q,PromisePrototypeThen:V,Symbol:h}=po(),t=h("kEmpty"),n=h("kEof");function s($,Z){if(Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal"),I($)&&!A($))throw new e("stream",$,"must be writable");let rt=_(this,$);return Z!=null&&Z.signal&&x(Z.signal,rt),rt}function u($,Z){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal");let rt=1;Z?.concurrency!=null&&(rt=C(Z.concurrency));let Q=rt-1;return Z?.highWaterMark!=null&&(Q=C(Z.highWaterMark)),g(rt,"options.concurrency",1),g(Q,"options.highWaterMark",0),Q+=rt,async function*(){let F=cf().AbortSignalAny([Z?.signal].filter(O)),Y=this,at=[],ht={signal:F},et,ft,ct=!1,st=0;function wt(){ct=!0,St()}function St(){st-=1,ut()}function ut(){ft&&!ct&&st<rt&&at.length<Q&&(ft(),ft=null)}async function It(){try{for await(let Pt of Y){if(ct)return;if(F.aborted)throw new c;try{if(Pt=$(Pt,ht),Pt===t)continue;Pt=q(Pt)}catch(j){Pt=U(j)}st+=1,V(Pt,St,wt),at.push(Pt),et&&(et(),et=null),!ct&&(at.length>=Q||st>=rt)&&await new J(j=>{ft=j})}at.push(n)}catch(Pt){let j=U(Pt);V(j,St,wt),at.push(j)}finally{ct=!0,et&&(et(),et=null)}}It();try{for(;;){for(;at.length>0;){let Pt=await at[0];if(Pt===n)return;if(F.aborted)throw new c;Pt!==t&&(yield Pt),at.shift(),ut()}await new J(Pt=>{et=Pt})}}finally{ct=!0,ft&&(ft(),ft=null)}}.call(this)}function d($=void 0){return $!=null&&M($,"options"),$?.signal!=null&&b($.signal,"options.signal"),async function*(){let rt=0;for await(let H of this){var Q;if($!=null&&(Q=$.signal)!==null&&Q!==void 0&&Q.aborted)throw new c({cause:$.signal.reason});yield[rt++,H]}}.call(this)}async function v($,Z=void 0){for await(let rt of m.call(this,$,Z))return!0;return!1}async function p($,Z=void 0){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);return!await v.call(this,async(...rt)=>!await $(...rt),Z)}async function f($,Z){for await(let rt of m.call(this,$,Z))return rt}async function o($,Z){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);async function rt(Q,H){return await $(Q,H),t}for await(let Q of u.call(this,rt,Z));}function m($,Z){if(typeof $!="function")throw new a("fn",["Function","AsyncFunction"],$);async function rt(Q,H){return await $(Q,H)?Q:t}return u.call(this,rt,Z)}class E extends l{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function R($,Z,rt){var Q;if(typeof $!="function")throw new a("reducer",["Function","AsyncFunction"],$);rt!=null&&M(rt,"options"),rt?.signal!=null&&b(rt.signal,"options.signal");let H=arguments.length>1;if(rt!=null&&(Q=rt.signal)!==null&&Q!==void 0&&Q.aborted){let et=new c(void 0,{cause:rt.signal.reason});throw this.once("error",()=>{}),await S(this.destroy(et)),et}let F=new r,Y=F.signal;if(rt!=null&&rt.signal){let et={once:!0,[y]:this,[w]:!0};rt.signal.addEventListener("abort",()=>F.abort(),et)}let at=!1;try{for await(let et of this){var ht;if(at=!0,rt!=null&&(ht=rt.signal)!==null&&ht!==void 0&&ht.aborted)throw new c;H?Z=await $(Z,et,{signal:Y}):(Z=et,H=!0)}if(!at&&!H)throw new E}finally{F.abort()}return Z}async function k($){$!=null&&M($,"options"),$?.signal!=null&&b($.signal,"options.signal");let Z=[];for await(let Q of this){var rt;if($!=null&&(rt=$.signal)!==null&&rt!==void 0&&rt.aborted)throw new c(void 0,{cause:$.signal.reason});P(Z,Q)}return Z}function L($,Z){let rt=u.call(this,$,Z);return async function*(){for await(let H of rt)yield*H}.call(this)}function z($){if($=K($),W($))return 0;if($<0)throw new i("number",">= 0",$);return $}function it($,Z=void 0){return Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal"),$=z($),async function*(){var Q;if(Z!=null&&(Q=Z.signal)!==null&&Q!==void 0&&Q.aborted)throw new c;for await(let F of this){var H;if(Z!=null&&(H=Z.signal)!==null&&H!==void 0&&H.aborted)throw new c;$--<=0&&(yield F)}}.call(this)}function G($,Z=void 0){return Z!=null&&M(Z,"options"),Z?.signal!=null&&b(Z.signal,"options.signal"),$=z($),async function*(){var Q;if(Z!=null&&(Q=Z.signal)!==null&&Q!==void 0&&Q.aborted)throw new c;for await(let F of this){var H;if(Z!=null&&(H=Z.signal)!==null&&H!==void 0&&H.aborted)throw new c;if($-- >0&&(yield F),$<=0)return}}.call(this)}return yx.streamReturningOperators={asIndexedPairs:B(d,"readable.asIndexedPairs will be removed in a future version."),drop:it,filter:m,flatMap:L,map:u,take:G,compose:s},yx.promiseReturningOperators={every:p,forEach:o,reduce:R,toArray:k,some:v,find:f},yx}var dZ={},cMt=!1;function _Mt(){if(cMt)return dZ;cMt=!0;let{ArrayPrototypePop:r,Promise:e}=po(),{isIterable:a,isNodeStream:l,isWebStream:i}=$c(),{pipelineImpl:c}=vZ(),{finished:b}=jp();SMt();function g(...M){return new e((y,w)=>{let S,_,x=M[M.length-1];if(x&&typeof x=="object"&&!l(x)&&!a(x)&&!i(x)){let A=r(M);S=A.signal,_=A.end}c(M,(A,I)=>{A?w(A):y(I)},{signal:S,end:_})})}return dZ={finished:b,pipeline:g},dZ}var cZ={},pMt=!1,mMt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function SMt(){if(pMt)return cZ;pMt=!0;let{Buffer:r}=Rn(),{ObjectDefineProperty:e,ObjectKeys:a,ReflectApply:l}=po(),{promisify:{custom:i}}=cf(),{streamReturningOperators:c,promiseReturningOperators:b}=Wse(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:g}}=$f(),M=MMt(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:w}=Mx(),{pipeline:S}=vZ(),{destroyer:_}=_g(),x=jp(),A=_Mt(),I=$c(),B=cZ=pZ().Stream;B.isDestroyed=I.isDestroyed,B.isDisturbed=I.isDisturbed,B.isErrored=I.isErrored,B.isReadable=I.isReadable,B.isWritable=I.isWritable,B.Readable=_x();for(let C of a(c)){let W=function(...J){if(new.target)throw g();return B.Readable.from(l(K,this||mMt,J))};var O=W;let K=c[C];e(W,"name",{__proto__:null,value:K.name}),e(W,"length",{__proto__:null,value:K.length}),e(B.Readable.prototype,C,{__proto__:null,value:W,enumerable:!1,configurable:!0,writable:!0})}for(let C of a(b)){let W=function(...U){if(new.target)throw g();return l(K,this||mMt,U)};var O=W;let K=b[C];e(W,"name",{__proto__:null,value:K.name}),e(W,"length",{__proto__:null,value:K.length}),e(B.Readable.prototype,C,{__proto__:null,value:W,enumerable:!1,configurable:!0,writable:!0})}B.Writable=mZ(),B.Duplex=Dc(),B.Transform=yMt(),B.PassThrough=wMt(),B.pipeline=S;let{addAbortSignal:P}=wx();return B.addAbortSignal=P,B.finished=x,B.destroy=_,B.compose=M,B.setDefaultHighWaterMark=y,B.getDefaultHighWaterMark=w,e(B,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return A}}),e(S,i,{__proto__:null,enumerable:!0,get(){return A.pipeline}}),e(x,i,{__proto__:null,enumerable:!0,get(){return A.finished}}),B.Stream=B,B._isUint8Array=function(K){return K instanceof Uint8Array},B._uint8ArrayToBuffer=function(K){return r.from(K.buffer,K.byteOffset,K.byteLength)},cZ}var co={},vMt=!1;function Gse(){if(vMt)return co;vMt=!0;let r=SMt(),e=_Mt(),a=r.Readable.destroy;return co=r.Readable,co._uint8ArrayToBuffer=r._uint8ArrayToBuffer,co._isUint8Array=r._isUint8Array,co.isDisturbed=r.isDisturbed,co.isErrored=r.isErrored,co.isReadable=r.isReadable,co.Readable=r.Readable,co.Writable=r.Writable,co.Duplex=r.Duplex,co.Transform=r.Transform,co.PassThrough=r.PassThrough,co.addAbortSignal=r.addAbortSignal,co.finished=r.finished,co.destroy=r.destroy,co.destroy=a,co.pipeline=r.pipeline,co.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get(){return e}}),co.Stream=r.Stream,co.default=co,co}var Sa=Gse();Sa._uint8ArrayToBuffer;Sa._isUint8Array;Sa.isDisturbed;Sa.isErrored;Sa.isReadable;Sa.Readable;Sa.Writable;Sa.Duplex;Sa.Transform;Sa.PassThrough;Sa.addAbortSignal;Sa.finished;Sa.destroy;Sa.pipeline;Sa.compose;Sa.Stream;var bMt=Sa.Readable;bMt.wrap=function(r,e){return e=Object.assign({objectMode:r.readableObjectMode!=null||r.objectMode!=null||!0},e),e.destroy=function(a,l){r.destroy(a),l(a)},new bMt(e).wrap(r)};var dDe=Sa.Writable,cDe=Sa.Duplex,xMt=Sa.Transform,EMt=Sa.PassThrough,pDe=Sa.finished,mDe=Sa.pipeline,vDe=Sa.Stream,bDe={finished:ZS(Sa.finished),pipeline:ZS(Sa.pipeline)};var Iv=An(Wh(),1);rd();async function AMt(r){let e=RMt(r),a=(await e.next()).value;a=await pf(e,a,32);let l=lo(a.subarray(0,32));a=a.subarray(32);let i=64*l;a=await pf(e,a,i);let c=new Array(l);for(let M=0;M<i;M+=64)c[M/64]=[lo(a.subarray(M,M+32)),(0,Iv.default)(Ft.from(a.subarray(M+32,M+64)))];a=a.subarray(i);let b=32+i,g=[];for(let[M,y]of c){a=await pf(e,a,px),a=await pf(e,a,2);let w=lo(a.subarray(0,2));a=a.subarray(2);let{sigLength:S,pubLength:_,sigName:x}=Zi[w];a=await pf(e,a,S);let A=a.subarray(0,S);a=a.subarray(S),a=await pf(e,a,_);let I=a.subarray(0,_);a=a.subarray(_),a=await pf(e,a,1);let B=a[0]===1;B&&(a=await pf(e,a,33));let P=B?a.subarray(1,33):Ft.allocUnsafe(0);a=a.subarray(B?33:1),a=await pf(e,a,1);let O=a[0]===1;O&&(a=await pf(e,a,33));let C=O?a.subarray(1,33):Ft.allocUnsafe(0);a=a.subarray(O?33:1),a=await pf(e,a,8);let K=lo(a.subarray(0,8));a=a.subarray(8),a=await pf(e,a,8);let W=lo(a.subarray(0,8));a=a.subarray(8),a=await pf(e,a,W);let J=a.subarray(0,W),U=K!==0&&W!==0?yg(Ft.from(J)):[];if(U.length!==K)throw new Error("Tags lengths don't match");a=a.subarray(W);let q=new xMt;q._transform=function(s,u,d){this.push(s),d()};let V=bp([(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(w.toString()),I,P,C,J,q]),h=2+S+_+(B?33:1)+(O?33:1)+16+W,t=M-h;if(a.byteLength>t)q.write(a.subarray(0,t)),a=a.subarray(t);else{let s=a.byteLength;for(q.write(a);t>s;){if(a=(await e.next()).value,!a)throw new Error(`Not enough data bytes expected: ${t} received: ${s}`);s+=a.byteLength,s>t?q.write(a.subarray(0,a.byteLength-(s-t))):q.write(a)}a=a.subarray(a.byteLength-(s-t))}if(q.end(),y!==(0,Iv.default)(Zu("sha256").update(A).digest()))throw new Error("ID doesn't match signature");if(!await p4[w].verify(I,await V,A))throw new Error("Invalid signature");g.push({id:y,sigName:x,signature:(0,Iv.default)(Ft.from(A)),target:(0,Iv.default)(Ft.from(P)),anchor:(0,Iv.default)(Ft.from(C)),owner:(0,Iv.default)(Ft.from(I)),tags:U,dataOffset:b+h,dataSize:t}),b+=h+t}return g}async function Vse(r,e,a,l){let i=y4("",a,l),c=new EMt,b=[(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,r],g=await bp(b),M=Ft.from(await a.sign(g));return i.setSignature(M),c.write(i.getRaw()),e.pipe(c)}async function pf(r,e,a){if(e.byteLength>=a)return e;let{done:l,value:i}=await r.next();if(l&&!i)throw new Error("Invalid buffer");return pf(r,Ft.concat([Ft.from(e),Ft.from(i)]),a)}async function*RMt(r){for await(let e of r)yield e}var Yse=AMt,Jse={readBytes:pf,getReader:RMt};var Xse={...GK,stream:bZ};globalThis.arbundles??=Xse;Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var ln;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function a(i){throw new Error}r.assertNever=a,r.arrayToEnum=i=>{let c={};for(let b of i)c[b]=b;return c},r.getValidEnumValues=i=>{let c=r.objectKeys(i).filter(g=>typeof i[i[g]]!="number"),b={};for(let g of c)b[g]=i[g];return r.objectValues(b)},r.objectValues=i=>r.objectKeys(i).map(function(c){return i[c]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let c=[];for(let b in i)Object.prototype.hasOwnProperty.call(i,b)&&c.push(b);return c},r.find=(i,c)=>{for(let b of i)if(c(b))return b},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function l(i,c=" | "){return i.map(b=>typeof b=="string"?`'${b}'`:b).join(c)}r.joinValues=l,r.jsonStringifyReplacer=(i,c)=>typeof c=="bigint"?c.toString():c})(ln||(ln={}));var yZ;(function(r){r.mergeShapes=(e,a)=>({...e,...a})})(yZ||(yZ={}));var Er=ln.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Uc=r=>{switch(typeof r){case"undefined":return Er.undefined;case"string":return Er.string;case"number":return isNaN(r)?Er.nan:Er.number;case"boolean":return Er.boolean;case"function":return Er.function;case"bigint":return Er.bigint;case"symbol":return Er.symbol;case"object":return Array.isArray(r)?Er.array:r===null?Er.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Er.promise:typeof Map<"u"&&r instanceof Map?Er.map:typeof Set<"u"&&r instanceof Set?Er.set:typeof Date<"u"&&r instanceof Date?Er.date:Er.object;default:return Er.unknown}},sr=ln.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Qse=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),Rh=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){let a=e||function(c){return c.message},l={_errors:[]},i=c=>{for(let b of c.issues)if(b.code==="invalid_union")b.unionErrors.map(i);else if(b.code==="invalid_return_type")i(b.returnTypeError);else if(b.code==="invalid_arguments")i(b.argumentsError);else if(b.path.length===0)l._errors.push(a(b));else{let g=l,M=0;for(;M<b.path.length;){let y=b.path[M];M===b.path.length-1?(g[y]=g[y]||{_errors:[]},g[y]._errors.push(a(b))):g[y]=g[y]||{_errors:[]},g=g[y],M++}}};return i(this),l}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ln.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){let a={},l=[];for(let i of this.issues)i.path.length>0?(a[i.path[0]]=a[i.path[0]]||[],a[i.path[0]].push(e(i))):l.push(e(i));return{formErrors:l,fieldErrors:a}}get formErrors(){return this.flatten()}};Rh.create=r=>new Rh(r);var Eg=(r,e)=>{let a;switch(r.code){case sr.invalid_type:r.received===Er.undefined?a="Required":a=`Expected ${r.expected}, received ${r.received}`;break;case sr.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(r.expected,ln.jsonStringifyReplacer)}`;break;case sr.unrecognized_keys:a=`Unrecognized key(s) in object: ${ln.joinValues(r.keys,", ")}`;break;case sr.invalid_union:a="Invalid input";break;case sr.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ln.joinValues(r.options)}`;break;case sr.invalid_enum_value:a=`Invalid enum value. Expected ${ln.joinValues(r.options)}, received '${r.received}'`;break;case sr.invalid_arguments:a="Invalid function arguments";break;case sr.invalid_return_type:a="Invalid function return type";break;case sr.invalid_date:a="Invalid date";break;case sr.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(a=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?a=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?a=`Invalid input: must end with "${r.validation.endsWith}"`:ln.assertNever(r.validation):r.validation!=="regex"?a=`Invalid ${r.validation}`:a="Invalid";break;case sr.too_small:r.type==="array"?a=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?a=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?a=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?a=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:a="Invalid input";break;case sr.too_big:r.type==="array"?a=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?a=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?a=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?a=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?a=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:a="Invalid input";break;case sr.custom:a="Invalid input";break;case sr.invalid_intersection_types:a="Intersection results could not be merged";break;case sr.not_multiple_of:a=`Number must be a multiple of ${r.multipleOf}`;break;case sr.not_finite:a="Number must be finite";break;default:a=e.defaultError,ln.assertNever(r)}return{message:a}},BMt=Eg;function tfe(r){BMt=r}function Sx(){return BMt}var xx=r=>{let{data:e,path:a,errorMaps:l,issueData:i}=r,c=[...a,...i.path||[]],b={...i,path:c};if(i.message!==void 0)return{...i,path:c,message:i.message};let g="",M=l.filter(y=>!!y).slice().reverse();for(let y of M)g=y(b,{data:e,defaultError:g}).message;return{...i,path:c,message:g}},efe=[];function _r(r,e){let a=Sx(),l=xx({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a,a===Eg?void 0:Eg].filter(i=>!!i)});r.common.issues.push(l)}var tf=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){let l=[];for(let i of a){if(i.status==="aborted")return Kr;i.status==="dirty"&&e.dirty(),l.push(i.value)}return{status:e.value,value:l}}static async mergeObjectAsync(e,a){let l=[];for(let i of a){let c=await i.key,b=await i.value;l.push({key:c,value:b})}return r.mergeObjectSync(e,l)}static mergeObjectSync(e,a){let l={};for(let i of a){let{key:c,value:b}=i;if(c.status==="aborted"||b.status==="aborted")return Kr;c.status==="dirty"&&e.dirty(),b.status==="dirty"&&e.dirty(),c.value!=="__proto__"&&(typeof b.value<"u"||i.alwaysSet)&&(l[c.value]=b.value)}return{status:e.value,value:l}}},Kr=Object.freeze({status:"aborted"}),xg=r=>({status:"dirty",value:r}),mf=r=>({status:"valid",value:r}),wZ=r=>r.status==="aborted",MZ=r=>r.status==="dirty",kv=r=>r.status==="valid",A4=r=>typeof Promise<"u"&&r instanceof Promise;function Ex(r,e,a,l){if(a==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!l:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?l:a==="a"?l.call(r):l?l.value:e.get(r)}function PMt(r,e,a,l,i){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?i.call(r,a):i?i.value=a:e.set(r,a),a}var kr;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(kr||(kr={}));var x4,E4,K0=class{constructor(e,a,l,i){this._cachedPath=[],this.parent=e,this.data=a,this._path=l,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},IMt=(r,e)=>{if(kv(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let a=new Rh(r.common.issues);return this._error=a,this._error}}};function gi(r){if(!r)return{};let{errorMap:e,invalid_type_error:a,required_error:l,description:i}=r;if(e&&(a||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(b,g)=>{var M,y;let{message:w}=r;return b.code==="invalid_enum_value"?{message:w??g.defaultError}:typeof g.data>"u"?{message:(M=w??l)!==null&&M!==void 0?M:g.defaultError}:b.code!=="invalid_type"?{message:g.defaultError}:{message:(y=w??a)!==null&&y!==void 0?y:g.defaultError}},description:i}}var yi=class{get description(){return this._def.description}_getType(e){return Uc(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:Uc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tf,ctx:{common:e.parent.common,data:e.data,parsedType:Uc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let a=this._parse(e);if(A4(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){let a=this._parse(e);return Promise.resolve(a)}parse(e,a){let l=this.safeParse(e,a);if(l.success)return l.data;throw l.error}safeParse(e,a){var l;let i={common:{issues:[],async:(l=a?.async)!==null&&l!==void 0?l:!1,contextualErrorMap:a?.errorMap},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Uc(e)},c=this._parseSync({data:e,path:i.path,parent:i});return IMt(i,c)}"~validate"(e){var a,l;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Uc(e)};if(!this["~standard"].async)try{let c=this._parseSync({data:e,path:[],parent:i});return kv(c)?{value:c.value}:{issues:i.common.issues}}catch(c){!((l=(a=c?.message)===null||a===void 0?void 0:a.toLowerCase())===null||l===void 0)&&l.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(c=>kv(c)?{value:c.value}:{issues:i.common.issues})}async parseAsync(e,a){let l=await this.safeParseAsync(e,a);if(l.success)return l.data;throw l.error}async safeParseAsync(e,a){let l={common:{issues:[],contextualErrorMap:a?.errorMap,async:!0},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Uc(e)},i=this._parse({data:e,path:l.path,parent:l}),c=await(A4(i)?i:Promise.resolve(i));return IMt(l,c)}refine(e,a){let l=i=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(i):a;return this._refinement((i,c)=>{let b=e(i),g=()=>c.addIssue({code:sr.custom,...l(i)});return typeof Promise<"u"&&b instanceof Promise?b.then(M=>M?!0:(g(),!1)):b?!0:(g(),!1)})}refinement(e,a){return this._refinement((l,i)=>e(l)?!0:(i.addIssue(typeof a=="function"?a(l,i):a),!1))}_refinement(e){return new Ih({schema:this,typeName:Ur.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return H0.create(this,this._def)}nullable(){return Ed.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zc.create(this)}promise(){return Hp.create(this,this._def)}or(e){return Lv.create([this,e],this._def)}and(e){return Dv.create(this,e,this._def)}transform(e){return new Ih({...gi(this._def),schema:this,typeName:Ur.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let a=typeof e=="function"?e:()=>e;return new zv({...gi(this._def),innerType:this,defaultValue:a,typeName:Ur.ZodDefault})}brand(){return new R4({typeName:Ur.ZodBranded,type:this,...gi(this._def)})}catch(e){let a=typeof e=="function"?e:()=>e;return new Fv({...gi(this._def),innerType:this,catchValue:a,typeName:Ur.ZodCatch})}describe(e){let a=this.constructor;return new a({...this._def,description:e})}pipe(e){return I4.create(this,e)}readonly(){return Hv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},rfe=/^c[^\s-]{8,}$/i,ife=/^[0-9a-z]+$/,nfe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,afe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ofe=/^[a-z0-9_-]{21}$/i,sfe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ffe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,hfe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ufe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gZ,lfe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dfe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cfe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,pfe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mfe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vfe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,NMt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",bfe=new RegExp(`^${NMt}$`);function OMt(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function gfe(r){return new RegExp(`^${OMt(r)}$`)}function CMt(r){let e=`${NMt}T${OMt(r)}`,a=[];return a.push(r.local?"Z?":"Z"),r.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function yfe(r,e){return!!((e==="v4"||!e)&&lfe.test(r)||(e==="v6"||!e)&&cfe.test(r))}function wfe(r,e){if(!sfe.test(r))return!1;try{let[a]=r.split("."),l=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),i=JSON.parse(atob(l));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function Mfe(r,e){return!!((e==="v4"||!e)&&dfe.test(r)||(e==="v6"||!e)&&pfe.test(r))}var zp=class r extends yi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Er.string){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_type,expected:Er.string,received:c.parsedType}),Kr}let l=new tf,i;for(let c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),l.dirty());else if(c.kind==="max")e.data.length>c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),l.dirty());else if(c.kind==="length"){let b=e.data.length>c.value,g=e.data.length<c.value;(b||g)&&(i=this._getOrReturnCtx(e,i),b?_r(i,{code:sr.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):g&&_r(i,{code:sr.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),l.dirty())}else if(c.kind==="email")hfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"email",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="emoji")gZ||(gZ=new RegExp(ufe,"u")),gZ.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"emoji",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="uuid")afe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"uuid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="nanoid")ofe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"nanoid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="cuid")rfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"cuid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="cuid2")ife.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"cuid2",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="ulid")nfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"ulid",code:sr.invalid_string,message:c.message}),l.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),_r(i,{validation:"url",code:sr.invalid_string,message:c.message}),l.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"regex",code:sr.invalid_string,message:c.message}),l.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="includes"?e.data.includes(c.value,c.position)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),l.dirty()):c.kind==="toLowerCase"?e.data=e.data.toLowerCase():c.kind==="toUpperCase"?e.data=e.data.toUpperCase():c.kind==="startsWith"?e.data.startsWith(c.value)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:{startsWith:c.value},message:c.message}),l.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:{endsWith:c.value},message:c.message}),l.dirty()):c.kind==="datetime"?CMt(c).test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"datetime",message:c.message}),l.dirty()):c.kind==="date"?bfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"date",message:c.message}),l.dirty()):c.kind==="time"?gfe(c).test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"time",message:c.message}),l.dirty()):c.kind==="duration"?ffe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"duration",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="ip"?yfe(e.data,c.version)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"ip",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="jwt"?wfe(e.data,c.alg)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"jwt",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="cidr"?Mfe(e.data,c.version)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"cidr",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="base64"?mfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"base64",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="base64url"?vfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"base64url",code:sr.invalid_string,message:c.message}),l.dirty()):ln.assertNever(c);return{status:l.value,value:e.data}}_regex(e,a,l){return this.refinement(i=>e.test(i),{validation:a,code:sr.invalid_string,...kr.errToObj(l)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...kr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...kr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...kr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...kr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...kr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...kr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...kr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...kr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...kr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...kr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...kr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...kr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...kr.errToObj(e)})}datetime(e){var a,l;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(a=e?.offset)!==null&&a!==void 0?a:!1,local:(l=e?.local)!==null&&l!==void 0?l:!1,...kr.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...kr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...kr.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...kr.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a?.position,...kr.errToObj(a?.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...kr.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...kr.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...kr.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...kr.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...kr.errToObj(a)})}nonempty(e){return this.min(1,kr.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};zp.create=r=>{var e;return new zp({checks:[],typeName:Ur.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...gi(r)})};function _fe(r,e){let a=(r.toString().split(".")[1]||"").length,l=(e.toString().split(".")[1]||"").length,i=a>l?a:l,c=parseInt(r.toFixed(i).replace(".","")),b=parseInt(e.toFixed(i).replace(".",""));return c%b/Math.pow(10,i)}var Tv=class r extends yi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Er.number){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_type,expected:Er.number,received:c.parsedType}),Kr}let l,i=new tf;for(let c of this._def.checks)c.kind==="int"?ln.isInteger(e.data)||(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.invalid_type,expected:"integer",received:"float",message:c.message}),i.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),i.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),i.dirty()):c.kind==="multipleOf"?_fe(e.data,c.value)!==0&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.not_multiple_of,multipleOf:c.value,message:c.message}),i.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.not_finite,message:c.message}),i.dirty()):ln.assertNever(c);return{status:i.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,kr.toString(a))}gt(e,a){return this.setLimit("min",e,!1,kr.toString(a))}lte(e,a){return this.setLimit("max",e,!0,kr.toString(a))}lt(e,a){return this.setLimit("max",e,!1,kr.toString(a))}setLimit(e,a,l,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:l,message:kr.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:kr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kr.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:kr.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:kr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kr.toString(e)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ln.isInteger(e.value))}get isFinite(){let e=null,a=null;for(let l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(a===null||l.value>a)&&(a=l.value):l.kind==="max"&&(e===null||l.value<e)&&(e=l.value)}return Number.isFinite(a)&&Number.isFinite(e)}};Tv.create=r=>new Tv({checks:[],typeName:Ur.ZodNumber,coerce:r?.coerce||!1,...gi(r)});var Bv=class r extends yi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Er.bigint)return this._getInvalidInput(e);let l,i=new tf;for(let c of this._def.checks)c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),i.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),i.dirty()):c.kind==="multipleOf"?e.data%c.value!==BigInt(0)&&(l=this._getOrReturnCtx(e,l),_r(l,{code:sr.not_multiple_of,multipleOf:c.value,message:c.message}),i.dirty()):ln.assertNever(c);return{status:i.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return _r(a,{code:sr.invalid_type,expected:Er.bigint,received:a.parsedType}),Kr}gte(e,a){return this.setLimit("min",e,!0,kr.toString(a))}gt(e,a){return this.setLimit("min",e,!1,kr.toString(a))}lte(e,a){return this.setLimit("max",e,!0,kr.toString(a))}lt(e,a){return this.setLimit("max",e,!1,kr.toString(a))}setLimit(e,a,l,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:l,message:kr.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:kr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kr.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:kr.toString(a)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};Bv.create=r=>{var e;return new Bv({checks:[],typeName:Ur.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...gi(r)})};var Pv=class extends yi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Er.boolean){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.boolean,received:l.parsedType}),Kr}return mf(e.data)}};Pv.create=r=>new Pv({typeName:Ur.ZodBoolean,coerce:r?.coerce||!1,...gi(r)});var Nv=class r extends yi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Er.date){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_type,expected:Er.date,received:c.parsedType}),Kr}if(isNaN(e.data.getTime())){let c=this._getOrReturnCtx(e);return _r(c,{code:sr.invalid_date}),Kr}let l=new tf,i;for(let c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),l.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),l.dirty()):ln.assertNever(c);return{status:l.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:kr.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:kr.toString(a)})}get minDate(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}};Nv.create=r=>new Nv({checks:[],coerce:r?.coerce||!1,typeName:Ur.ZodDate,...gi(r)});var Ag=class extends yi{_parse(e){if(this._getType(e)!==Er.symbol){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.symbol,received:l.parsedType}),Kr}return mf(e.data)}};Ag.create=r=>new Ag({typeName:Ur.ZodSymbol,...gi(r)});var Ov=class extends yi{_parse(e){if(this._getType(e)!==Er.undefined){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.undefined,received:l.parsedType}),Kr}return mf(e.data)}};Ov.create=r=>new Ov({typeName:Ur.ZodUndefined,...gi(r)});var Cv=class extends yi{_parse(e){if(this._getType(e)!==Er.null){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.null,received:l.parsedType}),Kr}return mf(e.data)}};Cv.create=r=>new Cv({typeName:Ur.ZodNull,...gi(r)});var Fp=class extends yi{constructor(){super(...arguments),this._any=!0}_parse(e){return mf(e.data)}};Fp.create=r=>new Fp({typeName:Ur.ZodAny,...gi(r)});var jc=class extends yi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return mf(e.data)}};jc.create=r=>new jc({typeName:Ur.ZodUnknown,...gi(r)});var fl=class extends yi{_parse(e){let a=this._getOrReturnCtx(e);return _r(a,{code:sr.invalid_type,expected:Er.never,received:a.parsedType}),Kr}};fl.create=r=>new fl({typeName:Ur.ZodNever,...gi(r)});var Rg=class extends yi{_parse(e){if(this._getType(e)!==Er.undefined){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.void,received:l.parsedType}),Kr}return mf(e.data)}};Rg.create=r=>new Rg({typeName:Ur.ZodVoid,...gi(r)});var zc=class r extends yi{_parse(e){let{ctx:a,status:l}=this._processInputParams(e),i=this._def;if(a.parsedType!==Er.array)return _r(a,{code:sr.invalid_type,expected:Er.array,received:a.parsedType}),Kr;if(i.exactLength!==null){let b=a.data.length>i.exactLength.value,g=a.data.length<i.exactLength.value;(b||g)&&(_r(a,{code:b?sr.too_big:sr.too_small,minimum:g?i.exactLength.value:void 0,maximum:b?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),l.dirty())}if(i.minLength!==null&&a.data.length<i.minLength.value&&(_r(a,{code:sr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),l.dirty()),i.maxLength!==null&&a.data.length>i.maxLength.value&&(_r(a,{code:sr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),l.dirty()),a.common.async)return Promise.all([...a.data].map((b,g)=>i.type._parseAsync(new K0(a,b,a.path,g)))).then(b=>tf.mergeArray(l,b));let c=[...a.data].map((b,g)=>i.type._parseSync(new K0(a,b,a.path,g)));return tf.mergeArray(l,c)}get element(){return this._def.type}min(e,a){return new r({...this._def,minLength:{value:e,message:kr.toString(a)}})}max(e,a){return new r({...this._def,maxLength:{value:e,message:kr.toString(a)}})}length(e,a){return new r({...this._def,exactLength:{value:e,message:kr.toString(a)}})}nonempty(e){return this.min(1,e)}};zc.create=(r,e)=>new zc({type:r,minLength:null,maxLength:null,exactLength:null,typeName:Ur.ZodArray,...gi(e)});function Sg(r){if(r instanceof qf){let e={};for(let a in r.shape){let l=r.shape[a];e[a]=H0.create(Sg(l))}return new qf({...r._def,shape:()=>e})}else return r instanceof zc?new zc({...r._def,type:Sg(r.element)}):r instanceof H0?H0.create(Sg(r.unwrap())):r instanceof Ed?Ed.create(Sg(r.unwrap())):r instanceof xd?xd.create(r.items.map(e=>Sg(e))):r}var qf=class r extends yi{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),a=ln.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==Er.object){let y=this._getOrReturnCtx(e);return _r(y,{code:sr.invalid_type,expected:Er.object,received:y.parsedType}),Kr}let{status:l,ctx:i}=this._processInputParams(e),{shape:c,keys:b}=this._getCached(),g=[];if(!(this._def.catchall instanceof fl&&this._def.unknownKeys==="strip"))for(let y in i.data)b.includes(y)||g.push(y);let M=[];for(let y of b){let w=c[y],S=i.data[y];M.push({key:{status:"valid",value:y},value:w._parse(new K0(i,S,i.path,y)),alwaysSet:y in i.data})}if(this._def.catchall instanceof fl){let y=this._def.unknownKeys;if(y==="passthrough")for(let w of g)M.push({key:{status:"valid",value:w},value:{status:"valid",value:i.data[w]}});else if(y==="strict")g.length>0&&(_r(i,{code:sr.unrecognized_keys,keys:g}),l.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let y=this._def.catchall;for(let w of g){let S=i.data[w];M.push({key:{status:"valid",value:w},value:y._parse(new K0(i,S,i.path,w)),alwaysSet:w in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let y=[];for(let w of M){let S=await w.key,_=await w.value;y.push({key:S,value:_,alwaysSet:w.alwaysSet})}return y}).then(y=>tf.mergeObjectSync(l,y)):tf.mergeObjectSync(l,M)}get shape(){return this._def.shape()}strict(e){return kr.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,l)=>{var i,c,b,g;let M=(b=(c=(i=this._def).errorMap)===null||c===void 0?void 0:c.call(i,a,l).message)!==null&&b!==void 0?b:l.defaultError;return a.code==="unrecognized_keys"?{message:(g=kr.errToObj(e).message)!==null&&g!==void 0?g:M}:{message:M}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ur.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let a={};return ln.objectKeys(e).forEach(l=>{e[l]&&this.shape[l]&&(a[l]=this.shape[l])}),new r({...this._def,shape:()=>a})}omit(e){let a={};return ln.objectKeys(this.shape).forEach(l=>{e[l]||(a[l]=this.shape[l])}),new r({...this._def,shape:()=>a})}deepPartial(){return Sg(this)}partial(e){let a={};return ln.objectKeys(this.shape).forEach(l=>{let i=this.shape[l];e&&!e[l]?a[l]=i:a[l]=i.optional()}),new r({...this._def,shape:()=>a})}required(e){let a={};return ln.objectKeys(this.shape).forEach(l=>{if(e&&!e[l])a[l]=this.shape[l];else{let c=this.shape[l];for(;c instanceof H0;)c=c._def.innerType;a[l]=c}}),new r({...this._def,shape:()=>a})}keyof(){return LMt(ln.objectKeys(this.shape))}};qf.create=(r,e)=>new qf({shape:()=>r,unknownKeys:"strip",catchall:fl.create(),typeName:Ur.ZodObject,...gi(e)});qf.strictCreate=(r,e)=>new qf({shape:()=>r,unknownKeys:"strict",catchall:fl.create(),typeName:Ur.ZodObject,...gi(e)});qf.lazycreate=(r,e)=>new qf({shape:r,unknownKeys:"strip",catchall:fl.create(),typeName:Ur.ZodObject,...gi(e)});var Lv=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l=this._def.options;function i(c){for(let g of c)if(g.result.status==="valid")return g.result;for(let g of c)if(g.result.status==="dirty")return a.common.issues.push(...g.ctx.common.issues),g.result;let b=c.map(g=>new Rh(g.ctx.common.issues));return _r(a,{code:sr.invalid_union,unionErrors:b}),Kr}if(a.common.async)return Promise.all(l.map(async c=>{let b={...a,common:{...a.common,issues:[]},parent:null};return{result:await c._parseAsync({data:a.data,path:a.path,parent:b}),ctx:b}})).then(i);{let c,b=[];for(let M of l){let y={...a,common:{...a.common,issues:[]},parent:null},w=M._parseSync({data:a.data,path:a.path,parent:y});if(w.status==="valid")return w;w.status==="dirty"&&!c&&(c={result:w,ctx:y}),y.common.issues.length&&b.push(y.common.issues)}if(c)return a.common.issues.push(...c.ctx.common.issues),c.result;let g=b.map(M=>new Rh(M));return _r(a,{code:sr.invalid_union,unionErrors:g}),Kr}}get options(){return this._def.options}};Lv.create=(r,e)=>new Lv({options:r,typeName:Ur.ZodUnion,...gi(e)});var qc=r=>r instanceof $v?qc(r.schema):r instanceof Ih?qc(r.innerType()):r instanceof qv?[r.value]:r instanceof Uv?r.options:r instanceof jv?ln.objectValues(r.enum):r instanceof zv?qc(r._def.innerType):r instanceof Ov?[void 0]:r instanceof Cv?[null]:r instanceof H0?[void 0,...qc(r.unwrap())]:r instanceof Ed?[null,...qc(r.unwrap())]:r instanceof R4||r instanceof Hv?qc(r.unwrap()):r instanceof Fv?qc(r._def.innerType):[],Ax=class r extends yi{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==Er.object)return _r(a,{code:sr.invalid_type,expected:Er.object,received:a.parsedType}),Kr;let l=this.discriminator,i=a.data[l],c=this.optionsMap.get(i);return c?a.common.async?c._parseAsync({data:a.data,path:a.path,parent:a}):c._parseSync({data:a.data,path:a.path,parent:a}):(_r(a,{code:sr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),Kr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,l){let i=new Map;for(let c of a){let b=qc(c.shape[e]);if(!b.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let g of b){if(i.has(g))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(g)}`);i.set(g,c)}}return new r({typeName:Ur.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:i,...gi(l)})}};function _Z(r,e){let a=Uc(r),l=Uc(e);if(r===e)return{valid:!0,data:r};if(a===Er.object&&l===Er.object){let i=ln.objectKeys(e),c=ln.objectKeys(r).filter(g=>i.indexOf(g)!==-1),b={...r,...e};for(let g of c){let M=_Z(r[g],e[g]);if(!M.valid)return{valid:!1};b[g]=M.data}return{valid:!0,data:b}}else if(a===Er.array&&l===Er.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let c=0;c<r.length;c++){let b=r[c],g=e[c],M=_Z(b,g);if(!M.valid)return{valid:!1};i.push(M.data)}return{valid:!0,data:i}}else return a===Er.date&&l===Er.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Dv=class extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e),i=(c,b)=>{if(wZ(c)||wZ(b))return Kr;let g=_Z(c.value,b.value);return g.valid?((MZ(c)||MZ(b))&&a.dirty(),{status:a.value,value:g.data}):(_r(l,{code:sr.invalid_intersection_types}),Kr)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([c,b])=>i(c,b)):i(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}};Dv.create=(r,e,a)=>new Dv({left:r,right:e,typeName:Ur.ZodIntersection,...gi(a)});var xd=class r extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.array)return _r(l,{code:sr.invalid_type,expected:Er.array,received:l.parsedType}),Kr;if(l.data.length<this._def.items.length)return _r(l,{code:sr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Kr;!this._def.rest&&l.data.length>this._def.items.length&&(_r(l,{code:sr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());let c=[...l.data].map((b,g)=>{let M=this._def.items[g]||this._def.rest;return M?M._parse(new K0(l,b,l.path,g)):null}).filter(b=>!!b);return l.common.async?Promise.all(c).then(b=>tf.mergeArray(a,b)):tf.mergeArray(a,c)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};xd.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xd({items:r,typeName:Ur.ZodTuple,rest:null,...gi(e)})};var Rx=class r extends yi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.object)return _r(l,{code:sr.invalid_type,expected:Er.object,received:l.parsedType}),Kr;let i=[],c=this._def.keyType,b=this._def.valueType;for(let g in l.data)i.push({key:c._parse(new K0(l,g,l.path,g)),value:b._parse(new K0(l,l.data[g],l.path,g)),alwaysSet:g in l.data});return l.common.async?tf.mergeObjectAsync(a,i):tf.mergeObjectSync(a,i)}get element(){return this._def.valueType}static create(e,a,l){return a instanceof yi?new r({keyType:e,valueType:a,typeName:Ur.ZodRecord,...gi(l)}):new r({keyType:zp.create(),valueType:e,typeName:Ur.ZodRecord,...gi(a)})}},Ig=class extends yi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.map)return _r(l,{code:sr.invalid_type,expected:Er.map,received:l.parsedType}),Kr;let i=this._def.keyType,c=this._def.valueType,b=[...l.data.entries()].map(([g,M],y)=>({key:i._parse(new K0(l,g,l.path,[y,"key"])),value:c._parse(new K0(l,M,l.path,[y,"value"]))}));if(l.common.async){let g=new Map;return Promise.resolve().then(async()=>{for(let M of b){let y=await M.key,w=await M.value;if(y.status==="aborted"||w.status==="aborted")return Kr;(y.status==="dirty"||w.status==="dirty")&&a.dirty(),g.set(y.value,w.value)}return{status:a.value,value:g}})}else{let g=new Map;for(let M of b){let y=M.key,w=M.value;if(y.status==="aborted"||w.status==="aborted")return Kr;(y.status==="dirty"||w.status==="dirty")&&a.dirty(),g.set(y.value,w.value)}return{status:a.value,value:g}}}};Ig.create=(r,e,a)=>new Ig({valueType:e,keyType:r,typeName:Ur.ZodMap,...gi(a)});var kg=class r extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.parsedType!==Er.set)return _r(l,{code:sr.invalid_type,expected:Er.set,received:l.parsedType}),Kr;let i=this._def;i.minSize!==null&&l.data.size<i.minSize.value&&(_r(l,{code:sr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),a.dirty()),i.maxSize!==null&&l.data.size>i.maxSize.value&&(_r(l,{code:sr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),a.dirty());let c=this._def.valueType;function b(M){let y=new Set;for(let w of M){if(w.status==="aborted")return Kr;w.status==="dirty"&&a.dirty(),y.add(w.value)}return{status:a.value,value:y}}let g=[...l.data.values()].map((M,y)=>c._parse(new K0(l,M,l.path,y)));return l.common.async?Promise.all(g).then(M=>b(M)):b(g)}min(e,a){return new r({...this._def,minSize:{value:e,message:kr.toString(a)}})}max(e,a){return new r({...this._def,maxSize:{value:e,message:kr.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};kg.create=(r,e)=>new kg({valueType:r,minSize:null,maxSize:null,typeName:Ur.ZodSet,...gi(e)});var Ix=class r extends yi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==Er.function)return _r(a,{code:sr.invalid_type,expected:Er.function,received:a.parsedType}),Kr;function l(g,M){return xx({data:g,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Sx(),Eg].filter(y=>!!y),issueData:{code:sr.invalid_arguments,argumentsError:M}})}function i(g,M){return xx({data:g,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Sx(),Eg].filter(y=>!!y),issueData:{code:sr.invalid_return_type,returnTypeError:M}})}let c={errorMap:a.common.contextualErrorMap},b=a.data;if(this._def.returns instanceof Hp){let g=this;return mf(async function(...M){let y=new Rh([]),w=await g._def.args.parseAsync(M,c).catch(x=>{throw y.addIssue(l(M,x)),y}),S=await Reflect.apply(b,this,w);return await g._def.returns._def.type.parseAsync(S,c).catch(x=>{throw y.addIssue(i(S,x)),y})})}else{let g=this;return mf(function(...M){let y=g._def.args.safeParse(M,c);if(!y.success)throw new Rh([l(M,y.error)]);let w=Reflect.apply(b,this,y.data),S=g._def.returns.safeParse(w,c);if(!S.success)throw new Rh([i(w,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:xd.create(e).rest(jc.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,l){return new r({args:e||xd.create([]).rest(jc.create()),returns:a||jc.create(),typeName:Ur.ZodFunction,...gi(l)})}},$v=class extends yi{get schema(){return this._def.getter()}_parse(e){let{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}};$v.create=(r,e)=>new $v({getter:r,typeName:Ur.ZodLazy,...gi(e)});var qv=class extends yi{_parse(e){if(e.data!==this._def.value){let a=this._getOrReturnCtx(e);return _r(a,{received:a.data,code:sr.invalid_literal,expected:this._def.value}),Kr}return{status:"valid",value:e.data}}get value(){return this._def.value}};qv.create=(r,e)=>new qv({value:r,typeName:Ur.ZodLiteral,...gi(e)});function LMt(r,e){return new Uv({values:r,typeName:Ur.ZodEnum,...gi(e)})}var Uv=class r extends yi{constructor(){super(...arguments),x4.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),l=this._def.values;return _r(a,{expected:ln.joinValues(l),received:a.parsedType,code:sr.invalid_type}),Kr}if(Ex(this,x4,"f")||PMt(this,x4,new Set(this._def.values),"f"),!Ex(this,x4,"f").has(e.data)){let a=this._getOrReturnCtx(e),l=this._def.values;return _r(a,{received:a.data,code:sr.invalid_enum_value,options:l}),Kr}return mf(e.data)}get options(){return this._def.values}get enum(){let e={};for(let a of this._def.values)e[a]=a;return e}get Values(){let e={};for(let a of this._def.values)e[a]=a;return e}get Enum(){let e={};for(let a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return r.create(e,{...this._def,...a})}exclude(e,a=this._def){return r.create(this.options.filter(l=>!e.includes(l)),{...this._def,...a})}};x4=new WeakMap;Uv.create=LMt;var jv=class extends yi{constructor(){super(...arguments),E4.set(this,void 0)}_parse(e){let a=ln.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(e);if(l.parsedType!==Er.string&&l.parsedType!==Er.number){let i=ln.objectValues(a);return _r(l,{expected:ln.joinValues(i),received:l.parsedType,code:sr.invalid_type}),Kr}if(Ex(this,E4,"f")||PMt(this,E4,new Set(ln.getValidEnumValues(this._def.values)),"f"),!Ex(this,E4,"f").has(e.data)){let i=ln.objectValues(a);return _r(l,{received:l.data,code:sr.invalid_enum_value,options:i}),Kr}return mf(e.data)}get enum(){return this._def.values}};E4=new WeakMap;jv.create=(r,e)=>new jv({values:r,typeName:Ur.ZodNativeEnum,...gi(e)});var Hp=class extends yi{unwrap(){return this._def.type}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==Er.promise&&a.common.async===!1)return _r(a,{code:sr.invalid_type,expected:Er.promise,received:a.parsedType}),Kr;let l=a.parsedType===Er.promise?a.data:Promise.resolve(a.data);return mf(l.then(i=>this._def.type.parseAsync(i,{path:a.path,errorMap:a.common.contextualErrorMap})))}};Hp.create=(r,e)=>new Hp({type:r,typeName:Ur.ZodPromise,...gi(e)});var Ih=class extends yi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ur.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:a,ctx:l}=this._processInputParams(e),i=this._def.effect||null,c={addIssue:b=>{_r(l,b),b.fatal?a.abort():a.dirty()},get path(){return l.path}};if(c.addIssue=c.addIssue.bind(c),i.type==="preprocess"){let b=i.transform(l.data,c);if(l.common.async)return Promise.resolve(b).then(async g=>{if(a.value==="aborted")return Kr;let M=await this._def.schema._parseAsync({data:g,path:l.path,parent:l});return M.status==="aborted"?Kr:M.status==="dirty"||a.value==="dirty"?xg(M.value):M});{if(a.value==="aborted")return Kr;let g=this._def.schema._parseSync({data:b,path:l.path,parent:l});return g.status==="aborted"?Kr:g.status==="dirty"||a.value==="dirty"?xg(g.value):g}}if(i.type==="refinement"){let b=g=>{let M=i.refinement(g,c);if(l.common.async)return Promise.resolve(M);if(M instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return g};if(l.common.async===!1){let g=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return g.status==="aborted"?Kr:(g.status==="dirty"&&a.dirty(),b(g.value),{status:a.value,value:g.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(g=>g.status==="aborted"?Kr:(g.status==="dirty"&&a.dirty(),b(g.value).then(()=>({status:a.value,value:g.value}))))}if(i.type==="transform")if(l.common.async===!1){let b=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!kv(b))return b;let g=i.transform(b.value,c);if(g instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:g}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(b=>kv(b)?Promise.resolve(i.transform(b.value,c)).then(g=>({status:a.value,value:g})):b);ln.assertNever(i)}};Ih.create=(r,e,a)=>new Ih({schema:r,typeName:Ur.ZodEffects,effect:e,...gi(a)});Ih.createWithPreprocess=(r,e,a)=>new Ih({schema:e,effect:{type:"preprocess",transform:r},typeName:Ur.ZodEffects,...gi(a)});var H0=class extends yi{_parse(e){return this._getType(e)===Er.undefined?mf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};H0.create=(r,e)=>new H0({innerType:r,typeName:Ur.ZodOptional,...gi(e)});var Ed=class extends yi{_parse(e){return this._getType(e)===Er.null?mf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ed.create=(r,e)=>new Ed({innerType:r,typeName:Ur.ZodNullable,...gi(e)});var zv=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l=a.data;return a.parsedType===Er.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:a.path,parent:a})}removeDefault(){return this._def.innerType}};zv.create=(r,e)=>new zv({innerType:r,typeName:Ur.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...gi(e)});var Fv=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l={...a,common:{...a.common,issues:[]}},i=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return A4(i)?i.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Rh(l.common.issues)},input:l.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Rh(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}};Fv.create=(r,e)=>new Fv({innerType:r,typeName:Ur.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...gi(e)});var Tg=class extends yi{_parse(e){if(this._getType(e)!==Er.nan){let l=this._getOrReturnCtx(e);return _r(l,{code:sr.invalid_type,expected:Er.nan,received:l.parsedType}),Kr}return{status:"valid",value:e.data}}};Tg.create=r=>new Tg({typeName:Ur.ZodNaN,...gi(r)});var Sfe=Symbol("zod_brand"),R4=class extends yi{_parse(e){let{ctx:a}=this._processInputParams(e),l=a.data;return this._def.type._parse({data:l,path:a.path,parent:a})}unwrap(){return this._def.type}},I4=class r extends yi{_parse(e){let{status:a,ctx:l}=this._processInputParams(e);if(l.common.async)return(async()=>{let c=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return c.status==="aborted"?Kr:c.status==="dirty"?(a.dirty(),xg(c.value)):this._def.out._parseAsync({data:c.value,path:l.path,parent:l})})();{let i=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return i.status==="aborted"?Kr:i.status==="dirty"?(a.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:l.path,parent:l})}}static create(e,a){return new r({in:e,out:a,typeName:Ur.ZodPipeline})}},Hv=class extends yi{_parse(e){let a=this._def.innerType._parse(e),l=i=>(kv(i)&&(i.value=Object.freeze(i.value)),i);return A4(a)?a.then(i=>l(i)):l(a)}unwrap(){return this._def.innerType}};Hv.create=(r,e)=>new Hv({innerType:r,typeName:Ur.ZodReadonly,...gi(e)});function kMt(r,e){let a=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof a=="string"?{message:a}:a}function DMt(r,e={},a){return r?Fp.create().superRefine((l,i)=>{var c,b;let g=r(l);if(g instanceof Promise)return g.then(M=>{var y,w;if(!M){let S=kMt(e,l),_=(w=(y=S.fatal)!==null&&y!==void 0?y:a)!==null&&w!==void 0?w:!0;i.addIssue({code:"custom",...S,fatal:_})}});if(!g){let M=kMt(e,l),y=(b=(c=M.fatal)!==null&&c!==void 0?c:a)!==null&&b!==void 0?b:!0;i.addIssue({code:"custom",...M,fatal:y})}}):Fp.create()}var xfe={object:qf.lazycreate},Ur;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(Ur||(Ur={}));var Efe=(r,e={message:`Input not instance of ${r.name}`})=>DMt(a=>a instanceof r,e),$Mt=zp.create,qMt=Tv.create,Afe=Tg.create,Rfe=Bv.create,UMt=Pv.create,Ife=Nv.create,kfe=Ag.create,Tfe=Ov.create,Bfe=Cv.create,Pfe=Fp.create,Nfe=jc.create,Ofe=fl.create,Cfe=Rg.create,Lfe=zc.create,Dfe=qf.create,$fe=qf.strictCreate,qfe=Lv.create,Ufe=Ax.create,jfe=Dv.create,zfe=xd.create,Ffe=Rx.create,Hfe=Ig.create,Kfe=kg.create,Zfe=Ix.create,Wfe=$v.create,Gfe=qv.create,Vfe=Uv.create,Yfe=jv.create,Jfe=Hp.create,TMt=Ih.create,Xfe=H0.create,Qfe=Ed.create,the=Ih.createWithPreprocess,ehe=I4.create,rhe=()=>$Mt().optional(),ihe=()=>qMt().optional(),nhe=()=>UMt().optional(),ahe={string:(r=>zp.create({...r,coerce:!0})),number:(r=>Tv.create({...r,coerce:!0})),boolean:(r=>Pv.create({...r,coerce:!0})),bigint:(r=>Bv.create({...r,coerce:!0})),date:(r=>Nv.create({...r,coerce:!0}))},ohe=Kr,Ir=Object.freeze({__proto__:null,defaultErrorMap:Eg,setErrorMap:tfe,getErrorMap:Sx,makeIssue:xx,EMPTY_PATH:efe,addIssueToContext:_r,ParseStatus:tf,INVALID:Kr,DIRTY:xg,OK:mf,isAborted:wZ,isDirty:MZ,isValid:kv,isAsync:A4,get util(){return ln},get objectUtil(){return yZ},ZodParsedType:Er,getParsedType:Uc,ZodType:yi,datetimeRegex:CMt,ZodString:zp,ZodNumber:Tv,ZodBigInt:Bv,ZodBoolean:Pv,ZodDate:Nv,ZodSymbol:Ag,ZodUndefined:Ov,ZodNull:Cv,ZodAny:Fp,ZodUnknown:jc,ZodNever:fl,ZodVoid:Rg,ZodArray:zc,ZodObject:qf,ZodUnion:Lv,ZodDiscriminatedUnion:Ax,ZodIntersection:Dv,ZodTuple:xd,ZodRecord:Rx,ZodMap:Ig,ZodSet:kg,ZodFunction:Ix,ZodLazy:$v,ZodLiteral:qv,ZodEnum:Uv,ZodNativeEnum:jv,ZodPromise:Hp,ZodEffects:Ih,ZodTransformer:Ih,ZodOptional:H0,ZodNullable:Ed,ZodDefault:zv,ZodCatch:Fv,ZodNaN:Tg,BRAND:Sfe,ZodBranded:R4,ZodPipeline:I4,ZodReadonly:Hv,custom:DMt,Schema:yi,ZodSchema:yi,late:xfe,get ZodFirstPartyTypeKind(){return Ur},coerce:ahe,any:Pfe,array:Lfe,bigint:Rfe,boolean:UMt,date:Ife,discriminatedUnion:Ufe,effect:TMt,enum:Vfe,function:Zfe,instanceof:Efe,intersection:jfe,lazy:Wfe,literal:Gfe,map:Hfe,nan:Afe,nativeEnum:Yfe,never:Ofe,null:Bfe,nullable:Qfe,number:qMt,object:Dfe,oboolean:nhe,onumber:ihe,optional:Xfe,ostring:rhe,pipeline:ehe,preprocess:the,promise:Jfe,record:Ffe,set:Kfe,strictObject:$fe,string:$Mt,symbol:kfe,transformer:TMt,tuple:zfe,undefined:Tfe,union:qfe,unknown:Nfe,void:Cfe,NEVER:ohe,ZodIssueCode:sr,quotelessJson:Qse,ZodError:Rh});Et();Rt();At();var kx=new RegExp("^[a-zA-Z0-9_-]{43}$"),WDe=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),she="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",GDe=she,SZ="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",ef="qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE",VDe="RR0vheYqtsKuJCWh6xj0beE35tjaEug5cejMw9n2aa8",kh="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",xZ=1e6,YDe="nEjlSFA_8narJlVHApbczDPkMc9znSqYtqtf1iOdoxM",jMt="sOW9Sdm1yoPRrzerC5iu1nsupp4e6I-HnJyYVHzvzQo",zMt="fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",FMt="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var Bg=Ir.string({description:"Arweave Transaction ID"}).refine(r=>kx.test(r),{message:"Must be an Arweave Transaction ID"}),k4=Ir.string({description:"AO Address"}),HMt=Ir.string({description:"Integer String"}).refine(r=>{let e=parseInt(r);return Number.isInteger(e)&&e>=0},{message:"Must be a non negative integer string"}),fhe=Ir.string(),EZ=Ir.array(Ir.string()),Tx=Ir.object({transactionId:Bg.describe("The Target ID of the undername"),ttlSeconds:Ir.number(),priority:Ir.number().optional(),owner:k4.describe("The owner address of the record").optional(),displayName:Ir.string().max(61).describe("Display name of the record (max 61 chars)").optional(),logo:Bg.describe("Logo transaction ID for the record").optional(),description:Ir.string().max(512).describe("Description of the record (max 512 chars)").optional(),keywords:Ir.array(Ir.string().max(32)).max(16).describe("Keywords array (max 16, each max 32 chars)").optional()}),Bx=Ir.record(Ir.string(),Tx),Px=Ir.array(k4.describe("Controller address")),Nx=Ir.record(k4.describe("Holder address"),Ir.number()),AZ=Ir.object({Name:Ir.string().describe("The name of the ANT."),Ticker:Ir.string().describe("The ticker symbol for the ANT."),Description:Ir.string().describe("The description for the ANT."),Keywords:EZ.describe("The keywords for the ANT."),Denomination:Ir.number().describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.").min(0,{message:"Denomination must be a non-negative number"}),Owner:k4.describe("The Owners address."),Controllers:Px.describe("Controllers of the ANT who have administrative privileges."),Records:Bx.describe("Records associated with the ANT."),Balances:Nx.describe("Balance details for each address holding the ANT."),Logo:Bg.describe("Transaction ID of the ANT logo."),TotalSupply:Ir.number().describe("Total supply of the ANT in circulation.").min(0,{message:"Total supply must be a non-negative number"}),Initialized:Ir.boolean().describe("Flag indicating whether the ANT has been initialized.")}),ZMt=Ir.object({name:Ir.string().describe("The name of the ANT."),ticker:Ir.string().describe("The ticker symbol for the ANT."),description:Ir.string().describe("The description for the ANT."),keywords:EZ.describe("The keywords for the ANT."),owner:k4.describe("The Owners address."),controllers:Px.describe("Controllers of the ANT who have administrative privileges."),records:Bx.describe("Records associated with the ANT."),balances:Nx.describe("Balance details for each address holding the ANT."),logo:Bg.describe("Transaction ID of the ANT logo.")}),hhe=["balance","balances","totalSupply","info","controllers","record","records","state"],uhe=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames","transferRecordOwnership"],lhe=[...hhe,...uhe],KMt=Ir.array(Ir.string({description:"Handler Name"})).refine(r=>lhe.every(e=>r.includes(e)),{message:"ANT is missing required handlers"}),WMt=Ir.object({Name:Ir.string().describe("The name of the ANT."),Owner:Bg.describe("The Owners address."),Ticker:Ir.string().describe("The ticker symbol for the ANT."),"Total-Supply":HMt.describe("Total supply of the ANT in circulation."),Description:fhe.describe("The description for the ANT."),Keywords:EZ.describe("The keywords for the ANT."),Logo:Bg.describe("Transaction ID of the ANT logo."),Denomination:HMt.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:KMt.optional().describe("List of handlers for the ANT."),HandlerNames:KMt.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function i$e(r){return AZ.safeParse(r).success}Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var Kp="3.21.1-alpha.1";var $a=class r{level="info";levels={debug:0,info:1,warn:2,error:3,none:999};static default=new r;constructor({level:e="info"}={}){this.level=e}formatMessage(e,a,...l){let c={timestamp:new Date().toISOString(),level:e,message:a,name:"ar-io-sdk",version:Kp};return l.length>0?JSON.stringify({...c,args:l}):JSON.stringify(c)}log(e,a,...l){if(this.levels[e]<this.levels[this.level])return;let i=this.formatMessage(e,a,...l);switch(e){case"debug":console.debug(i);break;case"info":console.info(i);break;case"warn":console.warn(i);break;case"error":console.error(i);break}}info(e,...a){this.log("info",e,...a)}warn(e,...a){this.log("warn",e,...a)}error(e,...a){this.log("error",e,...a)}debug(e,...a){this.log("debug",e,...a)}setLogLevel(e){this.level=e}};Et();Rt();At();Et();Rt();At();var dhe=Object.create,oB=Object.defineProperty,che=Object.getOwnPropertyDescriptor,phe=Object.getOwnPropertyNames,mhe=Object.getPrototypeOf,vhe=Object.prototype.hasOwnProperty,wu=(r,e)=>()=>(r&&(e=r(r=0)),e),Ea=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),sB=(r,e)=>{for(var a in e)oB(r,a,{get:e[a],enumerable:!0})},PIt=(r,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of phe(e))!vhe.call(r,i)&&i!==a&&oB(r,i,{get:()=>e[i],enumerable:!(l=che(e,i))||l.enumerable});return r},fB=(r,e,a)=>(a=r!=null?dhe(mhe(r)):{},PIt(e||!r||!r.__esModule?oB(a,"default",{value:r,enumerable:!0}):a,r)),GMt=r=>PIt(oB({},"__esModule",{value:!0}),r),bhe=Ea(r=>{"use strict";r.byteLength=M,r.toByteArray=w,r.fromByteArray=x;var e=[],a=[],l=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c=0,b=i.length;c<b;++c)e[c]=i[c],a[i.charCodeAt(c)]=c;var c,b;a[45]=62,a[95]=63;function g(A){var I=A.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=I);var P=B===I?0:4-B%4;return[B,P]}function M(A){var I=g(A),B=I[0],P=I[1];return(B+P)*3/4-P}function y(A,I,B){return(I+B)*3/4-B}function w(A){var I,B=g(A),P=B[0],O=B[1],C=new l(y(A,P,O)),K=0,W=O>0?P-4:P,J;for(J=0;J<W;J+=4)I=a[A.charCodeAt(J)]<<18|a[A.charCodeAt(J+1)]<<12|a[A.charCodeAt(J+2)]<<6|a[A.charCodeAt(J+3)],C[K++]=I>>16&255,C[K++]=I>>8&255,C[K++]=I&255;return O===2&&(I=a[A.charCodeAt(J)]<<2|a[A.charCodeAt(J+1)]>>4,C[K++]=I&255),O===1&&(I=a[A.charCodeAt(J)]<<10|a[A.charCodeAt(J+1)]<<4|a[A.charCodeAt(J+2)]>>2,C[K++]=I>>8&255,C[K++]=I&255),C}function S(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function _(A,I,B){for(var P,O=[],C=I;C<B;C+=3)P=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),O.push(S(P));return O.join("")}function x(A){for(var I,B=A.length,P=B%3,O=[],C=16383,K=0,W=B-P;K<W;K+=C)O.push(_(A,K,K+C>W?W:K+C));return P===1?(I=A[B-1],O.push(e[I>>2]+e[I<<4&63]+"==")):P===2&&(I=(A[B-2]<<8)+A[B-1],O.push(e[I>>10]+e[I>>4&63]+e[I<<2&63]+"=")),O.join("")}}),ghe=Ea(r=>{r.read=function(e,a,l,i,c){var b,g,M=c*8-i-1,y=(1<<M)-1,w=y>>1,S=-7,_=l?c-1:0,x=l?-1:1,A=e[a+_];for(_+=x,b=A&(1<<-S)-1,A>>=-S,S+=M;S>0;b=b*256+e[a+_],_+=x,S-=8);for(g=b&(1<<-S)-1,b>>=-S,S+=i;S>0;g=g*256+e[a+_],_+=x,S-=8);if(b===0)b=1-w;else{if(b===y)return g?NaN:(A?-1:1)*(1/0);g=g+Math.pow(2,i),b=b-w}return(A?-1:1)*g*Math.pow(2,b-i)},r.write=function(e,a,l,i,c,b){var g,M,y,w=b*8-c-1,S=(1<<w)-1,_=S>>1,x=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:b-1,I=i?1:-1,B=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(M=isNaN(a)?1:0,g=S):(g=Math.floor(Math.log(a)/Math.LN2),a*(y=Math.pow(2,-g))<1&&(g--,y*=2),g+_>=1?a+=x/y:a+=x*Math.pow(2,1-_),a*y>=2&&(g++,y/=2),g+_>=S?(M=0,g=S):g+_>=1?(M=(a*y-1)*Math.pow(2,c),g=g+_):(M=a*Math.pow(2,_-1)*Math.pow(2,c),g=0));c>=8;e[l+A]=M&255,A+=I,M/=256,c-=8);for(g=g<<c|M,w+=c;w>0;e[l+A]=g&255,A+=I,g/=256,w-=8);e[l+A-I]|=B*128}}),NIt=Ea(r=>{"use strict";var e=bhe(),a=ghe(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=g,r.SlowBuffer=O,r.INSPECT_MAX_BYTES=50;var i=2147483647;r.kMaxLength=i,g.TYPED_ARRAY_SUPPORT=c(),!g.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let T=new Uint8Array(1),N={foo:function(){return 42}};return Object.setPrototypeOf(N,Uint8Array.prototype),Object.setPrototypeOf(T,N),T.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}}),Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function b(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let N=new Uint8Array(T);return Object.setPrototypeOf(N,g.prototype),N}function g(T,N,D){if(typeof T=="number"){if(typeof N=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(T)}return M(T,N,D)}g.poolSize=8192;function M(T,N,D){if(typeof T=="string")return _(T,N);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(St(T,ArrayBuffer)||T&&St(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(St(T,SharedArrayBuffer)||T&&St(T.buffer,SharedArrayBuffer)))return I(T,N,D);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let X=T.valueOf&&T.valueOf();if(X!=null&&X!==T)return g.from(X,N,D);let nt=B(T);if(nt)return nt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return g.from(T[Symbol.toPrimitive]("string"),N,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}g.from=function(T,N,D){return M(T,N,D)},Object.setPrototypeOf(g.prototype,Uint8Array.prototype),Object.setPrototypeOf(g,Uint8Array);function y(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function w(T,N,D){return y(T),T<=0?b(T):N!==void 0?typeof D=="string"?b(T).fill(N,D):b(T).fill(N):b(T)}g.alloc=function(T,N,D){return w(T,N,D)};function S(T){return y(T),b(T<0?0:P(T)|0)}g.allocUnsafe=function(T){return S(T)},g.allocUnsafeSlow=function(T){return S(T)};function _(T,N){if((typeof N!="string"||N==="")&&(N="utf8"),!g.isEncoding(N))throw new TypeError("Unknown encoding: "+N);let D=C(T,N)|0,X=b(D),nt=X.write(T,N);return nt!==D&&(X=X.slice(0,nt)),X}function x(T){let N=T.length<0?0:P(T.length)|0,D=b(N);for(let X=0;X<N;X+=1)D[X]=T[X]&255;return D}function A(T){if(St(T,Uint8Array)){let N=new Uint8Array(T);return I(N.buffer,N.byteOffset,N.byteLength)}return x(T)}function I(T,N,D){if(N<0||T.byteLength<N)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<N+(D||0))throw new RangeError('"length" is outside of buffer bounds');let X;return N===void 0&&D===void 0?X=new Uint8Array(T):D===void 0?X=new Uint8Array(T,N):X=new Uint8Array(T,N,D),Object.setPrototypeOf(X,g.prototype),X}function B(T){if(g.isBuffer(T)){let N=P(T.length)|0,D=b(N);return D.length===0||T.copy(D,0,0,N),D}if(T.length!==void 0)return typeof T.length!="number"||ut(T.length)?b(0):x(T);if(T.type==="Buffer"&&Array.isArray(T.data))return x(T.data)}function P(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function O(T){return+T!=T&&(T=0),g.alloc(+T)}g.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==g.prototype},g.compare=function(T,N){if(St(T,Uint8Array)&&(T=g.from(T,T.offset,T.byteLength)),St(N,Uint8Array)&&(N=g.from(N,N.offset,N.byteLength)),!g.isBuffer(T)||!g.isBuffer(N))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===N)return 0;let D=T.length,X=N.length;for(let nt=0,tt=Math.min(D,X);nt<tt;++nt)if(T[nt]!==N[nt]){D=T[nt],X=N[nt];break}return D<X?-1:X<D?1:0},g.isEncoding=function(T){switch(String(T).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},g.concat=function(T,N){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return g.alloc(0);let D;if(N===void 0)for(N=0,D=0;D<T.length;++D)N+=T[D].length;let X=g.allocUnsafe(N),nt=0;for(D=0;D<T.length;++D){let tt=T[D];if(St(tt,Uint8Array))nt+tt.length>X.length?(g.isBuffer(tt)||(tt=g.from(tt)),tt.copy(X,nt)):Uint8Array.prototype.set.call(X,tt,nt);else if(g.isBuffer(tt))tt.copy(X,nt);else throw new TypeError('"list" argument must be an Array of Buffers');nt+=tt.length}return X};function C(T,N){if(g.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||St(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let D=T.length,X=arguments.length>2&&arguments[2]===!0;if(!X&&D===0)return 0;let nt=!1;for(;;)switch(N){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return et(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return st(T).length;default:if(nt)return X?-1:et(T).length;N=(""+N).toLowerCase(),nt=!0}}g.byteLength=C;function K(T,N,D){let X=!1;if((N===void 0||N<0)&&(N=0),N>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,N>>>=0,D<=N))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,N,D);case"utf8":case"utf-8":return u(this,N,D);case"ascii":return p(this,N,D);case"latin1":case"binary":return f(this,N,D);case"base64":return s(this,N,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,N,D);default:if(X)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),X=!0}}g.prototype._isBuffer=!0;function W(T,N,D){let X=T[N];T[N]=T[D],T[D]=X}g.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let N=0;N<T;N+=2)W(this,N,N+1);return this},g.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let N=0;N<T;N+=4)W(this,N,N+3),W(this,N+1,N+2);return this},g.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let N=0;N<T;N+=8)W(this,N,N+7),W(this,N+1,N+6),W(this,N+2,N+5),W(this,N+3,N+4);return this},g.prototype.toString=function(){let T=this.length;return T===0?"":arguments.length===0?u(this,0,T):K.apply(this,arguments)},g.prototype.toLocaleString=g.prototype.toString,g.prototype.equals=function(T){if(!g.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:g.compare(this,T)===0},g.prototype.inspect=function(){let T="",N=r.INSPECT_MAX_BYTES;return T=this.toString("hex",0,N).replace(/(.{2})/g,"$1 ").trim(),this.length>N&&(T+=" ... "),"<Buffer "+T+">"},l&&(g.prototype[l]=g.prototype.inspect),g.prototype.compare=function(T,N,D,X,nt){if(St(T,Uint8Array)&&(T=g.from(T,T.offset,T.byteLength)),!g.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(N===void 0&&(N=0),D===void 0&&(D=T?T.length:0),X===void 0&&(X=0),nt===void 0&&(nt=this.length),N<0||D>T.length||X<0||nt>this.length)throw new RangeError("out of range index");if(X>=nt&&N>=D)return 0;if(X>=nt)return-1;if(N>=D)return 1;if(N>>>=0,D>>>=0,X>>>=0,nt>>>=0,this===T)return 0;let tt=nt-X,mt=D-N,kt=Math.min(tt,mt),lt=this.slice(X,nt),xt=T.slice(N,D);for(let Tt=0;Tt<kt;++Tt)if(lt[Tt]!==xt[Tt]){tt=lt[Tt],mt=xt[Tt];break}return tt<mt?-1:mt<tt?1:0};function J(T,N,D,X,nt){if(T.length===0)return-1;if(typeof D=="string"?(X=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,ut(D)&&(D=nt?0:T.length-1),D<0&&(D=T.length+D),D>=T.length){if(nt)return-1;D=T.length-1}else if(D<0)if(nt)D=0;else return-1;if(typeof N=="string"&&(N=g.from(N,X)),g.isBuffer(N))return N.length===0?-1:U(T,N,D,X,nt);if(typeof N=="number")return N=N&255,typeof Uint8Array.prototype.indexOf=="function"?nt?Uint8Array.prototype.indexOf.call(T,N,D):Uint8Array.prototype.lastIndexOf.call(T,N,D):U(T,[N],D,X,nt);throw new TypeError("val must be string, number or Buffer")}function U(T,N,D,X,nt){let tt=1,mt=T.length,kt=N.length;if(X!==void 0&&(X=String(X).toLowerCase(),X==="ucs2"||X==="ucs-2"||X==="utf16le"||X==="utf-16le")){if(T.length<2||N.length<2)return-1;tt=2,mt/=2,kt/=2,D/=2}function lt(Tt,pt){return tt===1?Tt[pt]:Tt.readUInt16BE(pt*tt)}let xt;if(nt){let Tt=-1;for(xt=D;xt<mt;xt++)if(lt(T,xt)===lt(N,Tt===-1?0:xt-Tt)){if(Tt===-1&&(Tt=xt),xt-Tt+1===kt)return Tt*tt}else Tt!==-1&&(xt-=xt-Tt),Tt=-1}else for(D+kt>mt&&(D=mt-kt),xt=D;xt>=0;xt--){let Tt=!0;for(let pt=0;pt<kt;pt++)if(lt(T,xt+pt)!==lt(N,pt)){Tt=!1;break}if(Tt)return xt}return-1}g.prototype.includes=function(T,N,D){return this.indexOf(T,N,D)!==-1},g.prototype.indexOf=function(T,N,D){return J(this,T,N,D,!0)},g.prototype.lastIndexOf=function(T,N,D){return J(this,T,N,D,!1)};function q(T,N,D,X){D=Number(D)||0;let nt=T.length-D;X?(X=Number(X),X>nt&&(X=nt)):X=nt;let tt=N.length;X>tt/2&&(X=tt/2);let mt;for(mt=0;mt<X;++mt){let kt=parseInt(N.substr(mt*2,2),16);if(ut(kt))return mt;T[D+mt]=kt}return mt}function V(T,N,D,X){return wt(et(N,T.length-D),T,D,X)}function h(T,N,D,X){return wt(ft(N),T,D,X)}function t(T,N,D,X){return wt(st(N),T,D,X)}function n(T,N,D,X){return wt(ct(N,T.length-D),T,D,X)}g.prototype.write=function(T,N,D,X){if(N===void 0)X="utf8",D=this.length,N=0;else if(D===void 0&&typeof N=="string")X=N,D=this.length,N=0;else if(isFinite(N))N=N>>>0,isFinite(D)?(D=D>>>0,X===void 0&&(X="utf8")):(X=D,D=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let nt=this.length-N;if((D===void 0||D>nt)&&(D=nt),T.length>0&&(D<0||N<0)||N>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let tt=!1;for(;;)switch(X){case"hex":return q(this,T,N,D);case"utf8":case"utf-8":return V(this,T,N,D);case"ascii":case"latin1":case"binary":return h(this,T,N,D);case"base64":return t(this,T,N,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n(this,T,N,D);default:if(tt)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),tt=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(T,N,D){return N===0&&D===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(N,D))}function u(T,N,D){D=Math.min(T.length,D);let X=[],nt=N;for(;nt<D;){let tt=T[nt],mt=null,kt=tt>239?4:tt>223?3:tt>191?2:1;if(nt+kt<=D){let lt,xt,Tt,pt;switch(kt){case 1:tt<128&&(mt=tt);break;case 2:lt=T[nt+1],(lt&192)===128&&(pt=(tt&31)<<6|lt&63,pt>127&&(mt=pt));break;case 3:lt=T[nt+1],xt=T[nt+2],(lt&192)===128&&(xt&192)===128&&(pt=(tt&15)<<12|(lt&63)<<6|xt&63,pt>2047&&(pt<55296||pt>57343)&&(mt=pt));break;case 4:lt=T[nt+1],xt=T[nt+2],Tt=T[nt+3],(lt&192)===128&&(xt&192)===128&&(Tt&192)===128&&(pt=(tt&15)<<18|(lt&63)<<12|(xt&63)<<6|Tt&63,pt>65535&&pt<1114112&&(mt=pt))}}mt===null?(mt=65533,kt=1):mt>65535&&(mt-=65536,X.push(mt>>>10&1023|55296),mt=56320|mt&1023),X.push(mt),nt+=kt}return v(X)}var d=4096;function v(T){let N=T.length;if(N<=d)return String.fromCharCode.apply(String,T);let D="",X=0;for(;X<N;)D+=String.fromCharCode.apply(String,T.slice(X,X+=d));return D}function p(T,N,D){let X="";D=Math.min(T.length,D);for(let nt=N;nt<D;++nt)X+=String.fromCharCode(T[nt]&127);return X}function f(T,N,D){let X="";D=Math.min(T.length,D);for(let nt=N;nt<D;++nt)X+=String.fromCharCode(T[nt]);return X}function o(T,N,D){let X=T.length;(!N||N<0)&&(N=0),(!D||D<0||D>X)&&(D=X);let nt="";for(let tt=N;tt<D;++tt)nt+=It[T[tt]];return nt}function m(T,N,D){let X=T.slice(N,D),nt="";for(let tt=0;tt<X.length-1;tt+=2)nt+=String.fromCharCode(X[tt]+X[tt+1]*256);return nt}g.prototype.slice=function(T,N){let D=this.length;T=~~T,N=N===void 0?D:~~N,T<0?(T+=D,T<0&&(T=0)):T>D&&(T=D),N<0?(N+=D,N<0&&(N=0)):N>D&&(N=D),N<T&&(N=T);let X=this.subarray(T,N);return Object.setPrototypeOf(X,g.prototype),X};function E(T,N,D){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+N>D)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=this[T],nt=1,tt=0;for(;++tt<N&&(nt*=256);)X+=this[T+tt]*nt;return X},g.prototype.readUintBE=g.prototype.readUIntBE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=this[T+--N],nt=1;for(;N>0&&(nt*=256);)X+=this[T+--N]*nt;return X},g.prototype.readUint8=g.prototype.readUInt8=function(T,N){return T=T>>>0,N||E(T,1,this.length),this[T]},g.prototype.readUint16LE=g.prototype.readUInt16LE=function(T,N){return T=T>>>0,N||E(T,2,this.length),this[T]|this[T+1]<<8},g.prototype.readUint16BE=g.prototype.readUInt16BE=function(T,N){return T=T>>>0,N||E(T,2,this.length),this[T]<<8|this[T+1]},g.prototype.readUint32LE=g.prototype.readUInt32LE=function(T,N){return T=T>>>0,N||E(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},g.prototype.readUint32BE=g.prototype.readUInt32BE=function(T,N){return T=T>>>0,N||E(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},g.prototype.readBigUInt64LE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=N+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,nt=this[++T]+this[++T]*2**8+this[++T]*2**16+D*2**24;return BigInt(X)+(BigInt(nt)<<BigInt(32))}),g.prototype.readBigUInt64BE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=N*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],nt=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+D;return(BigInt(X)<<BigInt(32))+BigInt(nt)}),g.prototype.readIntLE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=this[T],nt=1,tt=0;for(;++tt<N&&(nt*=256);)X+=this[T+tt]*nt;return nt*=128,X>=nt&&(X-=Math.pow(2,8*N)),X},g.prototype.readIntBE=function(T,N,D){T=T>>>0,N=N>>>0,D||E(T,N,this.length);let X=N,nt=1,tt=this[T+--X];for(;X>0&&(nt*=256);)tt+=this[T+--X]*nt;return nt*=128,tt>=nt&&(tt-=Math.pow(2,8*N)),tt},g.prototype.readInt8=function(T,N){return T=T>>>0,N||E(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},g.prototype.readInt16LE=function(T,N){T=T>>>0,N||E(T,2,this.length);let D=this[T]|this[T+1]<<8;return D&32768?D|4294901760:D},g.prototype.readInt16BE=function(T,N){T=T>>>0,N||E(T,2,this.length);let D=this[T+1]|this[T]<<8;return D&32768?D|4294901760:D},g.prototype.readInt32LE=function(T,N){return T=T>>>0,N||E(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},g.prototype.readInt32BE=function(T,N){return T=T>>>0,N||E(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},g.prototype.readBigInt64LE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(D<<24);return(BigInt(X)<<BigInt(32))+BigInt(N+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),g.prototype.readBigInt64BE=Pt(function(T){T=T>>>0,F(T,"offset");let N=this[T],D=this[T+7];(N===void 0||D===void 0)&&Y(T,this.length-8);let X=(N<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(X)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+D)}),g.prototype.readFloatLE=function(T,N){return T=T>>>0,N||E(T,4,this.length),a.read(this,T,!0,23,4)},g.prototype.readFloatBE=function(T,N){return T=T>>>0,N||E(T,4,this.length),a.read(this,T,!1,23,4)},g.prototype.readDoubleLE=function(T,N){return T=T>>>0,N||E(T,8,this.length),a.read(this,T,!0,52,8)},g.prototype.readDoubleBE=function(T,N){return T=T>>>0,N||E(T,8,this.length),a.read(this,T,!1,52,8)};function R(T,N,D,X,nt,tt){if(!g.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(N>nt||N<tt)throw new RangeError('"value" argument is out of bounds');if(D+X>T.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(T,N,D,X){if(T=+T,N=N>>>0,D=D>>>0,!X){let mt=Math.pow(2,8*D)-1;R(this,T,N,D,mt,0)}let nt=1,tt=0;for(this[N]=T&255;++tt<D&&(nt*=256);)this[N+tt]=T/nt&255;return N+D},g.prototype.writeUintBE=g.prototype.writeUIntBE=function(T,N,D,X){if(T=+T,N=N>>>0,D=D>>>0,!X){let mt=Math.pow(2,8*D)-1;R(this,T,N,D,mt,0)}let nt=D-1,tt=1;for(this[N+nt]=T&255;--nt>=0&&(tt*=256);)this[N+nt]=T/tt&255;return N+D},g.prototype.writeUint8=g.prototype.writeUInt8=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,1,255,0),this[N]=T&255,N+1},g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,65535,0),this[N]=T&255,this[N+1]=T>>>8,N+2},g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,65535,0),this[N]=T>>>8,this[N+1]=T&255,N+2},g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,4294967295,0),this[N+3]=T>>>24,this[N+2]=T>>>16,this[N+1]=T>>>8,this[N]=T&255,N+4},g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,4294967295,0),this[N]=T>>>24,this[N+1]=T>>>16,this[N+2]=T>>>8,this[N+3]=T&255,N+4};function k(T,N,D,X,nt){H(N,X,nt,T,D,7);let tt=Number(N&BigInt(4294967295));T[D++]=tt,tt=tt>>8,T[D++]=tt,tt=tt>>8,T[D++]=tt,tt=tt>>8,T[D++]=tt;let mt=Number(N>>BigInt(32)&BigInt(4294967295));return T[D++]=mt,mt=mt>>8,T[D++]=mt,mt=mt>>8,T[D++]=mt,mt=mt>>8,T[D++]=mt,D}function L(T,N,D,X,nt){H(N,X,nt,T,D,7);let tt=Number(N&BigInt(4294967295));T[D+7]=tt,tt=tt>>8,T[D+6]=tt,tt=tt>>8,T[D+5]=tt,tt=tt>>8,T[D+4]=tt;let mt=Number(N>>BigInt(32)&BigInt(4294967295));return T[D+3]=mt,mt=mt>>8,T[D+2]=mt,mt=mt>>8,T[D+1]=mt,mt=mt>>8,T[D]=mt,D+8}g.prototype.writeBigUInt64LE=Pt(function(T,N=0){return k(this,T,N,BigInt(0),BigInt("0xffffffffffffffff"))}),g.prototype.writeBigUInt64BE=Pt(function(T,N=0){return L(this,T,N,BigInt(0),BigInt("0xffffffffffffffff"))}),g.prototype.writeIntLE=function(T,N,D,X){if(T=+T,N=N>>>0,!X){let kt=Math.pow(2,8*D-1);R(this,T,N,D,kt-1,-kt)}let nt=0,tt=1,mt=0;for(this[N]=T&255;++nt<D&&(tt*=256);)T<0&&mt===0&&this[N+nt-1]!==0&&(mt=1),this[N+nt]=(T/tt>>0)-mt&255;return N+D},g.prototype.writeIntBE=function(T,N,D,X){if(T=+T,N=N>>>0,!X){let kt=Math.pow(2,8*D-1);R(this,T,N,D,kt-1,-kt)}let nt=D-1,tt=1,mt=0;for(this[N+nt]=T&255;--nt>=0&&(tt*=256);)T<0&&mt===0&&this[N+nt+1]!==0&&(mt=1),this[N+nt]=(T/tt>>0)-mt&255;return N+D},g.prototype.writeInt8=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,1,127,-128),T<0&&(T=255+T+1),this[N]=T&255,N+1},g.prototype.writeInt16LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,32767,-32768),this[N]=T&255,this[N+1]=T>>>8,N+2},g.prototype.writeInt16BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,2,32767,-32768),this[N]=T>>>8,this[N+1]=T&255,N+2},g.prototype.writeInt32LE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,2147483647,-2147483648),this[N]=T&255,this[N+1]=T>>>8,this[N+2]=T>>>16,this[N+3]=T>>>24,N+4},g.prototype.writeInt32BE=function(T,N,D){return T=+T,N=N>>>0,D||R(this,T,N,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[N]=T>>>24,this[N+1]=T>>>16,this[N+2]=T>>>8,this[N+3]=T&255,N+4},g.prototype.writeBigInt64LE=Pt(function(T,N=0){return k(this,T,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),g.prototype.writeBigInt64BE=Pt(function(T,N=0){return L(this,T,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function z(T,N,D,X,nt,tt){if(D+X>T.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function it(T,N,D,X,nt){return N=+N,D=D>>>0,nt||z(T,N,D,4,34028234663852886e22,-34028234663852886e22),a.write(T,N,D,X,23,4),D+4}g.prototype.writeFloatLE=function(T,N,D){return it(this,T,N,!0,D)},g.prototype.writeFloatBE=function(T,N,D){return it(this,T,N,!1,D)};function G(T,N,D,X,nt){return N=+N,D=D>>>0,nt||z(T,N,D,8,17976931348623157e292,-17976931348623157e292),a.write(T,N,D,X,52,8),D+8}g.prototype.writeDoubleLE=function(T,N,D){return G(this,T,N,!0,D)},g.prototype.writeDoubleBE=function(T,N,D){return G(this,T,N,!1,D)},g.prototype.copy=function(T,N,D,X){if(!g.isBuffer(T))throw new TypeError("argument should be a Buffer");if(D||(D=0),!X&&X!==0&&(X=this.length),N>=T.length&&(N=T.length),N||(N=0),X>0&&X<D&&(X=D),X===D||T.length===0||this.length===0)return 0;if(N<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),T.length-N<X-D&&(X=T.length-N+D);let nt=X-D;return this===T&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(N,D,X):Uint8Array.prototype.set.call(T,this.subarray(D,X),N),nt},g.prototype.fill=function(T,N,D,X){if(typeof T=="string"){if(typeof N=="string"?(X=N,N=0,D=this.length):typeof D=="string"&&(X=D,D=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!g.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(T.length===1){let tt=T.charCodeAt(0);(X==="utf8"&&tt<128||X==="latin1")&&(T=tt)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(N<0||this.length<N||this.length<D)throw new RangeError("Out of range index");if(D<=N)return this;N=N>>>0,D=D===void 0?this.length:D>>>0,T||(T=0);let nt;if(typeof T=="number")for(nt=N;nt<D;++nt)this[nt]=T;else{let tt=g.isBuffer(T)?T:g.from(T,X),mt=tt.length;if(mt===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(nt=0;nt<D-N;++nt)this[nt+N]=tt[nt%mt]}return this};var $={};function Z(T,N,D){$[T]=class extends D{constructor(){super(),Object.defineProperty(this,"message",{value:N.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}Z("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Z("ERR_INVALID_ARG_TYPE",function(T,N){return`The "${T}" argument must be of type number. Received type ${typeof N}`},TypeError),Z("ERR_OUT_OF_RANGE",function(T,N,D){let X=`The value of "${T}" is out of range.`,nt=D;return Number.isInteger(D)&&Math.abs(D)>2**32?nt=rt(String(D)):typeof D=="bigint"&&(nt=String(D),(D>BigInt(2)**BigInt(32)||D<-(BigInt(2)**BigInt(32)))&&(nt=rt(nt)),nt+="n"),X+=` It must be ${N}. Received ${nt}`,X},RangeError);function rt(T){let N="",D=T.length,X=T[0]==="-"?1:0;for(;D>=X+4;D-=3)N=`_${T.slice(D-3,D)}${N}`;return`${T.slice(0,D)}${N}`}function Q(T,N,D){F(N,"offset"),(T[N]===void 0||T[N+D]===void 0)&&Y(N,T.length-(D+1))}function H(T,N,D,X,nt,tt){if(T>D||T<N){let mt=typeof N=="bigint"?"n":"",kt;throw tt>3?N===0||N===BigInt(0)?kt=`>= 0${mt} and < 2${mt} ** ${(tt+1)*8}${mt}`:kt=`>= -(2${mt} ** ${(tt+1)*8-1}${mt}) and < 2 ** ${(tt+1)*8-1}${mt}`:kt=`>= ${N}${mt} and <= ${D}${mt}`,new $.ERR_OUT_OF_RANGE("value",kt,T)}Q(X,nt,tt)}function F(T,N){if(typeof T!="number")throw new $.ERR_INVALID_ARG_TYPE(N,"number",T)}function Y(T,N,D){throw Math.floor(T)!==T?(F(T,D),new $.ERR_OUT_OF_RANGE(D||"offset","an integer",T)):N<0?new $.ERR_BUFFER_OUT_OF_BOUNDS:new $.ERR_OUT_OF_RANGE(D||"offset",`>= ${D?1:0} and <= ${N}`,T)}var at=/[^+/0-9A-Za-z-_]/g;function ht(T){if(T=T.split("=")[0],T=T.trim().replace(at,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function et(T,N){N=N||1/0;let D,X=T.length,nt=null,tt=[];for(let mt=0;mt<X;++mt){if(D=T.charCodeAt(mt),D>55295&&D<57344){if(!nt){if(D>56319){(N-=3)>-1&&tt.push(239,191,189);continue}else if(mt+1===X){(N-=3)>-1&&tt.push(239,191,189);continue}nt=D;continue}if(D<56320){(N-=3)>-1&&tt.push(239,191,189),nt=D;continue}D=(nt-55296<<10|D-56320)+65536}else nt&&(N-=3)>-1&&tt.push(239,191,189);if(nt=null,D<128){if((N-=1)<0)break;tt.push(D)}else if(D<2048){if((N-=2)<0)break;tt.push(D>>6|192,D&63|128)}else if(D<65536){if((N-=3)<0)break;tt.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((N-=4)<0)break;tt.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return tt}function ft(T){let N=[];for(let D=0;D<T.length;++D)N.push(T.charCodeAt(D)&255);return N}function ct(T,N){let D,X,nt,tt=[];for(let mt=0;mt<T.length&&!((N-=2)<0);++mt)D=T.charCodeAt(mt),X=D>>8,nt=D%256,tt.push(nt),tt.push(X);return tt}function st(T){return e.toByteArray(ht(T))}function wt(T,N,D,X){let nt;for(nt=0;nt<X&&!(nt+D>=N.length||nt>=T.length);++nt)N[nt+D]=T[nt];return nt}function St(T,N){return T instanceof N||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===N.name}function ut(T){return T!==T}var It=(function(){let T="0123456789abcdef",N=new Array(256);for(let D=0;D<16;++D){let X=D*16;for(let nt=0;nt<16;++nt)N[X+nt]=T[D]+T[nt]}return N})();function Pt(T){return typeof BigInt>"u"?j:T}function j(){throw new Error("BigInt not supported")}}),yhe=Ea((r,e)=>{var a=1e3,l=a*60,i=l*60,c=i*24,b=c*7,g=c*365.25;e.exports=function(_,x){x=x||{};var A=typeof _;if(A==="string"&&_.length>0)return M(_);if(A==="number"&&isFinite(_))return x.long?w(_):y(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function M(_){if(_=String(_),!(_.length>100)){var x=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(x){var A=parseFloat(x[1]),I=(x[2]||"ms").toLowerCase();switch(I){case"years":case"year":case"yrs":case"yr":case"y":return A*g;case"weeks":case"week":case"w":return A*b;case"days":case"day":case"d":return A*c;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*l;case"seconds":case"second":case"secs":case"sec":case"s":return A*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function y(_){var x=Math.abs(_);return x>=c?Math.round(_/c)+"d":x>=i?Math.round(_/i)+"h":x>=l?Math.round(_/l)+"m":x>=a?Math.round(_/a)+"s":_+"ms"}function w(_){var x=Math.abs(_);return x>=c?S(_,x,c,"day"):x>=i?S(_,x,i,"hour"):x>=l?S(_,x,l,"minute"):x>=a?S(_,x,a,"second"):_+" ms"}function S(_,x,A,I){var B=x>=A*1.5;return Math.round(_/A)+" "+I+(B?"s":"")}}),whe=Ea((r,e)=>{function a(l){c.debug=c,c.default=c,c.coerce=S,c.disable=y,c.enable=g,c.enabled=w,c.humanize=yhe(),c.destroy=_,Object.keys(l).forEach(x=>{c[x]=l[x]}),c.names=[],c.skips=[],c.formatters={};function i(x){let A=0;for(let I=0;I<x.length;I++)A=(A<<5)-A+x.charCodeAt(I),A|=0;return c.colors[Math.abs(A)%c.colors.length]}c.selectColor=i;function c(x){let A,I=null,B,P;function O(...C){if(!O.enabled)return;let K=O,W=Number(new Date),J=W-(A||W);K.diff=J,K.prev=A,K.curr=W,A=W,C[0]=c.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let U=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(q,V)=>{if(q==="%%")return"%";U++;let h=c.formatters[V];if(typeof h=="function"){let t=C[U];q=h.call(K,t),C.splice(U,1),U--}return q}),c.formatArgs.call(K,C),(K.log||c.log).apply(K,C)}return O.namespace=x,O.useColors=c.useColors(),O.color=c.selectColor(x),O.extend=b,O.destroy=c.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>I!==null?I:(B!==c.namespaces&&(B=c.namespaces,P=c.enabled(x)),P),set:C=>{I=C}}),typeof c.init=="function"&&c.init(O),O}function b(x,A){let I=c(this.namespace+(typeof A>"u"?":":A)+x);return I.log=this.log,I}function g(x){c.save(x),c.namespaces=x,c.names=[],c.skips=[];let A=(typeof x=="string"?x:"").trim().replace(" ",",").split(",").filter(Boolean);for(let I of A)I[0]==="-"?c.skips.push(I.slice(1)):c.names.push(I)}function M(x,A){let I=0,B=0,P=-1,O=0;for(;I<x.length;)if(B<A.length&&(A[B]===x[I]||A[B]==="*"))A[B]==="*"?(P=B,O=I,B++):(I++,B++);else if(P!==-1)B=P+1,O++,I=O;else return!1;for(;B<A.length&&A[B]==="*";)B++;return B===A.length}function y(){let x=[...c.names,...c.skips.map(A=>"-"+A)].join(",");return c.enable(""),x}function w(x){for(let A of c.skips)if(M(x,A))return!1;for(let A of c.names)if(M(x,A))return!0;return!1}function S(x){return x instanceof Error?x.stack||x.message:x}function _(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return c.enable(c.load()),c}e.exports=a}),Mhe=Ea((r,e)=>{r.formatArgs=l,r.save=i,r.load=c,r.useColors=a,r.storage=b(),r.destroy=(()=>{let M=!1;return()=>{M||(M=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function a(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let M;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(M=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(M[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(M){if(M[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+M[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let y="color: "+this.color;M.splice(1,0,y,"color: inherit");let w=0,S=0;M[0].replace(/%[a-zA-Z%]/g,_=>{_!=="%%"&&(w++,_==="%c"&&(S=w))}),M.splice(S,0,y)}r.log=console.debug||console.log||(()=>{});function i(M){try{M?r.storage.setItem("debug",M):r.storage.removeItem("debug")}catch{}}function c(){let M;try{M=r.storage.getItem("debug")}catch{}return!M&&typeof Te<"u"&&"env"in Te&&(M=Te.env.DEBUG),M}function b(){try{return localStorage}catch{}}e.exports=whe()(r);var{formatters:g}=e.exports;g.j=function(M){try{return JSON.stringify(M)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}});function fa(){fa.init.call(this)}function NE(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}function OIt(r){return r._maxListeners===void 0?fa.defaultMaxListeners:r._maxListeners}function VMt(r,e,a,l){var i,c,b,g;if(NE(a),(c=r._events)===void 0?(c=r._events=Object.create(null),r._eventsCount=0):(c.newListener!==void 0&&(r.emit("newListener",e,a.listener?a.listener:a),c=r._events),b=c[e]),b===void 0)b=c[e]=a,++r._eventsCount;else if(typeof b=="function"?b=c[e]=l?[a,b]:[b,a]:l?b.unshift(a):b.push(a),(i=OIt(r))>0&&b.length>i&&!b.warned){b.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+b.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=r,M.type=e,M.count=b.length,g=M,console&&console.warn&&console.warn(g)}return r}function _he(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function YMt(r,e,a){var l={fired:!1,wrapFn:void 0,target:r,type:e,listener:a},i=_he.bind(l);return i.listener=a,l.wrapFn=i,i}function JMt(r,e,a){var l=r._events;if(l===void 0)return[];var i=l[e];return i===void 0?[]:typeof i=="function"?a?[i.listener||i]:[i]:a?(function(c){for(var b=new Array(c.length),g=0;g<b.length;++g)b[g]=c[g].listener||c[g];return b})(i):CIt(i,i.length)}function XMt(r){var e=this._events;if(e!==void 0){var a=e[r];if(typeof a=="function")return 1;if(a!==void 0)return a.length}return 0}function CIt(r,e){for(var a=new Array(e),l=0;l<e;++l)a[l]=r[l];return a}var QMt,t_t,Kv,RZ,IZ,kZ,gs,LIt=wu(()=>{Kv=typeof Reflect=="object"?Reflect:null,RZ=Kv&&typeof Kv.apply=="function"?Kv.apply:function(r,e,a){return Function.prototype.apply.call(r,e,a)},t_t=Kv&&typeof Kv.ownKeys=="function"?Kv.ownKeys:Object.getOwnPropertySymbols?function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:function(r){return Object.getOwnPropertyNames(r)},IZ=Number.isNaN||function(r){return r!=r},QMt=fa,fa.EventEmitter=fa,fa.prototype._events=void 0,fa.prototype._eventsCount=0,fa.prototype._maxListeners=void 0,kZ=10,Object.defineProperty(fa,"defaultMaxListeners",{enumerable:!0,get:function(){return kZ},set:function(r){if(typeof r!="number"||r<0||IZ(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");kZ=r}}),fa.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},fa.prototype.setMaxListeners=function(r){if(typeof r!="number"||r<0||IZ(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this},fa.prototype.getMaxListeners=function(){return OIt(this)},fa.prototype.emit=function(r){for(var e=[],a=1;a<arguments.length;a++)e.push(arguments[a]);var l=r==="error",i=this._events;if(i!==void 0)l=l&&i.error===void 0;else if(!l)return!1;if(l){var c;if(e.length>0&&(c=e[0]),c instanceof Error)throw c;var b=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw b.context=c,b}var g=i[r];if(g===void 0)return!1;if(typeof g=="function")RZ(g,this,e);else{var M=g.length,y=CIt(g,M);for(a=0;a<M;++a)RZ(y[a],this,e)}return!0},fa.prototype.addListener=function(r,e){return VMt(this,r,e,!1)},fa.prototype.on=fa.prototype.addListener,fa.prototype.prependListener=function(r,e){return VMt(this,r,e,!0)},fa.prototype.once=function(r,e){return NE(e),this.on(r,YMt(this,r,e)),this},fa.prototype.prependOnceListener=function(r,e){return NE(e),this.prependListener(r,YMt(this,r,e)),this},fa.prototype.removeListener=function(r,e){var a,l,i,c,b;if(NE(e),(l=this._events)===void 0)return this;if((a=l[r])===void 0)return this;if(a===e||a.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete l[r],l.removeListener&&this.emit("removeListener",r,a.listener||e));else if(typeof a!="function"){for(i=-1,c=a.length-1;c>=0;c--)if(a[c]===e||a[c].listener===e){b=a[c].listener,i=c;break}if(i<0)return this;i===0?a.shift():(function(g,M){for(;M+1<g.length;M++)g[M]=g[M+1];g.pop()})(a,i),a.length===1&&(l[r]=a[0]),l.removeListener!==void 0&&this.emit("removeListener",r,b||e)}return this},fa.prototype.off=fa.prototype.removeListener,fa.prototype.removeAllListeners=function(r){var e,a,l;if((a=this._events)===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[r]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete a[r]),this;if(arguments.length===0){var i,c=Object.keys(a);for(l=0;l<c.length;++l)(i=c[l])!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=a[r])=="function")this.removeListener(r,e);else if(e!==void 0)for(l=e.length-1;l>=0;l--)this.removeListener(r,e[l]);return this},fa.prototype.listeners=function(r){return JMt(this,r,!0)},fa.prototype.rawListeners=function(r){return JMt(this,r,!1)},fa.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):XMt.call(r,e)},fa.prototype.listenerCount=XMt,fa.prototype.eventNames=function(){return this._eventsCount>0?t_t(this._events):[]},gs=QMt,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount});function KG(){throw new Error("setTimeout has not been defined")}function ZG(){throw new Error("clearTimeout has not been defined")}function DIt(r){if(t1===setTimeout)return setTimeout(r,0);if((t1===KG||!t1)&&setTimeout)return t1=setTimeout,setTimeout(r,0);try{return t1(r,0)}catch{try{return t1.call(null,r,0)}catch{return t1.call(this||A6,r,0)}}}function She(){R6&&M6&&(R6=!1,M6.length?$d=M6.concat($d):n7=-1,$d.length&&$It())}function $It(){if(!R6){var r=DIt(She);R6=!0;for(var e=$d.length;e;){for(M6=$d,$d=[];++n7<e;)M6&&M6[n7].run();n7=-1,e=$d.length}M6=null,R6=!1,(function(a){if(e1===clearTimeout)return clearTimeout(a);if((e1===ZG||!e1)&&clearTimeout)return e1=clearTimeout,clearTimeout(a);try{e1(a)}catch{try{return e1.call(null,a)}catch{return e1.call(this||A6,a)}}})(r)}}function e_t(r,e){(this||A6).fun=r,(this||A6).array=e}function Fc(){}var r_t,t1,e1,A6,mo,M6,$d,R6,n7,ti,$rt=wu(()=>{A6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis,mo=r_t={},(function(){try{t1=typeof setTimeout=="function"?setTimeout:KG}catch{t1=KG}try{e1=typeof clearTimeout=="function"?clearTimeout:ZG}catch{e1=ZG}})(),$d=[],R6=!1,n7=-1,mo.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)e[a-1]=arguments[a];$d.push(new e_t(r,e)),$d.length!==1||R6||DIt($It)},e_t.prototype.run=function(){(this||A6).fun.apply(null,(this||A6).array)},mo.title="browser",mo.browser=!0,mo.env={},mo.argv=[],mo.version="",mo.versions={},mo.on=Fc,mo.addListener=Fc,mo.once=Fc,mo.off=Fc,mo.removeListener=Fc,mo.removeAllListeners=Fc,mo.emit=Fc,mo.prependListener=Fc,mo.prependOnceListener=Fc,mo.listeners=function(r){return[]},mo.binding=function(r){throw new Error("process.binding is not supported")},mo.cwd=function(){return"/"},mo.chdir=function(r){throw new Error("process.chdir is not supported")},mo.umask=function(){return 0},ti=r_t,ti.addListener,ti.argv,ti.binding,ti.browser,ti.chdir,ti.cwd,ti.emit,ti.env,ti.listeners,ti.nextTick,ti.off,ti.on,ti.once,ti.prependListener,ti.prependOnceListener,ti.removeAllListeners,ti.removeListener,ti.title,ti.umask,ti.version,ti.versions});function Zv(r){return r.call.bind(r)}function iw(r,e){if(typeof r!="object")return!1;try{return e(r),!0}catch{return!1}}function i_t(r){return Mf&&th?qn(r)!==void 0:qIt(r)||UIt(r)||jIt(r)||zIt(r)||FIt(r)||HIt(r)||KIt(r)||ZIt(r)||WIt(r)||GIt(r)||VIt(r)}function qIt(r){return Mf&&th?qn(r)==="Uint8Array":qa(r)==="[object Uint8Array]"||QIt(r)&&r.buffer!==void 0}function UIt(r){return Mf&&th?qn(r)==="Uint8ClampedArray":qa(r)==="[object Uint8ClampedArray]"}function jIt(r){return Mf&&th?qn(r)==="Uint16Array":qa(r)==="[object Uint16Array]"}function zIt(r){return Mf&&th?qn(r)==="Uint32Array":qa(r)==="[object Uint32Array]"}function FIt(r){return Mf&&th?qn(r)==="Int8Array":qa(r)==="[object Int8Array]"}function HIt(r){return Mf&&th?qn(r)==="Int16Array":qa(r)==="[object Int16Array]"}function KIt(r){return Mf&&th?qn(r)==="Int32Array":qa(r)==="[object Int32Array]"}function ZIt(r){return Mf&&th?qn(r)==="Float32Array":qa(r)==="[object Float32Array]"}function WIt(r){return Mf&&th?qn(r)==="Float64Array":qa(r)==="[object Float64Array]"}function GIt(r){return Mf&&th?qn(r)==="BigInt64Array":qa(r)==="[object BigInt64Array]"}function VIt(r){return Mf&&th?qn(r)==="BigUint64Array":qa(r)==="[object BigUint64Array]"}function Ox(r){return qa(r)==="[object Map]"}function Cx(r){return qa(r)==="[object Set]"}function Lx(r){return qa(r)==="[object WeakMap]"}function TZ(r){return qa(r)==="[object WeakSet]"}function bT(r){return qa(r)==="[object ArrayBuffer]"}function n_t(r){return typeof ArrayBuffer<"u"&&(bT.working?bT(r):r instanceof ArrayBuffer)}function gT(r){return qa(r)==="[object DataView]"}function a_t(r){return typeof DataView<"u"&&(gT.working?gT(r):r instanceof DataView)}function yT(r){return qa(r)==="[object SharedArrayBuffer]"}function o_t(r){return typeof SharedArrayBuffer<"u"&&(yT.working?yT(r):r instanceof SharedArrayBuffer)}function s_t(r){return iw(r,tkt)}function f_t(r){return iw(r,ekt)}function h_t(r){return iw(r,rkt)}function u_t(r){return WG&&iw(r,pU)}function l_t(r){return CE&&iw(r,vU)}function Tm(r,e){var a={seen:[],stylize:Ehe};return arguments.length>=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),qrt(e)?a.showHidden=e:e&&fr._extend(a,e),_6(a.showHidden)&&(a.showHidden=!1),_6(a.depth)&&(a.depth=2),_6(a.colors)&&(a.colors=!1),_6(a.customInspect)&&(a.customInspect=!0),a.colors&&(a.stylize=xhe),wT(a,r,a.depth)}function xhe(r,e){var a=Tm.styles[e];return a?"\x1B["+Tm.colors[a][0]+"m"+r+"\x1B["+Tm.colors[a][1]+"m":r}function Ehe(r,e){return r}function wT(r,e,a){if(r.customInspect&&e&&OE(e.inspect)&&e.inspect!==fr.inspect&&(!e.constructor||e.constructor.prototype!==e)){var l=e.inspect(a,r);return _T(l)||(l=wT(r,l,a)),l}var i=(function(_,x){if(_6(x))return _.stylize("undefined","undefined");if(_T(x)){var A="'"+JSON.stringify(x).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return _.stylize(A,"string")}if(JIt(x))return _.stylize(""+x,"number");if(qrt(x))return _.stylize(""+x,"boolean");if(MT(x))return _.stylize("null","null")})(r,e);if(i)return i;var c=Object.keys(e),b=(function(_){var x={};return _.forEach(function(A,I){x[A]=!0}),x})(c);if(r.showHidden&&(c=Object.getOwnPropertyNames(e)),o7(e)&&(c.indexOf("message")>=0||c.indexOf("description")>=0))return BZ(e);if(c.length===0){if(OE(e)){var g=e.name?": "+e.name:"";return r.stylize("[Function"+g+"]","special")}if(a7(e))return r.stylize(RegExp.prototype.toString.call(e),"regexp");if(ST(e))return r.stylize(Date.prototype.toString.call(e),"date");if(o7(e))return BZ(e)}var M,y="",w=!1,S=["{","}"];return YIt(e)&&(w=!0,S=["[","]"]),OE(e)&&(y=" [Function"+(e.name?": "+e.name:"")+"]"),a7(e)&&(y=" "+RegExp.prototype.toString.call(e)),ST(e)&&(y=" "+Date.prototype.toUTCString.call(e)),o7(e)&&(y=" "+BZ(e)),c.length!==0||w&&e.length!=0?a<0?a7(e)?r.stylize(RegExp.prototype.toString.call(e),"regexp"):r.stylize("[Object]","special"):(r.seen.push(e),M=w?(function(_,x,A,I,B){for(var P=[],O=0,C=x.length;O<C;++O)XIt(x,String(O))?P.push(PZ(_,x,A,I,String(O),!0)):P.push("");return B.forEach(function(K){K.match(/^\d+$/)||P.push(PZ(_,x,A,I,K,!0))}),P})(r,e,a,b,c):c.map(function(_){return PZ(r,e,a,b,_,w)}),r.seen.pop(),(function(_,x,A){var I=0;return _.reduce(function(B,P){return I++,P.indexOf(`
61
61
  `)>=0&&I++,B+P.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?A[0]+(x===""?"":x+`
62
62
  `)+" "+_.join(`,
63
63
  `)+" "+A[1]:A[0]+x+" "+_.join(", ")+" "+A[1]})(M,y,S)):S[0]+y+S[1]}function BZ(r){return"["+Error.prototype.toString.call(r)+"]"}function PZ(r,e,a,l,i,c){var b,g,M;if((M=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?g=M.set?r.stylize("[Getter/Setter]","special"):r.stylize("[Getter]","special"):M.set&&(g=r.stylize("[Setter]","special")),XIt(l,i)||(b="["+i+"]"),g||(r.seen.indexOf(M.value)<0?(g=MT(a)?wT(r,M.value,null):wT(r,M.value,a-1)).indexOf(`
@@ -148,7 +148,7 @@ Use Chrome, Firefox or Internet Explorer 11`)},U5=en.Buffer,bX=Oh.Transform,bi(V
148
148
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...a){let l=new this(e);return a.forEach(i=>l.set(i)),l}static accessor(e){let l=(this[hUt]=this[hUt]={accessors:{}}).accessors,i=this.prototype;function c(b){let g=Bw(b);l[g]||(R8e(i,b),l[g]=!0)}return je.isArray(e)?e.forEach(c):c(e),this}};W3.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(W3.prototype,({value:r},e)=>{let a=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(l){this[a]=l}}});je.freezeMethods(W3);var Yo=W3;function Pw(r,e){let a=this||Z3,l=e||a,i=Yo.from(l.headers),c=l.data;return je.forEach(r,function(g){c=g.call(a,c,i.normalize(),e?e.status:void 0)}),i.normalize(),c}Et();Rt();At();function Nw(r){return!!(r&&r.__CANCEL__)}Et();Rt();At();function uUt(r,e,a){Xr.call(this,r??"canceled",Xr.ERR_CANCELED,e,a),this.name="CanceledError"}je.inherits(uUt,Xr,{__CANCEL__:!0});var Jd=uUt;Et();Rt();At();Et();Rt();At();Et();Rt();At();function Ow(r,e,a){let l=a.config.validateStatus;!a.status||!l||l(a.status)?r(a):e(new Xr("Request failed with status code "+a.status,[Xr.ERR_BAD_REQUEST,Xr.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}Et();Rt();At();function kat(r){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}Et();Rt();At();Et();Rt();At();function I8e(r,e){r=r||10;let a=new Array(r),l=new Array(r),i=0,c=0,b;return e=e!==void 0?e:1e3,function(M){let y=Date.now(),w=l[c];b||(b=y),a[i]=M,l[i]=y;let S=c,_=0;for(;S!==i;)_+=a[S++],S=S%r;if(i=(i+1)%r,i===c&&(c=(c+1)%r),y-b<e)return;let x=w&&y-w;return x?Math.round(_*1e3/x):void 0}}var lUt=I8e;Et();Rt();At();function k8e(r,e){let a=0,l=1e3/e,i,c,b=(y,w=Date.now())=>{a=w,i=null,c&&(clearTimeout(c),c=null),r(...y)};return[(...y)=>{let w=Date.now(),S=w-a;S>=l?b(y,w):(i=y,c||(c=setTimeout(()=>{c=null,b(i)},l-S)))},()=>i&&b(i)]}var dUt=k8e;var G3=(r,e,a=3)=>{let l=0,i=lUt(50,250);return dUt(c=>{let b=c.loaded,g=c.lengthComputable?c.total:void 0,M=b-l,y=i(M),w=b<=g;l=b;let S={loaded:b,total:g,progress:g?b/g:void 0,bytes:M,rate:y||void 0,estimated:y&&g&&w?(g-b)/y:void 0,event:c,lengthComputable:g!=null,[e?"download":"upload"]:!0};r(S)},a)},Tat=(r,e)=>{let a=r!=null;return[l=>e[0]({lengthComputable:a,total:r,loaded:l}),e[1]]},Bat=r=>(...e)=>je.asap(()=>r(...e));Et();Rt();At();Et();Rt();At();var cUt=to.hasStandardBrowserEnv?((r,e)=>a=>(a=new URL(a,to.origin),r.protocol===a.protocol&&r.host===a.host&&(e||r.port===a.port)))(new URL(to.origin),to.navigator&&/(msie|trident)/i.test(to.navigator.userAgent)):()=>!0;Et();Rt();At();var pUt=to.hasStandardBrowserEnv?{write(r,e,a,l,i,c){let b=[r+"="+encodeURIComponent(e)];je.isNumber(a)&&b.push("expires="+new Date(a).toGMTString()),je.isString(l)&&b.push("path="+l),je.isString(i)&&b.push("domain="+i),c===!0&&b.push("secure"),document.cookie=b.join("; ")},read(r){let e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};Et();Rt();At();Et();Rt();At();function Pat(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}Et();Rt();At();function Nat(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Cw(r,e,a){let l=!Pat(e);return r&&(l||a==!1)?Nat(r,e):e}Et();Rt();At();var mUt=r=>r instanceof Yo?{...r}:r;function Nl(r,e){e=e||{};let a={};function l(y,w,S,_){return je.isPlainObject(y)&&je.isPlainObject(w)?je.merge.call({caseless:_},y,w):je.isPlainObject(w)?je.merge({},w):je.isArray(w)?w.slice():w}function i(y,w,S,_){if(je.isUndefined(w)){if(!je.isUndefined(y))return l(void 0,y,S,_)}else return l(y,w,S,_)}function c(y,w){if(!je.isUndefined(w))return l(void 0,w)}function b(y,w){if(je.isUndefined(w)){if(!je.isUndefined(y))return l(void 0,y)}else return l(void 0,w)}function g(y,w,S){if(S in e)return l(y,w);if(S in r)return l(void 0,y)}let M={url:c,method:c,data:c,baseURL:b,transformRequest:b,transformResponse:b,paramsSerializer:b,timeout:b,timeoutMessage:b,withCredentials:b,withXSRFToken:b,adapter:b,responseType:b,xsrfCookieName:b,xsrfHeaderName:b,onUploadProgress:b,onDownloadProgress:b,decompress:b,maxContentLength:b,maxBodyLength:b,beforeRedirect:b,transport:b,httpAgent:b,httpsAgent:b,cancelToken:b,socketPath:b,responseEncoding:b,validateStatus:g,headers:(y,w,S)=>i(mUt(y),mUt(w),S,!0)};return je.forEach(Object.keys({...r,...e}),function(w){let S=M[w]||i,_=S(r[w],e[w],w);je.isUndefined(_)&&S!==g||(a[w]=_)}),a}var eP=r=>{let e=Nl({},r),{data:a,withXSRFToken:l,xsrfHeaderName:i,xsrfCookieName:c,headers:b,auth:g}=e;if(e.headers=b=Yo.from(b),e.url=Tw(Cw(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),g&&b.set("Authorization","Basic "+btoa((g.username||"")+":"+(g.password?unescape(encodeURIComponent(g.password)):""))),je.isFormData(a)){if(to.hasStandardBrowserEnv||to.hasStandardBrowserWebWorkerEnv)b.setContentType(void 0);else if(je.isFunction(a.getHeaders)){let M=a.getHeaders(),y=["content-type","content-length"];Object.entries(M).forEach(([w,S])=>{y.includes(w.toLowerCase())&&b.set(w,S)})}}if(to.hasStandardBrowserEnv&&(l&&je.isFunction(l)&&(l=l(e)),l||l!==!1&&cUt(e.url))){let M=i&&c&&pUt.read(c);M&&b.set(i,M)}return e};var T8e=typeof XMLHttpRequest<"u",vUt=T8e&&function(r){return new Promise(function(a,l){let i=eP(r),c=i.data,b=Yo.from(i.headers).normalize(),{responseType:g,onUploadProgress:M,onDownloadProgress:y}=i,w,S,_,x,A;function I(){x&&x(),A&&A(),i.cancelToken&&i.cancelToken.unsubscribe(w),i.signal&&i.signal.removeEventListener("abort",w)}let B=new XMLHttpRequest;B.open(i.method.toUpperCase(),i.url,!0),B.timeout=i.timeout;function P(){if(!B)return;let C=Yo.from("getAllResponseHeaders"in B&&B.getAllResponseHeaders()),W={data:!g||g==="text"||g==="json"?B.responseText:B.response,status:B.status,statusText:B.statusText,headers:C,config:r,request:B};Ow(function(U){a(U),I()},function(U){l(U),I()},W),B=null}"onloadend"in B?B.onloadend=P:B.onreadystatechange=function(){!B||B.readyState!==4||B.status===0&&!(B.responseURL&&B.responseURL.indexOf("file:")===0)||setTimeout(P)},B.onabort=function(){B&&(l(new Xr("Request aborted",Xr.ECONNABORTED,r,B)),B=null)},B.onerror=function(K){let W=K&&K.message?K.message:"Network Error",J=new Xr(W,Xr.ERR_NETWORK,r,B);J.event=K||null,l(J),B=null},B.ontimeout=function(){let K=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",W=i.transitional||XB;i.timeoutErrorMessage&&(K=i.timeoutErrorMessage),l(new Xr(K,W.clarifyTimeoutError?Xr.ETIMEDOUT:Xr.ECONNABORTED,r,B)),B=null},c===void 0&&b.setContentType(null),"setRequestHeader"in B&&je.forEach(b.toJSON(),function(K,W){B.setRequestHeader(W,K)}),je.isUndefined(i.withCredentials)||(B.withCredentials=!!i.withCredentials),g&&g!=="json"&&(B.responseType=i.responseType),y&&([_,A]=G3(y,!0),B.addEventListener("progress",_)),M&&B.upload&&([S,x]=G3(M),B.upload.addEventListener("progress",S),B.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(w=C=>{B&&(l(!C||C.type?new Jd(null,r,B):C),B.abort(),B=null)},i.cancelToken&&i.cancelToken.subscribe(w),i.signal&&(i.signal.aborted?w():i.signal.addEventListener("abort",w)));let O=kat(i.url);if(O&&to.protocols.indexOf(O)===-1){l(new Xr("Unsupported protocol "+O+":",Xr.ERR_BAD_REQUEST,r));return}B.send(c||null)})};Et();Rt();At();Et();Rt();At();var B8e=(r,e)=>{let{length:a}=r=r?r.filter(Boolean):[];if(e||a){let l=new AbortController,i,c=function(y){if(!i){i=!0,g();let w=y instanceof Error?y:this.reason;l.abort(w instanceof Xr?w:new Jd(w instanceof Error?w.message:w))}},b=e&&setTimeout(()=>{b=null,c(new Xr(`timeout ${e} of ms exceeded`,Xr.ETIMEDOUT))},e),g=()=>{r&&(b&&clearTimeout(b),b=null,r.forEach(y=>{y.unsubscribe?y.unsubscribe(c):y.removeEventListener("abort",c)}),r=null)};r.forEach(y=>y.addEventListener("abort",c));let{signal:M}=l;return M.unsubscribe=()=>je.asap(g),M}},bUt=B8e;Et();Rt();At();var P8e=function*(r,e){let a=r.byteLength;if(!e||a<e){yield r;return}let l=0,i;for(;l<a;)i=l+e,yield r.slice(l,i),l=i},N8e=async function*(r,e){for await(let a of O8e(r))yield*P8e(a,e)},O8e=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}let e=r.getReader();try{for(;;){let{done:a,value:l}=await e.read();if(a)break;yield l}}finally{await e.cancel()}},Oat=(r,e,a,l)=>{let i=N8e(r,e),c=0,b,g=M=>{b||(b=!0,l&&l(M))};return new ReadableStream({async pull(M){try{let{done:y,value:w}=await i.next();if(y){g(),M.close();return}let S=w.byteLength;if(a){let _=c+=S;a(_)}M.enqueue(new Uint8Array(w))}catch(y){throw g(y),y}},cancel(M){return g(M),i.return()}},{highWaterMark:2})};var gUt=64*1024,{isFunction:rP}=je,_Ut=(({fetch:r,Request:e,Response:a})=>({fetch:r,Request:e,Response:a}))(je.global),{ReadableStream:yUt,TextEncoder:wUt}=je.global,MUt=(r,...e)=>{try{return!!r(...e)}catch{return!1}},C8e=r=>{let{fetch:e,Request:a,Response:l}=Object.assign({},_Ut,r),i=rP(e),c=rP(a),b=rP(l);if(!i)return!1;let g=i&&rP(yUt),M=i&&(typeof wUt=="function"?(A=>I=>A.encode(I))(new wUt):async A=>new Uint8Array(await new a(A).arrayBuffer())),y=c&&g&&MUt(()=>{let A=!1,I=new a(to.origin,{body:new yUt,method:"POST",get duplex(){return A=!0,"half"}}).headers.has("Content-Type");return A&&!I}),w=b&&g&&MUt(()=>je.isReadableStream(new l("").body)),S={stream:w&&(A=>A.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(A=>{!S[A]&&(S[A]=(I,B)=>{let P=I&&I[A];if(P)return P.call(I);throw new Xr(`Response type '${A}' is not supported`,Xr.ERR_NOT_SUPPORT,B)})});let _=async A=>{if(A==null)return 0;if(je.isBlob(A))return A.size;if(je.isSpecCompliantForm(A))return(await new a(to.origin,{method:"POST",body:A}).arrayBuffer()).byteLength;if(je.isArrayBufferView(A)||je.isArrayBuffer(A))return A.byteLength;if(je.isURLSearchParams(A)&&(A=A+""),je.isString(A))return(await M(A)).byteLength},x=async(A,I)=>{let B=je.toFiniteNumber(A.getContentLength());return B??_(I)};return async A=>{let{url:I,method:B,data:P,signal:O,cancelToken:C,timeout:K,onDownloadProgress:W,onUploadProgress:J,responseType:U,headers:q,withCredentials:V="same-origin",fetchOptions:h}=eP(A);U=U?(U+"").toLowerCase():"text";let t=bUt([O,C&&C.toAbortSignal()],K),n=null,s=t&&t.unsubscribe&&(()=>{t.unsubscribe()}),u;try{if(J&&y&&B!=="get"&&B!=="head"&&(u=await x(q,P))!==0){let m=new a(I,{method:"POST",body:P,duplex:"half"}),E;if(je.isFormData(P)&&(E=m.headers.get("content-type"))&&q.setContentType(E),m.body){let[R,k]=Tat(u,G3(Bat(J)));P=Oat(m.body,gUt,R,k)}}je.isString(V)||(V=V?"include":"omit");let d=c&&"credentials"in a.prototype,v={...h,signal:t,method:B.toUpperCase(),headers:q.normalize().toJSON(),body:P,duplex:"half",credentials:d?V:void 0};n=c&&new a(I,v);let p=await(c?e(n,h):e(I,v)),f=w&&(U==="stream"||U==="response");if(w&&(W||f&&s)){let m={};["status","statusText","headers"].forEach(L=>{m[L]=p[L]});let E=je.toFiniteNumber(p.headers.get("content-length")),[R,k]=W&&Tat(E,G3(Bat(W),!0))||[];p=new l(Oat(p.body,gUt,R,()=>{k&&k(),s&&s()}),m)}U=U||"text";let o=await S[je.findKey(S,U)||"text"](p,A);return!f&&s&&s(),await new Promise((m,E)=>{Ow(m,E,{data:o,headers:Yo.from(p.headers),status:p.status,statusText:p.statusText,config:A,request:n})})}catch(d){throw s&&s(),d&&d.name==="TypeError"&&/Load failed|fetch/i.test(d.message)?Object.assign(new Xr("Network Error",Xr.ERR_NETWORK,A,n),{cause:d.cause||d}):Xr.from(d,d&&d.code,A,n)}}},L8e=new Map,Cat=r=>{let e=je.merge.call({skipUndefined:!0},_Ut,r?r.env:null),{fetch:a,Request:l,Response:i}=e,c=[l,i,a],b=c.length,g=b,M,y,w=L8e;for(;g--;)M=c[g],y=w.get(M),y===void 0&&w.set(M,y=g?new Map:C8e(e)),w=y;return y},dWe=Cat();var Lat={http:YB,xhr:vUt,fetch:{get:Cat}};je.forEach(Lat,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});var SUt=r=>`- ${r}`,$8e=r=>je.isFunction(r)||r===null||r===!1,iP={getAdapter:(r,e)=>{r=je.isArray(r)?r:[r];let{length:a}=r,l,i,c={};for(let b=0;b<a;b++){l=r[b];let g;if(i=l,!$8e(l)&&(i=Lat[(g=String(l)).toLowerCase()],i===void 0))throw new Xr(`Unknown adapter '${g}'`);if(i&&(je.isFunction(i)||(i=i.get(e))))break;c[g||"#"+b]=i}if(!i){let b=Object.entries(c).map(([M,y])=>`adapter ${M} `+(y===!1?"is not supported by the environment":"is not available in the build")),g=a?b.length>1?`since :
149
149
  `+b.map(SUt).join(`
150
150
  `):" "+SUt(b[0]):"as no adapter specified";throw new Xr("There is no suitable adapter to dispatch the request "+g,"ERR_NOT_SUPPORT")}return i},adapters:Lat};function Dat(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Jd(null,r)}function nP(r){return Dat(r),r.headers=Yo.from(r.headers),r.data=Pw.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),iP.getAdapter(r.adapter||Z3.adapter,r)(r).then(function(l){return Dat(r),l.data=Pw.call(r,r.transformResponse,l),l.headers=Yo.from(l.headers),l},function(l){return Nw(l)||(Dat(r),l&&l.response&&(l.response.data=Pw.call(r,r.transformResponse,l.response),l.response.headers=Yo.from(l.response.headers))),Promise.reject(l)})}Et();Rt();At();Et();Rt();At();var aP="1.12.0";var oP={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{oP[r]=function(l){return typeof l===r||"a"+(e<1?"n ":" ")+r}});var xUt={};oP.transitional=function(e,a,l){function i(c,b){return"[Axios v"+aP+"] Transitional option '"+c+"'"+b+(l?". "+l:"")}return(c,b,g)=>{if(e===!1)throw new Xr(i(b," has been removed"+(a?" in "+a:"")),Xr.ERR_DEPRECATED);return a&&!xUt[b]&&(xUt[b]=!0,console.warn(i(b," has been deprecated since v"+a+" and will be removed in the near future"))),e?e(c,b,g):!0}};oP.spelling=function(e){return(a,l)=>(console.warn(`${l} is likely a misspelling of ${e}`),!0)};function q8e(r,e,a){if(typeof r!="object")throw new Xr("options must be an object",Xr.ERR_BAD_OPTION_VALUE);let l=Object.keys(r),i=l.length;for(;i-- >0;){let c=l[i],b=e[c];if(b){let g=r[c],M=g===void 0||b(g,c,r);if(M!==!0)throw new Xr("option "+c+" must be "+M,Xr.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Xr("Unknown option "+c,Xr.ERR_BAD_OPTION)}}var Lw={assertOptions:q8e,validators:oP};var Xd=Lw.validators,V3=class{constructor(e){this.defaults=e||{},this.interceptors={request:new _at,response:new _at}}async request(e,a){try{return await this._request(e,a)}catch(l){if(l instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;let c=i.stack?i.stack.replace(/^.+\n/,""):"";try{l.stack?c&&!String(l.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(l.stack+=`
151
- `+c):l.stack=c}catch{}}throw l}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=Nl(this.defaults,a);let{transitional:l,paramsSerializer:i,headers:c}=a;l!==void 0&&Lw.assertOptions(l,{silentJSONParsing:Xd.transitional(Xd.boolean),forcedJSONParsing:Xd.transitional(Xd.boolean),clarifyTimeoutError:Xd.transitional(Xd.boolean)},!1),i!=null&&(je.isFunction(i)?a.paramsSerializer={serialize:i}:Lw.assertOptions(i,{encode:Xd.function,serialize:Xd.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),Lw.assertOptions(a,{baseUrl:Xd.spelling("baseURL"),withXsrfToken:Xd.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let b=c&&je.merge(c.common,c[a.method]);c&&je.forEach(["delete","get","head","post","put","patch","common"],A=>{delete c[A]}),a.headers=Yo.concat(b,c);let g=[],M=!0;this.interceptors.request.forEach(function(I){typeof I.runWhen=="function"&&I.runWhen(a)===!1||(M=M&&I.synchronous,g.unshift(I.fulfilled,I.rejected))});let y=[];this.interceptors.response.forEach(function(I){y.push(I.fulfilled,I.rejected)});let w,S=0,_;if(!M){let A=[nP.bind(this),void 0];for(A.unshift(...g),A.push(...y),_=A.length,w=Promise.resolve(a);S<_;)w=w.then(A[S++],A[S++]);return w}_=g.length;let x=a;for(S=0;S<_;){let A=g[S++],I=g[S++];try{x=A(x)}catch(B){I.call(this,B);break}}try{w=nP.call(this,x)}catch(A){return Promise.reject(A)}for(S=0,_=y.length;S<_;)w=w.then(y[S++],y[S++]);return w}getUri(e){e=Nl(this.defaults,e);let a=Cw(e.baseURL,e.url,e.allowAbsoluteUrls);return Tw(a,e.params,e.paramsSerializer)}};je.forEach(["delete","get","head","options"],function(e){V3.prototype[e]=function(a,l){return this.request(Nl(l||{},{method:e,url:a,data:(l||{}).data}))}});je.forEach(["post","put","patch"],function(e){function a(l){return function(c,b,g){return this.request(Nl(g||{},{method:e,headers:l?{"Content-Type":"multipart/form-data"}:{},url:c,data:b}))}}V3.prototype[e]=a(),V3.prototype[e+"Form"]=a(!0)});var Dw=V3;Et();Rt();At();var $at=class r{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});let l=this;this.promise.then(i=>{if(!l._listeners)return;let c=l._listeners.length;for(;c-- >0;)l._listeners[c](i);l._listeners=null}),this.promise.then=i=>{let c,b=new Promise(g=>{l.subscribe(g),c=g}).then(i);return b.cancel=function(){l.unsubscribe(c)},b},e(function(c,b,g){l.reason||(l.reason=new Jd(c,b,g),a(l.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){let e=new AbortController,a=l=>{e.abort(l)};return this.subscribe(a),e.signal.unsubscribe=()=>this.unsubscribe(a),e.signal}static source(){let e;return{token:new r(function(i){e=i}),cancel:e}}},EUt=$at;Et();Rt();At();function qat(r){return function(a){return r.apply(null,a)}}Et();Rt();At();function Uat(r){return je.isObject(r)&&r.isAxiosError===!0}Et();Rt();At();var jat={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(jat).forEach(([r,e])=>{jat[e]=r});var AUt=jat;function RUt(r){let e=new Dw(r),a=Aw(Dw.prototype.request,e);return je.extend(a,Dw.prototype,e,{allOwnKeys:!0}),je.extend(a,e,null,{allOwnKeys:!0}),a.create=function(i){return RUt(Nl(r,i))},a}var Bo=RUt(Z3);Bo.Axios=Dw;Bo.CanceledError=Jd;Bo.CancelToken=EUt;Bo.isCancel=Nw;Bo.VERSION=aP;Bo.toFormData=Km;Bo.AxiosError=Xr;Bo.Cancel=Bo.CanceledError;Bo.all=function(e){return Promise.all(e)};Bo.spread=qat;Bo.isAxiosError=Uat;Bo.mergeConfig=Nl;Bo.AxiosHeaders=Yo;Bo.formToJSON=r=>QB(je.isHTMLForm(r)?new FormData(r):r);Bo.getAdapter=iP.getAdapter;Bo.HttpStatusCode=AUt;Bo.default=Bo;var sP=Bo;var{Axios:zGe,AxiosError:FGe,CanceledError:HGe,isCancel:KGe,CancelToken:ZGe,VERSION:WGe,all:GGe,Cancel:VGe,isAxiosError:YGe,spread:JGe,toFormData:XGe,AxiosHeaders:QGe,HttpStatusCode:tVe,formToJSON:eVe,getAdapter:rVe,mergeConfig:iVe}=sP;Et();Rt();At();var BUt=An(kUt(),1),zat="axios-retry";function PUt(r){let e=["ERR_CANCELED","ECONNABORTED"];return r.response||!r.code||e.includes(r.code)?!1:(0,BUt.default)(r)}var NUt=["get","head","options"],j8e=NUt.concat(["put","delete"]);function Fat(r){return r.code!=="ECONNABORTED"&&(!r.response||r.response.status===429||r.response.status>=500&&r.response.status<=599)}function z8e(r){return r.config?.method?Fat(r)&&NUt.indexOf(r.config.method)!==-1:!1}function OUt(r){return r.config?.method?Fat(r)&&j8e.indexOf(r.config.method)!==-1:!1}function CUt(r){return PUt(r)||OUt(r)}function Hat(r=void 0){let e=r?.response?.headers["retry-after"];if(!e)return 0;let a=(Number(e)||0)*1e3;return a===0&&(a=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,a)}function F8e(r=0,e=void 0){return Math.max(0,Hat(e))}function H8e(r=0,e=void 0,a=100){let l=2**r*a,i=Math.max(l,Hat(e)),c=i*.2*Math.random();return i+c}function K8e(r=100){return(e=0,a=void 0)=>{let l=e*r;return Math.max(l,Hat(a))}}var Z8e={retries:3,retryCondition:CUt,retryDelay:F8e,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function W8e(r,e){return{...Z8e,...e,...r[zat]}}function TUt(r,e,a=!1){let l=W8e(r,e||{});return l.retryCount=l.retryCount||0,(!l.lastRequestTime||a)&&(l.lastRequestTime=Date.now()),r[zat]=l,l}function G8e(r,e){r.defaults.agent===e.agent&&delete e.agent,r.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,r.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function V8e(r,e){let{retries:a,retryCondition:l}=r,i=(r.retryCount||0)<a&&l(e);if(typeof i=="object")try{return await i!==!1}catch{return!1}return i}async function Y8e(r,e,a,l){e.retryCount+=1;let{retryDelay:i,shouldResetTimeout:c,onRetry:b}=e,g=i(e.retryCount,a);if(G8e(r,l),!c&&l.timeout&&e.lastRequestTime){let M=Date.now()-e.lastRequestTime,y=l.timeout-M-g;if(y<=0)return Promise.reject(a);l.timeout=y}return l.transformRequest=[M=>M],await b(e.retryCount,a,l),l.signal?.aborted?Promise.resolve(r(l)):new Promise(M=>{let y=()=>{clearTimeout(w),M(r(l))},w=setTimeout(()=>{M(r(l)),l.signal?.removeEventListener&&l.signal.removeEventListener("abort",y)},g);l.signal?.addEventListener&&l.signal.addEventListener("abort",y,{once:!0})})}async function J8e(r,e){r.retryCount>=r.retries&&await r.onMaxRetryTimesExceeded(e,r.retryCount)}var Zm=(r,e)=>{let a=r.interceptors.request.use(i=>(TUt(i,e,!0),i[zat]?.validateResponse&&(i.validateStatus=()=>!1),i)),l=r.interceptors.response.use(null,async i=>{let{config:c}=i;if(!c)return Promise.reject(i);let b=TUt(c,e);return i.response&&b.validateResponse?.(i.response)?i.response:await V8e(b,i)?Y8e(r,b,i,c):(await J8e(b,i),Promise.reject(i))});return{requestInterceptorId:a,responseInterceptorId:l}};Zm.isNetworkError=PUt;Zm.isSafeRequestError=z8e;Zm.isIdempotentRequestError=OUt;Zm.isNetworkOrIdempotentRequestError=CUt;Zm.exponentialDelay=H8e;Zm.linearDelay=K8e;Zm.isRetryableError=Fat;var fP=Zm;var LUt=({axiosConfig:r={},logger:e=$a.default,retryConfig:a={retries:5,retryDelay:fP.exponentialDelay,retryCondition:l=>fP.isRetryableError(l),onRetry(l,i,c){e.error(`Retrying request ${c.url} attempt ${l}`,i)}}}={})=>{let l=sP.create({...r,maxRedirects:0,headers:{...r.headers,"x-source-version":`${Kp}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return fP(l,a),l};Et();Rt();At();var Kat=({baseUrl:r,params:e})=>{let a=new URL(r);return Object.entries(e).forEach(([l,i])=>{if(i!=null)if(Array.isArray(i)&&i.length>0)for(let c of i)c!=null&&a.searchParams.append(l,c.toString());else a.searchParams.set(l,i.toString())}),a.toString()};async function X8e({signer:r,nonce:e=mat()}){let a,l,i=hP(r)?Hr.ARWEAVE:r.signatureType;switch(hP(r)?a=z6(Ft.from(await r.signMessage(Uint8Array.from(Ft.from(e))))):r instanceof sl?a=z6(Ft.from(await r.signer.signMessage(Uint8Array.from(Ft.from(e))))):(r instanceof Vu||r instanceof ks||r instanceof fv)&&("setPublicKey"in r&&r.publicKey===void 0&&await r.setPublicKey(),a=z6(Ft.from(await r.sign(Uint8Array.from(Ft.from(e)))))),i){case Hr.ARWEAVE:hP(r)?l=await r.getActivePublicKey():"setPublicKey"in r?(await r.setPublicKey(),l=z6(r.publicKey)):"publicKey"in r&&(l=z6(r.publicKey));break;case Hr.ETHEREUM:if("publicKey"in r)l="0x"+r.publicKey.toString("hex");else throw new Error("Public key not found");break;default:throw new Error(`Unsupported signer type for signing requests: ${i}`)}if(l===void 0||a===void 0)throw new Error("Public key or signature not found");return{"x-public-key":l,"x-nonce":e,"x-signature":a,"x-signature-type":i.toString()}}var $w=class{static init(e){let{signer:a,paymentUrl:l,axios:i,logger:c}=e??{};return a!==void 0?new Wm({signer:a,paymentUrl:l,axios:i,logger:c}):new uP({paymentUrl:l,axios:i,logger:c})}},uP=class{paymentUrl;axios;logger;constructor({paymentUrl:e="https://payment.ardrive.io",axios:a=LUt(),logger:l=$a.default}){this.paymentUrl=e,this.axios=a,this.logger=l}async getArNSPriceDetails({intent:e,name:a,quantity:l,type:i,years:c}){let b=Kat({baseUrl:`${this.paymentUrl}/v1/arns/price/${e}/${a}`,params:{increaseQty:l,type:i,years:c}}),{data:g,status:M}=await this.axios.get(b);if(this.logger.debug("getArNSPriceDetails",{intent:e,name:a,quantity:l,type:i,years:c,data:g,status:M}),M!==200)throw new Error("Failed to get ArNS purchase price "+JSON.stringify(g));if(!g.winc||!g.mARIO)throw new Error("Invalid response from Turbo "+JSON.stringify(g));return{winc:g.winc,mARIO:new Ew(+g.mARIO)}}async getPrice(e){let{winc:a}=await this.getArNSPriceDetails(e);return+a}},Wm=class extends uP{signer;constructor({signer:e,...a}){if(super(a),!Zat(e))throw new Error("Signer must be a TurboArNSSigner");this.signer=e}async initiateArNSPurchase({intent:e,name:a,quantity:l,type:i,processId:c,years:b,paidBy:g=[],referrer:M}){let y=Kat({baseUrl:`${this.paymentUrl}/v1/arns/purchase/${e}/${a}`,params:{increaseQty:l,processId:c,type:i,years:b,paidBy:g,referrer:M}}),w=await X8e({signer:this.signer}),{data:S,status:_}=await this.axios.post(y,null,{headers:w});if(this.logger.debug("Initiated ArNS purchase",{intent:e,name:a,quantity:l,processId:c,type:i,years:b,data:S,status:_}),_!==200)throw new Error("Failed to initiate ArNS purchase "+JSON.stringify(S));return{id:S.arioWriteResult.id,result:S.purchaseReceipt}}};function hP(r){return typeof r=="object"&&r!==null&&"signMessage"in r&&"getActivePublicKey"in r}function Zat(r){let e=hP(r),a=r instanceof ks||r instanceof fv||r instanceof Vu||r instanceof sl;return e||a}var K6=class{static init(e){return e!==void 0&&"signer"in e?new qw(e):new Y3(e)}static mainnet(e){return e!==void 0&&"signer"in e?new qw({...e,process:new Fn({processId:ef,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}):new Y3({...e,process:new Fn({processId:ef,ao:Fh({CU_URL:"https://cu.ardrive.io",MODE:"legacy",...e?.process?.ao})})})}static testnet(e){return e!==void 0&&"signer"in e?lat({arioInstance:new qw({...e,process:new Fn({processId:SZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl}):lat({arioInstance:new Y3({...e,process:new Fn({processId:SZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl})}},Y3=class{process;epochSettings;arweave;hyperbeamUrl;paymentProvider;logger=$a.default;constructor(e){if(this.arweave=e?.arweave??KB,this.hyperbeamUrl=e?.hyperbeamUrl,e===void 0||Object.keys(e).length===0)this.process=new Fn({processId:ef});else if(Vm(e))this.process=e.process;else if(Ym(e))this.process=new Fn({processId:e.processId});else throw new Wd;this.paymentProvider=$w.init({paymentUrl:e?.paymentUrl})}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getTokenSupply(){return this.process.read({tags:[{name:"Action",value:"Total-Token-Supply"}]})}async computeEpochIndexForTimestamp(e){let a=await this.getEpochSettings(),l=a.epochZeroStartTimestamp,i=a.durationMs;return Math.floor((e-l)/i)}async computeCurrentEpochIndex(){return this.computeEpochIndexForTimestamp(Date.now())}async computeEpochIndex(e){let a=e?.epochIndex;if(a!==void 0)return a;let l=e?.timestamp;if(l!==void 0)return this.computeEpochIndexForTimestamp(l)}async getEpochSettings(){return this.epochSettings??=await this.process.read({tags:[{name:"Action",value:"Epoch-Settings"}]})}async getEpoch(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(!c)throw new Error("Epoch data not found for epoch index "+a);return $Ut(c)}let i=[{name:"Action",value:"Epoch"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Records"},...hf(e)]})}async getArNSReservedNames(e){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"},...hf(e)]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Balances"},...hf(e)]})}async getVault({address:e,vaultId:a}){return this.process.read({tags:[{name:"Action",value:"Vault"},{name:"Address",value:e},{name:"Vault-Id",value:a}]})}async getVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Vaults"},...hf(e)]})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGatewayDelegates({address:e,...a}){return this.process.read({tags:[{name:"Action",value:"Paginated-Delegates"},{name:"Address",value:e},...hf(a)]})}async getGatewayDelegateAllowList({address:e,...a}){return this.process.read({tags:[{name:"Action",value:"Paginated-Allowed-Delegates"},{name:"Address",value:e},...hf(a)]})}async getGateways(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateways"},...hf(e)]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"}]})}async getPrescribedObservers(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({ao:this.process.ao,arweave:this.arweave,epochIndex:a,processId:this.process.processId});if(!c)throw new Error("Epoch data not found for epoch index "+a);return c.prescribedObservers}let i=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getPrescribedNames(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(!c)throw new Error("Epoch data not found for epoch index "+a);return c.prescribedNames}let i=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getObservations(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(!c)throw new Error("Epoch data not found for epoch index "+a);return c.observations}let i=[{name:"Action",value:"Epoch-Observations"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getDistributions(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(c===void 0)throw new Error("Epoch data not found for epoch index "+a);return c.distributions}let i=[{name:"Action",value:"Epoch-Distributions"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getEligibleEpochRewards(e,a){let l=await this.computeEpochIndex(e),i=await this.computeCurrentEpochIndex();if(l!==void 0&&l<i){let b=await H6({arweave:this.arweave,epochIndex:l,processId:this.process.processId,ao:this.process.ao});if(!b)throw new Error("Epoch data not found for epoch index "+l);return DUt(b,a)}let c=[{name:"Action",value:"Epoch-Eligible-Rewards"},...hf(a)];return this.process.read({tags:Ua(c)})}async getTokenCost({intent:e,type:a,years:l,name:i,quantity:c,fromAddress:b}){let M=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:e==="Buy-Record"?"Buy-Name":e},{name:"Name",value:i},{name:"Years",value:l?.toString()},{name:"Quantity",value:c?.toString()},{name:"Purchase-Type",value:a}];return this.process.read({tags:Ua(M),fromAddress:b})}async getCostDetails({intent:e,type:a,years:l,name:i,quantity:c,fromAddress:b,fundFrom:g}){let M=e==="Buy-Record"?"Buy-Name":e;if(g==="turbo"){let{mARIO:w,winc:S}=await this.paymentProvider.getArNSPriceDetails({intent:M,name:i,quantity:c,type:a,years:l});return{tokenCost:w.valueOf(),wincQty:S,discounts:[]}}let y=[{name:"Action",value:"Cost-Details"},{name:"Intent",value:M},{name:"Name",value:i},{name:"Years",value:l?.toString()},{name:"Quantity",value:c?.toString()},{name:"Purchase-Type",value:a},{name:"Fund-From",value:g}];return this.process.read({tags:Ua(y),fromAddress:b})}async getRegistrationFees(){return this.process.read({tags:[{name:"Action",value:"Registration-Fees"}]})}async getDemandFactor(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor"}]})}async getDemandFactorSettings(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor-Settings"}]})}async getArNSReturnedNames(e){return this.process.read({tags:[{name:"Action",value:"Returned-Names"},...hf(e)]})}async getArNSReturnedName({name:e}){let a=[{name:"Action",value:"Returned-Name"},{name:"Name",value:e}];return this.process.read({tags:a})}async getDelegations(e){let a=[{name:"Action",value:"Paginated-Delegations"},{name:"Address",value:e.address},...hf(e)];return this.process.read({tags:Ua(a)})}async getAllowedDelegates(e){return this.getGatewayDelegateAllowList(e)}async getGatewayVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateway-Vaults"},{name:"Address",value:e.address},...hf(e)]})}async getPrimaryNameRequest(e){let a=[{name:"Action",value:"Primary-Name-Request"},{name:"Initiator",value:e.initiator}];return this.process.read({tags:a})}async getPrimaryNameRequests(e){return this.process.read({tags:[{name:"Action",value:"Primary-Name-Requests"},...hf(e)]})}async getPrimaryName(e){let a=[{name:"Action",value:"Primary-Name"},{name:"Address",value:e?.address},{name:"Name",value:e?.name}];return this.process.read({tags:Ua(a)})}async getPrimaryNames(e){return this.process.read({tags:[{name:"Action",value:"Primary-Names"},...hf(e)]})}async getRedelegationFee(e){return this.process.read({tags:[{name:"Action",value:"Redelegation-Fee"},{name:"Address",value:e.address}]})}async getGatewayRegistrySettings(){return this.process.read({tags:[{name:"Action",value:"Gateway-Registry-Settings"}]})}async getAllDelegates(e){return this.process.read({tags:[{name:"Action",value:"All-Paginated-Delegates"},...hf(e)]})}async getAllGatewayVaults(e){return this.process.read({tags:[{name:"Action",value:"All-Gateway-Vaults"},...hf(e)]})}async resolveArNSName({name:e}){let a=e.lastIndexOf("_"),l=a===-1?e:e.slice(a+1),i=a===-1?"@":e.slice(0,a),c=await this.getArNSRecord({name:l});if(c===void 0||c.processId===void 0)throw new Error(`Base ArNS name ${l} not found on ARIO contract (${this.process.processId}).`);let b=xu.init({process:new Fn({ao:this.process.ao,processId:c.processId})}),[g,M]=await Promise.all([b.getOwner(),b.getRecord({undername:i})]);if(M===void 0)throw new Error(`Record for ${i} not found on ANT.`);if(M.ttlSeconds===void 0||M.transactionId===void 0)throw new Error(`Invalid record on ANT. Must have ttlSeconds and transactionId. Record: ${JSON.stringify(M)}`);return{name:e,owner:g,txId:M.transactionId,ttlSeconds:M.ttlSeconds,priority:M.priority,processId:c.processId,undernameLimit:c.undernameLimit,type:c.type}}async getArNSRecordsForAddress(e){let{antRegistryProcessId:a=kh,address:l}=e,i=R1.init({hyperbeamUrl:this.hyperbeamUrl,process:new Fn({ao:this.process.ao,processId:a})}),{Controlled:c=[],Owned:b=[]}=await i.accessControlList({address:l}),g=new Set([...c,...b]);return g.size===0?{items:[],hasMore:!1,nextCursor:void 0,limit:e.limit??1e3,totalItems:0,sortOrder:e.sortOrder??"asc"}:await this.getArNSRecords({...e,filters:{processId:Array.from(g)}})}},qw=class extends Y3{signer;paymentProvider;constructor({signer:e,paymentUrl:a,...l}){l===void 0?super({process:new Fn({processId:ef})}):super(l),this.signer=Gm(e),this.paymentProvider=$w.init({signer:Zat(e)?e:void 0,paymentUrl:a})}async transfer({target:e,qty:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:a.valueOf().toString()}],signer:this.signer})}async vaultedTransfer({recipient:e,quantity:a,lockLengthMs:l,revokable:i=!1},c){let{tags:b=[]}=c||{};return this.process.send({tags:[...b,{name:"Action",value:"Vaulted-Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:a.toString()},{name:"Lock-Length",value:l.toString()},{name:"Revokable",value:`${i}`}],signer:this.signer})}async revokeVault({vaultId:e,recipient:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Revoke-Vault"},{name:"Vault-Id",value:e},{name:"Recipient",value:a}],signer:this.signer})}async createVault({lockLengthMs:e,quantity:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Create-Vault"},{name:"Lock-Length",value:e.toString()},{name:"Quantity",value:a.toString()}],signer:this.signer})}async extendVault({vaultId:e,extendLengthMs:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Extend-Vault"},{name:"Vault-Id",value:e},{name:"Extend-Length",value:a.toString()}],signer:this.signer})}async increaseVault({vaultId:e,quantity:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Increase-Vault"},{name:"Vault-Id",value:e},{name:"Quantity",value:a.toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:a,allowedDelegates:l,delegateRewardShareRatio:i,fqdn:c,label:b,minDelegatedStake:g,note:M,port:y,properties:w,protocol:S,autoStake:_,observerAddress:x},A){let{tags:I=[]}=A||{},B=[...I,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:e.valueOf().toString()},{name:"Allow-Delegated-Staking",value:a?.toString()},{name:"Allowed-Delegates",value:l?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:i?.toString()},{name:"FQDN",value:c},{name:"Label",value:b},{name:"Min-Delegated-Stake",value:g?.valueOf().toString()},{name:"Note",value:M},{name:"Port",value:y?.toString()},{name:"Properties",value:w},{name:"Protocol",value:S},{name:"Auto-Stake",value:_?.toString()},{name:"Observer-Address",value:x}];return this.process.send({signer:this.signer,tags:Ua(B)})}async leaveNetwork(e){let{tags:a=[]}=e||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Leave-Network"}]})}async updateGatewaySettings({allowDelegatedStaking:e,allowedDelegates:a,delegateRewardShareRatio:l,fqdn:i,label:c,minDelegatedStake:b,note:g,port:M,properties:y,protocol:w,autoStake:S,observerAddress:_},x){let{tags:A=[]}=x||{},I=[...A,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:c},{name:"Note",value:g},{name:"FQDN",value:i},{name:"Port",value:M?.toString()},{name:"Properties",value:y},{name:"Protocol",value:w},{name:"Observer-Address",value:_},{name:"Allow-Delegated-Staking",value:e?.toString()},{name:"Allowed-Delegates",value:a?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:l?.toString()},{name:"Min-Delegated-Stake",value:b?.valueOf().toString()},{name:"Auto-Stake",value:S?.toString()}];return this.process.send({signer:this.signer,tags:Ua(I)})}async delegateStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async instantWithdrawal(e,a){let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Instant-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:Ua(i)})}async increaseOperatorStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async saveObservations(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:e.reportTxId},{name:"Failed-Gateways",value:e.failedGateways.join(",")}]})}async buyRecord(e,a){if(e.processId===void 0)try{let{nameTag:c,otherTags:b}=(a?.tags||[]).reduce((g,M)=>(M.name==="Name"?g.nameTag=M:g.otherTags.push(M),g),{nameTag:{name:"Name",value:e.name},otherTags:[]});e.processId=await xu.spawn({signer:this.signer,ao:this.process.ao,logger:this.logger,tags:[c,...b],onSigningProgress:a?.onSigningProgress})}catch(c){throw this.logger.error("Failed to spawn ANT for name purchase.",{error:c}),c}if(a?.onSigningProgress?.("buying-name",{name:e.name,years:e.years,type:e.type,processId:e.processId,fundFrom:e.fundFrom,referrer:e.referrer}),e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Buy-Name",name:e.name,years:e.years,type:e.type,processId:e.processId,paidBy:e.paidBy})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Buy-Name"},{name:"Name",value:e.name},{name:"Years",value:e.years?.toString()??"1"},{name:"Process-Id",value:e.processId},{name:"Purchase-Type",value:e.type||"lease"},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async upgradeRecord(e,a){if(e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Upgrade-Name",name:e.name})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Upgrade-Name"},{name:"Name",value:e.name},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async extendLease(e,a){if(e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Extend-Lease",name:e.name,years:e.years})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Extend-Lease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async increaseUndernameLimit(e,a){if(e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Increase-Undername-Limit",quantity:e.increaseCount,name:e.name})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async cancelWithdrawal(e,a){let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Cancel-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:Ua(i)})}async requestPrimaryName(e,a){if(e.fundFrom==="turbo")throw new Error("Turbo funding is not yet supported for primary name requests");let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Request-Primary-Name"},{name:"Name",value:e.name},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:Ua(i)})}async setPrimaryName(e,a){a?.onSigningProgress?.("requesting-primary-name",{name:e.name,fundFrom:e.fundFrom,referrer:e.referrer});let i=(await this.requestPrimaryName(e,a).catch(async y=>{if(y.message.includes("already exists")){let w=y.message.match(/by '([^']+)'/)?.[1];if(w===void 0)throw y;a?.onSigningProgress?.("request-already-exists",{name:e.name,initiator:w});let S=await this.getPrimaryNameRequest({initiator:w}),_=await this.getArNSRecord({name:e.name});if(_===void 0)throw new Error(`ARNS name '${e.name}' does not exist`);if(S.initiator!==w)throw new Error(`Primary name request for name '${e.name}' was not approved`);return{id:"stub-id",result:{request:S,baseNameOwner:_.processId,fundingPlan:{address:w}}}}throw y})).result,c=i?.baseNameOwner,b=i?.fundingPlan?.address;if(i===void 0||b===void 0||c===void 0)throw new Error(`Failed to request primary name ${e.name} for ${b} owned by ${c} process`);return a?.onSigningProgress?.("approving-request",{name:e.name,processId:c,request:i.request}),await xu.init({process:new Fn({processId:c,ao:this.process.ao}),signer:this.signer}).approvePrimaryNameRequest({name:e.name,address:b,arioProcessId:this.process.processId},a)}async redelegateStake(e,a){let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Redelegate-Stake"},{name:"Target",value:e.target},{name:"Source",value:e.source},{name:"Quantity",value:e.stakeQty.valueOf().toString()},{name:"Vault-Id",value:e.vaultId}];return this.process.send({signer:this.signer,tags:Ua(i)})}};var PJe=async({address:r,registry:e=R1.init()})=>{let a=await e.accessControlList({address:r});return[...new Set([...a.Owned,...a.Controlled])]};function qUt(r,e){return new Promise((a,l)=>{let i=setTimeout(()=>{l(new Error("Timeout"))},r);e.then(c=>{clearTimeout(i),a(c)}).catch(c=>{clearTimeout(i),l(c)})})}var UUt=class extends Pnt.default{contract;timeoutMs;throttle;logger;strict;antAoClient;constructor({contract:e=K6.init({processId:ef}),timeoutMs:a=6e4,concurrency:l=30,logger:i=$a.default,strict:c=!1,antAoClient:b=Fh({MODE:"legacy"})}={}){super(),this.contract=e,this.timeoutMs=a,this.throttle=G$t(l),this.logger=i,this.strict=c,this.antAoClient=b}async fetchProcessesOwnedByWallet({address:e,pageSize:a,antRegistry:l=R1.init()}){let i={},c=await l.accessControlList({address:e}),b=new Set([...c.Owned,...c.Controlled]);await qUt(this.timeoutMs,Q8e({contract:this.contract,emitter:this,pageSize:a})).catch(M=>(this.emit("error",`Error getting ArNS records: ${M}`),this.logger.error("Error getting ArNS records",{message:M?.message,stack:M?.stack}),{})).then(M=>{Object.entries(M).forEach(([y,w])=>{b.has(w.processId)&&(i[w.processId]==null&&(i[w.processId]={state:void 0,names:{}}),i[w.processId].names[y]=w)})});let g=Object.keys(i).length;this.emit("progress",0,g),await Promise.all(Object.keys(i).map(async(M,y)=>this.throttle(async()=>{if(i[M].state!==void 0){this.emit("progress",y+1,g);return}let w=xu.init({process:new Fn({processId:M,ao:this.antAoClient}),strict:this.strict}),S=await qUt(this.timeoutMs,w.getState()).catch(_=>{this.emit("error",`Error getting state for process ${M}: ${_}`)});(S?.Owner===e||S?.Controllers.includes(e))&&(i[M].state=S,this.emit("process",M,i[M])),this.emit("progress",y+1,g)}))),this.emit("end",i)}},Q8e=async({contract:r=K6.init({processId:ef}),emitter:e,logger:a=$a.default,pageSize:l=1e3})=>{let i,c=Date.now(),b={};do{let g=await r.getArNSRecords({cursor:i,limit:l}).catch(M=>{a?.error("Error getting ArNS records",{message:M?.message,stack:M?.stack}),e?.emit("arns:error",`Error getting ArNS records: ${M}`)});if(!g)return{};g.items.forEach(M=>{let{name:y,...w}=M;b[y]=w}),a.debug("Fetched page of ArNS records",{totalRecordCount:g.totalItems,fetchedRecordCount:Object.keys(b).length,cursor:g.nextCursor}),e?.emit("arns:pageLoaded",{totalRecordCount:g.totalItems,fetchedRecordCount:Object.keys(b).length,records:g.items,cursor:g.nextCursor}),i=g.nextCursor}while(i!==void 0);return e?.emit("arns:end",b),a.debug("Fetched all ArNS records",{totalRecordCount:Object.keys(b).length,durationMs:Date.now()-c}),b};var Fn=class{logger;ao;processId;constructor({processId:e,ao:a=Fh({MODE:"legacy"}),logger:l=$a.default}){this.processId=e,this.logger=l,this.ao=a}isMessageDataEmpty(e){return e===void 0||e==="null"||e===""||e===null}async read({tags:e,retries:a=3,fromAddress:l}){this.logger.debug("Evaluating read interaction on process",{tags:e,processId:this.processId});let i={process:this.processId,tags:e};l!==void 0&&(i.Owner=l);let c=0,b;for(;c<a;)try{b=await this.ao.dryrun(i);break}catch(w){if(c++,this.logger.debug(`Read attempt ${c} failed`,{error:w?.message,stack:w?.stack,tags:e,processId:this.processId}),c>=a)throw this.logger.debug("Maximum read attempts exceeded",{error:w?.message,stack:w?.stack,tags:e,processId:this.processId,ao:JSON.stringify(this.ao)}),new Error(`Failed to evaluate dry-run on process ${this.processId}.`,{cause:w});await new Promise(S=>setTimeout(S,2**c*1e3))}if(b===void 0)throw new Error("Unexpected error when evaluating read interaction");this.logger.debug("Read interaction result",{result:b,processId:this.processId});let g=lP(b);if(g!==void 0)throw new Error(g);if(b.Messages===void 0||b.Messages.length===0)throw this.logger.debug(`Empty result - process ${this.processId} does not support provided action.`,{result:b,tags:e,processId:this.processId}),new Error(b.message||`Process ${this.processId} did not return a valid response. Response: ${JSON.stringify(b)}`);let M=b.Messages?.[0]?.Data;return this.isMessageDataEmpty(M)?void 0:Tnt(M)}async send({tags:e,data:a,signer:l,retries:i=3}){let c,b=K$t(32);try{this.logger.debug("Evaluating send interaction on contract",{tags:e,data:a,processId:this.processId}),c=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:Kp}],data:a,signer:l,anchor:b}),this.logger.debug("Sent message to process",{messageId:c,processId:this.processId,anchor:b})}catch(S){throw this.logger.debug("Error sending message to process",{error:S?.message,stack:S?.stack,processId:this.processId,tags:e}),S}if(c===void 0)throw new Error("Failed to send message to process.");let g,M=0;for(;M<i;)try{g=await this.ao.result({message:c,process:this.processId}),this.logger.debug("Message result",{result:g,messageId:c,processId:this.processId});break}catch(S){if(M++,this.logger.debug("Retrying send interaction",{attempts:M,retries:i,error:S?.message,processId:this.processId}),M>=i)return this.logger.debug(`Message was sent to process ${this.processId} with id ${c} but result was not returned. Review transactions for more details.`,{error:S?.message,stack:S?.stack,tags:e,processId:this.processId,messageId:c}),{id:c};await new Promise(_=>setTimeout(_,2**M*2e3))}if(g===void 0)return this.logger.debug(`Message was sent to process ${this.processId} with id ${c} but the result was not returned. Review transactions for more details.`,{tags:e,processId:this.processId,messageId:c}),{id:c};let y=lP(g);if(y!==void 0)throw new CB(y);if(g.Messages?.length===0||g.Messages===void 0)return{id:c};if(this.isMessageDataEmpty(g.Messages[0].Data))return{id:c};let w=Tnt(g.Messages[0].Data);return this.logger.debug("Message result data",{resultData:w,messageId:c,processId:this.processId}),{id:c,result:w}}};var Jm=class{static init(e){return e!==void 0&&"signer"in e?new Wat(e):new dP(e)}},dP=class{process;constructor(e){if(e===void 0||Object.keys(e).length===0)this.process=new Fn({processId:kh});else if(Vm(e))this.process=e.process;else if(Ym(e))this.process=new Fn({processId:e.processId});else throw new Wd}async getANTVersions(){let e=await this.process.read({tags:[{name:"Action",value:"Get-Versions"}]});return Object.fromEntries(Object.entries(e).sort(([a],[l])=>a.localeCompare(l)))}async getLatestANTVersion(){let e=await this.getANTVersions(),a=Object.entries(e).at(-1);if(!a)throw new Error("No version found");return{version:a[0],...a[1]}}},Wat=class extends dP{signer;constructor({signer:e,...a}){super(a),this.signer=Gm(e)}async addVersion(e,a){let{version:l,moduleId:i,luaSourceId:c,notes:b}=e;return this.process.send({tags:Ua([{name:"Action",value:"Add-Version"},{name:"Version",value:l},{name:"Module-Id",value:i},{name:"Lua-Source-Id",value:c},{name:"Notes",value:b},...a?.tags??[]]),signer:this.signer})}};var xu=class r{static get versions(){return Jm.init()}static spawn=Vat;static fork=jUt;static async upgrade({signer:e,antProcessId:a,reassignAffiliatedNames:l=!0,names:i,arioProcessId:c=ef,antRegistryId:b=kh,ao:g,logger:M=$a.default,skipVersionCheck:y=!1,onSigningProgress:w,hyperbeamUrl:S}){if(i!==void 0&&i.length>0&&l!==void 0&&l!==!1)throw new Error("Cannot reassign all affiliated names and provide specific names");let _=i!==void 0&&i.length>0?new Set(i):new Set,x=i===void 0||i.length===0?l??!0:!1,A=K6.init({process:new Fn({processId:c,ao:g})}),I=async()=>{let K,W=!0,J=new Set;for(;W;){let U=await A.getArNSRecords({filters:{processId:a},cursor:K,limit:100});U.items.forEach(q=>{J.add(q.name)}),K=U.nextCursor,W=U.hasMore}return J};if(x)w?.("fetching-affiliated-names",{arioProcessId:c,antProcessId:a}),_=await I();else{if(i===void 0||i.length===0)throw new Error("Names are required when reassignAffiliatedNames is false.");w?.("validating-names",{arioProcessId:c,antProcessId:a,names:i});let K=await I();if(!i.every(W=>K.has(W))){let W=i.filter(J=>!K.has(J));throw new Error(`All names must be affiliated with the ANT on the provided ARIO process. The following names are not affiliated to this ANT: ${W.join(", ")}`)}}if(_.size===0)throw new Error("There are no names to reassign for this ANT.");let B=r.init({process:new Fn({processId:a,ao:g,logger:M}),hyperbeamUrl:S,signer:e});if(!y&&(w?.("checking-version",{antProcessId:a,antRegistryId:b}),await B.isLatestVersion({antRegistryId:b})))return{forkedProcessId:a,reassignedNames:{},failedReassignedNames:{}};let P=await r.fork({signer:e,antProcessId:a,ao:g,logger:M,antRegistryId:b,onSigningProgress:w}),O={},C={};for(let K of _){let W;try{w?.("reassigning-name",{name:K,arioProcessId:c,antProcessId:P}),W=await B.reassignName({name:K,arioProcessId:c,antProcessId:P}),w?.("successfully-reassigned-name",{name:K,arioProcessId:c,antProcessId:P}),O[K]=W}catch(J){M.error(`Failed to reassign name ${K}:`,{error:J}),w?.("failed-to-reassign-name",{name:K,arioProcessId:c,antProcessId:P,error:J}),C[K]={id:W?.id,error:J}}}return{forkedProcessId:P,reassignedNames:O,failedReassignedNames:C}}static init(e){return e!==void 0&&"signer"in e?new Gat(e):new cP(e)}},cP=class{process;processId;hyperbeamUrl;strict;checkHyperBeamPromise;moduleId;moduleIdPromise;logger=$a.default;constructor(e){if(this.strict=e.strict||!1,Vm(e))this.process=e.process;else if(Ym(e))this.process=new Fn({processId:e.processId});else throw new Wd;this.processId=this.process.processId,e.hyperbeamUrl!==void 0&&(this.hyperbeamUrl=new URL(e.hyperbeamUrl),this.logger.debug(`Using HyperBEAM node for process ${this.processId}`,{hyperbeamUrl:this.hyperbeamUrl}))}checkHyperBeamCompatibility(){return this.hyperbeamUrl===void 0?Promise.resolve(!1):this.checkHyperBeamPromise!==void 0?this.checkHyperBeamPromise:(this.checkHyperBeamPromise=fetch(`${this.hyperbeamUrl.toString()}${this.processId}~process@1.0/now/cache`,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(e=>!!e.ok).catch(e=>(this.logger.debug("Failed to check HyperBeam compatibility",{cause:e}),!1)),this.checkHyperBeamPromise)}async getState({strict:e}={strict:this.strict}){if(await this.checkHyperBeamCompatibility()){let i=0;for(;i<3;)try{let c=await fetch(`${this.hyperbeamUrl}${this.processId}~process@1.0/compute/cache/serialize~json@1.0`,{method:"GET",redirect:"follow",mode:"cors",headers:{"Content-Type":"application/json"}});if(c.status!==200)throw new Error(`Failed to fetch ant state: ${c?.statusText??"Unknown error"}`);let b=await c.json();if(!$$t(b))break;return q$t(b)}catch(c){this.logger.error(`Failed to fetch process state from HyperBEAM (attempt ${i+1} / 3)`,{cause:c}),i++,await new Promise(b=>setTimeout(b,1e3*i**2))}}let a=[{name:"Action",value:"State"}],l=await this.process.read({tags:a});return e&&Gd(AZ.passthrough().and(Ir.object({Records:Ir.record(Ir.string(),Tx.passthrough())})),l),l}async getInfo({strict:e}={strict:this.strict}){if(await this.checkHyperBeamCompatibility()){let i=await this.getState();return{Name:i.Name,Ticker:i.Ticker,Description:i.Description,Keywords:i.Keywords,Denomination:i.Denomination.toString(),Owner:i.Owner,Logo:i.Logo,"Total-Supply":i.TotalSupply.toString(),Handlers:[]}}let a=[{name:"Action",value:"Info"}],l=await this.process.read({tags:a});return e&&Gd(WMt.passthrough(),l),l}async getLogo(){return(await this.getInfo()).Logo}async getModuleId({graphqlUrl:e="https://arweave.net/graphql",retries:a=3}={}){if(this.moduleId!==void 0)return this.logger.debug("Returning cached module ID",{processId:this.processId,moduleId:this.moduleId}),this.moduleId;if(this.moduleIdPromise)return this.logger.debug("Returning in-flight module ID promise",{processId:this.processId}),this.moduleIdPromise;this.moduleIdPromise=this.fetchModuleId({graphqlUrl:e,retries:a});try{let l=await this.moduleIdPromise;return this.moduleId=l,this.logger.debug("Successfully fetched and cached module ID",{processId:this.processId,moduleId:l}),l}finally{this.moduleIdPromise=void 0}}async fetchModuleId({graphqlUrl:e,retries:a}){let l=JSON.stringify({query:`
151
+ `+c):l.stack=c}catch{}}throw l}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=Nl(this.defaults,a);let{transitional:l,paramsSerializer:i,headers:c}=a;l!==void 0&&Lw.assertOptions(l,{silentJSONParsing:Xd.transitional(Xd.boolean),forcedJSONParsing:Xd.transitional(Xd.boolean),clarifyTimeoutError:Xd.transitional(Xd.boolean)},!1),i!=null&&(je.isFunction(i)?a.paramsSerializer={serialize:i}:Lw.assertOptions(i,{encode:Xd.function,serialize:Xd.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),Lw.assertOptions(a,{baseUrl:Xd.spelling("baseURL"),withXsrfToken:Xd.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let b=c&&je.merge(c.common,c[a.method]);c&&je.forEach(["delete","get","head","post","put","patch","common"],A=>{delete c[A]}),a.headers=Yo.concat(b,c);let g=[],M=!0;this.interceptors.request.forEach(function(I){typeof I.runWhen=="function"&&I.runWhen(a)===!1||(M=M&&I.synchronous,g.unshift(I.fulfilled,I.rejected))});let y=[];this.interceptors.response.forEach(function(I){y.push(I.fulfilled,I.rejected)});let w,S=0,_;if(!M){let A=[nP.bind(this),void 0];for(A.unshift(...g),A.push(...y),_=A.length,w=Promise.resolve(a);S<_;)w=w.then(A[S++],A[S++]);return w}_=g.length;let x=a;for(S=0;S<_;){let A=g[S++],I=g[S++];try{x=A(x)}catch(B){I.call(this,B);break}}try{w=nP.call(this,x)}catch(A){return Promise.reject(A)}for(S=0,_=y.length;S<_;)w=w.then(y[S++],y[S++]);return w}getUri(e){e=Nl(this.defaults,e);let a=Cw(e.baseURL,e.url,e.allowAbsoluteUrls);return Tw(a,e.params,e.paramsSerializer)}};je.forEach(["delete","get","head","options"],function(e){V3.prototype[e]=function(a,l){return this.request(Nl(l||{},{method:e,url:a,data:(l||{}).data}))}});je.forEach(["post","put","patch"],function(e){function a(l){return function(c,b,g){return this.request(Nl(g||{},{method:e,headers:l?{"Content-Type":"multipart/form-data"}:{},url:c,data:b}))}}V3.prototype[e]=a(),V3.prototype[e+"Form"]=a(!0)});var Dw=V3;Et();Rt();At();var $at=class r{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});let l=this;this.promise.then(i=>{if(!l._listeners)return;let c=l._listeners.length;for(;c-- >0;)l._listeners[c](i);l._listeners=null}),this.promise.then=i=>{let c,b=new Promise(g=>{l.subscribe(g),c=g}).then(i);return b.cancel=function(){l.unsubscribe(c)},b},e(function(c,b,g){l.reason||(l.reason=new Jd(c,b,g),a(l.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){let e=new AbortController,a=l=>{e.abort(l)};return this.subscribe(a),e.signal.unsubscribe=()=>this.unsubscribe(a),e.signal}static source(){let e;return{token:new r(function(i){e=i}),cancel:e}}},EUt=$at;Et();Rt();At();function qat(r){return function(a){return r.apply(null,a)}}Et();Rt();At();function Uat(r){return je.isObject(r)&&r.isAxiosError===!0}Et();Rt();At();var jat={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(jat).forEach(([r,e])=>{jat[e]=r});var AUt=jat;function RUt(r){let e=new Dw(r),a=Aw(Dw.prototype.request,e);return je.extend(a,Dw.prototype,e,{allOwnKeys:!0}),je.extend(a,e,null,{allOwnKeys:!0}),a.create=function(i){return RUt(Nl(r,i))},a}var Bo=RUt(Z3);Bo.Axios=Dw;Bo.CanceledError=Jd;Bo.CancelToken=EUt;Bo.isCancel=Nw;Bo.VERSION=aP;Bo.toFormData=Km;Bo.AxiosError=Xr;Bo.Cancel=Bo.CanceledError;Bo.all=function(e){return Promise.all(e)};Bo.spread=qat;Bo.isAxiosError=Uat;Bo.mergeConfig=Nl;Bo.AxiosHeaders=Yo;Bo.formToJSON=r=>QB(je.isHTMLForm(r)?new FormData(r):r);Bo.getAdapter=iP.getAdapter;Bo.HttpStatusCode=AUt;Bo.default=Bo;var sP=Bo;var{Axios:zGe,AxiosError:FGe,CanceledError:HGe,isCancel:KGe,CancelToken:ZGe,VERSION:WGe,all:GGe,Cancel:VGe,isAxiosError:YGe,spread:JGe,toFormData:XGe,AxiosHeaders:QGe,HttpStatusCode:tVe,formToJSON:eVe,getAdapter:rVe,mergeConfig:iVe}=sP;Et();Rt();At();var BUt=An(kUt(),1),zat="axios-retry";function PUt(r){let e=["ERR_CANCELED","ECONNABORTED"];return r.response||!r.code||e.includes(r.code)?!1:(0,BUt.default)(r)}var NUt=["get","head","options"],j8e=NUt.concat(["put","delete"]);function Fat(r){return r.code!=="ECONNABORTED"&&(!r.response||r.response.status===429||r.response.status>=500&&r.response.status<=599)}function z8e(r){return r.config?.method?Fat(r)&&NUt.indexOf(r.config.method)!==-1:!1}function OUt(r){return r.config?.method?Fat(r)&&j8e.indexOf(r.config.method)!==-1:!1}function CUt(r){return PUt(r)||OUt(r)}function Hat(r=void 0){let e=r?.response?.headers["retry-after"];if(!e)return 0;let a=(Number(e)||0)*1e3;return a===0&&(a=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,a)}function F8e(r=0,e=void 0){return Math.max(0,Hat(e))}function H8e(r=0,e=void 0,a=100){let l=2**r*a,i=Math.max(l,Hat(e)),c=i*.2*Math.random();return i+c}function K8e(r=100){return(e=0,a=void 0)=>{let l=e*r;return Math.max(l,Hat(a))}}var Z8e={retries:3,retryCondition:CUt,retryDelay:F8e,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function W8e(r,e){return{...Z8e,...e,...r[zat]}}function TUt(r,e,a=!1){let l=W8e(r,e||{});return l.retryCount=l.retryCount||0,(!l.lastRequestTime||a)&&(l.lastRequestTime=Date.now()),r[zat]=l,l}function G8e(r,e){r.defaults.agent===e.agent&&delete e.agent,r.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,r.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function V8e(r,e){let{retries:a,retryCondition:l}=r,i=(r.retryCount||0)<a&&l(e);if(typeof i=="object")try{return await i!==!1}catch{return!1}return i}async function Y8e(r,e,a,l){e.retryCount+=1;let{retryDelay:i,shouldResetTimeout:c,onRetry:b}=e,g=i(e.retryCount,a);if(G8e(r,l),!c&&l.timeout&&e.lastRequestTime){let M=Date.now()-e.lastRequestTime,y=l.timeout-M-g;if(y<=0)return Promise.reject(a);l.timeout=y}return l.transformRequest=[M=>M],await b(e.retryCount,a,l),l.signal?.aborted?Promise.resolve(r(l)):new Promise(M=>{let y=()=>{clearTimeout(w),M(r(l))},w=setTimeout(()=>{M(r(l)),l.signal?.removeEventListener&&l.signal.removeEventListener("abort",y)},g);l.signal?.addEventListener&&l.signal.addEventListener("abort",y,{once:!0})})}async function J8e(r,e){r.retryCount>=r.retries&&await r.onMaxRetryTimesExceeded(e,r.retryCount)}var Zm=(r,e)=>{let a=r.interceptors.request.use(i=>(TUt(i,e,!0),i[zat]?.validateResponse&&(i.validateStatus=()=>!1),i)),l=r.interceptors.response.use(null,async i=>{let{config:c}=i;if(!c)return Promise.reject(i);let b=TUt(c,e);return i.response&&b.validateResponse?.(i.response)?i.response:await V8e(b,i)?Y8e(r,b,i,c):(await J8e(b,i),Promise.reject(i))});return{requestInterceptorId:a,responseInterceptorId:l}};Zm.isNetworkError=PUt;Zm.isSafeRequestError=z8e;Zm.isIdempotentRequestError=OUt;Zm.isNetworkOrIdempotentRequestError=CUt;Zm.exponentialDelay=H8e;Zm.linearDelay=K8e;Zm.isRetryableError=Fat;var fP=Zm;var LUt=({axiosConfig:r={},logger:e=$a.default,retryConfig:a={retries:5,retryDelay:fP.exponentialDelay,retryCondition:l=>fP.isRetryableError(l),onRetry(l,i,c){e.error(`Retrying request ${c.url} attempt ${l}`,i)}}}={})=>{let l=sP.create({...r,maxRedirects:0,headers:{...r.headers,"x-source-version":`${Kp}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return fP(l,a),l};Et();Rt();At();var Kat=({baseUrl:r,params:e})=>{let a=new URL(r);return Object.entries(e).forEach(([l,i])=>{if(i!=null)if(Array.isArray(i)&&i.length>0)for(let c of i)c!=null&&a.searchParams.append(l,c.toString());else a.searchParams.set(l,i.toString())}),a.toString()};async function X8e({signer:r,nonce:e=mat()}){let a,l,i=hP(r)?Hr.ARWEAVE:r.signatureType;switch(hP(r)?a=z6(Ft.from(await r.signMessage(Uint8Array.from(Ft.from(e))))):r instanceof sl?a=z6(Ft.from(await r.signer.signMessage(Uint8Array.from(Ft.from(e))))):(r instanceof Vu||r instanceof ks||r instanceof fv)&&("setPublicKey"in r&&r.publicKey===void 0&&await r.setPublicKey(),a=z6(Ft.from(await r.sign(Uint8Array.from(Ft.from(e)))))),i){case Hr.ARWEAVE:hP(r)?l=await r.getActivePublicKey():"setPublicKey"in r?(await r.setPublicKey(),l=z6(r.publicKey)):"publicKey"in r&&(l=z6(r.publicKey));break;case Hr.ETHEREUM:if("publicKey"in r)l="0x"+r.publicKey.toString("hex");else throw new Error("Public key not found");break;default:throw new Error(`Unsupported signer type for signing requests: ${i}`)}if(l===void 0||a===void 0)throw new Error("Public key or signature not found");return{"x-public-key":l,"x-nonce":e,"x-signature":a,"x-signature-type":i.toString()}}var $w=class{static init(e){let{signer:a,paymentUrl:l,axios:i,logger:c}=e??{};return a!==void 0?new Wm({signer:a,paymentUrl:l,axios:i,logger:c}):new uP({paymentUrl:l,axios:i,logger:c})}},uP=class{paymentUrl;axios;logger;constructor({paymentUrl:e="https://payment.ardrive.io",axios:a=LUt(),logger:l=$a.default}){this.paymentUrl=e,this.axios=a,this.logger=l}async getArNSPriceDetails({intent:e,name:a,quantity:l,type:i,years:c}){let b=Kat({baseUrl:`${this.paymentUrl}/v1/arns/price/${e}/${a}`,params:{increaseQty:l,type:i,years:c}}),{data:g,status:M}=await this.axios.get(b);if(this.logger.debug("getArNSPriceDetails",{intent:e,name:a,quantity:l,type:i,years:c,data:g,status:M}),M!==200)throw new Error("Failed to get ArNS purchase price "+JSON.stringify(g));if(!g.winc||!g.mARIO)throw new Error("Invalid response from Turbo "+JSON.stringify(g));return{winc:g.winc,mARIO:new Ew(+g.mARIO)}}async getPrice(e){let{winc:a}=await this.getArNSPriceDetails(e);return+a}},Wm=class extends uP{signer;constructor({signer:e,...a}){if(super(a),!Zat(e))throw new Error("Signer must be a TurboArNSSigner");this.signer=e}async initiateArNSPurchase({intent:e,name:a,quantity:l,type:i,processId:c,years:b,paidBy:g=[],referrer:M}){let y=Kat({baseUrl:`${this.paymentUrl}/v1/arns/purchase/${e}/${a}`,params:{increaseQty:l,processId:c,type:i,years:b,paidBy:g,referrer:M}}),w=await X8e({signer:this.signer}),{data:S,status:_}=await this.axios.post(y,null,{headers:w});if(this.logger.debug("Initiated ArNS purchase",{intent:e,name:a,quantity:l,processId:c,type:i,years:b,data:S,status:_}),_!==200)throw new Error("Failed to initiate ArNS purchase "+JSON.stringify(S));return{id:S.arioWriteResult.id,result:S.purchaseReceipt}}};function hP(r){return typeof r=="object"&&r!==null&&"signMessage"in r&&"getActivePublicKey"in r}function Zat(r){let e=hP(r),a=r instanceof ks||r instanceof fv||r instanceof Vu||r instanceof sl;return e||a}var K6=class{static init(e){return e!==void 0&&"signer"in e?new qw(e):new Y3(e)}static mainnet(e){return e!==void 0&&"signer"in e?new qw({...e,process:new Fn({processId:ef,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}):new Y3({...e,process:new Fn({processId:ef,ao:Fh({CU_URL:"https://cu.ardrive.io",MODE:"legacy",...e?.process?.ao})})})}static testnet(e){return e!==void 0&&"signer"in e?lat({arioInstance:new qw({...e,process:new Fn({processId:SZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl}):lat({arioInstance:new Y3({...e,process:new Fn({processId:SZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl})}},Y3=class{process;epochSettings;arweave;hyperbeamUrl;paymentProvider;logger=$a.default;constructor(e){if(this.arweave=e?.arweave??KB,this.hyperbeamUrl=e?.hyperbeamUrl,e===void 0||Object.keys(e).length===0)this.process=new Fn({processId:ef});else if(Vm(e))this.process=e.process;else if(Ym(e))this.process=new Fn({processId:e.processId});else throw new Wd;this.paymentProvider=$w.init({paymentUrl:e?.paymentUrl})}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getTokenSupply(){return this.process.read({tags:[{name:"Action",value:"Total-Token-Supply"}]})}async computeEpochIndexForTimestamp(e){let a=await this.getEpochSettings(),l=a.epochZeroStartTimestamp,i=a.durationMs;return Math.floor((e-l)/i)}async computeCurrentEpochIndex(){return this.computeEpochIndexForTimestamp(Date.now())}async computeEpochIndex(e){let a=e?.epochIndex;if(a!==void 0)return a;let l=e?.timestamp;if(l!==void 0)return this.computeEpochIndexForTimestamp(l)}async getEpochSettings(){return this.epochSettings??=await this.process.read({tags:[{name:"Action",value:"Epoch-Settings"}]})}async getEpoch(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(!c)throw new Error("Epoch data not found for epoch index "+a);return $Ut(c)}let i=[{name:"Action",value:"Epoch"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Records"},...hf(e)]})}async getArNSReservedNames(e){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"},...hf(e)]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Balances"},...hf(e)]})}async getVault({address:e,vaultId:a}){return this.process.read({tags:[{name:"Action",value:"Vault"},{name:"Address",value:e},{name:"Vault-Id",value:a}]})}async getVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Vaults"},...hf(e)]})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGatewayDelegates({address:e,...a}){return this.process.read({tags:[{name:"Action",value:"Paginated-Delegates"},{name:"Address",value:e},...hf(a)]})}async getGatewayDelegateAllowList({address:e,...a}){return this.process.read({tags:[{name:"Action",value:"Paginated-Allowed-Delegates"},{name:"Address",value:e},...hf(a)]})}async getGateways(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateways"},...hf(e)]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"}]})}async getPrescribedObservers(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({ao:this.process.ao,arweave:this.arweave,epochIndex:a,processId:this.process.processId});if(!c)throw new Error("Epoch data not found for epoch index "+a);return c.prescribedObservers}let i=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getPrescribedNames(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(!c)throw new Error("Epoch data not found for epoch index "+a);return c.prescribedNames}let i=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getObservations(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(!c)throw new Error("Epoch data not found for epoch index "+a);return c.observations}let i=[{name:"Action",value:"Epoch-Observations"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getDistributions(e){let a=await this.computeEpochIndex(e),l=await this.computeCurrentEpochIndex();if(a!==void 0&&a<l){let c=await H6({arweave:this.arweave,epochIndex:a,processId:this.process.processId,ao:this.process.ao});if(c===void 0)throw new Error("Epoch data not found for epoch index "+a);return c.distributions}let i=[{name:"Action",value:"Epoch-Distributions"},{name:"Epoch-Index",value:l.toString()}];return this.process.read({tags:Ua(i)})}async getEligibleEpochRewards(e,a){let l=await this.computeEpochIndex(e),i=await this.computeCurrentEpochIndex();if(l!==void 0&&l<i){let b=await H6({arweave:this.arweave,epochIndex:l,processId:this.process.processId,ao:this.process.ao});if(!b)throw new Error("Epoch data not found for epoch index "+l);return DUt(b,a)}let c=[{name:"Action",value:"Epoch-Eligible-Rewards"},...hf(a)];return this.process.read({tags:Ua(c)})}async getTokenCost({intent:e,type:a,years:l,name:i,quantity:c,fromAddress:b}){let M=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:e==="Buy-Record"?"Buy-Name":e},{name:"Name",value:i},{name:"Years",value:l?.toString()},{name:"Quantity",value:c?.toString()},{name:"Purchase-Type",value:a}];return this.process.read({tags:Ua(M),fromAddress:b})}async getCostDetails({intent:e,type:a,years:l,name:i,quantity:c,fromAddress:b,fundFrom:g}){let M=e==="Buy-Record"?"Buy-Name":e;if(g==="turbo"){let{mARIO:w,winc:S}=await this.paymentProvider.getArNSPriceDetails({intent:M,name:i,quantity:c,type:a,years:l});return{tokenCost:w.valueOf(),wincQty:S,discounts:[]}}let y=[{name:"Action",value:"Cost-Details"},{name:"Intent",value:M},{name:"Name",value:i},{name:"Years",value:l?.toString()},{name:"Quantity",value:c?.toString()},{name:"Purchase-Type",value:a},{name:"Fund-From",value:g}];return this.process.read({tags:Ua(y),fromAddress:b})}async getRegistrationFees(){return this.process.read({tags:[{name:"Action",value:"Registration-Fees"}]})}async getDemandFactor(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor"}]})}async getDemandFactorSettings(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor-Settings"}]})}async getArNSReturnedNames(e){return this.process.read({tags:[{name:"Action",value:"Returned-Names"},...hf(e)]})}async getArNSReturnedName({name:e}){let a=[{name:"Action",value:"Returned-Name"},{name:"Name",value:e}];return this.process.read({tags:a})}async getDelegations(e){let a=[{name:"Action",value:"Paginated-Delegations"},{name:"Address",value:e.address},...hf(e)];return this.process.read({tags:Ua(a)})}async getAllowedDelegates(e){return this.getGatewayDelegateAllowList(e)}async getGatewayVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateway-Vaults"},{name:"Address",value:e.address},...hf(e)]})}async getPrimaryNameRequest(e){let a=[{name:"Action",value:"Primary-Name-Request"},{name:"Initiator",value:e.initiator}];return this.process.read({tags:a})}async getPrimaryNameRequests(e){return this.process.read({tags:[{name:"Action",value:"Primary-Name-Requests"},...hf(e)]})}async getPrimaryName(e){let a=[{name:"Action",value:"Primary-Name"},{name:"Address",value:e?.address},{name:"Name",value:e?.name}];return this.process.read({tags:Ua(a)})}async getPrimaryNames(e){return this.process.read({tags:[{name:"Action",value:"Primary-Names"},...hf(e)]})}async getRedelegationFee(e){return this.process.read({tags:[{name:"Action",value:"Redelegation-Fee"},{name:"Address",value:e.address}]})}async getGatewayRegistrySettings(){return this.process.read({tags:[{name:"Action",value:"Gateway-Registry-Settings"}]})}async getAllDelegates(e){return this.process.read({tags:[{name:"Action",value:"All-Paginated-Delegates"},...hf(e)]})}async getAllGatewayVaults(e){return this.process.read({tags:[{name:"Action",value:"All-Gateway-Vaults"},...hf(e)]})}async resolveArNSName({name:e}){let a=e.lastIndexOf("_"),l=a===-1?e:e.slice(a+1),i=a===-1?"@":e.slice(0,a),c=await this.getArNSRecord({name:l});if(c===void 0||c.processId===void 0)throw new Error(`Base ArNS name ${l} not found on ARIO contract (${this.process.processId}).`);let b=xu.init({process:new Fn({ao:this.process.ao,processId:c.processId})}),[g,M]=await Promise.all([b.getOwner(),b.getRecord({undername:i})]);if(M===void 0)throw new Error(`Record for ${i} not found on ANT.`);if(M.ttlSeconds===void 0||M.transactionId===void 0)throw new Error(`Invalid record on ANT. Must have ttlSeconds and transactionId. Record: ${JSON.stringify(M)}`);return{name:e,owner:g,txId:M.transactionId,ttlSeconds:M.ttlSeconds,priority:M.priority,processId:c.processId,undernameLimit:c.undernameLimit,type:c.type}}async getArNSRecordsForAddress(e){let{antRegistryProcessId:a=kh,address:l}=e,i=R1.init({hyperbeamUrl:this.hyperbeamUrl,process:new Fn({ao:this.process.ao,processId:a})}),{Controlled:c=[],Owned:b=[]}=await i.accessControlList({address:l}),g=new Set([...c,...b]);return g.size===0?{items:[],hasMore:!1,nextCursor:void 0,limit:e.limit??1e3,totalItems:0,sortOrder:e.sortOrder??"asc"}:await this.getArNSRecords({...e,filters:{processId:Array.from(g)}})}},qw=class extends Y3{signer;paymentProvider;constructor({signer:e,paymentUrl:a,...l}){l===void 0?super({process:new Fn({processId:ef})}):super(l),this.signer=Gm(e),this.paymentProvider=$w.init({signer:Zat(e)?e:void 0,paymentUrl:a})}async transfer({target:e,qty:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:a.valueOf().toString()}],signer:this.signer})}async vaultedTransfer({recipient:e,quantity:a,lockLengthMs:l,revokable:i=!1},c){let{tags:b=[]}=c||{};return this.process.send({tags:[...b,{name:"Action",value:"Vaulted-Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:a.toString()},{name:"Lock-Length",value:l.toString()},{name:"Revokable",value:`${i}`}],signer:this.signer})}async revokeVault({vaultId:e,recipient:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Revoke-Vault"},{name:"Vault-Id",value:e},{name:"Recipient",value:a}],signer:this.signer})}async createVault({lockLengthMs:e,quantity:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Create-Vault"},{name:"Lock-Length",value:e.toString()},{name:"Quantity",value:a.toString()}],signer:this.signer})}async extendVault({vaultId:e,extendLengthMs:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Extend-Vault"},{name:"Vault-Id",value:e},{name:"Extend-Length",value:a.toString()}],signer:this.signer})}async increaseVault({vaultId:e,quantity:a},l){let{tags:i=[]}=l||{};return this.process.send({tags:[...i,{name:"Action",value:"Increase-Vault"},{name:"Vault-Id",value:e},{name:"Quantity",value:a.toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:a,allowedDelegates:l,delegateRewardShareRatio:i,fqdn:c,label:b,minDelegatedStake:g,note:M,port:y,properties:w,protocol:S,autoStake:_,observerAddress:x,services:A},I){let{tags:B=[]}=I||{},P=[...B,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:e.valueOf().toString()},{name:"Allow-Delegated-Staking",value:a?.toString()},{name:"Allowed-Delegates",value:l?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:i?.toString()},{name:"FQDN",value:c},{name:"Label",value:b},{name:"Min-Delegated-Stake",value:g?.valueOf().toString()},{name:"Note",value:M},{name:"Port",value:y?.toString()},{name:"Properties",value:w},{name:"Protocol",value:S},{name:"Auto-Stake",value:_?.toString()},{name:"Observer-Address",value:x},{name:"Services",value:A?JSON.stringify(A):void 0}];return this.process.send({signer:this.signer,tags:Ua(P)})}async leaveNetwork(e){let{tags:a=[]}=e||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Leave-Network"}]})}async updateGatewaySettings({allowDelegatedStaking:e,allowedDelegates:a,delegateRewardShareRatio:l,fqdn:i,label:c,minDelegatedStake:b,note:g,port:M,properties:y,protocol:w,autoStake:S,observerAddress:_,services:x},A){let{tags:I=[]}=A||{},B=[...I,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:c},{name:"Note",value:g},{name:"FQDN",value:i},{name:"Port",value:M?.toString()},{name:"Properties",value:y},{name:"Protocol",value:w},{name:"Observer-Address",value:_},{name:"Allow-Delegated-Staking",value:e?.toString()},{name:"Allowed-Delegates",value:a?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:l?.toString()},{name:"Min-Delegated-Stake",value:b?.valueOf().toString()},{name:"Auto-Stake",value:S?.toString()},{name:"Services",value:x?JSON.stringify(x):void 0}];return this.process.send({signer:this.signer,tags:Ua(B)})}async delegateStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async instantWithdrawal(e,a){let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Instant-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:Ua(i)})}async increaseOperatorStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async saveObservations(e,a){let{tags:l=[]}=a||{};return this.process.send({signer:this.signer,tags:[...l,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:e.reportTxId},{name:"Failed-Gateways",value:e.failedGateways.join(",")}]})}async buyRecord(e,a){if(e.processId===void 0)try{let{nameTag:c,otherTags:b}=(a?.tags||[]).reduce((g,M)=>(M.name==="Name"?g.nameTag=M:g.otherTags.push(M),g),{nameTag:{name:"Name",value:e.name},otherTags:[]});e.processId=await xu.spawn({signer:this.signer,ao:this.process.ao,logger:this.logger,tags:[c,...b],onSigningProgress:a?.onSigningProgress})}catch(c){throw this.logger.error("Failed to spawn ANT for name purchase.",{error:c}),c}if(a?.onSigningProgress?.("buying-name",{name:e.name,years:e.years,type:e.type,processId:e.processId,fundFrom:e.fundFrom,referrer:e.referrer}),e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Buy-Name",name:e.name,years:e.years,type:e.type,processId:e.processId,paidBy:e.paidBy})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Buy-Name"},{name:"Name",value:e.name},{name:"Years",value:e.years?.toString()??"1"},{name:"Process-Id",value:e.processId},{name:"Purchase-Type",value:e.type||"lease"},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async upgradeRecord(e,a){if(e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Upgrade-Name",name:e.name})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Upgrade-Name"},{name:"Name",value:e.name},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async extendLease(e,a){if(e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Extend-Lease",name:e.name,years:e.years})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Extend-Lease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async increaseUndernameLimit(e,a){if(e.fundFrom==="turbo"){if(!(this.paymentProvider instanceof Wm))throw new Error("Turbo funding is not supported for this payment provider");return this.paymentProvider.initiateArNSPurchase({intent:"Increase-Undername-Limit",quantity:e.increaseCount,name:e.name})}let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()},{name:"Fund-From",value:e.fundFrom},{name:"Referrer",value:e.referrer}];return this.process.send({signer:this.signer,tags:Ua(i)})}async cancelWithdrawal(e,a){let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Cancel-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:Ua(i)})}async requestPrimaryName(e,a){if(e.fundFrom==="turbo")throw new Error("Turbo funding is not yet supported for primary name requests");let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Request-Primary-Name"},{name:"Name",value:e.name},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:Ua(i)})}async setPrimaryName(e,a){a?.onSigningProgress?.("requesting-primary-name",{name:e.name,fundFrom:e.fundFrom,referrer:e.referrer});let i=(await this.requestPrimaryName(e,a).catch(async y=>{if(y.message.includes("already exists")){let w=y.message.match(/by '([^']+)'/)?.[1];if(w===void 0)throw y;a?.onSigningProgress?.("request-already-exists",{name:e.name,initiator:w});let S=await this.getPrimaryNameRequest({initiator:w}),_=await this.getArNSRecord({name:e.name});if(_===void 0)throw new Error(`ARNS name '${e.name}' does not exist`);if(S.initiator!==w)throw new Error(`Primary name request for name '${e.name}' was not approved`);return{id:"stub-id",result:{request:S,baseNameOwner:_.processId,fundingPlan:{address:w}}}}throw y})).result,c=i?.baseNameOwner,b=i?.fundingPlan?.address;if(i===void 0||b===void 0||c===void 0)throw new Error(`Failed to request primary name ${e.name} for ${b} owned by ${c} process`);return a?.onSigningProgress?.("approving-request",{name:e.name,processId:c,request:i.request}),await xu.init({process:new Fn({processId:c,ao:this.process.ao}),signer:this.signer}).approvePrimaryNameRequest({name:e.name,address:b,arioProcessId:this.process.processId},a)}async redelegateStake(e,a){let{tags:l=[]}=a||{},i=[...l,{name:"Action",value:"Redelegate-Stake"},{name:"Target",value:e.target},{name:"Source",value:e.source},{name:"Quantity",value:e.stakeQty.valueOf().toString()},{name:"Vault-Id",value:e.vaultId}];return this.process.send({signer:this.signer,tags:Ua(i)})}};var PJe=async({address:r,registry:e=R1.init()})=>{let a=await e.accessControlList({address:r});return[...new Set([...a.Owned,...a.Controlled])]};function qUt(r,e){return new Promise((a,l)=>{let i=setTimeout(()=>{l(new Error("Timeout"))},r);e.then(c=>{clearTimeout(i),a(c)}).catch(c=>{clearTimeout(i),l(c)})})}var UUt=class extends Pnt.default{contract;timeoutMs;throttle;logger;strict;antAoClient;constructor({contract:e=K6.init({processId:ef}),timeoutMs:a=6e4,concurrency:l=30,logger:i=$a.default,strict:c=!1,antAoClient:b=Fh({MODE:"legacy"})}={}){super(),this.contract=e,this.timeoutMs=a,this.throttle=G$t(l),this.logger=i,this.strict=c,this.antAoClient=b}async fetchProcessesOwnedByWallet({address:e,pageSize:a,antRegistry:l=R1.init()}){let i={},c=await l.accessControlList({address:e}),b=new Set([...c.Owned,...c.Controlled]);await qUt(this.timeoutMs,Q8e({contract:this.contract,emitter:this,pageSize:a})).catch(M=>(this.emit("error",`Error getting ArNS records: ${M}`),this.logger.error("Error getting ArNS records",{message:M?.message,stack:M?.stack}),{})).then(M=>{Object.entries(M).forEach(([y,w])=>{b.has(w.processId)&&(i[w.processId]==null&&(i[w.processId]={state:void 0,names:{}}),i[w.processId].names[y]=w)})});let g=Object.keys(i).length;this.emit("progress",0,g),await Promise.all(Object.keys(i).map(async(M,y)=>this.throttle(async()=>{if(i[M].state!==void 0){this.emit("progress",y+1,g);return}let w=xu.init({process:new Fn({processId:M,ao:this.antAoClient}),strict:this.strict}),S=await qUt(this.timeoutMs,w.getState()).catch(_=>{this.emit("error",`Error getting state for process ${M}: ${_}`)});(S?.Owner===e||S?.Controllers.includes(e))&&(i[M].state=S,this.emit("process",M,i[M])),this.emit("progress",y+1,g)}))),this.emit("end",i)}},Q8e=async({contract:r=K6.init({processId:ef}),emitter:e,logger:a=$a.default,pageSize:l=1e3})=>{let i,c=Date.now(),b={};do{let g=await r.getArNSRecords({cursor:i,limit:l}).catch(M=>{a?.error("Error getting ArNS records",{message:M?.message,stack:M?.stack}),e?.emit("arns:error",`Error getting ArNS records: ${M}`)});if(!g)return{};g.items.forEach(M=>{let{name:y,...w}=M;b[y]=w}),a.debug("Fetched page of ArNS records",{totalRecordCount:g.totalItems,fetchedRecordCount:Object.keys(b).length,cursor:g.nextCursor}),e?.emit("arns:pageLoaded",{totalRecordCount:g.totalItems,fetchedRecordCount:Object.keys(b).length,records:g.items,cursor:g.nextCursor}),i=g.nextCursor}while(i!==void 0);return e?.emit("arns:end",b),a.debug("Fetched all ArNS records",{totalRecordCount:Object.keys(b).length,durationMs:Date.now()-c}),b};var Fn=class{logger;ao;processId;constructor({processId:e,ao:a=Fh({MODE:"legacy"}),logger:l=$a.default}){this.processId=e,this.logger=l,this.ao=a}isMessageDataEmpty(e){return e===void 0||e==="null"||e===""||e===null}async read({tags:e,retries:a=3,fromAddress:l}){this.logger.debug("Evaluating read interaction on process",{tags:e,processId:this.processId});let i={process:this.processId,tags:e};l!==void 0&&(i.Owner=l);let c=0,b;for(;c<a;)try{b=await this.ao.dryrun(i);break}catch(w){if(c++,this.logger.debug(`Read attempt ${c} failed`,{error:w?.message,stack:w?.stack,tags:e,processId:this.processId}),c>=a)throw this.logger.debug("Maximum read attempts exceeded",{error:w?.message,stack:w?.stack,tags:e,processId:this.processId,ao:JSON.stringify(this.ao)}),new Error(`Failed to evaluate dry-run on process ${this.processId}.`,{cause:w});await new Promise(S=>setTimeout(S,2**c*1e3))}if(b===void 0)throw new Error("Unexpected error when evaluating read interaction");this.logger.debug("Read interaction result",{result:b,processId:this.processId});let g=lP(b);if(g!==void 0)throw new Error(g);if(b.Messages===void 0||b.Messages.length===0)throw this.logger.debug(`Empty result - process ${this.processId} does not support provided action.`,{result:b,tags:e,processId:this.processId}),new Error(b.message||`Process ${this.processId} did not return a valid response. Response: ${JSON.stringify(b)}`);let M=b.Messages?.[0]?.Data;return this.isMessageDataEmpty(M)?void 0:Tnt(M)}async send({tags:e,data:a,signer:l,retries:i=3}){let c,b=K$t(32);try{this.logger.debug("Evaluating send interaction on contract",{tags:e,data:a,processId:this.processId}),c=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:Kp}],data:a,signer:l,anchor:b}),this.logger.debug("Sent message to process",{messageId:c,processId:this.processId,anchor:b})}catch(S){throw this.logger.debug("Error sending message to process",{error:S?.message,stack:S?.stack,processId:this.processId,tags:e}),S}if(c===void 0)throw new Error("Failed to send message to process.");let g,M=0;for(;M<i;)try{g=await this.ao.result({message:c,process:this.processId}),this.logger.debug("Message result",{result:g,messageId:c,processId:this.processId});break}catch(S){if(M++,this.logger.debug("Retrying send interaction",{attempts:M,retries:i,error:S?.message,processId:this.processId}),M>=i)return this.logger.debug(`Message was sent to process ${this.processId} with id ${c} but result was not returned. Review transactions for more details.`,{error:S?.message,stack:S?.stack,tags:e,processId:this.processId,messageId:c}),{id:c};await new Promise(_=>setTimeout(_,2**M*2e3))}if(g===void 0)return this.logger.debug(`Message was sent to process ${this.processId} with id ${c} but the result was not returned. Review transactions for more details.`,{tags:e,processId:this.processId,messageId:c}),{id:c};let y=lP(g);if(y!==void 0)throw new CB(y);if(g.Messages?.length===0||g.Messages===void 0)return{id:c};if(this.isMessageDataEmpty(g.Messages[0].Data))return{id:c};let w=Tnt(g.Messages[0].Data);return this.logger.debug("Message result data",{resultData:w,messageId:c,processId:this.processId}),{id:c,result:w}}};var Jm=class{static init(e){return e!==void 0&&"signer"in e?new Wat(e):new dP(e)}},dP=class{process;constructor(e){if(e===void 0||Object.keys(e).length===0)this.process=new Fn({processId:kh});else if(Vm(e))this.process=e.process;else if(Ym(e))this.process=new Fn({processId:e.processId});else throw new Wd}async getANTVersions(){let e=await this.process.read({tags:[{name:"Action",value:"Get-Versions"}]});return Object.fromEntries(Object.entries(e).sort(([a],[l])=>a.localeCompare(l)))}async getLatestANTVersion(){let e=await this.getANTVersions(),a=Object.entries(e).at(-1);if(!a)throw new Error("No version found");return{version:a[0],...a[1]}}},Wat=class extends dP{signer;constructor({signer:e,...a}){super(a),this.signer=Gm(e)}async addVersion(e,a){let{version:l,moduleId:i,luaSourceId:c,notes:b}=e;return this.process.send({tags:Ua([{name:"Action",value:"Add-Version"},{name:"Version",value:l},{name:"Module-Id",value:i},{name:"Lua-Source-Id",value:c},{name:"Notes",value:b},...a?.tags??[]]),signer:this.signer})}};var xu=class r{static get versions(){return Jm.init()}static spawn=Vat;static fork=jUt;static async upgrade({signer:e,antProcessId:a,reassignAffiliatedNames:l=!0,names:i,arioProcessId:c=ef,antRegistryId:b=kh,ao:g,logger:M=$a.default,skipVersionCheck:y=!1,onSigningProgress:w,hyperbeamUrl:S}){if(i!==void 0&&i.length>0&&l!==void 0&&l!==!1)throw new Error("Cannot reassign all affiliated names and provide specific names");let _=i!==void 0&&i.length>0?new Set(i):new Set,x=i===void 0||i.length===0?l??!0:!1,A=K6.init({process:new Fn({processId:c,ao:g})}),I=async()=>{let K,W=!0,J=new Set;for(;W;){let U=await A.getArNSRecords({filters:{processId:a},cursor:K,limit:100});U.items.forEach(q=>{J.add(q.name)}),K=U.nextCursor,W=U.hasMore}return J};if(x)w?.("fetching-affiliated-names",{arioProcessId:c,antProcessId:a}),_=await I();else{if(i===void 0||i.length===0)throw new Error("Names are required when reassignAffiliatedNames is false.");w?.("validating-names",{arioProcessId:c,antProcessId:a,names:i});let K=await I();if(!i.every(W=>K.has(W))){let W=i.filter(J=>!K.has(J));throw new Error(`All names must be affiliated with the ANT on the provided ARIO process. The following names are not affiliated to this ANT: ${W.join(", ")}`)}}if(_.size===0)throw new Error("There are no names to reassign for this ANT.");let B=r.init({process:new Fn({processId:a,ao:g,logger:M}),hyperbeamUrl:S,signer:e});if(!y&&(w?.("checking-version",{antProcessId:a,antRegistryId:b}),await B.isLatestVersion({antRegistryId:b})))return{forkedProcessId:a,reassignedNames:{},failedReassignedNames:{}};let P=await r.fork({signer:e,antProcessId:a,ao:g,logger:M,antRegistryId:b,onSigningProgress:w}),O={},C={};for(let K of _){let W;try{w?.("reassigning-name",{name:K,arioProcessId:c,antProcessId:P}),W=await B.reassignName({name:K,arioProcessId:c,antProcessId:P}),w?.("successfully-reassigned-name",{name:K,arioProcessId:c,antProcessId:P}),O[K]=W}catch(J){M.error(`Failed to reassign name ${K}:`,{error:J}),w?.("failed-to-reassign-name",{name:K,arioProcessId:c,antProcessId:P,error:J}),C[K]={id:W?.id,error:J}}}return{forkedProcessId:P,reassignedNames:O,failedReassignedNames:C}}static init(e){return e!==void 0&&"signer"in e?new Gat(e):new cP(e)}},cP=class{process;processId;hyperbeamUrl;strict;checkHyperBeamPromise;moduleId;moduleIdPromise;logger=$a.default;constructor(e){if(this.strict=e.strict||!1,Vm(e))this.process=e.process;else if(Ym(e))this.process=new Fn({processId:e.processId});else throw new Wd;this.processId=this.process.processId,e.hyperbeamUrl!==void 0&&(this.hyperbeamUrl=new URL(e.hyperbeamUrl),this.logger.debug(`Using HyperBEAM node for process ${this.processId}`,{hyperbeamUrl:this.hyperbeamUrl}))}checkHyperBeamCompatibility(){return this.hyperbeamUrl===void 0?Promise.resolve(!1):this.checkHyperBeamPromise!==void 0?this.checkHyperBeamPromise:(this.checkHyperBeamPromise=fetch(`${this.hyperbeamUrl.toString()}${this.processId}~process@1.0/now/cache`,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(e=>!!e.ok).catch(e=>(this.logger.debug("Failed to check HyperBeam compatibility",{cause:e}),!1)),this.checkHyperBeamPromise)}async getState({strict:e}={strict:this.strict}){if(await this.checkHyperBeamCompatibility()){let i=0;for(;i<3;)try{let c=await fetch(`${this.hyperbeamUrl}${this.processId}~process@1.0/compute/cache/serialize~json@1.0`,{method:"GET",redirect:"follow",mode:"cors",headers:{"Content-Type":"application/json"}});if(c.status!==200)throw new Error(`Failed to fetch ant state: ${c?.statusText??"Unknown error"}`);let b=await c.json();if(!$$t(b))break;return q$t(b)}catch(c){this.logger.error(`Failed to fetch process state from HyperBEAM (attempt ${i+1} / 3)`,{cause:c}),i++,await new Promise(b=>setTimeout(b,1e3*i**2))}}let a=[{name:"Action",value:"State"}],l=await this.process.read({tags:a});return e&&Gd(AZ.passthrough().and(Ir.object({Records:Ir.record(Ir.string(),Tx.passthrough())})),l),l}async getInfo({strict:e}={strict:this.strict}){if(await this.checkHyperBeamCompatibility()){let i=await this.getState();return{Name:i.Name,Ticker:i.Ticker,Description:i.Description,Keywords:i.Keywords,Denomination:i.Denomination.toString(),Owner:i.Owner,Logo:i.Logo,"Total-Supply":i.TotalSupply.toString(),Handlers:[]}}let a=[{name:"Action",value:"Info"}],l=await this.process.read({tags:a});return e&&Gd(WMt.passthrough(),l),l}async getLogo(){return(await this.getInfo()).Logo}async getModuleId({graphqlUrl:e="https://arweave.net/graphql",retries:a=3}={}){if(this.moduleId!==void 0)return this.logger.debug("Returning cached module ID",{processId:this.processId,moduleId:this.moduleId}),this.moduleId;if(this.moduleIdPromise)return this.logger.debug("Returning in-flight module ID promise",{processId:this.processId}),this.moduleIdPromise;this.moduleIdPromise=this.fetchModuleId({graphqlUrl:e,retries:a});try{let l=await this.moduleIdPromise;return this.moduleId=l,this.logger.debug("Successfully fetched and cached module ID",{processId:this.processId,moduleId:l}),l}finally{this.moduleIdPromise=void 0}}async fetchModuleId({graphqlUrl:e,retries:a}){let l=JSON.stringify({query:`
152
152
  query {
153
153
  transactions(
154
154
  ids: ["${this.processId}"]