@ar.io/sdk 3.22.0-alpha.3 → 3.22.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/web.bundle.min.js +3 -3
- package/lib/cjs/common/hyperbeam/hb.js +2 -2
- package/lib/cjs/common/io.js +64 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/hyperbeam/hb.js +2 -2
- package/lib/esm/common/io.js +64 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -57,7 +57,7 @@ ${JSON.stringify(zt.from(a))},${JSON.stringify(zt.from(l))},${c} => ${JSON.strin
|
|
|
57
57
|
`)}static register(e,a){if(a||(a=e.locale),qie)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 jie="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",zy=null;function l5t(r){if(zy==null&&(zy=jie.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 WF=class extends rg{constructor(){super("en")}getWord(e){return l5t(this),zy[e]}getWordIndex(e){return l5t(this),zy.indexOf(e)}},VF=new WF;rg.register(VF);var wS={en:VF};Et();Rt();At();var d5t="hdnode/5.8.0";var _S=new Br(d5t),zie=Ha.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Fie=df("Bitcoin seed"),Fy=2147483648;function p5t(r){return(1<<r)-1<<8-r}function Hie(r){return(1<<r)-1}function MS(r){return Js(Lr(r),32)}function c5t(r){return KF.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(ZF(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 c5t(Sh([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",Lr(this.depth),this.parentFingerprint,Js(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(zie)):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,Fie,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(JF(e,l),l),r._fromSeed(Kie(e,a),{phrase:e,path:"m",locale:l.locale})}static fromSeed(e){return r._fromSeed(e,null)}static fromExtendedKey(e){let a=KF.decode(e);(a.length!==82||c5t(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 Kie(r,e){e||(e="");let a=df("mnemonic"+e,sd.NFKD);return ov(df(r,sd.NFKD),a,2048,64,"sha512")}function JF(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=p5t(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]&Hie(8-l)),l+=3);let i=r.length/4,c=br(nv(r))[0]&p5t(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 m5t="random/5.8.0";var YF=new Br(m5t);function Zie(){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 v5t=Zie(),SS=v5t.crypto||v5t.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 tH=Rn(QF());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 g5t(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 Wie=new Br(xS),eH=class extends Q2{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function rH(r,e){let a=JSON.parse(r);e=Ky(e);let l=Ys(Za(a,"ethaddr")),i=Pc(Za(a,"encseed"));(!i||i.length%16!==0)&&Wie.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 tH.default.ModeOfOperation.cbc(c,b),y=tH.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 eH({_isCrowdsaleAccount:!0,address:l,privateKey:_})}Et();Rt();At();function iH(r){let e=null;try{e=JSON.parse(r)}catch{return!1}return e.encseed&&e.ethaddr}function nH(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=Rn(QF()),ES=Rn(w5t());var Vie=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())})},oH=new Br(xS);function M5t(r){return r!=null&&r.mnemonic&&r.mnemonic.phrase}var sH=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 _5t(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||oH.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),Ys(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 sH(g)}function S5t(r,e,a,l,i){return br(ov(r,e,a,l,i))}function Jie(r,e,a,l,i){return Promise.resolve(S5t(r,e,a,l,i))}function x5t(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 oH.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 oH.throwArgumentError("unsupported key-derivation function","kdf",b)}function E5t(r,e){let a=JSON.parse(r),l=x5t(a,e,S5t,ES.default.syncScrypt);return _5t(a,l)}function A5t(r,e,a){return Vie(this,void 0,void 0,function*(){let l=JSON.parse(r),i=yield x5t(l,e,Jie,ES.default.scrypt,a);return _5t(l,i)})}function fH(r,e,a,l){try{if(Ys(r.address)!==L0(r.privateKey))throw new Error("address/privateKey mismatch");if(M5t(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(M5t(r)){let B=r.mnemonic;b=br(JF(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),Y=br(W.encrypt(i)),U=Fa(Sh([O,Y])),q={address:r.address.substring(2).toLowerCase(),id:g5t(_),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Lr(S).substring(2)},ciphertext:Lr(Y).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 G=Tp(16),h=new Nc.default.Counter(G),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(G).substring(2),mnemonicCiphertext:Lr(n).substring(2),path:g,locale:M,version:"0.1"}}return JSON.stringify(q)})}function R5t(r,e,a){if(iH(r)){a&&a(0);let l=rH(r,e);return a&&a(1),Promise.resolve(l)}return nH(r)?A5t(r,e,a):Promise.reject(new Error("invalid JSON wallet"))}function I5t(r,e){if(iH(r))return rH(r,e);if(nH(r))return E5t(r,e);throw new Error("invalid JSON wallet")}Et();Rt();At();var k5t="wallet/5.8.0";var T5t=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(k5t);function Yie(r){return r!=null&&Ho(r.privateKey,32)&&r.address!=null}function Xie(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!==Ys(e.address)&&ag.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),Xie(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&&(Ys(a.from)!==this.address&&ag.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete a.from);let l=this._signingKey().signDigest(Fa(HF(a)));return HF(a,l)})}signMessage(e){return T5t(this,void 0,void 0,function*(){return bF(this._signingKey().signDigest(xp(e)))})}_signTypedData(e,a,l){return T5t(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 bF(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={}),fH(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 R5t(e,a,l).then(i=>new r(i))}static fromEncryptedJsonSync(e,a){return new r(I5t(e,a))}static fromMnemonic(e,a,l){return a||(a=sv),new r(kp.fromMnemonic(e,null,l).derivePath(a))}};function B5t(r,e){return FF(xp(r),e)}function AS(r,e,a,l){return FF(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=zt.from(br(i))}async sign(e){this.publicKey||await this.setPublicKey();let a=await this.signer.signMessage(e);return zt.from(a.slice(2),"hex")}static verify(e,a,l){let i=L0(e);return B5t(a,l)===i}};Et();Rt();At();var sg=Rn($5t(),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 j9t=Rn(Wh(),1),zK=Rn(AH(),1);Et();Rt();At();nh();var O9t=Rn(N9t(),1);function jK(r){return r=C9t(r),(0,O9t.default)("keccak256").update(r).digest()}function C9t(r){if(!zt.isBuffer(r))if(Array.isArray(r))r=zt.from(r);else if(typeof r=="string")L9t(r)?r=zt.from(ux(D9t(r)),"hex"):r=zt.from(r);else if(typeof r=="number")r=q9t(r);else if(typeof r=="bigint")r=Use(r);else if(r==null)r=zt.allocUnsafe(0);else throw new Error("invalid type");return r}function L9t(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 D9t(r){return typeof r!="string"?r:$9t(r)?r.slice(2):r}function $9t(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 q9t(r){let e=U9t(r);return zt.from(ux(e.slice(2)),"hex")}function U9t(r){return`0x${r.toString(16)}`}function Use(r){let e=r.toString(16);return zt.from(ux(e),"hex")}typeof window<"u"&&(window.keccak256=jK);var a4=jK,jse={intToBuffer:q9t,intToHex:U9t,isHexPrefixed:$9t,stripHexPrefix:D9t,padToEven:ux,isHexString:L9t,toBuffer:C9t};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 zt.from(this._key,"hex")}static async verify(e,a,l){let i=e;typeof e=="string"&&(i=j9t.default.toBuffer(e));let c=!1;try{c=zK.default.ecdsaVerify(l,a4(zt.from(a)),i)}catch{}return c}async sign(e){return zK.default.ecdsaSign(a4(zt.from(e)),zt.from(this.key)).signature}};var FK=Rn(AH(),1),z9t=Rn(Wh(),1);var ks=class extends Sv{get publicKey(){return zt.from(this.pk,"hex")}constructor(e){e.startsWith("0x")&&(e=e.slice(2));let a=zt.from(e,"hex"),l=FK.default.publicKeyCreate(a,!1);super(e,zt.from(l))}async sign(e){return new og(this._key).signMessage(e).then(l=>zt.from(l.slice(2),"hex"))}static async verify(e,a,l){return FK.default.ecdsaVerify(l.length===65?l.slice(0,-1):l,br(xp(a)),typeof e=="string"?z9t.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 zt.from(this.pk)}get key(){return zt.from(this._key)}constructor(e,a){super(e.subarray(0,32),a)}};Et();Rt();At();var xv=class extends Y2{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(zt.from(zt.from(e).toString("hex")))}static async verify(e,a,l){return super.verify(e,zt.from(zt.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(zt.from(zt.from(e).toString("hex")))}static async verify(e,a,l){return super.verify(e,zt.from(zt.from(a).toString("hex")),l)}};Et();Rt();At();var u4=class extends wh{constructor(e,a){super(e,a)}get publicKey(){return zt.from(this.pk.slice(2),"hex")}get key(){return zt.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:zt.from(e).toString("hex"),nonce:"bundlr"})).signature;return typeof l=="string"?zt.from(l,"hex"):l.data.toUint8Array()}static async verify(e,a,l){let i=e;return vp(zt.from(l),zt.from(`APTOS
|
|
58
58
|
message: ${zt.from(a).toString("hex")}
|
|
59
59
|
nonce: bundlr`),zt.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=zt.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(zt.from(x),zt.from(a),zt.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 zt.from(this.address)}async sign(e){let a=await this.signer._signTypedData(l4,d4,{address:this.address,"Transaction hash":e});return zt.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 HK=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=zt.from(this.address)}async sign(e){let a=await this.signer._signTypedData(l4,d4,{address:this.address,"Transaction hash":e});return zt.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 F9t=Rn(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=F9t.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:Gu,2:wh,3:ks,4:xv,5:Ev,6:Av,7:Rv};Et();Rt();At();Et();Rt();At();async function zse(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=zse;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 KK(r){return v4(2,r)}function Fse(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=Rn(Wh(),1);Et();Rt();At();var F0=Rn(Wh(),1);nh();Et();Rt();At();var b4=class{buf;pos;constructor(e=zt.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=zt.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=zt.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 ZK(r){if(r?.length===0)return zt.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):zt.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):zt.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(zt.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=zt.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(zt.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(zt.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}},WK=vx;function Hse(r){return new WK(r)}async function Kse(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=>zt.concat(c)),i=zt.concat([zt.from(dx(r.length)),zt.from(a),l]);return new WK(i)}async function H9t(r,e){let a=await m4(r),l=await e.sign(a),i=await go().hash(l);return{signature:zt.from(l),id:zt.from(i)}}async function mx(r,e){let{signature:a,id:l}=await H9t(r,e);return r.getRaw().set(a,2),l}Et();Rt();At();var K9t=Rn(Wh(),1);function y4(r,e,a){let l=e.publicKey,i=a?.target?K9t.default.toBuffer(a.target):null,c=1+(i?.byteLength??0),b=a?.anchor?zt.from(a.anchor):null,g=1+(b?.byteLength??0),M=(a?.tags?.length??0)>0?ZK(a?.tags):null,y=16+(M?M.byteLength:0),w=typeof r=="string"?zt.from(r):zt.from(r),S=w.byteLength,_=2+e.signatureLength+e.ownerLength+c+g+y+S,x=zt.alloc(_);if(x.set(KK(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 VK=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 gZ={};I1(gZ,{default:()=>Yse,processStream:()=>RMt,streamExportForTesting:()=>Xse,streamSigner:()=>Jse});Et();Rt();At();Et();Rt();At();X3();FS();Ww();EP();WS();tK();Gw();var JK={},Z9t=!1;function po(){return Z9t||(Z9t=!0,JK={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}),JK}var w4={},W9t=!1;function _4(){if(W9t)return w4;W9t=!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={},V9t=!1;function cf(){if(V9t)return bx;V9t=!0;let r=In(),{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=[],Y=[];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"'),Y.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||Y.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}`}}Y.length>0&&(C+=" or ")}switch(Y.length){case 0:break;case 1:Y[0].toLowerCase()!==Y[0]&&(C+="an "),C+=`${Y[0]}`;break;case 2:C+=`one of ${Y[0]} or ${Y[1]}`;break;default:{let q=Y.pop();C+=`one of ${Y.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 XK={},J9t=!1;function S4(){if(J9t)return XK;J9t=!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:Y}=cf().types,U={};function q(ct){return ct===(ct|0)}function G(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 V(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(!Y(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)}),J=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 XK={isInt32:q,isUint32:G,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:V,validateString:v,validateUint32:d,validateUndefined:J,validateUnion:at,validateAbortSignal:Q,validateLinkHeaderValue:ft},XK}var QK={},Y9t=!1;function $c(){if(Y9t)return QK;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 Y(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 G(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&&G(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,V,$,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:(V=m._readableState)===null||V===void 0?void 0:V.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 QK={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:Y,isReadableFinished:U,isReadableErrored:n,isNodeStream:x,isWebStream:P,isWritable:G,isWritableNodeStream:S,isWritableStream:I,isWritableEnded:K,isWritableFinished:W,isWritableErrored:t,isServerRequest:v,isServerResponse:d,willEmitClose:p,isTransformStream:B},QK}var gx={},X9t=!1;function jp(){if(X9t)return gx;X9t=!0;let r=Yo,{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:Y,isWritableFinished:U,isWritableErrored:q,isNodeStream:G,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)||Y(f))return v(f,o,m);if(!G(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,V=()=>{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)},J=A(f),at=()=>{J=!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=()=>{J=!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",V),f.on("close",V)),!$&&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),J?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",V),f.removeListener("close",V),f.removeListener("finish",rt),f.removeListener("end",H),f.removeListener("error",F),f.removeListener("close",at)};if(o.signal&&!J){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 tZ={},Q9t=!1;function _g(){if(Q9t)return tZ;Q9t=!0;let r=Yo,{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 Y(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 G(h,t){!h||b(h)||(!t&&!g(h)&&(t=new l),M(h)?(h.socket=null,h.destroy(t)):Y(h)?h.abort():Y(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 tZ={construct:C,destroyer:G,destroy:_,undestroy:P,errorOrDestroy:O},tZ}var eZ={},tMt=!1;function mZ(){if(tMt)return eZ;tMt=!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 eZ={Stream:l,prependListener:i},eZ}var M4={},eMt=!1;function wx(){if(eMt)return M4;eMt=!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 rZ={},rMt=!1;function Zse(){if(rMt)return rZ;rMt=!0;let{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:a,Uint8Array:l}=po(),{Buffer:i}=In(),{inspect:c}=cf();return rZ=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})}},rZ}var iZ={},iMt=!1;function Mx(){if(iMt)return iZ;iMt=!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 iZ={getHighWaterMark:y,getDefaultHighWaterMark:g,setDefaultHighWaterMark:M},iZ}var nZ={},nMt=!1;function yMt(){if(nMt)return nZ;nMt=!0;let r=Yo,{PromisePrototypeThen:e,SymbolAsyncIterator:a,SymbolIterator:l}=po(),{Buffer:i}=In(),{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 nZ=g,nZ}var aZ={},aMt=!1,er=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function _x(){if(aMt)return aZ;aMt=!0;let r=Yo,{ArrayPrototypeIndexOf:e,NumberIsInteger:a,NumberIsNaN:l,NumberParseInt:i,ObjectDefineProperties:c,ObjectKeys:b,ObjectSetPrototypeOf:g,Promise:M,SafeSet:y,SymbolAsyncDispose:w,SymbolAsyncIterator:S,Symbol:_}=po();aZ=St,St.ReadableState=wt;let{EventEmitter:x}=wd,{Stream:A,prependListener:I}=mZ(),{Buffer:B}=In(),{addAbortSignal:P}=wx(),O=jp(),C=cf().debuglog("stream",ot=>{C=ot}),K=Zse(),W=_g(),{getHighWaterMark:Y,getDefaultHighWaterMark:U}=Mx(),{aggregateTwoErrors:q,codes:{ERR_INVALID_ARG_TYPE:G,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=yMt();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,V=64,$=128,Z=256,rt=512,Q=1024,H=2048,F=4096,J=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(V),emittedReadable:st($),readableListening:st(Z),resumeScheduled:st(rt),errorEmitted:st(Q),emitClose:st(H),autoDestroy:st(F),destroyed:st(J),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?Y(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 G("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&V)!==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&V)!==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|=V);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 Ft(){return Lt===void 0&&(Lt={}),Lt}return St.fromWeb=function(ot,Mt){return Ft().newStreamReadableFromReadableStream(ot,Mt)},St.toWeb=function(ot,Mt){return Ft().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)},aZ}var oZ={},oMt=!1,ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function vZ(){if(oMt)return oZ;oMt=!0;let r=Yo,{ArrayPrototypeSlice:e,Error:a,FunctionPrototypeSymbolHasInstance:l,ObjectDefineProperty:i,ObjectDefineProperties:c,ObjectSetPrototypeOf:b,StringPrototypeToLowerCase:g,Symbol:M,SymbolHasInstance:y}=po();oZ=d,d.WritableState=s;let{EventEmitter:w}=wd,S=mZ().Stream,{Buffer:_}=In(),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:Y,ERR_STREAM_NULL_VALUES:U,ERR_STREAM_WRITE_AFTER_END:q,ERR_UNKNOWN_ENCODING:G}=$f().codes,{errorOrDestroy:h}=x;b(d.prototype,S.prototype),b(d,S);function t(){}let n=M("kOnFinished");function s(F,J,at){typeof at!="boolean"&&(at=J 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,J),(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 J=(this||ar)instanceof Dc();if(!J&&!l(d,this||ar))return new d(F);(this||ar)._writableState=new s(F,this||ar,J),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,J,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 G(at);typeof ht!="function"&&(ht=t)}if(J===null)throw new U;if(!et.objectMode)if(typeof J=="string")et.decodeStrings!==!1&&(J=_.from(J,at),at="buffer");else if(J instanceof _)at="buffer";else if(S._isUint8Array(J))J=S._uint8ArrayToBuffer(J),at="buffer";else throw new P("chunk",["string","Buffer","Uint8Array"],J);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,J,at,ht))}d.prototype.write=function(F,J,at){return v(this||ar,F,J,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(J){if(typeof J=="string"&&(J=g(J)),!_.isEncoding(J))throw new G(J);return(this||ar)._writableState.defaultEncoding=J,this||ar};function p(F,J,at,ht,et){let ft=J.objectMode?1:at.length;J.length+=ft;let ct=J.length<J.highWaterMark;return ct||(J.needDrain=!0),J.writing||J.corked||J.errored||!J.constructed?(J.buffered.push({chunk:at,encoding:ht,callback:et}),J.allBuffers&&ht!=="buffer"&&(J.allBuffers=!1),J.allNoop&&et!==t&&(J.allNoop=!1)):(J.writelen=ft,J.writecb=et,J.writing=!0,J.sync=!0,F._write(at,ht,J.onwrite),J.sync=!1),ct&&!J.errored&&!J.destroyed}function f(F,J,at,ht,et,ft,ct){J.writelen=ht,J.writecb=ct,J.writing=!0,J.sync=!0,J.destroyed?J.onwrite(new W("write")):at?F._writev(et,J.onwrite):F._write(et,ft,J.onwrite),J.sync=!1}function o(F,J,at,ht){--J.pendingcb,ht(at),k(J),h(F,at)}function m(F,J){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,J?(J.stack,at.errored||(at.errored=J),F._readableState&&!F._readableState.errored&&(F._readableState.errored=J),ht?r.nextTick(o,F,at,J,et):o(F,at,J,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:J,count:at,cb:ht}){return J.afterWriteTickInfo=null,R(F,J,at,ht)}function R(F,J,at,ht){for(!J.ending&&!F.destroyed&&J.length===0&&J.needDrain&&(J.needDrain=!1,F.emit("drain"));at-- >0;)J.pendingcb--,ht();J.destroyed&&k(J),$(F,J)}function k(F){if(F.writing)return;for(let et=F.bufferedIndex;et<F.buffered.length;++et){var J;let{chunk:ft,callback:ct}=F.buffered[et],st=F.objectMode?1:ft.length;F.length-=st,ct((J=F.errored)!==null&&J!==void 0?J: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,J){if(J.corked||J.bufferProcessing||J.destroyed||!J.constructed)return;let{buffered:at,bufferedIndex:ht,objectMode:et}=J,ft=at.length-ht;if(!ft)return;let ct=ht;if(J.bufferProcessing=!0,ft>1&&F._writev){J.pendingcb-=ft-1;let st=J.allNoop?t:St=>{for(let ut=ct;ut<at.length;++ut)at[ut].callback(St)},wt=J.allNoop&&ct===0?at:e(at,ct);wt.allBuffers=J.allBuffers,f(F,J,!0,J.length,wt,"",st),u(J)}else{do{let{chunk:st,encoding:wt,callback:St}=at[ct];at[ct++]=null;let ut=et?1:st.length;f(F,J,!1,ut,st,wt,St)}while(ct<at.length&&!J.writing);ct===at.length?u(J):ct>256?(at.splice(0,ct),J.bufferedIndex=0):J.bufferedIndex=ct}J.bufferProcessing=!1}d.prototype._write=function(F,J,at){if((this||ar)._writev)this._writev([{chunk:F,encoding:J}],at);else throw new O("_write()")},d.prototype._writev=null,d.prototype.end=function(F,J,at){let ht=(this||ar)._writableState;typeof F=="function"?(at=F,F=null,J=null):typeof J=="function"&&(at=J,J=null);let et;if(F!=null){let ft=v(this||ar,F,J);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 Y("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,J){let at=!1;function ht(et){if(at){h(F,et??C());return}if(at=!0,J.pendingcb--,et){let ft=J[n].splice(0);for(let ct=0;ct<ft.length;ct++)ft[ct](et);h(F,et,J.sync)}else z(J)&&(J.prefinished=!0,F.emit("prefinish"),J.pendingcb++,r.nextTick(Z,F,J))}J.sync=!0,J.pendingcb++;try{F._final(ht)}catch(et){ht(et)}J.sync=!1}function V(F,J){!J.prefinished&&!J.finalCalled&&(typeof F._final=="function"&&!J.destroyed?(J.finalCalled=!0,it(F,J)):(J.prefinished=!0,F.emit("prefinish")))}function $(F,J,at){z(J)&&(V(F,J),J.pendingcb===0&&(at?(J.pendingcb++,r.nextTick((ht,et)=>{z(et)?Z(ht,et):et.pendingcb--},F,J)):z(J)&&(J.pendingcb++,Z(F,J))))}function Z(F,J){J.pendingcb--,J.finished=!0;let at=J[n].splice(0);for(let ht=0;ht<at.length;ht++)at[ht]();if(F.emit("finish"),J.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,J){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,J),this||ar},d.prototype._undestroy=x.undestroy,d.prototype._destroy=function(F,J){J(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,J){return H().newStreamWritableFromWritableStream(F,J)},d.toWeb=function(F){return H().newWritableStreamFromStreamWritable(F)},oZ}var sZ={},sMt=!1;function Wse(){if(sMt)return sZ;sMt=!0;let r=Yo,e=In(),{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=vZ(),{createDeferredPromise:C}=cf(),K=yMt(),W=globalThis.Blob||e.Blob,Y=typeof W<"u"?function(s){return s instanceof W}:function(s){return!1},U=globalThis.AbortController||_4().AbortController,{FunctionPrototypeCall:q}=po();class G 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)}}sZ=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(G,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 G({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(Y(s))return n(s.arrayBuffer());if(i(s))return K(G,s,{objectMode:!0,writable:!1});if(y(s?.readable)&&w(s?.writable))return G.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 G({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 G({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 sZ}var fZ={},fMt=!1;function Dc(){if(fMt)return fZ;fMt=!0;let{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:a,ObjectSetPrototypeOf:l}=po();fZ=b;let i=_x(),c=vZ();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=Wse()),y(w,"body")},fZ}var hZ={},hMt=!1;function wMt(){if(hMt)return hZ;hMt=!0;let{ObjectSetPrototypeOf:r,Symbol:e}=po();hZ=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()}},hZ}var uZ={},uMt=!1;function MMt(){if(uMt)return uZ;uMt=!0;let{ObjectSetPrototypeOf:r}=po();uZ=a;let e=wMt();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)},uZ}var lZ={},lMt=!1;function bZ(){if(lMt)return lZ;lMt=!0;let r=Yo,{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:Y,isWebStream:U,isReadableStream:q,isReadableFinished:G}=$c(),h=globalThis.AbortController||_4().AbortController,t,n,s;function u(k,L,z){let it=!1;k.on("close",()=>{it=!0});let V=c(k,{readable:L,writable:z},$=>{it=!$});return{destroy:$=>{it||(it=!0,g.destroyer(k,$||new x("pipe")))},cleanup:V}}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 V,$=null,Z=H=>{if(H&&(V=H),$){let F=$;$=null,F()}},rt=()=>new a((H,F)=>{V?F(V):$=()=>{V?F(V):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(V!==H?y(V,H):H)}finally{Q(),L.off("drain",Z)}}async function o(k,L,z,{end:it}){Y(L)&&(L=L.writable);let V=L.getWriter();try{for await(let $ of k)await V.ready,V.write($).catch(()=>{});await V.ready,it&&await V.close(),z()}catch($){try{await V.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,V=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,J=[],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(;J.length;)J.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);J.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:V}),!O(ft))throw new S("Iterable, AsyncIterable or Stream","source",ft)}else O(ut)||K(ut)||Y(ut)?ft=ut:ft=M.from(ut);else if(typeof ut=="function"){if(Y(ft)){var ct;ft=v((ct=ft)===null||ct===void 0?void 0:ct.readable)}else ft=v(ft);if(ft=ut(ft,{signal:V}),It){if(!O(ft,!0))throw new S("AsyncIterable",`transform[${St-1}]`,ft)}else{var st;t||(t=MMt());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)||Y(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);J.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(Y(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(Y(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(V!=null&&V.aborted||$!=null&&$.aborted)&&r.nextTick(rt),ft}function R(k,L,z,{end:it}){let V=!1;if(L.on("close",()=>{V||z(new A)}),k.pipe(L,{end:!1}),it){let Z=function(){V=!0,L.end()};var $=Z;G(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 lZ={pipelineImpl:E,pipeline:m},lZ}var dZ={},dMt=!1;function _Mt(){if(dMt)return dZ;dMt=!0;let{pipeline:r}=bZ(),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 dZ=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 Y(t){let n=K;K=null,n?n(t):t?W.destroy(t):!h&&!G&&W.destroy()}let U=I[0],q=r(I,Y),G=!!(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:G,readable:h}),G){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},dZ}var yx={},cMt=!1;function Vse(){if(cMt)return yx;cMt=!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(),_=_Mt(),{addAbortSignalNoValidate:x}=wx(),{isWritable:A,isNodeStream:I}=$c(),{deprecate:B}=cf(),{ArrayPrototypePush:P,Boolean:O,MathFloor:C,Number:K,NumberIsNaN:W,Promise:Y,PromiseReject:U,PromiseResolve:q,PromisePrototypeThen:G,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)),J=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 J){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,G(Pt,St,wt),at.push(Pt),et&&(et(),et=null),!ct&&(at.length>=Q||st>=rt)&&await new Y(j=>{ft=j})}at.push(n)}catch(Pt){let j=U(Pt);G(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 Y(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,J=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:J}):(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 V($,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:V,compose:s},yx.promiseReturningOperators={every:p,forEach:o,reduce:R,toArray:k,some:v,find:f},yx}var cZ={},pMt=!1;function SMt(){if(pMt)return cZ;pMt=!0;let{ArrayPrototypePop:r,Promise:e}=po(),{isIterable:a,isNodeStream:l,isWebStream:i}=$c(),{pipelineImpl:c}=bZ(),{finished:b}=jp();xMt();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 cZ={finished:b,pipeline:g},cZ}var pZ={},mMt=!1,vMt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function xMt(){if(mMt)return pZ;mMt=!0;let{Buffer:r}=In(),{ObjectDefineProperty:e,ObjectKeys:a,ReflectApply:l}=po(),{promisify:{custom:i}}=cf(),{streamReturningOperators:c,promiseReturningOperators:b}=Vse(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:g}}=$f(),M=_Mt(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:w}=Mx(),{pipeline:S}=bZ(),{destroyer:_}=_g(),x=jp(),A=SMt(),I=$c(),B=pZ=mZ().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(...Y){if(new.target)throw g();return B.Readable.from(l(K,this||vMt,Y))};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||vMt,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=vZ(),B.Duplex=Dc(),B.Transform=wMt(),B.PassThrough=MMt(),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)},pZ}var co={},bMt=!1;function Gse(){if(bMt)return co;bMt=!0;let r=xMt(),e=SMt(),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 gMt=Sa.Readable;gMt.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 gMt(e).wrap(r)};var cDe=Sa.Writable,pDe=Sa.Duplex,EMt=Sa.Transform,AMt=Sa.PassThrough,mDe=Sa.finished,vDe=Sa.pipeline,bDe=Sa.Stream,gDe={finished:ZS(Sa.finished),pipeline:ZS(Sa.pipeline)};var Iv=Rn(Wh(),1);rd();async function RMt(r){let e=IMt(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)(zt.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):zt.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):zt.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 Y=a.subarray(0,W),U=K!==0&&W!==0?yg(zt.from(Y)):[];if(U.length!==K)throw new Error("Tags lengths don't match");a=a.subarray(W);let q=new EMt;q._transform=function(s,u,d){this.push(s),d()};let G=bp([(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(w.toString()),I,P,C,Y,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 G,A))throw new Error("Invalid signature");g.push({id:y,sigName:x,signature:(0,Iv.default)(zt.from(A)),target:(0,Iv.default)(zt.from(P)),anchor:(0,Iv.default)(zt.from(C)),owner:(0,Iv.default)(zt.from(I)),tags:U,dataOffset:b+h,dataSize:t}),b+=h+t}return g}async function Jse(r,e,a,l){let i=y4("",a,l),c=new AMt,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=zt.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,zt.concat([zt.from(e),zt.from(i)]),a)}async function*IMt(r){for await(let e of r)yield e}var Yse=RMt,Xse={readBytes:pf,getReader:IMt};var Qse={...GK,stream:gZ};globalThis.arbundles??=Qse;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 wZ;(function(r){r.mergeShapes=(e,a)=>({...e,...a})})(wZ||(wZ={}));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"]),tfe=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}},PMt=Eg;function efe(r){PMt=r}function Sx(){return PMt}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}},rfe=[];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}),MZ=r=>r.status==="aborted",_Z=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 NMt(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}},kMt=(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 kMt(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 kMt(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}},ife=/^c[^\s-]{8,}$/i,nfe=/^[0-9a-z]+$/,afe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ofe=/^[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,sfe=/^[a-z0-9_-]{21}$/i,ffe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hfe=/^[-+]?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)?)??$/,ufe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lfe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yZ,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])$/,cfe=/^(?:(?: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])$/,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]))$/,mfe=/^(([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])$/,vfe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bfe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OMt="((\\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])))",gfe=new RegExp(`^${OMt}$`);function CMt(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 yfe(r){return new RegExp(`^${CMt(r)}$`)}function LMt(r){let e=`${OMt}T${CMt(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 wfe(r,e){return!!((e==="v4"||!e)&&dfe.test(r)||(e==="v6"||!e)&&pfe.test(r))}function Mfe(r,e){if(!ffe.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 _fe(r,e){return!!((e==="v4"||!e)&&cfe.test(r)||(e==="v6"||!e)&&mfe.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")ufe.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")yZ||(yZ=new RegExp(lfe,"u")),yZ.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")ofe.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")sfe.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")ife.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")nfe.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")afe.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"?LMt(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"?gfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"date",message:c.message}),l.dirty()):c.kind==="time"?yfe(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"?hfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"duration",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="ip"?wfe(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"?Mfe(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"?_fe(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"?vfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"base64",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="base64url"?bfe.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 Sfe(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"?Sfe(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 DMt(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 SZ(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=SZ(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=SZ(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(MZ(c)||MZ(b))return Kr;let g=SZ(c.value,b.value);return g.valid?((_Z(c)||_Z(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 DMt(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")||NMt(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=DMt;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")||NMt(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 xfe=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 TMt(r,e){let a=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof a=="string"?{message:a}:a}function $Mt(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=TMt(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=TMt(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 Efe={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 Afe=(r,e={message:`Input not instance of ${r.name}`})=>$Mt(a=>a instanceof r,e),qMt=zp.create,UMt=Tv.create,Rfe=Tg.create,Ife=Bv.create,jMt=Pv.create,kfe=Nv.create,Tfe=Ag.create,Bfe=Ov.create,Pfe=Cv.create,Nfe=Fp.create,Ofe=jc.create,Cfe=fl.create,Lfe=Rg.create,Dfe=zc.create,$fe=qf.create,qfe=qf.strictCreate,Ufe=Lv.create,jfe=Ax.create,zfe=Dv.create,Ffe=xd.create,Hfe=Rx.create,Kfe=Ig.create,Zfe=kg.create,Wfe=Ix.create,Vfe=$v.create,Gfe=qv.create,Jfe=Uv.create,Yfe=jv.create,Xfe=Hp.create,BMt=Ih.create,Qfe=H0.create,the=Ed.create,ehe=Ih.createWithPreprocess,rhe=I4.create,ihe=()=>qMt().optional(),nhe=()=>UMt().optional(),ahe=()=>jMt().optional(),ohe={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}))},she=Kr,Ir=Object.freeze({__proto__:null,defaultErrorMap:Eg,setErrorMap:efe,getErrorMap:Sx,makeIssue:xx,EMPTY_PATH:rfe,addIssueToContext:_r,ParseStatus:tf,INVALID:Kr,DIRTY:xg,OK:mf,isAborted:MZ,isDirty:_Z,isValid:kv,isAsync:A4,get util(){return ln},get objectUtil(){return wZ},ZodParsedType:Er,getParsedType:Uc,ZodType:yi,datetimeRegex:LMt,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:xfe,ZodBranded:R4,ZodPipeline:I4,ZodReadonly:Hv,custom:$Mt,Schema:yi,ZodSchema:yi,late:Efe,get ZodFirstPartyTypeKind(){return Ur},coerce:ohe,any:Nfe,array:Dfe,bigint:Ife,boolean:jMt,date:kfe,discriminatedUnion:jfe,effect:BMt,enum:Jfe,function:Wfe,instanceof:Afe,intersection:zfe,lazy:Vfe,literal:Gfe,map:Kfe,nan:Rfe,nativeEnum:Yfe,never:Cfe,null:Pfe,nullable:the,number:UMt,object:$fe,oboolean:ahe,onumber:nhe,optional:Qfe,ostring:ihe,pipeline:rhe,preprocess:ehe,promise:Xfe,record:Hfe,set:Zfe,strictObject:qfe,string:qMt,symbol:Tfe,transformer:BMt,tuple:Ffe,undefined:Bfe,union:Ufe,unknown:Ofe,void:Lfe,NEVER:she,ZodIssueCode:sr,quotelessJson:tfe,ZodError:Rh});Et();Rt();At();var kx=new RegExp("^[a-zA-Z0-9_-]{43}$"),VDe=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),fhe="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",GDe=fhe,xZ="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",ef="qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE",JDe="RR0vheYqtsKuJCWh6xj0beE35tjaEug5cejMw9n2aa8",kh="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",EZ=1e6,YDe="nEjlSFA_8narJlVHApbczDPkMc9znSqYtqtf1iOdoxM",zMt="sOW9Sdm1yoPRrzerC5iu1nsupp4e6I-HnJyYVHzvzQo",FMt="fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",HMt="_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"}),KMt=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"}),hhe=Ir.string(),AZ=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()),RZ=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:AZ.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.")}),WMt=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:AZ.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.")}),uhe=["balance","balances","totalSupply","info","controllers","record","records","state"],lhe=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames","transferRecordOwnership"],dhe=[...uhe,...lhe],ZMt=Ir.array(Ir.string({description:"Handler Name"})).refine(r=>dhe.every(e=>r.includes(e)),{message:"ANT is missing required handlers"}),VMt=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":KMt.describe("Total supply of the ANT in circulation."),Description:hhe.describe("The description for the ANT."),Keywords:AZ.describe("The keywords for the ANT."),Logo:Bg.describe("Transaction ID of the ANT logo."),Denomination:KMt.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:ZMt.optional().describe("List of handlers for the ANT."),HandlerNames:ZMt.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function n$e(r){return RZ.safeParse(r).success}Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var Kp="3.22.0-alpha.2";var xa=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 che=Object.create,oB=Object.defineProperty,phe=Object.getOwnPropertyDescriptor,mhe=Object.getOwnPropertyNames,vhe=Object.getPrototypeOf,bhe=Object.prototype.hasOwnProperty,wu=(r,e)=>()=>(r&&(e=r(r=0)),e),Aa=(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})},NIt=(r,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mhe(e))!bhe.call(r,i)&&i!==a&&oB(r,i,{get:()=>e[i],enumerable:!(l=phe(e,i))||l.enumerable});return r},fB=(r,e,a)=>(a=r!=null?che(vhe(r)):{},NIt(e||!r||!r.__esModule?oB(a,"default",{value:r,enumerable:!0}):a,r)),GMt=r=>NIt(oB({},"__esModule",{value:!0}),r),ghe=Aa(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,Y;for(Y=0;Y<W;Y+=4)I=a[A.charCodeAt(Y)]<<18|a[A.charCodeAt(Y+1)]<<12|a[A.charCodeAt(Y+2)]<<6|a[A.charCodeAt(Y+3)],C[K++]=I>>16&255,C[K++]=I>>8&255,C[K++]=I&255;return O===2&&(I=a[A.charCodeAt(Y)]<<2|a[A.charCodeAt(Y+1)]>>4,C[K++]=I&255),O===1&&(I=a[A.charCodeAt(Y)]<<10|a[A.charCodeAt(Y+1)]<<4|a[A.charCodeAt(Y+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("")}}),yhe=Aa(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}}),OIt=Aa(r=>{"use strict";var e=ghe(),a=yhe(),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 Y(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 Y(this,T,N,D,!0)},g.prototype.lastIndexOf=function(T,N,D){return Y(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 G(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 G(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)&&J(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)&&J(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)&&J(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)&&J(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 V(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 V(this,T,N,!0,D)},g.prototype.writeDoubleBE=function(T,N,D){return V(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)&&J(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 J(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")}}),whe=Aa((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":"")}}),Mhe=Aa((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=whe(),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),Y=W-(A||W);K.diff=Y,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,G)=>{if(q==="%%")return"%";U++;let h=c.formatters[G];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}),_he=Aa((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=Mhe()(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 CIt(r){return r._maxListeners===void 0?fa.defaultMaxListeners:r._maxListeners}function JMt(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=CIt(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 She(){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=She.bind(l);return i.listener=a,l.wrapFn=i,i}function XMt(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):LIt(i,i.length)}function QMt(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 LIt(r,e){for(var a=new Array(e),l=0;l<e;++l)a[l]=r[l];return a}var t_t,e_t,Kv,IZ,kZ,TZ,gs,DIt=wu(()=>{Kv=typeof Reflect=="object"?Reflect:null,IZ=Kv&&typeof Kv.apply=="function"?Kv.apply:function(r,e,a){return Function.prototype.apply.call(r,e,a)},e_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)},kZ=Number.isNaN||function(r){return r!=r},t_t=fa,fa.EventEmitter=fa,fa.prototype._events=void 0,fa.prototype._eventsCount=0,fa.prototype._maxListeners=void 0,TZ=10,Object.defineProperty(fa,"defaultMaxListeners",{enumerable:!0,get:function(){return TZ},set:function(r){if(typeof r!="number"||r<0||kZ(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");TZ=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||kZ(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 CIt(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")IZ(g,this,e);else{var M=g.length,y=LIt(g,M);for(a=0;a<M;++a)IZ(y[a],this,e)}return!0},fa.prototype.addListener=function(r,e){return JMt(this,r,e,!1)},fa.prototype.on=fa.prototype.addListener,fa.prototype.prependListener=function(r,e){return JMt(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 XMt(this,r,!0)},fa.prototype.rawListeners=function(r){return XMt(this,r,!1)},fa.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):QMt.call(r,e)},fa.prototype.listenerCount=QMt,fa.prototype.eventNames=function(){return this._eventsCount>0?e_t(this._events):[]},gs=t_t,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount});function ZV(){throw new Error("setTimeout has not been defined")}function WV(){throw new Error("clearTimeout has not been defined")}function $It(r){if(t1===setTimeout)return setTimeout(r,0);if((t1===ZV||!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 xhe(){R6&&M6&&(R6=!1,M6.length?$d=M6.concat($d):n7=-1,$d.length&&qIt())}function qIt(){if(!R6){var r=$It(xhe);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===WV||!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 r_t(r,e){(this||A6).fun=r,(this||A6).array=e}function Fc(){}var i_t,t1,e1,A6,mo,M6,$d,R6,n7,ti,qrt=wu(()=>{A6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis,mo=i_t={},(function(){try{t1=typeof setTimeout=="function"?setTimeout:ZV}catch{t1=ZV}try{e1=typeof clearTimeout=="function"?clearTimeout:WV}catch{e1=WV}})(),$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 r_t(r,e)),$d.length!==1||R6||$It(qIt)},r_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=i_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 n_t(r){return Mf&&th?qn(r)!==void 0:UIt(r)||jIt(r)||zIt(r)||FIt(r)||HIt(r)||KIt(r)||ZIt(r)||WIt(r)||VIt(r)||GIt(r)||JIt(r)}function UIt(r){return Mf&&th?qn(r)==="Uint8Array":qa(r)==="[object Uint8Array]"||tkt(r)&&r.buffer!==void 0}function jIt(r){return Mf&&th?qn(r)==="Uint8ClampedArray":qa(r)==="[object Uint8ClampedArray]"}function zIt(r){return Mf&&th?qn(r)==="Uint16Array":qa(r)==="[object Uint16Array]"}function FIt(r){return Mf&&th?qn(r)==="Uint32Array":qa(r)==="[object Uint32Array]"}function HIt(r){return Mf&&th?qn(r)==="Int8Array":qa(r)==="[object Int8Array]"}function KIt(r){return Mf&&th?qn(r)==="Int16Array":qa(r)==="[object Int16Array]"}function ZIt(r){return Mf&&th?qn(r)==="Int32Array":qa(r)==="[object Int32Array]"}function WIt(r){return Mf&&th?qn(r)==="Float32Array":qa(r)==="[object Float32Array]"}function VIt(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 JIt(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 BZ(r){return qa(r)==="[object WeakSet]"}function bT(r){return qa(r)==="[object ArrayBuffer]"}function a_t(r){return typeof ArrayBuffer<"u"&&(bT.working?bT(r):r instanceof ArrayBuffer)}function gT(r){return qa(r)==="[object DataView]"}function o_t(r){return typeof DataView<"u"&&(gT.working?gT(r):r instanceof DataView)}function yT(r){return qa(r)==="[object SharedArrayBuffer]"}function s_t(r){return typeof SharedArrayBuffer<"u"&&(yT.working?yT(r):r instanceof SharedArrayBuffer)}function f_t(r){return iw(r,ekt)}function h_t(r){return iw(r,rkt)}function u_t(r){return iw(r,ikt)}function l_t(r){return VV&&iw(r,pU)}function d_t(r){return CE&&iw(r,vU)}function Tm(r,e){var a={seen:[],stylize:Ahe};return arguments.length>=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),Urt(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=Ehe),wT(a,r,a.depth)}function Ehe(r,e){var a=Tm.styles[e];return a?"\x1B["+Tm.colors[a][0]+"m"+r+"\x1B["+Tm.colors[a][1]+"m":r}function Ahe(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(XIt(x))return _.stylize(""+x,"number");if(Urt(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 PZ(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 PZ(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=" "+PZ(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)QIt(x,String(O))?P.push(NZ(_,x,A,I,String(O),!0)):P.push("");return B.forEach(function(K){K.match(/^\d+$/)||P.push(NZ(_,x,A,I,K,!0))}),P})(r,e,a,b,c):c.map(function(_){return NZ(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=[],Y=[];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"'),Y.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||Y.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}`}}Y.length>0&&(C+=" or ")}switch(Y.length){case 0:break;case 1:Y[0].toLowerCase()!==Y[0]&&(C+="an "),C+=`${Y[0]}`;break;case 2:C+=`one of ${Y[0]} or ${Y[1]}`;break;default:{let q=Y.pop();C+=`one of ${Y.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 XK={},J9t=!1;function S4(){if(J9t)return XK;J9t=!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:Y}=cf().types,U={};function q(ct){return ct===(ct|0)}function G(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 V(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(!Y(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)}),J=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 XK={isInt32:q,isUint32:G,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:V,validateString:v,validateUint32:d,validateUndefined:J,validateUnion:at,validateAbortSignal:Q,validateLinkHeaderValue:ft},XK}var QK={},Y9t=!1;function $c(){if(Y9t)return QK;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 Y(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 G(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&&G(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,V,$,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:(V=m._readableState)===null||V===void 0?void 0:V.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 QK={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:Y,isReadableFinished:U,isReadableErrored:n,isNodeStream:x,isWebStream:P,isWritable:G,isWritableNodeStream:S,isWritableStream:I,isWritableEnded:K,isWritableFinished:W,isWritableErrored:t,isServerRequest:v,isServerResponse:d,willEmitClose:p,isTransformStream:B},QK}var gx={},X9t=!1;function jp(){if(X9t)return gx;X9t=!0;let r=Yo,{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:Y,isWritableFinished:U,isWritableErrored:q,isNodeStream:G,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)||Y(f))return v(f,o,m);if(!G(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,V=()=>{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)},J=A(f),at=()=>{J=!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=()=>{J=!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",V),f.on("close",V)),!$&&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),J?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",V),f.removeListener("close",V),f.removeListener("finish",rt),f.removeListener("end",H),f.removeListener("error",F),f.removeListener("close",at)};if(o.signal&&!J){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 tZ={},Q9t=!1;function _g(){if(Q9t)return tZ;Q9t=!0;let r=Yo,{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 Y(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 G(h,t){!h||b(h)||(!t&&!g(h)&&(t=new l),M(h)?(h.socket=null,h.destroy(t)):Y(h)?h.abort():Y(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 tZ={construct:C,destroyer:G,destroy:_,undestroy:P,errorOrDestroy:O},tZ}var eZ={},tMt=!1;function mZ(){if(tMt)return eZ;tMt=!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 eZ={Stream:l,prependListener:i},eZ}var M4={},eMt=!1;function wx(){if(eMt)return M4;eMt=!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 rZ={},rMt=!1;function Zse(){if(rMt)return rZ;rMt=!0;let{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:a,Uint8Array:l}=po(),{Buffer:i}=In(),{inspect:c}=cf();return rZ=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})}},rZ}var iZ={},iMt=!1;function Mx(){if(iMt)return iZ;iMt=!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 iZ={getHighWaterMark:y,getDefaultHighWaterMark:g,setDefaultHighWaterMark:M},iZ}var nZ={},nMt=!1;function yMt(){if(nMt)return nZ;nMt=!0;let r=Yo,{PromisePrototypeThen:e,SymbolAsyncIterator:a,SymbolIterator:l}=po(),{Buffer:i}=In(),{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 nZ=g,nZ}var aZ={},aMt=!1,er=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function _x(){if(aMt)return aZ;aMt=!0;let r=Yo,{ArrayPrototypeIndexOf:e,NumberIsInteger:a,NumberIsNaN:l,NumberParseInt:i,ObjectDefineProperties:c,ObjectKeys:b,ObjectSetPrototypeOf:g,Promise:M,SafeSet:y,SymbolAsyncDispose:w,SymbolAsyncIterator:S,Symbol:_}=po();aZ=St,St.ReadableState=wt;let{EventEmitter:x}=wd,{Stream:A,prependListener:I}=mZ(),{Buffer:B}=In(),{addAbortSignal:P}=wx(),O=jp(),C=cf().debuglog("stream",ot=>{C=ot}),K=Zse(),W=_g(),{getHighWaterMark:Y,getDefaultHighWaterMark:U}=Mx(),{aggregateTwoErrors:q,codes:{ERR_INVALID_ARG_TYPE:G,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=yMt();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,V=64,$=128,Z=256,rt=512,Q=1024,H=2048,F=4096,J=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(V),emittedReadable:st($),readableListening:st(Z),resumeScheduled:st(rt),errorEmitted:st(Q),emitClose:st(H),autoDestroy:st(F),destroyed:st(J),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?Y(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 G("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&V)!==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&V)!==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|=V);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 Ft(){return Lt===void 0&&(Lt={}),Lt}return St.fromWeb=function(ot,Mt){return Ft().newStreamReadableFromReadableStream(ot,Mt)},St.toWeb=function(ot,Mt){return Ft().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)},aZ}var oZ={},oMt=!1,ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function vZ(){if(oMt)return oZ;oMt=!0;let r=Yo,{ArrayPrototypeSlice:e,Error:a,FunctionPrototypeSymbolHasInstance:l,ObjectDefineProperty:i,ObjectDefineProperties:c,ObjectSetPrototypeOf:b,StringPrototypeToLowerCase:g,Symbol:M,SymbolHasInstance:y}=po();oZ=d,d.WritableState=s;let{EventEmitter:w}=wd,S=mZ().Stream,{Buffer:_}=In(),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:Y,ERR_STREAM_NULL_VALUES:U,ERR_STREAM_WRITE_AFTER_END:q,ERR_UNKNOWN_ENCODING:G}=$f().codes,{errorOrDestroy:h}=x;b(d.prototype,S.prototype),b(d,S);function t(){}let n=M("kOnFinished");function s(F,J,at){typeof at!="boolean"&&(at=J 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,J),(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 J=(this||ar)instanceof Dc();if(!J&&!l(d,this||ar))return new d(F);(this||ar)._writableState=new s(F,this||ar,J),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,J,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 G(at);typeof ht!="function"&&(ht=t)}if(J===null)throw new U;if(!et.objectMode)if(typeof J=="string")et.decodeStrings!==!1&&(J=_.from(J,at),at="buffer");else if(J instanceof _)at="buffer";else if(S._isUint8Array(J))J=S._uint8ArrayToBuffer(J),at="buffer";else throw new P("chunk",["string","Buffer","Uint8Array"],J);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,J,at,ht))}d.prototype.write=function(F,J,at){return v(this||ar,F,J,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(J){if(typeof J=="string"&&(J=g(J)),!_.isEncoding(J))throw new G(J);return(this||ar)._writableState.defaultEncoding=J,this||ar};function p(F,J,at,ht,et){let ft=J.objectMode?1:at.length;J.length+=ft;let ct=J.length<J.highWaterMark;return ct||(J.needDrain=!0),J.writing||J.corked||J.errored||!J.constructed?(J.buffered.push({chunk:at,encoding:ht,callback:et}),J.allBuffers&&ht!=="buffer"&&(J.allBuffers=!1),J.allNoop&&et!==t&&(J.allNoop=!1)):(J.writelen=ft,J.writecb=et,J.writing=!0,J.sync=!0,F._write(at,ht,J.onwrite),J.sync=!1),ct&&!J.errored&&!J.destroyed}function f(F,J,at,ht,et,ft,ct){J.writelen=ht,J.writecb=ct,J.writing=!0,J.sync=!0,J.destroyed?J.onwrite(new W("write")):at?F._writev(et,J.onwrite):F._write(et,ft,J.onwrite),J.sync=!1}function o(F,J,at,ht){--J.pendingcb,ht(at),k(J),h(F,at)}function m(F,J){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,J?(J.stack,at.errored||(at.errored=J),F._readableState&&!F._readableState.errored&&(F._readableState.errored=J),ht?r.nextTick(o,F,at,J,et):o(F,at,J,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:J,count:at,cb:ht}){return J.afterWriteTickInfo=null,R(F,J,at,ht)}function R(F,J,at,ht){for(!J.ending&&!F.destroyed&&J.length===0&&J.needDrain&&(J.needDrain=!1,F.emit("drain"));at-- >0;)J.pendingcb--,ht();J.destroyed&&k(J),$(F,J)}function k(F){if(F.writing)return;for(let et=F.bufferedIndex;et<F.buffered.length;++et){var J;let{chunk:ft,callback:ct}=F.buffered[et],st=F.objectMode?1:ft.length;F.length-=st,ct((J=F.errored)!==null&&J!==void 0?J: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,J){if(J.corked||J.bufferProcessing||J.destroyed||!J.constructed)return;let{buffered:at,bufferedIndex:ht,objectMode:et}=J,ft=at.length-ht;if(!ft)return;let ct=ht;if(J.bufferProcessing=!0,ft>1&&F._writev){J.pendingcb-=ft-1;let st=J.allNoop?t:St=>{for(let ut=ct;ut<at.length;++ut)at[ut].callback(St)},wt=J.allNoop&&ct===0?at:e(at,ct);wt.allBuffers=J.allBuffers,f(F,J,!0,J.length,wt,"",st),u(J)}else{do{let{chunk:st,encoding:wt,callback:St}=at[ct];at[ct++]=null;let ut=et?1:st.length;f(F,J,!1,ut,st,wt,St)}while(ct<at.length&&!J.writing);ct===at.length?u(J):ct>256?(at.splice(0,ct),J.bufferedIndex=0):J.bufferedIndex=ct}J.bufferProcessing=!1}d.prototype._write=function(F,J,at){if((this||ar)._writev)this._writev([{chunk:F,encoding:J}],at);else throw new O("_write()")},d.prototype._writev=null,d.prototype.end=function(F,J,at){let ht=(this||ar)._writableState;typeof F=="function"?(at=F,F=null,J=null):typeof J=="function"&&(at=J,J=null);let et;if(F!=null){let ft=v(this||ar,F,J);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 Y("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,J){let at=!1;function ht(et){if(at){h(F,et??C());return}if(at=!0,J.pendingcb--,et){let ft=J[n].splice(0);for(let ct=0;ct<ft.length;ct++)ft[ct](et);h(F,et,J.sync)}else z(J)&&(J.prefinished=!0,F.emit("prefinish"),J.pendingcb++,r.nextTick(Z,F,J))}J.sync=!0,J.pendingcb++;try{F._final(ht)}catch(et){ht(et)}J.sync=!1}function V(F,J){!J.prefinished&&!J.finalCalled&&(typeof F._final=="function"&&!J.destroyed?(J.finalCalled=!0,it(F,J)):(J.prefinished=!0,F.emit("prefinish")))}function $(F,J,at){z(J)&&(V(F,J),J.pendingcb===0&&(at?(J.pendingcb++,r.nextTick((ht,et)=>{z(et)?Z(ht,et):et.pendingcb--},F,J)):z(J)&&(J.pendingcb++,Z(F,J))))}function Z(F,J){J.pendingcb--,J.finished=!0;let at=J[n].splice(0);for(let ht=0;ht<at.length;ht++)at[ht]();if(F.emit("finish"),J.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,J){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,J),this||ar},d.prototype._undestroy=x.undestroy,d.prototype._destroy=function(F,J){J(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,J){return H().newStreamWritableFromWritableStream(F,J)},d.toWeb=function(F){return H().newWritableStreamFromStreamWritable(F)},oZ}var sZ={},sMt=!1;function Wse(){if(sMt)return sZ;sMt=!0;let r=Yo,e=In(),{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=vZ(),{createDeferredPromise:C}=cf(),K=yMt(),W=globalThis.Blob||e.Blob,Y=typeof W<"u"?function(s){return s instanceof W}:function(s){return!1},U=globalThis.AbortController||_4().AbortController,{FunctionPrototypeCall:q}=po();class G 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)}}sZ=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(G,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 G({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(Y(s))return n(s.arrayBuffer());if(i(s))return K(G,s,{objectMode:!0,writable:!1});if(y(s?.readable)&&w(s?.writable))return G.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 G({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 G({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 sZ}var fZ={},fMt=!1;function Dc(){if(fMt)return fZ;fMt=!0;let{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:a,ObjectSetPrototypeOf:l}=po();fZ=b;let i=_x(),c=vZ();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=Wse()),y(w,"body")},fZ}var hZ={},hMt=!1;function wMt(){if(hMt)return hZ;hMt=!0;let{ObjectSetPrototypeOf:r,Symbol:e}=po();hZ=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()}},hZ}var uZ={},uMt=!1;function MMt(){if(uMt)return uZ;uMt=!0;let{ObjectSetPrototypeOf:r}=po();uZ=a;let e=wMt();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)},uZ}var lZ={},lMt=!1;function bZ(){if(lMt)return lZ;lMt=!0;let r=Yo,{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:Y,isWebStream:U,isReadableStream:q,isReadableFinished:G}=$c(),h=globalThis.AbortController||_4().AbortController,t,n,s;function u(k,L,z){let it=!1;k.on("close",()=>{it=!0});let V=c(k,{readable:L,writable:z},$=>{it=!$});return{destroy:$=>{it||(it=!0,g.destroyer(k,$||new x("pipe")))},cleanup:V}}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 V,$=null,Z=H=>{if(H&&(V=H),$){let F=$;$=null,F()}},rt=()=>new a((H,F)=>{V?F(V):$=()=>{V?F(V):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(V!==H?y(V,H):H)}finally{Q(),L.off("drain",Z)}}async function o(k,L,z,{end:it}){Y(L)&&(L=L.writable);let V=L.getWriter();try{for await(let $ of k)await V.ready,V.write($).catch(()=>{});await V.ready,it&&await V.close(),z()}catch($){try{await V.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,V=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,J=[],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(;J.length;)J.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);J.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:V}),!O(ft))throw new S("Iterable, AsyncIterable or Stream","source",ft)}else O(ut)||K(ut)||Y(ut)?ft=ut:ft=M.from(ut);else if(typeof ut=="function"){if(Y(ft)){var ct;ft=v((ct=ft)===null||ct===void 0?void 0:ct.readable)}else ft=v(ft);if(ft=ut(ft,{signal:V}),It){if(!O(ft,!0))throw new S("AsyncIterable",`transform[${St-1}]`,ft)}else{var st;t||(t=MMt());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)||Y(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);J.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(Y(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(Y(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(V!=null&&V.aborted||$!=null&&$.aborted)&&r.nextTick(rt),ft}function R(k,L,z,{end:it}){let V=!1;if(L.on("close",()=>{V||z(new A)}),k.pipe(L,{end:!1}),it){let Z=function(){V=!0,L.end()};var $=Z;G(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 lZ={pipelineImpl:E,pipeline:m},lZ}var dZ={},dMt=!1;function _Mt(){if(dMt)return dZ;dMt=!0;let{pipeline:r}=bZ(),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 dZ=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 Y(t){let n=K;K=null,n?n(t):t?W.destroy(t):!h&&!G&&W.destroy()}let U=I[0],q=r(I,Y),G=!!(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:G,readable:h}),G){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},dZ}var yx={},cMt=!1;function Vse(){if(cMt)return yx;cMt=!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(),_=_Mt(),{addAbortSignalNoValidate:x}=wx(),{isWritable:A,isNodeStream:I}=$c(),{deprecate:B}=cf(),{ArrayPrototypePush:P,Boolean:O,MathFloor:C,Number:K,NumberIsNaN:W,Promise:Y,PromiseReject:U,PromiseResolve:q,PromisePrototypeThen:G,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)),J=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 J){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,G(Pt,St,wt),at.push(Pt),et&&(et(),et=null),!ct&&(at.length>=Q||st>=rt)&&await new Y(j=>{ft=j})}at.push(n)}catch(Pt){let j=U(Pt);G(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 Y(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,J=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:J}):(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 V($,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:V,compose:s},yx.promiseReturningOperators={every:p,forEach:o,reduce:R,toArray:k,some:v,find:f},yx}var cZ={},pMt=!1;function SMt(){if(pMt)return cZ;pMt=!0;let{ArrayPrototypePop:r,Promise:e}=po(),{isIterable:a,isNodeStream:l,isWebStream:i}=$c(),{pipelineImpl:c}=bZ(),{finished:b}=jp();xMt();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 cZ={finished:b,pipeline:g},cZ}var pZ={},mMt=!1,vMt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function xMt(){if(mMt)return pZ;mMt=!0;let{Buffer:r}=In(),{ObjectDefineProperty:e,ObjectKeys:a,ReflectApply:l}=po(),{promisify:{custom:i}}=cf(),{streamReturningOperators:c,promiseReturningOperators:b}=Vse(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:g}}=$f(),M=_Mt(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:w}=Mx(),{pipeline:S}=bZ(),{destroyer:_}=_g(),x=jp(),A=SMt(),I=$c(),B=pZ=mZ().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(...Y){if(new.target)throw g();return B.Readable.from(l(K,this||vMt,Y))};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||vMt,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=vZ(),B.Duplex=Dc(),B.Transform=wMt(),B.PassThrough=MMt(),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)},pZ}var co={},bMt=!1;function Gse(){if(bMt)return co;bMt=!0;let r=xMt(),e=SMt(),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 gMt=Sa.Readable;gMt.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 gMt(e).wrap(r)};var cDe=Sa.Writable,pDe=Sa.Duplex,EMt=Sa.Transform,AMt=Sa.PassThrough,mDe=Sa.finished,vDe=Sa.pipeline,bDe=Sa.Stream,gDe={finished:ZS(Sa.finished),pipeline:ZS(Sa.pipeline)};var Iv=Rn(Wh(),1);rd();async function RMt(r){let e=IMt(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)(zt.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):zt.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):zt.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 Y=a.subarray(0,W),U=K!==0&&W!==0?yg(zt.from(Y)):[];if(U.length!==K)throw new Error("Tags lengths don't match");a=a.subarray(W);let q=new EMt;q._transform=function(s,u,d){this.push(s),d()};let G=bp([(0,Xn.stringToBuffer)("dataitem"),(0,Xn.stringToBuffer)("1"),(0,Xn.stringToBuffer)(w.toString()),I,P,C,Y,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 G,A))throw new Error("Invalid signature");g.push({id:y,sigName:x,signature:(0,Iv.default)(zt.from(A)),target:(0,Iv.default)(zt.from(P)),anchor:(0,Iv.default)(zt.from(C)),owner:(0,Iv.default)(zt.from(I)),tags:U,dataOffset:b+h,dataSize:t}),b+=h+t}return g}async function Jse(r,e,a,l){let i=y4("",a,l),c=new AMt,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=zt.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,zt.concat([zt.from(e),zt.from(i)]),a)}async function*IMt(r){for await(let e of r)yield e}var Yse=RMt,Xse={readBytes:pf,getReader:IMt};var Qse={...GK,stream:gZ};globalThis.arbundles??=Qse;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 wZ;(function(r){r.mergeShapes=(e,a)=>({...e,...a})})(wZ||(wZ={}));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"]),tfe=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}},PMt=Eg;function efe(r){PMt=r}function Sx(){return PMt}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}},rfe=[];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}),MZ=r=>r.status==="aborted",_Z=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 NMt(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}},kMt=(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 kMt(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 kMt(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}},ife=/^c[^\s-]{8,}$/i,nfe=/^[0-9a-z]+$/,afe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ofe=/^[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,sfe=/^[a-z0-9_-]{21}$/i,ffe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hfe=/^[-+]?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)?)??$/,ufe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lfe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yZ,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])$/,cfe=/^(?:(?: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])$/,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]))$/,mfe=/^(([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])$/,vfe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bfe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OMt="((\\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])))",gfe=new RegExp(`^${OMt}$`);function CMt(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 yfe(r){return new RegExp(`^${CMt(r)}$`)}function LMt(r){let e=`${OMt}T${CMt(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 wfe(r,e){return!!((e==="v4"||!e)&&dfe.test(r)||(e==="v6"||!e)&&pfe.test(r))}function Mfe(r,e){if(!ffe.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 _fe(r,e){return!!((e==="v4"||!e)&&cfe.test(r)||(e==="v6"||!e)&&mfe.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")ufe.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")yZ||(yZ=new RegExp(lfe,"u")),yZ.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")ofe.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")sfe.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")ife.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")nfe.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")afe.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"?LMt(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"?gfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{code:sr.invalid_string,validation:"date",message:c.message}),l.dirty()):c.kind==="time"?yfe(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"?hfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"duration",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="ip"?wfe(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"?Mfe(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"?_fe(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"?vfe.test(e.data)||(i=this._getOrReturnCtx(e,i),_r(i,{validation:"base64",code:sr.invalid_string,message:c.message}),l.dirty()):c.kind==="base64url"?bfe.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 Sfe(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"?Sfe(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 DMt(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 SZ(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=SZ(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=SZ(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(MZ(c)||MZ(b))return Kr;let g=SZ(c.value,b.value);return g.valid?((_Z(c)||_Z(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 DMt(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")||NMt(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=DMt;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")||NMt(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 xfe=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 TMt(r,e){let a=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof a=="string"?{message:a}:a}function $Mt(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=TMt(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=TMt(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 Efe={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 Afe=(r,e={message:`Input not instance of ${r.name}`})=>$Mt(a=>a instanceof r,e),qMt=zp.create,UMt=Tv.create,Rfe=Tg.create,Ife=Bv.create,jMt=Pv.create,kfe=Nv.create,Tfe=Ag.create,Bfe=Ov.create,Pfe=Cv.create,Nfe=Fp.create,Ofe=jc.create,Cfe=fl.create,Lfe=Rg.create,Dfe=zc.create,$fe=qf.create,qfe=qf.strictCreate,Ufe=Lv.create,jfe=Ax.create,zfe=Dv.create,Ffe=xd.create,Hfe=Rx.create,Kfe=Ig.create,Zfe=kg.create,Wfe=Ix.create,Vfe=$v.create,Gfe=qv.create,Jfe=Uv.create,Yfe=jv.create,Xfe=Hp.create,BMt=Ih.create,Qfe=H0.create,the=Ed.create,ehe=Ih.createWithPreprocess,rhe=I4.create,ihe=()=>qMt().optional(),nhe=()=>UMt().optional(),ahe=()=>jMt().optional(),ohe={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}))},she=Kr,Ir=Object.freeze({__proto__:null,defaultErrorMap:Eg,setErrorMap:efe,getErrorMap:Sx,makeIssue:xx,EMPTY_PATH:rfe,addIssueToContext:_r,ParseStatus:tf,INVALID:Kr,DIRTY:xg,OK:mf,isAborted:MZ,isDirty:_Z,isValid:kv,isAsync:A4,get util(){return ln},get objectUtil(){return wZ},ZodParsedType:Er,getParsedType:Uc,ZodType:yi,datetimeRegex:LMt,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:xfe,ZodBranded:R4,ZodPipeline:I4,ZodReadonly:Hv,custom:$Mt,Schema:yi,ZodSchema:yi,late:Efe,get ZodFirstPartyTypeKind(){return Ur},coerce:ohe,any:Nfe,array:Dfe,bigint:Ife,boolean:jMt,date:kfe,discriminatedUnion:jfe,effect:BMt,enum:Jfe,function:Wfe,instanceof:Afe,intersection:zfe,lazy:Vfe,literal:Gfe,map:Kfe,nan:Rfe,nativeEnum:Yfe,never:Cfe,null:Pfe,nullable:the,number:UMt,object:$fe,oboolean:ahe,onumber:nhe,optional:Qfe,ostring:ihe,pipeline:rhe,preprocess:ehe,promise:Xfe,record:Hfe,set:Zfe,strictObject:qfe,string:qMt,symbol:Tfe,transformer:BMt,tuple:Ffe,undefined:Bfe,union:Ufe,unknown:Ofe,void:Lfe,NEVER:she,ZodIssueCode:sr,quotelessJson:tfe,ZodError:Rh});Et();Rt();At();var kx=new RegExp("^[a-zA-Z0-9_-]{43}$"),VDe=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),fhe="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",GDe=fhe,xZ="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",ef="qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE",JDe="RR0vheYqtsKuJCWh6xj0beE35tjaEug5cejMw9n2aa8",kh="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",EZ=1e6,YDe="nEjlSFA_8narJlVHApbczDPkMc9znSqYtqtf1iOdoxM",zMt="sOW9Sdm1yoPRrzerC5iu1nsupp4e6I-HnJyYVHzvzQo",FMt="fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",HMt="_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"}),KMt=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"}),hhe=Ir.string(),AZ=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()),RZ=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:AZ.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.")}),WMt=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:AZ.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.")}),uhe=["balance","balances","totalSupply","info","controllers","record","records","state"],lhe=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames","transferRecordOwnership"],dhe=[...uhe,...lhe],ZMt=Ir.array(Ir.string({description:"Handler Name"})).refine(r=>dhe.every(e=>r.includes(e)),{message:"ANT is missing required handlers"}),VMt=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":KMt.describe("Total supply of the ANT in circulation."),Description:hhe.describe("The description for the ANT."),Keywords:AZ.describe("The keywords for the ANT."),Logo:Bg.describe("Transaction ID of the ANT logo."),Denomination:KMt.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:ZMt.optional().describe("List of handlers for the ANT."),HandlerNames:ZMt.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function n$e(r){return RZ.safeParse(r).success}Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var Kp="3.22.0-alpha.4";var xa=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 che=Object.create,oB=Object.defineProperty,phe=Object.getOwnPropertyDescriptor,mhe=Object.getOwnPropertyNames,vhe=Object.getPrototypeOf,bhe=Object.prototype.hasOwnProperty,wu=(r,e)=>()=>(r&&(e=r(r=0)),e),Aa=(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})},NIt=(r,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mhe(e))!bhe.call(r,i)&&i!==a&&oB(r,i,{get:()=>e[i],enumerable:!(l=phe(e,i))||l.enumerable});return r},fB=(r,e,a)=>(a=r!=null?che(vhe(r)):{},NIt(e||!r||!r.__esModule?oB(a,"default",{value:r,enumerable:!0}):a,r)),GMt=r=>NIt(oB({},"__esModule",{value:!0}),r),ghe=Aa(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,Y;for(Y=0;Y<W;Y+=4)I=a[A.charCodeAt(Y)]<<18|a[A.charCodeAt(Y+1)]<<12|a[A.charCodeAt(Y+2)]<<6|a[A.charCodeAt(Y+3)],C[K++]=I>>16&255,C[K++]=I>>8&255,C[K++]=I&255;return O===2&&(I=a[A.charCodeAt(Y)]<<2|a[A.charCodeAt(Y+1)]>>4,C[K++]=I&255),O===1&&(I=a[A.charCodeAt(Y)]<<10|a[A.charCodeAt(Y+1)]<<4|a[A.charCodeAt(Y+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("")}}),yhe=Aa(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}}),OIt=Aa(r=>{"use strict";var e=ghe(),a=yhe(),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 Y(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 Y(this,T,N,D,!0)},g.prototype.lastIndexOf=function(T,N,D){return Y(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 G(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 G(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)&&J(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)&&J(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)&&J(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)&&J(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 V(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 V(this,T,N,!0,D)},g.prototype.writeDoubleBE=function(T,N,D){return V(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)&&J(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 J(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")}}),whe=Aa((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":"")}}),Mhe=Aa((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=whe(),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),Y=W-(A||W);K.diff=Y,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,G)=>{if(q==="%%")return"%";U++;let h=c.formatters[G];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}),_he=Aa((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=Mhe()(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 CIt(r){return r._maxListeners===void 0?fa.defaultMaxListeners:r._maxListeners}function JMt(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=CIt(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 She(){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=She.bind(l);return i.listener=a,l.wrapFn=i,i}function XMt(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):LIt(i,i.length)}function QMt(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 LIt(r,e){for(var a=new Array(e),l=0;l<e;++l)a[l]=r[l];return a}var t_t,e_t,Kv,IZ,kZ,TZ,gs,DIt=wu(()=>{Kv=typeof Reflect=="object"?Reflect:null,IZ=Kv&&typeof Kv.apply=="function"?Kv.apply:function(r,e,a){return Function.prototype.apply.call(r,e,a)},e_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)},kZ=Number.isNaN||function(r){return r!=r},t_t=fa,fa.EventEmitter=fa,fa.prototype._events=void 0,fa.prototype._eventsCount=0,fa.prototype._maxListeners=void 0,TZ=10,Object.defineProperty(fa,"defaultMaxListeners",{enumerable:!0,get:function(){return TZ},set:function(r){if(typeof r!="number"||r<0||kZ(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");TZ=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||kZ(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 CIt(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")IZ(g,this,e);else{var M=g.length,y=LIt(g,M);for(a=0;a<M;++a)IZ(y[a],this,e)}return!0},fa.prototype.addListener=function(r,e){return JMt(this,r,e,!1)},fa.prototype.on=fa.prototype.addListener,fa.prototype.prependListener=function(r,e){return JMt(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 XMt(this,r,!0)},fa.prototype.rawListeners=function(r){return XMt(this,r,!1)},fa.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):QMt.call(r,e)},fa.prototype.listenerCount=QMt,fa.prototype.eventNames=function(){return this._eventsCount>0?e_t(this._events):[]},gs=t_t,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount,gs.EventEmitter,gs.defaultMaxListeners,gs.init,gs.listenerCount});function ZV(){throw new Error("setTimeout has not been defined")}function WV(){throw new Error("clearTimeout has not been defined")}function $It(r){if(t1===setTimeout)return setTimeout(r,0);if((t1===ZV||!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 xhe(){R6&&M6&&(R6=!1,M6.length?$d=M6.concat($d):n7=-1,$d.length&&qIt())}function qIt(){if(!R6){var r=$It(xhe);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===WV||!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 r_t(r,e){(this||A6).fun=r,(this||A6).array=e}function Fc(){}var i_t,t1,e1,A6,mo,M6,$d,R6,n7,ti,qrt=wu(()=>{A6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis,mo=i_t={},(function(){try{t1=typeof setTimeout=="function"?setTimeout:ZV}catch{t1=ZV}try{e1=typeof clearTimeout=="function"?clearTimeout:WV}catch{e1=WV}})(),$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 r_t(r,e)),$d.length!==1||R6||$It(qIt)},r_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=i_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 n_t(r){return Mf&&th?qn(r)!==void 0:UIt(r)||jIt(r)||zIt(r)||FIt(r)||HIt(r)||KIt(r)||ZIt(r)||WIt(r)||VIt(r)||GIt(r)||JIt(r)}function UIt(r){return Mf&&th?qn(r)==="Uint8Array":qa(r)==="[object Uint8Array]"||tkt(r)&&r.buffer!==void 0}function jIt(r){return Mf&&th?qn(r)==="Uint8ClampedArray":qa(r)==="[object Uint8ClampedArray]"}function zIt(r){return Mf&&th?qn(r)==="Uint16Array":qa(r)==="[object Uint16Array]"}function FIt(r){return Mf&&th?qn(r)==="Uint32Array":qa(r)==="[object Uint32Array]"}function HIt(r){return Mf&&th?qn(r)==="Int8Array":qa(r)==="[object Int8Array]"}function KIt(r){return Mf&&th?qn(r)==="Int16Array":qa(r)==="[object Int16Array]"}function ZIt(r){return Mf&&th?qn(r)==="Int32Array":qa(r)==="[object Int32Array]"}function WIt(r){return Mf&&th?qn(r)==="Float32Array":qa(r)==="[object Float32Array]"}function VIt(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 JIt(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 BZ(r){return qa(r)==="[object WeakSet]"}function bT(r){return qa(r)==="[object ArrayBuffer]"}function a_t(r){return typeof ArrayBuffer<"u"&&(bT.working?bT(r):r instanceof ArrayBuffer)}function gT(r){return qa(r)==="[object DataView]"}function o_t(r){return typeof DataView<"u"&&(gT.working?gT(r):r instanceof DataView)}function yT(r){return qa(r)==="[object SharedArrayBuffer]"}function s_t(r){return typeof SharedArrayBuffer<"u"&&(yT.working?yT(r):r instanceof SharedArrayBuffer)}function f_t(r){return iw(r,ekt)}function h_t(r){return iw(r,rkt)}function u_t(r){return iw(r,ikt)}function l_t(r){return VV&&iw(r,pU)}function d_t(r){return CE&&iw(r,vU)}function Tm(r,e){var a={seen:[],stylize:Ahe};return arguments.length>=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),Urt(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=Ehe),wT(a,r,a.depth)}function Ehe(r,e){var a=Tm.styles[e];return a?"\x1B["+Tm.colors[a][0]+"m"+r+"\x1B["+Tm.colors[a][1]+"m":r}function Ahe(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(XIt(x))return _.stylize(""+x,"number");if(Urt(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 PZ(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 PZ(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=" "+PZ(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)QIt(x,String(O))?P.push(NZ(_,x,A,I,String(O),!0)):P.push("");return B.forEach(function(K){K.match(/^\d+$/)||P.push(NZ(_,x,A,I,K,!0))}),P})(r,e,a,b,c):c.map(function(_){return NZ(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 PZ(r){return"["+Error.prototype.toString.call(r)+"]"}function NZ(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")),QIt(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(`
|
|
@@ -143,12 +143,12 @@ Use Chrome, Firefox or Internet Explorer 11`)},U5=en.Buffer,gX=Oh.Transform,bi(G
|
|
|
143
143
|
`,`${e?`content-type: ${e.trim()}`:""}\r
|
|
144
144
|
`,r,`\r
|
|
145
145
|
--${a}--\r
|
|
146
|
-
`]);return{boundary:a,body:l}}async function f6e(r){let e=await r.arrayBuffer(),a=await crypto.subtle.digest("SHA-256",e);return n6e.Buffer.from(a)}async function pnt({processId:r,data:e,tags:a,anchor:l}){let i=new Headers;r&&i.append("target",r),l&&i.append("anchor",l),a&&a.forEach(b=>i.append(b.name,b.value)),i.set("Variant","ao.N.1");let c;if(e){let b=i.get("content-type"),g=await s6e(e,b);c=g.body,i.set("Content-Type",`multipart/form-data; boundary="${g.boundary}"`);let M=await f6e(c);i.append("Content-Digest",`sha-256=:${o6e(M)}:`)}return{headers:i,body:c}}function mnt({url:r,method:e,headers:a}){return a=new Headers(a),{fields:[...a.keys()].sort(),request:{url:r,method:e,headers:{...Object.fromEntries(a)}}}}function h6e(r){return`http-sig-${[...a6e(r).subarray(1,9)].map(e=>e.toString(16).padStart(2,"0")).join("")}`}function u6e({fetch:r,logger:e,HB_URL:a,signer:l}){let i=e.child("deployProcess");return c=>si(c).chain(Di(({processId:b,data:g,tags:M})=>pnt({processId:b,data:g,tags:M}))).chain(Di(({headers:b,body:g})=>l(mnt({url:`${a}/~scheduler@1.0/schedule`,method:"POST",headers:b})).then(M=>({...M,body:g})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(b=>si(b).chain(Di(({url:g,method:M,headers:y,body:w})=>r(g,{method:M,headers:y,body:w,redirect:"follow"}))).bichain(g=>Rl(g),Di(async g=>{if(g.ok)return g.headers.get("process");throw new Error(`${g.status}: ${await g.text()}`)})).bimap(i.tap("Error encountered when deploying process via HB MU"),i.tap("Successfully deployed process via HB MU")).map(g=>({processId:g}))).toPromise()}function l6e({fetch:r,logger:e,HB_URL:a,signer:l}){let i=e.child("deployMessage");return c=>si(c).chain(Di(({processId:b,data:g,tags:M,anchor:y})=>pnt({processId:b,data:g,tags:M,anchor:y}))).chain(Di(({headers:b,body:g})=>l(mnt({url:`${a}/~scheduler@1.0/schedule`,method:"POST",headers:b})).then(M=>({...M,body:g})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(b=>si(b).chain(Di(({url:g,method:M,headers:y,body:w})=>r(g,{method:M,headers:y,body:w,redirect:"follow"}))).bichain(g=>Rl(g),Di(async g=>{if(g.ok)return g.headers.get("slot");throw new Error(`${g.status}: ${await g.text()}`)})).bimap(i.tap("Error encountered when writing message via HB MU"),i.tap("Successfully wrote message via HB MU")).map(g=>({messageId:g}))).toPromise()}function d6e({fetch:r,logger:e,HB_URL:a,signer:l}){let i=e.child("loadResult");return c=>si(c).chain(Di(async({id:b,processId:g})=>{let{headers:M,body:y}=await pnt({processId:g});return M.append("slot+integer",b),M.append("accept","application/json"),l(mnt({url:`${a}/~compute-lite@1.0/compute&slot+integer=${b}&process-id=${g}`,method:"POST",headers:M})).then(w=>({...w,body:y}))})).map(i.tap("fetching message result from HB CU: %o")).chain(b=>si(b).chain(Di(({url:g,method:M,headers:y,body:w})=>r(g,{method:M,headers:y,body:w,redirect:"follow"}))).bichain(g=>Rl(g),Di(async g=>{if(g.ok)return g.json();throw new Error(`${g.status}: ${await g.text()}`)})).bimap(i.tap("Error encountered when writing message via HB CU"),i.tap("Successfully wrote message via HB CU"))).toPromise()}function c6e({fetch:r,logger:e,HB_URL:a,signer:l}){return async(i,c)=>{let b=new URL(i);c.headers=new Headers(c.headers);let g=b.href,M=new URLSearchParams({"relay-path":g}),y=`${a}/~relay@1.0/call?${M.toString()}`;e('Relaying "%s" through HyperBEAM Node "%s"',b.href,y);let{headers:w}=await l({fields:[...c.headers.keys(),"relay-path"].sort(),request:{url:i,...c,headers:{...Object.fromEntries(c.headers),"relay-path":g}}});return r(y,{...c,headers:w})}}var p6e=fB(_he(),1),d$t=(r="@permaweb/aoconnect")=>{let e=(0,p6e.default)(r);return e.child=a=>d$t(`${e.namespace}:${a}`),e.tap=(a,...l)=>G2e((...i)=>e(a,...l,...i)),e},c$t=({url:r,path:e})=>e?e.startsWith("/")?c$t({url:r,path:e.slice(1)}):(r=new URL(r),r.pathname+=e,r.toString()):r;function m6e(r){return $m(TB([]),U7((e,a)=>$m(K2e([],a.name),e2e(a.value),Qf(a.name,m1,e))(e),{}),unt(e=>e.length>1?e:e[0]))(r)}function SIt(r){return KDt([[w7(String),y7(r)],[w7(Array),O2e(r)],[PDt,ume]])}function U6(r){let e;return w7(bu,r)?(e=new Error(v6e(r)),e.stack+=r.stack):w7(Error,r)?e=r:B2e("message",r)?e=new Error(r.message):w7(String,r)?e=new Error(r):e=new Error("An error occurred"),e}function v6e(r){return $m(e=>(function a(l,i,c){return U7((b,g)=>$m(KDt([[y7(or.invalid_arguments),()=>a(g.argumentsError,422,"Invalid Arguments")],[y7(or.invalid_return_type),()=>a(g.returnTypeError,500,"Invalid Return")],[y7(or.invalid_union),()=>v2e(M=>a(M,400,"Invalid Union"),g.unionErrors)],[PDt,()=>[{...g,status:i,contextCode:c}]]]),E2e(b))(g.code),[],l.issues)})(e,400,""),e=>U7((a,l)=>{let{message:i,path:c,contextCode:b}=l,g=c[1]||c[0],M=b?`${b} `:"";return a.push(`${M}'${g}': ${i}.`),a},[],e),U2e(" | "))(r)}var b6e=Xe.object({id:Xe.string().min(1,{message:"message is required to be a message id"}),processId:Xe.string().min(1,{message:"process is required to be a process id"})});function g6e(){return r=>si(r).map(b6e.parse).map(()=>r)}var dw=Xe.object({name:Xe.string(),value:Xe.string()}),y6e=Xe.function().args(Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))})).returns(Xe.promise(Xe.any())),w6e=Xe.function().args(Xe.object({id:Xe.string().min(1,{message:"message id is required"}),processId:Xe.string().min(1,{message:"process id is required"})})).returns(Xe.promise(Xe.any())),M6e=Xe.function().args(Xe.object({process:Xe.string().min(1,{message:"process id is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()})).returns(Xe.promise(Xe.object({edges:Xe.array(Xe.object({cursor:Xe.string(),node:Xe.object({Output:Xe.any().optional(),Messages:Xe.array(Xe.any()).optional(),Spawns:Xe.array(Xe.any()).optional(),Error:Xe.any().optional()})}))}))),p$t=Xe.function().args(Xe.object({processId:Xe.string(),data:Xe.any(),tags:Xe.array(dw),anchor:Xe.string().optional(),signer:Xe.any()})).returns(Xe.promise(Xe.object({messageId:Xe.string()}).passthrough())),_6e=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(dw),signer:Xe.any()})).returns(Xe.promise(Xe.object({processId:Xe.string()}).passthrough())),S6e=Xe.function().args(Xe.object({process:Xe.string(),message:Xe.string(),baseLayer:Xe.boolean().optional(),exclude:Xe.array(Xe.string()).optional()})).returns(Xe.promise(Xe.object({assignmentId:Xe.string()}).passthrough())),m$t=p$t,I$e=Xe.function().args(Xe.object({suUrl:Xe.string().url(),processId:Xe.string()})).returns(Xe.promise(Xe.object({tags:Xe.array(dw)}).passthrough())),k$e=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({url:Xe.string()}))),x6e=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.boolean())),E6e=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({tags:Xe.array(dw)}).passthrough())),BB=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(dw),target:Xe.string().optional(),anchor:Xe.string().optional()})).returns(Xe.promise(Xe.object({id:Xe.string(),raw:Xe.any()})));function A6e({loadResult:r}){return r=Di(w6e.implement(r)),e=>si({id:e.id,processId:e.processId}).chain(r)}function zV(r){let e=g6e(r),a=A6e(r);return({message:l,process:i})=>si({id:l,processId:i}).chain(e).chain(a).map(r.logger.tap('readResult result for message "%s": %O',l)).map(c=>c).bimap(U6,q6).toPromise()}var $6=(...r)=>e=>r.reduce((a,l)=>l(a),e),vnt=r=>e=>e??r,R6e=r=>e=>$6(a=>a&&a[e],vnt(r)),I6e=r=>e=>{let a={};for(let l in e)e.hasOwnProperty(l)&&(a[l]=r(e[l],l,e));return a},k6e=r=>(...e)=>!r(...e),PB=r=>e=>{let a=e.findIndex(i=>i.name==="Data-Protocol"&&i.value===r);if(a===-1)return[0,0];let l=e.findIndex((i,c)=>c>a&&i.name==="Data-Protocol"&&i.value!==r);return l===-1&&(l=e.length),[a,l]},bnt=r=>{let e=r.findIndex(a=>a.name==="Data-Protocol");return e===-1&&(e=r.length),e},v$t=r=>e=>e.name===r,gnt=(r,e)=>$6(PB(r),([a,l])=>e.slice(a,l))(e),b$t=(r,e,a)=>$6(l=>gnt(r,l),l=>l.filter(v$t(e)))(a),T6e=(r,e,a)=>$6(l=>b$t(r,e,l),l=>l[0])(a),NB=(r,e)=>(e=e.filter(a=>a.name!=="Data-Protocol"||a.value!==r),e.length?[{name:"Data-Protocol",value:r},...e]:[]),B6e=(r,e,a)=>{let[l,i]=PB(r)(a),[c,b,g]=[a.slice(0,l),a.slice(l,i),a.slice(i)];return b.length||(e=NB(r,e),c=g,g=[]),[c,b,e,g].flat(1)},P6e=(r,e)=>{let a=bnt(e),[l,i]=[e.slice(0,a),e.slice(a)];return[l,r,i].flat(1)},g$t=(r,e,a)=>{let[l,i]=PB(r)(a),[c,b]=[a.slice(0,l),a.slice(i)];return b.length===a.length&&(c=b,b=[]),[c,NB(r,e),b].flat(1)},N6e=(r,e)=>g$t(r,[],e),O6e=(r,e,a)=>{let[l,i]=PB(r)(a),[c,b,g]=[a.slice(0,l),a.slice(l,i),a.slice(i)];return[c,NB(r,b.filter(k6e(v$t(e)))),g].flat(1)},ynt=(r,e=!1)=>$6(vnt([]),a=>a.reduce((l,i)=>$6(R6e([])(i.name),c=>(c.push(i.value),c),c=>(l[i.name]=c,l))(l),{}),I6e(a=>e?a:a[0]))(r),y$t=(r,e,a)=>$6(vnt([]),l=>gnt(r,l),l=>ynt(l,a))(e),C6e=(r,e)=>y$t(r,e,!0),L6e=(r,e)=>y$t(r,e,!1),D6e=r=>{let e=bnt(r);return ynt(r.slice(0,e),!1)},$6e=r=>{let e=bnt(r);return ynt(r.slice(0,e),!0)},w$t=r=>({findAll:e=>gnt(r,e),findAllByName:(e,a)=>b$t(r,e,a),findByName:(e,a)=>T6e(r,e,a),create:e=>NB(r,e),update:(e,a)=>g$t(r,e,a),concat:(e,a)=>B6e(r,e,a),removeAll:e=>N6e(r,e),removeAllByName:(e,a)=>O6e(r,e,a),parse:e=>L6e(r,e),parseAll:e=>C6e(r,e),concatUnassoc:P6e,parseUnassoc:D6e,parseAllUnassoc:$6e}),wnt=w$t("ao"),xIt=j3(wnt.removeAllByName),q6e=j3(wnt.concat),EIt=j3(wnt.concatUnassoc),U6e=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function j6e(){return r=>si(r.tags).map(TB([])).map(xIt("Variant")).map(xIt("Type")).map(q6e([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"}])).map(U6e.parse).map(Qf("tags",m1,r))}function z6e({logger:r}){return e=>si(e).chain(ZDt(jDt(e.data),()=>O6(e),()=>O6(" ").map(Qf("data",m1,e)).map(a=>$m(C6("tags"),EIt([{name:"Content-Type",value:"text/plain"}]),Qf("tags",m1,a))(a)).map(r.tap('added pseudo-random string as message "data"')))).map(a=>$m(C6("tags"),EIt([{name:"SDK",value:"aoconnect"}]),Qf("tags",m1,a))(a))}function F6e(r){let e=j6e(r),a=z6e(r),l=p$t.implement(r.deployMessage);return i=>si(i).chain(e).chain(a).chain(Di(({id:c,data:b,tags:g,anchor:M,signer:y})=>l({processId:c,data:b,tags:g,anchor:M,signer:BB.implement(y)}))).map(c=>Qf("messageId",c.messageId,i))}function FV(r){let e=F6e(r);return({process:a,data:l,tags:i,anchor:c,signer:b})=>si({id:a,data:l,tags:i,anchor:c,signer:b}).chain(e).map(g=>g.messageId).bimap(U6,q6).toPromise()}var M5=(r,e,a)=>l=>e(l[r])?O6(l):Rl(`Tag '${r}': ${a}`);function H6e({loadTransactionMeta:r,logger:e}){return r=Di(E6e.implement(r)),a=>si(a).chain(r).map(C6("tags")).map(m6e).chain(M5("Data-Protocol",SIt("ao"),"value 'ao' was not found on module")).chain(M5("Type",SIt("Module"),"value 'Module' was not found on module")).chain(M5("Module-Format",qV,"was not found on module")).chain(M5("Input-Encoding",qV,"was not found on module")).chain(M5("Output-Encoding",qV,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function K6e({logger:r,validateScheduler:e}){return e=Di(x6e.implement(e)),a=>si(a).chain(l=>e(l).chain(i=>i?O6(l):Rl(`Valid Scheduler-Location owned by ${l} not found`))).bimap(r.tap("Verifying scheduler failed: %s"),r.tap("Verified scheduler"))}function Z6e({logger:r}){return e=>si(e).map(r.tap("Checking for signer")).chain(a=>a?O6(a):Rl("signer not found"))}function W6e(r){let e=r.logger.child("verifyInput");r={...r,logger:e};let a=H6e(r),l=K6e(r),i=Z6e(r);return c=>si(c).chain(b=>a(b.module).map(()=>b)).chain(b=>i(b.signer).map(()=>b)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var Mnt=w$t("ao"),PE=j3(Mnt.removeAllByName),V6e=j3(Mnt.concat),AIt=j3(Mnt.concatUnassoc),G6e=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function J6e(){return r=>si(r).map(C6("tags")).map(TB([])).map(PE("Variant")).map(PE("Type")).map(PE("Module")).map(PE("Scheduler")).map(V6e([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:r.module},{name:"Scheduler",value:r.scheduler}])).map(G6e.parse).map(Qf("tags",m1,r))}function Y6e({logger:r}){return e=>si(e).chain(ZDt(jDt(e.data),()=>O6(e),()=>O6(" ").map(Qf("data",m1,e)).map(a=>$m(C6("tags"),AIt([{name:"Content-Type",value:"text/plain"}]),Qf("tags",m1,a))(a)).map(r.tap('added pseudo-random string as process "data"')))).map(a=>$m(C6("tags"),AIt([{name:"SDK",value:"aoconnect"}]),Qf("tags",m1,a))(a))}function X6e(r){let e=r.logger.child("uploadProcess");r={...r,logger:e};let a=J6e(r),l=Y6e(r),i=_6e.implement(r.deployProcess);return c=>si(c).chain(a).chain(l).chain(Di(({data:b,tags:g,signer:M})=>i({data:b,tags:g,signer:BB.implement(M)}))).map(b=>Qf("processId",b.processId,c))}function HV(r){let e=W6e(r),a=X6e(r);return({module:l,scheduler:i,signer:c,tags:b,data:g})=>si({module:l,scheduler:i,signer:c,tags:b,data:g}).chain(e).chain(a).map(M=>M.processId).bimap(U6,q6).toPromise()}function Q6e(r){let e=m$t.implement(r.deployMonitor);return a=>si(a).chain(Di(({id:l,signer:i})=>e({processId:l,signer:BB.implement(i),data:" ",tags:[]}))).map(l=>Qf("monitorId",l.messageId,a))}function RIt(r){let e=Q6e(r);return({process:a,signer:l})=>si({id:a,signer:l}).chain(e).map(i=>i.monitorId).bimap(U6,q6).toPromise()}function tbe(r){let e=m$t.implement(r.deployUnmonitor);return a=>si(a).chain(Di(({id:l,signer:i})=>e({processId:l,signer:BB.implement(i),data:" ",tags:[]}))).map(l=>Qf("monitorId",l.messageId,a))}function IIt(r){let e=tbe(r);return({process:a,signer:l})=>si({id:a,signer:l}).chain(e).map(i=>i.monitorId).bimap(U6,q6).toPromise()}var ebe=Xe.object({process:Xe.string().min(1,{message:"process identifier is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()});function rbe(){return r=>si(r).map(ebe.parse).map(()=>r)}function ibe({queryResults:r}){return r=Di(M6e.implement(r)),e=>si({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(r)}function kIt(r){let e=rbe(r),a=ibe(r);return({process:l,from:i,to:c,sort:b,limit:g})=>si({process:l,from:i,to:c,sort:b,limit:g}).chain(e).chain(a).map(r.logger.tap('readResults result for message "%s": %O',l)).map(M=>M).bimap(U6,q6).toPromise()}var nbe=Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))});function abe(){return r=>si(r).map(nbe.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function obe({dryrunFetch:r}){return Di(y6e.implement(r))}function TIt(r){let e=abe(r),a=obe(r);return l=>si(l).map(sbe).chain(e).chain(a).toPromise()}function sbe({process:r,data:e,tags:a,anchor:l,...i}){return{Id:"1234",Owner:"1234",...i,Target:r,Data:e||"1234",Tags:a||[],Anchor:l||"0"}}function fbe(r){let e=S6e.implement(r.deployAssign);return a=>si(a).chain(Di(({process:l,message:i,baseLayer:c,exclude:b})=>e({process:l,message:i,baseLayer:c,exclude:b}))).map(l=>Qf("assignmentId",l.assignmentId,a))}function BIt(r){let e=fbe(r);return({process:a,message:l,baseLayer:i,exclude:c})=>si({process:a,message:l,baseLayer:i,exclude:c}).chain(e).map(b=>b.assignmentId).bimap(U6,q6).toPromise()}var hbe="https://arweave.net",ube="https://mu.ao-testnet.xyz",lbe="https://cu.ao-testnet.xyz",dbe="http://localhost:8734",cbe="http://localhost:8734",pbe="http://cu.s451-comm3-main.xyz",mbe="http://mu.s451-comm3-main.xyz",c6=fetch;function vbe({createDataItemSigner:r,createHbSigner:e}){let a=d$t();function l({MODE:g,wallet:M,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S,MU_URL:_=mbe,CU_URL:x=pbe,RELAY_URL:A=dbe,fetch:I=c6}){let B=a.child("relay");B("Mode Activated \u{1F500}");let P=e(M),O=()=>r(M),C=c6e({fetch:c6,logger:B,HB_URL:A,signer:P}),{validate:K}=xrt({cacheSize:100,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S}),W=B.child("result"),Y=zV({loadResult:lIt({fetch:C,CU_URL:x,logger:W}),logger:W}),U=B.child("message"),q=FV({deployMessage:aIt({fetch:C,MU_URL:_,logger:U}),logger:U}),G=B.child("spawn"),h=HV({loadTransactionMeta:jV({fetch:I,GRAPHQL_URL:y,logger:G}),validateScheduler:K,deployProcess:oIt({fetch:C,MU_URL:_,logger:G}),logger:G}),t=B.child("monitor"),n=RIt({deployMonitor:sIt({fetch:C,MU_URL:_,logger:t}),logger:t}),s=B.child("unmonitor"),u=IIt({deployUnmonitor:fIt({fetch:C,MU_URL:_,logger:s}),logger:t}),d=B.child("results"),v=kIt({queryResults:dIt({fetch:C,CU_URL:x,logger:d}),logger:d}),p=B.child("dryrun"),f=TIt({dryrunFetch:uIt({fetch:C,CU_URL:x,logger:p}),logger:p}),o=B.child("assign"),m=BIt({deployAssign:hIt({fetch:C,MU_URL:_,logger:o}),logger:U});return{MODE:g,result:Y,results:v,message:q,spawn:h,monitor:n,unmonitor:u,dryrun:f,assign:m,createDataItemSigner:O}}function i({MODE:g,GRAPHQL_URL:M,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w,MU_URL:S=ube,CU_URL:_=lbe,fetch:x=c6,noLog:A}){let I=a.child("legacy");A||I("Mode Activated \u2139\uFE0F");let{validate:B}=xrt({cacheSize:100,GRAPHQL_URL:M,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w}),P=I.child("result"),O=zV({loadResult:lIt({fetch:x,CU_URL:_,logger:P}),logger:P}),C=I.child("message"),K=FV({deployMessage:aIt({fetch:x,MU_URL:S,logger:C}),logger:C}),W=I.child("spawn"),Y=HV({loadTransactionMeta:jV({fetch:x,GRAPHQL_URL:M,logger:W}),validateScheduler:B,deployProcess:oIt({fetch:x,MU_URL:S,logger:W}),logger:W}),U=I.child("monitor"),q=RIt({deployMonitor:sIt({fetch:x,MU_URL:S,logger:U}),logger:U}),G=I.child("unmonitor"),h=IIt({deployUnmonitor:fIt({fetch:x,MU_URL:S,logger:G}),logger:U}),t=I.child("results"),n=kIt({queryResults:dIt({fetch:x,CU_URL:_,logger:t}),logger:t}),s=I.child("dryrun"),u=TIt({dryrunFetch:uIt({fetch:x,CU_URL:_,logger:s}),logger:s}),d=I.child("assign"),v=BIt({deployAssign:hIt({fetch:x,MU_URL:S,logger:d}),logger:C});return{MODE:g,result:O,results:n,message:K,spawn:Y,monitor:q,unmonitor:h,dryrun:u,assign:v,createDataItemSigner:r}}function c({MODE:g,wallet:M,GRAPHQL_URL:y,AO_URL:w=cbe,fetch:S=c6}){let _=a.child("mainnet");if(_("Mode Activated \u{1F432}"),!M)throw new Error("mainnet mode requires providing a wallet to connect()");let x=e(M),A=()=>r(M);async function I(Y){return _('Mock validation for address "%s"',Y),!0}let B=_.child("result"),P=zV({loadResult:d6e({fetch:c6,logger:B,HB_URL:w,signer:x}),logger:B}),O=_.child("message"),C=FV({deployMessage:l6e({fetch:c6,logger:O,HB_URL:w,signer:x}),logger:O}),K=_.child("spawn"),W=HV({loadTransactionMeta:jV({fetch:S,GRAPHQL_URL:y,logger:K}),validateScheduler:I,deployProcess:u6e({fetch:c6,logger:K,HB_URL:w,signer:x}),logger:K});return{MODE:g,result:P,message:C,spawn:W,createDataItemSigner:A}}function b(g={}){let{GRAPHQL_URL:M,GATEWAY_URL:y=hbe,...w}=g;M||(M=c$t({url:y,path:"/graphql"}));let S=g.MODE||"legacy";if(S==="legacy")return i({...w,GRAPHQL_URL:M});if(S==="relay")return l({...w,GRAPHQL_URL:M});if(S==="mainnet")return c({...w,GRAPHQL_URL:M});throw new Error(`Unrecognized MODE: ${S}`)}return b}var Lrt={};sB(Lrt,{createDataItemSigner:()=>Fbe,createHbSigner:()=>Hbe});var _nt=fB(OIt(),1),M$t={};sB(M$t,{AVSCTap:()=>cw,ArweaveSigner:()=>Ent,DataItem:()=>rw,MAX_TAG_BYTES:()=>OB,MIN_BINARY_SIZE:()=>Int,SIG_CONFIG:()=>P3,SignatureConfig:()=>vu,Signer:()=>E$t,createData:()=>k$t,default:()=>$be,deserializeTags:()=>aB,indexToType:()=>Ant,serializeTags:()=>Rnt,tagsExceedLimit:()=>I$t,warparbundles:()=>qbe});var bbe=Object.create,Snt=Object.defineProperty,gbe=Object.getOwnPropertyDescriptor,ybe=Object.getOwnPropertyNames,wbe=Object.getPrototypeOf,Mbe=Object.prototype.hasOwnProperty,w1=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),_be=(r,e)=>{for(var a in e)Snt(r,a,{get:e[a],enumerable:!0})},Sbe=(r,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ybe(e))!Mbe.call(r,i)&&i!==a&&Snt(r,i,{get:()=>e[i],enumerable:!(l=gbe(e,i))||l.enumerable});return r},j6=(r,e,a)=>(a=r!=null?bbe(wbe(r)):{},Sbe(e||!r||!r.__esModule?Snt(a,"default",{value:r,enumerable:!0}):a,r)),xbe=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});function e(a){var l=4,i=a.length,c=i%l;if(!c)return a;var b=i,g=l-c,M=i+g,y=zt.alloc(M);for(y.write(a);g--;)y.write("=",b++);return y.toString()}r.default=e}),Ebe=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=xbe();function a(M,y){return y===void 0&&(y="utf8"),zt.isBuffer(M)?c(M.toString("base64")):c(zt.from(M,y).toString("base64"))}function l(M,y){return y===void 0&&(y="utf8"),zt.from(i(M),"base64").toString(y)}function i(M){return M=M.toString(),e.default(M).replace(/\-/g,"+").replace(/_/g,"/")}function c(M){return M.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function b(M){return zt.from(i(M),"base64")}var g=a;g.encode=a,g.decode=l,g.toBase64=i,g.fromBase64=c,g.toBuffer=b,r.default=g}),xnt=w1((r,e)=>{e.exports=Ebe().default,e.exports.default=e.exports}),_$t=w1(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,Y;for(Y=0;Y<W;Y+=4)I=a[A.charCodeAt(Y)]<<18|a[A.charCodeAt(Y+1)]<<12|a[A.charCodeAt(Y+2)]<<6|a[A.charCodeAt(Y+3)],C[K++]=I>>16&255,C[K++]=I>>8&255,C[K++]=I&255;return O===2&&(I=a[A.charCodeAt(Y)]<<2|a[A.charCodeAt(Y+1)]>>4,C[K++]=I&255),O===1&&(I=a[A.charCodeAt(Y)]<<10|a[A.charCodeAt(Y+1)]<<4|a[A.charCodeAt(Y+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("")}}),S$t=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.b64UrlDecode=r.b64UrlEncode=r.bufferTob64Url=r.bufferTob64=r.b64UrlToBuffer=r.stringToB64Url=r.stringToBuffer=r.bufferToString=r.b64UrlToString=r.concatBuffers=void 0;var e=_$t();function a(_){let x=0;for(let B=0;B<_.length;B++)x+=_[B].byteLength;let A=new Uint8Array(x),I=0;A.set(new Uint8Array(_[0]),I),I+=_[0].byteLength;for(let B=1;B<_.length;B++)A.set(new Uint8Array(_[B]),I),I+=_[B].byteLength;return A}r.concatBuffers=a;function l(_){let x=g(_);return i(x)}r.b64UrlToString=l;function i(_){return new TextDecoder("utf-8",{fatal:!0}).decode(_)}r.bufferToString=i;function c(_){return new TextEncoder().encode(_)}r.stringToBuffer=c;function b(_){return y(c(_))}r.stringToB64Url=b;function g(_){return new Uint8Array(e.toByteArray(S(_)))}r.b64UrlToBuffer=g;function M(_){return e.fromByteArray(new Uint8Array(_))}r.bufferTob64=M;function y(_){return w(M(_))}r.bufferTob64Url=y;function w(_){return _.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}r.b64UrlEncode=w;function S(_){_=_.replace(/\-/g,"+").replace(/\_/g,"/");let x;return _.length%4==0?x=0:x=4-_.length%4,_.concat("=".repeat(x))}r.b64UrlDecode=S}),Abe=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=S$t(),a=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let l=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",l.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(l,i,{saltLength:c}={}){let b=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(l),i);return new Uint8Array(b)}async hash(l,i="SHA-256"){let c=await this.driver.digest(i,l);return new Uint8Array(c)}async verify(l,i,c){let b={kty:"RSA",e:"AQAB",n:l},g=await this.jwkToPublicCryptoKey(b),M=await this.driver.digest("SHA-256",i),y=await this.driver.verify({name:"RSA-PSS",saltLength:0},g,c,i),w=await this.driver.verify({name:"RSA-PSS",saltLength:32},g,c,i),S=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((g.algorithm.modulusLength-1)/8)-M.byteLength-2},g,c,i);return y||w||S}async jwkToCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let l=crypto?.subtle;return l===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof l[i]=="function")}async encrypt(l,i,c){let b=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),g=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},b,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),M=new Uint8Array(16);crypto.getRandomValues(M);let y=await this.driver.encrypt({name:"AES-CBC",iv:M},g,l);return e.concatBuffers([M,y])}async decrypt(l,i,c){let b=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),g=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},b,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),M=l.slice(0,16),y=await this.driver.decrypt({name:"AES-CBC",iv:M},g,l.slice(16));return e.concatBuffers([y])}};r.default=a}),Rbe=w1(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}}),Drt=w1(r=>{"use strict";var e=_$t(),a=Rbe(),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 Y(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 Y(this,T,N,D,!0)},g.prototype.lastIndexOf=function(T,N,D){return Y(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 G(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 G(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)&&J(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)&&J(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)&&J(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)&&J(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 V(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 V(this,T,N,!0,D)},g.prototype.writeDoubleBE=function(T,N,D){return V(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)&&J(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 J(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")}}),Ibe=w1((r,e)=>{typeof window<"u"?(window.global=window,globalThis.fetch=window.fetch,e.exports={Buffer:Drt().Buffer,Crypto:window.crypto}):e.exports={Buffer:Drt().Buffer,Crypto:crypto}}),x$t={};_be(x$t,{AVSCTap:()=>cw,ArweaveSigner:()=>Ent,DataItem:()=>rw,MAX_TAG_BYTES:()=>OB,MIN_BINARY_SIZE:()=>Int,SIG_CONFIG:()=>P3,SignatureConfig:()=>vu,Signer:()=>E$t,createData:()=>k$t,deserializeTags:()=>aB,indexToType:()=>Ant,serializeTags:()=>Rnt,tagsExceedLimit:()=>I$t});var E$t=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(r,e,a,l){throw new Error("You must implement verify method on child")}},kbe=j6(xnt(),1),wl=j6(S$t(),1);async function A$t(r){if(Array.isArray(r)){let i=(0,wl.concatBuffers)([(0,wl.stringToBuffer)("list"),(0,wl.stringToBuffer)(r.length.toString())]);return await R$t(r,await p1().hash(i,"SHA-384"))}let e=r,a=(0,wl.concatBuffers)([(0,wl.stringToBuffer)("blob"),(0,wl.stringToBuffer)(e.byteLength.toString())]),l=(0,wl.concatBuffers)([await p1().hash(a,"SHA-384"),await p1().hash(e,"SHA-384")]);return await p1().hash(l,"SHA-384")}async function R$t(r,e){if(r.length<1)return e;let a=(0,wl.concatBuffers)([e,await A$t(r[0])]),l=await p1().hash(a,"SHA-384");return await R$t(r.slice(1),l)}var KV=j6(Abe(),1),Tbe=KV.default.default?KV.default.default:KV.default,Bbe=class extends Tbe{getPublicKey(r){throw new Error("Unimplemented")}},Pbe;function p1(){return Pbe??=new Bbe}var vu;(function(r){r[r.ARWEAVE=1]="ARWEAVE",r[r.ED25519=2]="ED25519",r[r.ETHEREUM=3]="ETHEREUM",r[r.SOLANA=4]="SOLANA",r[r.INJECTEDAPTOS=5]="INJECTEDAPTOS",r[r.MULTIAPTOS=6]="MULTIAPTOS",r[r.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(vu||(vu={}));var P3={[vu.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[vu.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[vu.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[vu.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[vu.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[vu.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[vu.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},Ent=class{signatureType=1;ownerLength=P3[1].pubLength;signatureLength=P3[1].sigLength;jwk;pk;constructor(r){this.pk=r.n,this.jwk=r}get publicKey(){return kbe.default.toBuffer(this.pk)}sign(r){return p1().sign(this.jwk,r)}static async verify(r,e,a){return await p1().verify(r,e,a)}},Ant={1:Ent},kd=j6(xnt(),1);async function $rt(r){return A$t([(0,wl.stringToBuffer)("dataitem"),(0,wl.stringToBuffer)("1"),(0,wl.stringToBuffer)(r.signatureType.toString()),r.rawOwner,r.rawTarget,r.rawAnchor,r.rawTags,r.rawData])}async function Nbe(r,e){let a=await $rt(r),l=await e.sign(a),i=await p1().hash(l);return{signature:zt.from(l),id:zt.from(i)}}async function Obe(r,e){let{signature:a,id:l}=await Nbe(r,e);return r.getRaw().set(a,2),l}var cw=class{buf;pos;constructor(r=zt.alloc(OB),e=0){this.buf=r,this.pos=e}writeTags(r){if(!Array.isArray(r))throw new Error("input must be array");let e=r.length,a;if(e)for(this.writeLong(e),a=0;a<e;a++){let l=r[a];if(l?.name===void 0||l?.value===void 0)throw new Error(`Invalid tag format for ${l}, expected {name:string, value: string}`);this.writeString(l.name),this.writeString(l.value)}this.writeLong(0)}toBuffer(){let r=zt.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(r,0,0,this.pos),r}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(r){let e=this.buf,a,l;if(r>=-1073741824&&r<1073741824){l=r>=0?r<<1:~r<<1|1;do e[this.pos]=l&127,l>>=7;while(l&&(e[this.pos++]|=128))}else{a=r>=0?r*2:-r*2-1;do e[this.pos]=a&127,a/=128;while(a>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(r){let e=zt.byteLength(r),a=this.buf;this.writeLong(e);let l=this.pos;if(this.pos+=e,!(this.pos>a.length)){if(e>64)this.buf.write(r,this.pos-e,e,"utf8");else{let i,c,b,g;for(i=0,c=e;i<c;i++)b=r.charCodeAt(i),b<128?a[l++]=b:b<2048?(a[l++]=b>>6|192,a[l++]=b&63|128):(b&64512)===55296&&((g=r.charCodeAt(i+1))&64512)===56320?(b=65536+((b&1023)<<10)+(g&1023),i++,a[l++]=b>>18|240,a[l++]=b>>12&63|128,a[l++]=b>>6&63|128,a[l++]=b&63|128):(a[l++]=b>>12|224,a[l++]=b>>6&63|128,a[l++]=b&63|128)}this.buf=a}}readLong(){let r=0,e=0,a=this.buf,l,i,c,b;do l=a[this.pos++],i=l&128,r|=(l&127)<<e,e+=7;while(i&&e<28);if(i){c=r,b=268435456;do l=a[this.pos++],c+=(l&127)*b,b*=128;while(l&128);return(c%2?-(c+1):c)/2}return r>>1^-(r&1)}skipLong(){let r=this.buf;for(;r[this.pos++]&128;);}readTags(){let r=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let a=this.readString(),l=this.readString();r.push({name:a,value:l})}return r}readString(){let r=this.readLong(),e=this.pos,a=this.buf;if(this.pos+=r,!(this.pos>a.length))return this.buf.slice(e,e+r).toString()}};function Rnt(r){let e=new cw;return e.writeTags(r),e.toBuffer()}function I$t(r){let e=new cw;return e.writeTags(r),e.tagsExceedLimit()}function aB(r){return new cw(r).readTags()}function um(r){let e=0;for(let a=r.length-1;a>=0;a--)e=e*256+r[a];return e}function Cbe(r){if(r>29)throw new Error("Short too long");let e=[0,0];for(let a=0;a<e.length;a++){let l=r&255;e[a]=l,r=(r-l)/256}return Uint8Array.from(e)}function PIt(r){let e=[0,0,0,0,0,0,0,0];for(let a=0;a<e.length;a++){let l=r&255;e[a]=l,r=(r-l)/256}return Uint8Array.from(e)}var Lbe=j6(Ibe(),1),r3=j6(Drt(),1),OB=4096,Int=80,rw=class{binary;_id;constructor(r){this.binary=r}static isDataItem(r){return r.binary!==void 0}get signatureType(){let r=um(this.binary.subarray(0,2));if(vu?.[r]!==void 0)return r;throw new Error("Unknown signature type: "+r)}async isValid(){return rw.verify(this.binary)}get id(){return(async()=>kd.default.encode(await this.rawId))()}set id(r){this._id=kd.default.toBuffer(r)}get rawId(){return(async()=>r3.Buffer.from(await Lbe.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(r){this._id=r}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return kd.default.encode(this.rawSignature)}set rawOwner(r){if(r.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${r.byteLength} bytes.`);this.binary.set(r,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return P3[this.signatureType].sigLength}get owner(){return kd.default.encode(this.rawOwner)}get ownerLength(){return P3[this.signatureType].pubLength}get rawTarget(){let r=this.getTargetStart();return this.binary[r]==1?this.binary.subarray(r+1,r+33):r3.Buffer.alloc(0)}get target(){return kd.default.encode(this.rawTarget)}get rawAnchor(){let r=this.getAnchorStart();return this.binary[r]==1?this.binary.subarray(r+1,r+33):r3.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let r=this.getTagsStart(),e=um(this.binary.subarray(r+8,r+16));return this.binary.subarray(r+16,r+16+e)}get tags(){let r=this.getTagsStart();if(um(this.binary.subarray(r,r+8))==0)return[];let e=um(this.binary.subarray(r+8,r+16));return aB(r3.Buffer.from(this.binary.subarray(r+16,r+16+e)))}get tagsB64Url(){return this.tags.map(r=>({name:kd.default.encode(r.name),value:kd.default.encode(r.value)}))}getStartOfData(){let r=this.getTagsStart(),e=this.binary.subarray(r+8,r+16),a=um(e);return r+16+a}get rawData(){let r=this.getTagsStart(),e=this.binary.subarray(r+8,r+16),a=um(e),l=r+16+a;return this.binary.subarray(l,this.binary.length)}get data(){return kd.default.encode(this.rawData)}getRaw(){return this.binary}async sign(r){return this._id=await Obe(this,r),this.rawId}async setSignature(r){this.binary.set(r,2),this._id=r3.Buffer.from(await p1().hash(r))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(r=>({name:kd.default.encode(r.name),value:kd.default.encode(r.value)})),data:this.data}}static async verify(r){if(r.byteLength<Int)return!1;let e=new rw(r),a=e.signatureType,l=e.getTagsStart(),i=um(r.subarray(l,l+8)),c=r.subarray(l+8,l+16),b=um(c);if(b>OB)return!1;if(i>0)try{if(aB(r3.Buffer.from(r.subarray(l+16,l+16+b))).length!==i)return!1}catch{return!1}let g=Ant[a],M=await $rt(e);return await g.verify(e.rawOwner,M,e.rawSignature)}async getSignatureData(){return $rt(this)}getTagsStart(){let r=this.getTargetStart(),e=this.binary[r]==1,a=r+(e?33:1),l=this.binary[a]==1;return a+=l?33:1,a}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let r=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return r+=e?32:0,r}},Dbe=j6(xnt(),1);function k$t(r,e,a){let l=e.publicKey,i=a?.target?Dbe.default.toBuffer(a.target):null,c=1+(i?.byteLength??0),b=a?.anchor?zt.from(a.anchor):null,g=1+(b?.byteLength??0),M=(a?.tags?.length??0)>0?Rnt(a.tags):null,y=16+(M?M.byteLength:0),w=zt.from(r),S=w.byteLength,_=2+e.signatureLength+e.ownerLength+c+g+y+S,x=zt.alloc(_);if(x.set(Cbe(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(PIt(a?.tags?.length??0),B);let P=PIt(M?.byteLength??0);x.set(P,B+8),M&&x.set(M,B+16);let O=B+y;return x.set(w,O),new rw(x)}var knt={...x$t};globalThis.arbundles??=knt;var $be=knt,qbe=knt,Ube=fB(dce(),1);globalThis.Buffer||(globalThis.Buffer=_nt.Buffer);var{DataItem:jbe}=M$t,{signMessage:zbe}=Ube.httpbis;function Fbe(r){return async({data:e,tags:a,target:l,anchor:i,createDataItem:c=b=>new jbe(b)})=>{let b=await r.signDataItem({data:e,tags:a,target:l,anchor:i}),g=c(_nt.Buffer.from(b));return{id:await g.id,raw:await g.getRaw()}}}function Hbe(r){let e=["alg","keyid"].sort(),a;return async({fields:l,request:i})=>new Promise(c=>(a||(a=r.connect(["ACCESS_ADDRESS","ACCESS_PUBLIC_KEY","SIGNATURE"]).then(async()=>{let b=await r.getActivePublicKey(),g=await r.getActiveAddress();return{publicKey:b,address:g}})),c(a))).then(({publicKey:c,address:b})=>zbe({key:{id:c,alg:"rsa-pss-sha512",sign:async g=>{let M=await r.signMessage(g,{hashAlgorithm:"SHA-512"});return _nt.Buffer.from(M)}},fields:l,name:h6e(b),params:e},i))}var Kbe=globalThis.GATEWAY_URL||void 0,Zbe=globalThis.MU_URL||void 0,Wbe=globalThis.CU_URL||void 0,Vbe=globalThis.GRAPHQL_URL||void 0,Gbe=globalThis.GRAPHQL_MAX_RETRIES||void 0,Jbe=globalThis.GRAPHQL_RETRY_BACKOFF||void 0,Ybe=globalThis.RELAY_URL||void 0,Xbe=globalThis.AO_URL=void 0,Fh=vbe({createDataItemSigner:Lrt.createDataItemSigner,createHbSigner:Lrt.createHbSigner}),{result:T$e,results:B$e,message:P$e,spawn:N$e,monitor:O$e,unmonitor:C$e,dryrun:L$e,assign:D$e,createDataItemSigner:T$t}=Fh({MODE:"legacy",GATEWAY_URL:Kbe,MU_URL:Zbe,CU_URL:Wbe,RELAY_URL:Ybe,AO_URL:Xbe,GRAPHQL_URL:Vbe,GRAPHQL_MAX_RETRIES:Gbe,GRAPHQL_RETRY_BACKOFF:Jbe,noLog:!0});Et();Rt();At();Et();Rt();At();Et();Rt();At();var Il=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},B$t=class extends Il{},P$t=class extends Il{},N$t=class extends Il{constructor(e,a){super(`Failed request: ${e}: ${a}`)}},O$t=class extends Il{},CB=class extends Il{},C$t=class extends Il{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Wd=class extends Il{constructor(){super("Invalid contract configuration")}},L$t=class extends Il{constructor(){super("Invalid process configuration")}},D$t=class extends Il{};Et();Rt();At();var $$t=class{logger;winston;constructor({level:e="info"}={}){try{this.winston=JUt("winston")}catch{throw new Error("Winston is not installed. Install it with: npm install winston")}this.logger=this.winston.createLogger({level:e==="none"?"error":e,silent:e==="none",defaultMeta:{name:"ar-io-sdk",version:Kp},format:this.winston.format.combine(this.winston.format.timestamp(),this.winston.format.json()),transports:[new this.winston.transports.Console({format:this.winston.format.combine(this.winston.format.timestamp(),this.winston.format.json())})]})}info(e,...a){this.logger.info(e,...a)}warn(e,...a){this.logger.warn(e,...a)}error(e,...a){this.logger.error(e,...a)}debug(e,...a){this.logger.debug(e,...a)}setLogLevel(e){e==="none"?this.logger.silent=!0:(this.logger.silent=!1,this.logger.level=e)}};Et();Rt();At();Et();Rt();At();var Tnt=r=>{let e=Object.entries(r).sort(([a,l],[i,c])=>a==="@"?-1:i==="@"?1:"priority"in l&&!("priority"in c)?-1:!("priority"in l)&&"priority"in c?1:l.priority!==void 0&&c.priority!==void 0?l.priority===c.priority?a<i?-1:a>i?1:0:l.priority-c.priority:a<i?-1:a>i?1:0);return Object.fromEntries(e.map(([a,l],i)=>[a,{...l,index:i}]))},q$t=r=>"name"in r&&"ticker"in r&&"description"in r&&"keywords"in r&&"denomination"in r&&"owner"in r&&"controllers"in r&&"records"in r&&"balances"in r&&"logo"in r&&"totalsupply"in r&&"initialized"in r,U$t=r=>{function e(l){return Object.fromEntries(Object.entries(l).map(([i,c])=>i.toLowerCase().includes("balances")?[i.toLowerCase(),c]:typeof c=="object"&&!Array.isArray(c)&&c!==null?[i.toLowerCase(),e(c)]:[i.toLowerCase(),c]))}let a=e(r);return{Name:a.name,Ticker:a.ticker,Description:a.description,Keywords:a.keywords,Denomination:parseInt(a.denomination),Owner:a.owner,Controllers:a.controllers,Records:Object.entries(a.records).reduce((l,[i,c])=>(l[i]={transactionId:c.transactionid,ttlSeconds:c.ttlseconds,...c.priority!==void 0?{priority:c.priority}:{}},l),{}),Balances:a.balances,Logo:a.logo,TotalSupply:a.totalsupply||1,Initialized:a.initialized}};Et();Rt();At();function Vd(r,e){let a=r.safeParse(e);if(!a.success)throw new Error(JSON.stringify(a.error.format(),null,2));return a}Et();Rt();At();Et();Rt();At();Et();Rt();At();rd();var j$t="+",z$t="/",F$t="-",H$t="_",K$t="=";function Qbe(r){let e=r.length%4;return e&&(r+=K$t.repeat(4-e)),r.replaceAll(F$t,j$t).replaceAll(H$t,z$t)}function tge(r){return r.replaceAll(j$t,F$t).replaceAll(z$t,H$t).replaceAll(K$t,"")}function PUe(r){let e=Qbe(r);return zt.from(e,"base64")}function z6(r){let e=r.toString("base64");return tge(e)}function NUe(r){return z6(Zu("sha256").update(Uint8Array.from(r)).digest())}function Z$t(r=32){let e=oz(r);return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("").slice(0,r)}Et();Rt();At();Et();Rt();At();function Bnt(r){try{return JSON.parse(r)}catch{return r}}Et();Rt();At();Et();Rt();At();var Nnt=Rn(V$t(),1);Et();Rt();At();var ige=Object.defineProperty,nge=(r,e,a)=>e in r?ige(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,mw=(r,e,a)=>(nge(r,typeof e!="symbol"?e+"":e,a),a),Ont=class{constructor(e){mw(this,"value"),mw(this,"next"),this.value=e}},Cnt=class{constructor(){mw(this,"head"),mw(this,"tail"),mw(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let a=new Ont(e);return this.head&&this.tail?(this.tail.next=a,this.tail=a):(this.head=a,this.tail=a),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function G$t(r){if(!((Number.isInteger(r)||r===1/0)&&r>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new Cnt,a=0,l=()=>{a--,e.size>0&&e.pop()()},i=async(g,M,y)=>{a++;let w=(async()=>g(...y))();M(w);try{await w}catch{}l()},c=(g,M,y)=>{e.push(i.bind(null,g,M,y)),(async()=>(await Promise.resolve(),a<r&&e.size>0&&e.pop()()))()},b=(g,...M)=>new Promise(y=>{c(g,y,M)});return Object.defineProperties(b,{activeCount:{get:()=>a},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),b}Et();Rt();At();Et();Rt();At();var zqt=Rn(jqt(),1),KB=zqt.default.init({host:"arweave.net",port:443,protocol:"https"});Et();Rt();At();var x3e="https://faucet.ario.permaweb.services";function dat({arioInstance:r,faucetApiUrl:e=x3e}){let a=new lat({faucetUrl:e,processId:r.process.processId});return new Proxy(r,{get(i,c){if(c==="faucet")return a;if(c in i){let b=i[c];return typeof b=="function"?b.bind(i):b}}})}var lat=class{faucetUrl;processId;constructor({faucetUrl:e,processId:a}){this.faucetUrl=e,this.processId=a}async captchaUrl(){let e=await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`,{method:"GET"});if(!e.ok){let l=await e.json().catch(()=>({error:e.statusText}));throw new Error(l.error)}return await e.json()}async claimWithCaptchaResponse({captchaResponse:e,recipient:a,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,recipient:a,quantity:l,captchaResponse:e})});if(!i.ok){let b=await i.json().catch(()=>({error:i.statusText}));throw new Error(b.error)}return await i.json()}async requestAuthToken({captchaResponse:e}){let a=await fetch(`${this.faucetUrl}/api/captcha/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,captchaResponse:e})});if(!a.ok){let i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error)}return await a.json()}async claimWithAuthToken({authToken:e,recipient:a,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/async`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({recipient:a,qty:l,processId:this.processId})});if(!i.ok){let b=await i.json().catch(()=>({error:i.statusText}));throw new Error(b.error)}return await i.json()}async verifyAuthToken({authToken:e}){let a=await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!a.ok){let i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error)}return await a.json()}};Et();Rt();At();var ZB=class{url;processId;isHyperBeamCompatible;checkHyperBeamPromise;logger;hbTimeoutMs;constructor(e){this.url=e.url,this.processId=e.processId,this.logger=e.logger??xa.default,this.hbTimeoutMs=e.hbTimeoutMs??5e3,this.isHyperBeamCompatible=void 0,this.checkHyperBeamPromise=this.checkHyperBeamCompatibility()}async meta(){let e=new URL(`${this.url}/${this.processId}~process@1.0/meta`);return this.fetchHyperbeamPath({path:e.toString()})}async now({path:e,json:a=!1}){return this.fetchHyperbeamPath({path:`${this.url}/${this.processId}~process@1.0/now/${e}`,json:a})}async compute({path:e,json:a=!1}){return this.fetchHyperbeamPath({path:`${this.url}/${this.processId}~process@1.0/compute/${e}`,json:a})}async checkHyperBeamCompatibility({minSlot:e}={}){if(e!==void 0&&(this.isHyperBeamCompatible=void 0,this.checkHyperBeamPromise=void 0),this.checkHyperBeamPromise!==void 0)return this.checkHyperBeamPromise;if(this.isHyperBeamCompatible!==void 0)return Promise.resolve(this.isHyperBeamCompatible);let a=fetch(`${this.url.toString()}/${this.processId}~process@1.0/now`,{method:"HEAD",signal:AbortSignal.timeout(this.hbTimeoutMs)}).then(async l=>{if(l.ok){if(e!==void 0){let i=await this.compute({path:"at-slot",json:!1});if(Number(i)<e)return!1}return this.isHyperBeamCompatible=!0,!0}return this.isHyperBeamCompatible=!1,!1}).catch(l=>(this.logger.debug("Failed to check HyperBeam compatibility",{cause:l}),this.isHyperBeamCompatible=!1,!1));return this.checkHyperBeamPromise=a,a}async fetchHyperbeamPath({path:e,json:a=!0}){try{let l=new URL(e);if(a){this.logger.debug("Fetching path as JSON",{path:e}),l.searchParams.set("require-codec","application/json"),l.searchParams.set("accept-bundle","true");let i=await fetch(l);if(!i.ok)throw new Error(`Failed to fetch path as JSON: ${i.statusText}`);let c=await i.json().then(b=>b).catch(b=>{throw this.logger.error("Failed to parse JSON",{cause:b}),new Error(`Received response but failed to parse JSON: ${b.message}`)});if(typeof c!="object"||c===null||!("body"in c))throw new Error("Response body missing in JSON response");return c.body}else{this.logger.debug("Fetching path as text",{path:e});let i=await fetch(l);if(!i.ok)throw new Error(`Failed to fetch path: ${i.statusText}`);return await i.text()}}catch(l){throw this.logger.error("Failed to fetch path as JSON",{cause:l}),l}}};Et();Rt();At();Et();Rt();At();Et();Rt();At();var Ls=[];for(let r=0;r<256;++r)Ls.push((r+256).toString(16).slice(1));function Fqt(r,e=0){return(Ls[r[e+0]]+Ls[r[e+1]]+Ls[r[e+2]]+Ls[r[e+3]]+"-"+Ls[r[e+4]]+Ls[r[e+5]]+"-"+Ls[r[e+6]]+Ls[r[e+7]]+"-"+Ls[r[e+8]]+Ls[r[e+9]]+"-"+Ls[r[e+10]]+Ls[r[e+11]]+Ls[r[e+12]]+Ls[r[e+13]]+Ls[r[e+14]]+Ls[r[e+15]]).toLowerCase()}Et();Rt();At();var cat,E3e=new Uint8Array(16);function pat(){if(!cat){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");cat=crypto.getRandomValues.bind(crypto)}return cat(E3e)}Et();Rt();At();Et();Rt();At();var A3e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mat={randomUUID:A3e};function R3e(r,e,a){if(mat.randomUUID&&!e&&!r)return mat.randomUUID();r=r||{};let l=r.random??r.rng?.()??pat();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,e){if(a=a||0,a<0||a+16>e.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[a+i]=l[i];return e}return Fqt(l)}var vat=R3e;Et();Rt();At();var bat=class r{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new r(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new r(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},gat=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMARIO(){return new Ew(Math.floor(this.value*EZ))}toString(){return`${this.value}`}},Ew=class r extends bat{constructor(e){super(e)}multiply(e){let a=Math.floor(this.valueOf()*e.valueOf());return new r(a)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let a=Math.floor(this.valueOf()/e.valueOf());return new r(a)}plus(e){let a=super.plus(e);return new r(a.valueOf())}minus(e){let a=super.minus(e);return new r(a.valueOf())}toARIO(){return new gat(this.valueOf()/EZ)}};Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();function Aw(r,e){return function(){return r.apply(e,arguments)}}var{toString:I3e}=Object.prototype,{getPrototypeOf:wat}=Object,{iterator:VB,toStringTag:Kqt}=Symbol,GB=(r=>e=>{let a=I3e.call(e);return r[a]||(r[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),Pl=r=>(r=r.toLowerCase(),e=>GB(e)===r),JB=r=>e=>typeof e===r,{isArray:H3}=Array,F3=JB("undefined");function Rw(r){return r!==null&&!F3(r)&&r.constructor!==null&&!F3(r.constructor)&&ih(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}var Zqt=Pl("ArrayBuffer");function k3e(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Zqt(r.buffer),e}var T3e=JB("string"),ih=JB("function"),Wqt=JB("number"),Iw=r=>r!==null&&typeof r=="object",B3e=r=>r===!0||r===!1,WB=r=>{if(GB(r)!=="object")return!1;let e=wat(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Kqt in r)&&!(VB in r)},P3e=r=>{if(!Iw(r)||Rw(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},N3e=Pl("Date"),O3e=Pl("File"),C3e=Pl("Blob"),L3e=Pl("FileList"),D3e=r=>Iw(r)&&ih(r.pipe),$3e=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||ih(r.append)&&((e=GB(r))==="formdata"||e==="object"&&ih(r.toString)&&r.toString()==="[object FormData]"))},q3e=Pl("URLSearchParams"),[U3e,j3e,z3e,F3e]=["ReadableStream","Request","Response","Headers"].map(Pl),H3e=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function kw(r,e,{allOwnKeys:a=!1}={}){if(r===null||typeof r>"u")return;let l,i;if(typeof r!="object"&&(r=[r]),H3(r))for(l=0,i=r.length;l<i;l++)e.call(null,r[l],l,r);else{if(Rw(r))return;let c=a?Object.getOwnPropertyNames(r):Object.keys(r),b=c.length,g;for(l=0;l<b;l++)g=c[l],e.call(null,r[g],g,r)}}function Vqt(r,e){if(Rw(r))return null;e=e.toLowerCase();let a=Object.keys(r),l=a.length,i;for(;l-- >0;)if(i=a[l],e===i.toLowerCase())return i;return null}var F6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gqt=r=>!F3(r)&&r!==F6;function yat(){let{caseless:r,skipUndefined:e}=Gqt(this)&&this||{},a={},l=(i,c)=>{let b=r&&Vqt(a,c)||c;WB(a[b])&&WB(i)?a[b]=yat(a[b],i):WB(i)?a[b]=yat({},i):H3(i)?a[b]=i.slice():(!e||!F3(i))&&(a[b]=i)};for(let i=0,c=arguments.length;i<c;i++)arguments[i]&&kw(arguments[i],l);return a}var K3e=(r,e,a,{allOwnKeys:l}={})=>(kw(e,(i,c)=>{a&&ih(i)?r[c]=Aw(i,a):r[c]=i},{allOwnKeys:l}),r),Z3e=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),W3e=(r,e,a,l)=>{r.prototype=Object.create(e.prototype,l),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),a&&Object.assign(r.prototype,a)},V3e=(r,e,a,l)=>{let i,c,b,g={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),c=i.length;c-- >0;)b=i[c],(!l||l(b,r,e))&&!g[b]&&(e[b]=r[b],g[b]=!0);r=a!==!1&&wat(r)}while(r&&(!a||a(r,e))&&r!==Object.prototype);return e},G3e=(r,e,a)=>{r=String(r),(a===void 0||a>r.length)&&(a=r.length),a-=e.length;let l=r.indexOf(e,a);return l!==-1&&l===a},J3e=r=>{if(!r)return null;if(H3(r))return r;let e=r.length;if(!Wqt(e))return null;let a=new Array(e);for(;e-- >0;)a[e]=r[e];return a},Y3e=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&wat(Uint8Array)),X3e=(r,e)=>{let l=(r&&r[VB]).call(r),i;for(;(i=l.next())&&!i.done;){let c=i.value;e.call(r,c[0],c[1])}},Q3e=(r,e)=>{let a,l=[];for(;(a=r.exec(e))!==null;)l.push(a);return l},t8e=Pl("HTMLFormElement"),e8e=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,l,i){return l.toUpperCase()+i}),Hqt=(({hasOwnProperty:r})=>(e,a)=>r.call(e,a))(Object.prototype),r8e=Pl("RegExp"),Jqt=(r,e)=>{let a=Object.getOwnPropertyDescriptors(r),l={};kw(a,(i,c)=>{let b;(b=e(i,c,r))!==!1&&(l[c]=b||i)}),Object.defineProperties(r,l)},i8e=r=>{Jqt(r,(e,a)=>{if(ih(r)&&["arguments","caller","callee"].indexOf(a)!==-1)return!1;let l=r[a];if(ih(l)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},n8e=(r,e)=>{let a={},l=i=>{i.forEach(c=>{a[c]=!0})};return H3(r)?l(r):l(String(r).split(e)),a},a8e=()=>{},o8e=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function s8e(r){return!!(r&&ih(r.append)&&r[Kqt]==="FormData"&&r[VB])}var f8e=r=>{let e=new Array(10),a=(l,i)=>{if(Iw(l)){if(e.indexOf(l)>=0)return;if(Rw(l))return l;if(!("toJSON"in l)){e[i]=l;let c=H3(l)?[]:{};return kw(l,(b,g)=>{let M=a(b,i+1);!F3(M)&&(c[g]=M)}),e[i]=void 0,c}}return l};return a(r,0)},h8e=Pl("AsyncFunction"),u8e=r=>r&&(Iw(r)||ih(r))&&ih(r.then)&&ih(r.catch),Yqt=((r,e)=>r?setImmediate:e?((a,l)=>(F6.addEventListener("message",({source:i,data:c})=>{i===F6&&c===a&&l.length&&l.shift()()},!1),i=>{l.push(i),F6.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",ih(F6.postMessage)),l8e=typeof queueMicrotask<"u"?queueMicrotask.bind(F6):typeof Te<"u"&&Te.nextTick||Yqt,d8e=r=>r!=null&&ih(r[VB]),je={isArray:H3,isArrayBuffer:Zqt,isBuffer:Rw,isFormData:$3e,isArrayBufferView:k3e,isString:T3e,isNumber:Wqt,isBoolean:B3e,isObject:Iw,isPlainObject:WB,isEmptyObject:P3e,isReadableStream:U3e,isRequest:j3e,isResponse:z3e,isHeaders:F3e,isUndefined:F3,isDate:N3e,isFile:O3e,isBlob:C3e,isRegExp:r8e,isFunction:ih,isStream:D3e,isURLSearchParams:q3e,isTypedArray:Y3e,isFileList:L3e,forEach:kw,merge:yat,extend:K3e,trim:H3e,stripBOM:Z3e,inherits:W3e,toFlatObject:V3e,kindOf:GB,kindOfTest:Pl,endsWith:G3e,toArray:J3e,forEachEntry:X3e,matchAll:Q3e,isHTMLForm:t8e,hasOwnProperty:Hqt,hasOwnProp:Hqt,reduceDescriptors:Jqt,freezeMethods:i8e,toObjectSet:n8e,toCamelCase:e8e,noop:a8e,toFiniteNumber:o8e,findKey:Vqt,global:F6,isContextDefined:Gqt,isSpecCompliantForm:s8e,toJSONObject:f8e,isAsyncFn:h8e,isThenable:u8e,setImmediate:Yqt,asap:l8e,isIterable:d8e};Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();function K3(r,e,a,l,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),a&&(this.config=a),l&&(this.request=l),i&&(this.response=i,this.status=i.status?i.status:null)}je.inherits(K3,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});var Xqt=K3.prototype,Qqt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Qqt[r]={value:r}});Object.defineProperties(K3,Qqt);Object.defineProperty(Xqt,"isAxiosError",{value:!0});K3.from=(r,e,a,l,i,c)=>{let b=Object.create(Xqt);je.toFlatObject(r,b,function(w){return w!==Error.prototype},y=>y!=="isAxiosError");let g=r&&r.message?r.message:"Error",M=e==null&&r?r.code:e;return K3.call(b,g,M,a,l,i),r&&b.cause==null&&Object.defineProperty(b,"cause",{value:r,configurable:!0}),b.name=r&&r.name||"Error",c&&Object.assign(b,c),b};var Xr=K3;Et();Rt();At();var YB=null;function Mat(r){return je.isPlainObject(r)||je.isArray(r)}function eUt(r){return je.endsWith(r,"[]")?r.slice(0,-2):r}function tUt(r,e,a){return r?r.concat(e).map(function(i,c){return i=eUt(i),!a&&c?"["+i+"]":i}).join(a?".":""):e}function c8e(r){return je.isArray(r)&&!r.some(Mat)}var p8e=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function m8e(r,e,a){if(!je.isObject(r))throw new TypeError("target must be an object");e=e||new(YB||FormData),a=je.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(I,B){return!je.isUndefined(B[I])});let l=a.metaTokens,i=a.visitor||w,c=a.dots,b=a.indexes,M=(a.Blob||typeof Blob<"u"&&Blob)&&je.isSpecCompliantForm(e);if(!je.isFunction(i))throw new TypeError("visitor must be a function");function y(A){if(A===null)return"";if(je.isDate(A))return A.toISOString();if(je.isBoolean(A))return A.toString();if(!M&&je.isBlob(A))throw new Xr("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(A)||je.isTypedArray(A)?M&&typeof Blob=="function"?new Blob([A]):zt.from(A):A}function w(A,I,B){let P=A;if(A&&!B&&typeof A=="object"){if(je.endsWith(I,"{}"))I=l?I:I.slice(0,-2),A=JSON.stringify(A);else if(je.isArray(A)&&c8e(A)||(je.isFileList(A)||je.endsWith(I,"[]"))&&(P=je.toArray(A)))return I=eUt(I),P.forEach(function(C,K){!(je.isUndefined(C)||C===null)&&e.append(b===!0?tUt([I],K,c):b===null?I:I+"[]",y(C))}),!1}return Mat(A)?!0:(e.append(tUt(B,I,c),y(A)),!1)}let S=[],_=Object.assign(p8e,{defaultVisitor:w,convertValue:y,isVisitable:Mat});function x(A,I){if(!je.isUndefined(A)){if(S.indexOf(A)!==-1)throw Error("Circular reference detected in "+I.join("."));S.push(A),je.forEach(A,function(P,O){(!(je.isUndefined(P)||P===null)&&i.call(e,P,je.isString(O)?O.trim():O,I,_))===!0&&x(P,I?I.concat(O):[O])}),S.pop()}}if(!je.isObject(r))throw new TypeError("data must be an object");return x(r),e}var Km=m8e;function rUt(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(l){return e[l]})}function iUt(r,e){this._pairs=[],r&&Km(r,this,e)}var nUt=iUt.prototype;nUt.append=function(e,a){this._pairs.push([e,a])};nUt.toString=function(e){let a=e?function(l){return e.call(this,l,rUt)}:rUt;return this._pairs.map(function(i){return a(i[0])+"="+a(i[1])},"").join("&")};var XB=iUt;function v8e(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Tw(r,e,a){if(!e)return r;let l=a&&a.encode||v8e;je.isFunction(a)&&(a={serialize:a});let i=a&&a.serialize,c;if(i?c=i(e,a):c=je.isURLSearchParams(e)?e.toString():new XB(e,a).toString(l),c){let b=r.indexOf("#");b!==-1&&(r=r.slice(0,b)),r+=(r.indexOf("?")===-1?"?":"&")+c}return r}Et();Rt();At();var _at=class{constructor(){this.handlers=[]}use(e,a,l){return this.handlers.push({fulfilled:e,rejected:a,synchronous:l?l.synchronous:!1,runWhen:l?l.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(l){l!==null&&e(l)})}},Sat=_at;Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var QB={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var aUt=typeof URLSearchParams<"u"?URLSearchParams:XB;Et();Rt();At();var oUt=typeof FormData<"u"?FormData:null;Et();Rt();At();var sUt=typeof Blob<"u"?Blob:null;var fUt={isBrowser:!0,classes:{URLSearchParams:aUt,FormData:oUt,Blob:sUt},protocols:["http","https","file","blob","url","data"]};var Aat={};I1(Aat,{hasBrowserEnv:()=>Eat,hasStandardBrowserEnv:()=>b8e,hasStandardBrowserWebWorkerEnv:()=>g8e,navigator:()=>xat,origin:()=>y8e});Et();Rt();At();var Eat=typeof window<"u"&&typeof document<"u",xat=typeof navigator=="object"&&navigator||void 0,b8e=Eat&&(!xat||["ReactNative","NativeScript","NS"].indexOf(xat.product)<0),g8e=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",y8e=Eat&&window.location.href||"http://localhost";var to={...Aat,...fUt};function Rat(r,e){return Km(r,new to.classes.URLSearchParams,{visitor:function(a,l,i,c){return to.isNode&&je.isBuffer(a)?(this.append(l,a.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...e})}Et();Rt();At();function w8e(r){return je.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function M8e(r){let e={},a=Object.keys(r),l,i=a.length,c;for(l=0;l<i;l++)c=a[l],e[c]=r[c];return e}function _8e(r){function e(a,l,i,c){let b=a[c++];if(b==="__proto__")return!0;let g=Number.isFinite(+b),M=c>=a.length;return b=!b&&je.isArray(i)?i.length:b,M?(je.hasOwnProp(i,b)?i[b]=[i[b],l]:i[b]=l,!g):((!i[b]||!je.isObject(i[b]))&&(i[b]=[]),e(a,l,i[b],c)&&je.isArray(i[b])&&(i[b]=M8e(i[b])),!g)}if(je.isFormData(r)&&je.isFunction(r.entries)){let a={};return je.forEachEntry(r,(l,i)=>{e(w8e(l),i,a,0)}),a}return null}var tP=_8e;function S8e(r,e,a){if(je.isString(r))try{return(e||JSON.parse)(r),je.trim(r)}catch(l){if(l.name!=="SyntaxError")throw l}return(a||JSON.stringify)(r)}var Iat={transitional:QB,adapter:["xhr","http","fetch"],transformRequest:[function(e,a){let l=a.getContentType()||"",i=l.indexOf("application/json")>-1,c=je.isObject(e);if(c&&je.isHTMLForm(e)&&(e=new FormData(e)),je.isFormData(e))return i?JSON.stringify(tP(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let g;if(c){if(l.indexOf("application/x-www-form-urlencoded")>-1)return Rat(e,this.formSerializer).toString();if((g=je.isFileList(e))||l.indexOf("multipart/form-data")>-1){let M=this.env&&this.env.FormData;return Km(g?{"files[]":e}:e,M&&new M,this.formSerializer)}}return c||i?(a.setContentType("application/json",!1),S8e(e)):e}],transformResponse:[function(e){let a=this.transitional||Iat.transitional,l=a&&a.forcedJSONParsing,i=this.responseType==="json";if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(l&&!this.responseType||i)){let b=!(a&&a.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(g){if(b)throw g.name==="SyntaxError"?Xr.from(g,Xr.ERR_BAD_RESPONSE,this,null,this.response):g}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:to.classes.FormData,Blob:to.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],r=>{Iat.headers[r]={}});var Z3=Iat;Et();Rt();At();Et();Rt();At();var x8e=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),hUt=r=>{let e={},a,l,i;return r&&r.split(`
|
|
146
|
+
`]);return{boundary:a,body:l}}async function f6e(r){let e=await r.arrayBuffer(),a=await crypto.subtle.digest("SHA-256",e);return n6e.Buffer.from(a)}async function pnt({processId:r,data:e,tags:a,anchor:l}){let i=new Headers;r&&i.append("target",r),l&&i.append("anchor",l),a&&a.forEach(b=>i.append(b.name,b.value)),i.set("Variant","ao.N.1");let c;if(e){let b=i.get("content-type"),g=await s6e(e,b);c=g.body,i.set("Content-Type",`multipart/form-data; boundary="${g.boundary}"`);let M=await f6e(c);i.append("Content-Digest",`sha-256=:${o6e(M)}:`)}return{headers:i,body:c}}function mnt({url:r,method:e,headers:a}){return a=new Headers(a),{fields:[...a.keys()].sort(),request:{url:r,method:e,headers:{...Object.fromEntries(a)}}}}function h6e(r){return`http-sig-${[...a6e(r).subarray(1,9)].map(e=>e.toString(16).padStart(2,"0")).join("")}`}function u6e({fetch:r,logger:e,HB_URL:a,signer:l}){let i=e.child("deployProcess");return c=>si(c).chain(Di(({processId:b,data:g,tags:M})=>pnt({processId:b,data:g,tags:M}))).chain(Di(({headers:b,body:g})=>l(mnt({url:`${a}/~scheduler@1.0/schedule`,method:"POST",headers:b})).then(M=>({...M,body:g})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(b=>si(b).chain(Di(({url:g,method:M,headers:y,body:w})=>r(g,{method:M,headers:y,body:w,redirect:"follow"}))).bichain(g=>Rl(g),Di(async g=>{if(g.ok)return g.headers.get("process");throw new Error(`${g.status}: ${await g.text()}`)})).bimap(i.tap("Error encountered when deploying process via HB MU"),i.tap("Successfully deployed process via HB MU")).map(g=>({processId:g}))).toPromise()}function l6e({fetch:r,logger:e,HB_URL:a,signer:l}){let i=e.child("deployMessage");return c=>si(c).chain(Di(({processId:b,data:g,tags:M,anchor:y})=>pnt({processId:b,data:g,tags:M,anchor:y}))).chain(Di(({headers:b,body:g})=>l(mnt({url:`${a}/~scheduler@1.0/schedule`,method:"POST",headers:b})).then(M=>({...M,body:g})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(b=>si(b).chain(Di(({url:g,method:M,headers:y,body:w})=>r(g,{method:M,headers:y,body:w,redirect:"follow"}))).bichain(g=>Rl(g),Di(async g=>{if(g.ok)return g.headers.get("slot");throw new Error(`${g.status}: ${await g.text()}`)})).bimap(i.tap("Error encountered when writing message via HB MU"),i.tap("Successfully wrote message via HB MU")).map(g=>({messageId:g}))).toPromise()}function d6e({fetch:r,logger:e,HB_URL:a,signer:l}){let i=e.child("loadResult");return c=>si(c).chain(Di(async({id:b,processId:g})=>{let{headers:M,body:y}=await pnt({processId:g});return M.append("slot+integer",b),M.append("accept","application/json"),l(mnt({url:`${a}/~compute-lite@1.0/compute&slot+integer=${b}&process-id=${g}`,method:"POST",headers:M})).then(w=>({...w,body:y}))})).map(i.tap("fetching message result from HB CU: %o")).chain(b=>si(b).chain(Di(({url:g,method:M,headers:y,body:w})=>r(g,{method:M,headers:y,body:w,redirect:"follow"}))).bichain(g=>Rl(g),Di(async g=>{if(g.ok)return g.json();throw new Error(`${g.status}: ${await g.text()}`)})).bimap(i.tap("Error encountered when writing message via HB CU"),i.tap("Successfully wrote message via HB CU"))).toPromise()}function c6e({fetch:r,logger:e,HB_URL:a,signer:l}){return async(i,c)=>{let b=new URL(i);c.headers=new Headers(c.headers);let g=b.href,M=new URLSearchParams({"relay-path":g}),y=`${a}/~relay@1.0/call?${M.toString()}`;e('Relaying "%s" through HyperBEAM Node "%s"',b.href,y);let{headers:w}=await l({fields:[...c.headers.keys(),"relay-path"].sort(),request:{url:i,...c,headers:{...Object.fromEntries(c.headers),"relay-path":g}}});return r(y,{...c,headers:w})}}var p6e=fB(_he(),1),d$t=(r="@permaweb/aoconnect")=>{let e=(0,p6e.default)(r);return e.child=a=>d$t(`${e.namespace}:${a}`),e.tap=(a,...l)=>G2e((...i)=>e(a,...l,...i)),e},c$t=({url:r,path:e})=>e?e.startsWith("/")?c$t({url:r,path:e.slice(1)}):(r=new URL(r),r.pathname+=e,r.toString()):r;function m6e(r){return $m(TB([]),U7((e,a)=>$m(K2e([],a.name),e2e(a.value),Qf(a.name,m1,e))(e),{}),unt(e=>e.length>1?e:e[0]))(r)}function SIt(r){return KDt([[w7(String),y7(r)],[w7(Array),O2e(r)],[PDt,ume]])}function U6(r){let e;return w7(bu,r)?(e=new Error(v6e(r)),e.stack+=r.stack):w7(Error,r)?e=r:B2e("message",r)?e=new Error(r.message):w7(String,r)?e=new Error(r):e=new Error("An error occurred"),e}function v6e(r){return $m(e=>(function a(l,i,c){return U7((b,g)=>$m(KDt([[y7(or.invalid_arguments),()=>a(g.argumentsError,422,"Invalid Arguments")],[y7(or.invalid_return_type),()=>a(g.returnTypeError,500,"Invalid Return")],[y7(or.invalid_union),()=>v2e(M=>a(M,400,"Invalid Union"),g.unionErrors)],[PDt,()=>[{...g,status:i,contextCode:c}]]]),E2e(b))(g.code),[],l.issues)})(e,400,""),e=>U7((a,l)=>{let{message:i,path:c,contextCode:b}=l,g=c[1]||c[0],M=b?`${b} `:"";return a.push(`${M}'${g}': ${i}.`),a},[],e),U2e(" | "))(r)}var b6e=Xe.object({id:Xe.string().min(1,{message:"message is required to be a message id"}),processId:Xe.string().min(1,{message:"process is required to be a process id"})});function g6e(){return r=>si(r).map(b6e.parse).map(()=>r)}var dw=Xe.object({name:Xe.string(),value:Xe.string()}),y6e=Xe.function().args(Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))})).returns(Xe.promise(Xe.any())),w6e=Xe.function().args(Xe.object({id:Xe.string().min(1,{message:"message id is required"}),processId:Xe.string().min(1,{message:"process id is required"})})).returns(Xe.promise(Xe.any())),M6e=Xe.function().args(Xe.object({process:Xe.string().min(1,{message:"process id is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()})).returns(Xe.promise(Xe.object({edges:Xe.array(Xe.object({cursor:Xe.string(),node:Xe.object({Output:Xe.any().optional(),Messages:Xe.array(Xe.any()).optional(),Spawns:Xe.array(Xe.any()).optional(),Error:Xe.any().optional()})}))}))),p$t=Xe.function().args(Xe.object({processId:Xe.string(),data:Xe.any(),tags:Xe.array(dw),anchor:Xe.string().optional(),signer:Xe.any()})).returns(Xe.promise(Xe.object({messageId:Xe.string()}).passthrough())),_6e=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(dw),signer:Xe.any()})).returns(Xe.promise(Xe.object({processId:Xe.string()}).passthrough())),S6e=Xe.function().args(Xe.object({process:Xe.string(),message:Xe.string(),baseLayer:Xe.boolean().optional(),exclude:Xe.array(Xe.string()).optional()})).returns(Xe.promise(Xe.object({assignmentId:Xe.string()}).passthrough())),m$t=p$t,I$e=Xe.function().args(Xe.object({suUrl:Xe.string().url(),processId:Xe.string()})).returns(Xe.promise(Xe.object({tags:Xe.array(dw)}).passthrough())),k$e=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({url:Xe.string()}))),x6e=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.boolean())),E6e=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({tags:Xe.array(dw)}).passthrough())),BB=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(dw),target:Xe.string().optional(),anchor:Xe.string().optional()})).returns(Xe.promise(Xe.object({id:Xe.string(),raw:Xe.any()})));function A6e({loadResult:r}){return r=Di(w6e.implement(r)),e=>si({id:e.id,processId:e.processId}).chain(r)}function zV(r){let e=g6e(r),a=A6e(r);return({message:l,process:i})=>si({id:l,processId:i}).chain(e).chain(a).map(r.logger.tap('readResult result for message "%s": %O',l)).map(c=>c).bimap(U6,q6).toPromise()}var $6=(...r)=>e=>r.reduce((a,l)=>l(a),e),vnt=r=>e=>e??r,R6e=r=>e=>$6(a=>a&&a[e],vnt(r)),I6e=r=>e=>{let a={};for(let l in e)e.hasOwnProperty(l)&&(a[l]=r(e[l],l,e));return a},k6e=r=>(...e)=>!r(...e),PB=r=>e=>{let a=e.findIndex(i=>i.name==="Data-Protocol"&&i.value===r);if(a===-1)return[0,0];let l=e.findIndex((i,c)=>c>a&&i.name==="Data-Protocol"&&i.value!==r);return l===-1&&(l=e.length),[a,l]},bnt=r=>{let e=r.findIndex(a=>a.name==="Data-Protocol");return e===-1&&(e=r.length),e},v$t=r=>e=>e.name===r,gnt=(r,e)=>$6(PB(r),([a,l])=>e.slice(a,l))(e),b$t=(r,e,a)=>$6(l=>gnt(r,l),l=>l.filter(v$t(e)))(a),T6e=(r,e,a)=>$6(l=>b$t(r,e,l),l=>l[0])(a),NB=(r,e)=>(e=e.filter(a=>a.name!=="Data-Protocol"||a.value!==r),e.length?[{name:"Data-Protocol",value:r},...e]:[]),B6e=(r,e,a)=>{let[l,i]=PB(r)(a),[c,b,g]=[a.slice(0,l),a.slice(l,i),a.slice(i)];return b.length||(e=NB(r,e),c=g,g=[]),[c,b,e,g].flat(1)},P6e=(r,e)=>{let a=bnt(e),[l,i]=[e.slice(0,a),e.slice(a)];return[l,r,i].flat(1)},g$t=(r,e,a)=>{let[l,i]=PB(r)(a),[c,b]=[a.slice(0,l),a.slice(i)];return b.length===a.length&&(c=b,b=[]),[c,NB(r,e),b].flat(1)},N6e=(r,e)=>g$t(r,[],e),O6e=(r,e,a)=>{let[l,i]=PB(r)(a),[c,b,g]=[a.slice(0,l),a.slice(l,i),a.slice(i)];return[c,NB(r,b.filter(k6e(v$t(e)))),g].flat(1)},ynt=(r,e=!1)=>$6(vnt([]),a=>a.reduce((l,i)=>$6(R6e([])(i.name),c=>(c.push(i.value),c),c=>(l[i.name]=c,l))(l),{}),I6e(a=>e?a:a[0]))(r),y$t=(r,e,a)=>$6(vnt([]),l=>gnt(r,l),l=>ynt(l,a))(e),C6e=(r,e)=>y$t(r,e,!0),L6e=(r,e)=>y$t(r,e,!1),D6e=r=>{let e=bnt(r);return ynt(r.slice(0,e),!1)},$6e=r=>{let e=bnt(r);return ynt(r.slice(0,e),!0)},w$t=r=>({findAll:e=>gnt(r,e),findAllByName:(e,a)=>b$t(r,e,a),findByName:(e,a)=>T6e(r,e,a),create:e=>NB(r,e),update:(e,a)=>g$t(r,e,a),concat:(e,a)=>B6e(r,e,a),removeAll:e=>N6e(r,e),removeAllByName:(e,a)=>O6e(r,e,a),parse:e=>L6e(r,e),parseAll:e=>C6e(r,e),concatUnassoc:P6e,parseUnassoc:D6e,parseAllUnassoc:$6e}),wnt=w$t("ao"),xIt=j3(wnt.removeAllByName),q6e=j3(wnt.concat),EIt=j3(wnt.concatUnassoc),U6e=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function j6e(){return r=>si(r.tags).map(TB([])).map(xIt("Variant")).map(xIt("Type")).map(q6e([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"}])).map(U6e.parse).map(Qf("tags",m1,r))}function z6e({logger:r}){return e=>si(e).chain(ZDt(jDt(e.data),()=>O6(e),()=>O6(" ").map(Qf("data",m1,e)).map(a=>$m(C6("tags"),EIt([{name:"Content-Type",value:"text/plain"}]),Qf("tags",m1,a))(a)).map(r.tap('added pseudo-random string as message "data"')))).map(a=>$m(C6("tags"),EIt([{name:"SDK",value:"aoconnect"}]),Qf("tags",m1,a))(a))}function F6e(r){let e=j6e(r),a=z6e(r),l=p$t.implement(r.deployMessage);return i=>si(i).chain(e).chain(a).chain(Di(({id:c,data:b,tags:g,anchor:M,signer:y})=>l({processId:c,data:b,tags:g,anchor:M,signer:BB.implement(y)}))).map(c=>Qf("messageId",c.messageId,i))}function FV(r){let e=F6e(r);return({process:a,data:l,tags:i,anchor:c,signer:b})=>si({id:a,data:l,tags:i,anchor:c,signer:b}).chain(e).map(g=>g.messageId).bimap(U6,q6).toPromise()}var M5=(r,e,a)=>l=>e(l[r])?O6(l):Rl(`Tag '${r}': ${a}`);function H6e({loadTransactionMeta:r,logger:e}){return r=Di(E6e.implement(r)),a=>si(a).chain(r).map(C6("tags")).map(m6e).chain(M5("Data-Protocol",SIt("ao"),"value 'ao' was not found on module")).chain(M5("Type",SIt("Module"),"value 'Module' was not found on module")).chain(M5("Module-Format",qV,"was not found on module")).chain(M5("Input-Encoding",qV,"was not found on module")).chain(M5("Output-Encoding",qV,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function K6e({logger:r,validateScheduler:e}){return e=Di(x6e.implement(e)),a=>si(a).chain(l=>e(l).chain(i=>i?O6(l):Rl(`Valid Scheduler-Location owned by ${l} not found`))).bimap(r.tap("Verifying scheduler failed: %s"),r.tap("Verified scheduler"))}function Z6e({logger:r}){return e=>si(e).map(r.tap("Checking for signer")).chain(a=>a?O6(a):Rl("signer not found"))}function W6e(r){let e=r.logger.child("verifyInput");r={...r,logger:e};let a=H6e(r),l=K6e(r),i=Z6e(r);return c=>si(c).chain(b=>a(b.module).map(()=>b)).chain(b=>i(b.signer).map(()=>b)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var Mnt=w$t("ao"),PE=j3(Mnt.removeAllByName),V6e=j3(Mnt.concat),AIt=j3(Mnt.concatUnassoc),G6e=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function J6e(){return r=>si(r).map(C6("tags")).map(TB([])).map(PE("Variant")).map(PE("Type")).map(PE("Module")).map(PE("Scheduler")).map(V6e([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:r.module},{name:"Scheduler",value:r.scheduler}])).map(G6e.parse).map(Qf("tags",m1,r))}function Y6e({logger:r}){return e=>si(e).chain(ZDt(jDt(e.data),()=>O6(e),()=>O6(" ").map(Qf("data",m1,e)).map(a=>$m(C6("tags"),AIt([{name:"Content-Type",value:"text/plain"}]),Qf("tags",m1,a))(a)).map(r.tap('added pseudo-random string as process "data"')))).map(a=>$m(C6("tags"),AIt([{name:"SDK",value:"aoconnect"}]),Qf("tags",m1,a))(a))}function X6e(r){let e=r.logger.child("uploadProcess");r={...r,logger:e};let a=J6e(r),l=Y6e(r),i=_6e.implement(r.deployProcess);return c=>si(c).chain(a).chain(l).chain(Di(({data:b,tags:g,signer:M})=>i({data:b,tags:g,signer:BB.implement(M)}))).map(b=>Qf("processId",b.processId,c))}function HV(r){let e=W6e(r),a=X6e(r);return({module:l,scheduler:i,signer:c,tags:b,data:g})=>si({module:l,scheduler:i,signer:c,tags:b,data:g}).chain(e).chain(a).map(M=>M.processId).bimap(U6,q6).toPromise()}function Q6e(r){let e=m$t.implement(r.deployMonitor);return a=>si(a).chain(Di(({id:l,signer:i})=>e({processId:l,signer:BB.implement(i),data:" ",tags:[]}))).map(l=>Qf("monitorId",l.messageId,a))}function RIt(r){let e=Q6e(r);return({process:a,signer:l})=>si({id:a,signer:l}).chain(e).map(i=>i.monitorId).bimap(U6,q6).toPromise()}function tbe(r){let e=m$t.implement(r.deployUnmonitor);return a=>si(a).chain(Di(({id:l,signer:i})=>e({processId:l,signer:BB.implement(i),data:" ",tags:[]}))).map(l=>Qf("monitorId",l.messageId,a))}function IIt(r){let e=tbe(r);return({process:a,signer:l})=>si({id:a,signer:l}).chain(e).map(i=>i.monitorId).bimap(U6,q6).toPromise()}var ebe=Xe.object({process:Xe.string().min(1,{message:"process identifier is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()});function rbe(){return r=>si(r).map(ebe.parse).map(()=>r)}function ibe({queryResults:r}){return r=Di(M6e.implement(r)),e=>si({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(r)}function kIt(r){let e=rbe(r),a=ibe(r);return({process:l,from:i,to:c,sort:b,limit:g})=>si({process:l,from:i,to:c,sort:b,limit:g}).chain(e).chain(a).map(r.logger.tap('readResults result for message "%s": %O',l)).map(M=>M).bimap(U6,q6).toPromise()}var nbe=Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))});function abe(){return r=>si(r).map(nbe.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function obe({dryrunFetch:r}){return Di(y6e.implement(r))}function TIt(r){let e=abe(r),a=obe(r);return l=>si(l).map(sbe).chain(e).chain(a).toPromise()}function sbe({process:r,data:e,tags:a,anchor:l,...i}){return{Id:"1234",Owner:"1234",...i,Target:r,Data:e||"1234",Tags:a||[],Anchor:l||"0"}}function fbe(r){let e=S6e.implement(r.deployAssign);return a=>si(a).chain(Di(({process:l,message:i,baseLayer:c,exclude:b})=>e({process:l,message:i,baseLayer:c,exclude:b}))).map(l=>Qf("assignmentId",l.assignmentId,a))}function BIt(r){let e=fbe(r);return({process:a,message:l,baseLayer:i,exclude:c})=>si({process:a,message:l,baseLayer:i,exclude:c}).chain(e).map(b=>b.assignmentId).bimap(U6,q6).toPromise()}var hbe="https://arweave.net",ube="https://mu.ao-testnet.xyz",lbe="https://cu.ao-testnet.xyz",dbe="http://localhost:8734",cbe="http://localhost:8734",pbe="http://cu.s451-comm3-main.xyz",mbe="http://mu.s451-comm3-main.xyz",c6=fetch;function vbe({createDataItemSigner:r,createHbSigner:e}){let a=d$t();function l({MODE:g,wallet:M,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S,MU_URL:_=mbe,CU_URL:x=pbe,RELAY_URL:A=dbe,fetch:I=c6}){let B=a.child("relay");B("Mode Activated \u{1F500}");let P=e(M),O=()=>r(M),C=c6e({fetch:c6,logger:B,HB_URL:A,signer:P}),{validate:K}=xrt({cacheSize:100,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S}),W=B.child("result"),Y=zV({loadResult:lIt({fetch:C,CU_URL:x,logger:W}),logger:W}),U=B.child("message"),q=FV({deployMessage:aIt({fetch:C,MU_URL:_,logger:U}),logger:U}),G=B.child("spawn"),h=HV({loadTransactionMeta:jV({fetch:I,GRAPHQL_URL:y,logger:G}),validateScheduler:K,deployProcess:oIt({fetch:C,MU_URL:_,logger:G}),logger:G}),t=B.child("monitor"),n=RIt({deployMonitor:sIt({fetch:C,MU_URL:_,logger:t}),logger:t}),s=B.child("unmonitor"),u=IIt({deployUnmonitor:fIt({fetch:C,MU_URL:_,logger:s}),logger:t}),d=B.child("results"),v=kIt({queryResults:dIt({fetch:C,CU_URL:x,logger:d}),logger:d}),p=B.child("dryrun"),f=TIt({dryrunFetch:uIt({fetch:C,CU_URL:x,logger:p}),logger:p}),o=B.child("assign"),m=BIt({deployAssign:hIt({fetch:C,MU_URL:_,logger:o}),logger:U});return{MODE:g,result:Y,results:v,message:q,spawn:h,monitor:n,unmonitor:u,dryrun:f,assign:m,createDataItemSigner:O}}function i({MODE:g,GRAPHQL_URL:M,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w,MU_URL:S=ube,CU_URL:_=lbe,fetch:x=c6,noLog:A}){let I=a.child("legacy");A||I("Mode Activated \u2139\uFE0F");let{validate:B}=xrt({cacheSize:100,GRAPHQL_URL:M,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w}),P=I.child("result"),O=zV({loadResult:lIt({fetch:x,CU_URL:_,logger:P}),logger:P}),C=I.child("message"),K=FV({deployMessage:aIt({fetch:x,MU_URL:S,logger:C}),logger:C}),W=I.child("spawn"),Y=HV({loadTransactionMeta:jV({fetch:x,GRAPHQL_URL:M,logger:W}),validateScheduler:B,deployProcess:oIt({fetch:x,MU_URL:S,logger:W}),logger:W}),U=I.child("monitor"),q=RIt({deployMonitor:sIt({fetch:x,MU_URL:S,logger:U}),logger:U}),G=I.child("unmonitor"),h=IIt({deployUnmonitor:fIt({fetch:x,MU_URL:S,logger:G}),logger:U}),t=I.child("results"),n=kIt({queryResults:dIt({fetch:x,CU_URL:_,logger:t}),logger:t}),s=I.child("dryrun"),u=TIt({dryrunFetch:uIt({fetch:x,CU_URL:_,logger:s}),logger:s}),d=I.child("assign"),v=BIt({deployAssign:hIt({fetch:x,MU_URL:S,logger:d}),logger:C});return{MODE:g,result:O,results:n,message:K,spawn:Y,monitor:q,unmonitor:h,dryrun:u,assign:v,createDataItemSigner:r}}function c({MODE:g,wallet:M,GRAPHQL_URL:y,AO_URL:w=cbe,fetch:S=c6}){let _=a.child("mainnet");if(_("Mode Activated \u{1F432}"),!M)throw new Error("mainnet mode requires providing a wallet to connect()");let x=e(M),A=()=>r(M);async function I(Y){return _('Mock validation for address "%s"',Y),!0}let B=_.child("result"),P=zV({loadResult:d6e({fetch:c6,logger:B,HB_URL:w,signer:x}),logger:B}),O=_.child("message"),C=FV({deployMessage:l6e({fetch:c6,logger:O,HB_URL:w,signer:x}),logger:O}),K=_.child("spawn"),W=HV({loadTransactionMeta:jV({fetch:S,GRAPHQL_URL:y,logger:K}),validateScheduler:I,deployProcess:u6e({fetch:c6,logger:K,HB_URL:w,signer:x}),logger:K});return{MODE:g,result:P,message:C,spawn:W,createDataItemSigner:A}}function b(g={}){let{GRAPHQL_URL:M,GATEWAY_URL:y=hbe,...w}=g;M||(M=c$t({url:y,path:"/graphql"}));let S=g.MODE||"legacy";if(S==="legacy")return i({...w,GRAPHQL_URL:M});if(S==="relay")return l({...w,GRAPHQL_URL:M});if(S==="mainnet")return c({...w,GRAPHQL_URL:M});throw new Error(`Unrecognized MODE: ${S}`)}return b}var Lrt={};sB(Lrt,{createDataItemSigner:()=>Fbe,createHbSigner:()=>Hbe});var _nt=fB(OIt(),1),M$t={};sB(M$t,{AVSCTap:()=>cw,ArweaveSigner:()=>Ent,DataItem:()=>rw,MAX_TAG_BYTES:()=>OB,MIN_BINARY_SIZE:()=>Int,SIG_CONFIG:()=>P3,SignatureConfig:()=>vu,Signer:()=>E$t,createData:()=>k$t,default:()=>$be,deserializeTags:()=>aB,indexToType:()=>Ant,serializeTags:()=>Rnt,tagsExceedLimit:()=>I$t,warparbundles:()=>qbe});var bbe=Object.create,Snt=Object.defineProperty,gbe=Object.getOwnPropertyDescriptor,ybe=Object.getOwnPropertyNames,wbe=Object.getPrototypeOf,Mbe=Object.prototype.hasOwnProperty,w1=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),_be=(r,e)=>{for(var a in e)Snt(r,a,{get:e[a],enumerable:!0})},Sbe=(r,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ybe(e))!Mbe.call(r,i)&&i!==a&&Snt(r,i,{get:()=>e[i],enumerable:!(l=gbe(e,i))||l.enumerable});return r},j6=(r,e,a)=>(a=r!=null?bbe(wbe(r)):{},Sbe(e||!r||!r.__esModule?Snt(a,"default",{value:r,enumerable:!0}):a,r)),xbe=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});function e(a){var l=4,i=a.length,c=i%l;if(!c)return a;var b=i,g=l-c,M=i+g,y=zt.alloc(M);for(y.write(a);g--;)y.write("=",b++);return y.toString()}r.default=e}),Ebe=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=xbe();function a(M,y){return y===void 0&&(y="utf8"),zt.isBuffer(M)?c(M.toString("base64")):c(zt.from(M,y).toString("base64"))}function l(M,y){return y===void 0&&(y="utf8"),zt.from(i(M),"base64").toString(y)}function i(M){return M=M.toString(),e.default(M).replace(/\-/g,"+").replace(/_/g,"/")}function c(M){return M.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function b(M){return zt.from(i(M),"base64")}var g=a;g.encode=a,g.decode=l,g.toBase64=i,g.fromBase64=c,g.toBuffer=b,r.default=g}),xnt=w1((r,e)=>{e.exports=Ebe().default,e.exports.default=e.exports}),_$t=w1(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,Y;for(Y=0;Y<W;Y+=4)I=a[A.charCodeAt(Y)]<<18|a[A.charCodeAt(Y+1)]<<12|a[A.charCodeAt(Y+2)]<<6|a[A.charCodeAt(Y+3)],C[K++]=I>>16&255,C[K++]=I>>8&255,C[K++]=I&255;return O===2&&(I=a[A.charCodeAt(Y)]<<2|a[A.charCodeAt(Y+1)]>>4,C[K++]=I&255),O===1&&(I=a[A.charCodeAt(Y)]<<10|a[A.charCodeAt(Y+1)]<<4|a[A.charCodeAt(Y+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("")}}),S$t=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.b64UrlDecode=r.b64UrlEncode=r.bufferTob64Url=r.bufferTob64=r.b64UrlToBuffer=r.stringToB64Url=r.stringToBuffer=r.bufferToString=r.b64UrlToString=r.concatBuffers=void 0;var e=_$t();function a(_){let x=0;for(let B=0;B<_.length;B++)x+=_[B].byteLength;let A=new Uint8Array(x),I=0;A.set(new Uint8Array(_[0]),I),I+=_[0].byteLength;for(let B=1;B<_.length;B++)A.set(new Uint8Array(_[B]),I),I+=_[B].byteLength;return A}r.concatBuffers=a;function l(_){let x=g(_);return i(x)}r.b64UrlToString=l;function i(_){return new TextDecoder("utf-8",{fatal:!0}).decode(_)}r.bufferToString=i;function c(_){return new TextEncoder().encode(_)}r.stringToBuffer=c;function b(_){return y(c(_))}r.stringToB64Url=b;function g(_){return new Uint8Array(e.toByteArray(S(_)))}r.b64UrlToBuffer=g;function M(_){return e.fromByteArray(new Uint8Array(_))}r.bufferTob64=M;function y(_){return w(M(_))}r.bufferTob64Url=y;function w(_){return _.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}r.b64UrlEncode=w;function S(_){_=_.replace(/\-/g,"+").replace(/\_/g,"/");let x;return _.length%4==0?x=0:x=4-_.length%4,_.concat("=".repeat(x))}r.b64UrlDecode=S}),Abe=w1(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=S$t(),a=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let l=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",l.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(l,i,{saltLength:c}={}){let b=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(l),i);return new Uint8Array(b)}async hash(l,i="SHA-256"){let c=await this.driver.digest(i,l);return new Uint8Array(c)}async verify(l,i,c){let b={kty:"RSA",e:"AQAB",n:l},g=await this.jwkToPublicCryptoKey(b),M=await this.driver.digest("SHA-256",i),y=await this.driver.verify({name:"RSA-PSS",saltLength:0},g,c,i),w=await this.driver.verify({name:"RSA-PSS",saltLength:32},g,c,i),S=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((g.algorithm.modulusLength-1)/8)-M.byteLength-2},g,c,i);return y||w||S}async jwkToCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let l=crypto?.subtle;return l===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof l[i]=="function")}async encrypt(l,i,c){let b=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),g=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},b,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),M=new Uint8Array(16);crypto.getRandomValues(M);let y=await this.driver.encrypt({name:"AES-CBC",iv:M},g,l);return e.concatBuffers([M,y])}async decrypt(l,i,c){let b=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),g=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},b,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),M=l.slice(0,16),y=await this.driver.decrypt({name:"AES-CBC",iv:M},g,l.slice(16));return e.concatBuffers([y])}};r.default=a}),Rbe=w1(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}}),Drt=w1(r=>{"use strict";var e=_$t(),a=Rbe(),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 Y(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 Y(this,T,N,D,!0)},g.prototype.lastIndexOf=function(T,N,D){return Y(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 G(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 G(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)&&J(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)&&J(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)&&J(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)&&J(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 V(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 V(this,T,N,!0,D)},g.prototype.writeDoubleBE=function(T,N,D){return V(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)&&J(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 J(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")}}),Ibe=w1((r,e)=>{typeof window<"u"?(window.global=window,globalThis.fetch=window.fetch,e.exports={Buffer:Drt().Buffer,Crypto:window.crypto}):e.exports={Buffer:Drt().Buffer,Crypto:crypto}}),x$t={};_be(x$t,{AVSCTap:()=>cw,ArweaveSigner:()=>Ent,DataItem:()=>rw,MAX_TAG_BYTES:()=>OB,MIN_BINARY_SIZE:()=>Int,SIG_CONFIG:()=>P3,SignatureConfig:()=>vu,Signer:()=>E$t,createData:()=>k$t,deserializeTags:()=>aB,indexToType:()=>Ant,serializeTags:()=>Rnt,tagsExceedLimit:()=>I$t});var E$t=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(r,e,a,l){throw new Error("You must implement verify method on child")}},kbe=j6(xnt(),1),wl=j6(S$t(),1);async function A$t(r){if(Array.isArray(r)){let i=(0,wl.concatBuffers)([(0,wl.stringToBuffer)("list"),(0,wl.stringToBuffer)(r.length.toString())]);return await R$t(r,await p1().hash(i,"SHA-384"))}let e=r,a=(0,wl.concatBuffers)([(0,wl.stringToBuffer)("blob"),(0,wl.stringToBuffer)(e.byteLength.toString())]),l=(0,wl.concatBuffers)([await p1().hash(a,"SHA-384"),await p1().hash(e,"SHA-384")]);return await p1().hash(l,"SHA-384")}async function R$t(r,e){if(r.length<1)return e;let a=(0,wl.concatBuffers)([e,await A$t(r[0])]),l=await p1().hash(a,"SHA-384");return await R$t(r.slice(1),l)}var KV=j6(Abe(),1),Tbe=KV.default.default?KV.default.default:KV.default,Bbe=class extends Tbe{getPublicKey(r){throw new Error("Unimplemented")}},Pbe;function p1(){return Pbe??=new Bbe}var vu;(function(r){r[r.ARWEAVE=1]="ARWEAVE",r[r.ED25519=2]="ED25519",r[r.ETHEREUM=3]="ETHEREUM",r[r.SOLANA=4]="SOLANA",r[r.INJECTEDAPTOS=5]="INJECTEDAPTOS",r[r.MULTIAPTOS=6]="MULTIAPTOS",r[r.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(vu||(vu={}));var P3={[vu.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[vu.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[vu.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[vu.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[vu.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[vu.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[vu.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},Ent=class{signatureType=1;ownerLength=P3[1].pubLength;signatureLength=P3[1].sigLength;jwk;pk;constructor(r){this.pk=r.n,this.jwk=r}get publicKey(){return kbe.default.toBuffer(this.pk)}sign(r){return p1().sign(this.jwk,r)}static async verify(r,e,a){return await p1().verify(r,e,a)}},Ant={1:Ent},kd=j6(xnt(),1);async function $rt(r){return A$t([(0,wl.stringToBuffer)("dataitem"),(0,wl.stringToBuffer)("1"),(0,wl.stringToBuffer)(r.signatureType.toString()),r.rawOwner,r.rawTarget,r.rawAnchor,r.rawTags,r.rawData])}async function Nbe(r,e){let a=await $rt(r),l=await e.sign(a),i=await p1().hash(l);return{signature:zt.from(l),id:zt.from(i)}}async function Obe(r,e){let{signature:a,id:l}=await Nbe(r,e);return r.getRaw().set(a,2),l}var cw=class{buf;pos;constructor(r=zt.alloc(OB),e=0){this.buf=r,this.pos=e}writeTags(r){if(!Array.isArray(r))throw new Error("input must be array");let e=r.length,a;if(e)for(this.writeLong(e),a=0;a<e;a++){let l=r[a];if(l?.name===void 0||l?.value===void 0)throw new Error(`Invalid tag format for ${l}, expected {name:string, value: string}`);this.writeString(l.name),this.writeString(l.value)}this.writeLong(0)}toBuffer(){let r=zt.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(r,0,0,this.pos),r}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(r){let e=this.buf,a,l;if(r>=-1073741824&&r<1073741824){l=r>=0?r<<1:~r<<1|1;do e[this.pos]=l&127,l>>=7;while(l&&(e[this.pos++]|=128))}else{a=r>=0?r*2:-r*2-1;do e[this.pos]=a&127,a/=128;while(a>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(r){let e=zt.byteLength(r),a=this.buf;this.writeLong(e);let l=this.pos;if(this.pos+=e,!(this.pos>a.length)){if(e>64)this.buf.write(r,this.pos-e,e,"utf8");else{let i,c,b,g;for(i=0,c=e;i<c;i++)b=r.charCodeAt(i),b<128?a[l++]=b:b<2048?(a[l++]=b>>6|192,a[l++]=b&63|128):(b&64512)===55296&&((g=r.charCodeAt(i+1))&64512)===56320?(b=65536+((b&1023)<<10)+(g&1023),i++,a[l++]=b>>18|240,a[l++]=b>>12&63|128,a[l++]=b>>6&63|128,a[l++]=b&63|128):(a[l++]=b>>12|224,a[l++]=b>>6&63|128,a[l++]=b&63|128)}this.buf=a}}readLong(){let r=0,e=0,a=this.buf,l,i,c,b;do l=a[this.pos++],i=l&128,r|=(l&127)<<e,e+=7;while(i&&e<28);if(i){c=r,b=268435456;do l=a[this.pos++],c+=(l&127)*b,b*=128;while(l&128);return(c%2?-(c+1):c)/2}return r>>1^-(r&1)}skipLong(){let r=this.buf;for(;r[this.pos++]&128;);}readTags(){let r=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let a=this.readString(),l=this.readString();r.push({name:a,value:l})}return r}readString(){let r=this.readLong(),e=this.pos,a=this.buf;if(this.pos+=r,!(this.pos>a.length))return this.buf.slice(e,e+r).toString()}};function Rnt(r){let e=new cw;return e.writeTags(r),e.toBuffer()}function I$t(r){let e=new cw;return e.writeTags(r),e.tagsExceedLimit()}function aB(r){return new cw(r).readTags()}function um(r){let e=0;for(let a=r.length-1;a>=0;a--)e=e*256+r[a];return e}function Cbe(r){if(r>29)throw new Error("Short too long");let e=[0,0];for(let a=0;a<e.length;a++){let l=r&255;e[a]=l,r=(r-l)/256}return Uint8Array.from(e)}function PIt(r){let e=[0,0,0,0,0,0,0,0];for(let a=0;a<e.length;a++){let l=r&255;e[a]=l,r=(r-l)/256}return Uint8Array.from(e)}var Lbe=j6(Ibe(),1),r3=j6(Drt(),1),OB=4096,Int=80,rw=class{binary;_id;constructor(r){this.binary=r}static isDataItem(r){return r.binary!==void 0}get signatureType(){let r=um(this.binary.subarray(0,2));if(vu?.[r]!==void 0)return r;throw new Error("Unknown signature type: "+r)}async isValid(){return rw.verify(this.binary)}get id(){return(async()=>kd.default.encode(await this.rawId))()}set id(r){this._id=kd.default.toBuffer(r)}get rawId(){return(async()=>r3.Buffer.from(await Lbe.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(r){this._id=r}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return kd.default.encode(this.rawSignature)}set rawOwner(r){if(r.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${r.byteLength} bytes.`);this.binary.set(r,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return P3[this.signatureType].sigLength}get owner(){return kd.default.encode(this.rawOwner)}get ownerLength(){return P3[this.signatureType].pubLength}get rawTarget(){let r=this.getTargetStart();return this.binary[r]==1?this.binary.subarray(r+1,r+33):r3.Buffer.alloc(0)}get target(){return kd.default.encode(this.rawTarget)}get rawAnchor(){let r=this.getAnchorStart();return this.binary[r]==1?this.binary.subarray(r+1,r+33):r3.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let r=this.getTagsStart(),e=um(this.binary.subarray(r+8,r+16));return this.binary.subarray(r+16,r+16+e)}get tags(){let r=this.getTagsStart();if(um(this.binary.subarray(r,r+8))==0)return[];let e=um(this.binary.subarray(r+8,r+16));return aB(r3.Buffer.from(this.binary.subarray(r+16,r+16+e)))}get tagsB64Url(){return this.tags.map(r=>({name:kd.default.encode(r.name),value:kd.default.encode(r.value)}))}getStartOfData(){let r=this.getTagsStart(),e=this.binary.subarray(r+8,r+16),a=um(e);return r+16+a}get rawData(){let r=this.getTagsStart(),e=this.binary.subarray(r+8,r+16),a=um(e),l=r+16+a;return this.binary.subarray(l,this.binary.length)}get data(){return kd.default.encode(this.rawData)}getRaw(){return this.binary}async sign(r){return this._id=await Obe(this,r),this.rawId}async setSignature(r){this.binary.set(r,2),this._id=r3.Buffer.from(await p1().hash(r))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(r=>({name:kd.default.encode(r.name),value:kd.default.encode(r.value)})),data:this.data}}static async verify(r){if(r.byteLength<Int)return!1;let e=new rw(r),a=e.signatureType,l=e.getTagsStart(),i=um(r.subarray(l,l+8)),c=r.subarray(l+8,l+16),b=um(c);if(b>OB)return!1;if(i>0)try{if(aB(r3.Buffer.from(r.subarray(l+16,l+16+b))).length!==i)return!1}catch{return!1}let g=Ant[a],M=await $rt(e);return await g.verify(e.rawOwner,M,e.rawSignature)}async getSignatureData(){return $rt(this)}getTagsStart(){let r=this.getTargetStart(),e=this.binary[r]==1,a=r+(e?33:1),l=this.binary[a]==1;return a+=l?33:1,a}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let r=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return r+=e?32:0,r}},Dbe=j6(xnt(),1);function k$t(r,e,a){let l=e.publicKey,i=a?.target?Dbe.default.toBuffer(a.target):null,c=1+(i?.byteLength??0),b=a?.anchor?zt.from(a.anchor):null,g=1+(b?.byteLength??0),M=(a?.tags?.length??0)>0?Rnt(a.tags):null,y=16+(M?M.byteLength:0),w=zt.from(r),S=w.byteLength,_=2+e.signatureLength+e.ownerLength+c+g+y+S,x=zt.alloc(_);if(x.set(Cbe(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(PIt(a?.tags?.length??0),B);let P=PIt(M?.byteLength??0);x.set(P,B+8),M&&x.set(M,B+16);let O=B+y;return x.set(w,O),new rw(x)}var knt={...x$t};globalThis.arbundles??=knt;var $be=knt,qbe=knt,Ube=fB(dce(),1);globalThis.Buffer||(globalThis.Buffer=_nt.Buffer);var{DataItem:jbe}=M$t,{signMessage:zbe}=Ube.httpbis;function Fbe(r){return async({data:e,tags:a,target:l,anchor:i,createDataItem:c=b=>new jbe(b)})=>{let b=await r.signDataItem({data:e,tags:a,target:l,anchor:i}),g=c(_nt.Buffer.from(b));return{id:await g.id,raw:await g.getRaw()}}}function Hbe(r){let e=["alg","keyid"].sort(),a;return async({fields:l,request:i})=>new Promise(c=>(a||(a=r.connect(["ACCESS_ADDRESS","ACCESS_PUBLIC_KEY","SIGNATURE"]).then(async()=>{let b=await r.getActivePublicKey(),g=await r.getActiveAddress();return{publicKey:b,address:g}})),c(a))).then(({publicKey:c,address:b})=>zbe({key:{id:c,alg:"rsa-pss-sha512",sign:async g=>{let M=await r.signMessage(g,{hashAlgorithm:"SHA-512"});return _nt.Buffer.from(M)}},fields:l,name:h6e(b),params:e},i))}var Kbe=globalThis.GATEWAY_URL||void 0,Zbe=globalThis.MU_URL||void 0,Wbe=globalThis.CU_URL||void 0,Vbe=globalThis.GRAPHQL_URL||void 0,Gbe=globalThis.GRAPHQL_MAX_RETRIES||void 0,Jbe=globalThis.GRAPHQL_RETRY_BACKOFF||void 0,Ybe=globalThis.RELAY_URL||void 0,Xbe=globalThis.AO_URL=void 0,Fh=vbe({createDataItemSigner:Lrt.createDataItemSigner,createHbSigner:Lrt.createHbSigner}),{result:T$e,results:B$e,message:P$e,spawn:N$e,monitor:O$e,unmonitor:C$e,dryrun:L$e,assign:D$e,createDataItemSigner:T$t}=Fh({MODE:"legacy",GATEWAY_URL:Kbe,MU_URL:Zbe,CU_URL:Wbe,RELAY_URL:Ybe,AO_URL:Xbe,GRAPHQL_URL:Vbe,GRAPHQL_MAX_RETRIES:Gbe,GRAPHQL_RETRY_BACKOFF:Jbe,noLog:!0});Et();Rt();At();Et();Rt();At();Et();Rt();At();var Il=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},B$t=class extends Il{},P$t=class extends Il{},N$t=class extends Il{constructor(e,a){super(`Failed request: ${e}: ${a}`)}},O$t=class extends Il{},CB=class extends Il{},C$t=class extends Il{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Wd=class extends Il{constructor(){super("Invalid contract configuration")}},L$t=class extends Il{constructor(){super("Invalid process configuration")}},D$t=class extends Il{};Et();Rt();At();var $$t=class{logger;winston;constructor({level:e="info"}={}){try{this.winston=JUt("winston")}catch{throw new Error("Winston is not installed. Install it with: npm install winston")}this.logger=this.winston.createLogger({level:e==="none"?"error":e,silent:e==="none",defaultMeta:{name:"ar-io-sdk",version:Kp},format:this.winston.format.combine(this.winston.format.timestamp(),this.winston.format.json()),transports:[new this.winston.transports.Console({format:this.winston.format.combine(this.winston.format.timestamp(),this.winston.format.json())})]})}info(e,...a){this.logger.info(e,...a)}warn(e,...a){this.logger.warn(e,...a)}error(e,...a){this.logger.error(e,...a)}debug(e,...a){this.logger.debug(e,...a)}setLogLevel(e){e==="none"?this.logger.silent=!0:(this.logger.silent=!1,this.logger.level=e)}};Et();Rt();At();Et();Rt();At();var Tnt=r=>{let e=Object.entries(r).sort(([a,l],[i,c])=>a==="@"?-1:i==="@"?1:"priority"in l&&!("priority"in c)?-1:!("priority"in l)&&"priority"in c?1:l.priority!==void 0&&c.priority!==void 0?l.priority===c.priority?a<i?-1:a>i?1:0:l.priority-c.priority:a<i?-1:a>i?1:0);return Object.fromEntries(e.map(([a,l],i)=>[a,{...l,index:i}]))},q$t=r=>"name"in r&&"ticker"in r&&"description"in r&&"keywords"in r&&"denomination"in r&&"owner"in r&&"controllers"in r&&"records"in r&&"balances"in r&&"logo"in r&&"totalsupply"in r&&"initialized"in r,U$t=r=>{function e(l){return Object.fromEntries(Object.entries(l).map(([i,c])=>i.toLowerCase().includes("balances")?[i.toLowerCase(),c]:typeof c=="object"&&!Array.isArray(c)&&c!==null?[i.toLowerCase(),e(c)]:[i.toLowerCase(),c]))}let a=e(r);return{Name:a.name,Ticker:a.ticker,Description:a.description,Keywords:a.keywords,Denomination:parseInt(a.denomination),Owner:a.owner,Controllers:a.controllers,Records:Object.entries(a.records).reduce((l,[i,c])=>(l[i]={transactionId:c.transactionid,ttlSeconds:c.ttlseconds,...c.priority!==void 0?{priority:c.priority}:{}},l),{}),Balances:a.balances,Logo:a.logo,TotalSupply:a.totalsupply||1,Initialized:a.initialized}};Et();Rt();At();function Vd(r,e){let a=r.safeParse(e);if(!a.success)throw new Error(JSON.stringify(a.error.format(),null,2));return a}Et();Rt();At();Et();Rt();At();Et();Rt();At();rd();var j$t="+",z$t="/",F$t="-",H$t="_",K$t="=";function Qbe(r){let e=r.length%4;return e&&(r+=K$t.repeat(4-e)),r.replaceAll(F$t,j$t).replaceAll(H$t,z$t)}function tge(r){return r.replaceAll(j$t,F$t).replaceAll(z$t,H$t).replaceAll(K$t,"")}function PUe(r){let e=Qbe(r);return zt.from(e,"base64")}function z6(r){let e=r.toString("base64");return tge(e)}function NUe(r){return z6(Zu("sha256").update(Uint8Array.from(r)).digest())}function Z$t(r=32){let e=oz(r);return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("").slice(0,r)}Et();Rt();At();Et();Rt();At();function Bnt(r){try{return JSON.parse(r)}catch{return r}}Et();Rt();At();Et();Rt();At();var Nnt=Rn(V$t(),1);Et();Rt();At();var ige=Object.defineProperty,nge=(r,e,a)=>e in r?ige(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,mw=(r,e,a)=>(nge(r,typeof e!="symbol"?e+"":e,a),a),Ont=class{constructor(e){mw(this,"value"),mw(this,"next"),this.value=e}},Cnt=class{constructor(){mw(this,"head"),mw(this,"tail"),mw(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let a=new Ont(e);return this.head&&this.tail?(this.tail.next=a,this.tail=a):(this.head=a,this.tail=a),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function G$t(r){if(!((Number.isInteger(r)||r===1/0)&&r>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new Cnt,a=0,l=()=>{a--,e.size>0&&e.pop()()},i=async(g,M,y)=>{a++;let w=(async()=>g(...y))();M(w);try{await w}catch{}l()},c=(g,M,y)=>{e.push(i.bind(null,g,M,y)),(async()=>(await Promise.resolve(),a<r&&e.size>0&&e.pop()()))()},b=(g,...M)=>new Promise(y=>{c(g,y,M)});return Object.defineProperties(b,{activeCount:{get:()=>a},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),b}Et();Rt();At();Et();Rt();At();var zqt=Rn(jqt(),1),KB=zqt.default.init({host:"arweave.net",port:443,protocol:"https"});Et();Rt();At();var x3e="https://faucet.ario.permaweb.services";function dat({arioInstance:r,faucetApiUrl:e=x3e}){let a=new lat({faucetUrl:e,processId:r.process.processId});return new Proxy(r,{get(i,c){if(c==="faucet")return a;if(c in i){let b=i[c];return typeof b=="function"?b.bind(i):b}}})}var lat=class{faucetUrl;processId;constructor({faucetUrl:e,processId:a}){this.faucetUrl=e,this.processId=a}async captchaUrl(){let e=await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`,{method:"GET"});if(!e.ok){let l=await e.json().catch(()=>({error:e.statusText}));throw new Error(l.error)}return await e.json()}async claimWithCaptchaResponse({captchaResponse:e,recipient:a,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,recipient:a,quantity:l,captchaResponse:e})});if(!i.ok){let b=await i.json().catch(()=>({error:i.statusText}));throw new Error(b.error)}return await i.json()}async requestAuthToken({captchaResponse:e}){let a=await fetch(`${this.faucetUrl}/api/captcha/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,captchaResponse:e})});if(!a.ok){let i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error)}return await a.json()}async claimWithAuthToken({authToken:e,recipient:a,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/async`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({recipient:a,qty:l,processId:this.processId})});if(!i.ok){let b=await i.json().catch(()=>({error:i.statusText}));throw new Error(b.error)}return await i.json()}async verifyAuthToken({authToken:e}){let a=await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!a.ok){let i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error)}return await a.json()}};Et();Rt();At();var ZB=class{url;processId;isHyperBeamCompatible;checkHyperBeamPromise;logger;hbTimeoutMs;constructor(e){this.url=e.url,this.processId=e.processId,this.logger=e.logger??xa.default,this.hbTimeoutMs=e.hbTimeoutMs??5e3,this.isHyperBeamCompatible=void 0,this.checkHyperBeamPromise=this.checkHyperBeamCompatibility()}async meta(){let e=new URL(`${this.url}/${this.processId}~process@1.0/meta`);return this.fetchHyperbeamPath({path:e.toString()})}async now({path:e,json:a=!1}){return this.fetchHyperbeamPath({path:`${this.url}/${this.processId}~process@1.0/now/${e}`,json:a})}async compute({path:e,json:a=!0}){return this.fetchHyperbeamPath({path:`${this.url}/${this.processId}~process@1.0/compute/${e}`,json:a})}async checkHyperBeamCompatibility({minSlot:e}={}){if(e!==void 0&&(this.isHyperBeamCompatible=void 0,this.checkHyperBeamPromise=void 0),this.checkHyperBeamPromise!==void 0)return this.checkHyperBeamPromise;if(this.isHyperBeamCompatible!==void 0)return Promise.resolve(this.isHyperBeamCompatible);let a=fetch(`${this.url.toString()}/${this.processId}~process@1.0/now`,{method:"HEAD",signal:AbortSignal.timeout(this.hbTimeoutMs)}).then(async l=>{if(l.ok){if(e!==void 0){let i=await this.compute({path:"at-slot",json:!1});if(Number(i)<e)return!1}return this.isHyperBeamCompatible=!0,!0}return this.isHyperBeamCompatible=!1,!1}).catch(l=>(this.logger.error("Failed to check HyperBeam compatibility",{cause:l}),this.isHyperBeamCompatible=!1,!1));return this.checkHyperBeamPromise=a,a}async fetchHyperbeamPath({path:e,json:a=!0}){try{let l=new URL(e);if(a){this.logger.debug("Fetching path as JSON",{path:e}),l.searchParams.set("require-codec","application/json"),l.searchParams.set("accept-bundle","true");let i=await fetch(l);if(!i.ok)throw new Error(`Failed to fetch path as JSON: ${i.statusText}`);let c=await i.json().then(b=>b).catch(b=>{throw this.logger.error("Failed to parse JSON",{cause:b}),new Error(`Received response but failed to parse JSON: ${b.message}`)});if(typeof c!="object"||c===null||!("body"in c))throw new Error("Response body missing in JSON response");return c.body}else{this.logger.debug("Fetching path as text",{path:e});let i=await fetch(l);if(!i.ok)throw new Error(`Failed to fetch path: ${i.statusText}`);return await i.text()}}catch(l){throw this.logger.error("Failed to fetch path as JSON",{cause:l}),l}}};Et();Rt();At();Et();Rt();At();Et();Rt();At();var Ls=[];for(let r=0;r<256;++r)Ls.push((r+256).toString(16).slice(1));function Fqt(r,e=0){return(Ls[r[e+0]]+Ls[r[e+1]]+Ls[r[e+2]]+Ls[r[e+3]]+"-"+Ls[r[e+4]]+Ls[r[e+5]]+"-"+Ls[r[e+6]]+Ls[r[e+7]]+"-"+Ls[r[e+8]]+Ls[r[e+9]]+"-"+Ls[r[e+10]]+Ls[r[e+11]]+Ls[r[e+12]]+Ls[r[e+13]]+Ls[r[e+14]]+Ls[r[e+15]]).toLowerCase()}Et();Rt();At();var cat,E3e=new Uint8Array(16);function pat(){if(!cat){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");cat=crypto.getRandomValues.bind(crypto)}return cat(E3e)}Et();Rt();At();Et();Rt();At();var A3e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mat={randomUUID:A3e};function R3e(r,e,a){if(mat.randomUUID&&!e&&!r)return mat.randomUUID();r=r||{};let l=r.random??r.rng?.()??pat();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,e){if(a=a||0,a<0||a+16>e.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[a+i]=l[i];return e}return Fqt(l)}var vat=R3e;Et();Rt();At();var bat=class r{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new r(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new r(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},gat=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMARIO(){return new Ew(Math.floor(this.value*EZ))}toString(){return`${this.value}`}},Ew=class r extends bat{constructor(e){super(e)}multiply(e){let a=Math.floor(this.valueOf()*e.valueOf());return new r(a)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let a=Math.floor(this.valueOf()/e.valueOf());return new r(a)}plus(e){let a=super.plus(e);return new r(a.valueOf())}minus(e){let a=super.minus(e);return new r(a.valueOf())}toARIO(){return new gat(this.valueOf()/EZ)}};Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();function Aw(r,e){return function(){return r.apply(e,arguments)}}var{toString:I3e}=Object.prototype,{getPrototypeOf:wat}=Object,{iterator:VB,toStringTag:Kqt}=Symbol,GB=(r=>e=>{let a=I3e.call(e);return r[a]||(r[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),Pl=r=>(r=r.toLowerCase(),e=>GB(e)===r),JB=r=>e=>typeof e===r,{isArray:H3}=Array,F3=JB("undefined");function Rw(r){return r!==null&&!F3(r)&&r.constructor!==null&&!F3(r.constructor)&&ih(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}var Zqt=Pl("ArrayBuffer");function k3e(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Zqt(r.buffer),e}var T3e=JB("string"),ih=JB("function"),Wqt=JB("number"),Iw=r=>r!==null&&typeof r=="object",B3e=r=>r===!0||r===!1,WB=r=>{if(GB(r)!=="object")return!1;let e=wat(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Kqt in r)&&!(VB in r)},P3e=r=>{if(!Iw(r)||Rw(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},N3e=Pl("Date"),O3e=Pl("File"),C3e=Pl("Blob"),L3e=Pl("FileList"),D3e=r=>Iw(r)&&ih(r.pipe),$3e=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||ih(r.append)&&((e=GB(r))==="formdata"||e==="object"&&ih(r.toString)&&r.toString()==="[object FormData]"))},q3e=Pl("URLSearchParams"),[U3e,j3e,z3e,F3e]=["ReadableStream","Request","Response","Headers"].map(Pl),H3e=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function kw(r,e,{allOwnKeys:a=!1}={}){if(r===null||typeof r>"u")return;let l,i;if(typeof r!="object"&&(r=[r]),H3(r))for(l=0,i=r.length;l<i;l++)e.call(null,r[l],l,r);else{if(Rw(r))return;let c=a?Object.getOwnPropertyNames(r):Object.keys(r),b=c.length,g;for(l=0;l<b;l++)g=c[l],e.call(null,r[g],g,r)}}function Vqt(r,e){if(Rw(r))return null;e=e.toLowerCase();let a=Object.keys(r),l=a.length,i;for(;l-- >0;)if(i=a[l],e===i.toLowerCase())return i;return null}var F6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gqt=r=>!F3(r)&&r!==F6;function yat(){let{caseless:r,skipUndefined:e}=Gqt(this)&&this||{},a={},l=(i,c)=>{let b=r&&Vqt(a,c)||c;WB(a[b])&&WB(i)?a[b]=yat(a[b],i):WB(i)?a[b]=yat({},i):H3(i)?a[b]=i.slice():(!e||!F3(i))&&(a[b]=i)};for(let i=0,c=arguments.length;i<c;i++)arguments[i]&&kw(arguments[i],l);return a}var K3e=(r,e,a,{allOwnKeys:l}={})=>(kw(e,(i,c)=>{a&&ih(i)?r[c]=Aw(i,a):r[c]=i},{allOwnKeys:l}),r),Z3e=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),W3e=(r,e,a,l)=>{r.prototype=Object.create(e.prototype,l),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),a&&Object.assign(r.prototype,a)},V3e=(r,e,a,l)=>{let i,c,b,g={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),c=i.length;c-- >0;)b=i[c],(!l||l(b,r,e))&&!g[b]&&(e[b]=r[b],g[b]=!0);r=a!==!1&&wat(r)}while(r&&(!a||a(r,e))&&r!==Object.prototype);return e},G3e=(r,e,a)=>{r=String(r),(a===void 0||a>r.length)&&(a=r.length),a-=e.length;let l=r.indexOf(e,a);return l!==-1&&l===a},J3e=r=>{if(!r)return null;if(H3(r))return r;let e=r.length;if(!Wqt(e))return null;let a=new Array(e);for(;e-- >0;)a[e]=r[e];return a},Y3e=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&wat(Uint8Array)),X3e=(r,e)=>{let l=(r&&r[VB]).call(r),i;for(;(i=l.next())&&!i.done;){let c=i.value;e.call(r,c[0],c[1])}},Q3e=(r,e)=>{let a,l=[];for(;(a=r.exec(e))!==null;)l.push(a);return l},t8e=Pl("HTMLFormElement"),e8e=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,l,i){return l.toUpperCase()+i}),Hqt=(({hasOwnProperty:r})=>(e,a)=>r.call(e,a))(Object.prototype),r8e=Pl("RegExp"),Jqt=(r,e)=>{let a=Object.getOwnPropertyDescriptors(r),l={};kw(a,(i,c)=>{let b;(b=e(i,c,r))!==!1&&(l[c]=b||i)}),Object.defineProperties(r,l)},i8e=r=>{Jqt(r,(e,a)=>{if(ih(r)&&["arguments","caller","callee"].indexOf(a)!==-1)return!1;let l=r[a];if(ih(l)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},n8e=(r,e)=>{let a={},l=i=>{i.forEach(c=>{a[c]=!0})};return H3(r)?l(r):l(String(r).split(e)),a},a8e=()=>{},o8e=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function s8e(r){return!!(r&&ih(r.append)&&r[Kqt]==="FormData"&&r[VB])}var f8e=r=>{let e=new Array(10),a=(l,i)=>{if(Iw(l)){if(e.indexOf(l)>=0)return;if(Rw(l))return l;if(!("toJSON"in l)){e[i]=l;let c=H3(l)?[]:{};return kw(l,(b,g)=>{let M=a(b,i+1);!F3(M)&&(c[g]=M)}),e[i]=void 0,c}}return l};return a(r,0)},h8e=Pl("AsyncFunction"),u8e=r=>r&&(Iw(r)||ih(r))&&ih(r.then)&&ih(r.catch),Yqt=((r,e)=>r?setImmediate:e?((a,l)=>(F6.addEventListener("message",({source:i,data:c})=>{i===F6&&c===a&&l.length&&l.shift()()},!1),i=>{l.push(i),F6.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",ih(F6.postMessage)),l8e=typeof queueMicrotask<"u"?queueMicrotask.bind(F6):typeof Te<"u"&&Te.nextTick||Yqt,d8e=r=>r!=null&&ih(r[VB]),je={isArray:H3,isArrayBuffer:Zqt,isBuffer:Rw,isFormData:$3e,isArrayBufferView:k3e,isString:T3e,isNumber:Wqt,isBoolean:B3e,isObject:Iw,isPlainObject:WB,isEmptyObject:P3e,isReadableStream:U3e,isRequest:j3e,isResponse:z3e,isHeaders:F3e,isUndefined:F3,isDate:N3e,isFile:O3e,isBlob:C3e,isRegExp:r8e,isFunction:ih,isStream:D3e,isURLSearchParams:q3e,isTypedArray:Y3e,isFileList:L3e,forEach:kw,merge:yat,extend:K3e,trim:H3e,stripBOM:Z3e,inherits:W3e,toFlatObject:V3e,kindOf:GB,kindOfTest:Pl,endsWith:G3e,toArray:J3e,forEachEntry:X3e,matchAll:Q3e,isHTMLForm:t8e,hasOwnProperty:Hqt,hasOwnProp:Hqt,reduceDescriptors:Jqt,freezeMethods:i8e,toObjectSet:n8e,toCamelCase:e8e,noop:a8e,toFiniteNumber:o8e,findKey:Vqt,global:F6,isContextDefined:Gqt,isSpecCompliantForm:s8e,toJSONObject:f8e,isAsyncFn:h8e,isThenable:u8e,setImmediate:Yqt,asap:l8e,isIterable:d8e};Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();function K3(r,e,a,l,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),a&&(this.config=a),l&&(this.request=l),i&&(this.response=i,this.status=i.status?i.status:null)}je.inherits(K3,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});var Xqt=K3.prototype,Qqt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Qqt[r]={value:r}});Object.defineProperties(K3,Qqt);Object.defineProperty(Xqt,"isAxiosError",{value:!0});K3.from=(r,e,a,l,i,c)=>{let b=Object.create(Xqt);je.toFlatObject(r,b,function(w){return w!==Error.prototype},y=>y!=="isAxiosError");let g=r&&r.message?r.message:"Error",M=e==null&&r?r.code:e;return K3.call(b,g,M,a,l,i),r&&b.cause==null&&Object.defineProperty(b,"cause",{value:r,configurable:!0}),b.name=r&&r.name||"Error",c&&Object.assign(b,c),b};var Xr=K3;Et();Rt();At();var YB=null;function Mat(r){return je.isPlainObject(r)||je.isArray(r)}function eUt(r){return je.endsWith(r,"[]")?r.slice(0,-2):r}function tUt(r,e,a){return r?r.concat(e).map(function(i,c){return i=eUt(i),!a&&c?"["+i+"]":i}).join(a?".":""):e}function c8e(r){return je.isArray(r)&&!r.some(Mat)}var p8e=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function m8e(r,e,a){if(!je.isObject(r))throw new TypeError("target must be an object");e=e||new(YB||FormData),a=je.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(I,B){return!je.isUndefined(B[I])});let l=a.metaTokens,i=a.visitor||w,c=a.dots,b=a.indexes,M=(a.Blob||typeof Blob<"u"&&Blob)&&je.isSpecCompliantForm(e);if(!je.isFunction(i))throw new TypeError("visitor must be a function");function y(A){if(A===null)return"";if(je.isDate(A))return A.toISOString();if(je.isBoolean(A))return A.toString();if(!M&&je.isBlob(A))throw new Xr("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(A)||je.isTypedArray(A)?M&&typeof Blob=="function"?new Blob([A]):zt.from(A):A}function w(A,I,B){let P=A;if(A&&!B&&typeof A=="object"){if(je.endsWith(I,"{}"))I=l?I:I.slice(0,-2),A=JSON.stringify(A);else if(je.isArray(A)&&c8e(A)||(je.isFileList(A)||je.endsWith(I,"[]"))&&(P=je.toArray(A)))return I=eUt(I),P.forEach(function(C,K){!(je.isUndefined(C)||C===null)&&e.append(b===!0?tUt([I],K,c):b===null?I:I+"[]",y(C))}),!1}return Mat(A)?!0:(e.append(tUt(B,I,c),y(A)),!1)}let S=[],_=Object.assign(p8e,{defaultVisitor:w,convertValue:y,isVisitable:Mat});function x(A,I){if(!je.isUndefined(A)){if(S.indexOf(A)!==-1)throw Error("Circular reference detected in "+I.join("."));S.push(A),je.forEach(A,function(P,O){(!(je.isUndefined(P)||P===null)&&i.call(e,P,je.isString(O)?O.trim():O,I,_))===!0&&x(P,I?I.concat(O):[O])}),S.pop()}}if(!je.isObject(r))throw new TypeError("data must be an object");return x(r),e}var Km=m8e;function rUt(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(l){return e[l]})}function iUt(r,e){this._pairs=[],r&&Km(r,this,e)}var nUt=iUt.prototype;nUt.append=function(e,a){this._pairs.push([e,a])};nUt.toString=function(e){let a=e?function(l){return e.call(this,l,rUt)}:rUt;return this._pairs.map(function(i){return a(i[0])+"="+a(i[1])},"").join("&")};var XB=iUt;function v8e(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Tw(r,e,a){if(!e)return r;let l=a&&a.encode||v8e;je.isFunction(a)&&(a={serialize:a});let i=a&&a.serialize,c;if(i?c=i(e,a):c=je.isURLSearchParams(e)?e.toString():new XB(e,a).toString(l),c){let b=r.indexOf("#");b!==-1&&(r=r.slice(0,b)),r+=(r.indexOf("?")===-1?"?":"&")+c}return r}Et();Rt();At();var _at=class{constructor(){this.handlers=[]}use(e,a,l){return this.handlers.push({fulfilled:e,rejected:a,synchronous:l?l.synchronous:!1,runWhen:l?l.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(l){l!==null&&e(l)})}},Sat=_at;Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var QB={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};Et();Rt();At();Et();Rt();At();Et();Rt();At();Et();Rt();At();var aUt=typeof URLSearchParams<"u"?URLSearchParams:XB;Et();Rt();At();var oUt=typeof FormData<"u"?FormData:null;Et();Rt();At();var sUt=typeof Blob<"u"?Blob:null;var fUt={isBrowser:!0,classes:{URLSearchParams:aUt,FormData:oUt,Blob:sUt},protocols:["http","https","file","blob","url","data"]};var Aat={};I1(Aat,{hasBrowserEnv:()=>Eat,hasStandardBrowserEnv:()=>b8e,hasStandardBrowserWebWorkerEnv:()=>g8e,navigator:()=>xat,origin:()=>y8e});Et();Rt();At();var Eat=typeof window<"u"&&typeof document<"u",xat=typeof navigator=="object"&&navigator||void 0,b8e=Eat&&(!xat||["ReactNative","NativeScript","NS"].indexOf(xat.product)<0),g8e=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",y8e=Eat&&window.location.href||"http://localhost";var to={...Aat,...fUt};function Rat(r,e){return Km(r,new to.classes.URLSearchParams,{visitor:function(a,l,i,c){return to.isNode&&je.isBuffer(a)?(this.append(l,a.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...e})}Et();Rt();At();function w8e(r){return je.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function M8e(r){let e={},a=Object.keys(r),l,i=a.length,c;for(l=0;l<i;l++)c=a[l],e[c]=r[c];return e}function _8e(r){function e(a,l,i,c){let b=a[c++];if(b==="__proto__")return!0;let g=Number.isFinite(+b),M=c>=a.length;return b=!b&&je.isArray(i)?i.length:b,M?(je.hasOwnProp(i,b)?i[b]=[i[b],l]:i[b]=l,!g):((!i[b]||!je.isObject(i[b]))&&(i[b]=[]),e(a,l,i[b],c)&&je.isArray(i[b])&&(i[b]=M8e(i[b])),!g)}if(je.isFormData(r)&&je.isFunction(r.entries)){let a={};return je.forEachEntry(r,(l,i)=>{e(w8e(l),i,a,0)}),a}return null}var tP=_8e;function S8e(r,e,a){if(je.isString(r))try{return(e||JSON.parse)(r),je.trim(r)}catch(l){if(l.name!=="SyntaxError")throw l}return(a||JSON.stringify)(r)}var Iat={transitional:QB,adapter:["xhr","http","fetch"],transformRequest:[function(e,a){let l=a.getContentType()||"",i=l.indexOf("application/json")>-1,c=je.isObject(e);if(c&&je.isHTMLForm(e)&&(e=new FormData(e)),je.isFormData(e))return i?JSON.stringify(tP(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let g;if(c){if(l.indexOf("application/x-www-form-urlencoded")>-1)return Rat(e,this.formSerializer).toString();if((g=je.isFileList(e))||l.indexOf("multipart/form-data")>-1){let M=this.env&&this.env.FormData;return Km(g?{"files[]":e}:e,M&&new M,this.formSerializer)}}return c||i?(a.setContentType("application/json",!1),S8e(e)):e}],transformResponse:[function(e){let a=this.transitional||Iat.transitional,l=a&&a.forcedJSONParsing,i=this.responseType==="json";if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(l&&!this.responseType||i)){let b=!(a&&a.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(g){if(b)throw g.name==="SyntaxError"?Xr.from(g,Xr.ERR_BAD_RESPONSE,this,null,this.response):g}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:to.classes.FormData,Blob:to.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],r=>{Iat.headers[r]={}});var Z3=Iat;Et();Rt();At();Et();Rt();At();var x8e=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),hUt=r=>{let e={},a,l,i;return r&&r.split(`
|
|
147
147
|
`).forEach(function(b){i=b.indexOf(":"),a=b.substring(0,i).trim().toLowerCase(),l=b.substring(i+1).trim(),!(!a||e[a]&&x8e[a])&&(a==="set-cookie"?e[a]?e[a].push(l):e[a]=[l]:e[a]=e[a]?e[a]+", "+l:l)}),e};var uUt=Symbol("internals");function Bw(r){return r&&String(r).trim().toLowerCase()}function eP(r){return r===!1||r==null?r:je.isArray(r)?r.map(eP):String(r)}function E8e(r){let e=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,l;for(;l=a.exec(r);)e[l[1]]=l[2];return e}var A8e=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function kat(r,e,a,l,i){if(je.isFunction(l))return l.call(this,e,a);if(i&&(e=a),!!je.isString(e)){if(je.isString(l))return e.indexOf(l)!==-1;if(je.isRegExp(l))return l.test(e)}}function R8e(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,a,l)=>a.toUpperCase()+l)}function I8e(r,e){let a=je.toCamelCase(" "+e);["get","set","has"].forEach(l=>{Object.defineProperty(r,l+a,{value:function(i,c,b){return this[l].call(this,e,i,c,b)},configurable:!0})})}var W3=class{constructor(e){e&&this.set(e)}set(e,a,l){let i=this;function c(g,M,y){let w=Bw(M);if(!w)throw new Error("header name must be a non-empty string");let S=je.findKey(i,w);(!S||i[S]===void 0||y===!0||y===void 0&&i[S]!==!1)&&(i[S||M]=eP(g))}let b=(g,M)=>je.forEach(g,(y,w)=>c(y,w,M));if(je.isPlainObject(e)||e instanceof this.constructor)b(e,a);else if(je.isString(e)&&(e=e.trim())&&!A8e(e))b(hUt(e),a);else if(je.isObject(e)&&je.isIterable(e)){let g={},M,y;for(let w of e){if(!je.isArray(w))throw TypeError("Object iterator must return a key-value pair");g[y=w[0]]=(M=g[y])?je.isArray(M)?[...M,w[1]]:[M,w[1]]:w[1]}b(g,a)}else e!=null&&c(a,e,l);return this}get(e,a){if(e=Bw(e),e){let l=je.findKey(this,e);if(l){let i=this[l];if(!a)return i;if(a===!0)return E8e(i);if(je.isFunction(a))return a.call(this,i,l);if(je.isRegExp(a))return a.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,a){if(e=Bw(e),e){let l=je.findKey(this,e);return!!(l&&this[l]!==void 0&&(!a||kat(this,this[l],l,a)))}return!1}delete(e,a){let l=this,i=!1;function c(b){if(b=Bw(b),b){let g=je.findKey(l,b);g&&(!a||kat(l,l[g],g,a))&&(delete l[g],i=!0)}}return je.isArray(e)?e.forEach(c):c(e),i}clear(e){let a=Object.keys(this),l=a.length,i=!1;for(;l--;){let c=a[l];(!e||kat(this,this[c],c,e,!0))&&(delete this[c],i=!0)}return i}normalize(e){let a=this,l={};return je.forEach(this,(i,c)=>{let b=je.findKey(l,c);if(b){a[b]=eP(i),delete a[c];return}let g=e?R8e(c):String(c).trim();g!==c&&delete a[c],a[g]=eP(i),l[g]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let a=Object.create(null);return je.forEach(this,(l,i)=>{l!=null&&l!==!1&&(a[i]=e&&je.isArray(l)?l.join(", "):l)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,a])=>e+": "+a).join(`
|
|
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[uUt]=this[uUt]={accessors:{}}).accessors,i=this.prototype;function c(b){let g=Bw(b);l[g]||(I8e(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 Jo=W3;function Pw(r,e){let a=this||Z3,l=e||a,i=Jo.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 lUt(r,e,a){Xr.call(this,r??"canceled",Xr.ERR_CANCELED,e,a),this.name="CanceledError"}je.inherits(lUt,Xr,{__CANCEL__:!0});var Yd=lUt;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 Tat(r){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}Et();Rt();At();Et();Rt();At();function k8e(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 dUt=k8e;Et();Rt();At();function T8e(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 cUt=T8e;var V3=(r,e,a=3)=>{let l=0,i=dUt(50,250);return cUt(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)},Bat=(r,e)=>{let a=r!=null;return[l=>e[0]({lengthComputable:a,total:r,loaded:l}),e[1]]},Pat=r=>(...e)=>je.asap(()=>r(...e));Et();Rt();At();Et();Rt();At();var pUt=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 mUt=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 Nat(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}Et();Rt();At();function Oat(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Cw(r,e,a){let l=!Nat(e);return r&&(l||a==!1)?Oat(r,e):e}Et();Rt();At();var vUt=r=>r instanceof Jo?{...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(vUt(y),vUt(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 rP=r=>{let e=Nl({},r),{data:a,withXSRFToken:l,xsrfHeaderName:i,xsrfCookieName:c,headers:b,auth:g}=e;if(e.headers=b=Jo.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&&pUt(e.url))){let M=i&&c&&mUt.read(c);M&&b.set(i,M)}return e};var B8e=typeof XMLHttpRequest<"u",bUt=B8e&&function(r){return new Promise(function(a,l){let i=rP(r),c=i.data,b=Jo.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=Jo.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",Y=new Xr(W,Xr.ERR_NETWORK,r,B);Y.event=K||null,l(Y),B=null},B.ontimeout=function(){let K=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",W=i.transitional||QB;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]=V3(y,!0),B.addEventListener("progress",_)),M&&B.upload&&([S,x]=V3(M),B.upload.addEventListener("progress",S),B.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(w=C=>{B&&(l(!C||C.type?new Yd(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=Tat(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 P8e=(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 Yd(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}},gUt=P8e;Et();Rt();At();var N8e=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},O8e=async function*(r,e){for await(let a of C8e(r))yield*N8e(a,e)},C8e=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()}},Cat=(r,e,a,l)=>{let i=O8e(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 yUt=64*1024,{isFunction:iP}=je,SUt=(({fetch:r,Request:e,Response:a})=>({fetch:r,Request:e,Response:a}))(je.global),{ReadableStream:wUt,TextEncoder:MUt}=je.global,_Ut=(r,...e)=>{try{return!!r(...e)}catch{return!1}},L8e=r=>{let{fetch:e,Request:a,Response:l}=Object.assign({},SUt,r),i=iP(e),c=iP(a),b=iP(l);if(!i)return!1;let g=i&&iP(wUt),M=i&&(typeof MUt=="function"?(A=>I=>A.encode(I))(new MUt):async A=>new Uint8Array(await new a(A).arrayBuffer())),y=c&&g&&_Ut(()=>{let A=!1,I=new a(to.origin,{body:new wUt,method:"POST",get duplex(){return A=!0,"half"}}).headers.has("Content-Type");return A&&!I}),w=b&&g&&_Ut(()=>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:Y,responseType:U,headers:q,withCredentials:G="same-origin",fetchOptions:h}=rP(A);U=U?(U+"").toLowerCase():"text";let t=gUt([O,C&&C.toAbortSignal()],K),n=null,s=t&&t.unsubscribe&&(()=>{t.unsubscribe()}),u;try{if(Y&&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]=Bat(u,V3(Pat(Y)));P=Cat(m.body,yUt,R,k)}}je.isString(G)||(G=G?"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?G: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&&Bat(E,V3(Pat(W),!0))||[];p=new l(Cat(p.body,yUt,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:Jo.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)}}},D8e=new Map,Lat=r=>{let e=je.merge.call({skipUndefined:!0},SUt,r?r.env:null),{fetch:a,Request:l,Response:i}=e,c=[l,i,a],b=c.length,g=b,M,y,w=D8e;for(;g--;)M=c[g],y=w.get(M),y===void 0&&w.set(M,y=g?new Map:L8e(e)),w=y;return y},gWe=Lat();var Dat={http:YB,xhr:bUt,fetch:{get:Lat}};je.forEach(Dat,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});var xUt=r=>`- ${r}`,q8e=r=>je.isFunction(r)||r===null||r===!1,nP={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,!q8e(l)&&(i=Dat[(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(xUt).join(`
|
|
150
150
|
`):" "+xUt(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:Dat};function $at(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Yd(null,r)}function aP(r){return $at(r),r.headers=Jo.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),nP.getAdapter(r.adapter||Z3.adapter,r)(r).then(function(l){return $at(r),l.data=Pw.call(r,r.transformResponse,l),l.headers=Jo.from(l.headers),l},function(l){return Nw(l)||($at(r),l&&l.response&&(l.response.data=Pw.call(r,r.transformResponse,l.response),l.response.headers=Jo.from(l.response.headers))),Promise.reject(l)})}Et();Rt();At();Et();Rt();At();var oP="1.12.0";var sP={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{sP[r]=function(l){return typeof l===r||"a"+(e<1?"n ":" ")+r}});var EUt={};sP.transitional=function(e,a,l){function i(c,b){return"[Axios v"+oP+"] 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&&!EUt[b]&&(EUt[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}};sP.spelling=function(e){return(a,l)=>(console.warn(`${l} is likely a misspelling of ${e}`),!0)};function U8e(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:U8e,validators:sP};var Xd=Lw.validators,G3=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Sat,response:new Sat}}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=Jo.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=[aP.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=aP.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){G3.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}))}}G3.prototype[e]=a(),G3.prototype[e+"Form"]=a(!0)});var Dw=G3;Et();Rt();At();var qat=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 Yd(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}}},AUt=qat;Et();Rt();At();function Uat(r){return function(a){return r.apply(null,a)}}Et();Rt();At();function jat(r){return je.isObject(r)&&r.isAxiosError===!0}Et();Rt();At();var zat={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(zat).forEach(([r,e])=>{zat[e]=r});var RUt=zat;function IUt(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 IUt(Nl(r,i))},a}var Bo=IUt(Z3);Bo.Axios=Dw;Bo.CanceledError=Yd;Bo.CancelToken=AUt;Bo.isCancel=Nw;Bo.VERSION=oP;Bo.toFormData=Km;Bo.AxiosError=Xr;Bo.Cancel=Bo.CanceledError;Bo.all=function(e){return Promise.all(e)};Bo.spread=Uat;Bo.isAxiosError=jat;Bo.mergeConfig=Nl;Bo.AxiosHeaders=Jo;Bo.formToJSON=r=>tP(je.isHTMLForm(r)?new FormData(r):r);Bo.getAdapter=nP.getAdapter;Bo.HttpStatusCode=RUt;Bo.default=Bo;var fP=Bo;var{Axios:VVe,AxiosError:GVe,CanceledError:JVe,isCancel:YVe,CancelToken:XVe,VERSION:QVe,all:tGe,Cancel:eGe,isAxiosError:rGe,spread:iGe,toFormData:nGe,AxiosHeaders:aGe,HttpStatusCode:oGe,formToJSON:sGe,getAdapter:fGe,mergeConfig:hGe}=fP;Et();Rt();At();var PUt=Rn(TUt(),1),Fat="axios-retry";function NUt(r){let e=["ERR_CANCELED","ECONNABORTED"];return r.response||!r.code||e.includes(r.code)?!1:(0,PUt.default)(r)}var OUt=["get","head","options"],z8e=OUt.concat(["put","delete"]);function Hat(r){return r.code!=="ECONNABORTED"&&(!r.response||r.response.status===429||r.response.status>=500&&r.response.status<=599)}function F8e(r){return r.config?.method?Hat(r)&&OUt.indexOf(r.config.method)!==-1:!1}function CUt(r){return r.config?.method?Hat(r)&&z8e.indexOf(r.config.method)!==-1:!1}function LUt(r){return NUt(r)||CUt(r)}function Kat(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 H8e(r=0,e=void 0){return Math.max(0,Kat(e))}function K8e(r=0,e=void 0,a=100){let l=2**r*a,i=Math.max(l,Kat(e)),c=i*.2*Math.random();return i+c}function Z8e(r=100){return(e=0,a=void 0)=>{let l=e*r;return Math.max(l,Kat(a))}}var W8e={retries:3,retryCondition:LUt,retryDelay:H8e,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function V8e(r,e){return{...W8e,...e,...r[Fat]}}function BUt(r,e,a=!1){let l=V8e(r,e||{});return l.retryCount=l.retryCount||0,(!l.lastRequestTime||a)&&(l.lastRequestTime=Date.now()),r[Fat]=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 J8e(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 X8e(r,e){r.retryCount>=r.retries&&await r.onMaxRetryTimesExceeded(e,r.retryCount)}var Zm=(r,e)=>{let a=r.interceptors.request.use(i=>(BUt(i,e,!0),i[Fat]?.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=BUt(c,e);return i.response&&b.validateResponse?.(i.response)?i.response:await J8e(b,i)?Y8e(r,b,i,c):(await X8e(b,i),Promise.reject(i))});return{requestInterceptorId:a,responseInterceptorId:l}};Zm.isNetworkError=NUt;Zm.isSafeRequestError=F8e;Zm.isIdempotentRequestError=CUt;Zm.isNetworkOrIdempotentRequestError=LUt;Zm.exponentialDelay=K8e;Zm.linearDelay=Z8e;Zm.isRetryableError=Hat;var hP=Zm;var DUt=({axiosConfig:r={},logger:e=xa.default,retryConfig:a={retries:5,retryDelay:hP.exponentialDelay,retryCondition:l=>hP.isRetryableError(l),onRetry(l,i,c){e.error(`Retrying request ${c.url} attempt ${l}`,i)}}}={})=>{let l=fP.create({...r,maxRedirects:0,headers:{...r.headers,"x-source-version":`${Kp}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return hP(l,a),l};Et();Rt();At();var Zat=({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 Q8e({signer:r,nonce:e=vat()}){let a,l,i=uP(r)?Hr.ARWEAVE:r.signatureType;switch(uP(r)?a=z6(zt.from(await r.signMessage(Uint8Array.from(zt.from(e))))):r instanceof sl?a=z6(zt.from(await r.signer.signMessage(Uint8Array.from(zt.from(e))))):(r instanceof Gu||r instanceof ks||r instanceof fv)&&("setPublicKey"in r&&r.publicKey===void 0&&await r.setPublicKey(),a=z6(zt.from(await r.sign(Uint8Array.from(zt.from(e)))))),i){case Hr.ARWEAVE:uP(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 lP({paymentUrl:l,axios:i,logger:c})}},lP=class{paymentUrl;axios;logger;constructor({paymentUrl:e="https://payment.ardrive.io",axios:a=DUt(),logger:l=xa.default}){this.paymentUrl=e,this.axios=a,this.logger=l}async getArNSPriceDetails({intent:e,name:a,quantity:l,type:i,years:c}){let b=Zat({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 lP{signer;constructor({signer:e,...a}){if(super(a),!Wat(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=Zat({baseUrl:`${this.paymentUrl}/v1/arns/purchase/${e}/${a}`,params:{increaseQty:l,processId:c,type:i,years:b,paidBy:g,referrer:M}}),w=await Q8e({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 uP(r){return typeof r=="object"&&r!==null&&"signMessage"in r&&"getActivePublicKey"in r}function Wat(r){let e=uP(r),a=r instanceof ks||r instanceof fv||r instanceof Gu||r instanceof sl;return e||a}var K6=class{static init(e){return e!==void 0&&"signer"in e?new qw(e):new J3(e)}static mainnet(e){return e!==void 0&&"signer"in e?new qw({...e,process:new bn({processId:ef,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}):new J3({...e,process:new bn({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?dat({arioInstance:new qw({...e,process:new bn({processId:xZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl}):dat({arioInstance:new J3({...e,process:new bn({processId:xZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl})}},J3=class{process;epochSettings;arweave;hyperbeamUrl;paymentProvider;logger=xa.default;hb;constructor(e){if(this.arweave=e?.arweave??KB,e===void 0||Object.keys(e).length===0)this.process=new bn({processId:ef});else if(Gm(e))this.process=e.process;else if(Jm(e))this.process=new bn({processId:e.processId});else throw new Wd;e?.hyperbeamUrl!==void 0&&(this.hyperbeamUrl=e.hyperbeamUrl,this.hb=new ZB({url:this.hyperbeamUrl,processId:this.process.processId}),this.logger.debug(`Using HyperBEAM node for process ${this.process.processId}`,{hyperbeamUrl:this.hyperbeamUrl})),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 qUt(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}){if(this.hb&&await this.hb.checkHyperBeamCompatibility()){this.logger.debug("Getting balance from HyperBEAM",{address:e});let a=await this.hb.compute({path:`balances/${e}`}).then(l=>Number(l)).catch(l=>(this.logger.error("Failed to get balance from HyperBEAM",{cause:l}),null));if(a!==null)return a;this.logger.info("Failed to get balance from HyperBEAM, failing over to to CU read",{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 $Ut(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 bn({ao:this.process.ao,processId:c.processId}),hyperbeamUrl:this.hyperbeamUrl}),[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 bn({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 J3{signer;paymentProvider;constructor({signer:e,paymentUrl:a,...l}){l===void 0?super({process:new bn({processId:ef})}):super(l),this.signer=Vm(e),this.paymentProvider=$w.init({signer:Wat(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 bn({processId:c,ao:this.process.ao}),signer:this.signer,hyperbeamUrl:this.hyperbeamUrl}).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 qYe=async({address:r,registry:e=R1.init()})=>{let a=await e.accessControlList({address:r});return[...new Set([...a.Owned,...a.Controlled])]};function UUt(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 jUt=class extends Nnt.default{contract;timeoutMs;throttle;logger;strict;antAoClient;constructor({contract:e=K6.init({processId:ef}),timeoutMs:a=6e4,concurrency:l=30,logger:i=xa.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 UUt(this.timeoutMs,tye({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 bn({processId:M,ao:this.antAoClient}),strict:this.strict}),S=await UUt(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)}},tye=async({contract:r=K6.init({processId:ef}),emitter:e,logger:a=xa.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 bn=class{logger;ao;processId;constructor({processId:e,ao:a=Fh({MODE:"legacy"}),logger:l=xa.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=dP(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:Bnt(M)}async send({tags:e,data:a,signer:l,retries:i=3}){let c,b=Z$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=dP(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=Bnt(g.Messages[0].Data);return this.logger.debug("Message result data",{resultData:w,messageId:c,processId:this.processId}),{id:c,result:w}}};var Ym=class{static init(e){return e!==void 0&&"signer"in e?new Vat(e):new cP(e)}},cP=class{process;constructor(e){if(e===void 0||Object.keys(e).length===0)this.process=new bn({processId:kh});else if(Gm(e))this.process=e.process;else if(Jm(e))this.process=new bn({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]}}},Vat=class extends cP{signer;constructor({signer:e,...a}){super(a),this.signer=Vm(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 Ym.init()}static spawn=Jat;static fork=zUt;static async upgrade({signer:e,antProcessId:a,reassignAffiliatedNames:l=!0,names:i,arioProcessId:c=ef,antRegistryId:b=kh,ao:g,logger:M=xa.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 bn({processId:c,ao:g}),hyperbeamUrl:S}),I=async()=>{let K,W=!0,Y=new Set;for(;W;){let U=await A.getArNSRecords({filters:{processId:a},cursor:K,limit:100});U.items.forEach(q=>{Y.add(q.name)}),K=U.nextCursor,W=U.hasMore}return Y};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(Y=>!K.has(Y));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 bn({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,hyperbeamUrl:S}),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(Y){M.error(`Failed to reassign name ${K}:`,{error:Y}),w?.("failed-to-reassign-name",{name:K,arioProcessId:c,antProcessId:P,error:Y}),C[K]={id:W?.id,error:Y}}}return{forkedProcessId:P,reassignedNames:O,failedReassignedNames:C}}static init(e){return e!==void 0&&"signer"in e?new Gat(e):new pP(e)}},pP=class{process;processId;hyperbeamUrl;strict;checkHyperBeamPromise;moduleId;moduleIdPromise;logger=xa.default;constructor(e){if(this.strict=e.strict||!1,Gm(e))this.process=e.process;else if(Jm(e))this.process=new bn({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(!q$t(b))break;return U$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&&Vd(RZ.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&&Vd(VMt.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=Jo.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=[aP.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=aP.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){G3.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}))}}G3.prototype[e]=a(),G3.prototype[e+"Form"]=a(!0)});var Dw=G3;Et();Rt();At();var qat=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 Yd(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}}},AUt=qat;Et();Rt();At();function Uat(r){return function(a){return r.apply(null,a)}}Et();Rt();At();function jat(r){return je.isObject(r)&&r.isAxiosError===!0}Et();Rt();At();var zat={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(zat).forEach(([r,e])=>{zat[e]=r});var RUt=zat;function IUt(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 IUt(Nl(r,i))},a}var Bo=IUt(Z3);Bo.Axios=Dw;Bo.CanceledError=Yd;Bo.CancelToken=AUt;Bo.isCancel=Nw;Bo.VERSION=oP;Bo.toFormData=Km;Bo.AxiosError=Xr;Bo.Cancel=Bo.CanceledError;Bo.all=function(e){return Promise.all(e)};Bo.spread=Uat;Bo.isAxiosError=jat;Bo.mergeConfig=Nl;Bo.AxiosHeaders=Jo;Bo.formToJSON=r=>tP(je.isHTMLForm(r)?new FormData(r):r);Bo.getAdapter=nP.getAdapter;Bo.HttpStatusCode=RUt;Bo.default=Bo;var fP=Bo;var{Axios:VVe,AxiosError:GVe,CanceledError:JVe,isCancel:YVe,CancelToken:XVe,VERSION:QVe,all:tGe,Cancel:eGe,isAxiosError:rGe,spread:iGe,toFormData:nGe,AxiosHeaders:aGe,HttpStatusCode:oGe,formToJSON:sGe,getAdapter:fGe,mergeConfig:hGe}=fP;Et();Rt();At();var PUt=Rn(TUt(),1),Fat="axios-retry";function NUt(r){let e=["ERR_CANCELED","ECONNABORTED"];return r.response||!r.code||e.includes(r.code)?!1:(0,PUt.default)(r)}var OUt=["get","head","options"],z8e=OUt.concat(["put","delete"]);function Hat(r){return r.code!=="ECONNABORTED"&&(!r.response||r.response.status===429||r.response.status>=500&&r.response.status<=599)}function F8e(r){return r.config?.method?Hat(r)&&OUt.indexOf(r.config.method)!==-1:!1}function CUt(r){return r.config?.method?Hat(r)&&z8e.indexOf(r.config.method)!==-1:!1}function LUt(r){return NUt(r)||CUt(r)}function Kat(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 H8e(r=0,e=void 0){return Math.max(0,Kat(e))}function K8e(r=0,e=void 0,a=100){let l=2**r*a,i=Math.max(l,Kat(e)),c=i*.2*Math.random();return i+c}function Z8e(r=100){return(e=0,a=void 0)=>{let l=e*r;return Math.max(l,Kat(a))}}var W8e={retries:3,retryCondition:LUt,retryDelay:H8e,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function V8e(r,e){return{...W8e,...e,...r[Fat]}}function BUt(r,e,a=!1){let l=V8e(r,e||{});return l.retryCount=l.retryCount||0,(!l.lastRequestTime||a)&&(l.lastRequestTime=Date.now()),r[Fat]=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 J8e(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 X8e(r,e){r.retryCount>=r.retries&&await r.onMaxRetryTimesExceeded(e,r.retryCount)}var Zm=(r,e)=>{let a=r.interceptors.request.use(i=>(BUt(i,e,!0),i[Fat]?.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=BUt(c,e);return i.response&&b.validateResponse?.(i.response)?i.response:await J8e(b,i)?Y8e(r,b,i,c):(await X8e(b,i),Promise.reject(i))});return{requestInterceptorId:a,responseInterceptorId:l}};Zm.isNetworkError=NUt;Zm.isSafeRequestError=F8e;Zm.isIdempotentRequestError=CUt;Zm.isNetworkOrIdempotentRequestError=LUt;Zm.exponentialDelay=K8e;Zm.linearDelay=Z8e;Zm.isRetryableError=Hat;var hP=Zm;var DUt=({axiosConfig:r={},logger:e=xa.default,retryConfig:a={retries:5,retryDelay:hP.exponentialDelay,retryCondition:l=>hP.isRetryableError(l),onRetry(l,i,c){e.error(`Retrying request ${c.url} attempt ${l}`,i)}}}={})=>{let l=fP.create({...r,maxRedirects:0,headers:{...r.headers,"x-source-version":`${Kp}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return hP(l,a),l};Et();Rt();At();var Zat=({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 Q8e({signer:r,nonce:e=vat()}){let a,l,i=uP(r)?Hr.ARWEAVE:r.signatureType;switch(uP(r)?a=z6(zt.from(await r.signMessage(Uint8Array.from(zt.from(e))))):r instanceof sl?a=z6(zt.from(await r.signer.signMessage(Uint8Array.from(zt.from(e))))):(r instanceof Gu||r instanceof ks||r instanceof fv)&&("setPublicKey"in r&&r.publicKey===void 0&&await r.setPublicKey(),a=z6(zt.from(await r.sign(Uint8Array.from(zt.from(e)))))),i){case Hr.ARWEAVE:uP(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 lP({paymentUrl:l,axios:i,logger:c})}},lP=class{paymentUrl;axios;logger;constructor({paymentUrl:e="https://payment.ardrive.io",axios:a=DUt(),logger:l=xa.default}){this.paymentUrl=e,this.axios=a,this.logger=l}async getArNSPriceDetails({intent:e,name:a,quantity:l,type:i,years:c}){let b=Zat({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 lP{signer;constructor({signer:e,...a}){if(super(a),!Wat(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=Zat({baseUrl:`${this.paymentUrl}/v1/arns/purchase/${e}/${a}`,params:{increaseQty:l,processId:c,type:i,years:b,paidBy:g,referrer:M}}),w=await Q8e({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 uP(r){return typeof r=="object"&&r!==null&&"signMessage"in r&&"getActivePublicKey"in r}function Wat(r){let e=uP(r),a=r instanceof ks||r instanceof fv||r instanceof Gu||r instanceof sl;return e||a}var K6=class{static init(e){return e!==void 0&&"signer"in e?new qw(e):new J3(e)}static mainnet(e){return e!==void 0&&"signer"in e?new qw({...e,process:new bn({processId:ef,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}):new J3({...e,process:new bn({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?dat({arioInstance:new qw({...e,process:new bn({processId:xZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl}):dat({arioInstance:new J3({...e,process:new bn({processId:xZ,ao:Fh({MODE:"legacy",CU_URL:"https://cu.ardrive.io",...e?.process?.ao})})}),faucetApiUrl:e?.faucetUrl})}},J3=class{process;epochSettings;arweave;hyperbeamUrl;paymentProvider;logger=xa.default;hb;constructor(e){if(this.arweave=e?.arweave??KB,e===void 0||Object.keys(e).length===0)this.process=new bn({processId:ef});else if(Gm(e))this.process=e.process;else if(Jm(e))this.process=new bn({processId:e.processId});else throw new Wd;e?.hyperbeamUrl!==void 0&&(this.hyperbeamUrl=e.hyperbeamUrl,this.hb=new ZB({url:this.hyperbeamUrl,processId:this.process.processId}),this.logger.debug(`Using HyperBEAM node for process ${this.process.processId}`,{hyperbeamUrl:this.hyperbeamUrl})),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 qUt(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}){if(this.hb&&await this.hb.checkHyperBeamCompatibility()){this.logger.debug("Getting balance from HyperBEAM",{address:e});let a=await this.hb.compute({path:`balances/${e}`}).then(l=>Number(l)).catch(l=>(this.logger.error("Failed to get balance from HyperBEAM",{cause:l}),null));if(a!==null)return a;this.logger.info("Failed to get balance from HyperBEAM, failing over to to CU read",{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 $Ut(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){if(this.hb&&await this.hb.checkHyperBeamCompatibility()){this.logger.debug("Getting primary name request from HyperBEAM",{initiator:e.initiator});let l=await this.hb.compute({path:`/primary-names/requests/${e.initiator}`}).catch(i=>(this.logger.error("Failed to get primary name request from HyperBEAM",{cause:i}),null));if(l!==null)return{...l,initiator:e.initiator};this.logger.info("Failed to get primary name request from HyperBEAM, failing over to CU read",{initiator:e.initiator})}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){if(this.hb&&await this.hb.checkHyperBeamCompatibility()){this.logger.debug("Getting primary name from HyperBEAM",{params:e});try{let l;"name"in e?l=await this.hb.compute({path:`/primary-names/names/${e.name}`}):l=e.address;let i=await this.hb.compute({path:`/primary-names/owners/${l}`}),c=i.name,b=i.startTimestamp,M=(await this.getArNSRecord({name:c})).processId;return{owner:l,name:c,startTimestamp:b,processId:M}}catch(l){this.logger.error("Failed to get primary name from HyperBEAM",{cause:l}),this.logger.info("Failed to get primary name from HyperBEAM, failing over to CU read",{params: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 bn({ao:this.process.ao,processId:c.processId}),hyperbeamUrl:this.hyperbeamUrl}),[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 bn({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 J3{signer;paymentProvider;constructor({signer:e,paymentUrl:a,...l}){l===void 0?super({process:new bn({processId:ef})}):super(l),this.signer=Vm(e),this.paymentProvider=$w.init({signer:Wat(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 bn({processId:c,ao:this.process.ao}),signer:this.signer,hyperbeamUrl:this.hyperbeamUrl}).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 qYe=async({address:r,registry:e=R1.init()})=>{let a=await e.accessControlList({address:r});return[...new Set([...a.Owned,...a.Controlled])]};function UUt(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 jUt=class extends Nnt.default{contract;timeoutMs;throttle;logger;strict;antAoClient;constructor({contract:e=K6.init({processId:ef}),timeoutMs:a=6e4,concurrency:l=30,logger:i=xa.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 UUt(this.timeoutMs,tye({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 bn({processId:M,ao:this.antAoClient}),strict:this.strict}),S=await UUt(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)}},tye=async({contract:r=K6.init({processId:ef}),emitter:e,logger:a=xa.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 bn=class{logger;ao;processId;constructor({processId:e,ao:a=Fh({MODE:"legacy"}),logger:l=xa.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=dP(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:Bnt(M)}async send({tags:e,data:a,signer:l,retries:i=3}){let c,b=Z$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=dP(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=Bnt(g.Messages[0].Data);return this.logger.debug("Message result data",{resultData:w,messageId:c,processId:this.processId}),{id:c,result:w}}};var Ym=class{static init(e){return e!==void 0&&"signer"in e?new Vat(e):new cP(e)}},cP=class{process;constructor(e){if(e===void 0||Object.keys(e).length===0)this.process=new bn({processId:kh});else if(Gm(e))this.process=e.process;else if(Jm(e))this.process=new bn({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]}}},Vat=class extends cP{signer;constructor({signer:e,...a}){super(a),this.signer=Vm(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 Ym.init()}static spawn=Jat;static fork=zUt;static async upgrade({signer:e,antProcessId:a,reassignAffiliatedNames:l=!0,names:i,arioProcessId:c=ef,antRegistryId:b=kh,ao:g,logger:M=xa.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 bn({processId:c,ao:g}),hyperbeamUrl:S}),I=async()=>{let K,W=!0,Y=new Set;for(;W;){let U=await A.getArNSRecords({filters:{processId:a},cursor:K,limit:100});U.items.forEach(q=>{Y.add(q.name)}),K=U.nextCursor,W=U.hasMore}return Y};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(Y=>!K.has(Y));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 bn({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,hyperbeamUrl:S}),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(Y){M.error(`Failed to reassign name ${K}:`,{error:Y}),w?.("failed-to-reassign-name",{name:K,arioProcessId:c,antProcessId:P,error:Y}),C[K]={id:W?.id,error:Y}}}return{forkedProcessId:P,reassignedNames:O,failedReassignedNames:C}}static init(e){return e!==void 0&&"signer"in e?new Gat(e):new pP(e)}},pP=class{process;processId;hyperbeamUrl;strict;checkHyperBeamPromise;moduleId;moduleIdPromise;logger=xa.default;constructor(e){if(this.strict=e.strict||!1,Gm(e))this.process=e.process;else if(Jm(e))this.process=new bn({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(!q$t(b))break;return U$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&&Vd(RZ.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&&Vd(VMt.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}"]
|