{
  "snapId": "npm:@metamask/solana-wallet-snap",
  "manifest": {
    "version": "7.2.0",
    "description": "Manage Solana using MetaMask",
    "proposedName": "Solana",
    "repository": {
      "type": "git",
      "url": "https://github.com/MetaMask/internal-snaps.git"
    },
    "source": {
      "shasum": "cqTY0FyKjnaDQmSdXtg6YxAPj2W4PCwKBSTU0asdU54=",
      "location": {
        "npm": {
          "filePath": "dist/bundle.js",
          "iconPath": "images/icon.svg",
          "packageName": "@metamask/solana-wallet-snap",
          "registry": "https://registry.npmjs.org/"
        }
      }
    },
    "initialConnections": {
      "https://portfolio.metamask.io": {}
    },
    "initialPermissions": {
      "endowment:rpc": {
        "dapps": true,
        "snaps": false
      },
      "endowment:keyring": {
        "allowedOrigins": [
          "https://portfolio.metamask.io"
        ],
        "capabilities": {
          "scopes": [
            "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
          ],
          "privateKey": {
            "exportFormats": [
              {
                "encoding": "base58"
              }
            ]
          },
          "bip44": {
            "deriveIndex": true,
            "deriveIndexRange": true,
            "discover": true
          }
        }
      },
      "snap_getBip32Entropy": [
        {
          "path": [
            "m",
            "44'",
            "501'"
          ],
          "curve": "ed25519"
        }
      ],
      "endowment:lifecycle-hooks": {},
      "endowment:network-access": {},
      "endowment:cronjob": {
        "jobs": []
      },
      "endowment:protocol": {
        "scopes": {
          "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
            "methods": [
              "getGenesisHash",
              "getLatestBlockhash",
              "getMinimumBalanceForRentExemption"
            ]
          },
          "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": {
            "methods": [
              "getGenesisHash",
              "getLatestBlockhash",
              "getMinimumBalanceForRentExemption"
            ]
          }
        }
      },
      "endowment:assets": {
        "scopes": [
          "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
          "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"
        ]
      },
      "endowment:name-lookup": {
        "chains": [
          "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
          "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"
        ]
      },
      "snap_manageAccounts": {},
      "snap_manageState": {},
      "snap_dialog": {},
      "snap_getPreferences": {},
      "endowment:messenger": {
        "actions": [
          "RemoteFeatureFlagController:getState",
          "AssetsController:getAccountAssetByID",
          "AssetsController:getAccountAssetsByIDs",
          "AssetsController:getAccountAssetsByScope",
          "AssetsController:getAssets"
        ]
      }
    },
    "platformVersion": "12.0.1",
    "manifestVersion": "0.1"
  },
  "files": [
    {
      "path": "dist/bundle.js",
      "value": "(()=>{var e={91(e,t,n){\"use strict\";t.x2=void 0;const r=n(648),i=n(486),o=n(4),a=n(249),s=n(654),c=n(450);function u(e){if(\"string\"!=typeof e)throw new TypeError(\"Invalid mnemonic type: \"+typeof e);return e.normalize(\"NFKD\")}function l(e){const t=u(e),n=t.split(\" \");if(![12,15,18,21,24].includes(n.length))throw new Error(\"Invalid mnemonic\");return{nfkd:t,words:n}}function d(e){r.default.bytes(e,16,20,24,28,32)}const f=e=>{const t=8-e.length/4;return new Uint8Array([(0,o.sha256)(e)[0]>>t<<t])};function h(e){if(!Array.isArray(e)||2048!==e.length||\"string\"!=typeof e[0])throw new Error(\"Worlist: expected array of 2048 strings\");return e.forEach(e=>{if(\"string\"!=typeof e)throw new Error(`Wordlist: non-string element: ${e}`)}),c.utils.chain(c.utils.checksum(1,f),c.utils.radix2(11,!0),c.utils.alphabet(e))}function p(e,t){let n;if(\"string\"==typeof e){const{words:r}=l(e);n=h(t).decode(r)}else n=h(t).decode(Array.from(new Uint16Array(e.buffer)).map(e=>t[e]));return d(n),n}function g(e,t){d(e);const n=h(t).encode(e).map(e=>t.indexOf(e));return new Uint8Array(new Uint16Array(n).buffer)}t.x2=p;const m=e=>u(`mnemonic${e}`);function y(e,t){let n;return n=\"string\"==typeof e?(new TextEncoder).encode(l(e).nfkd):(new TextEncoder).encode(Array.from(new Uint16Array(e.buffer)).map(e=>t[e]).join(\" \")),n}},925(e,t){\"use strict\";t.p=void 0,t.p=\"abandon\\nability\\nable\\nabout\\nabove\\nabsent\\nabsorb\\nabstract\\nabsurd\\nabuse\\naccess\\naccident\\naccount\\naccuse\\nachieve\\nacid\\nacoustic\\nacquire\\nacross\\nact\\naction\\nactor\\nactress\\nactual\\nadapt\\nadd\\naddict\\naddress\\nadjust\\nadmit\\nadult\\nadvance\\nadvice\\naerobic\\naffair\\nafford\\nafraid\\nagain\\nage\\nagent\\nagree\\nahead\\naim\\nair\\nairport\\naisle\\nalarm\\nalbum\\nalcohol\\nalert\\nalien\\nall\\nalley\\nallow\\nalmost\\nalone\\nalpha\\nalready\\nalso\\nalter\\nalways\\namateur\\namazing\\namong\\namount\\namused\\nanalyst\\nanchor\\nancient\\nanger\\nangle\\nangry\\nanimal\\nankle\\nannounce\\nannual\\nanother\\nanswer\\nantenna\\nantique\\nanxiety\\nany\\napart\\napology\\nappear\\napple\\napprove\\napril\\narch\\narctic\\narea\\narena\\nargue\\narm\\narmed\\narmor\\narmy\\naround\\narrange\\narrest\\narrive\\narrow\\nart\\nartefact\\nartist\\nartwork\\nask\\naspect\\nassault\\nasset\\nassist\\nassume\\nasthma\\nathlete\\natom\\nattack\\nattend\\nattitude\\nattract\\nauction\\naudit\\naugust\\naunt\\nauthor\\nauto\\nautumn\\naverage\\navocado\\navoid\\nawake\\naware\\naway\\nawesome\\nawful\\nawkward\\naxis\\nbaby\\nbachelor\\nbacon\\nbadge\\nbag\\nbalance\\nbalcony\\nball\\nbamboo\\nbanana\\nbanner\\nbar\\nbarely\\nbargain\\nbarrel\\nbase\\nbasic\\nbasket\\nbattle\\nbeach\\nbean\\nbeauty\\nbecause\\nbecome\\nbeef\\nbefore\\nbegin\\nbehave\\nbehind\\nbelieve\\nbelow\\nbelt\\nbench\\nbenefit\\nbest\\nbetray\\nbetter\\nbetween\\nbeyond\\nbicycle\\nbid\\nbike\\nbind\\nbiology\\nbird\\nbirth\\nbitter\\nblack\\nblade\\nblame\\nblanket\\nblast\\nbleak\\nbless\\nblind\\nblood\\nblossom\\nblouse\\nblue\\nblur\\nblush\\nboard\\nboat\\nbody\\nboil\\nbomb\\nbone\\nbonus\\nbook\\nboost\\nborder\\nboring\\nborrow\\nboss\\nbottom\\nbounce\\nbox\\nboy\\nbracket\\nbrain\\nbrand\\nbrass\\nbrave\\nbread\\nbreeze\\nbrick\\nbridge\\nbrief\\nbright\\nbring\\nbrisk\\nbroccoli\\nbroken\\nbronze\\nbroom\\nbrother\\nbrown\\nbrush\\nbubble\\nbuddy\\nbudget\\nbuffalo\\nbuild\\nbulb\\nbulk\\nbullet\\nbundle\\nbunker\\nburden\\nburger\\nburst\\nbus\\nbusiness\\nbusy\\nbutter\\nbuyer\\nbuzz\\ncabbage\\ncabin\\ncable\\ncactus\\ncage\\ncake\\ncall\\ncalm\\ncamera\\ncamp\\ncan\\ncanal\\ncancel\\ncandy\\ncannon\\ncanoe\\ncanvas\\ncanyon\\ncapable\\ncapital\\ncaptain\\ncar\\ncarbon\\ncard\\ncargo\\ncarpet\\ncarry\\ncart\\ncase\\ncash\\ncasino\\ncastle\\ncasual\\ncat\\ncatalog\\ncatch\\ncategory\\ncattle\\ncaught\\ncause\\ncaution\\ncave\\nceiling\\ncelery\\ncement\\ncensus\\ncentury\\ncereal\\ncertain\\nchair\\nchalk\\nchampion\\nchange\\nchaos\\nchapter\\ncharge\\nchase\\nchat\\ncheap\\ncheck\\ncheese\\nchef\\ncherry\\nchest\\nchicken\\nchief\\nchild\\nchimney\\nchoice\\nchoose\\nchronic\\nchuckle\\nchunk\\nchurn\\ncigar\\ncinnamon\\ncircle\\ncitizen\\ncity\\ncivil\\nclaim\\nclap\\nclarify\\nclaw\\nclay\\nclean\\nclerk\\nclever\\nclick\\nclient\\ncliff\\nclimb\\nclinic\\nclip\\nclock\\nclog\\nclose\\ncloth\\ncloud\\nclown\\nclub\\nclump\\ncluster\\nclutch\\ncoach\\ncoast\\ncoconut\\ncode\\ncoffee\\ncoil\\ncoin\\ncollect\\ncolor\\ncolumn\\ncombine\\ncome\\ncomfort\\ncomic\\ncommon\\ncompany\\nconcert\\nconduct\\nconfirm\\ncongress\\nconnect\\nconsider\\ncontrol\\nconvince\\ncook\\ncool\\ncopper\\ncopy\\ncoral\\ncore\\ncorn\\ncorrect\\ncost\\ncotton\\ncouch\\ncountry\\ncouple\\ncourse\\ncousin\\ncover\\ncoyote\\ncrack\\ncradle\\ncraft\\ncram\\ncrane\\ncrash\\ncrater\\ncrawl\\ncrazy\\ncream\\ncredit\\ncreek\\ncrew\\ncricket\\ncrime\\ncrisp\\ncritic\\ncrop\\ncross\\ncrouch\\ncrowd\\ncrucial\\ncruel\\ncruise\\ncrumble\\ncrunch\\ncrush\\ncry\\ncrystal\\ncube\\nculture\\ncup\\ncupboard\\ncurious\\ncurrent\\ncurtain\\ncurve\\ncushion\\ncustom\\ncute\\ncycle\\ndad\\ndamage\\ndamp\\ndance\\ndanger\\ndaring\\ndash\\ndaughter\\ndawn\\nday\\ndeal\\ndebate\\ndebris\\ndecade\\ndecember\\ndecide\\ndecline\\ndecorate\\ndecrease\\ndeer\\ndefense\\ndefine\\ndefy\\ndegree\\ndelay\\ndeliver\\ndemand\\ndemise\\ndenial\\ndentist\\ndeny\\ndepart\\ndepend\\ndeposit\\ndepth\\ndeputy\\nderive\\ndescribe\\ndesert\\ndesign\\ndesk\\ndespair\\ndestroy\\ndetail\\ndetect\\ndevelop\\ndevice\\ndevote\\ndiagram\\ndial\\ndiamond\\ndiary\\ndice\\ndiesel\\ndiet\\ndiffer\\ndigital\\ndignity\\ndilemma\\ndinner\\ndinosaur\\ndirect\\ndirt\\ndisagree\\ndiscover\\ndisease\\ndish\\ndismiss\\ndisorder\\ndisplay\\ndistance\\ndivert\\ndivide\\ndivorce\\ndizzy\\ndoctor\\ndocument\\ndog\\ndoll\\ndolphin\\ndomain\\ndonate\\ndonkey\\ndonor\\ndoor\\ndose\\ndouble\\ndove\\ndraft\\ndragon\\ndrama\\ndrastic\\ndraw\\ndream\\ndress\\ndrift\\ndrill\\ndrink\\ndrip\\ndrive\\ndrop\\ndrum\\ndry\\nduck\\ndumb\\ndune\\nduring\\ndust\\ndutch\\nduty\\ndwarf\\ndynamic\\neager\\neagle\\nearly\\nearn\\nearth\\neasily\\neast\\neasy\\necho\\necology\\neconomy\\nedge\\nedit\\neducate\\neffort\\negg\\neight\\neither\\nelbow\\nelder\\nelectric\\nelegant\\nelement\\nelephant\\nelevator\\nelite\\nelse\\nembark\\nembody\\nembrace\\nemerge\\nemotion\\nemploy\\nempower\\nempty\\nenable\\nenact\\nend\\nendless\\nendorse\\nenemy\\nenergy\\nenforce\\nengage\\nengine\\nenhance\\nenjoy\\nenlist\\nenough\\nenrich\\nenroll\\nensure\\nenter\\nentire\\nentry\\nenvelope\\nepisode\\nequal\\nequip\\nera\\nerase\\nerode\\nerosion\\nerror\\nerupt\\nescape\\nessay\\nessence\\nestate\\neternal\\nethics\\nevidence\\nevil\\nevoke\\nevolve\\nexact\\nexample\\nexcess\\nexchange\\nexcite\\nexclude\\nexcuse\\nexecute\\nexercise\\nexhaust\\nexhibit\\nexile\\nexist\\nexit\\nexotic\\nexpand\\nexpect\\nexpire\\nexplain\\nexpose\\nexpress\\nextend\\nextra\\neye\\neyebrow\\nfabric\\nface\\nfaculty\\nfade\\nfaint\\nfaith\\nfall\\nfalse\\nfame\\nfamily\\nfamous\\nfan\\nfancy\\nfantasy\\nfarm\\nfashion\\nfat\\nfatal\\nfather\\nfatigue\\nfault\\nfavorite\\nfeature\\nfebruary\\nfederal\\nfee\\nfeed\\nfeel\\nfemale\\nfence\\nfestival\\nfetch\\nfever\\nfew\\nfiber\\nfiction\\nfield\\nfigure\\nfile\\nfilm\\nfilter\\nfinal\\nfind\\nfine\\nfinger\\nfinish\\nfire\\nfirm\\nfirst\\nfiscal\\nfish\\nfit\\nfitness\\nfix\\nflag\\nflame\\nflash\\nflat\\nflavor\\nflee\\nflight\\nflip\\nfloat\\nflock\\nfloor\\nflower\\nfluid\\nflush\\nfly\\nfoam\\nfocus\\nfog\\nfoil\\nfold\\nfollow\\nfood\\nfoot\\nforce\\nforest\\nforget\\nfork\\nfortune\\nforum\\nforward\\nfossil\\nfoster\\nfound\\nfox\\nfragile\\nframe\\nfrequent\\nfresh\\nfriend\\nfringe\\nfrog\\nfront\\nfrost\\nfrown\\nfrozen\\nfruit\\nfuel\\nfun\\nfunny\\nfurnace\\nfury\\nfuture\\ngadget\\ngain\\ngalaxy\\ngallery\\ngame\\ngap\\ngarage\\ngarbage\\ngarden\\ngarlic\\ngarment\\ngas\\ngasp\\ngate\\ngather\\ngauge\\ngaze\\ngeneral\\ngenius\\ngenre\\ngentle\\ngenuine\\ngesture\\nghost\\ngiant\\ngift\\ngiggle\\nginger\\ngiraffe\\ngirl\\ngive\\nglad\\nglance\\nglare\\nglass\\nglide\\nglimpse\\nglobe\\ngloom\\nglory\\nglove\\nglow\\nglue\\ngoat\\ngoddess\\ngold\\ngood\\ngoose\\ngorilla\\ngospel\\ngossip\\ngovern\\ngown\\ngrab\\ngrace\\ngrain\\ngrant\\ngrape\\ngrass\\ngravity\\ngreat\\ngreen\\ngrid\\ngrief\\ngrit\\ngrocery\\ngroup\\ngrow\\ngrunt\\nguard\\nguess\\nguide\\nguilt\\nguitar\\ngun\\ngym\\nhabit\\nhair\\nhalf\\nhammer\\nhamster\\nhand\\nhappy\\nharbor\\nhard\\nharsh\\nharvest\\nhat\\nhave\\nhawk\\nhazard\\nhead\\nhealth\\nheart\\nheavy\\nhedgehog\\nheight\\nhello\\nhelmet\\nhelp\\nhen\\nhero\\nhidden\\nhigh\\nhill\\nhint\\nhip\\nhire\\nhistory\\nhobby\\nhockey\\nhold\\nhole\\nholiday\\nhollow\\nhome\\nhoney\\nhood\\nhope\\nhorn\\nhorror\\nhorse\\nhospital\\nhost\\nhotel\\nhour\\nhover\\nhub\\nhuge\\nhuman\\nhumble\\nhumor\\nhundred\\nhungry\\nhunt\\nhurdle\\nhurry\\nhurt\\nhusband\\nhybrid\\nice\\nicon\\nidea\\nidentify\\nidle\\nignore\\nill\\nillegal\\nillness\\nimage\\nimitate\\nimmense\\nimmune\\nimpact\\nimpose\\nimprove\\nimpulse\\ninch\\ninclude\\nincome\\nincrease\\nindex\\nindicate\\nindoor\\nindustry\\ninfant\\ninflict\\ninform\\ninhale\\ninherit\\ninitial\\ninject\\ninjury\\ninmate\\ninner\\ninnocent\\ninput\\ninquiry\\ninsane\\ninsect\\ninside\\ninspire\\ninstall\\nintact\\ninterest\\ninto\\ninvest\\ninvite\\ninvolve\\niron\\nisland\\nisolate\\nissue\\nitem\\nivory\\njacket\\njaguar\\njar\\njazz\\njealous\\njeans\\njelly\\njewel\\njob\\njoin\\njoke\\njourney\\njoy\\njudge\\njuice\\njump\\njungle\\njunior\\njunk\\njust\\nkangaroo\\nkeen\\nkeep\\nketchup\\nkey\\nkick\\nkid\\nkidney\\nkind\\nkingdom\\nkiss\\nkit\\nkitchen\\nkite\\nkitten\\nkiwi\\nknee\\nknife\\nknock\\nknow\\nlab\\nlabel\\nlabor\\nladder\\nlady\\nlake\\nlamp\\nlanguage\\nlaptop\\nlarge\\nlater\\nlatin\\nlaugh\\nlaundry\\nlava\\nlaw\\nlawn\\nlawsuit\\nlayer\\nlazy\\nleader\\nleaf\\nlearn\\nleave\\nlecture\\nleft\\nleg\\nlegal\\nlegend\\nleisure\\nlemon\\nlend\\nlength\\nlens\\nleopard\\nlesson\\nletter\\nlevel\\nliar\\nliberty\\nlibrary\\nlicense\\nlife\\nlift\\nlight\\nlike\\nlimb\\nlimit\\nlink\\nlion\\nliquid\\nlist\\nlittle\\nlive\\nlizard\\nload\\nloan\\nlobster\\nlocal\\nlock\\nlogic\\nlonely\\nlong\\nloop\\nlottery\\nloud\\nlounge\\nlove\\nloyal\\nlucky\\nluggage\\nlumber\\nlunar\\nlunch\\nluxury\\nlyrics\\nmachine\\nmad\\nmagic\\nmagnet\\nmaid\\nmail\\nmain\\nmajor\\nmake\\nmammal\\nman\\nmanage\\nmandate\\nmango\\nmansion\\nmanual\\nmaple\\nmarble\\nmarch\\nmargin\\nmarine\\nmarket\\nmarriage\\nmask\\nmass\\nmaster\\nmatch\\nmaterial\\nmath\\nmatrix\\nmatter\\nmaximum\\nmaze\\nmeadow\\nmean\\nmeasure\\nmeat\\nmechanic\\nmedal\\nmedia\\nmelody\\nmelt\\nmember\\nmemory\\nmention\\nmenu\\nmercy\\nmerge\\nmerit\\nmerry\\nmesh\\nmessage\\nmetal\\nmethod\\nmiddle\\nmidnight\\nmilk\\nmillion\\nmimic\\nmind\\nminimum\\nminor\\nminute\\nmiracle\\nmirror\\nmisery\\nmiss\\nmistake\\nmix\\nmixed\\nmixture\\nmobile\\nmodel\\nmodify\\nmom\\nmoment\\nmonitor\\nmonkey\\nmonster\\nmonth\\nmoon\\nmoral\\nmore\\nmorning\\nmosquito\\nmother\\nmotion\\nmotor\\nmountain\\nmouse\\nmove\\nmovie\\nmuch\\nmuffin\\nmule\\nmultiply\\nmuscle\\nmuseum\\nmushroom\\nmusic\\nmust\\nmutual\\nmyself\\nmystery\\nmyth\\nnaive\\nname\\nnapkin\\nnarrow\\nnasty\\nnation\\nnature\\nnear\\nneck\\nneed\\nnegative\\nneglect\\nneither\\nnephew\\nnerve\\nnest\\nnet\\nnetwork\\nneutral\\nnever\\nnews\\nnext\\nnice\\nnight\\nnoble\\nnoise\\nnominee\\nnoodle\\nnormal\\nnorth\\nnose\\nnotable\\nnote\\nnothing\\nnotice\\nnovel\\nnow\\nnuclear\\nnumber\\nnurse\\nnut\\noak\\nobey\\nobject\\noblige\\nobscure\\nobserve\\nobtain\\nobvious\\noccur\\nocean\\noctober\\nodor\\noff\\noffer\\noffice\\noften\\noil\\nokay\\nold\\nolive\\nolympic\\nomit\\nonce\\none\\nonion\\nonline\\nonly\\nopen\\nopera\\nopinion\\noppose\\noption\\norange\\norbit\\norchard\\norder\\nordinary\\norgan\\norient\\noriginal\\norphan\\nostrich\\nother\\noutdoor\\nouter\\noutput\\noutside\\noval\\noven\\nover\\nown\\nowner\\noxygen\\noyster\\nozone\\npact\\npaddle\\npage\\npair\\npalace\\npalm\\npanda\\npanel\\npanic\\npanther\\npaper\\nparade\\nparent\\npark\\nparrot\\nparty\\npass\\npatch\\npath\\npatient\\npatrol\\npattern\\npause\\npave\\npayment\\npeace\\npeanut\\npear\\npeasant\\npelican\\npen\\npenalty\\npencil\\npeople\\npepper\\nperfect\\npermit\\nperson\\npet\\nphone\\nphoto\\nphrase\\nphysical\\npiano\\npicnic\\npicture\\npiece\\npig\\npigeon\\npill\\npilot\\npink\\npioneer\\npipe\\npistol\\npitch\\npizza\\nplace\\nplanet\\nplastic\\nplate\\nplay\\nplease\\npledge\\npluck\\nplug\\nplunge\\npoem\\npoet\\npoint\\npolar\\npole\\npolice\\npond\\npony\\npool\\npopular\\nportion\\nposition\\npossible\\npost\\npotato\\npottery\\npoverty\\npowder\\npower\\npractice\\npraise\\npredict\\nprefer\\nprepare\\npresent\\npretty\\nprevent\\nprice\\npride\\nprimary\\nprint\\npriority\\nprison\\nprivate\\nprize\\nproblem\\nprocess\\nproduce\\nprofit\\nprogram\\nproject\\npromote\\nproof\\nproperty\\nprosper\\nprotect\\nproud\\nprovide\\npublic\\npudding\\npull\\npulp\\npulse\\npumpkin\\npunch\\npupil\\npuppy\\npurchase\\npurity\\npurpose\\npurse\\npush\\nput\\npuzzle\\npyramid\\nquality\\nquantum\\nquarter\\nquestion\\nquick\\nquit\\nquiz\\nquote\\nrabbit\\nraccoon\\nrace\\nrack\\nradar\\nradio\\nrail\\nrain\\nraise\\nrally\\nramp\\nranch\\nrandom\\nrange\\nrapid\\nrare\\nrate\\nrather\\nraven\\nraw\\nrazor\\nready\\nreal\\nreason\\nrebel\\nrebuild\\nrecall\\nreceive\\nrecipe\\nrecord\\nrecycle\\nreduce\\nreflect\\nreform\\nrefuse\\nregion\\nregret\\nregular\\nreject\\nrelax\\nrelease\\nrelief\\nrely\\nremain\\nremember\\nremind\\nremove\\nrender\\nrenew\\nrent\\nreopen\\nrepair\\nrepeat\\nreplace\\nreport\\nrequire\\nrescue\\nresemble\\nresist\\nresource\\nresponse\\nresult\\nretire\\nretreat\\nreturn\\nreunion\\nreveal\\nreview\\nreward\\nrhythm\\nrib\\nribbon\\nrice\\nrich\\nride\\nridge\\nrifle\\nright\\nrigid\\nring\\nriot\\nripple\\nrisk\\nritual\\nrival\\nriver\\nroad\\nroast\\nrobot\\nrobust\\nrocket\\nromance\\nroof\\nrookie\\nroom\\nrose\\nrotate\\nrough\\nround\\nroute\\nroyal\\nrubber\\nrude\\nrug\\nrule\\nrun\\nrunway\\nrural\\nsad\\nsaddle\\nsadness\\nsafe\\nsail\\nsalad\\nsalmon\\nsalon\\nsalt\\nsalute\\nsame\\nsample\\nsand\\nsatisfy\\nsatoshi\\nsauce\\nsausage\\nsave\\nsay\\nscale\\nscan\\nscare\\nscatter\\nscene\\nscheme\\nschool\\nscience\\nscissors\\nscorpion\\nscout\\nscrap\\nscreen\\nscript\\nscrub\\nsea\\nsearch\\nseason\\nseat\\nsecond\\nsecret\\nsection\\nsecurity\\nseed\\nseek\\nsegment\\nselect\\nsell\\nseminar\\nsenior\\nsense\\nsentence\\nseries\\nservice\\nsession\\nsettle\\nsetup\\nseven\\nshadow\\nshaft\\nshallow\\nshare\\nshed\\nshell\\nsheriff\\nshield\\nshift\\nshine\\nship\\nshiver\\nshock\\nshoe\\nshoot\\nshop\\nshort\\nshoulder\\nshove\\nshrimp\\nshrug\\nshuffle\\nshy\\nsibling\\nsick\\nside\\nsiege\\nsight\\nsign\\nsilent\\nsilk\\nsilly\\nsilver\\nsimilar\\nsimple\\nsince\\nsing\\nsiren\\nsister\\nsituate\\nsix\\nsize\\nskate\\nsketch\\nski\\nskill\\nskin\\nskirt\\nskull\\nslab\\nslam\\nsleep\\nslender\\nslice\\nslide\\nslight\\nslim\\nslogan\\nslot\\nslow\\nslush\\nsmall\\nsmart\\nsmile\\nsmoke\\nsmooth\\nsnack\\nsnake\\nsnap\\nsniff\\nsnow\\nsoap\\nsoccer\\nsocial\\nsock\\nsoda\\nsoft\\nsolar\\nsoldier\\nsolid\\nsolution\\nsolve\\nsomeone\\nsong\\nsoon\\nsorry\\nsort\\nsoul\\nsound\\nsoup\\nsource\\nsouth\\nspace\\nspare\\nspatial\\nspawn\\nspeak\\nspecial\\nspeed\\nspell\\nspend\\nsphere\\nspice\\nspider\\nspike\\nspin\\nspirit\\nsplit\\nspoil\\nsponsor\\nspoon\\nsport\\nspot\\nspray\\nspread\\nspring\\nspy\\nsquare\\nsqueeze\\nsquirrel\\nstable\\nstadium\\nstaff\\nstage\\nstairs\\nstamp\\nstand\\nstart\\nstate\\nstay\\nsteak\\nsteel\\nstem\\nstep\\nstereo\\nstick\\nstill\\nsting\\nstock\\nstomach\\nstone\\nstool\\nstory\\nstove\\nstrategy\\nstreet\\nstrike\\nstrong\\nstruggle\\nstudent\\nstuff\\nstumble\\nstyle\\nsubject\\nsubmit\\nsubway\\nsuccess\\nsuch\\nsudden\\nsuffer\\nsugar\\nsuggest\\nsuit\\nsummer\\nsun\\nsunny\\nsunset\\nsuper\\nsupply\\nsupreme\\nsure\\nsurface\\nsurge\\nsurprise\\nsurround\\nsurvey\\nsuspect\\nsustain\\nswallow\\nswamp\\nswap\\nswarm\\nswear\\nsweet\\nswift\\nswim\\nswing\\nswitch\\nsword\\nsymbol\\nsymptom\\nsyrup\\nsystem\\ntable\\ntackle\\ntag\\ntail\\ntalent\\ntalk\\ntank\\ntape\\ntarget\\ntask\\ntaste\\ntattoo\\ntaxi\\nteach\\nteam\\ntell\\nten\\ntenant\\ntennis\\ntent\\nterm\\ntest\\ntext\\nthank\\nthat\\ntheme\\nthen\\ntheory\\nthere\\nthey\\nthing\\nthis\\nthought\\nthree\\nthrive\\nthrow\\nthumb\\nthunder\\nticket\\ntide\\ntiger\\ntilt\\ntimber\\ntime\\ntiny\\ntip\\ntired\\ntissue\\ntitle\\ntoast\\ntobacco\\ntoday\\ntoddler\\ntoe\\ntogether\\ntoilet\\ntoken\\ntomato\\ntomorrow\\ntone\\ntongue\\ntonight\\ntool\\ntooth\\ntop\\ntopic\\ntopple\\ntorch\\ntornado\\ntortoise\\ntoss\\ntotal\\ntourist\\ntoward\\ntower\\ntown\\ntoy\\ntrack\\ntrade\\ntraffic\\ntragic\\ntrain\\ntransfer\\ntrap\\ntrash\\ntravel\\ntray\\ntreat\\ntree\\ntrend\\ntrial\\ntribe\\ntrick\\ntrigger\\ntrim\\ntrip\\ntrophy\\ntrouble\\ntruck\\ntrue\\ntruly\\ntrumpet\\ntrust\\ntruth\\ntry\\ntube\\ntuition\\ntumble\\ntuna\\ntunnel\\nturkey\\nturn\\nturtle\\ntwelve\\ntwenty\\ntwice\\ntwin\\ntwist\\ntwo\\ntype\\ntypical\\nugly\\numbrella\\nunable\\nunaware\\nuncle\\nuncover\\nunder\\nundo\\nunfair\\nunfold\\nunhappy\\nuniform\\nunique\\nunit\\nuniverse\\nunknown\\nunlock\\nuntil\\nunusual\\nunveil\\nupdate\\nupgrade\\nuphold\\nupon\\nupper\\nupset\\nurban\\nurge\\nusage\\nuse\\nused\\nuseful\\nuseless\\nusual\\nutility\\nvacant\\nvacuum\\nvague\\nvalid\\nvalley\\nvalve\\nvan\\nvanish\\nvapor\\nvarious\\nvast\\nvault\\nvehicle\\nvelvet\\nvendor\\nventure\\nvenue\\nverb\\nverify\\nversion\\nvery\\nvessel\\nveteran\\nviable\\nvibrant\\nvicious\\nvictory\\nvideo\\nview\\nvillage\\nvintage\\nviolin\\nvirtual\\nvirus\\nvisa\\nvisit\\nvisual\\nvital\\nvivid\\nvocal\\nvoice\\nvoid\\nvolcano\\nvolume\\nvote\\nvoyage\\nwage\\nwagon\\nwait\\nwalk\\nwall\\nwalnut\\nwant\\nwarfare\\nwarm\\nwarrior\\nwash\\nwasp\\nwaste\\nwater\\nwave\\nway\\nwealth\\nweapon\\nwear\\nweasel\\nweather\\nweb\\nwedding\\nweekend\\nweird\\nwelcome\\nwest\\nwet\\nwhale\\nwhat\\nwheat\\nwheel\\nwhen\\nwhere\\nwhip\\nwhisper\\nwide\\nwidth\\nwife\\nwild\\nwill\\nwin\\nwindow\\nwine\\nwing\\nwink\\nwinner\\nwinter\\nwire\\nwisdom\\nwise\\nwish\\nwitness\\nwolf\\nwoman\\nwonder\\nwood\\nwool\\nword\\nwork\\nworld\\nworry\\nworth\\nwrap\\nwreck\\nwrestle\\nwrist\\nwrite\\nwrong\\nyard\\nyear\\nyellow\\nyou\\nyoung\\nyouth\\nzebra\\nzero\\nzone\\nzoo\".split(\"\\n\")},648(e,t){\"use strict\";function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function r(e){if(\"boolean\"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function i(e,...t){if(!((n=e)instanceof Uint8Array||null!=n&&\"object\"==typeof n&&\"Uint8Array\"===n.constructor.name))throw new Error(\"Expected Uint8Array\");var n;if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if(\"function\"!=typeof e||\"function\"!=typeof e.create)throw new Error(\"Hash should be wrapped by utils.wrapConstructor\");n(e.outputLen),n(e.blockLen)}function a(e,t=!0){if(e.destroyed)throw new Error(\"Hash instance has been destroyed\");if(t&&e.finished)throw new Error(\"Hash#digest() has already been called\")}function s(e,t){i(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}t.output=t.exists=t.hash=t.bytes=t.number=void 0,t.number=n,t.bytes=i,t.hash=o,t.exists=a,t.output=s;const c={number:n,bool:r,bytes:i,hash:o,exists:a,output:s};t.default=c},134(e,t,n){\"use strict\";t.SHA2=void 0;const r=n(648),i=n(654);class o extends i.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,r.exists)(this);const{view:t,buffer:n,blockLen:o}=this,a=(e=(0,i.toBytes)(e)).length;for(let r=0;r<a;){const s=Math.min(o-this.pos,a-r);if(s===o){const t=(0,i.createView)(e);for(;o<=a-r;r+=o)this.process(t,r);continue}n.set(e.subarray(r,r+s),this.pos),this.pos+=s,r+=s,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,r.exists)(this),(0,r.output)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:o,isLE:a}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(n,0),s=0);for(let e=s;e<o;e++)t[e]=0;!function(e,t,n,r){if(\"function\"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),a=Number(n>>i&o),s=Number(n&o),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,s,r)}(n,o-8,BigInt(8*this.length),a),this.process(n,0);const c=(0,i.createView)(e),u=this.outputLen;if(u%4)throw new Error(\"_sha2: outputLen should be aligned to 32bit\");const l=u/4,d=this.get();if(l>d.length)throw new Error(\"_sha2: outputLen bigger than state\");for(let e=0;e<l;e++)c.setUint32(4*e,d[e],a)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}}t.SHA2=o},109(e,t){\"use strict\";const n=BigInt(2**32-1),r=BigInt(32);function i(e,t=!1){return t?{h:Number(e&n),l:Number(e>>r&n)}:{h:0|Number(e>>r&n),l:0|Number(e&n)}}function o(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:a,l:s}=i(e[o],t);[n[o],r[o]]=[a,s]}return[n,r]}const a=(e,t)=>BigInt(e>>>0)<<r|BigInt(t>>>0);const s=(e,t,n)=>e>>>n;const c=(e,t,n)=>e<<32-n|t>>>n;const u=(e,t,n)=>e>>>n|t<<32-n;const l=(e,t,n)=>e<<32-n|t>>>n;const d=(e,t,n)=>e<<64-n|t>>>n-32;const f=(e,t,n)=>e>>>n-32|t<<64-n;const h=(e,t)=>t;const p=(e,t)=>e;const g=(e,t,n)=>e<<n|t>>>32-n;const m=(e,t,n)=>t<<n|e>>>32-n;const y=(e,t,n)=>t<<n-32|e>>>64-n;const w=(e,t,n)=>e<<n-32|t>>>64-n;function v(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}const A=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);const b=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;const S=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);const k=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;const x=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);const E=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;const I={fromBig:i,split:o,toBig:a,shrSH:s,shrSL:c,rotrSH:u,rotrSL:l,rotrBH:d,rotrBL:f,rotr32H:h,rotr32L:p,rotlSH:g,rotlSL:m,rotlBH:y,rotlBL:w,add:v,add3L:A,add3H:b,add4L:S,add4H:k,add5H:E,add5L:x};t.default=I},610(e,t){\"use strict\";t.crypto=void 0,t.crypto=\"object\"==typeof globalThis&&\"crypto\"in globalThis?globalThis.crypto:void 0},832(e,t,n){\"use strict\";t.hmac=void 0;const r=n(648),i=n(654);class o extends i.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,r.hash)(e);const n=(0,i.toBytes)(t);if(this.iHash=e.create(),\"function\"!=typeof this.iHash.update)throw new Error(\"Expected instance of class which extends utils.Hash\");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,a=new Uint8Array(o);a.set(n.length>o?e.create().update(n).digest():n);for(let e=0;e<a.length;e++)a[e]^=54;this.iHash.update(a),this.oHash=e.create();for(let e=0;e<a.length;e++)a[e]^=106;this.oHash.update(a),a.fill(0)}update(e){return(0,r.exists)(this),this.iHash.update(e),this}digestInto(e){(0,r.exists)(this),(0,r.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.hmac=(e,t,n)=>new o(e,t).update(n).digest(),t.hmac.create=(e,t)=>new o(e,t)},486(e,t,n){\"use strict\";t.pbkdf2Async=t.pbkdf2=void 0;const r=n(648),i=n(832),o=n(654);function a(e,t,n,a){(0,r.hash)(e);const s=(0,o.checkOpts)({dkLen:32,asyncTick:10},a),{c,dkLen:u,asyncTick:l}=s;if((0,r.number)(c),(0,r.number)(u),(0,r.number)(l),c<1)throw new Error(\"PBKDF2: iterations (c) should be >= 1\");const d=(0,o.toBytes)(t),f=(0,o.toBytes)(n),h=new Uint8Array(u),p=i.hmac.create(e,d),g=p._cloneInto().update(f);return{c,dkLen:u,asyncTick:l,DK:h,PRF:p,PRFSalt:g}}function s(e,t,n,r,i){return e.destroy(),t.destroy(),r&&r.destroy(),i.fill(0),n}t.pbkdf2=function(e,t,n,r){const{c:i,dkLen:c,DK:u,PRF:l,PRFSalt:d}=a(e,t,n,r);let f;const h=new Uint8Array(4),p=(0,o.createView)(h),g=new Uint8Array(l.outputLen);for(let e=1,t=0;t<c;e++,t+=l.outputLen){const n=u.subarray(t,t+l.outputLen);p.setInt32(0,e,!1),(f=d._cloneInto(f)).update(h).digestInto(g),n.set(g.subarray(0,n.length));for(let e=1;e<i;e++){l._cloneInto(f).update(g).digestInto(g);for(let e=0;e<n.length;e++)n[e]^=g[e]}}return s(l,d,u,f,g)},t.pbkdf2Async=async function(e,t,n,r){const{c:i,dkLen:c,asyncTick:u,DK:l,PRF:d,PRFSalt:f}=a(e,t,n,r);let h;const p=new Uint8Array(4),g=(0,o.createView)(p),m=new Uint8Array(d.outputLen);for(let e=1,t=0;t<c;e++,t+=d.outputLen){const n=l.subarray(t,t+d.outputLen);g.setInt32(0,e,!1),(h=f._cloneInto(h)).update(p).digestInto(m),n.set(m.subarray(0,n.length)),await(0,o.asyncLoop)(i-1,u,()=>{d._cloneInto(h).update(m).digestInto(m);for(let e=0;e<n.length;e++)n[e]^=m[e]})}return s(d,f,l,h,m)}},4(e,t,n){\"use strict\";t.sha256=void 0;const r=n(134),i=n(654),o=(e,t,n)=>e&t^~e&n,a=(e,t,n)=>e&t^e&n^t&n,s=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),c=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class l extends r.SHA2{constructor(){super(64,32,8,!1),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3],this.E=0|c[4],this.F=0|c[5],this.G=0|c[6],this.H=0|c[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:a,H:s}=this;return[e,t,n,r,i,o,a,s]}set(e,t,n,r,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let n=0;n<16;n++,t+=4)u[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=u[e-15],n=u[e-2],r=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(n,17)^(0,i.rotr)(n,19)^n>>>10;u[e]=o+u[e-7]+r+u[e-16]|0}let{A:n,B:r,C:c,D:l,E:d,F:f,G:h,H:p}=this;for(let e=0;e<64;e++){const t=p+((0,i.rotr)(d,6)^(0,i.rotr)(d,11)^(0,i.rotr)(d,25))+o(d,f,h)+s[e]+u[e]|0,g=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+a(n,r,c)|0;p=h,h=f,f=d,d=l+t|0,l=c,c=r,r=n,n=t+g|0}n=n+this.A|0,r=r+this.B|0,c=c+this.C|0,l=l+this.D|0,d=d+this.E|0,f=f+this.F|0,h=h+this.G|0,p=p+this.H|0,this.set(n,r,c,l,d,f,h,p)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class d extends l{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,i.wrapConstructor)(()=>new l),(0,i.wrapConstructor)(()=>new d)},249(e,t,n){\"use strict\";t.sha512=void 0;const r=n(134),i=n(109),o=n(654),[a,s]=i.default.split([\"0x428a2f98d728ae22\",\"0x7137449123ef65cd\",\"0xb5c0fbcfec4d3b2f\",\"0xe9b5dba58189dbbc\",\"0x3956c25bf348b538\",\"0x59f111f1b605d019\",\"0x923f82a4af194f9b\",\"0xab1c5ed5da6d8118\",\"0xd807aa98a3030242\",\"0x12835b0145706fbe\",\"0x243185be4ee4b28c\",\"0x550c7dc3d5ffb4e2\",\"0x72be5d74f27b896f\",\"0x80deb1fe3b1696b1\",\"0x9bdc06a725c71235\",\"0xc19bf174cf692694\",\"0xe49b69c19ef14ad2\",\"0xefbe4786384f25e3\",\"0x0fc19dc68b8cd5b5\",\"0x240ca1cc77ac9c65\",\"0x2de92c6f592b0275\",\"0x4a7484aa6ea6e483\",\"0x5cb0a9dcbd41fbd4\",\"0x76f988da831153b5\",\"0x983e5152ee66dfab\",\"0xa831c66d2db43210\",\"0xb00327c898fb213f\",\"0xbf597fc7beef0ee4\",\"0xc6e00bf33da88fc2\",\"0xd5a79147930aa725\",\"0x06ca6351e003826f\",\"0x142929670a0e6e70\",\"0x27b70a8546d22ffc\",\"0x2e1b21385c26c926\",\"0x4d2c6dfc5ac42aed\",\"0x53380d139d95b3df\",\"0x650a73548baf63de\",\"0x766a0abb3c77b2a8\",\"0x81c2c92e47edaee6\",\"0x92722c851482353b\",\"0xa2bfe8a14cf10364\",\"0xa81a664bbc423001\",\"0xc24b8b70d0f89791\",\"0xc76c51a30654be30\",\"0xd192e819d6ef5218\",\"0xd69906245565a910\",\"0xf40e35855771202a\",\"0x106aa07032bbd1b8\",\"0x19a4c116b8d2d0c8\",\"0x1e376c085141ab53\",\"0x2748774cdf8eeb99\",\"0x34b0bcb5e19b48a8\",\"0x391c0cb3c5c95a63\",\"0x4ed8aa4ae3418acb\",\"0x5b9cca4f7763e373\",\"0x682e6ff3d6b2b8a3\",\"0x748f82ee5defb2fc\",\"0x78a5636f43172f60\",\"0x84c87814a1f0ab72\",\"0x8cc702081a6439ec\",\"0x90befffa23631e28\",\"0xa4506cebde82bde9\",\"0xbef9a3f7b2c67915\",\"0xc67178f2e372532b\",\"0xca273eceea26619c\",\"0xd186b8c721c0c207\",\"0xeada7dd6cde0eb1e\",\"0xf57d4f7fee6ed178\",\"0x06f067aa72176fba\",\"0x0a637dc5a2c898a6\",\"0x113f9804bef90dae\",\"0x1b710b35131c471b\",\"0x28db77f523047d84\",\"0x32caab7b40c72493\",\"0x3c9ebe0a15c9bebc\",\"0x431d67c49c100d4c\",\"0x4cc5d4becb3e42b6\",\"0x597f299cfc657e2a\",\"0x5fcb6fab3ad6faec\",\"0x6c44198c4a475817\"].map(e=>BigInt(e))),c=new Uint32Array(80),u=new Uint32Array(80);class l extends r.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:c,El:u,Fh:l,Fl:d,Gh:f,Gl:h,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,g]}set(e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let n=0;n<16;n++,t+=4)c[n]=e.getUint32(t),u[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|c[e-15],n=0|u[e-15],r=i.default.rotrSH(t,n,1)^i.default.rotrSH(t,n,8)^i.default.shrSH(t,n,7),o=i.default.rotrSL(t,n,1)^i.default.rotrSL(t,n,8)^i.default.shrSL(t,n,7),a=0|c[e-2],s=0|u[e-2],l=i.default.rotrSH(a,s,19)^i.default.rotrBH(a,s,61)^i.default.shrSH(a,s,6),d=i.default.rotrSL(a,s,19)^i.default.rotrBL(a,s,61)^i.default.shrSL(a,s,6),f=i.default.add4L(o,d,u[e-7],u[e-16]),h=i.default.add4H(f,r,l,c[e-7],c[e-16]);c[e]=0|h,u[e]=0|f}let{Ah:n,Al:r,Bh:o,Bl:l,Ch:d,Cl:f,Dh:h,Dl:p,Eh:g,El:m,Fh:y,Fl:w,Gh:v,Gl:A,Hh:b,Hl:S}=this;for(let e=0;e<80;e++){const t=i.default.rotrSH(g,m,14)^i.default.rotrSH(g,m,18)^i.default.rotrBH(g,m,41),k=i.default.rotrSL(g,m,14)^i.default.rotrSL(g,m,18)^i.default.rotrBL(g,m,41),x=g&y^~g&v,E=m&w^~m&A,I=i.default.add5L(S,k,E,s[e],u[e]),T=i.default.add5H(I,b,t,x,a[e],c[e]),B=0|I,C=i.default.rotrSH(n,r,28)^i.default.rotrBH(n,r,34)^i.default.rotrBH(n,r,39),M=i.default.rotrSL(n,r,28)^i.default.rotrBL(n,r,34)^i.default.rotrBL(n,r,39),P=n&o^n&d^o&d,_=r&l^r&f^l&f;b=0|v,S=0|A,v=0|y,A=0|w,y=0|g,w=0|m,({h:g,l:m}=i.default.add(0|h,0|p,0|T,0|B)),h=0|d,p=0|f,d=0|o,f=0|l,o=0|n,l=0|r;const R=i.default.add3L(B,M,_);n=i.default.add3H(R,T,C,P),r=0|R}({h:n,l:r}=i.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l}=i.default.add(0|this.Bh,0|this.Bl,0|o,0|l)),({h:d,l:f}=i.default.add(0|this.Ch,0|this.Cl,0|d,0|f)),({h,l:p}=i.default.add(0|this.Dh,0|this.Dl,0|h,0|p)),({h:g,l:m}=i.default.add(0|this.Eh,0|this.El,0|g,0|m)),({h:y,l:w}=i.default.add(0|this.Fh,0|this.Fl,0|y,0|w)),({h:v,l:A}=i.default.add(0|this.Gh,0|this.Gl,0|v,0|A)),({h:b,l:S}=i.default.add(0|this.Hh,0|this.Hl,0|b,0|S)),this.set(n,r,o,l,d,f,h,p,g,m,y,w,v,A,b,S)}roundClean(){c.fill(0),u.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class d extends l{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class f extends l{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class h extends l{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}t.sha512=(0,o.wrapConstructor)(()=>new l),(0,o.wrapConstructor)(()=>new d),(0,o.wrapConstructor)(()=>new f),(0,o.wrapConstructor)(()=>new h)},654(e,t,n){\"use strict\";t.randomBytes=t.wrapConstructor=t.checkOpts=t.Hash=t.toBytes=t.asyncLoop=t.dY=t.qv=t.rotr=t.createView=void 0;const r=n(610);function i(e){return e instanceof Uint8Array||null!=e&&\"object\"==typeof e&&\"Uint8Array\"===e.constructor.name}t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.rotr=(e,t)=>e<<32-t|e>>>t,t.qv=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.qv)throw new Error(\"Non little-endian hardware is not supported\");const o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,\"0\"));const a=48,s=57,c=65,u=70,l=97,d=102;function f(e){return e>=a&&e<=s?e-a:e>=c&&e<=u?e-(c-10):e>=l&&e<=d?e-(l-10):void 0}function h(e){if(\"string\"!=typeof e)throw new Error(\"utf8ToBytes expected string, got \"+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function p(e){if(\"string\"==typeof e&&(e=h(e)),!i(e))throw new Error(\"expected Uint8Array, got \"+typeof e);return e}t.dY=async()=>{},t.asyncLoop=async function(e,n,r){let i=Date.now();for(let o=0;o<e;o++){r(o);const e=Date.now()-i;e>=0&&e<n||(await(0,t.dY)(),i+=e)}},t.toBytes=p;t.Hash=class{clone(){return this._cloneInto()}};const g={}.toString;t.checkOpts=function(e,t){if(void 0!==t&&\"[object Object]\"!==g.call(t))throw new Error(\"Options should be object or undefined\");return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(p(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},t.randomBytes=function(e=32){if(r.crypto&&\"function\"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(e));throw new Error(\"crypto.getRandomValues must be defined\")}},450(e,t){\"use strict\";function n(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function r(e){return e instanceof Uint8Array||null!=e&&\"object\"==typeof e&&\"Uint8Array\"===e.constructor.name}function i(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map(e=>e.encode).reduceRight(n,t),decode:e.map(e=>e.decode).reduce(n,t)}}function o(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&\"number\"!=typeof t[0])throw new Error(\"alphabet.encode input should be an array of numbers\");return t.map(t=>{if(n(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&\"string\"!=typeof t[0])throw new Error(\"alphabet.decode input should be array of strings\");return t.map(t=>{if(\"string\"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: \"${t}\". Allowed: ${e}`);return n})}}}function a(e=\"\"){if(\"string\"!=typeof e)throw new Error(\"join separator should be string\");return{encode:t=>{if(!Array.isArray(t)||t.length&&\"string\"!=typeof t[0])throw new Error(\"join.encode input should be array of strings\");for(let e of t)if(\"string\"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if(\"string\"!=typeof t)throw new Error(\"join.decode input should be string\");return t.split(e)}}}function s(e,t=\"=\"){if(n(e),\"string\"!=typeof t)throw new Error(\"padding chr should be string\");return{encode(n){if(!Array.isArray(n)||n.length&&\"string\"!=typeof n[0])throw new Error(\"padding.encode input should be array of strings\");for(let e of n)if(\"string\"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&\"string\"!=typeof n[0])throw new Error(\"padding.encode input should be array of strings\");for(let e of n)if(\"string\"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error(\"Invalid padding: string should have whole number of bytes\");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error(\"Invalid padding: string has too much padding\");return n.slice(0,r)}}}function c(e){if(\"function\"!=typeof e)throw new Error(\"normalize fn should be function\");return{encode:e=>e,decode:t=>e(t)}}function u(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error(\"convertRadix: data should be array\");if(!e.length)return[];let i=0;const o=[],a=Array.from(e);for(a.forEach(e=>{if(n(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)});;){let e=0,n=!0;for(let o=i;o<a.length;o++){const s=a[o],c=t*e+s;if(!Number.isSafeInteger(c)||t*e/t!==e||c-s!==t*e)throw new Error(\"convertRadix: carry overflow\");e=c%r;const u=Math.floor(c/r);if(a[o]=u,!Number.isSafeInteger(u)||u*r+e!==c)throw new Error(\"convertRadix: carry overflow\");n&&(u?n=!1:i=o)}if(o.push(e),n)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}t.Af=t.Ar=t.uh=t.As=t.rg=t.ic=t.tw=t.r0=t.K3=t.RG=t.xn=t.utils=void 0;const l=(e,t)=>t?l(t,e%t):e,d=(e,t)=>e+(t-l(e,t));function f(e,t,r,i){if(!Array.isArray(e))throw new Error(\"convertRadix2: data should be array\");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(d(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${d(t,r)}`);let o=0,a=0;const s=2**r-1,c=[];for(const i of e){if(n(i),i>=2**t)throw new Error(`convertRadix2: invalid data word=${i} from=${t}`);if(o=o<<t|i,a+t>32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=r;a-=r)c.push((o>>a-r&s)>>>0);o&=2**a-1}if(o=o<<r-a&s,!i&&a>=t)throw new Error(\"Excess padding\");if(!i&&o)throw new Error(`Non-zero padding: ${o}`);return i&&a>0&&c.push(o>>>0),c}function h(e){return n(e),{encode:t=>{if(!r(t))throw new Error(\"radix.encode input should be Uint8Array\");return u(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&\"number\"!=typeof t[0])throw new Error(\"radix.decode input should be array of numbers\");return Uint8Array.from(u(t,e,256))}}}function p(e,t=!1){if(n(e),e<=0||e>32)throw new Error(\"radix2: bits should be in (0..32]\");if(d(8,e)>32||d(e,8)>32)throw new Error(\"radix2: carry overflow\");return{encode:n=>{if(!r(n))throw new Error(\"radix2.encode input should be Uint8Array\");return f(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&\"number\"!=typeof n[0])throw new Error(\"radix2.decode input should be array of numbers\");return Uint8Array.from(f(n,e,8,t))}}}function g(e){if(\"function\"!=typeof e)throw new Error(\"unsafeWrapper fn should be function\");return function(...t){try{return e.apply(null,t)}catch(e){}}}function m(e,t){if(n(e),\"function\"!=typeof t)throw new Error(\"checksum fn should be function\");return{encode(n){if(!r(n))throw new Error(\"checksum.encode: input should be Uint8Array\");const i=t(n).slice(0,e),o=new Uint8Array(n.length+e);return o.set(n),o.set(i,n.length),o},decode(n){if(!r(n))throw new Error(\"checksum.decode: input should be Uint8Array\");const i=n.slice(0,-e),o=t(i).slice(0,e),a=n.slice(-e);for(let t=0;t<e;t++)if(o[t]!==a[t])throw new Error(\"Invalid checksum\");return i}}}t.utils={alphabet:o,chain:i,checksum:m,convertRadix:u,convertRadix2:f,radix:h,radix2:p,join:a,padding:s},t.xn=i(p(4),o(\"0123456789ABCDEF\"),a(\"\")),t.RG=i(p(5),o(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\"),s(5),a(\"\")),i(p(5),o(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\"),a(\"\")),i(p(5),o(\"0123456789ABCDEFGHIJKLMNOPQRSTUV\"),s(5),a(\"\")),i(p(5),o(\"0123456789ABCDEFGHIJKLMNOPQRSTUV\"),a(\"\")),i(p(5),o(\"0123456789ABCDEFGHJKMNPQRSTVWXYZ\"),a(\"\"),c(e=>e.toUpperCase().replace(/O/g,\"0\").replace(/[IL]/g,\"1\"))),t.K3=i(p(6),o(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"),s(6),a(\"\")),i(p(6),o(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"),a(\"\")),t.r0=i(p(6),o(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\"),s(6),a(\"\")),i(p(6),o(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\"),a(\"\"));const y=e=>i(h(58),o(e),a(\"\"));t.tw=y(\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\"),y(\"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ\"),y(\"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz\");const w=[0,2,3,5,6,7,9,10,11];t.ic={encode(e){let n=\"\";for(let r=0;r<e.length;r+=8){const i=e.subarray(r,r+8);n+=t.tw.encode(i).padStart(w[i.length],\"1\")}return n},decode(e){let n=[];for(let r=0;r<e.length;r+=11){const i=e.slice(r,r+11),o=w.indexOf(i.length),a=t.tw.decode(i);for(let e=0;e<a.length-o;e++)if(0!==a[e])throw new Error(\"base58xmr: wrong padding\");n=n.concat(Array.from(a.slice(a.length-o)))}return Uint8Array.from(n)}};t.rg=e=>i(m(4,t=>e(e(t))),t.tw),t.rg;const v=i(o(\"qpzry9x8gf2tvdw0s3jn54khce6mua7l\"),a(\"\")),A=[996825010,642813549,513874426,1027748829,705979059];function b(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<A.length;e++)1==(t>>e&1)&&(n^=A[e]);return n}function S(e,t,n=1){const r=e.length;let i=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);i=b(i)^n>>5}i=b(i);for(let t=0;t<r;t++)i=b(i)^31&e.charCodeAt(t);for(let e of t)i=b(i)^e;for(let e=0;e<6;e++)i=b(i);return i^=n,v.encode(f([i%2**30],30,5,!1))}function k(e){const t=\"bech32\"===e?1:734539939,n=p(5),r=n.decode,i=n.encode,o=g(r);function a(e,n,r=90){if(\"string\"!=typeof e)throw new Error(\"bech32.encode prefix should be string, not \"+typeof e);if(n instanceof Uint8Array&&(n=Array.from(n)),!Array.isArray(n)||n.length&&\"number\"!=typeof n[0])throw new Error(\"bech32.encode words should be array of numbers, not \"+typeof n);if(0===e.length)throw new TypeError(`Invalid prefix length ${e.length}`);const i=e.length+7+n.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);const o=e.toLowerCase(),a=S(o,n,t);return`${o}1${v.encode(n)}${a}`}function s(e,n=90){if(\"string\"!=typeof e)throw new Error(\"bech32.decode input should be string, not \"+typeof e);if(e.length<8||!1!==n&&e.length>n)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error(\"String must be lowercase or uppercase\");const i=r.lastIndexOf(\"1\");if(0===i||-1===i)throw new Error('Letter \"1\" must be present between prefix and data only');const o=r.slice(0,i),a=r.slice(i+1);if(a.length<6)throw new Error(\"Data must be at least 6 characters long\");const s=v.decode(a).slice(0,-6),c=S(o,s,t);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected \"${c}\"`);return{prefix:o,words:s}}return{encode:a,decode:s,encodeFromBytes:function(e,t){return a(e,i(t))},decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:g(s),fromWords:r,fromWordsUnsafe:o,toWords:i}}k(\"bech32\"),k(\"bech32m\"),t.As={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},t.uh=i(p(4),o(\"0123456789abcdef\"),a(\"\"),c(e=>{if(\"string\"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));const x={utf8:t.As,hex:t.uh,base16:t.xn,base32:t.RG,base64:t.K3,base64url:t.r0,base58:t.tw,base58xmr:t.ic},E=\"Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr\";t.Ar=(e,t)=>{if(\"string\"!=typeof e||!x.hasOwnProperty(e))throw new TypeError(E);if(!r(t))throw new TypeError(\"bytesToString() expects Uint8Array\");return x[e].encode(t)},t.Ar;t.Af=(e,t)=>{if(!x.hasOwnProperty(e))throw new TypeError(E);if(\"string\"!=typeof t)throw new TypeError(\"stringToBytes() expects string\");return x[e].decode(t)},t.Af},991(e,t){\"use strict\";t.toByteArray=function(e){var t,n,o=s(e),a=o[0],c=o[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,c=r-i;s<c;s+=a)o.push(u(e,s,s+a>c?c:s+a));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+\"==\")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+\"=\"));return o.join(\"\")};for(var n=[],r=[],i=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,o=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",a=0;a<64;++a)n[a]=o[a],r[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var n=e.indexOf(\"=\");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(c(r));return i.join(\"\")}r[\"-\".charCodeAt(0)]=62,r[\"_\".charCodeAt(0)]=63},48(e,t,n){\"use strict\";const r=n(991),i=n(318),o=\"function\"==typeof Symbol&&\"function\"==typeof Symbol.for?Symbol.for(\"nodejs.util.inspect.custom\"):null;t.hp=c,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value \"'+e+'\" is invalid for option \"size\"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if(\"number\"==typeof e){if(\"string\"==typeof t)throw new TypeError('The \"string\" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if(\"string\"==typeof e)return function(e,t){\"string\"==typeof t&&\"\"!==t||(t=\"utf8\");if(!c.isEncoding(t))throw new TypeError(\"Unknown encoding: \"+t);const n=0|g(e,t);let r=s(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if(\"undefined\"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(\"number\"==typeof e)throw new TypeError('The \"value\" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return\"number\"!=typeof e.length||J(e.length)?s(0):f(e);if(\"Buffer\"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if(\"undefined\"!=typeof Symbol&&null!=Symbol.toPrimitive&&\"function\"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive](\"string\"),t,n);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof e)}function l(e){if(\"number\"!=typeof e)throw new TypeError('\"size\" argument must be of type number');if(e<0)throw new RangeError('The value \"'+e+'\" is invalid for option \"size\"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('\"offset\" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('\"length\" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=a)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+a.toString(16)+\" bytes\");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if(\"string\"!=typeof e)throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case\"ascii\":case\"latin1\":case\"binary\":return n;case\"utf8\":case\"utf-8\":return W(e).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*n;case\"hex\":return n>>>1;case\"base64\":return V(e).length;default:if(i)return r?-1:W(e).length;t=(\"\"+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return\"\";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return\"\";if((n>>>=0)<=(t>>>=0))return\"\";for(e||(e=\"utf8\");;)switch(e){case\"hex\":return M(this,t,n);case\"utf8\":case\"utf-8\":return I(this,t,n);case\"ascii\":return B(this,t,n);case\"latin1\":case\"binary\":return C(this,t,n);case\"base64\":return E(this,t,n);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return P(this,t,n);default:if(r)throw new TypeError(\"Unknown encoding: \"+e);e=(e+\"\").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,i){if(0===e.length)return-1;if(\"string\"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if(\"string\"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if(\"number\"==typeof t)return t&=255,\"function\"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError(\"val must be string, number or Buffer\")}function v(e,t,n,r,i){let o,a=1,s=e.length,c=t.length;if(void 0!==r&&(\"ucs2\"===(r=String(r).toLowerCase())||\"ucs-2\"===r||\"utf16le\"===r||\"utf-16le\"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(u(e,o)===u(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+c>s&&(n=s-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(u(e,o+r)!==u(t,r)){n=!1;break}if(n)return o}return-1}function A(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(J(r))return a;e[n+a]=r}return a}function b(e,t,n,r){return G(W(t,e.length-n),e,n,r)}function S(e,t,n,r){return G(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function k(e,t,n,r){return G(V(t),e,n,r)}function x(e,t,n,r){return G(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let n=\"\",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=T));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||\"undefined\"==typeof console||\"function\"!=typeof console.error||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.\"),Object.defineProperty(c.prototype,\"parent\",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,\"offset\",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?s(e):void 0!==t?\"string\"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('\"list\" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))i+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('\"list\" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError(\"Buffer size must be a multiple of 32-bits\");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError(\"Buffer size must be a multiple of 64-bits\");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?\"\":0===arguments.length?I(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError(\"Argument must be a Buffer\");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e=\"\";const n=t.IS;return e=this.toString(\"hex\",0,n).replace(/(.{2})/g,\"$1 \").trim(),this.length>n&&(e+=\" ... \"),\"<Buffer \"+e+\">\"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError(\"out of range index\");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n);for(let e=0;e<s;++e)if(u[e]!==l[e]){o=u[e],a=l[e];break}return o<a?-1:a<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r=\"utf8\",n=this.length,t=0;else if(void 0===n&&\"string\"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r=\"utf8\")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");r||(r=\"utf8\");let o=!1;for(;;)switch(r){case\"hex\":return A(this,e,t,n);case\"utf8\":case\"utf-8\":return b(this,e,t,n);case\"ascii\":case\"latin1\":case\"binary\":return S(this,e,t,n);case\"base64\":return k(this,e,t,n);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return x(this,e,t,n);default:if(o)throw new TypeError(\"Unknown encoding: \"+r);r=(\"\"+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function B(e,t,n){let r=\"\";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){let r=\"\";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function M(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=\"\";for(let r=t;r<n;++r)i+=Y[e[r]];return i}function P(e,t,n){const r=e.slice(t,n);let i=\"\";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function _(e,t,n){if(e%1!=0||e<0)throw new RangeError(\"offset is not uint\");if(e+t>n)throw new RangeError(\"Trying to access beyond buffer length\")}function R(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('\"value\" argument is out of bounds');if(n+r>e.length)throw new RangeError(\"Index out of range\")}function O(e,t,n,r,i){$(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,i){$(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function N(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError(\"Index out of range\");if(n<0)throw new RangeError(\"Index out of range\")}function z(e,t,n,r,o){return t=+t,n>>>=0,o||N(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,o){return t=+t,n>>>=0,o||N(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||_(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||_(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X(function(e){K(e>>>=0,\"offset\");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),c.prototype.readBigUInt64BE=X(function(e){K(e>>>=0,\"offset\");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||_(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||_(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X(function(e){K(e>>>=0,\"offset\");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),c.prototype.readBigInt64BE=X(function(e){K(e>>>=0,\"offset\");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)}),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=X(function(e,t=0){return O(this,e,t,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),c.prototype.writeBigUInt64BE=X(function(e,t=0){return U(this,e,t,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=X(function(e,t=0){return O(this,e,t,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))}),c.prototype.writeBigInt64BE=X(function(e,t=0){return U(this,e,t,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))}),c.prototype.writeFloatLE=function(e,t,n){return z(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return z(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError(\"argument should be a Buffer\");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError(\"targetStart out of bounds\");if(n<0||n>=this.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"sourceEnd out of bounds\");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&\"function\"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},c.prototype.fill=function(e,t,n,r){if(\"string\"==typeof e){if(\"string\"==typeof t?(r=t,t=0,n=this.length):\"string\"==typeof n&&(r=n,n=this.length),void 0!==r&&\"string\"!=typeof r)throw new TypeError(\"encoding must be a string\");if(\"string\"==typeof r&&!c.isEncoding(r))throw new TypeError(\"Unknown encoding: \"+r);if(1===e.length){const t=e.charCodeAt(0);(\"utf8\"===r&&t<128||\"latin1\"===r)&&(e=t)}}else\"number\"==typeof e?e&=255:\"boolean\"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError(\"Out of range index\");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),\"number\"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const o=c.isBuffer(e)?e:c.from(e,r),a=o.length;if(0===a)throw new TypeError('The value \"'+e+'\" is invalid for argument \"value\"');for(i=0;i<n-t;++i)this[i+t]=o[i%a]}return this};const L={};function D(e,t,n){L[e]=class extends n{constructor(){super(),Object.defineProperty(this,\"message\",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,\"code\",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function j(e){let t=\"\",n=e.length;const r=\"-\"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function $(e,t,n,r,i,o){if(e>n||e<t){const r=\"bigint\"==typeof t?\"n\":\"\";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new L.ERR_OUT_OF_RANGE(\"value\",i,e)}!function(e,t,n){K(t,\"offset\"),void 0!==e[t]&&void 0!==e[t+n]||q(t,e.length-(n+1))}(r,i,o)}function K(e,t){if(\"number\"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,\"number\",e)}function q(e,t,n){if(Math.floor(e)!==e)throw K(e,n),new L.ERR_OUT_OF_RANGE(n||\"offset\",\"an integer\",e);if(t<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(n||\"offset\",`>= ${n?1:0} and <= ${t}`,e)}D(\"ERR_BUFFER_OUT_OF_BOUNDS\",function(e){return e?`${e} is outside of buffer bounds`:\"Attempt to access memory outside buffer bounds\"},RangeError),D(\"ERR_INVALID_ARG_TYPE\",function(e,t){return`The \"${e}\" argument must be of type number. Received type ${typeof t}`},TypeError),D(\"ERR_OUT_OF_RANGE\",function(e,t,n){let r=`The value of \"${e}\" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=j(String(n)):\"bigint\"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+=\"n\"),r+=` It must be ${t}. Received ${i}`,r},RangeError);const H=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error(\"Invalid code point\");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){return r.toByteArray(function(e){if((e=(e=e.split(\"=\")[0]).trim().replace(H,\"\")).length<2)return\"\";for(;e.length%4!=0;)e+=\"=\";return e}(e))}function G(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e=\"0123456789abcdef\",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function X(e){return\"undefined\"==typeof BigInt?Q:e}function Q(){throw new Error(\"BigInt not supported\")}},282(e){e.exports=a,a.default=a,a.stable=l,a.stableStringify=l;var t=\"[...]\",n=\"[Circular]\",r=[],i=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(e,t,n,a){var s;void 0===a&&(a=o()),c(e,\"\",0,[],void 0,0,a);try{s=0===i.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(e){return JSON.stringify(\"[unable to serialize, circular reference is too complex to analyze]\")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function s(e,t,n,o){var a=Object.getOwnPropertyDescriptor(o,n);void 0!==a.get?a.configurable?(Object.defineProperty(o,n,{value:e}),r.push([o,n,t,a])):i.push([t,n,e]):(o[n]=e,r.push([o,n,t]))}function c(e,r,i,o,a,u,l){var d;if(u+=1,\"object\"==typeof e&&null!==e){for(d=0;d<o.length;d++)if(o[d]===e)return void s(n,e,r,a);if(void 0!==l.depthLimit&&u>l.depthLimit)return void s(t,e,r,a);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void s(t,e,r,a);if(o.push(e),Array.isArray(e))for(d=0;d<e.length;d++)c(e[d],d,d,o,e,u,l);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var h=f[d];c(e[h],h,d,o,e,u,l)}}o.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,n,a){void 0===a&&(a=o());var s,c=d(e,\"\",0,[],void 0,0,a)||e;try{s=0===i.length?JSON.stringify(c,t,n):JSON.stringify(c,f(t),n)}catch(e){return JSON.stringify(\"[unable to serialize, circular reference is too complex to analyze]\")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function d(e,i,o,a,c,l,f){var h;if(l+=1,\"object\"==typeof e&&null!==e){for(h=0;h<a.length;h++)if(a[h]===e)return void s(n,e,i,c);try{if(\"function\"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&l>f.depthLimit)return void s(t,e,i,c);if(void 0!==f.edgesLimit&&o+1>f.edgesLimit)return void s(t,e,i,c);if(a.push(e),Array.isArray(e))for(h=0;h<e.length;h++)d(e[h],h,h,a,e,l,f);else{var p={},g=Object.keys(e).sort(u);for(h=0;h<g.length;h++){var m=g[h];d(e[m],m,h,a,e,l,f),p[m]=e[m]}if(void 0===c)return p;r.push([c,i,e]),c[i]=p}a.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(i.length>0)for(var r=0;r<i.length;r++){var o=i[r];if(o[1]===t&&o[0]===n){n=o[2],i.splice(r,1);break}}return e.call(this,t,n)}}},318(e,t){t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*g}},250(e,t,n){var r;e=n.nmd(e),function(){var i,o=\"Expected a function\",a=\"__lodash_hash_undefined__\",s=\"__lodash_placeholder__\",c=16,u=32,l=64,d=128,f=256,h=1/0,p=9007199254740991,g=NaN,m=4294967295,y=[[\"ary\",d],[\"bind\",1],[\"bindKey\",2],[\"curry\",8],[\"curryRight\",c],[\"flip\",512],[\"partial\",u],[\"partialRight\",l],[\"rearg\",f]],w=\"[object Arguments]\",v=\"[object Array]\",A=\"[object Boolean]\",b=\"[object Date]\",S=\"[object Error]\",k=\"[object Function]\",x=\"[object GeneratorFunction]\",E=\"[object Map]\",I=\"[object Number]\",T=\"[object Object]\",B=\"[object Promise]\",C=\"[object RegExp]\",M=\"[object Set]\",P=\"[object String]\",_=\"[object Symbol]\",R=\"[object WeakMap]\",O=\"[object ArrayBuffer]\",U=\"[object DataView]\",N=\"[object Float32Array]\",z=\"[object Float64Array]\",F=\"[object Int8Array]\",L=\"[object Int16Array]\",D=\"[object Int32Array]\",j=\"[object Uint8Array]\",$=\"[object Uint8ClampedArray]\",K=\"[object Uint16Array]\",q=\"[object Uint32Array]\",H=/\\b__p \\+= '';/g,W=/\\b(__p \\+=) '' \\+/g,V=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,Z=/[&<>\"']/g,J=RegExp(G.source),Y=RegExp(Z.source),X=/<%-([\\s\\S]+?)%>/g,Q=/<%([\\s\\S]+?)%>/g,ee=/<%=([\\s\\S]+?)%>/g,te=/\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,ne=/^\\w*$/,re=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,ie=/[\\\\^$.*+?()[\\]{}|]/g,oe=RegExp(ie.source),ae=/^\\s+/,se=/\\s/,ce=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,ue=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,le=/,? & /,de=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,fe=/[()=,{}\\[\\]\\/\\s]/,he=/\\\\(\\\\)?/g,pe=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,ge=/\\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,we=/^\\[object .+?Constructor\\]$/,ve=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\\d*)$/,be=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,Se=/($^)/,ke=/['\\n\\r\\u2028\\u2029\\\\]/g,xe=\"\\\\ud800-\\\\udfff\",Ee=\"\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\",Ie=\"\\\\u2700-\\\\u27bf\",Te=\"a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff\",Be=\"A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde\",Ce=\"\\\\ufe0e\\\\ufe0f\",Me=\"\\\\xac\\\\xb1\\\\xd7\\\\xf7\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf\\\\u2000-\\\\u206f \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000\",Pe=\"['’]\",_e=\"[\"+xe+\"]\",Re=\"[\"+Me+\"]\",Oe=\"[\"+Ee+\"]\",Ue=\"\\\\d+\",Ne=\"[\"+Ie+\"]\",ze=\"[\"+Te+\"]\",Fe=\"[^\"+xe+Me+Ue+Ie+Te+Be+\"]\",Le=\"\\\\ud83c[\\\\udffb-\\\\udfff]\",De=\"[^\"+xe+\"]\",je=\"(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}\",$e=\"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\",Ke=\"[\"+Be+\"]\",qe=\"\\\\u200d\",He=\"(?:\"+ze+\"|\"+Fe+\")\",We=\"(?:\"+Ke+\"|\"+Fe+\")\",Ve=\"(?:['’](?:d|ll|m|re|s|t|ve))?\",Ge=\"(?:['’](?:D|LL|M|RE|S|T|VE))?\",Ze=\"(?:\"+Oe+\"|\"+Le+\")\"+\"?\",Je=\"[\"+Ce+\"]?\",Ye=Je+Ze+(\"(?:\"+qe+\"(?:\"+[De,je,$e].join(\"|\")+\")\"+Je+Ze+\")*\"),Xe=\"(?:\"+[Ne,je,$e].join(\"|\")+\")\"+Ye,Qe=\"(?:\"+[De+Oe+\"?\",Oe,je,$e,_e].join(\"|\")+\")\",et=RegExp(Pe,\"g\"),tt=RegExp(Oe,\"g\"),nt=RegExp(Le+\"(?=\"+Le+\")|\"+Qe+Ye,\"g\"),rt=RegExp([Ke+\"?\"+ze+\"+\"+Ve+\"(?=\"+[Re,Ke,\"$\"].join(\"|\")+\")\",We+\"+\"+Ge+\"(?=\"+[Re,Ke+He,\"$\"].join(\"|\")+\")\",Ke+\"?\"+He+\"+\"+Ve,Ke+\"+\"+Ge,\"\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])\",\"\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])\",Ue,Xe].join(\"|\"),\"g\"),it=RegExp(\"[\"+qe+xe+Ee+Ce+\"]\"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,at=[\"Array\",\"Buffer\",\"DataView\",\"Date\",\"Error\",\"Float32Array\",\"Float64Array\",\"Function\",\"Int8Array\",\"Int16Array\",\"Int32Array\",\"Map\",\"Math\",\"Object\",\"Promise\",\"RegExp\",\"Set\",\"String\",\"Symbol\",\"TypeError\",\"Uint8Array\",\"Uint8ClampedArray\",\"Uint16Array\",\"Uint32Array\",\"WeakMap\",\"_\",\"clearTimeout\",\"isFinite\",\"parseInt\",\"setTimeout\"],st=-1,ct={};ct[N]=ct[z]=ct[F]=ct[L]=ct[D]=ct[j]=ct[$]=ct[K]=ct[q]=!0,ct[w]=ct[v]=ct[O]=ct[A]=ct[U]=ct[b]=ct[S]=ct[k]=ct[E]=ct[I]=ct[T]=ct[C]=ct[M]=ct[P]=ct[R]=!1;var ut={};ut[w]=ut[v]=ut[O]=ut[U]=ut[A]=ut[b]=ut[N]=ut[z]=ut[F]=ut[L]=ut[D]=ut[E]=ut[I]=ut[T]=ut[C]=ut[M]=ut[P]=ut[_]=ut[j]=ut[$]=ut[K]=ut[q]=!0,ut[S]=ut[k]=ut[R]=!1;var lt={\"\\\\\":\"\\\\\",\"'\":\"'\",\"\\n\":\"n\",\"\\r\":\"r\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},dt=parseFloat,ft=parseInt,ht=\"object\"==typeof globalThis&&globalThis&&globalThis.Object===Object&&globalThis,pt=\"object\"==typeof self&&self&&self.Object===Object&&self,gt=ht||pt||Function(\"return this\")(),mt=t&&!t.nodeType&&t,yt=mt&&e&&!e.nodeType&&e,wt=yt&&yt.exports===mt,vt=wt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require(\"util\").types;return e||vt&&vt.binding&&vt.binding(\"util\")}catch(e){}}(),bt=At&&At.isArrayBuffer,St=At&&At.isDate,kt=At&&At.isMap,xt=At&&At.isRegExp,Et=At&&At.isSet,It=At&&At.isTypedArray;function Tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Bt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Mt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Pt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function _t(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function Rt(e,t){return!!(null==e?0:e.length)&&Kt(e,t,0)>-1}function Ot(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Ut(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Nt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function zt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function Ft(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Dt=Vt(\"length\");function jt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function $t(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Kt(e,t,n){return t==t?function(e,t,n){var r=n-1,i=e.length;for(;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):$t(e,Ht,n)}function qt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Ht(e){return e!=e}function Wt(e,t){var n=null==e?0:e.length;return n?Jt(e,t)/n:g}function Vt(e){return function(t){return null==t?i:t[e]}}function Gt(e){return function(t){return null==e?i:e[t]}}function Zt(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function Jt(e,t){for(var n,r=-1,o=e.length;++r<o;){var a=t(e[r]);a!==i&&(n=n===i?a:n+a)}return n}function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Xt(e){return e?e.slice(0,mn(e)+1).replace(ae,\"\"):e}function Qt(e){return function(t){return e(t)}}function en(e,t){return Ut(t,function(t){return e[t]})}function tn(e,t){return e.has(t)}function nn(e,t){for(var n=-1,r=e.length;++n<r&&Kt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&Kt(t,e[n],0)>-1;);return n}var on=Gt({À:\"A\",Á:\"A\",Â:\"A\",Ã:\"A\",Ä:\"A\",Å:\"A\",à:\"a\",á:\"a\",â:\"a\",ã:\"a\",ä:\"a\",å:\"a\",Ç:\"C\",ç:\"c\",Ð:\"D\",ð:\"d\",È:\"E\",É:\"E\",Ê:\"E\",Ë:\"E\",è:\"e\",é:\"e\",ê:\"e\",ë:\"e\",Ì:\"I\",Í:\"I\",Î:\"I\",Ï:\"I\",ì:\"i\",í:\"i\",î:\"i\",ï:\"i\",Ñ:\"N\",ñ:\"n\",Ò:\"O\",Ó:\"O\",Ô:\"O\",Õ:\"O\",Ö:\"O\",Ø:\"O\",ò:\"o\",ó:\"o\",ô:\"o\",õ:\"o\",ö:\"o\",ø:\"o\",Ù:\"U\",Ú:\"U\",Û:\"U\",Ü:\"U\",ù:\"u\",ú:\"u\",û:\"u\",ü:\"u\",Ý:\"Y\",ý:\"y\",ÿ:\"y\",Æ:\"Ae\",æ:\"ae\",Þ:\"Th\",þ:\"th\",ß:\"ss\",Ā:\"A\",Ă:\"A\",Ą:\"A\",ā:\"a\",ă:\"a\",ą:\"a\",Ć:\"C\",Ĉ:\"C\",Ċ:\"C\",Č:\"C\",ć:\"c\",ĉ:\"c\",ċ:\"c\",č:\"c\",Ď:\"D\",Đ:\"D\",ď:\"d\",đ:\"d\",Ē:\"E\",Ĕ:\"E\",Ė:\"E\",Ę:\"E\",Ě:\"E\",ē:\"e\",ĕ:\"e\",ė:\"e\",ę:\"e\",ě:\"e\",Ĝ:\"G\",Ğ:\"G\",Ġ:\"G\",Ģ:\"G\",ĝ:\"g\",ğ:\"g\",ġ:\"g\",ģ:\"g\",Ĥ:\"H\",Ħ:\"H\",ĥ:\"h\",ħ:\"h\",Ĩ:\"I\",Ī:\"I\",Ĭ:\"I\",Į:\"I\",İ:\"I\",ĩ:\"i\",ī:\"i\",ĭ:\"i\",į:\"i\",ı:\"i\",Ĵ:\"J\",ĵ:\"j\",Ķ:\"K\",ķ:\"k\",ĸ:\"k\",Ĺ:\"L\",Ļ:\"L\",Ľ:\"L\",Ŀ:\"L\",Ł:\"L\",ĺ:\"l\",ļ:\"l\",ľ:\"l\",ŀ:\"l\",ł:\"l\",Ń:\"N\",Ņ:\"N\",Ň:\"N\",Ŋ:\"N\",ń:\"n\",ņ:\"n\",ň:\"n\",ŋ:\"n\",Ō:\"O\",Ŏ:\"O\",Ő:\"O\",ō:\"o\",ŏ:\"o\",ő:\"o\",Ŕ:\"R\",Ŗ:\"R\",Ř:\"R\",ŕ:\"r\",ŗ:\"r\",ř:\"r\",Ś:\"S\",Ŝ:\"S\",Ş:\"S\",Š:\"S\",ś:\"s\",ŝ:\"s\",ş:\"s\",š:\"s\",Ţ:\"T\",Ť:\"T\",Ŧ:\"T\",ţ:\"t\",ť:\"t\",ŧ:\"t\",Ũ:\"U\",Ū:\"U\",Ŭ:\"U\",Ů:\"U\",Ű:\"U\",Ų:\"U\",ũ:\"u\",ū:\"u\",ŭ:\"u\",ů:\"u\",ű:\"u\",ų:\"u\",Ŵ:\"W\",ŵ:\"w\",Ŷ:\"Y\",ŷ:\"y\",Ÿ:\"Y\",Ź:\"Z\",Ż:\"Z\",Ž:\"Z\",ź:\"z\",ż:\"z\",ž:\"z\",Ĳ:\"IJ\",ĳ:\"ij\",Œ:\"Oe\",œ:\"oe\",ŉ:\"'n\",ſ:\"s\"}),an=Gt({\"&\":\"&amp;\",\"<\":\"&lt;\",\">\":\"&gt;\",'\"':\"&quot;\",\"'\":\"&#39;\"});function sn(e){return\"\\\\\"+lt[e]}function cn(e){return it.test(e)}function un(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function ln(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n];a!==t&&a!==s||(e[n]=s,o[i++]=n)}return o}function fn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function hn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function pn(e){return cn(e)?function(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Dt(e)}function gn(e){return cn(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.split(\"\")}(e)}function mn(e){for(var t=e.length;t--&&se.test(e.charAt(t)););return t}var yn=Gt({\"&amp;\":\"&\",\"&lt;\":\"<\",\"&gt;\":\">\",\"&quot;\":'\"',\"&#39;\":\"'\"});var wn=function e(t){var n,r=(t=null==t?gt:wn.defaults(gt.Object(),t,wn.pick(gt,at))).Array,se=t.Date,xe=t.Error,Ee=t.Function,Ie=t.Math,Te=t.Object,Be=t.RegExp,Ce=t.String,Me=t.TypeError,Pe=r.prototype,_e=Ee.prototype,Re=Te.prototype,Oe=t[\"__core-js_shared__\"],Ue=_e.toString,Ne=Re.hasOwnProperty,ze=0,Fe=(n=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||\"\"))?\"Symbol(src)_1.\"+n:\"\",Le=Re.toString,De=Ue.call(Te),je=gt._,$e=Be(\"^\"+Ue.call(Ne).replace(ie,\"\\\\$&\").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,\"$1.*?\")+\"$\"),Ke=wt?t.Buffer:i,qe=t.Symbol,He=t.Uint8Array,We=Ke?Ke.allocUnsafe:i,Ve=ln(Te.getPrototypeOf,Te),Ge=Te.create,Ze=Re.propertyIsEnumerable,Je=Pe.splice,Ye=qe?qe.isConcatSpreadable:i,Xe=qe?qe.iterator:i,Qe=qe?qe.toStringTag:i,nt=function(){try{var e=ho(Te,\"defineProperty\");return e({},\"\",{}),e}catch(e){}}(),it=t.clearTimeout!==gt.clearTimeout&&t.clearTimeout,lt=se&&se.now!==gt.Date.now&&se.now,ht=t.setTimeout!==gt.setTimeout&&t.setTimeout,pt=Ie.ceil,mt=Ie.floor,yt=Te.getOwnPropertySymbols,vt=Ke?Ke.isBuffer:i,At=t.isFinite,Dt=Pe.join,Gt=ln(Te.keys,Te),vn=Ie.max,An=Ie.min,bn=se.now,Sn=t.parseInt,kn=Ie.random,xn=Pe.reverse,En=ho(t,\"DataView\"),In=ho(t,\"Map\"),Tn=ho(t,\"Promise\"),Bn=ho(t,\"Set\"),Cn=ho(t,\"WeakMap\"),Mn=ho(Te,\"create\"),Pn=Cn&&new Cn,_n={},Rn=Lo(En),On=Lo(In),Un=Lo(Tn),Nn=Lo(Bn),zn=Lo(Cn),Fn=qe?qe.prototype:i,Ln=Fn?Fn.valueOf:i,Dn=Fn?Fn.toString:i;function jn(e){if(ns(e)&&!Ha(e)&&!(e instanceof Hn)){if(e instanceof qn)return e;if(Ne.call(e,\"__wrapped__\"))return Do(e)}return new qn(e)}var $n=function(){function e(){}return function(t){if(!ts(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Kn(){}function qn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Gn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new Vn(e);this.size=t.size}function Yn(e,t){var n=Ha(e),r=!n&&qa(e),i=!n&&!r&&Za(e),o=!n&&!r&&!i&&ls(e),a=n||r||i||o,s=a?Yt(e.length,Ce):[],c=s.length;for(var u in e)!t&&!Ne.call(e,u)||a&&(\"length\"==u||i&&(\"offset\"==u||\"parent\"==u)||o&&(\"buffer\"==u||\"byteLength\"==u||\"byteOffset\"==u)||Ao(u,c))||s.push(u);return s}function Xn(e){var t=e.length;return t?e[Zr(0,t-1)]:i}function Qn(e,t){return No(Mi(e),cr(t,0,e.length))}function er(e){return No(Mi(e))}function tr(e,t,n){(n!==i&&!ja(e[t],n)||n===i&&!(t in e))&&ar(e,t,n)}function nr(e,t,n){var r=e[t];Ne.call(e,t)&&ja(r,n)&&(n!==i||t in e)||ar(e,t,n)}function rr(e,t){for(var n=e.length;n--;)if(ja(e[n][0],t))return n;return-1}function ir(e,t,n,r){return hr(e,function(e,i,o){t(r,e,n(e),o)}),r}function or(e,t){return e&&Pi(t,_s(t),e)}function ar(e,t,n){\"__proto__\"==t&&nt?nt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function sr(e,t){for(var n=-1,o=t.length,a=r(o),s=null==e;++n<o;)a[n]=s?i:Ts(e,t[n]);return a}function cr(e,t,n){return e==e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function ur(e,t,n,r,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,r,o,a):n(e)),s!==i)return s;if(!ts(e))return e;var d=Ha(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&\"string\"==typeof e[0]&&Ne.call(e,\"index\")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Mi(e,s)}else{var f=mo(e),h=f==k||f==x;if(Za(e))return xi(e,c);if(f==T||f==w||h&&!o){if(s=u||h?{}:wo(e),!c)return u?function(e,t){return Pi(e,go(e),t)}(e,function(e,t){return e&&Pi(t,Rs(t),e)}(s,e)):function(e,t){return Pi(e,po(e),t)}(e,or(s,e))}else{if(!ut[f])return o?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case O:return Ei(e);case A:case b:return new r(+e);case U:return function(e,t){var n=t?Ei(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case z:case F:case L:case D:case j:case $:case K:case q:return Ii(e,n);case E:return new r;case I:case P:return new r(e);case C:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return new r;case _:return i=e,Ln?Te(Ln.call(i)):{}}var i}(e,f,c)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),ss(e)?e.forEach(function(r){s.add(ur(r,t,n,r,e,a))}):rs(e)&&e.forEach(function(r,i){s.set(i,ur(r,t,n,i,e,a))});var g=d?i:(l?u?oo:io:u?Rs:_s)(e);return Ct(g||e,function(r,i){g&&(r=e[i=r]),nr(s,i,ur(r,t,n,i,e,a))}),s}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Te(e);r--;){var o=n[r],a=t[o],s=e[o];if(s===i&&!(o in e)||!a(s))return!1}return!0}function dr(e,t,n){if(\"function\"!=typeof e)throw new Me(o);return _o(function(){e.apply(i,n)},t)}function fr(e,t,n,r){var i=-1,o=Rt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Ut(t,Qt(n))),r?(o=Ot,a=!1):t.length>=200&&(o=tn,a=!1,t=new Zn(t));e:for(;++i<s;){var l=e[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var f=u;f--;)if(t[f]===d)continue e;c.push(l)}else o(t,d,r)||c.push(l)}return c}jn.templateSettings={escape:X,evaluate:Q,interpolate:ee,variable:\"\",imports:{_:jn}},jn.prototype=Kn.prototype,jn.prototype.constructor=jn,qn.prototype=$n(Kn.prototype),qn.prototype.constructor=qn,Hn.prototype=$n(Kn.prototype),Hn.prototype.constructor=Hn,Wn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Wn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wn.prototype.get=function(e){var t=this.__data__;if(Mn){var n=t[e];return n===a?i:n}return Ne.call(t,e)?t[e]:i},Wn.prototype.has=function(e){var t=this.__data__;return Mn?t[e]!==i:Ne.call(t,e)},Wn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Mn&&t===i?a:t,this},Vn.prototype.clear=function(){this.__data__=[],this.size=0},Vn.prototype.delete=function(e){var t=this.__data__,n=rr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,!0)},Vn.prototype.get=function(e){var t=this.__data__,n=rr(t,e);return n<0?i:t[n][1]},Vn.prototype.has=function(e){return rr(this.__data__,e)>-1},Vn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(In||Vn),string:new Wn}},Gn.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},Gn.prototype.get=function(e){return lo(this,e).get(e)},Gn.prototype.has=function(e){return lo(this,e).has(e)},Gn.prototype.set=function(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Zn.prototype.add=Zn.prototype.push=function(e){return this.__data__.set(e,a),this},Zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new Vn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Vn){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gn(r)}return n.set(e,t),this.size=n.size,this};var hr=Oi(br),pr=Oi(Sr,!0);function gr(e,t){var n=!0;return hr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function mr(e,t,n){for(var r=-1,o=e.length;++r<o;){var a=e[r],s=t(a);if(null!=s&&(c===i?s==s&&!us(s):n(s,c)))var c=s,u=a}return u}function yr(e,t){var n=[];return hr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function wr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=vo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?wr(s,t-1,n,r,i):Nt(i,s):r||(i[i.length]=s)}return i}var vr=Ui(),Ar=Ui(!0);function br(e,t){return e&&vr(e,t,_s)}function Sr(e,t){return e&&Ar(e,t,_s)}function kr(e,t){return _t(t,function(t){return Xa(e[t])})}function xr(e,t){for(var n=0,r=(t=Ai(t,e)).length;null!=e&&n<r;)e=e[Fo(t[n++])];return n&&n==r?e:i}function Er(e,t,n){var r=t(e);return Ha(e)?r:Nt(r,n(e))}function Ir(e){return null==e?e===i?\"[object Undefined]\":\"[object Null]\":Qe&&Qe in Te(e)?function(e){var t=Ne.call(e,Qe),n=e[Qe];try{e[Qe]=i;var r=!0}catch(e){}var o=Le.call(e);r&&(t?e[Qe]=n:delete e[Qe]);return o}(e):function(e){return Le.call(e)}(e)}function Tr(e,t){return e>t}function Br(e,t){return null!=e&&Ne.call(e,t)}function Cr(e,t){return null!=e&&t in Te(e)}function Mr(e,t,n){for(var o=n?Ot:Rt,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Ut(f,Qt(t))),l=An(f.length,l),u[c]=!n&&(t||a>=120&&f.length>=120)?new Zn(c&&f):i}f=e[0];var h=-1,p=u[0];e:for(;++h<a&&d.length<l;){var g=f[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(p?tn(p,m):o(d,m,n))){for(c=s;--c;){var y=u[c];if(!(y?tn(y,m):o(e[c],m,n)))continue e}p&&p.push(m),d.push(g)}}return d}function Pr(e,t,n){var r=null==(e=Co(e,t=Ai(t,e)))?e:e[Fo(Yo(t))];return null==r?i:Tt(r,e,n)}function _r(e){return ns(e)&&Ir(e)==w}function Rr(e,t,n,r,o){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,n,r,o,a){var s=Ha(e),c=Ha(t),u=s?v:mo(e),l=c?v:mo(t),d=(u=u==w?T:u)==T,f=(l=l==w?T:l)==T,h=u==l;if(h&&Za(e)){if(!Za(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Jn),s||ls(e)?no(e,t,n,r,o,a):function(e,t,n,r,i,o,a){switch(n){case U:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case O:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case A:case b:case I:return ja(+e,+t);case S:return e.name==t.name&&e.message==t.message;case C:case P:return e==t+\"\";case E:var s=un;case M:var c=1&r;if(s||(s=fn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=no(s(e),s(t),r,i,o,a);return a.delete(e),l;case _:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(e,t,u,n,r,o,a);if(!(1&n)){var p=d&&Ne.call(e,\"__wrapped__\"),g=f&&Ne.call(t,\"__wrapped__\");if(p||g){var m=p?e.value():e,y=g?t.value():t;return a||(a=new Jn),o(m,y,n,r,a)}}if(!h)return!1;return a||(a=new Jn),function(e,t,n,r,o,a){var s=1&n,c=io(e),u=c.length,l=io(t),d=l.length;if(u!=d&&!s)return!1;var f=u;for(;f--;){var h=c[f];if(!(s?h in t:Ne.call(t,h)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);var y=s;for(;++f<u;){var w=e[h=c[f]],v=t[h];if(r)var A=s?r(v,w,h,t,e,a):r(w,v,h,e,t,a);if(!(A===i?w===v||o(w,v,n,r,a):A)){m=!1;break}y||(y=\"constructor\"==h)}if(m&&!y){var b=e.constructor,S=t.constructor;b==S||!(\"constructor\"in e)||!(\"constructor\"in t)||\"function\"==typeof b&&b instanceof b&&\"function\"==typeof S&&S instanceof S||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,r,o,a)}(e,t,n,r,Rr,o))}function Or(e,t,n,r){var o=n.length,a=o,s=!r;if(null==e)return!a;for(e=Te(e);o--;){var c=n[o];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++o<a;){var u=(c=n[o])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===i&&!(u in e))return!1}else{var f=new Jn;if(r)var h=r(l,d,u,e,t,f);if(!(h===i?Rr(d,l,3,r,f):h))return!1}}return!0}function Ur(e){return!(!ts(e)||(t=e,Fe&&Fe in t))&&(Xa(e)?$e:we).test(Lo(e));var t}function Nr(e){return\"function\"==typeof e?e:null==e?ic:\"object\"==typeof e?Ha(e)?$r(e[0],e[1]):jr(e):hc(e)}function zr(e){if(!Eo(e))return Gt(e);var t=[];for(var n in Te(e))Ne.call(e,n)&&\"constructor\"!=n&&t.push(n);return t}function Fr(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in Te(e))t.push(n);return t}(e);var t=Eo(e),n=[];for(var r in e)(\"constructor\"!=r||!t&&Ne.call(e,r))&&n.push(r);return n}function Lr(e,t){return e<t}function Dr(e,t){var n=-1,i=Va(e)?r(e.length):[];return hr(e,function(e,r,o){i[++n]=t(e,r,o)}),i}function jr(e){var t=fo(e);return 1==t.length&&t[0][2]?To(t[0][0],t[0][1]):function(n){return n===e||Or(n,e,t)}}function $r(e,t){return So(e)&&Io(t)?To(Fo(e),t):function(n){var r=Ts(n,e);return r===i&&r===t?Bs(n,e):Rr(t,r,3)}}function Kr(e,t,n,r,o){e!==t&&vr(t,function(a,s){if(o||(o=new Jn),ts(a))!function(e,t,n,r,o,a,s){var c=Mo(e,n),u=Mo(t,n),l=s.get(u);if(l)return void tr(e,n,l);var d=a?a(c,u,n+\"\",e,t,s):i,f=d===i;if(f){var h=Ha(u),p=!h&&Za(u),g=!h&&!p&&ls(u);d=u,h||p||g?Ha(c)?d=c:Ga(c)?d=Mi(c):p?(f=!1,d=xi(u,!0)):g?(f=!1,d=Ii(u,!0)):d=[]:os(u)||qa(u)?(d=c,qa(c)?d=ws(c):ts(c)&&!Xa(c)||(d=wo(u))):f=!1}f&&(s.set(u,d),o(d,u,r,a,s),s.delete(u));tr(e,n,d)}(e,t,s,n,Kr,r,o);else{var c=r?r(Mo(e,s),a,s+\"\",e,t,o):i;c===i&&(c=a),tr(e,s,c)}},Rs)}function qr(e,t){var n=e.length;if(n)return Ao(t+=t<0?n:0,n)?e[t]:i}function Hr(e,t,n){t=t.length?Ut(t,function(e){return Ha(e)?function(t){return xr(t,1===e.length?e[0]:e)}:e}):[ic];var r=-1;t=Ut(t,Qt(uo()));var i=Dr(e,function(e,n,i){var o=Ut(t,function(t){return t(e)});return{criteria:o,index:++r,value:e}});return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,function(e,t){return function(e,t,n){var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;for(;++r<a;){var c=Ti(i[r],o[r]);if(c)return r>=s?c:c*(\"desc\"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function Wr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=xr(e,a);n(s,a)&&ei(o,Ai(a,e),s)}return o}function Vr(e,t,n,r){var i=r?qt:Kt,o=-1,a=t.length,s=e;for(e===t&&(t=Mi(t)),n&&(s=Ut(e,Qt(n)));++o<a;)for(var c=0,u=t[o],l=n?n(u):u;(c=i(s,l,c,r))>-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;Ao(i)?Je.call(e,i,1):fi(e,i)}}return e}function Zr(e,t){return e+mt(kn()*(t-e+1))}function Jr(e,t){var n=\"\";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Ro(Bo(e,t,ic),e+\"\")}function Xr(e){return Xn(js(e))}function Qr(e,t){var n=js(e);return No(n,cr(t,0,n.length))}function ei(e,t,n,r){if(!ts(e))return e;for(var o=-1,a=(t=Ai(t,e)).length,s=a-1,c=e;null!=c&&++o<a;){var u=Fo(t[o]),l=n;if(\"__proto__\"===u||\"constructor\"===u||\"prototype\"===u)return e;if(o!=s){var d=c[u];(l=r?r(d,u,c):i)===i&&(l=ts(d)?d:Ao(t[o+1])?[]:{})}nr(c,u,l),c=c[u]}return e}var ti=Pn?function(e,t){return Pn.set(e,t),e}:ic,ni=nt?function(e,t){return nt(e,\"toString\",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:ic;function ri(e){return No(js(e))}function ii(e,t,n){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i<o;)a[i]=e[i+t];return a}function oi(e,t){var n;return hr(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ai(e,t,n){var r=0,i=null==e?r:e.length;if(\"number\"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!us(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return si(e,t,ic,n)}function si(e,t,n,r){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=us(t),l=t===i;o<a;){var d=mt((o+a)/2),f=n(e[d]),h=f!==i,p=null===f,g=f==f,m=us(f);if(s)var y=r||g;else y=l?g&&(r||h):c?g&&h&&(r||!p):u?g&&h&&!p&&(r||!m):!p&&!m&&(r?f<=t:f<t);y?o=d+1:a=d}return An(a,4294967294)}function ci(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!ja(s,c)){var c=s;o[i++]=0===a?0:a}}return o}function ui(e){return\"number\"==typeof e?e:us(e)?g:+e}function li(e){if(\"string\"==typeof e)return e;if(Ha(e))return Ut(e,li)+\"\";if(us(e))return Dn?Dn.call(e):\"\";var t=e+\"\";return\"0\"==t&&1/e==-1/0?\"-0\":t}function di(e,t,n){var r=-1,i=Rt,o=e.length,a=!0,s=[],c=s;if(n)a=!1,i=Ot;else if(o>=200){var u=t?null:Ji(e);if(u)return fn(u);a=!1,i=tn,c=new Zn}else c=t?[]:s;e:for(;++r<o;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(l)}else i(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function fi(e,t){var n=-1,r=(t=Ai(t,e)).length;if(!r)return!0;for(;++n<r;){var i=Fo(t[n]);if(\"__proto__\"===i&&!Ne.call(e,\"__proto__\"))return!1;if((\"constructor\"===i||\"prototype\"===i)&&n<r-1)return!1}var o=Co(e,t);return null==o||delete o[Fo(Yo(t))]}function hi(e,t,n,r){return ei(e,t,n(xr(e,t)),r)}function pi(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ii(e,r?0:o,r?o+1:i):ii(e,r?o+1:0,r?i:o)}function gi(e,t){var n=e;return n instanceof Hn&&(n=n.value()),zt(t,function(e,t){return t.func.apply(t.thisArg,Nt([e],t.args))},n)}function mi(e,t,n){var i=e.length;if(i<2)return i?di(e[0]):[];for(var o=-1,a=r(i);++o<i;)for(var s=e[o],c=-1;++c<i;)c!=o&&(a[o]=fr(a[o]||s,e[c],t,n));return di(wr(a,1),t,n)}function yi(e,t,n){for(var r=-1,o=e.length,a=t.length,s={};++r<o;){var c=r<a?t[r]:i;n(s,e[r],c)}return s}function wi(e){return Ga(e)?e:[]}function vi(e){return\"function\"==typeof e?e:ic}function Ai(e,t){return Ha(e)?e:So(e,t)?[e]:zo(vs(e))}var bi=Yr;function Si(e,t,n){var r=e.length;return n=n===i?r:n,!t&&n>=r?e:ii(e,t,n)}var ki=it||function(e){return gt.clearTimeout(e)};function xi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function Ei(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function Ii(e,t){var n=t?Ei(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ti(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=us(e),s=t!==i,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!o)return 1;if(!r&&!a&&!l&&e<t||l&&n&&o&&!r&&!a||c&&n&&o||!s&&o||!u)return-1}return 0}function Bi(e,t,n,i){for(var o=-1,a=e.length,s=n.length,c=-1,u=t.length,l=vn(a-s,0),d=r(u+l),f=!i;++c<u;)d[c]=t[c];for(;++o<s;)(f||o<a)&&(d[n[o]]=e[o]);for(;l--;)d[c++]=e[o++];return d}function Ci(e,t,n,i){for(var o=-1,a=e.length,s=-1,c=n.length,u=-1,l=t.length,d=vn(a-c,0),f=r(d+l),h=!i;++o<d;)f[o]=e[o];for(var p=o;++u<l;)f[p+u]=t[u];for(;++s<c;)(h||o<a)&&(f[p+n[s]]=e[o++]);return f}function Mi(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function Pi(e,t,n,r){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=r?r(n[c],e[c],c,n,e):i;u===i&&(u=e[c]),o?ar(n,c,u):nr(n,c,u)}return n}function _i(e,t){return function(n,r){var i=Ha(n)?Bt:ir,o=t?t():{};return i(n,e,uo(r,2),o)}}function Ri(e){return Yr(function(t,n){var r=-1,o=n.length,a=o>1?n[o-1]:i,s=o>2?n[2]:i;for(a=e.length>3&&\"function\"==typeof a?(o--,a):i,s&&bo(n[0],n[1],s)&&(a=o<3?i:a,o=1),t=Te(t);++r<o;){var c=n[r];c&&e(t,c,r,a)}return t})}function Oi(e,t){return function(n,r){if(null==n)return n;if(!Va(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Te(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Ui(e){return function(t,n,r){for(var i=-1,o=Te(t),a=r(t),s=a.length;s--;){var c=a[e?s:++i];if(!1===n(o[c],c,o))break}return t}}function Ni(e){return function(t){var n=cn(t=vs(t))?gn(t):i,r=n?n[0]:t.charAt(0),o=n?Si(n,1).join(\"\"):t.slice(1);return r[e]()+o}}function zi(e){return function(t){return zt(Xs(qs(t).replace(et,\"\")),e,\"\")}}function Fi(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=$n(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Li(e){return function(t,n,r){var o=Te(t);if(!Va(t)){var a=uo(n,3);t=_s(t),n=function(e){return a(o[e],e,o)}}var s=e(t,n,r);return s>-1?o[a?t[s]:s]:i}}function Di(e){return ro(function(t){var n=t.length,r=n,a=qn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if(\"function\"!=typeof s)throw new Me(o);if(a&&!c&&\"wrapper\"==so(s))var c=new qn([],!0)}for(r=c?r:n;++r<n;){var u=so(s=t[r]),l=\"wrapper\"==u?ao(s):i;c=l&&ko(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[so(l[0])].apply(c,l[3]):1==s.length&&ko(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&Ha(r))return c.plant(r).value();for(var i=0,o=n?t[i].apply(this,e):r;++i<n;)o=t[i].call(this,o);return o}})}function ji(e,t,n,o,a,s,c,u,l,f){var h=t&d,p=1&t,g=2&t,m=24&t,y=512&t,w=g?i:Fi(e);return function d(){for(var v=arguments.length,A=r(v),b=v;b--;)A[b]=arguments[b];if(m)var S=co(d),k=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(A,S);if(o&&(A=Bi(A,o,a,m)),s&&(A=Ci(A,s,c,m)),v-=k,m&&v<f){var x=dn(A,S);return Gi(e,t,ji,d.placeholder,n,A,x,u,l,f-v)}var E=p?n:this,I=g?E[e]:e;return v=A.length,u?A=function(e,t){var n=e.length,r=An(t.length,n),o=Mi(e);for(;r--;){var a=t[r];e[r]=Ao(a,n)?o[a]:i}return e}(A,u):y&&v>1&&A.reverse(),h&&l<v&&(A.length=l),this&&this!==gt&&this instanceof d&&(I=w||Fi(I)),I.apply(E,A)}}function $i(e,t){return function(n,r){return function(e,t,n,r){return br(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ki(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;\"string\"==typeof n||\"string\"==typeof r?(n=li(n),r=li(r)):(n=ui(n),r=ui(r)),o=e(n,r)}return o}}function qi(e){return ro(function(t){return t=Ut(t,Qt(uo())),Yr(function(n){var r=this;return e(t,function(e){return Tt(e,r,n)})})})}function Hi(e,t){var n=(t=t===i?\" \":li(t)).length;if(n<2)return n?Jr(t,e):t;var r=Jr(t,pt(e/pn(t)));return cn(t)?Si(gn(r),0,e).join(\"\"):r.slice(0,e)}function Wi(e){return function(t,n,o){return o&&\"number\"!=typeof o&&bo(t,n,o)&&(n=o=i),t=ps(t),n===i?(n=t,t=0):n=ps(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),s=r(a);a--;)s[i?a:++o]=e,e+=n;return s}(t,n,o=o===i?t<n?1:-1:ps(o),e)}}function Vi(e){return function(t,n){return\"string\"==typeof t&&\"string\"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Gi(e,t,n,r,o,a,s,c,d,f){var h=8&t;t|=h?u:l,4&(t&=~(h?l:u))||(t&=-4);var p=[e,t,o,h?a:i,h?s:i,h?i:a,h?i:s,c,d,f],g=n.apply(i,p);return ko(e)&&Po(g,p),g.placeholder=r,Oo(g,e,t)}function Zi(e){var t=Ie[e];return function(e,n){if(e=ys(e),(n=null==n?0:An(gs(n),292))&&At(e)){var r=(vs(e)+\"e\").split(\"e\");return+((r=(vs(t(r[0]+\"e\"+(+r[1]+n)))+\"e\").split(\"e\"))[0]+\"e\"+(+r[1]-n))}return t(e)}}var Ji=Bn&&1/fn(new Bn([,-0]))[1]==h?function(e){return new Bn(e)}:uc;function Yi(e){return function(t){var n=mo(t);return n==E?un(t):n==M?hn(t):function(e,t){return Ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function Xi(e,t,n,a,h,p,g,m){var y=2&t;if(!y&&\"function\"!=typeof e)throw new Me(o);var w=a?a.length:0;if(w||(t&=-97,a=h=i),g=g===i?g:vn(gs(g),0),m=m===i?m:gs(m),w-=h?h.length:0,t&l){var v=a,A=h;a=h=i}var b=y?i:ao(e),S=[e,t,n,a,h,v,A,p,g,m];if(b&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,a=r==d&&8==n||r==d&&n==f&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!a)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?Bi(u,c,t[4]):c,e[4]=u?dn(e[3],s):t[4]}(c=t[5])&&(u=e[5],e[5]=u?Ci(u,c,t[6]):c,e[6]=u?dn(e[5],s):t[6]);(c=t[7])&&(e[7]=c);r&d&&(e[8]=null==e[8]?t[8]:An(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(S,b),e=S[0],t=S[1],n=S[2],a=S[3],h=S[4],!(m=S[9]=S[9]===i?y?0:e.length:vn(S[9]-w,0))&&24&t&&(t&=-25),t&&1!=t)k=8==t||t==c?function(e,t,n){var o=Fi(e);return function a(){for(var s=arguments.length,c=r(s),u=s,l=co(a);u--;)c[u]=arguments[u];var d=s<3&&c[0]!==l&&c[s-1]!==l?[]:dn(c,l);return(s-=d.length)<n?Gi(e,t,ji,a.placeholder,i,c,d,i,i,n-s):Tt(this&&this!==gt&&this instanceof a?o:e,this,c)}}(e,t,m):t!=u&&33!=t||h.length?ji.apply(i,S):function(e,t,n,i){var o=1&t,a=Fi(e);return function t(){for(var s=-1,c=arguments.length,u=-1,l=i.length,d=r(l+c),f=this&&this!==gt&&this instanceof t?a:e;++u<l;)d[u]=i[u];for(;c--;)d[u++]=arguments[++s];return Tt(f,o?n:this,d)}}(e,t,n,a);else var k=function(e,t,n){var r=1&t,i=Fi(e);return function t(){return(this&&this!==gt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,n);return Oo((b?ti:Po)(k,S),e,t)}function Qi(e,t,n,r){return e===i||ja(e,Re[n])&&!Ne.call(r,n)?t:e}function eo(e,t,n,r,o,a){return ts(e)&&ts(t)&&(a.set(t,e),Kr(e,t,i,eo,a),a.delete(t)),e}function to(e){return os(e)?i:e}function no(e,t,n,r,o,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Zn:i;for(a.set(e,t),a.set(t,e);++f<c;){var g=e[f],m=t[f];if(r)var y=s?r(m,g,f,t,e,a):r(g,m,f,e,t,a);if(y!==i){if(y)continue;h=!1;break}if(p){if(!Lt(t,function(e,t){if(!tn(p,t)&&(g===e||o(g,e,n,r,a)))return p.push(t)})){h=!1;break}}else if(g!==m&&!o(g,m,n,r,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function ro(e){return Ro(Bo(e,i,Wo),e+\"\")}function io(e){return Er(e,_s,po)}function oo(e){return Er(e,Rs,go)}var ao=Pn?function(e){return Pn.get(e)}:uc;function so(e){for(var t=e.name+\"\",n=_n[t],r=Ne.call(_n,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function co(e){return(Ne.call(jn,\"placeholder\")?jn:e).placeholder}function uo(){var e=jn.iteratee||oc;return e=e===oc?Nr:e,arguments.length?e(arguments[0],arguments[1]):e}function lo(e,t){var n,r,i=e.__data__;return(\"string\"==(r=typeof(n=t))||\"number\"==r||\"symbol\"==r||\"boolean\"==r?\"__proto__\"!==n:null===n)?i[\"string\"==typeof t?\"string\":\"hash\"]:i.map}function fo(e){for(var t=_s(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Io(i)]}return t}function ho(e,t){var n=function(e,t){return null==e?i:e[t]}(e,t);return Ur(n)?n:i}var po=yt?function(e){return null==e?[]:(e=Te(e),_t(yt(e),function(t){return Ze.call(e,t)}))}:mc,go=yt?function(e){for(var t=[];e;)Nt(t,po(e)),e=Ve(e);return t}:mc,mo=Ir;function yo(e,t,n){for(var r=-1,i=(t=Ai(t,e)).length,o=!1;++r<i;){var a=Fo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&es(i)&&Ao(a,i)&&(Ha(e)||qa(e))}function wo(e){return\"function\"!=typeof e.constructor||Eo(e)?{}:$n(Ve(e))}function vo(e){return Ha(e)||qa(e)||!!(Ye&&e&&e[Ye])}function Ao(e,t){var n=typeof e;return!!(t=t??p)&&(\"number\"==n||\"symbol\"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t}function bo(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!(\"number\"==r?Va(n)&&Ao(t,n.length):\"string\"==r&&t in n)&&ja(n[t],e)}function So(e,t){if(Ha(e))return!1;var n=typeof e;return!(\"number\"!=n&&\"symbol\"!=n&&\"boolean\"!=n&&null!=e&&!us(e))||(ne.test(e)||!te.test(e)||null!=t&&e in Te(t))}function ko(e){var t=so(e),n=jn[t];if(\"function\"!=typeof n||!(t in Hn.prototype))return!1;if(e===n)return!0;var r=ao(n);return!!r&&e===r[0]}(En&&mo(new En(new ArrayBuffer(1)))!=U||In&&mo(new In)!=E||Tn&&mo(Tn.resolve())!=B||Bn&&mo(new Bn)!=M||Cn&&mo(new Cn)!=R)&&(mo=function(e){var t=Ir(e),n=t==T?e.constructor:i,r=n?Lo(n):\"\";if(r)switch(r){case Rn:return U;case On:return E;case Un:return B;case Nn:return M;case zn:return R}return t});var xo=Oe?Xa:yc;function Eo(e){var t=e&&e.constructor;return e===(\"function\"==typeof t&&t.prototype||Re)}function Io(e){return e==e&&!ts(e)}function To(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==i||e in Te(n)))}}function Bo(e,t,n){return t=vn(t===i?e.length-1:t,0),function(){for(var i=arguments,o=-1,a=vn(i.length-t,0),s=r(a);++o<a;)s[o]=i[t+o];o=-1;for(var c=r(t+1);++o<t;)c[o]=i[o];return c[t]=n(s),Tt(e,this,c)}}function Co(e,t){return t.length<2?e:xr(e,ii(t,0,-1))}function Mo(e,t){if((\"constructor\"!==t||\"function\"!=typeof e[t])&&\"__proto__\"!=t)return e[t]}var Po=Uo(ti),_o=ht||function(e,t){return gt.setTimeout(e,t)},Ro=Uo(ni);function Oo(e,t,n){var r=t+\"\";return Ro(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?\"& \":\"\")+t[r],t=t.join(n>2?\", \":\" \"),e.replace(ce,\"{\\n/* [wrapped with \"+t+\"] */\\n\")}(r,function(e,t){return Ct(y,function(n){var r=\"_.\"+n[0];t&n[1]&&!Rt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Uo(e){var t=0,n=0;return function(){var r=bn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function No(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n<t;){var a=Zr(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var zo=function(e){var t=Ua(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(\"\"),e.replace(re,function(e,n,r,i){t.push(r?i.replace(he,\"$1\"):n||e)}),t});function Fo(e){if(\"string\"==typeof e||us(e))return e;var t=e+\"\";return\"0\"==t&&1/e==-1/0?\"-0\":t}function Lo(e){if(null!=e){try{return Ue.call(e)}catch(e){}try{return e+\"\"}catch(e){}}return\"\"}function Do(e){if(e instanceof Hn)return e.clone();var t=new qn(e.__wrapped__,e.__chain__);return t.__actions__=Mi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var jo=Yr(function(e,t){return Ga(e)?fr(e,wr(t,1,Ga,!0)):[]}),$o=Yr(function(e,t){var n=Yo(t);return Ga(n)&&(n=i),Ga(e)?fr(e,wr(t,1,Ga,!0),uo(n,2)):[]}),Ko=Yr(function(e,t){var n=Yo(t);return Ga(n)&&(n=i),Ga(e)?fr(e,wr(t,1,Ga,!0),i,n):[]});function qo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:gs(n);return i<0&&(i=vn(r+i,0)),$t(e,uo(t,3),i)}function Ho(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r-1;return n!==i&&(o=gs(n),o=n<0?vn(r+o,0):An(o,r-1)),$t(e,uo(t,3),o,!0)}function Wo(e){return(null==e?0:e.length)?wr(e,1):[]}function Vo(e){return e&&e.length?e[0]:i}var Go=Yr(function(e){var t=Ut(e,wi);return t.length&&t[0]===e[0]?Mr(t):[]}),Zo=Yr(function(e){var t=Yo(e),n=Ut(e,wi);return t===Yo(n)?t=i:n.pop(),n.length&&n[0]===e[0]?Mr(n,uo(t,2)):[]}),Jo=Yr(function(e){var t=Yo(e),n=Ut(e,wi);return(t=\"function\"==typeof t?t:i)&&n.pop(),n.length&&n[0]===e[0]?Mr(n,i,t):[]});function Yo(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Xo=Yr(Qo);function Qo(e,t){return e&&e.length&&t&&t.length?Vr(e,t):e}var ea=ro(function(e,t){var n=null==e?0:e.length,r=sr(e,t);return Gr(e,Ut(t,function(e){return Ao(e,n)?+e:e}).sort(Ti)),r});function ta(e){return null==e?e:xn.call(e)}var na=Yr(function(e){return di(wr(e,1,Ga,!0))}),ra=Yr(function(e){var t=Yo(e);return Ga(t)&&(t=i),di(wr(e,1,Ga,!0),uo(t,2))}),ia=Yr(function(e){var t=Yo(e);return t=\"function\"==typeof t?t:i,di(wr(e,1,Ga,!0),i,t)});function oa(e){if(!e||!e.length)return[];var t=0;return e=_t(e,function(e){if(Ga(e))return t=vn(e.length,t),!0}),Yt(t,function(t){return Ut(e,Vt(t))})}function aa(e,t){if(!e||!e.length)return[];var n=oa(e);return null==t?n:Ut(n,function(e){return Tt(t,i,e)})}var sa=Yr(function(e,t){return Ga(e)?fr(e,t):[]}),ca=Yr(function(e){return mi(_t(e,Ga))}),ua=Yr(function(e){var t=Yo(e);return Ga(t)&&(t=i),mi(_t(e,Ga),uo(t,2))}),la=Yr(function(e){var t=Yo(e);return t=\"function\"==typeof t?t:i,mi(_t(e,Ga),i,t)}),da=Yr(oa);var fa=Yr(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=\"function\"==typeof n?(e.pop(),n):i,aa(e,n)});function ha(e){var t=jn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ga=ro(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return sr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Hn&&Ao(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new qn(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(i),e})):this.thru(o)});var ma=_i(function(e,t,n){Ne.call(e,n)?++e[n]:ar(e,n,1)});var ya=Li(qo),wa=Li(Ho);function va(e,t){return(Ha(e)?Ct:hr)(e,uo(t,3))}function Aa(e,t){return(Ha(e)?Mt:pr)(e,uo(t,3))}var ba=_i(function(e,t,n){Ne.call(e,n)?e[n].push(t):ar(e,n,[t])});var Sa=Yr(function(e,t,n){var i=-1,o=\"function\"==typeof t,a=Va(e)?r(e.length):[];return hr(e,function(e){a[++i]=o?Tt(t,e,n):Pr(e,t,n)}),a}),ka=_i(function(e,t,n){ar(e,n,t)});function xa(e,t){return(Ha(e)?Ut:Dr)(e,uo(t,3))}var Ea=_i(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});var Ia=Yr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&bo(e,t[0],t[1])?t=[]:n>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,wr(t,1),[])}),Ta=lt||function(){return gt.Date.now()};function Ba(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Xi(e,d,i,i,i,i,t)}function Ca(e,t){var n;if(\"function\"!=typeof t)throw new Me(o);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ma=Yr(function(e,t,n){var r=1;if(n.length){var i=dn(n,co(Ma));r|=u}return Xi(e,r,t,n,i)}),Pa=Yr(function(e,t,n){var r=3;if(n.length){var i=dn(n,co(Pa));r|=u}return Xi(t,r,e,n,i)});function _a(e,t,n){var r,a,s,c,u,l,d=0,f=!1,h=!1,p=!0;if(\"function\"!=typeof e)throw new Me(o);function g(t){var n=r,o=a;return r=a=i,d=t,c=e.apply(o,n)}function m(e){var n=e-l;return l===i||n>=t||n<0||h&&e-d>=s}function y(){var e=Ta();if(m(e))return w(e);u=_o(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function w(e){return u=i,p&&r?g(e):(r=a=i,c)}function v(){var e=Ta(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===i)return function(e){return d=e,u=_o(y,t),f?g(e):c}(l);if(h)return ki(u),u=_o(y,t),g(l)}return u===i&&(u=_o(y,t)),c}return t=ys(t)||0,ts(n)&&(f=!!n.leading,s=(h=\"maxWait\"in n)?vn(ys(n.maxWait)||0,t):s,p=\"trailing\"in n?!!n.trailing:p),v.cancel=function(){u!==i&&ki(u),d=0,r=l=a=u=i},v.flush=function(){return u===i?c:w(Ta())},v}var Ra=Yr(function(e,t){return dr(e,1,t)}),Oa=Yr(function(e,t,n){return dr(e,ys(t)||0,n)});function Ua(e,t){if(\"function\"!=typeof e||null!=t&&\"function\"!=typeof t)throw new Me(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ua.Cache||Gn),n}function Na(e){if(\"function\"!=typeof e)throw new Me(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ua.Cache=Gn;var za=bi(function(e,t){var n=(t=1==t.length&&Ha(t[0])?Ut(t[0],Qt(uo())):Ut(wr(t,1),Qt(uo()))).length;return Yr(function(r){for(var i=-1,o=An(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return Tt(e,this,r)})}),Fa=Yr(function(e,t){var n=dn(t,co(Fa));return Xi(e,u,i,t,n)}),La=Yr(function(e,t){var n=dn(t,co(La));return Xi(e,l,i,t,n)}),Da=ro(function(e,t){return Xi(e,f,i,i,i,t)});function ja(e,t){return e===t||e!=e&&t!=t}var $a=Vi(Tr),Ka=Vi(function(e,t){return e>=t}),qa=_r(function(){return arguments}())?_r:function(e){return ns(e)&&Ne.call(e,\"callee\")&&!Ze.call(e,\"callee\")},Ha=r.isArray,Wa=bt?Qt(bt):function(e){return ns(e)&&Ir(e)==O};function Va(e){return null!=e&&es(e.length)&&!Xa(e)}function Ga(e){return ns(e)&&Va(e)}var Za=vt||yc,Ja=St?Qt(St):function(e){return ns(e)&&Ir(e)==b};function Ya(e){if(!ns(e))return!1;var t=Ir(e);return t==S||\"[object DOMException]\"==t||\"string\"==typeof e.message&&\"string\"==typeof e.name&&!os(e)}function Xa(e){if(!ts(e))return!1;var t=Ir(e);return t==k||t==x||\"[object AsyncFunction]\"==t||\"[object Proxy]\"==t}function Qa(e){return\"number\"==typeof e&&e==gs(e)}function es(e){return\"number\"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&(\"object\"==t||\"function\"==t)}function ns(e){return null!=e&&\"object\"==typeof e}var rs=kt?Qt(kt):function(e){return ns(e)&&mo(e)==E};function is(e){return\"number\"==typeof e||ns(e)&&Ir(e)==I}function os(e){if(!ns(e)||Ir(e)!=T)return!1;var t=Ve(e);if(null===t)return!0;var n=Ne.call(t,\"constructor\")&&t.constructor;return\"function\"==typeof n&&n instanceof n&&Ue.call(n)==De}var as=xt?Qt(xt):function(e){return ns(e)&&Ir(e)==C};var ss=Et?Qt(Et):function(e){return ns(e)&&mo(e)==M};function cs(e){return\"string\"==typeof e||!Ha(e)&&ns(e)&&Ir(e)==P}function us(e){return\"symbol\"==typeof e||ns(e)&&Ir(e)==_}var ls=It?Qt(It):function(e){return ns(e)&&es(e.length)&&!!ct[Ir(e)]};var ds=Vi(Lr),fs=Vi(function(e,t){return e<=t});function hs(e){if(!e)return[];if(Va(e))return cs(e)?gn(e):Mi(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=mo(e);return(t==E?un:t==M?fn:js)(e)}function ps(e){return e?(e=ys(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function ms(e){return e?cr(gs(e),0,m):0}function ys(e){if(\"number\"==typeof e)return e;if(us(e))return g;if(ts(e)){var t=\"function\"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+\"\":t}if(\"string\"!=typeof e)return 0===e?e:+e;e=Xt(e);var n=ye.test(e);return n||ve.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function ws(e){return Pi(e,Rs(e))}function vs(e){return null==e?\"\":li(e)}var As=Ri(function(e,t){if(Eo(t)||Va(t))Pi(t,_s(t),e);else for(var n in t)Ne.call(t,n)&&nr(e,n,t[n])}),bs=Ri(function(e,t){Pi(t,Rs(t),e)}),Ss=Ri(function(e,t,n,r){Pi(t,Rs(t),e,r)}),ks=Ri(function(e,t,n,r){Pi(t,_s(t),e,r)}),xs=ro(sr);var Es=Yr(function(e,t){e=Te(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&bo(t[0],t[1],o)&&(r=1);++n<r;)for(var a=t[n],s=Rs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===i||ja(d,Re[l])&&!Ne.call(e,l))&&(e[l]=a[l])}return e}),Is=Yr(function(e){return e.push(i,eo),Tt(Us,i,e)});function Ts(e,t,n){var r=null==e?i:xr(e,t);return r===i?n:r}function Bs(e,t){return null!=e&&yo(e,t,Cr)}var Cs=$i(function(e,t,n){null!=t&&\"function\"!=typeof t.toString&&(t=Le.call(t)),e[t]=n},tc(ic)),Ms=$i(function(e,t,n){null!=t&&\"function\"!=typeof t.toString&&(t=Le.call(t)),Ne.call(e,t)?e[t].push(n):e[t]=[n]},uo),Ps=Yr(Pr);function _s(e){return Va(e)?Yn(e):zr(e)}function Rs(e){return Va(e)?Yn(e,!0):Fr(e)}var Os=Ri(function(e,t,n){Kr(e,t,n)}),Us=Ri(function(e,t,n,r){Kr(e,t,n,r)}),Ns=ro(function(e,t){var n={};if(null==e)return n;var r=!1;t=Ut(t,function(t){return t=Ai(t,e),r||(r=t.length>1),t}),Pi(e,oo(e),n),r&&(n=ur(n,7,to));for(var i=t.length;i--;)fi(n,t[i]);return n});var zs=ro(function(e,t){return null==e?{}:function(e,t){return Wr(e,t,function(t,n){return Bs(e,n)})}(e,t)});function Fs(e,t){if(null==e)return{};var n=Ut(oo(e),function(e){return[e]});return t=uo(t),Wr(e,n,function(e,n){return t(e,n[0])})}var Ls=Yi(_s),Ds=Yi(Rs);function js(e){return null==e?[]:en(e,_s(e))}var $s=zi(function(e,t,n){return t=t.toLowerCase(),e+(n?Ks(t):t)});function Ks(e){return Ys(vs(e).toLowerCase())}function qs(e){return(e=vs(e))&&e.replace(be,on).replace(tt,\"\")}var Hs=zi(function(e,t,n){return e+(n?\"-\":\"\")+t.toLowerCase()}),Ws=zi(function(e,t,n){return e+(n?\" \":\"\")+t.toLowerCase()}),Vs=Ni(\"toLowerCase\");var Gs=zi(function(e,t,n){return e+(n?\"_\":\"\")+t.toLowerCase()});var Zs=zi(function(e,t,n){return e+(n?\" \":\"\")+Ys(t)});var Js=zi(function(e,t,n){return e+(n?\" \":\"\")+t.toUpperCase()}),Ys=Ni(\"toUpperCase\");function Xs(e,t,n){return e=vs(e),(t=n?i:t)===i?function(e){return ot.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Qs=Yr(function(e,t){try{return Tt(e,i,t)}catch(e){return Ya(e)?e:new xe(e)}}),ec=ro(function(e,t){return Ct(t,function(t){t=Fo(t),ar(e,t,Ma(e[t],e))}),e});function tc(e){return function(){return e}}var nc=Di(),rc=Di(!0);function ic(e){return e}function oc(e){return Nr(\"function\"==typeof e?e:ur(e,1))}var ac=Yr(function(e,t){return function(n){return Pr(n,e,t)}}),sc=Yr(function(e,t){return function(n){return Pr(e,n,t)}});function cc(e,t,n){var r=_s(t),i=kr(t,r);null!=n||ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=kr(t,_s(t)));var o=!(ts(n)&&\"chain\"in n&&!n.chain),a=Xa(e);return Ct(i,function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Nt([this.value()],arguments))})}),e}function uc(){}var lc=qi(Ut),dc=qi(Pt),fc=qi(Lt);function hc(e){return So(e)?Vt(Fo(e)):function(e){return function(t){return xr(t,e)}}(e)}var pc=Wi(),gc=Wi(!0);function mc(){return[]}function yc(){return!1}var wc=Ki(function(e,t){return e+t},0),vc=Zi(\"ceil\"),Ac=Ki(function(e,t){return e/t},1),bc=Zi(\"floor\");var Sc,kc=Ki(function(e,t){return e*t},1),xc=Zi(\"round\"),Ec=Ki(function(e,t){return e-t},0);return jn.after=function(e,t){if(\"function\"!=typeof t)throw new Me(o);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},jn.ary=Ba,jn.assign=As,jn.assignIn=bs,jn.assignInWith=Ss,jn.assignWith=ks,jn.at=xs,jn.before=Ca,jn.bind=Ma,jn.bindAll=ec,jn.bindKey=Pa,jn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ha(e)?e:[e]},jn.chain=ha,jn.chunk=function(e,t,n){t=(n?bo(e,t,n):t===i)?1:vn(gs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,s=0,c=r(pt(o/t));a<o;)c[s++]=ii(e,a,a+=t);return c},jn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},jn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Nt(Ha(n)?Mi(n):[n],wr(t,1))},jn.cond=function(e){var t=null==e?0:e.length,n=uo();return e=t?Ut(e,function(e){if(\"function\"!=typeof e[1])throw new Me(o);return[n(e[0]),e[1]]}):[],Yr(function(n){for(var r=-1;++r<t;){var i=e[r];if(Tt(i[0],this,n))return Tt(i[1],this,n)}})},jn.conforms=function(e){return function(e){var t=_s(e);return function(n){return lr(n,e,t)}}(ur(e,1))},jn.constant=tc,jn.countBy=ma,jn.create=function(e,t){var n=$n(e);return null==t?n:or(n,t)},jn.curry=function e(t,n,r){var o=Xi(t,8,i,i,i,i,i,n=r?i:n);return o.placeholder=e.placeholder,o},jn.curryRight=function e(t,n,r){var o=Xi(t,c,i,i,i,i,i,n=r?i:n);return o.placeholder=e.placeholder,o},jn.debounce=_a,jn.defaults=Es,jn.defaultsDeep=Is,jn.defer=Ra,jn.delay=Oa,jn.difference=jo,jn.differenceBy=$o,jn.differenceWith=Ko,jn.drop=function(e,t,n){var r=null==e?0:e.length;return r?ii(e,(t=n||t===i?1:gs(t))<0?0:t,r):[]},jn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?ii(e,0,(t=r-(t=n||t===i?1:gs(t)))<0?0:t):[]},jn.dropRightWhile=function(e,t){return e&&e.length?pi(e,uo(t,3),!0,!0):[]},jn.dropWhile=function(e,t){return e&&e.length?pi(e,uo(t,3),!0):[]},jn.fill=function(e,t,n,r){var o=null==e?0:e.length;return o?(n&&\"number\"!=typeof n&&bo(e,t,n)&&(n=0,r=o),function(e,t,n,r){var o=e.length;for((n=gs(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:gs(r))<0&&(r+=o),r=n>r?0:ms(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},jn.filter=function(e,t){return(Ha(e)?_t:yr)(e,uo(t,3))},jn.flatMap=function(e,t){return wr(xa(e,t),1)},jn.flatMapDeep=function(e,t){return wr(xa(e,t),h)},jn.flatMapDepth=function(e,t,n){return n=n===i?1:gs(n),wr(xa(e,t),n)},jn.flatten=Wo,jn.flattenDeep=function(e){return(null==e?0:e.length)?wr(e,h):[]},jn.flattenDepth=function(e,t){return(null==e?0:e.length)?wr(e,t=t===i?1:gs(t)):[]},jn.flip=function(e){return Xi(e,512)},jn.flow=nc,jn.flowRight=rc,jn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];ar(r,i[0],i[1])}return r},jn.functions=function(e){return null==e?[]:kr(e,_s(e))},jn.functionsIn=function(e){return null==e?[]:kr(e,Rs(e))},jn.groupBy=ba,jn.initial=function(e){return(null==e?0:e.length)?ii(e,0,-1):[]},jn.intersection=Go,jn.intersectionBy=Zo,jn.intersectionWith=Jo,jn.invert=Cs,jn.invertBy=Ms,jn.invokeMap=Sa,jn.iteratee=oc,jn.keyBy=ka,jn.keys=_s,jn.keysIn=Rs,jn.map=xa,jn.mapKeys=function(e,t){var n={};return t=uo(t,3),br(e,function(e,r,i){ar(n,t(e,r,i),e)}),n},jn.mapValues=function(e,t){var n={};return t=uo(t,3),br(e,function(e,r,i){ar(n,r,t(e,r,i))}),n},jn.matches=function(e){return jr(ur(e,1))},jn.matchesProperty=function(e,t){return $r(e,ur(t,1))},jn.memoize=Ua,jn.merge=Os,jn.mergeWith=Us,jn.method=ac,jn.methodOf=sc,jn.mixin=cc,jn.negate=Na,jn.nthArg=function(e){return e=gs(e),Yr(function(t){return qr(t,e)})},jn.omit=Ns,jn.omitBy=function(e,t){return Fs(e,Na(uo(t)))},jn.once=function(e){return Ca(2,e)},jn.orderBy=function(e,t,n,r){return null==e?[]:(Ha(t)||(t=null==t?[]:[t]),Ha(n=r?i:n)||(n=null==n?[]:[n]),Hr(e,t,n))},jn.over=lc,jn.overArgs=za,jn.overEvery=dc,jn.overSome=fc,jn.partial=Fa,jn.partialRight=La,jn.partition=Ea,jn.pick=zs,jn.pickBy=Fs,jn.property=hc,jn.propertyOf=function(e){return function(t){return null==e?i:xr(e,t)}},jn.pull=Xo,jn.pullAll=Qo,jn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Vr(e,t,uo(n,2)):e},jn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Vr(e,t,i,n):e},jn.pullAt=ea,jn.range=pc,jn.rangeRight=gc,jn.rearg=Da,jn.reject=function(e,t){return(Ha(e)?_t:yr)(e,Na(uo(t,3)))},jn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=uo(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return Gr(e,i),n},jn.rest=function(e,t){if(\"function\"!=typeof e)throw new Me(o);return Yr(e,t=t===i?t:gs(t))},jn.reverse=ta,jn.sampleSize=function(e,t,n){return t=(n?bo(e,t,n):t===i)?1:gs(t),(Ha(e)?Qn:Qr)(e,t)},jn.set=function(e,t,n){return null==e?e:ei(e,t,n)},jn.setWith=function(e,t,n,r){return r=\"function\"==typeof r?r:i,null==e?e:ei(e,t,n,r)},jn.shuffle=function(e){return(Ha(e)?er:ri)(e)},jn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&\"number\"!=typeof n&&bo(e,t,n)?(t=0,n=r):(t=null==t?0:gs(t),n=n===i?r:gs(n)),ii(e,t,n)):[]},jn.sortBy=Ia,jn.sortedUniq=function(e){return e&&e.length?ci(e):[]},jn.sortedUniqBy=function(e,t){return e&&e.length?ci(e,uo(t,2)):[]},jn.split=function(e,t,n){return n&&\"number\"!=typeof n&&bo(e,t,n)&&(t=n=i),(n=n===i?m:n>>>0)?(e=vs(e))&&(\"string\"==typeof t||null!=t&&!as(t))&&!(t=li(t))&&cn(e)?Si(gn(e),0,n):e.split(t,n):[]},jn.spread=function(e,t){if(\"function\"!=typeof e)throw new Me(o);return t=null==t?0:vn(gs(t),0),Yr(function(n){var r=n[t],i=Si(n,0,t);return r&&Nt(i,r),Tt(e,this,i)})},jn.tail=function(e){var t=null==e?0:e.length;return t?ii(e,1,t):[]},jn.take=function(e,t,n){return e&&e.length?ii(e,0,(t=n||t===i?1:gs(t))<0?0:t):[]},jn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ii(e,(t=r-(t=n||t===i?1:gs(t)))<0?0:t,r):[]},jn.takeRightWhile=function(e,t){return e&&e.length?pi(e,uo(t,3),!1,!0):[]},jn.takeWhile=function(e,t){return e&&e.length?pi(e,uo(t,3)):[]},jn.tap=function(e,t){return t(e),e},jn.throttle=function(e,t,n){var r=!0,i=!0;if(\"function\"!=typeof e)throw new Me(o);return ts(n)&&(r=\"leading\"in n?!!n.leading:r,i=\"trailing\"in n?!!n.trailing:i),_a(e,t,{leading:r,maxWait:t,trailing:i})},jn.thru=pa,jn.toArray=hs,jn.toPairs=Ls,jn.toPairsIn=Ds,jn.toPath=function(e){return Ha(e)?Ut(e,Fo):us(e)?[e]:Mi(zo(vs(e)))},jn.toPlainObject=ws,jn.transform=function(e,t,n){var r=Ha(e),i=r||Za(e)||ls(e);if(t=uo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:ts(e)&&Xa(o)?$n(Ve(e)):{}}return(i?Ct:br)(e,function(e,r,i){return t(n,e,r,i)}),n},jn.unary=function(e){return Ba(e,1)},jn.union=na,jn.unionBy=ra,jn.unionWith=ia,jn.uniq=function(e){return e&&e.length?di(e):[]},jn.uniqBy=function(e,t){return e&&e.length?di(e,uo(t,2)):[]},jn.uniqWith=function(e,t){return t=\"function\"==typeof t?t:i,e&&e.length?di(e,i,t):[]},jn.unset=function(e,t){return null==e||fi(e,t)},jn.unzip=oa,jn.unzipWith=aa,jn.update=function(e,t,n){return null==e?e:hi(e,t,vi(n))},jn.updateWith=function(e,t,n,r){return r=\"function\"==typeof r?r:i,null==e?e:hi(e,t,vi(n),r)},jn.values=js,jn.valuesIn=function(e){return null==e?[]:en(e,Rs(e))},jn.without=sa,jn.words=Xs,jn.wrap=function(e,t){return Fa(vi(t),e)},jn.xor=ca,jn.xorBy=ua,jn.xorWith=la,jn.zip=da,jn.zipObject=function(e,t){return yi(e||[],t||[],nr)},jn.zipObjectDeep=function(e,t){return yi(e||[],t||[],ei)},jn.zipWith=fa,jn.entries=Ls,jn.entriesIn=Ds,jn.extend=bs,jn.extendWith=Ss,cc(jn,jn),jn.add=wc,jn.attempt=Qs,jn.camelCase=$s,jn.capitalize=Ks,jn.ceil=vc,jn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ys(n))==n?n:0),t!==i&&(t=(t=ys(t))==t?t:0),cr(ys(e),t,n)},jn.clone=function(e){return ur(e,4)},jn.cloneDeep=function(e){return ur(e,5)},jn.cloneDeepWith=function(e,t){return ur(e,5,t=\"function\"==typeof t?t:i)},jn.cloneWith=function(e,t){return ur(e,4,t=\"function\"==typeof t?t:i)},jn.conformsTo=function(e,t){return null==t||lr(e,t,_s(t))},jn.deburr=qs,jn.defaultTo=function(e,t){return null==e||e!=e?t:e},jn.divide=Ac,jn.endsWith=function(e,t,n){e=vs(e),t=li(t);var r=e.length,o=n=n===i?r:cr(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},jn.eq=ja,jn.escape=function(e){return(e=vs(e))&&Y.test(e)?e.replace(Z,an):e},jn.escapeRegExp=function(e){return(e=vs(e))&&oe.test(e)?e.replace(ie,\"\\\\$&\"):e},jn.every=function(e,t,n){var r=Ha(e)?Pt:gr;return n&&bo(e,t,n)&&(t=i),r(e,uo(t,3))},jn.find=ya,jn.findIndex=qo,jn.findKey=function(e,t){return jt(e,uo(t,3),br)},jn.findLast=wa,jn.findLastIndex=Ho,jn.findLastKey=function(e,t){return jt(e,uo(t,3),Sr)},jn.floor=bc,jn.forEach=va,jn.forEachRight=Aa,jn.forIn=function(e,t){return null==e?e:vr(e,uo(t,3),Rs)},jn.forInRight=function(e,t){return null==e?e:Ar(e,uo(t,3),Rs)},jn.forOwn=function(e,t){return e&&br(e,uo(t,3))},jn.forOwnRight=function(e,t){return e&&Sr(e,uo(t,3))},jn.get=Ts,jn.gt=$a,jn.gte=Ka,jn.has=function(e,t){return null!=e&&yo(e,t,Br)},jn.hasIn=Bs,jn.head=Vo,jn.identity=ic,jn.includes=function(e,t,n,r){e=Va(e)?e:js(e),n=n&&!r?gs(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Kt(e,t,n)>-1},jn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:gs(n);return i<0&&(i=vn(r+i,0)),Kt(e,t,i)},jn.inRange=function(e,t,n){return t=ps(t),n===i?(n=t,t=0):n=ps(n),function(e,t,n){return e>=An(t,n)&&e<vn(t,n)}(e=ys(e),t,n)},jn.invoke=Ps,jn.isArguments=qa,jn.isArray=Ha,jn.isArrayBuffer=Wa,jn.isArrayLike=Va,jn.isArrayLikeObject=Ga,jn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Ir(e)==A},jn.isBuffer=Za,jn.isDate=Ja,jn.isElement=function(e){return ns(e)&&1===e.nodeType&&!os(e)},jn.isEmpty=function(e){if(null==e)return!0;if(Va(e)&&(Ha(e)||\"string\"==typeof e||\"function\"==typeof e.splice||Za(e)||ls(e)||qa(e)))return!e.length;var t=mo(e);if(t==E||t==M)return!e.size;if(Eo(e))return!zr(e).length;for(var n in e)if(Ne.call(e,n))return!1;return!0},jn.isEqual=function(e,t){return Rr(e,t)},jn.isEqualWith=function(e,t,n){var r=(n=\"function\"==typeof n?n:i)?n(e,t):i;return r===i?Rr(e,t,i,n):!!r},jn.isError=Ya,jn.isFinite=function(e){return\"number\"==typeof e&&At(e)},jn.isFunction=Xa,jn.isInteger=Qa,jn.isLength=es,jn.isMap=rs,jn.isMatch=function(e,t){return e===t||Or(e,t,fo(t))},jn.isMatchWith=function(e,t,n){return n=\"function\"==typeof n?n:i,Or(e,t,fo(t),n)},jn.isNaN=function(e){return is(e)&&e!=+e},jn.isNative=function(e){if(xo(e))throw new xe(\"Unsupported core-js use. Try https://npms.io/search?q=ponyfill.\");return Ur(e)},jn.isNil=function(e){return null==e},jn.isNull=function(e){return null===e},jn.isNumber=is,jn.isObject=ts,jn.isObjectLike=ns,jn.isPlainObject=os,jn.isRegExp=as,jn.isSafeInteger=function(e){return Qa(e)&&e>=-9007199254740991&&e<=p},jn.isSet=ss,jn.isString=cs,jn.isSymbol=us,jn.isTypedArray=ls,jn.isUndefined=function(e){return e===i},jn.isWeakMap=function(e){return ns(e)&&mo(e)==R},jn.isWeakSet=function(e){return ns(e)&&\"[object WeakSet]\"==Ir(e)},jn.join=function(e,t){return null==e?\"\":Dt.call(e,t)},jn.kebabCase=Hs,jn.last=Yo,jn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=gs(n))<0?vn(r+o,0):An(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):$t(e,Ht,o,!0)},jn.lowerCase=Ws,jn.lowerFirst=Vs,jn.lt=ds,jn.lte=fs,jn.max=function(e){return e&&e.length?mr(e,ic,Tr):i},jn.maxBy=function(e,t){return e&&e.length?mr(e,uo(t,2),Tr):i},jn.mean=function(e){return Wt(e,ic)},jn.meanBy=function(e,t){return Wt(e,uo(t,2))},jn.min=function(e){return e&&e.length?mr(e,ic,Lr):i},jn.minBy=function(e,t){return e&&e.length?mr(e,uo(t,2),Lr):i},jn.stubArray=mc,jn.stubFalse=yc,jn.stubObject=function(){return{}},jn.stubString=function(){return\"\"},jn.stubTrue=function(){return!0},jn.multiply=kc,jn.nth=function(e,t){return e&&e.length?qr(e,gs(t)):i},jn.noConflict=function(){return gt._===this&&(gt._=je),this},jn.noop=uc,jn.now=Ta,jn.pad=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Hi(mt(i),n)+e+Hi(pt(i),n)},jn.padEnd=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?e+Hi(t-r,n):e},jn.padStart=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?Hi(t-r,n)+e:e},jn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Sn(vs(e).replace(ae,\"\"),t||0)},jn.random=function(e,t,n){if(n&&\"boolean\"!=typeof n&&bo(e,t,n)&&(t=n=i),n===i&&(\"boolean\"==typeof t?(n=t,t=i):\"boolean\"==typeof e&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=ps(e),t===i?(t=e,e=0):t=ps(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var o=kn();return An(e+o*(t-e+dt(\"1e-\"+((o+\"\").length-1))),t)}return Zr(e,t)},jn.reduce=function(e,t,n){var r=Ha(e)?zt:Zt,i=arguments.length<3;return r(e,uo(t,4),n,i,hr)},jn.reduceRight=function(e,t,n){var r=Ha(e)?Ft:Zt,i=arguments.length<3;return r(e,uo(t,4),n,i,pr)},jn.repeat=function(e,t,n){return t=(n?bo(e,t,n):t===i)?1:gs(t),Jr(vs(e),t)},jn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},jn.result=function(e,t,n){var r=-1,o=(t=Ai(t,e)).length;for(o||(o=1,e=i);++r<o;){var a=null==e?i:e[Fo(t[r])];a===i&&(r=o,a=n),e=Xa(a)?a.call(e):a}return e},jn.round=xc,jn.runInContext=e,jn.sample=function(e){return(Ha(e)?Xn:Xr)(e)},jn.size=function(e){if(null==e)return 0;if(Va(e))return cs(e)?pn(e):e.length;var t=mo(e);return t==E||t==M?e.size:zr(e).length},jn.snakeCase=Gs,jn.some=function(e,t,n){var r=Ha(e)?Lt:oi;return n&&bo(e,t,n)&&(t=i),r(e,uo(t,3))},jn.sortedIndex=function(e,t){return ai(e,t)},jn.sortedIndexBy=function(e,t,n){return si(e,t,uo(n,2))},jn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ai(e,t);if(r<n&&ja(e[r],t))return r}return-1},jn.sortedLastIndex=function(e,t){return ai(e,t,!0)},jn.sortedLastIndexBy=function(e,t,n){return si(e,t,uo(n,2),!0)},jn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=ai(e,t,!0)-1;if(ja(e[n],t))return n}return-1},jn.startCase=Zs,jn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:cr(gs(n),0,e.length),t=li(t),e.slice(n,n+t.length)==t},jn.subtract=Ec,jn.sum=function(e){return e&&e.length?Jt(e,ic):0},jn.sumBy=function(e,t){return e&&e.length?Jt(e,uo(t,2)):0},jn.template=function(e,t,n){var r=jn.templateSettings;n&&bo(e,t,n)&&(t=i),e=vs(e),t=ks({},t,r,Qi);var o=ks({},t.imports,r.imports,Qi),a=_s(o),s=en(o,a);Ct(a,function(e){if(fe.test(e))throw new xe(\"Invalid `imports` option passed into `_.template`\")});var c,u,l=0,d=t.interpolate||Se,f=\"__p += '\",h=Be((t.escape||Se).source+\"|\"+d.source+\"|\"+(d===ee?pe:Se).source+\"|\"+(t.evaluate||Se).source+\"|$\",\"g\"),p=\"//# sourceURL=\"+(Ne.call(t,\"sourceURL\")?(t.sourceURL+\"\").replace(/\\s/g,\" \"):\"lodash.templateSources[\"+ ++st+\"]\")+\"\\n\";e.replace(h,function(t,n,r,i,o,a){return r||(r=i),f+=e.slice(l,a).replace(ke,sn),n&&(c=!0,f+=\"' +\\n__e(\"+n+\") +\\n'\"),o&&(u=!0,f+=\"';\\n\"+o+\";\\n__p += '\"),r&&(f+=\"' +\\n((__t = (\"+r+\")) == null ? '' : __t) +\\n'\"),l=a+t.length,t}),f+=\"';\\n\";var g=Ne.call(t,\"variable\")&&t.variable;if(g){if(fe.test(g))throw new xe(\"Invalid `variable` option passed into `_.template`\")}else f=\"with (obj) {\\n\"+f+\"\\n}\\n\";f=(u?f.replace(H,\"\"):f).replace(W,\"$1\").replace(V,\"$1;\"),f=\"function(\"+(g||\"obj\")+\") {\\n\"+(g?\"\":\"obj || (obj = {});\\n\")+\"var __t, __p = ''\"+(c?\", __e = _.escape\":\"\")+(u?\", __j = Array.prototype.join;\\nfunction print() { __p += __j.call(arguments, '') }\\n\":\";\\n\")+f+\"return __p\\n}\";var m=Qs(function(){return Ee(a,p+\"return \"+f).apply(i,s)});if(m.source=f,Ya(m))throw m;return m},jn.times=function(e,t){if((e=gs(e))<1||e>p)return[];var n=m,r=An(e,m);t=uo(t),e-=m;for(var i=Yt(r,t);++n<e;)t(n);return i},jn.toFinite=ps,jn.toInteger=gs,jn.toLength=ms,jn.toLower=function(e){return vs(e).toLowerCase()},jn.toNumber=ys,jn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},jn.toString=vs,jn.toUpper=function(e){return vs(e).toUpperCase()},jn.trim=function(e,t,n){if((e=vs(e))&&(n||t===i))return Xt(e);if(!e||!(t=li(t)))return e;var r=gn(e),o=gn(t);return Si(r,nn(r,o),rn(r,o)+1).join(\"\")},jn.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===i))return e.slice(0,mn(e)+1);if(!e||!(t=li(t)))return e;var r=gn(e);return Si(r,0,rn(r,gn(t))+1).join(\"\")},jn.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===i))return e.replace(ae,\"\");if(!e||!(t=li(t)))return e;var r=gn(e);return Si(r,nn(r,gn(t))).join(\"\")},jn.truncate=function(e,t){var n=30,r=\"...\";if(ts(t)){var o=\"separator\"in t?t.separator:o;n=\"length\"in t?gs(t.length):n,r=\"omission\"in t?li(t.omission):r}var a=(e=vs(e)).length;if(cn(e)){var s=gn(e);a=s.length}if(n>=a)return e;var c=n-pn(r);if(c<1)return r;var u=s?Si(s,0,c).join(\"\"):e.slice(0,c);if(o===i)return u+r;if(s&&(c+=u.length-c),as(o)){if(e.slice(c).search(o)){var l,d=u;for(o.global||(o=Be(o.source,vs(ge.exec(o))+\"g\")),o.lastIndex=0;l=o.exec(d);)var f=l.index;u=u.slice(0,f===i?c:f)}}else if(e.indexOf(li(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+r},jn.unescape=function(e){return(e=vs(e))&&J.test(e)?e.replace(G,yn):e},jn.uniqueId=function(e){var t=++ze;return vs(e)+t},jn.upperCase=Js,jn.upperFirst=Ys,jn.each=va,jn.eachRight=Aa,jn.first=Vo,cc(jn,(Sc={},br(jn,function(e,t){Ne.call(jn.prototype,t)||(Sc[t]=e)}),Sc),{chain:!1}),jn.VERSION=\"4.18.1\",Ct([\"bind\",\"bindKey\",\"curry\",\"curryRight\",\"partial\",\"partialRight\"],function(e){jn[e].placeholder=jn}),Ct([\"drop\",\"take\"],function(e,t){Hn.prototype[e]=function(n){n=n===i?1:vn(gs(n),0);var r=this.__filtered__&&!t?new Hn(this):this.clone();return r.__filtered__?r.__takeCount__=An(n,r.__takeCount__):r.__views__.push({size:An(n,m),type:e+(r.__dir__<0?\"Right\":\"\")}),r},Hn.prototype[e+\"Right\"]=function(t){return this.reverse()[e](t).reverse()}}),Ct([\"filter\",\"map\",\"takeWhile\"],function(e,t){var n=t+1,r=1==n||3==n;Hn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Ct([\"head\",\"last\"],function(e,t){var n=\"take\"+(t?\"Right\":\"\");Hn.prototype[e]=function(){return this[n](1).value()[0]}}),Ct([\"initial\",\"tail\"],function(e,t){var n=\"drop\"+(t?\"\":\"Right\");Hn.prototype[e]=function(){return this.__filtered__?new Hn(this):this[n](1)}}),Hn.prototype.compact=function(){return this.filter(ic)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=Yr(function(e,t){return\"function\"==typeof e?new Hn(this):this.map(function(n){return Pr(n,e,t)})}),Hn.prototype.reject=function(e){return this.filter(Na(uo(e)))},Hn.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Hn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Hn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hn.prototype.toArray=function(){return this.take(m)},br(Hn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=jn[r?\"take\"+(\"last\"==t?\"Right\":\"\"):t],a=r||/^find/.test(t);o&&(jn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Hn,u=s[0],l=c||Ha(t),d=function(e){var t=o.apply(jn,Nt([e],s));return r&&f?t[0]:t};l&&n&&\"function\"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=a&&!f,g=c&&!h;if(!a&&l){t=g?t:new Hn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:i}),new qn(m,f)}return p&&g?e.apply(this,s):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})}),Ct([\"pop\",\"push\",\"shift\",\"sort\",\"splice\",\"unshift\"],function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?\"tap\":\"thru\",r=/^(?:pop|shift)$/.test(e);jn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ha(i)?i:[],e)}return this[n](function(n){return t.apply(Ha(n)?n:[],e)})}}),br(Hn.prototype,function(e,t){var n=jn[t];if(n){var r=n.name+\"\";Ne.call(_n,r)||(_n[r]=[]),_n[r].push({name:t,func:n})}}),_n[ji(i,2).name]=[{name:\"wrapper\",func:i}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Mi(this.__views__),e},Hn.prototype.reverse=function(){if(this.__filtered__){var e=new Hn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ha(e),r=t<0,i=n?e.length:0,o=function(e,t,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],a=o.size;switch(o.type){case\"drop\":e+=a;break;case\"dropRight\":t-=a;break;case\"take\":t=An(t,e+a);break;case\"takeRight\":e=vn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,f=0,h=An(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return gi(e,this.__actions__);var p=[];e:for(;c--&&f<h;){for(var g=-1,m=e[u+=t];++g<d;){var y=l[g],w=y.iteratee,v=y.type,A=w(m);if(2==v)m=A;else if(!A){if(1==v)continue e;break e}}p[f++]=m}return p},jn.prototype.at=ga,jn.prototype.chain=function(){return ha(this)},jn.prototype.commit=function(){return new qn(this.value(),this.__chain__)},jn.prototype.next=function(){this.__values__===i&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},jn.prototype.plant=function(e){for(var t,n=this;n instanceof Kn;){var r=Do(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},jn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hn){var t=e;return this.__actions__.length&&(t=new Hn(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:i}),new qn(t,this.__chain__)}return this.thru(ta)},jn.prototype.toJSON=jn.prototype.valueOf=jn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},jn.prototype.first=jn.prototype.head,Xe&&(jn.prototype[Xe]=function(){return this}),jn}();gt._=wn,(r=function(){return wn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},750(e,t,n){\"use strict\";n.r(t),n.d(t,{now:()=>r});const r=()=>Date.now()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{\"use strict\";n.r(r),n.d(r,{onActive:()=>Qz,onAssetHistoricalPrice:()=>iF,onAssetsConversion:()=>rF,onAssetsLookup:()=>nF,onAssetsMarketData:()=>oF,onClientRequest:()=>Gz,onCronjob:()=>Wz,onInactive:()=>eF,onInstall:()=>Xz,onKeyringRequest:()=>qz,onNameLookup:()=>tF,onProtocolRequest:()=>Vz,onRpcRequest:()=>Kz,onStart:()=>Jz,onUpdate:()=>Yz,onUserInput:()=>Hz,onWebSocketEvent:()=>Zz});var e={};n.r(e),n.d(e,{compressPublicKey:()=>zT,compressedPublicKeyLength:()=>jT,curve:()=>CT,decompressPublicKey:()=>FT,deriveUnhardenedKeys:()=>RT,getPublicKey:()=>UT,isValidPrivateKey:()=>_T,masterNodeGenerationSpec:()=>DT,name:()=>MT,privateKeyLength:()=>LT,publicAdd:()=>NT,publicKeyLength:()=>OT,secret:()=>PT});var t={};n.r(t),n.d(t,{bytesToNumberLE:()=>ZT,compressPublicKey:()=>QT,compressedPublicKeyLength:()=>rB,curve:()=>$T,decompressPublicKey:()=>eB,deriveUnhardenedKeys:()=>VT,getPublicKey:()=>YT,isValidPrivateKey:()=>WT,masterNodeGenerationSpec:()=>nB,multiplyWithBase:()=>JT,name:()=>KT,privateKeyLength:()=>tB,publicAdd:()=>XT,publicKeyLength:()=>GT,secret:()=>qT});var i={};n.r(i),n.d(i,{deriveChildKey:()=>DB,privateKeyToEthAddress:()=>FB,publicKeyToEthAddress:()=>LB});var o={};n.r(o),n.d(o,{bip39MnemonicToMultipath:()=>WB,createBip39KeyFromSeed:()=>JB,deriveChildKey:()=>ZB,entropyToCip3MasterNode:()=>YB,getDerivationPathWithSeed:()=>GB,mnemonicToSeed:()=>HB,multipathToBip39Mnemonic:()=>VB});var a={};n.r(a),n.d(a,{add:()=>iC,bigIntToBytes:()=>eC,bytesToBigInt:()=>QB,deriveChainCode:()=>dC,deriveChildKey:()=>pC,derivePrivateKey:()=>cC,derivePublicKey:()=>hC,getKeyExtension:()=>oC,mod2Pow256:()=>rC,padEnd32Bytes:()=>tC,toReversed:()=>XB,trunc28Mul8:()=>nC});var s={};n.r(s),n.d(s,{deriveChildKey:()=>gC});var c={};n.r(c),n.d(c,{compressPublicKey:()=>oM,compressedPublicKeyLength:()=>uM,curve:()=>YC,decompressPublicKey:()=>aM,deriveUnhardenedKeys:()=>eM,getPublicKey:()=>rM,isValidPrivateKey:()=>nM,masterNodeGenerationSpec:()=>cM,name:()=>XC,privateKeyLength:()=>sM,publicAdd:()=>iM,publicKeyLength:()=>tM,secret:()=>QC});class u extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(\".\")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function l(e){return\"object\"==typeof e&&null!==e}function d(e){if(\"[object Object]\"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function f(e){return\"symbol\"==typeof e?e.toString():\"string\"==typeof e?JSON.stringify(e):`${e}`}function h(e,t,n,r){if(!0===e)return;!1===e?e={}:\"string\"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \\`${a}\\`${s?` with refinement \\`${s}\\``:\"\"}, but received: \\`${f(r)}\\``}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*p(e,t,n,r){(function(e){return l(e)&&\"function\"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=h(i,t,n,r);e&&(yield e)}}function*g(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&\"type\"!==t.type&&l(t.schema)&&l(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c=\"valid\";for(const r of t.validator(e,s))r.explanation=n.message,c=\"not_valid\",yield[r,void 0];for(let[u,d,f]of t.entries(e,s)){const t=g(d,f,{path:void 0===u?r:[...r,u],branch:void 0===u?i:[...i,d],coerce:o,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?\"not_valid\":\"not_refined\",yield[n[0],void 0]):o&&(d=n[1],void 0===u?e=d:e instanceof Map?e.set(u,d):e instanceof Set?e.add(d):l(e)&&(void 0!==d||u in e)&&(e[u]=d))}if(\"not_valid\"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c=\"not_refined\",yield[r,void 0];\"valid\"===c&&(yield[void 0,e])}class m{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>p(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>p(i(e,t),t,this,e):()=>[];for(const t of Object.getOwnPropertySymbols(e))Object.defineProperty(this,t,Object.getOwnPropertyDescriptor(e,t))}assert(e,t){return v(e,this,t)}create(e,t){return A(e,this,t)}is(e){return b(e,this)}mask(e,t){return function(e,t,n){const r=S(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return S(e,this,t)}}const y=\"EXACT_OPTIONAL\";class w extends m{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=y}static isExactOptional(e){return l(e)&&\"brand\"in e&&e.brand===y}}function v(e,t,n){const r=S(e,t,{message:n});if(r[0])throw r[0]}function A(e,t,n){const r=S(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function b(e,t){return!S(e,t)[0]}function S(e,t,n={}){const r=g(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new u(i[0],function*(){for(const e of r)e[0]&&(yield e[0])}),void 0]}return[void 0,i[1]]}function k(e,t){return new m({type:e,schema:null,validator:t})}function x(e,t){return k(e,e=>\"string\"==typeof e&&t.test(e))}const E=x(\"UuidV4\",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),I=E,T=(k(\"Url\",e=>{try{const t=new URL(e);return\"http:\"===t.protocol||\"https:\"===t.protocol}catch{return!1}}),x(\"StringNumber\",/^\\d+(\\.\\d+)?$/u)),B=\"***\",C=Symbol.for(\"superstruct.sensitive\");function M(e,t){const n={...e};for(const e of t)e in n&&(n[e]=B);return n}function P(e){function*t(t){for(const n of t)yield{...n,value:B,message:`Expected a value of type \\`${e.type}\\`${n.refinement?` with refinement \\`${n.refinement}\\``:\"\"}, but received: \\`${B}\\``,branch:new Array(n.branch.length).fill(B)}}return new m({...e,validator:(n,r)=>t(e.validator(n,r)),refiner:(n,r)=>t(e.refiner(n,r)),*entries(t,n){for(const[r,i,o]of e.entries(t,n))yield[r,i,P(o)]}})}function _(e,t,n){function*r(e){for(const r of e){if(!l(t)){yield r;continue}const e=r.branch.indexOf(t);if(-1===e){yield r;continue}const i=[...r.branch];i[e]=M(t,n);for(let t=e-1;t>=0;t--){const e=i[t];if(!l(e))break;const n=r.branch[t+1],o=i[t+1];if(Array.isArray(e)){const r=e.indexOf(n);if(-1===r)break;const a=[...e];a[r]=o,i[t]=a}else if(e instanceof Map){let r,a=!1;for(const[t,i]of e)if(i===n){r=t,a=!0;break}if(!a)break;const s=new Map(e);s.set(r,o),i[t]=s}else{const r=Object.keys(e).find(t=>e[t]===n);if(void 0===r)break;i[t]={...e,[r]:o}}}yield{...r,branch:i}}}return new m({...e,validator:(t,n)=>r(e.validator(t,n)),refiner:(t,n)=>r(e.refiner(t,n)),*entries(r,i){for(const o of e.entries(r,i)){const[e,r,i]=o;yield[e,r,_(i,t,n)]}}})}function R(e){const t=P(e);return Object.defineProperty(t,C,{value:!0,enumerable:!0,configurable:!0,writable:!1}),t}function O(e,t){const n=Object.keys(t).filter(e=>{return void 0!==t[e]&&(n=t[e],Object.prototype.hasOwnProperty.call(n,C));var n});return 0===n.length?e:new m({...e,*entries(t,r){const i=r.branch[r.branch.length-1]??t;for(const o of e.entries(t,r)){const[e,t,r]=o;yield[e,t,_(r,i,n)]}}})}function U(e){return new m({type:\"array\",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${f(e)}`})}function N(){return k(\"boolean\",e=>\"boolean\"==typeof e)}function z(e){const t={},n=e.map(e=>f(e)).join();for(const n of e)t[n]=n;return new m({type:\"enums\",schema:t,validator:t=>e.includes(t)||`Expected one of \\`${n}\\`, but received: ${f(t)}`})}function F(){return k(\"integer\",e=>\"number\"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${f(e)}`)}function L(e){const t=f(e),n=typeof e;return new m({type:\"literal\",schema:\"string\"===n||\"number\"===n||\"boolean\"===n?e:null,validator:n=>n===e||`Expected the literal \\`${t}\\`, but received: ${f(n)}`})}function D(){return k(\"never\",()=>!1)}function j(e){return new m({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function $(){return k(\"number\",e=>\"number\"==typeof e&&!isNaN(e)||`Expected a number, but received: ${f(e)}`)}function K(e){const t=e?Object.keys(e):[],n=D(),r=new m({type:\"object\",schema:e??null,*entries(r){if(e&&l(r)){const i=new Set(Object.keys(r));for(const n of t){i.delete(n);const t=e[n];w.isExactOptional(t)&&!Object.prototype.hasOwnProperty.call(r,n)||(yield[n,r[n],e[n]])}for(const e of i)yield[e,r[e],n]}},validator:e=>l(e)||`Expected an object, but received: ${f(e)}`,coercer:e=>l(e)?{...e}:e});return e?O(r,e):r}function q(e){return new m({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function H(e){return new w(e)}function W(e,t){return new m({type:\"record\",schema:null,*entries(n){if(l(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>l(e)||`Expected an object, but received: ${f(e)}`})}function V(){return k(\"string\",e=>\"string\"==typeof e||`Expected a string, but received: ${f(e)}`)}function G(e){const t=Object.keys(e);return O(new m({type:\"type\",schema:e,*entries(n){if(l(n))for(const r of t)w.isExactOptional(e[r])&&!Object.prototype.hasOwnProperty.call(n,r)||(yield[r,n[r],e[r]])},validator:e=>l(e)||`Expected an object, but received: ${f(e)}`,coercer:e=>l(e)?{...e}:e}),e)}function Z(e){const t=e.map(e=>e.type).join(\" | \");return new m({type:\"union\",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const i=[];for(const t of e){const[...e]=g(n,t,r),[o]=e;if(!o?.[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \\`${t}\\`, but received: ${f(n)}`,...i]}})}function J(){return k(\"unknown\",()=>!0)}function Y(e,t,n){return new m({...e,coercer:(r,i)=>b(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}function X(e,t,n={}){return Y(e,J(),e=>{const r=\"function\"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&d(e)&&d(r)){const t={...e};let n=!1;for(const e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e})}function Q(e){return e instanceof Map||e instanceof Set?e.size:e.length}function ee(e,t,n={}){const{exclusive:r}=n;return re(e,\"min\",n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?\"\":\"or equal to \"}${t} but received \\`${n}\\``)}function te(e){return re(e,\"nonempty\",t=>Q(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function ne(e,t){return re(e,\"pattern\",n=>t.test(n)||`Expected a ${e.type} matching \\`/${t.source}/\\` but received \"${n}\"`)}function re(e,t,n){return new m({...e,*refiner(r,i){yield*e.refiner(r,i);const o=p(n(r,i),i,e,r);for(const e of o)yield{...e,refinement:t}}})}function ie(e){return Boolean(e)&&\"object\"==typeof e&&!Array.isArray(e)}const oe=(e,t)=>Object.hasOwnProperty.call(e,t);var ae;!function(e){e[e.Null=4]=\"Null\",e[e.Comma=1]=\"Comma\",e[e.Wrapper=1]=\"Wrapper\",e[e.True=4]=\"True\",e[e.False=5]=\"False\",e[e.Quote=1]=\"Quote\",e[e.Colon=1]=\"Colon\",e[e.Date=24]=\"Date\"}(ae=ae||(ae={}));function se(e){if(\"object\"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}const ce=e=>K(e);function ue({path:e,branch:t}){const n=e[e.length-1];return oe(t[t.length-2],n)}function le(e){return new m({...e,type:`optional ${e.type}`,validator:(t,n)=>!ue(n)||e.validator(t,n),refiner:(t,n)=>!ue(n)||e.refiner(t,n)})}function de(e){if(null===e||\"boolean\"==typeof e||\"string\"==typeof e)return!0;if(\"number\"==typeof e&&Number.isFinite(e))return!0;if(\"object\"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!de(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if(\"string\"!=typeof n[e][0]||!de(n[e][1])){t=!1;break}return t}return!1}const fe=k(\"JSON\",e=>de(e)),he=Y(fe,re(k(\"any\",()=>!0),\"JSON\",e=>b(e,fe)),e=>JSON.parse(JSON.stringify(e,(e,t)=>{if(\"__proto__\"!==e&&\"constructor\"!==e)return t})));function pe(e){try{return function(e){A(e,he)}(e),!0}catch{return!1}}const ge=L(\"2.0\"),me=j(Z([$(),V()])),ye=ce({code:F(),message:V(),data:le(he),stack:le(V())}),we=Z([W(V(),he),U(he)]);ce({id:me,jsonrpc:ge,method:V(),params:le(we)}),ce({jsonrpc:ge,method:V(),params:le(we)});K({id:me,jsonrpc:ge,result:q(J()),error:q(ye)});const ve=ce({id:me,jsonrpc:ge,result:he}),Ae=ce({id:me,jsonrpc:ge,error:ye});Z([ve,Ae]);function be(e){return b(e,Ae)}function Se(e){return b(e,ye)}const ke=K({jsonrpc:L(\"2.0\"),id:Z([V(),$(),L(null)]),method:V(),params:H(Z([U(he),W(V(),he)]))});var xe;function Ee(e){return new m({type:\"union\",schema:null,*entries(t,n){yield*e(t).entries(t,n)},*refiner(t,n){yield*e(t).refiner(t,n)},coercer:(t,n)=>e(t).coercer(t,n),validator:(t,n)=>e(t).validator(t,n)})}!function(e){e.Mnemonic=\"mnemonic\",e.PrivateKey=\"private-key\",e.Custom=\"custom\",e.Mpc=\"mpc\"}(xe||(xe={}));const Ie=K({type:L(`${xe.Mnemonic}`),id:V(),derivationPath:V(),groupIndex:$()}),Te=K({type:L(`${xe.PrivateKey}`)}),Be=K({type:L(`${xe.Custom}`)}),Ce=K({type:L(`${xe.Mpc}`)}),Me=Ee(e=>{if(!se(e))return Ie;switch(e.type){case xe.PrivateKey:return Te;case xe.Custom:return Be;case xe.Mpc:return Ce;case xe.Mnemonic:default:return Ie}}),Pe=(_e=[W(V(),he),G({entropy:H(Me),exportable:H(N())})],new m({type:\"intersection\",schema:null,*entries(e,t){for(const{entries:n}of _e)yield*n(e,t)},*validator(e,t){for(const{validator:n}of _e)yield*n(e,t)},*refiner(e,t){for(const{refiner:n}of _e)yield*n(e,t)}}));var _e;const Re=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Oe=/^[-a-z0-9]{3,8}$/u,Ue=/^[-_a-zA-Z0-9]{1,32}$/u,Ne=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,ze=/^[-.%a-zA-Z0-9]{1,128}$/u,Fe=/^[-a-z0-9]{3,8}$/u,Le=/^[-.%a-zA-Z0-9]{1,128}$/u,De=/^[-.%a-zA-Z0-9]{1,78}$/u,je=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,$e=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,Ke=x(\"CaipChainId\",Re),qe=(x(\"CaipNamespace\",Oe),x(\"CaipReference\",Ue),x(\"CaipAccountId\",Ne)),He=(x(\"CaipAccountAddress\",ze),x(\"CaipAssetNamespace\",Fe),x(\"CaipAssetReference\",Le),x(\"CaipTokenId\",De),x(\"CaipAssetType\",je)),We=x(\"CaipAssetId\",$e),Ve=x(\"CaipAssetTypeOrId\",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var Ge,Ze,Je,Ye,Xe,Qe,et;function tt(e){const t=je.exec(e);if(!t?.groups)throw new Error(\"Invalid CAIP asset type.\");return{assetNamespace:t.groups.assetNamespace,assetReference:t.groups.assetReference,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}!function(e){e.Bip122=\"bip122\",e.Solana=\"solana\",e.Stellar=\"stellar\",e.Tron=\"tron\",e.Eip155=\"eip155\",e.Wallet=\"wallet\"}(Ge=Ge||(Ge={})),function(e){e.Eoa=\"eip155:eoa\",e.Erc4337=\"eip155:erc4337\"}(Ze||(Ze={})),function(e){e.P2pkh=\"bip122:p2pkh\",e.P2sh=\"bip122:p2sh\",e.P2wpkh=\"bip122:p2wpkh\",e.P2tr=\"bip122:p2tr\"}(Je||(Je={})),function(e){e.DataAccount=\"solana:data-account\"}(Ye||(Ye={})),function(e){e.Eoa=\"tron:eoa\"}(Xe||(Xe={})),function(e){e.Account=\"stellar:account\"}(Qe||(Qe={})),function(e){e.Account=\"any:account\"}(et||(et={}));const nt=z([`${Ze.Eoa}`,`${Ze.Erc4337}`,`${Je.P2pkh}`,`${Je.P2sh}`,`${Je.P2wpkh}`,`${Je.P2tr}`,`${Ye.DataAccount}`,`${Xe.Eoa}`,`${Qe.Account}`,`${et.Account}`]),rt=K({id:I,type:z([`${Ze.Eoa}`,`${Ze.Erc4337}`,`${Je.P2pkh}`,`${Je.P2sh}`,`${Je.P2wpkh}`,`${Je.P2tr}`,`${Ye.DataAccount}`,`${Xe.Eoa}`,`${Qe.Account}`,`${et.Account}`]),address:V(),scopes:te(U(Ke)),options:Pe,methods:U(V())}),it=x(\"DerivationPath\",/^m(?:\\/\\d+'?)+$/u);var ot;!function(e){e.Bip44=\"bip44\"}(ot||(ot={}));const at=K({type:L(`${ot.Bip44}`),scopes:U(Ke),derivationPath:it}),st=K({limit:$(),next:H(j(V()))}),ct=K({amount:T,unit:V(),metadata:H(W(V(),he))}),ut=K({transport:V(),selfReportedOrigin:V()}),lt=K({id:E,scope:V(),account:E,origin:V(),originMetadata:H(j(ut)),request:K({method:V(),params:H(Z([U(he),W(V(),he)]))})}),dt=K({type:L(\"address:import\"),address:V(),accountType:H(nt),scopes:H(te(U(Ke)))}),ft=K({type:L(\"bip44:derive-path\"),entropySource:V(),derivationPath:it}),ht=K({type:L(\"bip44:derive-index\"),entropySource:V(),groupIndex:$()}),pt=K({type:L(\"bip44:discover\"),entropySource:V(),groupIndex:$()}),gt=K({type:L(\"bip44:derive-index-range\"),entropySource:V(),range:K({from:$(),to:$()})}),mt=G({type:L(\"custom\")});var yt;!function(e){e.Hexadecimal=\"hexadecimal\",e.Base58=\"base58\",e.Base32=\"base32\"}(yt||(yt={}));const wt=z([`${yt.Hexadecimal}`,`${yt.Base58}`,`${yt.Base32}`]),vt=(K({encoding:wt,type:H(nt)}),K({encoding:wt}),K({type:L(\"private-key:import\"),privateKey:R(V()),encoding:wt,accountType:H(nt)}));var At;!function(e){e.Bip44DerivePath=\"bip44:derive-path\",e.Bip44DeriveIndex=\"bip44:derive-index\",e.Bip44DeriveIndexRange=\"bip44:derive-index-range\",e.Bip44Discover=\"bip44:discover\",e.PrivateKeyImport=\"private-key:import\",e.AddressImport=\"address:import\",e.Custom=\"custom\"}(At||(At={}));const bt=Ee(e=>{const t=e?.type;switch(t){case At.Bip44DerivePath:return ft;case At.Bip44DeriveIndex:return ht;case At.Bip44DeriveIndexRange:return gt;case At.Bip44Discover:return pt;case At.PrivateKeyImport:return vt;case At.AddressImport:return dt;case At.Custom:return mt;default:return ft}});var St;!function(e){e.CreateAccount=\"keyring_createAccount\",e.CreateAccounts=\"keyring_createAccounts\",e.DeleteAccount=\"keyring_deleteAccount\",e.DiscoverAccounts=\"keyring_discoverAccounts\",e.ExportAccount=\"keyring_exportAccount\",e.FilterAccountChains=\"keyring_filterAccountChains\",e.GetAccount=\"keyring_getAccount\",e.ListAccounts=\"keyring_listAccounts\",e.UpdateAccount=\"keyring_updateAccount\",e.ApproveRequest=\"keyring_approveRequest\",e.GetRequest=\"keyring_getRequest\",e.ListRequests=\"keyring_listRequests\",e.RejectRequest=\"keyring_rejectRequest\",e.SubmitRequest=\"keyring_submitRequest\",e.GetAccountBalances=\"keyring_getAccountBalances\",e.ListAccountAssets=\"keyring_listAccountAssets\",e.ListAccountTransactions=\"keyring_listAccountTransactions\",e.SetSelectedAccounts=\"keyring_setSelectedAccounts\",e.ResolveAccountAddress=\"keyring_resolveAccountAddress\"}(St||(St={}));const kt={jsonrpc:L(\"2.0\"),id:Z([V(),$(),L(null)])},xt=(K({...kt,method:L(\"keyring_listAccounts\")}),U(rt),K({...kt,method:L(\"keyring_getAccount\"),params:K({id:E})}),K({...kt,method:L(\"keyring_createAccount\"),params:K({options:W(V(),he)})}),K({...kt,method:L(\"keyring_createAccounts\"),params:K({options:bt})}),U(rt),K({...kt,method:L(\"keyring_setSelectedAccounts\"),params:K({accounts:U(V())})}),L(null),K({...kt,method:L(\"keyring_discoverAccounts\"),params:K({scopes:U(Ke),entropySource:V(),groupIndex:$()})}),U(at),K({...kt,method:L(\"keyring_listAccountTransactions\"),params:K({id:E,pagination:st})})),Et=K({...kt,method:L(\"keyring_listAccountAssets\"),params:K({id:E})}),It=U(Ve),Tt=(K({...kt,method:L(`${St.GetAccountBalances}`),params:K({id:E,assets:U(He)})}),W(He,ct),K({...kt,method:L(\"keyring_resolveAccountAddress\"),params:K({scope:Ke,request:ke})}),j(K({address:qe})),K({...kt,method:L(\"keyring_filterAccountChains\"),params:K({id:E,chains:U(V())})}),U(V()),K({...kt,method:L(\"keyring_updateAccount\"),params:K({account:rt})}),L(null),K({...kt,method:L(\"keyring_deleteAccount\"),params:K({id:E})}),L(null),K({...kt,method:L(\"keyring_exportAccount\"),params:K({id:E})}),K({...kt,method:L(\"keyring_listRequests\")}),U(lt),K({...kt,method:L(\"keyring_getRequest\"),params:K({id:E})}),K({...kt,method:L(\"keyring_submitRequest\"),params:lt}),K({...kt,method:L(\"keyring_approveRequest\"),params:K({id:E,data:W(V(),he)})}),L(null),K({...kt,method:L(\"keyring_rejectRequest\"),params:K({id:E})}),L(null),K({type:L(\"private-key\"),privateKey:R(V()),encoding:wt}),K({type:L(\"private-key\"),encoding:wt}));var Bt;!function(e){e.PrivateKey=\"private-key\"}(Bt||(Bt={}));const Ct=Tt;const Mt={GetAccounts:\"keyring_getAccounts\",CreateAccounts:\"keyring_createAccounts\",GetAccount:\"keyring_getAccount\",DeleteAccount:\"keyring_deleteAccount\",ExportAccount:\"keyring_exportAccount\",SubmitRequest:\"keyring_submitRequest\"};const Pt={jsonrpc:L(\"2.0\"),id:Z([V(),$(),L(null)])},_t=K({...Pt,method:L(`${Mt.GetAccounts}`)}),Rt=(U(rt),K({...Pt,method:L(`${Mt.GetAccount}`),params:K({id:E})})),Ot=K({...Pt,method:L(`${Mt.CreateAccounts}`),params:bt}),Ut=(U(rt),K({...Pt,method:L(`${Mt.DeleteAccount}`),params:K({id:E})})),Nt=(L(null),K({...Pt,method:L(`${Mt.ExportAccount}`),params:K({id:E,options:H(Ct)})})),zt=K({...Pt,method:L(`${Mt.SubmitRequest}`),params:lt}),Ft=K({address:qe});const Lt={...Mt,SetSelectedAccounts:\"keyring_setSelectedAccounts\",GetAccountTransactions:\"keyring_getAccountTransactions\",GetAccountAssets:\"keyring_getAccountAssets\",GetAccountBalances:\"keyring_getAccountBalances\",ResolveAccountAddress:\"keyring_resolveAccountAddress\"};const Dt={jsonrpc:L(\"2.0\"),id:Z([V(),$(),L(null)])},jt=K({...Dt,method:L(`${Lt.SetSelectedAccounts}`),params:K({accounts:U(V())})}),$t=(L(null),K({...Dt,method:L(`${Lt.GetAccountTransactions}`),params:K({id:E,pagination:st})})),Kt=K({...Dt,method:L(`${Lt.GetAccountAssets}`),params:K({id:E})}),qt=(U(Ve),K({...Dt,method:L(`${Lt.GetAccountBalances}`),params:K({id:E,assets:U(He)})})),Ht=(W(He,ct),K({...Dt,method:L(`${Lt.ResolveAccountAddress}`),params:K({scope:Ke,request:ke})})),Wt=(j(Ft),-31002),Vt=\"Snap Error\";function Gt(e,t,n=null){return ie(e)&&oe(e,t)?e[t]:n}function Zt(e,t,n=String(e)){const r=Gt(e,t);return\"string\"==typeof r?r:n}function Jt(e){return Zt(e,\"message\")}function Yt(e){return Zt(e,\"stack\",null)}function Xt(e){return Zt(e,\"name\",e instanceof Error?e.name:\"Error\")}function Qt(e){const t=Gt(e,\"data\");return null!==t&&pe(t)&&!Array.isArray(t)?t:{}}function en(e){if(ie(e)&&\"serialize\"in e&&\"function\"==typeof e.serialize){const t=e.serialize();return Se(t)&&function(e){return e.code===Wt&&e.message===Vt}(t)}return!1}var tn=n(282);const nn={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},rn={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},on={\"-32700\":{standard:\"JSON RPC 2.0\",message:\"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.\"},\"-32600\":{standard:\"JSON RPC 2.0\",message:\"The JSON sent is not a valid Request object.\"},\"-32601\":{standard:\"JSON RPC 2.0\",message:\"The method does not exist / is not available.\"},\"-32602\":{standard:\"JSON RPC 2.0\",message:\"Invalid method parameter(s).\"},\"-32603\":{standard:\"JSON RPC 2.0\",message:\"Internal JSON-RPC error.\"},\"-32000\":{standard:\"EIP-1474\",message:\"Invalid input.\"},\"-32001\":{standard:\"EIP-1474\",message:\"Resource not found.\"},\"-32002\":{standard:\"EIP-1474\",message:\"Resource unavailable.\"},\"-32003\":{standard:\"EIP-1474\",message:\"Transaction rejected.\"},\"-32004\":{standard:\"EIP-1474\",message:\"Method not supported.\"},\"-32005\":{standard:\"EIP-1474\",message:\"Request limit exceeded.\"},4001:{standard:\"EIP-1193\",message:\"User rejected the request.\"},4100:{standard:\"EIP-1193\",message:\"The requested account and/or method has not been authorized by the user.\"},4200:{standard:\"EIP-1193\",message:\"The requested method is not supported by this Ethereum provider.\"},4900:{standard:\"EIP-1193\",message:\"The provider is disconnected from all chains.\"},4901:{standard:\"EIP-1193\",message:\"The provider is disconnected from the specified chain.\"}};const an=nn.internal,sn=(cn(an),\"Unspecified server error.\");function cn(e,t=\"Unspecified error message. This is a bug, please report it.\"){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(oe(on,t))return on[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return sn}return t}function un(e){return Array.isArray(e)?e.map(e=>pe(e)?e:ie(e)?ln(e):null):ie(e)?ln(e):pe(e)?e:null}function ln(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return pe(r)&&(t[n]=r),t},{})}const dn=function(e){return e?.__esModule?e.default:e}(tn);class fn extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('\"code\" must be an integer.');if(!t||\"string\"!=typeof t)throw new Error('\"message\" must be a non-empty string.');!function(e){return ie(e)&&oe(e,\"cause\")&&ie(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),oe(this,\"cause\")||Object.assign(this,{cause:n.cause})),void 0!==n&&(this.data=n),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,se(this.data)&&(e.data.cause=un(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return dn(this.serialize(),pn,2)}}class hn extends fn{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('\"code\" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function pn(e,t){if(\"[Circular]\"!==t)return t}const gn=e=>Pn(nn.parse,e),mn=e=>Pn(nn.invalidRequest,e),yn=e=>Pn(nn.invalidParams,e),wn=e=>Pn(nn.methodNotFound,e),vn=e=>Pn(nn.internal,e),An=e=>Pn(nn.invalidInput,e),bn=e=>Pn(nn.resourceNotFound,e),Sn=e=>Pn(nn.resourceUnavailable,e),kn=e=>Pn(nn.transactionRejected,e),xn=e=>Pn(nn.methodNotSupported,e),En=e=>Pn(nn.limitExceeded,e),In=e=>_n(rn.userRejectedRequest,e),Tn=e=>_n(rn.unauthorized,e),Bn=e=>_n(rn.unsupportedMethod,e),Cn=e=>_n(rn.disconnected,e),Mn=e=>_n(rn.chainDisconnected,e);function Pn(e,t){const[n,r]=Rn(t);return new fn(e,n??cn(e),r)}function _n(e,t){const[n,r]=Rn(t);return new hn(e,n??cn(e),r)}function Rn(e){if(e){if(\"string\"==typeof e)return[e];if(\"object\"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&\"string\"!=typeof t)throw new Error(\"Must specify string message.\");return[t??void 0,n]}}return[]}class On extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=Jt(e);super(n),this.#t=n,this.#e=function(e){const t=Gt(e,\"code\");return\"number\"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Qt(e),...t};Object.keys(r).length>0&&(this.#n=r),this.#r=super.stack}get name(){return\"SnapError\"}get code(){return this.#e}get message(){return this.#t}get data(){return this.#n}get stack(){return this.#r}toJSON(){return{code:Wt,message:Vt,data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}}function Un(e){if(\"string\"==typeof e)return{name:\"Error\",message:e,stack:null,cause:null};if(Se(e))return{name:\"JsonRpcError\",message:Jt(e),stack:Yt(e)??Yt(e.data)??null,cause:null};const t=function(e){return Gt(e,\"cause\")}(e);return{name:Xt(e),message:Jt(e),stack:Yt(e)??null,cause:null===t?null:Un(t)}}function Nn(e){return class extends On{constructor(t,n){if(\"object\"==typeof t){const n=e();return void super({code:n.code,message:n.message,data:t})}const r=e(t);super({code:r.code,message:r.message,data:n})}}}const zn=Nn(vn),Fn=Nn(An),Ln=Nn(yn),Dn=Nn(mn),jn=Nn(En),$n=Nn(wn),Kn=Nn(xn),qn=Nn(gn),Hn=Nn(bn),Wn=Nn(Sn),Vn=Nn(kn),Gn=Nn(Mn),Zn=Nn(Cn),Jn=Nn(Tn),Yn=Nn(Bn),Xn=Nn(In);class Qn extends Kn{constructor(e){super(`Method not supported: ${e}`)}}async function er(e,t){try{return await async function(e,t){switch(v(t,ke),t.method){case`${Mt.GetAccounts}`:return v(t,_t),e.getAccounts();case`${Mt.GetAccount}`:return v(t,Rt),e.getAccount(t.params.id);case`${Mt.CreateAccounts}`:return v(t,Ot),e.createAccounts(t.params);case`${Mt.DeleteAccount}`:return v(t,Ut),e.deleteAccount(t.params.id);case`${Mt.ExportAccount}`:if(void 0===e.exportAccount)throw new Qn(t.method);return v(t,Nt),e.exportAccount(t.params.id,t.params.options);case`${Mt.SubmitRequest}`:return v(t,zt),e.submitRequest(t.params);case`${Lt.SetSelectedAccounts}`:if(void 0===e.setSelectedAccounts)throw new Qn(t.method);return v(t,jt),e.setSelectedAccounts(t.params.accounts);case`${St.ListAccountTransactions}`:if(void 0===e.getAccountTransactions)throw new Qn(t.method);return v(t,xt),e.getAccountTransactions(t.params.id,t.params.pagination);case`${Lt.GetAccountTransactions}`:if(void 0===e.getAccountTransactions)throw new Qn(t.method);return v(t,$t),e.getAccountTransactions(t.params.id,t.params.pagination);case`${St.ListAccountAssets}`:if(void 0===e.getAccountAssets)throw new Qn(t.method);return v(t,Et),e.getAccountAssets(t.params.id);case`${Lt.GetAccountAssets}`:if(void 0===e.getAccountAssets)throw new Qn(t.method);return v(t,Kt),e.getAccountAssets(t.params.id);case`${Lt.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new Qn(t.method);return v(t,qt),e.getAccountBalances(t.params.id,t.params.assets);case`${Lt.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new Qn(t.method);return v(t,Ht),e.resolveAccountAddress(t.params.scope,t.params.request);default:throw new Qn(t.method)}}(e,t)}catch(e){if(en(e))throw e;const t=e instanceof Error&&\"string\"==typeof e.message?e.message:\"An unknown error occurred while handling the keyring (v2) request\";throw new Error(t)}}const tr=(e,t,n)=>{if(!e)throw new Jn(\"Origin not found\");if(!n.get(e)?.has(t))throw new Jn(\"Permission denied\")};var nr=/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i,rr=Math.ceil,ir=Math.floor,or=\"[BigNumber Error] \",ar=or+\"Number primitive has more than 15 significant digits: \",sr=1e14,cr=14,ur=9007199254740991,lr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],dr=1e7,fr=1e9;function hr(e){var t=0|e;return e>0||e===t?t:t-1}function pr(e){for(var t,n,r=1,i=e.length,o=e[0]+\"\";r<i;){for(t=e[r++]+\"\",n=cr-t.length;n--;t=\"0\"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function gr(e,t){var n,r,i=e.c,o=t.c,a=e.s,s=t.s,c=e.e,u=t.e;if(!a||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=a<0,r=c==u,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>u^n?1:-1;for(s=(c=i.length)<(u=o.length)?c:u,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function mr(e,t,n,r){if(e<t||e>n||e!==ir(e))throw Error(or+(r||\"Argument\")+(\"number\"==typeof e?e<t||e>n?\" out of range: \":\" not an integer: \":\" not a primitive number: \")+String(e))}function yr(e){var t=e.c.length-1;return hr(e.e/cr)==t&&e.c[t]%2!=0}function wr(e,t){return(e.length>1?e.charAt(0)+\".\"+e.slice(1):e)+(t<0?\"e\":\"e+\")+t}function vr(e,t,n){var r,i;if(t<0){for(i=n+\".\";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+\".\"+e.slice(t));return e}var Ar=function e(t){var n,r,i,o,a,s,c,u,l,d,f=I.prototype={constructor:I,toString:null,valueOf:null},h=new I(1),p=20,g=4,m=-7,y=21,w=-1e7,v=1e7,A=!1,b=1,S=0,k={prefix:\"\",groupSize:3,secondaryGroupSize:0,groupSeparator:\",\",decimalSeparator:\".\",fractionGroupSize:0,fractionGroupSeparator:\" \",suffix:\"\"},x=\"0123456789abcdefghijklmnopqrstuvwxyz\",E=!0;function I(e,t){var n,o,a,s,c,u,l,d,f=this;if(!(f instanceof I))return new I(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>v?f.c=f.e=null:e.e<w?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((u=\"number\"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>v?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!nr.test(d=String(e)))return i(f,d,u);f.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf(\".\"))>-1&&(d=d.replace(\".\",\"\")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(mr(t,2,x.length,\"Base\"),10==t&&E)return M(f=new I(e),p+f.e+1,g);if(d=String(e),u=\"number\"==typeof e){if(0*e!=0)return i(f,d,u,t);if(f.s=1/e<0?(d=d.slice(1),-1):1,I.DEBUG&&d.replace(/^0\\.0*|\\./,\"\").length>15)throw Error(ar+e)}else f.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=x.slice(0,t),s=c=0,l=d.length;c<l;c++)if(n.indexOf(o=d.charAt(c))<0){if(\".\"==o){if(c>s){s=l;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return i(f,String(e),u,t)}u=!1,(s=(d=r(d,t,10,f.s)).indexOf(\".\"))>-1?d=d.replace(\".\",\"\"):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(l=d.length;48===d.charCodeAt(--l););if(d=d.slice(c,++l)){if(l-=c,u&&I.DEBUG&&l>15&&(e>ur||e!==ir(e)))throw Error(ar+f.s*e);if((s=s-c-1)>v)f.c=f.e=null;else if(s<w)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%cr,s<0&&(c+=cr),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=cr;c<l;)f.c.push(+d.slice(c,c+=cr));c=cr-(d=d.slice(c)).length}else c-=l;for(;c--;d+=\"0\");f.c.push(+d)}}else f.c=[f.e=0]}function T(e,t,n,r){var i,o,a,s,c;if(null==n?n=g:mr(n,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)c=pr(e.c),c=1==r||2==r&&(a<=m||a>=y)?wr(c,a):vr(c,a,\"0\");else if(o=(e=M(new I(e),t,n)).e,s=(c=pr(e.c)).length,1==r||2==r&&(t<=o||o<=m)){for(;s<t;c+=\"0\",s++);c=wr(c,o)}else if(t-=a+(2===r&&o>a),c=vr(c,o,\"0\"),o+1>s){if(--t>0)for(c+=\".\";t--;c+=\"0\");}else if((t+=o-s)>0)for(o+1==s&&(c+=\".\");t--;c+=\"0\");return e.s<0&&i?\"-\"+c:c}function B(e,t){for(var n,r,i=1,o=new I(e[0]);i<e.length;i++)(!(r=new I(e[i])).s||(n=gr(o,r))===t||0===n&&o.s===t)&&(o=r);return o}function C(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*cr-1)>v?e.c=e.e=null:n<w?e.c=[e.e=0]:(e.e=n,e.c=t),e}function M(e,t,n,r){var i,o,a,s,c,u,l,d=e.c,f=lr;if(d){e:{for(i=1,s=d[0];s>=10;s/=10,i++);if((o=t-i)<0)o+=cr,a=t,c=d[u=0],l=ir(c/f[i-a-1]%10);else if((u=rr((o+1)/cr))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,i=1,a=(o%=cr)-cr+1}else{for(c=s=d[u],i=1;s>=10;s/=10,i++);l=(a=(o%=cr)-cr+i)<0?0:ir(c/f[i-a-1]%10)}if(r=r||t<0||null!=d[u+1]||(a<0?c:c%f[i-a-1]),r=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?a>0?c/f[i-a]:0:d[u-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,r?(t-=e.e+1,d[0]=f[(cr-t%cr)%cr],e.e=-t||0):d[0]=e.e=0,e;if(0==o?(d.length=u,s=1,u--):(d.length=u+1,s=f[cr-o],d[u]=a>0?ir(c/f[i-a]%f[a])*s:0),r)for(;;){if(0==u){for(o=1,a=d[0];a>=10;a/=10,o++);for(a=d[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(e.e++,d[0]==sr&&(d[0]=1));break}if(d[u]+=s,d[u]!=sr)break;d[u--]=0,s=1}for(o=d.length;0===d[--o];d.pop());}e.e>v?e.c=e.e=null:e.e<w&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=pr(e.c),t=n<=m||n>=y?wr(t,n):vr(t,n,\"0\"),e.s<0?\"-\"+t:t)}return I.clone=e,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(e){var t,n;if(null!=e){if(\"object\"!=typeof e)throw Error(or+\"Object expected: \"+e);if(e.hasOwnProperty(t=\"DECIMAL_PLACES\")&&(mr(n=e[t],0,fr,t),p=n),e.hasOwnProperty(t=\"ROUNDING_MODE\")&&(mr(n=e[t],0,8,t),g=n),e.hasOwnProperty(t=\"EXPONENTIAL_AT\")&&((n=e[t])&&n.pop?(mr(n[0],-fr,0,t),mr(n[1],0,fr,t),m=n[0],y=n[1]):(mr(n,-fr,fr,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t=\"RANGE\"))if((n=e[t])&&n.pop)mr(n[0],-fr,-1,t),mr(n[1],1,fr,t),w=n[0],v=n[1];else{if(mr(n,-fr,fr,t),!n)throw Error(or+t+\" cannot be zero: \"+n);w=-(v=n<0?-n:n)}if(e.hasOwnProperty(t=\"CRYPTO\")){if((n=e[t])!==!!n)throw Error(or+t+\" not true or false: \"+n);if(n){if(\"undefined\"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(or+\"crypto unavailable\");A=n}else A=n}if(e.hasOwnProperty(t=\"MODULO_MODE\")&&(mr(n=e[t],0,9,t),b=n),e.hasOwnProperty(t=\"POW_PRECISION\")&&(mr(n=e[t],0,fr,t),S=n),e.hasOwnProperty(t=\"FORMAT\")){if(\"object\"!=typeof(n=e[t]))throw Error(or+t+\" not an object: \"+n);k=n}if(e.hasOwnProperty(t=\"ALPHABET\")){if(\"string\"!=typeof(n=e[t])||/^.?$|[+\\-.\\s]|(.).*\\1/.test(n))throw Error(or+t+\" invalid: \"+n);E=\"0123456789\"==n.slice(0,10),x=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[w,v],CRYPTO:A,MODULO_MODE:b,POW_PRECISION:S,FORMAT:k,ALPHABET:x}},I.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!I.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if(\"[object Array]\"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-fr&&i<=fr&&i===ir(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%cr)<1&&(t+=cr),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=sr||n!==ir(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(or+\"Invalid BigNumber: \"+e)},I.maximum=I.max=function(){return B(arguments,-1)},I.minimum=I.min=function(){return B(arguments,1)},I.random=(o=9007199254740992,a=Math.random()*o&2097151?function(){return ir(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,s=0,c=[],u=new I(h);if(null==e?e=p:mr(e,0,fr),i=rr(e/cr),A)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*t[s]+(t[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[s]=n[0],t[s+1]=n[1]):(c.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw A=!1,Error(or+\"crypto unavailable\");for(t=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(c.push(o%1e14),s+=7);s=i/7}if(!A)for(;s<i;)(o=a())<9e15&&(c[s++]=o%1e14);for(i=c[--s],e%=cr,i&&e&&(o=lr[cr-e],c[s]=ir(i/o)*o);0===c[s];c.pop(),s--);if(s<0)c=[r=0];else{for(r=-1;0===c[0];c.splice(0,1),r-=cr);for(s=1,o=c[0];o>=10;o/=10,s++);s<cr&&(r-=cr-s)}return u.e=r,u.c=c,u}),I.sum=function(){for(var e=1,t=arguments,n=new I(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e=\"0123456789\";function t(e,t,n,r){for(var i,o,a=[0],s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,o,a,s){var c,u,l,d,f,h,m,y,w=r.indexOf(\".\"),v=p,A=g;for(w>=0&&(d=S,S=0,r=r.replace(\".\",\"\"),h=(y=new I(i)).pow(r.length-w),S=d,y.c=t(vr(pr(h.c),h.e,\"0\"),10,o,e),y.e=y.c.length),l=d=(m=t(r,i,o,s?(c=x,e):(c=e,x))).length;0==m[--d];m.pop());if(!m[0])return c.charAt(0);if(w<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,v,A,o)).c,f=h.r,l=h.e),w=m[u=l+v+1],d=o/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=w||f)&&(0==A||A==(h.s<0?3:2)):w>d||w==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?vr(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(m.length=u,f)for(--o;++m[--u]>o;)m[u]=0,u||(++l,m=[1].concat(m));for(d=m.length;!m[--d];);for(w=0,r=\"\";w<=d;r+=c.charAt(m[w++]));r=vr(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,a,s=0,c=e.length,u=t%dr,l=t/dr|0;for(e=e.slice();c--;)s=((i=u*(o=e[c]%dr)+(r=l*o+(a=e[c]/dr|0)*u)%dr*dr+s)/n|0)+(r/dr|0)+l*a,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,o,a,s){var c,u,l,d,f,h,p,g,m,y,w,v,A,b,S,k,x,E=r.s==i.s?1:-1,T=r.c,B=i.c;if(!(T&&T[0]&&B&&B[0]))return new I(r.s&&i.s&&(T?!B||T[0]!=B[0]:B)?T&&0==T[0]||!B?0*E:E/0:NaN);for(m=(g=new I(E)).c=[],E=o+(u=r.e-i.e)+1,s||(s=sr,u=hr(r.e/cr)-hr(i.e/cr),E=E/cr|0),l=0;B[l]==(T[l]||0);l++);if(B[l]>(T[l]||0)&&u--,E<0)m.push(1),d=!0;else{for(b=T.length,k=B.length,l=0,E+=2,(f=ir(s/(B[0]+1)))>1&&(B=e(B,f,s),T=e(T,f,s),k=B.length,b=T.length),A=k,w=(y=T.slice(0,k)).length;w<k;y[w++]=0);x=B.slice(),x=[0].concat(x),S=B[0],B[1]>=s/2&&S++;do{if(f=0,(c=t(B,y,k,w))<0){if(v=y[0],k!=w&&(v=v*s+(y[1]||0)),(f=ir(v/S))>1)for(f>=s&&(f=s-1),p=(h=e(B,f,s)).length,w=y.length;1==t(h,y,p,w);)f--,n(h,k<p?x:B,p,s),p=h.length,c=1;else 0==f&&(c=f=1),p=(h=B.slice()).length;if(p<w&&(h=[0].concat(h)),n(y,h,w,s),w=y.length,-1==c)for(;t(B,y,k,w)<1;)f++,n(y,k<w?x:B,w,s),w=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[w++]=T[A]||0:(y=[T[A]],w=1)}while((A++<b||null!=y[0])&&E--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==sr){for(l=1,E=m[0];E>=10;E/=10,l++);M(g,o+(g.e=l+u*cr-1)+1,a,d)}else g.e=u,g.r=+d;return g}}(),s=/^(-?)0([xbo])(?=\\w[\\w.]*$)/i,c=/^([^.]+)\\.$/,u=/^\\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,d=/^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g,i=function(e,t,n,r){var i,o=n?t:t.replace(d,\"\");if(l.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(s,function(e,t,n){return i=\"x\"==(n=n.toLowerCase())?16:\"b\"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(c,\"$1\").replace(u,\"0.$1\")),t!=o))return new I(o,i);if(I.DEBUG)throw Error(or+\"Not a\"+(r?\" base \"+r:\"\")+\" number: \"+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new I(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return gr(this,new I(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,i,o=this;if(null!=e)return mr(e,0,fr),null==t?t=g:mr(t,0,8),M(new I(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-hr(this.e/cr))*cr,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},f.dividedBy=f.div=function(e,t){return n(this,new I(e,t),p,g)},f.dividedToIntegerBy=f.idiv=function(e,t){return n(this,new I(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,t){var n,r,i,o,a,s,c,u,l=this;if((e=new I(e)).c&&!e.isInteger())throw Error(or+\"Exponent not an integer: \"+P(e));if(null!=t&&(t=new I(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new I(Math.pow(+P(l),a?e.s*(2-yr(e)):+P(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new I(NaN);(r=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&yr(e)?-0:0,l.e>-1&&(o=1/o),new I(s?1/o:o);S&&(o=rr(S/cr+2))}for(a?(n=new I(.5),s&&(e.s=1),c=yr(e)):c=(i=Math.abs(+P(e)))%2,u=new I(h);;){if(c){if(!(u=u.times(l)).c)break;o?u.c.length>o&&(u.c.length=o):r&&(u=u.mod(t))}if(i){if(0===(i=ir(i/2)))break;c=i%2}else if(M(e=e.times(n),e.e+1,1),e.e>14)c=yr(e);else{if(0===(i=+P(e)))break;c=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):r&&(l=l.mod(t))}return r?u:(s&&(u=h.div(u)),t?u.mod(t):o?M(u,S,g,void 0):u)},f.integerValue=function(e){var t=new I(this);return null==e?e=g:mr(e,0,8),M(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===gr(this,new I(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return gr(this,new I(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=gr(this,new I(e,t)))||0===t},f.isInteger=function(){return!!this.c&&hr(this.e/cr)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return gr(this,new I(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=gr(this,new I(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var n,r,i,o,a=this,s=a.s;if(t=(e=new I(e,t)).s,!s||!t)return new I(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/cr,u=e.e/cr,l=a.c,d=e.c;if(!c||!u){if(!l||!d)return l?(e.s=-t,e):new I(d?a:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new I(l[0]?a:3==g?-0:0)}if(c=hr(c),u=hr(u),l=l.slice(),s=c-u){for((o=s<0)?(s=-s,i=l):(u=c,i=d),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(r=(o=(s=l.length)<(t=d.length))?s:t,s=t=0;t<r;t++)if(l[t]!=d[t]){o=l[t]<d[t];break}if(o&&(i=l,l=d,d=i,e.s=-e.s),(t=(r=d.length)-(n=l.length))>0)for(;t--;l[n++]=0);for(t=sr-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=sr}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?C(e,l,u):(e.s=3==g?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var r,i,o=this;return e=new I(e,t),!o.c||!e.s||e.c&&!e.c[0]?new I(NaN):!e.c||o.c&&!o.c[0]?new I(o):(9==b?(i=e.s,e.s=1,r=n(o,e,0,3),e.s=i,r.s*=i):r=n(o,e,0,b),(e=o.minus(r.times(e))).c[0]||1!=b||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,t){var n,r,i,o,a,s,c,u,l,d,f,h,p,g,m,y=this,w=y.c,v=(e=new I(e,t)).c;if(!(w&&v&&w[0]&&v[0]))return!y.s||!e.s||w&&!w[0]&&!v||v&&!v[0]&&!w?e.c=e.e=e.s=null:(e.s*=y.s,w&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=hr(y.e/cr)+hr(e.e/cr),e.s*=y.s,(c=w.length)<(d=v.length)&&(p=w,w=v,v=p,i=c,c=d,d=i),i=c+d,p=[];i--;p.push(0));for(g=sr,m=dr,i=d;--i>=0;){for(n=0,f=v[i]%m,h=v[i]/m|0,o=i+(a=c);o>i;)n=((u=f*(u=w[--a]%m)+(s=h*u+(l=w[a]/m|0)*f)%m*m+p[o]+n)/g|0)+(s/m|0)+h*l,p[o--]=u%g;p[o]=n}return n?++r:p.splice(0,1),C(e,p,r)},f.negated=function(){var e=new I(this);return e.s=-e.s||null,e},f.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new I(e,t)).s,!i||!t)return new I(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/cr,a=e.e/cr,s=r.c,c=e.c;if(!o||!a){if(!s||!c)return new I(i/0);if(!s[0]||!c[0])return c[0]?e:new I(s[0]?r:0*i)}if(o=hr(o),a=hr(a),s=s.slice(),i=o-a){for(i>0?(a=o,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for((i=s.length)-(t=c.length)<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/sr|0,s[t]=sr===s[t]?0:s[t]%sr;return i&&(s=[i].concat(s),++a),C(e,s,a)},f.precision=f.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return mr(e,1,fr),null==t?t=g:mr(t,0,8),M(new I(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*cr+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},f.shiftedBy=function(e){return mr(e,-9007199254740991,ur),this.times(\"1e\"+e)},f.squareRoot=f.sqrt=function(){var e,t,r,i,o,a=this,s=a.c,c=a.s,u=a.e,l=p+4,d=new I(\"0.5\");if(1!==c||!s||!s[0])return new I(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+P(a)))||c==1/0?(((t=pr(s)).length+u)%2==0&&(t+=\"0\"),c=Math.sqrt(+t),u=hr((u+1)/2)-(u<0||u%2),r=new I(t=c==1/0?\"5e\"+u:(t=c.toExponential()).slice(0,t.indexOf(\"e\")+1)+u)):r=new I(c+\"\"),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(o=r,r=d.times(o.plus(n(a,o,l,1))),pr(o.c).slice(0,c)===(t=pr(r.c)).slice(0,c)){if(r.e<u&&--c,\"9999\"!=(t=t.slice(c-3,c+1))&&(i||\"4999\"!=t)){+t&&(+t.slice(1)||\"5\"!=t.charAt(0))||(M(r,r.e+p+2,1),e=!r.times(r).eq(a));break}if(!i&&(M(o,o.e+p+2,0),o.times(o).eq(a))){r=o;break}l+=4,c+=4,i=1}return M(r,r.e+p+1,g,e)},f.toExponential=function(e,t){return null!=e&&(mr(e,0,fr),e++),T(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(mr(e,0,fr),e=e+this.e+1),T(this,e,t)},f.toFormat=function(e,t,n){var r,i=this;if(null==n)null!=e&&t&&\"object\"==typeof t?(n=t,t=null):e&&\"object\"==typeof e?(n=e,e=t=null):n=k;else if(\"object\"!=typeof n)throw Error(or+\"Argument not an object: \"+n);if(r=i.toFixed(e,t),i.c){var o,a=r.split(\".\"),s=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||\"\",l=a[0],d=a[1],f=i.s<0,h=f?l.slice(1):l,p=h.length;if(c&&(o=s,s=c,c=o,p-=o),s>0&&p>0){for(o=p%s||s,l=h.substr(0,o);o<p;o+=s)l+=u+h.substr(o,s);c>0&&(l+=u+h.slice(o)),f&&(l=\"-\"+l)}r=d?l+(n.decimalSeparator||\"\")+((c=+n.fractionGroupSize)?d.replace(new RegExp(\"\\\\d{\"+c+\"}\\\\B\",\"g\"),\"$&\"+(n.fractionGroupSeparator||\"\")):d):l}return(n.prefix||\"\")+r+(n.suffix||\"\")},f.toFraction=function(e){var t,r,i,o,a,s,c,u,l,d,f,p,m=this,y=m.c;if(null!=e&&(!(c=new I(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(or+\"Argument \"+(c.isInteger()?\"out of range: \":\"not an integer: \")+P(c));if(!y)return new I(m);for(t=new I(h),l=r=new I(h),i=u=new I(h),p=pr(y),a=t.e=p.length-m.e-1,t.c[0]=lr[(s=a%cr)<0?cr+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=v,v=1/0,c=new I(p),u.c[0]=0;d=n(c,t,0,1),1!=(o=r.plus(d.times(i))).comparedTo(e);)r=i,i=o,l=u.plus(d.times(o=l)),u=o,t=c.minus(d.times(o=t)),c=o;return o=n(e.minus(r),i,0,1),u=u.plus(o.times(l)),r=r.plus(o.times(i)),u.s=l.s=m.s,f=n(l,i,a*=2,g).minus(m).abs().comparedTo(n(u,r,a,g).minus(m).abs())<1?[l,i]:[u,r],v=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&mr(e,1,fr),T(this,e,t,2)},f.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t=\"Infinity\",i<0&&(t=\"-\"+t)):t=\"NaN\":(null==e?t=o<=m||o>=y?wr(pr(n.c),o):vr(pr(n.c),o,\"0\"):10===e&&E?t=vr(pr((n=M(new I(n),p+o+1,g)).c),n.e,\"0\"):(mr(e,2,x.length,\"Base\"),t=r(vr(pr(n.c),o,\"0\"),10,e,i,!0)),i<0&&n.c[0]&&(t=\"-\"+t)),t},f.valueOf=f.toJSON=function(){return P(this)},f._isBigNumber=!0,f[Symbol.toStringTag]=\"BigNumber\",f[Symbol.for(\"nodejs.util.inspect.custom\")]=f.valueOf,null!=t&&I.set(t),I}();const br=Ar,Sr=(new Error(\"timeout while waiting for mutex to become available\"),new Error(\"mutex already locked\"),new Error(\"request for lock canceled\"));var kr=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class xr{constructor(e,t=Sr){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{const i={resolve:n,reject:r,weight:e,priority:t},o=Er(this._queue,e=>t<=e.priority);-1===o&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)})}runExclusive(e){return kr(this,arguments,void 0,function*(e,t=1,n=0){const[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}})}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const n=Er(e,e=>t.priority<=e.priority);e.splice(n+1,0,t)}(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach(e=>e.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const n=this._weightedWaiters[t-1];if(!n)continue;const r=n.findIndex(t=>t.priority<=e);(-1===r?n:n.splice(0,r)).forEach(e=>e.resolve())}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function Er(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var Ir=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Tr{constructor(e){this._semaphore=new xr(1,e)}acquire(){return Ir(this,arguments,void 0,function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}var Br=n(250);const{cloneDeepWith:Cr}=Br,Mr=e=>Cr(e,e=>{if(void 0===e)return{__type:\"undefined\"};if(e instanceof Ar)return{__type:\"BigNumber\",value:e.toString()};if(\"bigint\"==typeof e)return{__type:\"bigint\",value:e.toString()};if(e instanceof Uint8Array){const t=Array.from(e,e=>String.fromCharCode(e)).join(\"\");return{__type:\"Uint8Array\",value:btoa(t)}}}),Pr=e=>JSON.parse(JSON.stringify(e),(e,t)=>{if(!t)return t;if(\"undefined\"!==t.__type){if(\"BigNumber\"===t.__type)return new Ar(t.value);if(\"bigint\"===t.__type)return BigInt(t.value);if(\"Uint8Array\"===t.__type){const e=atob(t.value),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}return t}}),{cloneDeep:_r,unset:Rr}=Br,Or=()=>globalThis.snap.request;class Ur{#i=new Tr;#o=new Tr;#a=new Tr;#s=0;#c=null;async#u(){this.#o.isLocked()||(this.#c=await this.#o.acquire())}async wrapRegularStateOperation(e){await this.#i.runExclusive(async()=>{await this.#u(),this.#s+=1});try{return await e()}finally{this.#s-=1,0===this.#s&&this.#c&&(this.#c(),this.#c=null)}}async wrapRegularStateWriteOperation(e){return await this.#a.runExclusive(async()=>this.wrapRegularStateOperation(e))}async wrapManageStateOperation(e){return await this.#i.runExclusive(async()=>(await this.#o.waitForUnlock(),await e()))}}function Nr(e,t){return n=e,Boolean(\"string\"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class zr extends Error{constructor(e){super(e.message),this.code=\"ERR_ASSERTION\"}}function Fr(e,t=\"Assertion failed.\",n=zr){if(!e){if(t instanceof Error)throw t;throw Nr(n,t)}}function Lr(e){throw new Error(\"Invalid branch reached. Should be detected during compilation.\")}const Dr=\"Transaction Added\",jr=\"Transaction Rejected\",$r=\"Transaction Approved\",Kr=\"Transaction Submitted\",qr=\"Transaction Finalized\",Hr=\"Security Alert Detected\",Wr=\"Security Scan Completed\";class Vr extends Error{constructor(e,t){super(e,t),this.name=\"HttpError\"}}const Gr=1/1.4,Zr={generator:(e,t)=>{const[n,r]=e||[0,0],i=n+Math.random(),o=Math.pow(t.exponent,i)*Math.tanh(Math.sqrt(4*i)),a=isFinite(o)?Math.max(0,o-r):1/0;return[Math.min(a*Gr*t.initialDelay,t.maxDelay),[n+1,o]]},maxDelay:3e4,exponent:2,initialDelay:128};class Jr{constructor(e){this.options=e?{...Zr,...e}:Zr}next(){return Yr(this.options).next(void 0)}}const Yr=(e,t,n=0,r=-1)=>({duration:n,next(){const[n,i]=e.generator(t,e);return Yr(e,i,n,r+1)}});class Xr{constructor(e){this.interval=e}next(){return Qr(this.interval)}}const Qr=e=>({duration:e,next(){return this}});const ei=(new AbortController).signal,ti=new AbortController;ti.abort();ti.signal;class ni extends Error{constructor(e=\"Operation cancelled\"){super(e),this.message=e,this.isTaskCancelledError=!0}}const ri={dispose:()=>{}};var ii;!function(e){e.once=(e,t)=>{let n,r=!1;return n=e(e=>{t(e),n?n.dispose():r=!0}),r?(n.dispose(),ri):n},e.toPromise=(t,n)=>{if(!n)return new Promise(n=>e.once(t,n));if(n.aborted)return Promise.reject(new ni);const r=[];return new Promise((i,o)=>{const a=oi(n);r.push(a),r.push(a.event(()=>{o(new ni)})),r.push(e.once(t,e=>{i(e)}))}).finally(()=>{for(const e of r)e.dispose()})}}(ii||(ii={}));const oi=e=>{const t=new si;if(e.aborted)return t.emit(),{event:t.addListener,dispose:()=>{}};const n=()=>e.removeEventListener(\"abort\",r),r=()=>{t.emit(),n()};return e.addEventListener(\"abort\",r),{event:t.addListener,dispose:n}};class ai{constructor(){this.addListener=e=>this.addListenerInner(e)}get size(){return this.listeners?\"function\"==typeof this.listeners?1:this.listeners.length:0}emit(e){if(this.listeners)if(\"function\"==typeof this.listeners)this.listeners(e);else for(const t of this.listeners)t(e);else;}addListenerInner(e){return this.listeners?\"function\"==typeof this.listeners?this.listeners=[this.listeners,e]:this.listeners.push(e):this.listeners=e,{dispose:()=>this.removeListener(e)}}removeListener(e){if(!this.listeners)return;if(\"function\"==typeof this.listeners)return void(this.listeners===e&&(this.listeners=void 0));const t=this.listeners.indexOf(e);-1!==t&&(2===this.listeners.length?this.listeners=0===t?this.listeners[1]:this.listeners[0]:this.listeners=this.listeners.slice(0,t).concat(this.listeners.slice(t+1)))}}class si extends ai{constructor(){super(...arguments),this.addListener=e=>this.lastValue?(e(this.lastValue.value),ri):this.addListenerInner(e)}emit(e){this.lastValue={value:e},super.emit(e),this.listeners=void 0}}var ci=n(750);const ui=e=>{if(\"error\"in e)throw e.error;return\"success\"in e?e.success:e.value};class li{constructor(e=()=>!1,t=()=>!1){this.errorFilter=e,this.resultFilter=t,this.successEmitter=new ai,this.failureEmitter=new ai,this.onSuccess=this.successEmitter.addListener,this.onFailure=this.failureEmitter.addListener}clone(){return new li(this.errorFilter,this.resultFilter)}async invoke(e,...t){const n=this.successEmitter.size||this.failureEmitter.size?(()=>{if(void 0!==ci){const e=ci.now();return()=>ci.now()-e}{const e=process.hrtime.bigint();return()=>Number(process.hrtime.bigint()-e)/1e6}})():null;try{const r=await e(...t);return this.resultFilter(r)?(n&&this.failureEmitter.emit({duration:n(),handled:!0,reason:{value:r}}),{value:r}):(n&&this.successEmitter.emit({duration:n()}),{success:r})}catch(e){const t=e,r=this.errorFilter(t);if(n&&this.failureEmitter.emit({duration:n(),handled:r,reason:{error:t}}),!r)throw t;return{error:t}}}}class di extends Error{constructor(e=\"Execution prevented because the circuit breaker is open\"){super(e),this.isHydratingCircuitError=!0}}class fi extends Error{constructor(e=\"Execution prevented because the circuit breaker is open\"){super(e),this.isBrokenCircuitError=!0}}class hi extends fi{constructor(){super(\"Execution prevented because the circuit breaker is open\"),this.isIsolatedCircuitError=!0}}var pi;!function(e){e[e.Closed=0]=\"Closed\",e[e.Open=1]=\"Open\",e[e.HalfOpen=2]=\"HalfOpen\",e[e.Isolated=3]=\"Isolated\"}(pi||(pi={}));class gi{get state(){return this.innerState.value}get lastFailure(){return this.innerLastFailure}constructor(e,t){if(this.options=e,this.executor=t,this.breakEmitter=new ai,this.resetEmitter=new ai,this.halfOpenEmitter=new ai,this.stateChangeEmitter=new ai,this.innerState={value:pi.Closed},this.onBreak=this.breakEmitter.addListener,this.onReset=this.resetEmitter.addListener,this.onHalfOpen=this.halfOpenEmitter.addListener,this.onStateChange=this.stateChangeEmitter.addListener,this.onSuccess=this.executor.onSuccess,this.onFailure=this.executor.onFailure,this.halfOpenAfterBackoffFactory=\"number\"==typeof e.halfOpenAfter?new Xr(e.halfOpenAfter):e.halfOpenAfter,e.initialState){const t=e.initialState;if(this.innerState=t.ownState,this.options.breaker.state=t.breakerState,this.innerState.value===pi.Open||this.innerState.value===pi.HalfOpen){this.innerLastFailure={error:new di};let e=this.halfOpenAfterBackoffFactory.next({attempt:1,result:this.innerLastFailure,signal:ei});for(let t=2;t<=this.innerState.attemptNo;t++)e=e.next({attempt:t,result:this.innerLastFailure,signal:ei});this.innerState.backoff=e}}}isolate(){this.innerState.value!==pi.Isolated&&(this.innerState={value:pi.Isolated,counters:0},this.breakEmitter.emit({isolated:!0}),this.stateChangeEmitter.emit(pi.Isolated)),this.innerState.counters++;let e=!1;return{dispose:()=>{e||(e=!0,this.innerState.value!==pi.Isolated||--this.innerState.counters||(this.innerState={value:pi.Closed},this.resetEmitter.emit(),this.stateChangeEmitter.emit(pi.Closed)))}}}async execute(e,t=ei){const n=this.innerState;switch(n.value){case pi.Closed:const r=await this.executor.invoke(e,{signal:t});return\"success\"in r?this.options.breaker.success(n.value):(this.innerLastFailure=r,this.options.breaker.failure(n.value)&&this.open(r,t)),ui(r);case pi.HalfOpen:if(await n.test.catch(()=>{}),this.state===pi.Closed&&t.aborted)throw new ni;return this.execute(e);case pi.Open:if(Date.now()-n.openedAt<n.backoff.duration)throw new fi;const i=this.halfOpen(e,t);return this.innerState={value:pi.HalfOpen,test:i,backoff:n.backoff,attemptNo:n.attemptNo+1},this.stateChangeEmitter.emit(pi.HalfOpen),i;case pi.Isolated:throw new hi;default:throw new Error(`Unexpected circuit state ${n}`)}}toJSON(){const e=this.innerState;let t;return t=e.value===pi.HalfOpen?{value:pi.Open,openedAt:0,attemptNo:e.attemptNo}:e.value===pi.Open?{value:pi.Open,openedAt:e.openedAt,attemptNo:e.attemptNo}:e,{ownState:t,breakerState:this.options.breaker.state}}async halfOpen(e,t){this.halfOpenEmitter.emit();try{const n=await this.executor.invoke(e,{signal:t});return\"success\"in n?(this.options.breaker.success(pi.HalfOpen),this.close()):(this.innerLastFailure=n,this.options.breaker.failure(pi.HalfOpen),this.open(n,t)),ui(n)}catch(e){throw this.close(),e}}open(e,t){if(this.state===pi.Isolated||this.state===pi.Open)return;const n=this.innerState.value===pi.HalfOpen?this.innerState.attemptNo:1,r={attempt:n,result:e,signal:t},i=this.innerState.value===pi.HalfOpen?this.innerState.backoff.next(r):this.halfOpenAfterBackoffFactory.next(r);this.innerState={value:pi.Open,openedAt:Date.now(),backoff:i,attemptNo:n},this.breakEmitter.emit(e),this.stateChangeEmitter.emit(pi.Open)}close(){this.state===pi.HalfOpen&&(this.innerState={value:pi.Closed},this.resetEmitter.emit(),this.stateChangeEmitter.emit(pi.Closed))}}const mi=(e,t)=>new Promise(n=>{const r=setTimeout(n,e);t&&r.unref()});class yi{constructor(e,t){this.options=e,this.executor=t,this.onGiveUpEmitter=new ai,this.onRetryEmitter=new ai,this.onSuccess=this.executor.onSuccess,this.onFailure=this.executor.onFailure,this.onRetry=this.onRetryEmitter.addListener,this.onGiveUp=this.onGiveUpEmitter.addListener}dangerouslyUnref(){return new yi({...this.options,unref:!0},this.executor.clone())}async execute(e,t=ei){const n=this.options.backoff||new Xr(0);let r;for(let i=0;;i++){const o=await this.executor.invoke(e,{attempt:i,signal:t});if(\"success\"in o)return o.success;if(!t.aborted&&i<this.options.maxAttempts){const e={attempt:i+1,signal:t,result:o};r=r?r.next(e):n.next(e);const a=r.duration,s=mi(a,!!this.options.unref);this.onRetryEmitter.emit({...o,delay:a,attempt:i+1}),await s;continue}if(this.onGiveUpEmitter.emit(o),\"error\"in o)throw o.error;return o.value}}}const wi=(e,t)=>t?n=>n instanceof e&&t(n):t=>t instanceof e,vi=()=>!1;class Ai{constructor(e){this.options=e}orType(e,t){const n=wi(e,t);return new Ai({...this.options,errorFilter:e=>this.options.errorFilter(e)||n(e)})}orWhen(e){return new Ai({...this.options,errorFilter:t=>this.options.errorFilter(t)||e(t)})}orWhenResult(e){return new Ai({...this.options,resultFilter:t=>this.options.resultFilter(t)||e(t)})}orResultType(e,t){const n=wi(e,t);return new Ai({...this.options,resultFilter:e=>this.options.resultFilter(e)||n(e)})}}new class{constructor(){this.executor=new li,this.onSuccess=this.executor.onSuccess,this.onFailure=this.executor.onFailure}async execute(e,t=ei){return ui(await this.executor.invoke(e,{signal:t}))}};const bi=new Ai({errorFilter:()=>!0,resultFilter:vi});function Si(e){return new Ai({errorFilter:e,resultFilter:vi})}class ki{constructor(e){this.threshold=e,this.state=0}success(){this.state=0}failure(){return++this.state>=this.threshold}}const xi=\"available\",Ei=\"degraded\",Ii=\"unavailable\",Ti=\"unknown\",Bi=3,Ci=3*(1+Bi),Mi=18e5,Pi=5e3,_i=e=>\"object\"!=typeof e||null===e||!(\"httpStatus\"in e)||\"number\"!=typeof e.httpStatus||e.httpStatus>=500;function Ri(e){return e===pi.Open?{state:e,openedAt:Date.now()}:{state:e}}function Oi(e={}){const{maxRetries:t=Bi,retryFilterPolicy:n=bi,maxConsecutiveFailures:r=Ci,circuitBreakDuration:i=Mi,degradedThreshold:o=Pi,backoff:a=new Jr,isServiceFailure:s=_i}=e;let c=Ti;const u=function(e,t){return new yi({backoff:t.backoff||new Xr(0),maxAttempts:t.maxAttempts??1/0},new li(e.options.errorFilter,e.options.resultFilter))}(n,{maxAttempts:t,backoff:a}),l=u.onRetry.bind(u),d=new ki(r),f=function(e,t){return new gi(t,new li(e.options.errorFilter,e.options.resultFilter))}(Si(s),{halfOpenAfter:i,breaker:d});let h=Ri(f.state);f.onStateChange(e=>{h=Ri(e)}),f.onBreak(()=>{c=Ii});const p=f.onBreak.bind(f),g=new ai,m=g.addListener,y=new ai,w=y.addListener;u.onGiveUp(e=>{f.state===pi.Closed&&(c=Ei,g.emit(e))}),u.onSuccess(({duration:e})=>{f.state===pi.Closed&&(e>o?(c=Ei,g.emit({duration:e})):c!==xi&&(c=xi,y.emit()))});const v=function(...e){return{_altReturn:void 0,onFailure:e[0].onFailure,onSuccess:e[0].onSuccess,wrapped:e,execute(t,n){const r=(n,i)=>i===e.length?t(n):e[i].execute(e=>r({...n,...e},i+1),n.signal);return Promise.resolve(r({signal:n},0))}}}(u,f);return{...v,circuitBreakerPolicy:f,circuitBreakDuration:i,getCircuitState:()=>f.state,getRemainingCircuitOpenDuration:()=>h.state===pi.Open?h.openedAt+i-Date.now():null,reset:()=>{const{dispose:e}=f.isolate();e(),d.success(),c=Ti},retryPolicy:u,onBreak:p,onDegraded:m,onAvailable:w,onRetry:l}}const Ui=\"NetworkError\",Ni=\"TimeoutError\",zi=new Set([408,425,429,500,502,503,504]),Fi=(e,{name:t,httpStatus:n,retryAfterMs:r,cause:i}={})=>{const o=new Error(e,void 0===i?void 0:{cause:i});return void 0!==t&&(o.name=t),void 0!==n&&(o.httpStatus=n),void 0!==r&&(o.retryAfterMs=r),o},Li=e=>{if(!(e instanceof Error))return!1;const{name:t,httpStatus:n}=e;return t===Ui||t===Ni||void 0!==n&&zi.has(n)},Di=e=>Li(e)||(e?.httpStatus??0)>=500,ji=e=>e.error,$i=e=>({next(t){const n=e.next(t),r=ji(t.result),i=r?.retryAfterMs,o=\"number\"==typeof i&&Number.isFinite(i)&&i>=0?i:0;return{...$i(n),duration:Math.max(n.duration,o)}}}),Ki=({service:e,chainIdCaip:t,logger:n,backoff:r=new Jr,...i})=>{const o=`[${[e,t].filter(Boolean).join(\" \")}]`,a=Oi({circuitBreakDuration:3e4,...i,backoff:$i(r),retryFilterPolicy:Si(e=>{if(!Li(e))return!1;const t=e.retryAfterMs??0;return!(t>3e4)||(n.warn(`${o} Not retrying: Retry-After of ${t} ms is over the 30000 ms cap:`,e),!1)}),isServiceFailure:Di});return a.onRetry(({attempt:e,delay:t,...r})=>n.warn(`${o} Retrying (attempt ${e}, delay ${t} ms):`,ji(r))),a.retryPolicy.onGiveUp(e=>n.warn(`${o} Giving up:`,ji(e))),a.onBreak(e=>{const t=`${o} Circuit opened for ${a.circuitBreakDuration} ms`,r=ji(e);void 0===r?n.warn(t):n.warn(`${t}:`,r)}),a};function qi(e){if(\"string\"!=typeof e)return;const t=Number(e);if(Number.isFinite(t)&&t>=0)return 1e3*t;const n=Date.parse(e);return Number.isNaN(n)?void 0:Math.max(0,n-Date.now())}function Hi(e){return e instanceof Error?Fi(e.message,{name:Ui,cause:e}):Fi(\"Network request failed\",{name:Ui,cause:e})}function Wi(){return Object.assign(new Error(\"The operation was aborted.\"),{name:\"AbortError\"})}function Vi(){}async function Gi(e,t,n=Hi,r){if(r?.aborted)throw r.reason??Wi();try{return await async function(e,t){if(!t)return e;let n;const r=new Promise((e,r)=>{n=()=>{r(Wi())},t.addEventListener(\"abort\",n,{once:!0}),t.aborted&&n()});e.catch(Vi);try{return await Promise.race([e,r])}finally{t.removeEventListener(\"abort\",n)}}(e.execute(async()=>{if(r?.aborted)throw Wi();try{return await t()}catch(e){if(r?.aborted)throw Wi();if(e instanceof SyntaxError||\"AbortError\"===e?.name)throw e;if(e instanceof Error&&(void 0!==e.httpStatus||e.name===Ui||e.name===Ni))throw e;throw n(e)}},r??void 0),r??void 0)}catch(e){if(r?.aborted)throw r.reason??e;throw e}}async function Zi(e,t,n,r=globalThis.fetch){const i=n?.signal;return Gi(e,async()=>{const e=await r(t,{...n,signal:i??AbortSignal.timeout(1e4)});if(!e.ok)throw Fi(`HTTP error! status: ${e.status}`,{httpStatus:e.status,retryAfterMs:qi(e.headers?.get(\"Retry-After\"))});return e.text()},Hi,i)}const Ji=re(V(),\"safe-url\",e=>{try{const t=new URL(e),n=[\"http:\",\"https:\",\"wss:\"];if(!n.includes(t.protocol))return`URL must use one of the following protocols: ${n.join(\", \")}`;if(!e.match(/^(https?|wss):\\/\\/[^/]+\\/?/u))return\"Malformed URL - incorrect protocol format\";const r=t.hostname.toLowerCase();if(!(\"localhost\"===r||r.includes(\".\")&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/u.test(r)))return\"Invalid hostname format\";const i=decodeURIComponent(e.toLowerCase());if(e.includes(\"\\\\\")||e.includes(\"@\")||i.includes(\"\\\\\")||i.includes(\"@\")||e.toLowerCase().includes(\"%2f@\")||e.toLowerCase().includes(\"%5c@\"))return\"URL contains protocol pollution attempts\";if(e.includes(\"../\")||e.includes(\"..%2f\")||e.includes(\"..%2F\"))return\"Directory traversal attempts are not allowed\";const o=[/<[^>]*>/u,/javascript:/u,/data:/u,/\\\\[@\\\\]/u,/%2f@/u,/[^\\x20-\\x7E]/u,/\\$\\{.*?\\}/u,/#\\{.*?\\}/u,/[|;]/u,/%0[acd]|%0[acd]/u,/\\/\\/\\w+@/u,/(?:[^a-z]|^)(?:union\\s+(?:all\\s+)?select|select\\s+(?:.*\\s+)?from|insert\\s+into|update\\s+.*\\s+set|delete\\s+from|drop\\s+table|alter\\s+table|create\\s+table|exec(?:ute)?|union|where\\s+[\\d\\w]\\s*=\\s*[\\d\\w]|\\bor\\b\\s*[\\d\\w]\\s*=\\s*[\\d\\w])/iu,/'.*?(?:OR|UNION|SELECT|FROM|WHERE).*?'/iu,/%27.*?(?:OR|UNION|SELECT|FROM|WHERE).*?(?:%27|')/iu,/%20(?:OR|UNION|SELECT|FROM|WHERE)%20/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=(?:[^&]*\\/\\/|https?:)/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=%(?:[^&]*\\/\\/|https?:)/iu];for(const e of o)if(e.test(i))return\"URL contains potentially malicious patterns\";return!0}catch(e){return`Invalid URL format: ${e.message}`}}),Yi={\"Content-Type\":\"application/json\",accept:\"application/json\"};function Xi(e){return e&&\"string\"==typeof e?e.replace(/[\\u0000-\\u0008\\u000A-\\u001F\\u007F]/gu,\"\"):\"\"}function Qi(e){if(!e||\"string\"!=typeof e)return\"\";const t=Xi(e);try{const e=new URL(t);return![\"http:\",\"https:\",\"wss:\",\"ipfs:\"].includes(e.protocol)||t.length>2048?\"\":t}catch{return\"\"}}function eo(e){const{baseUrl:t,path:n,pathParams:r,queryParams:i,encodePathParams:o=!0}=e,a=Qi(t);if(\"\"===a)throw new Error(\"Invalid URL format\");v(a,Ji);const s=n.replace(/\\{(\\w+)\\}/gu,(e,t)=>{const n=r?.[t];if(void 0===n)throw new Error(`Path parameter ${t} is undefined`);const i=Xi(n);return o?encodeURIComponent(i):i}).replace(/^\\/+/u,\"\").replace(/\\/+/gu,\"/\").replace(/\\/+$/u,\"\"),c=a.endsWith(\"/\")?a:`${a}/`,u=new URL(s,c);Object.entries(i??{}).filter(([e,t])=>void 0!==t).filter(([e,t])=>null!==t).forEach(([e,t])=>{if(t){const n=Xi(t);u.searchParams.append(e,n)}});const l=u.toString();return v(l,Ji),l}const to={SILENT:\"silent\",ERROR:\"error\",WARN:\"warn\",INFO:\"info\",DEBUG:\"debug\",TRACE:\"trace\"},no={[to.SILENT]:0,[to.ERROR]:1,[to.WARN]:2,[to.INFO]:3,[to.DEBUG]:4,[to.TRACE]:5},ro=z(Object.values(to));class io{#l;#d;#f;constructor({level:e,prefix:t,decorators:n}){v(e,ro),this.#l=e,this.#d=t,this.#f=n}withPrefix(e){return new io({level:this.#l,prefix:this.#d?`${this.#d} ${e}`:e,decorators:this.#f})}error(...e){this.#h(to.ERROR,console.error,e)}warn(...e){this.#h(to.WARN,console.warn,e)}log(...e){this.info(...e)}info(...e){this.#h(to.INFO,console.info,e)}debug(...e){this.#h(to.DEBUG,console.debug,e)}trace(...e){this.#h(to.TRACE,console.trace,e)}#p(e){return no[e]>no[this.#l]}#h(e,t,n){if(this.#p(e))return;const r=this.#d?(...e)=>t(this.#d,...e):t,i=this.#f?.[e];i?i(r,...n):r(...n)}}const oo=new io({level:to.SILENT}),ao=(e,t)=>`${e}:${t.map(e=>JSON.stringify(Mr(e))).join(\":\")}`;const so=Y(X(z(Object.values(to)),to.SILENT),V(),e=>\"\"===e?void 0:e.toLowerCase());class co{#g;constructor(e,t){this.#g=((e,t)=>{try{return A(e,t)}catch(e){throw new Error(`Invalid environment configuration: ${e.message}`)}})(e,t)}get config(){return this.#g}}var uo;!function(e){e[e.Millisecond=1]=\"Millisecond\",e[e.Second=1e3]=\"Second\",e[e.Minute=6e4]=\"Minute\",e[e.Hour=36e5]=\"Hour\",e[e.Day=864e5]=\"Day\",e[e.Week=6048e5]=\"Week\",e[e.Year=31536e6]=\"Year\"}(uo=uo||(uo={}));const lo=1000000n,fo=1e9,ho={Mainnet:\"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\",Devnet:\"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1\",Testnet:\"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z\",Localnet:\"solana:123456789abcdef\"},po=Object.values(ho),go=e=>{if(!(e=>po.includes(e))(e))throw new Error(`Unsupported network: \"${e}\"`);return e},mo={SolMainnet:`${ho.Mainnet}/slip44:501`,SolDevnet:`${ho.Devnet}/slip44:501`,SolTestnet:`${ho.Testnet}/slip44:501`,SolLocalnet:`${ho.Localnet}/slip44:501`,UsdcMainnet:`${ho.Mainnet}/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`,UsdcDevnet:`${ho.Devnet}/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU`,UsdcLocalnet:`${ho.Localnet}/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`,EurcMainnet:`${ho.Mainnet}/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr`,EurcDevnet:`${ho.Devnet}/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr`,EurcLocalnet:`${ho.Localnet}/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr`,Ai16zMainnet:`${ho.Mainnet}/token:HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC`},yo=(ne(V(),/^solana:[a-zA-Z0-9]+\\/slip44:501$/u),ne(V(),/^solana:[a-zA-Z0-9]+\\/token:[a-zA-Z0-9]+$/u)),wo=(ne(V(),/^solana:[a-zA-Z0-9]+\\/nft:[a-zA-Z0-9]+$/u),k(\"TokenCaipAssetTypeFromString\",e=>{if(\"string\"!=typeof e)return\"Expected a string, but received: \"+typeof e;const[t]=yo.validate(e);return t||!0})),vo=\"slip44:501\",Ao={[mo.SolMainnet]:{symbol:\"SOL\",caip19Id:mo.SolMainnet,address:\"So11111111111111111111111111111111111111112\",decimals:9},[mo.SolDevnet]:{symbol:\"SOL\",caip19Id:mo.SolDevnet,address:\"So11111111111111111111111111111111111111112\",decimals:9},[mo.SolTestnet]:{symbol:\"SOL\",caip19Id:mo.SolTestnet,address:\"So11111111111111111111111111111111111111112\",decimals:9},[mo.SolLocalnet]:{symbol:\"SOL\",caip19Id:mo.SolLocalnet,address:\"So11111111111111111111111111111111111111112\",decimals:9},[mo.UsdcMainnet]:{symbol:\"USDC\",caip19Id:mo.UsdcMainnet,address:\"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",decimals:6},[mo.UsdcDevnet]:{symbol:\"USDC\",caip19Id:mo.UsdcDevnet,address:\"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU\",decimals:6},[mo.UsdcLocalnet]:{symbol:\"USDC\",caip19Id:mo.UsdcLocalnet,address:\"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",decimals:6}},bo={[ho.Mainnet]:{caip2Id:ho.Mainnet,cluster:\"mainnet\",name:\"Solana Mainnet\",nativeToken:Ao[mo.SolMainnet]},[ho.Devnet]:{caip2Id:ho.Devnet,cluster:\"devnet\",name:\"Solana Devnet\",nativeToken:Ao[mo.SolDevnet]},[ho.Testnet]:{caip2Id:ho.Testnet,cluster:\"testnet\",name:\"Solana Testnet\",nativeToken:Ao[mo.SolTestnet]},[ho.Localnet]:{caip2Id:ho.Localnet,cluster:\"local\",name:\"Solana Localnet\",nativeToken:Ao[mo.SolLocalnet]}},So=\"confirm-sign-and-send-transaction\";async function ko(e,t){const n=Mr(t);return snap.request({method:\"snap_createInterface\",params:{ui:e,context:n}})}async function xo(e,t,n){const r=Mr(n);return snap.request({method:\"snap_updateInterface\",params:{id:e,ui:t,context:r}})}async function Eo(e,t){return snap.request({method:\"snap_resolveInterface\",params:{id:e,value:t}})}async function Io(e){return snap.request({method:\"snap_dialog\",params:{id:e}})}async function To(){return snap.request({method:\"snap_getPreferences\"})}async function Bo(e){const t=await snap.request({method:\"snap_getInterfaceContext\",params:{id:e}});return t?Pr(t):null}async function Co(){return await snap.request({method:\"snap_getClientStatus\"})}async function Mo(e){try{return await snap.request({method:\"snap_endTrace\",params:{name:e}})}catch(e){return null}}const Po=[ho.Mainnet,ho.Devnet],_o={production:[ho.Mainnet],local:[ho.Mainnet],test:[ho.Localnet]},Ro=z(Object.values(ho)),Oo=K({symbol:V(),caip19Id:V(),address:V(),decimals:$()}),Uo=K({caip2Id:Ro,cluster:V(),name:V(),nativeToken:Oo,rpcUrls:(No=Ji,Y(U(No),V(),e=>e.split(\",\"))),webSocketUrl:Ji});var No;const zo=K({environment:z([\"local\",\"test\",\"production\"]),logLevel:so,networks:U(Uo),explorerBaseUrl:Ji,priceApi:K({baseUrl:Ji,chunkSize:$(),cacheTtlsMilliseconds:K({spotPrices:$()})}),tokenApi:K({baseUrl:Ji,chunkSize:$()}),staticApi:K({baseUrl:Ji}),transactions:K({storageLimit:$()}),securityAlertsApi:K({baseUrl:Ji}),nftApi:K({baseUrl:Ji,cacheTtlsMilliseconds:K({listAddressSolanaNfts:$(),getNftMetadata:$()})}),subscriptions:K({maxReconnectAttempts:$(),reconnectDelayMilliseconds:$(),closeConnectionsGracePeriodMilliseconds:$()})}),Fo={environment:\"production\",logLevel:\"silent\",networks:[{...bo[ho.Mainnet],rpcUrls:\"https://solana-mainnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d\",webSocketUrl:\"wss://solana-mainnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d\"},{...bo[ho.Devnet],rpcUrls:\"https://solana-devnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d\",webSocketUrl:\"wss://solana-devnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d\"},{...bo[ho.Testnet],rpcUrls:\"https://api.testnet.solana.com\",webSocketUrl:\"wss://api.testnet.solana.com\"},{...bo[ho.Localnet],rpcUrls:\"http://localhost:8899\",webSocketUrl:\"wss://localhost:8899\"}],explorerBaseUrl:\"https://solscan.io\",priceApi:{baseUrl:\"https://price.api.cx.metamask.io\",chunkSize:50,cacheTtlsMilliseconds:{spotPrices:uo.Minute}},tokenApi:{baseUrl:\"https://tokens.api.cx.metamask.io\",chunkSize:50},staticApi:{baseUrl:\"https://static.cx.metamask.io\"},securityAlertsApi:{baseUrl:\"https://security-alerts.api.cx.metamask.io\"},nftApi:{baseUrl:\"https://nft.api.cx.metamask.io\",cacheTtlsMilliseconds:{listAddressSolanaNfts:uo.Minute,getNftMetadata:uo.Minute}},transactions:{storageLimit:10},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:uo.Second,closeConnectionsGracePeriodMilliseconds:5*uo.Minute}};const Lo=new class extends co{#m;constructor(e=Fo){super(e,zo),this.#m=[]}getNetworkBy(e,t){const n=this.config.networks.find(n=>n[e]===t);if(!n)throw new Error(`Network ${e} not found`);return n}async getActiveNetworks(){if(this.#m.length>0)return this.#m;const e=(0,Br.uniq)([ho.Mainnet,..._o[this.config.environment]??[]]);try{const{clientVersion:t}=await Co(),n=t.includes(\"flask\")?[ho.Devnet]:[],r=(0,Br.uniq)([...e,...n]);return this.#m=r,this.#m}catch{return e}}};var Do=-32700,jo=-32603,$o=-32602,Ko=-32601,qo=-32600,Ho=-32020,Wo=-32015,Vo=-32014,Go=-32012,Zo=-32010,Jo=-32009,Yo=-32007,Xo=-32006,Qo=-32004,ea=-32002,ta=-32001,na=28e5,ra=2800001,ia=2800003,oa=2800006,aa=2800007,sa=2800008,ca=2800009,ua=323e4,la=32300001,da=3230002,fa=3230004,ha=361e4,pa=3610001,ga=3610003,ma=3610005,ya=3610006,wa=3610007,va=3704001,Aa=3704002,ba=3704003,Sa=4615e3,ka=4615026,xa=5508e3,Ea=5663e3,Ia=5663001,Ta=5663004,Ba=5663005,Ca=5663006,Ma=5663007,Pa=5663008,_a=5663009,Ra=5663012,Oa=5663015,Ua=5663016,Na=5663017,za=5663018,Fa=5663019,La=5663020,Da=5663021,ja=5663023,$a=5663024,Ka=5663025,qa=5663026,Ha=5663027,Wa=5663028,Va=5663030,Ga=5663031,Za=5663032,Ja=5663033,Ya=5663034,Xa=5663035,Qa=5663036,es=5663037,ts=5663039,ns=705e4,rs=7050030,is=7050031,os=7050035,as=8078e3,ss=8078001,cs=8078002,us=8078004,ls=8078005,ds=8078006,fs=8078007,hs=8078008,ps=8078010,gs=8078011,ms=8078012,ys=8078013,ws=8078014,vs=8078017,As=8078018,bs=8078022,Ss=8078024,ks=8078025,xs=8078026,Es=8078027,Is=81e5,Ts=8100002,Bs=8100003,Cs=85e5,Ms=8500002,Ps=8500004,_s=8500007,Rs=9900003;function Os(e){if(Array.isArray(e)){return\"%5B\"+e.map(Os).join(\"%2C%20\")+\"%5D\"}return\"bigint\"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function Us([e,t]){return`${e}=${Os(t)}`}function Ns(e,t={}){{let n=`Solana error #${e}; Decode this error by running \\`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${function(e){const t=Object.entries(e).map(Us).join(\"&\");return btoa(t)}(t)}'`),`${n}\\``}}function zs(e,t){return!!(e instanceof Error&&\"SolanaError\"===e.name)&&(void 0===t||e.context.__code===t)}var Fs=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([t,i])=>{\"cause\"===t?r={cause:i.value}:(void 0===n&&(n={__code:e}),Object.defineProperty(n,t,i))});super(Ns(e,n),r),this.context=Object.freeze(void 0===n?{__code:e}:n),this.name=\"SolanaError\"}};function Ls(...e){\"captureStackTrace\"in Error&&\"function\"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function Ds({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:n,rpcEnumError:r},i){let o,a;\"string\"==typeof r?o=r:(o=Object.keys(r)[0],a=r[o]);const s=e+n.indexOf(o),c=t(s,o,a),u=new Fs(s,c);return Ls(u,i),u}var js=[\"GenericError\",\"InvalidArgument\",\"InvalidInstructionData\",\"InvalidAccountData\",\"AccountDataTooSmall\",\"InsufficientFunds\",\"IncorrectProgramId\",\"MissingRequiredSignature\",\"AccountAlreadyInitialized\",\"UninitializedAccount\",\"UnbalancedInstruction\",\"ModifiedProgramId\",\"ExternalAccountLamportSpend\",\"ExternalAccountDataModified\",\"ReadonlyLamportChange\",\"ReadonlyDataModified\",\"DuplicateAccountIndex\",\"ExecutableModified\",\"RentEpochModified\",\"NotEnoughAccountKeys\",\"AccountDataSizeChanged\",\"AccountNotExecutable\",\"AccountBorrowFailed\",\"AccountBorrowOutstanding\",\"DuplicateAccountOutOfSync\",\"Custom\",\"InvalidError\",\"ExecutableDataModified\",\"ExecutableLamportChange\",\"ExecutableAccountNotRentExempt\",\"UnsupportedProgramId\",\"CallDepth\",\"MissingAccount\",\"ReentrancyNotAllowed\",\"MaxSeedLengthExceeded\",\"InvalidSeeds\",\"InvalidRealloc\",\"ComputationalBudgetExceeded\",\"PrivilegeEscalation\",\"ProgramEnvironmentSetupFailure\",\"ProgramFailedToComplete\",\"ProgramFailedToCompile\",\"Immutable\",\"IncorrectAuthority\",\"BorshIoError\",\"AccountNotRentExempt\",\"InvalidAccountOwner\",\"ArithmeticOverflow\",\"UnsupportedSysvar\",\"IllegalOwner\",\"MaxAccountsDataAllocationsExceeded\",\"MaxAccountsExceeded\",\"MaxInstructionTraceLengthExceeded\",\"BuiltinProgramsMustConsumeComputeUnits\"];function $s(e,t){const n=Number(e);return Ds({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===Sa?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===ka?{code:Number(r),index:n}:{index:n},orderedErrorNames:js,rpcEnumError:t},$s)}var Ks=[\"AccountInUse\",\"AccountLoadedTwice\",\"AccountNotFound\",\"ProgramAccountNotFound\",\"InsufficientFundsForFee\",\"InvalidAccountForFee\",\"AlreadyProcessed\",\"BlockhashNotFound\",\"CallChainTooDeep\",\"MissingSignatureForFee\",\"InvalidAccountIndex\",\"SignatureFailure\",\"InvalidProgramForExecution\",\"SanitizeFailure\",\"ClusterMaintenance\",\"AccountBorrowOutstanding\",\"WouldExceedMaxBlockCostLimit\",\"UnsupportedVersion\",\"InvalidWritableAccount\",\"WouldExceedMaxAccountCostLimit\",\"WouldExceedAccountDataBlockLimit\",\"TooManyAccountLocks\",\"AddressLookupTableNotFound\",\"InvalidAddressLookupTableOwner\",\"InvalidAddressLookupTableData\",\"InvalidAddressLookupTableIndex\",\"InvalidRentPayingAccount\",\"WouldExceedMaxVoteCostLimit\",\"WouldExceedAccountDataTotalLimit\",\"DuplicateInstruction\",\"InsufficientFundsForRent\",\"MaxLoadedAccountsDataSizeExceeded\",\"InvalidLoadedAccountsDataSizeLimit\",\"ResanitizationNeeded\",\"ProgramExecutionTemporarilyRestricted\",\"UnbalancedTransaction\"];function qs(e){return\"object\"==typeof e&&\"InstructionError\"in e?$s(...e.InstructionError):Ds({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===ns?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===rs?{index:Number(n)}:e===is||e===os?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:Ks,rpcEnumError:e},qs)}function Hs(e){let t;if(\"object\"==typeof(n=e)&&null!==n&&\"code\"in n&&\"message\"in n&&(\"number\"==typeof n.code||\"bigint\"==typeof n.code)&&\"string\"==typeof n.message){const{code:n,data:r,message:i}=e,o=Number(n);if(o===ea){const{err:e,...n}=r,i=e?{cause:qs(e)}:null;t=new Fs(ea,{...n,...i})}else{let e;switch(o){case jo:case $o:case qo:case Ko:case Do:case Go:case ta:case Qo:case Vo:case Ho:case Zo:case Jo:case Yo:case Xo:case Wo:e={__serverMessage:i};break;default:\"object\"!=typeof r||Array.isArray(r)||(e=r)}t=new Fs(o,e)}}else{const n=\"object\"==typeof e&&null!==e&&\"message\"in e&&\"string\"==typeof e.message?e.message:\"Malformed JSON-RPC error with no message attribute\";t=new Fs(10,{error:e,message:n})}var n;return Ls(t,Hs),t}var Ws=(e,t)=>function(e,t){if(e.length>=t)return e;const n=new Uint8Array(t).fill(0);return n.set(e),n}(e.length<=t?e:e.slice(0,t),t);function Vs(e,t,n){return Gs((0===n||n<=-e.byteLength)&&e.length===t.length?e:e.slice(n,n+t.length),t)}function Gs(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Zs(e,t){return\"fixedSize\"in t?t.fixedSize:t.getSizeFromValue(e)}function Js(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(Zs(t,e));return e.write(t,n,0),n}})}function Ys(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function Xs(e){return\"fixedSize\"in e&&\"number\"==typeof e.fixedSize}function Qs(e){if(!Xs(e))throw new Fs(cs)}function ec(e){return!Xs(e)}function tc(e,t){if(Xs(e)!==Xs(t))throw new Fs(us);if(Xs(e)&&Xs(t)&&e.fixedSize!==t.fixedSize)throw new Fs(ls,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!Xs(e)&&!Xs(t)&&e.maxSize!==t.maxSize)throw new Fs(ds,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function nc(e,t,n,r=0){const i=n.length-r;if(i<t)throw new Fs(ss,{bytesLength:i,codecDescription:e,expected:t})}function rc(e,t,n){if(t<0||t>n)throw new Fs(ws,{bytesLength:n,codecDescription:e,offset:t})}function ic(e,t){const n=(n,r,i)=>{const o=e.encode(n);return i=t.write(o.length,r,i),r.set(o,i),i+o.length};if(Xs(t)&&Xs(e))return Js({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=Xs(t)?t.fixedSize:t.maxSize??null,i=Xs(e)?e.fixedSize:e.maxSize??null,o=null!==r&&null!==i?r+i:null;return Js({...e,...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=Zs(n,e);return Zs(r,t)+r},write:n})}function oc(e,t){const n=(n,r)=>{const[i,o]=t.read(n,r),a=Number(i);return((r=o)>0||n.length>a)&&(n=n.slice(r,r+a)),nc(\"addDecoderSizePrefix\",a,n),[e.decode(n),r+a]};if(Xs(t)&&Xs(e))return Ys({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=Xs(t)?t.fixedSize:t.maxSize??null,i=Xs(e)?e.fixedSize:e.maxSize??null,o=null!==r&&null!==i?r+i:null;return Ys({...e,...null!==o?{maxSize:o}:{},read:n})}function ac(e,t,n){let r=e.byteOffset+(t??0);const i=n??e.byteLength;let o;return\"undefined\"==typeof SharedArrayBuffer?o=e.buffer:e.buffer instanceof SharedArrayBuffer?(o=new ArrayBuffer(e.length),new Uint8Array(o).set(new Uint8Array(e)),r=t??0):o=e.buffer,0!==r&&r!==-o.byteLength||i!==o.byteLength?o.slice(r,r+i):o}function sc(e,t){return Js({fixedSize:t,write:(n,r,i)=>{const o=e.encode(n),a=o.length>t?o.slice(0,t):o;return r.set(a,i),i+t}})}function cc(e,t){return Ys({fixedSize:t,read:(n,r)=>{nc(\"fixCodecSize\",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),Xs(e)&&(n=Ws(n,e.fixedSize));const[i]=e.read(n,0);return[i,r+t]}})}function uc(e,t){return Js({...e,write:(n,r,i)=>{const o=e=>dc(e,r.length),a=t.preOffset?t.preOffset({bytes:r,preOffset:i,wrapBytes:o}):i;rc(\"offsetEncoder\",a,r.length);const s=e.write(n,r,a),c=t.postOffset?t.postOffset({bytes:r,newPreOffset:a,postOffset:s,preOffset:i,wrapBytes:o}):s;return rc(\"offsetEncoder\",c,r.length),c}})}function lc(e,t){return Ys({...e,read:(n,r)=>{const i=e=>dc(e,n.length),o=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:i}):r;rc(\"offsetDecoder\",o,n.length);const[a,s]=e.read(n,o),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:o,postOffset:s,preOffset:r,wrapBytes:i}):s;return rc(\"offsetDecoder\",c,n.length),[a,c]}})}function dc(e,t){return 0===t?0:(e%t+t)%t}function fc(e,t){if(Xs(e)){const n=t(e.fixedSize);if(n<0)throw new Fs(ys,{bytesLength:n,codecDescription:\"resizeEncoder\"});return Js({...e,fixedSize:n})}return Js({...e,getSizeFromValue:n=>{const r=t(e.getSizeFromValue(n));if(r<0)throw new Fs(ys,{bytesLength:r,codecDescription:\"resizeEncoder\"});return r}})}function hc(e,t){if(Xs(e)){const n=t(e.fixedSize);if(n<0)throw new Fs(ys,{bytesLength:n,codecDescription:\"resizeDecoder\"});return Ys({...e,fixedSize:n})}return e}function pc(e,t){return uc(fc(e,e=>e+t),{preOffset:({preOffset:e})=>e+t})}function gc(e,t){return lc(hc(e,e=>e+t),{postOffset:({postOffset:e})=>e+t})}function mc(e,t){return Js({...ec(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,i)=>e.write(t(n),r,i)})}function yc(e,t){return Ys({...e,read:(n,r)=>{const[i,o]=e.read(n,r);return[t(i,n,r),o]}})}function wc(e,t,n,r){if(r<t||r>n)throw new Fs(gs,{codecDescription:e,max:n,min:t,value:r})}function vc(e){return 1!==e?.endian}function Ac(e){return Js({fixedSize:e.size,write(t,n,r){e.range&&wc(e.name,e.range[0],e.range[1],t);const i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,vc(e.config)),n.set(new Uint8Array(i),r),r+e.size}})}function bc(e){return Ys({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Fs(as,{codecDescription:e})}(e.name,t,n),nc(e.name,e.size,t,n);const r=new DataView(ac(t,n,e.size));return[e.get(r,vc(e.config)),n+e.size]}})}var Sc=(e={})=>bc({config:e,get:(e,t)=>e.getFloat64(0,t),name:\"f64\",size:8}),kc=(e={})=>bc({config:e,get:(e,t)=>e.getInt16(0,t),name:\"i16\",size:2}),xc=(e={})=>bc({config:e,get:(e,t)=>e.getBigInt64(0,t),name:\"i64\",size:8}),Ec=()=>bc({get:e=>e.getInt8(0),name:\"i8\",size:1}),Ic=()=>Js({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{wc(\"shortU16\",0,65535,e);const r=[0];for(let t=0;;t+=1){const n=Number(e)>>7*t;if(0===n)break;const i=127&n;r[t]=i,t>0&&(r[t-1]|=128)}return t.set(r,n),n+r.length}}),Tc=()=>Ys({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){const i=r-1,o=e[t+i];if(n|=(127&o)<<7*i,!(128&o))break}return[n,t+r]}}),Bc=(e={})=>Ac({config:e,name:\"u16\",range:[0,Number(\"0xffff\")],set:(e,t,n)=>e.setUint16(0,Number(t),n),size:2}),Cc=(e={})=>bc({config:e,get:(e,t)=>e.getUint16(0,t),name:\"u16\",size:2}),Mc=(e={})=>Ac({config:e,name:\"u32\",range:[0,Number(\"0xffffffff\")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),Pc=(e={})=>bc({config:e,get:(e,t)=>e.getUint32(0,t),name:\"u32\",size:4}),_c=(e={})=>Ac({config:e,name:\"u64\",range:[0n,BigInt(\"0xffffffffffffffff\")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),Rc=(e={})=>bc({config:e,get:(e,t)=>e.getBigUint64(0,t),name:\"u64\",size:8}),Oc=()=>Ac({name:\"u8\",range:[0,Number(\"0xff\")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),Uc=()=>bc({get:e=>e.getUint8(0),name:\"u8\",size:1});function Nc(e,t,n){if(t!==n)throw new Fs(fs,{actual:n,codecDescription:e,expected:t})}function zc(e){return e.reduce((e,t)=>null===e||null===t?null:e+t,0)}function Fc(e){return Xs(e)?e.fixedSize:null}function Lc(e){return Xs(e)?e.fixedSize:e.maxSize??null}function Dc(e,t={}){const n=t.size??Mc(),r=$c(n,Fc(e)),i=$c(n,Lc(e))??void 0;return Js({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>(\"object\"==typeof n?Zs(t.length,n):0)+[...t].reduce((t,n)=>t+Zs(n,e),0),maxSize:i},write:(r,i,o)=>(\"number\"==typeof n&&Nc(t.description??\"array\",n,r.length),\"object\"==typeof n&&(o=n.write(r.length,i,o)),r.forEach(t=>{o=e.write(t,i,o)}),o)})}function jc(e,t={}){const n=t.size??Pc(),r=Fc(e),i=$c(n,r),o=$c(n,Lc(e))??void 0;return Ys({...null!==i?{fixedSize:i}:{maxSize:o},read:(r,i)=>{const o=[];if(\"object\"==typeof n&&!t.requireSizePrefix&&i>=r.length)return[o,i];if(\"remainder\"===n){for(;i<r.length;){const[t,n]=e.read(r,i);i=n,o.push(t)}return[o,i]}const[a,s]=\"number\"==typeof n?[n,i]:n.read(r,i);i=s;for(let t=0;t<a;t+=1){const[t,n]=e.read(r,i);i=n,o.push(t)}return[o,i]}})}function $c(e,t){return\"number\"!=typeof e?null:0===e?0:null===t?null:t*e}function Kc(e={}){return mc(e.size??Oc(),e=>e?1:0)}function qc(e={}){return yc(e.size??Uc(),e=>1===Number(e))}function Hc(){return Js({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Wc(){return Ys({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}function Vc(e){return Js({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function Gc(e){return Ys({fixedSize:e.length,read:(t,n)=>{const r=Ys({read(e,t){const n=e.slice(t).reduce((e,t)=>e+t.toString(16).padStart(2,\"0\"),\"\");return[n,e.length]}});if(!Vs(t,e,n))throw new Fs(As,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function Zc(e,t){const n=zc(e.map(Fc)),r=zc(e.map(Lc))??void 0;return Js({...null===n?{getSizeFromValue:t=>e.map((e,n)=>Zs(t[n],e)).reduce((e,t)=>e+t,0),maxSize:r}:{fixedSize:n},write:(n,r,i)=>(Nc(t?.description??\"tuple\",e.length,n.length),e.forEach((e,t)=>{i=e.write(n[t],r,i)}),i)})}function Jc(e){const t=zc(e.map(Fc)),n=zc(e.map(Lc))??void 0;return Ys({...null===t?{maxSize:n}:{fixedSize:t},read:(t,n)=>{const r=[];return e.forEach(e=>{const[i,o]=e.read(t,n);r.push(i),n=o}),[r,n]}})}function Yc(e,t){const n=eu(e),r=(n,r,i)=>{const o=t(n);return Qc(e,o),e[o].write(n,r,i)};if(null!==n)return Js({fixedSize:n,write:r});const i=tu(e);return Js({...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=t(n);return Qc(e,r),Zs(n,e[r])},write:r})}function Xc(e,t){const n=eu(e),r=(n,r)=>{const i=t(n,r);return Qc(e,i),e[i].read(n,r)};if(null!==n)return Ys({fixedSize:n,read:r});const i=tu(e);return Ys({...null!==i?{maxSize:i}:{},read:r})}function Qc(e,t){if(void 0===e[t])throw new Fs(vs,{maxRange:e.length-1,minRange:0,variant:t})}function eu(e){if(0===e.length)return 0;if(!Xs(e[0]))return null;const t=e[0].fixedSize;return e.every(e=>Xs(e)&&e.fixedSize===t)?t:null}function tu(e){return e.map(e=>Lc(e)).reduce((e,t)=>null===e||null===t?null:Math.max(e,t),0)}function nu(e,t={}){const n=t.discriminator??\"__kind\",r=t.size??Uc();return Xc(e.map(([e,t])=>yc(Jc([r,t]),([,t])=>({[n]:e,...t}))),(e,t)=>Number(r.read(e,t)[0]))}function ru(e){const t=[...new Set(Object.values(e).filter(e=>\"number\"==typeof e))].sort(),n=Object.fromEntries(Object.entries(e).slice(t.length)),r=Object.keys(n),i=Object.values(n),o=[...new Set([...r,...i.filter(e=>\"string\"==typeof e)])];return{enumKeys:r,enumRecord:n,enumValues:i,numericalValues:t,stringValues:o}}function iu(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function ou(e){if(0===e.length)return\"\";let t=[e[0],e[0]];const n=[];for(let r=1;r<e.length;r++){const i=e[r];t[1]+1===i?t[1]=i:(n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),t=[i,i])}return n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),n.join(\", \")}function au(e,t={}){const n=t.size??Oc(),r=t.useValuesAsDiscriminators??!1,{enumKeys:i,enumValues:o,numericalValues:a,stringValues:s}=ru(e);if(r&&o.some(e=>\"string\"==typeof e))throw new Fs(bs,{stringValues:o.filter(e=>\"string\"==typeof e)});return mc(n,e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=iu(t,e=>e===n);return r>=0?r:e.findIndex(e=>e===n)}({enumKeys:i,enumValues:o,variant:e});if(t<0)throw new Fs(ps,{formattedNumericalValues:ou(a),numericalValues:a,stringValues:s,variant:e});return r?o[t]:t})}function su(e,t={}){const n=t.size??Uc(),r=t.useValuesAsDiscriminators??!1,{enumKeys:i,enumValues:o,numericalValues:a}=ru(e);if(r&&o.some(e=>\"string\"==typeof e))throw new Fs(bs,{stringValues:o.filter(e=>\"string\"==typeof e)});return yc(n,e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?iu(n,t=>t===e):e>=0&&e<t.length?e:-1}({discriminator:t,enumKeys:i,enumValues:o,useValuesAsDiscriminators:r});if(n<0){const e=r?a:[...Array(i.length).keys()];throw new Fs(hs,{discriminator:t,formattedValidDiscriminators:ou(e),validDiscriminators:e})}return o[n]})}function cu(e,t){return yc(Jc([...t,e]),e=>e[e.length-1])}function uu(e,t,n={}){return yc(jc(Jc([e,t]),n),e=>new Map(e))}function lu(){return Js({fixedSize:0,write:(e,t,n)=>n})}function du(){return Ys({fixedSize:0,read:(e,t)=>[void 0,t]})}function fu(e,t={}){const n=null===t.prefix?mc(lu(),e=>{}):Kc({size:t.prefix??Oc()});return Yc([mc(Zc([n,\"zeroes\"===t.noneValue?(Qs(e),sc(lu(),e.fixedSize)):t.noneValue?Vc(t.noneValue):lu()]),e=>[!1,void 0]),mc(Zc([n,e]),e=>[!0,e])],e=>Number(null!==e))}function hu(e){return Yc(e.map(([,e])=>e),t=>{const n=e.findIndex(([e])=>e(t));if(-1===n)throw new Fs(Ss);return n})}function pu(e){return Xc(e.map(([,e])=>e),t=>{const n=e.findIndex(([e])=>e(t));if(-1===n)throw new Fs(ks,{bytes:t});return n})}function gu(e){const t=e.map(([,e])=>e),n=zc(t.map(Fc)),r=zc(t.map(Lc))??void 0;return Js({...null===n?{getSizeFromValue:t=>e.map(([e,n])=>Zs(t[e],n)).reduce((e,t)=>e+t,0),maxSize:r}:{fixedSize:n},write:(t,n,r)=>(e.forEach(([e,i])=>{r=i.write(t[e],n,r)}),r)})}function mu(e){const t=e.map(([,e])=>e),n=zc(t.map(Fc)),r=zc(t.map(Lc))??void 0;return Ys({...null===n?{maxSize:r}:{fixedSize:n},read:(t,n)=>{const r={};return e.forEach(([e,i])=>{const[o,a]=i.read(t,n);n=a,r[e]=o}),[r,n]}})}function yu(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Fs(ms,{alphabet:e,base:e.length,value:n})}function wu(e,t=0){const n=e.length;let r=t;for(;r<n;){const t=e[r];let i,o=128,a=191;if(t<128){r++;continue}if(t>=194&&t<=223)i=1;else if(t>=224&&t<=239)i=2,224===t&&(o=160),237===t&&(a=159);else{if(!(t>=240&&t<=244))return r;i=3,240===t&&(o=144),244===t&&(a=143)}const s=r;r++;for(let t=0;t<i;t++,r++){if(r>=n)return s;const i=e[r];if(!(0===t?i>=o&&i<=a:i>=128&&i<=191))return s}}return-1}var vu=e=>Js({getSizeFromValue:t=>{const[n,r]=Su(t,e[0]);if(!r)return t.length;const i=ku(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(yu(e,t),\"\"===t)return r;const[i,o]=Su(t,e[0]);if(!o)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let a=ku(o,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(i.length).fill(0),...s];return n.set(c,r),r+c.length}}),Au=e=>Ys({read(t,n){const r=0===n||n<=-t.byteLength?t:t.slice(n);if(0===r.length)return[\"\",t.length];let i=r.findIndex(e=>0!==e);i=-1===i?r.length:i;const o=e[0].repeat(i);if(i===r.length)return[o,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join(\"\")}(r.slice(i).reduce((e,t)=>256n*e+BigInt(t),0n),e);return[o+a,t.length]}}),bu=e=>tc(vu(e),Au(e));function Su(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function ku(e,t){const n=BigInt(t.length);let r=0n;for(const i of e)r*=n,r+=BigInt(t.indexOf(i));return r}var xu=\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\",Eu=()=>vu(xu),Iu=()=>Au(xu),Tu=()=>bu(xu);var Bu=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";var Cu=()=>Js({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Fs(ms,{alphabet:Bu,base:64,value:e})}},write(e,t,n){try{const r=atob(e).split(\"\").map(e=>e.charCodeAt(0));return t.set(r,n),r.length+n}catch{throw new Fs(ms,{alphabet:Bu,base:64,value:e})}}}),Mu=()=>Ys({read(e,t=0){const n=btoa(function(e){let t=\"\";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}(e.subarray(t)));return[n,e.length]}}),Pu=()=>tc(Cu(),Mu()),_u=globalThis.TextDecoder,Ru=globalThis.TextEncoder,Ou=(e={})=>{let t;return Js({getSizeFromValue:e=>(t||=new Ru).encode(e).length,write:(n,r,i)=>{e.fatal&&function(e){const t=e.isWellFormed;if(\"function\"!=typeof t||!t.call(e))for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<55296||n>57343)continue;const r=e.charCodeAt(t+1);if(!(n<=56319&&r>=56320&&r<=57343))throw new Fs(Es,{index:t,value:e});t++}}(n);const o=(t||=new Ru).encode(n);return r.set(o,i),i+o.length}})},Uu=(e={})=>{let t;return Ys({read(n,r){t||=new _u(\"utf-8\",{fatal:e.fatal??!1,ignoreBOM:e.ignoreBOM??!1});let i=e.fatal?function(e,t,n){const r=t.slice(n);if(!e.fatal)return function(e,t=0){const n=wu(e,t);if(-1!==n)throw new Fs(xs,{bytes:e,offset:n})}(t,n),e.decode(r);try{return e.decode(r)}catch{throw new Fs(xs,{bytes:t,offset:wu(t,n)})}}(t,n,r):t.decode(n.slice(r));return e.ignoreBOM||void 0!==t.ignoreBOM||65279!==i.charCodeAt(0)||(i=i.slice(1)),!1!==e.removeNullCharacters&&(i=(e=>e.replace(/\\u0000/g,\"\"))(i)),[i,n.length]}})};var Nu,zu,Fu=(e={})=>tc(Ou(e),Uu(e));function Lu(){if(!globalThis.isSecureContext)throw new Fs(ha)}function Du(){if(Lu(),void 0===globalThis.crypto||\"function\"!=typeof globalThis.crypto.subtle?.exportKey)throw new Fs(ga)}function ju(){return Nu||(Nu=Eu()),Nu}function $u(e){if(e.length<32||e.length>44)return!1;const t=ju();try{return 32===t.encode(e).byteLength}catch{return!1}}function Ku(e){if(e.length<32||e.length>44)throw new Fs(ra,{actualLength:e.length});const t=ju().encode(e).byteLength;if(32!==t)throw new Fs(na,{actualLength:t})}function qu(e){return Ku(e),e}function Hu(){return mc(sc(ju(),32),e=>qu(e))}function Wu(){return cc((zu||(zu=Iu()),zu),32)}function Vu(){return tc(Hu(),Wu())}function Gu(){return new Intl.Collator(\"en\",{caseFirst:\"lower\",ignorePunctuation:!1,localeMatcher:\"best fit\",numeric:!1,sensitivity:\"variant\",usage:\"sort\"}).compare}var Zu=57896044618658097711785492504343953926634992332820282019728792003956564819949n,Ju=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function Yu(e){const t=e%Zu;return t>=0n?t:Zu+t}function Xu(e,t){let n=e;for(;t-- >0n;)n*=n,n%=Zu;return n}function Qu(e,t){const n=Yu(t*t*t),r=function(e){const t=e*e%Zu*e%Zu,n=Xu(t,2n)*t%Zu,r=Xu(n,1n)*e%Zu,i=Xu(r,5n)*r%Zu,o=Xu(i,10n)*i%Zu,a=Xu(o,20n)*o%Zu,s=Xu(a,40n)*a%Zu,c=Xu(s,80n)*s%Zu,u=Xu(c,80n)*s%Zu,l=Xu(u,10n)*i%Zu;return Xu(l,2n)*e%Zu}(e*Yu(n*n*t));let i=Yu(e*n*r);const o=Yu(t*i*i),a=i,s=Yu(i*Ju),c=o===e,u=o===Yu(-e),l=o===Yu(-e*Ju);return c&&(i=a),(u||l)&&(i=s),1n==(1n&Yu(i))&&(i=Yu(-i)),c||u?i:null}function el(e){if(32!==e.byteLength)return!1;const t=function(e){const t=e.reduce((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`,\"\");return BigInt(`0x${t}`)}(e);return function(e,t){const n=Yu(e*e),r=Qu(Yu(n-1n),Yu(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}(t,e[31])}var tl=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function nl({programAddress:e,seeds:t}){if(function(){if(Lu(),void 0===globalThis.crypto||\"function\"!=typeof globalThis.crypto.subtle?.digest)throw new Fs(pa)}(),t.length>16)throw new Fs(oa,{actual:t.length,maxSeeds:16});let n;const r=t.reduce((e,t,r)=>{const i=\"string\"==typeof t?(n||=new TextEncoder).encode(t):t;if(i.byteLength>32)throw new Fs(aa,{actual:i.byteLength,index:r,maxSeedLength:32});return e.push(...i),e},[]),i=Vu(),o=i.encode(e),a=await crypto.subtle.digest(\"SHA-256\",new Uint8Array([...r,...o,...tl])),s=new Uint8Array(a);if(el(s))throw new Fs(sa);return i.decode(s)}async function rl({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await nl({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!zs(e,sa))throw e;n--}throw new Fs(ca)}async function il(e){if(Du(),\"public\"!==e.type||\"Ed25519\"!==e.algorithm.name)throw new Fs(ia);const t=await crypto.subtle.exportKey(\"raw\",e);return Wu().decode(new Uint8Array(t))}var ol,al=((ol=al||{})[ol.WRITABLE_SIGNER=3]=\"WRITABLE_SIGNER\",ol[ol.READONLY_SIGNER=2]=\"READONLY_SIGNER\",ol[ol.WRITABLE=1]=\"WRITABLE\",ol[ol.READONLY=0]=\"READONLY\",ol);function sl(e){return e>=2}function cl(e){return!!(1&e)}function ul(e,t){return e|t}var ll,dl=Object.freeze({name:\"Ed25519\"});async function fl(e,t=!1){const n=e.byteLength;if(32!==n)throw new Fs(va,{actualLength:n});const r=function(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}(e);return await crypto.subtle.importKey(\"pkcs8\",r,dl,t,[\"sign\"])}function hl(e){const t=e.byteLength;if(64!==t)throw new Fs(Aa,{actualLength:t})}async function pl(e,t){!function(){if(Lu(),void 0===globalThis.crypto||\"function\"!=typeof globalThis.crypto.subtle?.sign)throw new Fs(ma)}();const n=await crypto.subtle.sign(dl,e,ac(t));return new Uint8Array(n)}function gl(e){return function(e){if(ll||(ll=Eu()),e.length<64||e.length>88)throw new Fs(ba,{actualLength:e.length});hl(ll.encode(e))}(e),e}async function ml(e,t,n){return function(){if(Lu(),void 0===globalThis.crypto||\"function\"!=typeof globalThis.crypto.subtle?.verify)throw new Fs(ya)}(),await crypto.subtle.verify(dl,e,ac(t),ac(n))}async function yl(e,t=!1){const n=fl(e,t),[r,i]=await Promise.all([(t?n:fl(e,!0)).then(async e=>await async function(e,t=!1){if(Du(),!1===e.extractable)throw new Fs(wa,{key:e});const n=await crypto.subtle.exportKey(\"jwk\",e);return await crypto.subtle.importKey(\"jwk\",{crv:\"Ed25519\",ext:t,key_ops:[\"verify\"],kty:\"OKP\",x:n.x},\"Ed25519\",t,[\"verify\"])}(e,!0)),n]);return{privateKey:i,publicKey:r}}function wl(e){switch(e){case\"finalized\":return 2;case\"confirmed\":return 1;case\"processed\":return 0;default:throw new Fs(Rs,{unexpectedValue:e})}}var vl=18446744073709551615n;function Al(e){return function(e){if(e<0||e>vl)throw new Fs(6)}(e),e}function bl(e,...t){return t.reduce((e,t)=>t(e),e)}function Sl(e){return\"lifetimeConstraint\"in e&&\"string\"==typeof e.lifetimeConstraint.blockhash&&\"bigint\"==typeof e.lifetimeConstraint.lastValidBlockHeight&&$u(e.lifetimeConstraint.blockhash)}function kl(e,t){return\"lifetimeConstraint\"in t&&t.lifetimeConstraint&&\"blockhash\"in t.lifetimeConstraint&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight?t:Object.freeze({...t,lifetimeConstraint:Object.freeze(e)})}var xl,El,Il,Tl;function Bl(){return xl||(xl=Oc()),xl}function Cl(){return El||(El=Uc()),El}function Ml(){return gu([[\"numSignerAccounts\",Bl()],[\"numReadonlySignerAccounts\",Bl()],[\"numReadonlyNonSignerAccounts\",Bl()]])}function Pl(){return mu([[\"numSignerAccounts\",Cl()],[\"numReadonlySignerAccounts\",Cl()],[\"numReadonlyNonSignerAccounts\",Cl()]])}function _l(){return Il||(Il=mc(gu([[\"programAddressIndex\",Oc()],[\"accountIndices\",Dc(Oc(),{size:Ic()})],[\"data\",ic(Hc(),Ic())]]),e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),Il}function Rl(){return Tl||(Tl=yc(mu([[\"programAddressIndex\",Uc()],[\"accountIndices\",jc(Uc(),{size:Tc()})],[\"data\",oc(Wc(),Tc())]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;const{accountIndices:t,data:n,...r}=e;return{...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}})),Tl}var Ol=e=>Js({getSizeFromValue:t=>{const[n,r]=Nl(t,e[0]);if(!r)return t.length;const i=zl(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(function(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Fs(ms,{alphabet:e,base:e.length,value:n})}(e,t),\"\"===t)return r;const[i,o]=Nl(t,e[0]);if(!o)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let a=zl(o,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(i.length).fill(0),...s];return n.set(c,r),r+c.length}}),Ul=e=>Ys({read(t,n){const r=0===n||n<=-t.byteLength?t:t.slice(n);if(0===r.length)return[\"\",t.length];let i=r.findIndex(e=>0!==e);i=-1===i?r.length:i;const o=e[0].repeat(i);if(i===r.length)return[o,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join(\"\")}(r.slice(i).reduce((e,t)=>256n*e+BigInt(t),0n),e);return[o+a,t.length]}});function Nl(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function zl(e,t){const n=BigInt(t.length);let r=0n;for(const i of e)r*=n,r+=BigInt(t.indexOf(i));return r}var Fl=\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";function Ll(){return mc(fu(sc(Ol(Fl),32),{noneValue:\"zeroes\",prefix:null}),e=>e??null)}function Dl(){return cc(Ul(Fl),32)}var jl,$l;function Kl(){return Js({getSizeFromValue:e=>\"legacy\"===e?0:1,maxSize:1,write:(e,t,n)=>{if(\"legacy\"===e)return n;if(e<0||e>127)throw new Fs(Ta,{actualVersion:e});if(e>1)throw new Fs(Da,{unsupportedVersion:e});return t.set([128|e],n),n+1}})}function ql(){return Ys({maxSize:1,read:(e,t)=>{const n=e[t];if(128&n){const e=128^n;if(e>1)throw new Fs(Da,{unsupportedVersion:e});return[e,t+1]}return[\"legacy\",t]}})}function Hl(){if(!jl){const e=Dc(Oc(),{size:Ic()});jl=gu([[\"lookupTableAddress\",Hu()],[\"writableIndexes\",e],[\"readonlyIndexes\",e]])}return jl}function Wl(){if(!$l){const e=jc(Uc(),{size:Tc()});$l=mu([[\"lookupTableAddress\",Wu()],[\"writableIndexes\",e],[\"readonlyIndexes\",e]])}return $l}var Vl=\"ComputeBudget111111111111111111111111111111\",Gl=14e5;function Zl(e,t){const n=gu([[\"discriminator\",Oc()],[\"value\",Hc()]]).encode({discriminator:e,value:t});return Object.freeze({data:n,programAddress:Vl})}function Jl(e,t,n){return e.programAddress===Vl&&\"data\"in e&&null!=e.data&&e.data.byteLength===n&&e.data[0]===t}function Yl(e){return Jl(e,2,5)}function Xl(e){return Jl(e,4,5)}function Ql(e,t,n){const r=[...n.instructions];return r[e]=t,Object.freeze({...n,instructions:Object.freeze(r)})}function ed(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions.slice(0,e),...t.instructions.slice(e+1)])})}function td(e){if(!Number.isInteger(e)||e<0||e>Gl)throw new Fs(ts,{computeUnitLimit:e,maxComputeUnitLimit:Gl})}function nd(e){return void 0===e.computeUnitLimit&&void 0===e.heapSize&&void 0===e.loadedAccountsDataSizeLimit&&void 0===e.priorityFeeLamports}function rd(e,t){return e.computeUnitLimit===t.computeUnitLimit&&e.heapSize===t.heapSize&&e.loadedAccountsDataSizeLimit===t.loadedAccountsDataSizeLimit&&e.priorityFeeLamports===t.priorityFeeLamports}function id(e){const t=3&e;if(1===t||2===t)throw new Fs(Wa,{mask:e});return 3===t}function od(e){return!!(4&e)}function ad(e){return!!(8&e)}function sd(e){return!!(16&e)}function cd(){return Dc(hu([[e=>\"u32\"===e.kind,mc(gu([[\"value\",Mc()]]),e=>e)],[e=>\"u64\"===e.kind,mc(gu([[\"value\",_c()]]),e=>e)]]),{size:\"remainder\"})}function ud(e){return mu([[\"instructionAccountIndices\",jc(Uc(),{size:e.numInstructionAccounts})],[\"instructionData\",cc(Wc(),e.numInstructionDataBytes)]])}function ld(){return Ys({read(e,t){const[{header:n,configMask:r,lifetimeToken:i,numInstructions:o,numStaticAccounts:a},s]=mu([[\"version\",ql()],[\"header\",Pl()],[\"configMask\",Pc()],[\"lifetimeToken\",Dl()],[\"numInstructions\",Uc()],[\"numStaticAccounts\",Uc()]]).read(e,t);let c=s;const[u,l]=jc(Wu(),{size:a}).read(e,c);c=l;const[d,f]=function(e){const t=id(e),n=od(e),r=ad(e),i=sd(e),o=yc(Pc(),e=>({kind:\"u32\",value:e})),a=yc(Rc(),e=>({kind:\"u64\",value:e})),s=du();return yc(Jc([t?a:s,n?o:s,r?o:s,i?o:s]),e=>e.filter(Boolean))}(r).read(e,c);c=f;const[h,p]=jc(mu([[\"programAccountIndex\",Uc()],[\"numInstructionAccounts\",Uc()],[\"numInstructionDataBytes\",Cc()]]),{size:o}).read(e,c);c=p;const g=[];for(const t of h){const[n,r]=ud(t).read(e,c);g.push(n),c=r}return[{configMask:r,configValues:d,header:n,instructionHeaders:h,instructionPayloads:g,lifetimeToken:i,numInstructions:o,numStaticAccounts:a,staticAccounts:u,version:1},c]}})}function dd(){return mc(hu([[e=>\"legacy\"===e.version,mc(gu([[\"header\",Ml()],[\"staticAccounts\",Dc(Hu(),{size:Ic()})],[\"lifetimeToken\",Ll()],[\"instructions\",Dc(_l(),{size:Ic()})]]),e=>({...e,lifetimeToken:\"lifetimeToken\"in e?e.lifetimeToken:void 0}))],[e=>0===e.version,mc(gu([[\"version\",Kl()],[\"header\",Ml()],[\"staticAccounts\",Dc(Hu(),{size:Ic()})],[\"lifetimeToken\",Ll()],[\"instructions\",Dc(_l(),{size:Ic()})],[\"addressTableLookups\",Dc(Hl(),{size:Ic()})]]),e=>({...e,addressTableLookups:e.addressTableLookups??[],lifetimeToken:\"lifetimeToken\"in e?e.lifetimeToken:void 0}))],[e=>1===e.version,mc(gu([[\"version\",Kl()],[\"header\",Ml()],[\"configMask\",Mc()],[\"lifetimeToken\",Ll()],[\"numInstructions\",Oc()],[\"numStaticAccounts\",Oc()],[\"staticAccounts\",Dc(Hu(),{size:\"remainder\"})],[\"configValues\",cd()],[\"instructionHeaders\",Dc(gu([[\"programAccountIndex\",Oc()],[\"numInstructionAccounts\",Oc()],[\"numInstructionDataBytes\",Bc()]]),{size:\"remainder\"})],[\"instructionPayloads\",Dc(gu([[\"instructionAccountIndices\",Dc(Oc(),{size:\"remainder\"})],[\"instructionData\",Hc()]]),{size:\"remainder\"})]]),e=>({...e,lifetimeToken:\"lifetimeToken\"in e?e.lifetimeToken:void 0}))]]),e=>{if(\"legacy\"!==e.version&&e.version>1)throw new Fs(Da,{unsupportedVersion:e.version});return e})}function fd(){return Ys({read(e,t){const[n]=ql().read(e,t);return pu([[()=>\"legacy\"===n,yc(mu([[\"header\",Pl()],[\"staticAccounts\",jc(Wu(),{size:Tc()})],[\"lifetimeToken\",Dl()],[\"instructions\",jc(Rl(),{size:Tc()})]]),e=>({...e,version:\"legacy\"}))],[()=>0===n,yc(mu([[\"version\",ql()],[\"header\",Pl()],[\"staticAccounts\",jc(Wu(),{size:Tc()})],[\"lifetimeToken\",Dl()],[\"instructions\",jc(Rl(),{size:Tc()})],[\"addressTableLookups\",jc(Wl(),{size:Tc()})]]),({addressTableLookups:e,...t})=>e?.length?{...t,addressTableLookups:e,version:0}:{...t,version:0})],[()=>1===n,ld()]]).read(e,t)}})}function hd(e,t,n){e[t]=n(e[t]??{role:al.READONLY})}var pd=Symbol(\"AddressMapTypeProperty\");function gd(e,t){const n={[e]:{[pd]:0,role:al.WRITABLE_SIGNER}},r=new Set;for(const e of t)if(hd(n,e.programAddress,t=>{if(r.add(e.programAddress),pd in t){if(cl(t.role)){if(0===t[pd])throw new Fs(Ea,{programAddress:e.programAddress});throw new Fs(Ia,{programAddress:e.programAddress})}if(1===t[pd])return t}return{[pd]:1,role:al.READONLY}}),e.accounts)for(const t of e.accounts)hd(n,t.address,e=>{const{address:n,...i}=t;if(pd in e)switch(e[pd]){case 0:return e;case 1:{const n=ul(e.role,i.role);if(r.has(t.address)){if(cl(i.role))throw new Fs(Ia,{programAddress:t.address});return e.role!==n?{...e,role:n}:e}return e.role!==n?{...e,role:n}:e}}return{...i,[pd]:1}});return n}function md(e){let t;return Object.entries(e).sort(([e,n],[r,i])=>{if(n[pd]!==i[pd]){if(0===n[pd])return-1;if(0===i[pd])return 1;if(1===n[pd])return-1;if(1===i[pd])return 1}const o=sl(n.role);if(o!==sl(i.role))return o?-1:1;const a=cl(n.role);return a!==cl(i.role)?a?-1:1:(t||=Gu(),t(e,r))}).map(([e,t])=>({address:e,...t}))}function yd(e){let t=0,n=0,r=0;for(const i of e){if(\"lookupTableAddress\"in i)break;const e=cl(i.role);sl(i.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function wd(e){const t={};for(const[n,r]of e.entries())t[r.address]=n;return t}function vd(e,t){const n=wd(t);return e.map(({accounts:e,data:t,programAddress:r})=>({programAddressIndex:n[r],...e?{accountIndices:e.map(({address:e})=>n[e])}:null,...t?{data:t}:null}))}function Ad(e){return\"nonce\"in e?e.nonce:e.blockhash}function bd(e,t,n){e[t]=n(e[t]??{role:al.READONLY})}var Sd=Symbol(\"AddressMapTypeProperty\");function kd(e){const t={};for(const n of e){if(!(\"lookupTableAddress\"in n))continue;const e=t[n.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};n.role===al.WRITABLE?e.writableIndexes.push(n.addressIndex):e.readonlyIndexes.push(n.addressIndex)}return Object.keys(t).sort(Gu()).map(e=>({lookupTableAddress:e,...t[e]}))}function xd(e,t){const n=function(e){const t={};for(const[n,r]of e.entries())t[r.address]=n;return t}(t);return e.map(({accounts:e,data:t,programAddress:r})=>({programAddressIndex:n[r],...e?{accountIndices:e.map(({address:e})=>n[e])}:null,...t?{data:t}:null}))}function Ed(e){const t=e.findIndex(e=>\"lookupTableAddress\"in e);return(-1===t?e:e.slice(0,t)).map(({address:e})=>e)}function Id(e){const t=function(e){let t;return Object.entries(e).sort(([e,n],[r,i])=>{if(n[Sd]!==i[Sd]){if(0===n[Sd])return-1;if(0===i[Sd])return 1;if(2===n[Sd])return-1;if(2===i[Sd])return 1}const o=sl(n.role);if(o!==sl(i.role))return o?-1:1;const a=cl(n.role);return a!==cl(i.role)?a?-1:1:(t||=Gu(),1===n[Sd]&&1===i[Sd]&&n.lookupTableAddress!==i.lookupTableAddress?t(n.lookupTableAddress,i.lookupTableAddress):t(e,r))}).map(([e,t])=>({address:e,...t}))}(function(e,t){const n={[e]:{[Sd]:0,role:al.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(bd(n,e.programAddress,t=>{if(r.add(e.programAddress),Sd in t){if(cl(t.role)){if(0===t[Sd])throw new Fs(Ea,{programAddress:e.programAddress});throw new Fs(Ia,{programAddress:e.programAddress})}if(2===t[Sd])return t}return{[Sd]:2,role:al.READONLY}}),e.accounts)for(const i of e.accounts)bd(n,i.address,e=>{const{address:n,...o}=i;if(Sd in e)switch(e[Sd]){case 0:return e;case 1:{const n=ul(e.role,o.role);if(\"lookupTableAddress\"in o){if(e.lookupTableAddress!==o.lookupTableAddress&&(t||=Gu())(o.lookupTableAddress,e.lookupTableAddress)<0)return{[Sd]:1,...o,role:n}}else if(sl(o.role))return{[Sd]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=ul(e.role,o.role);if(r.has(i.address)){if(cl(o.role))throw new Fs(Ia,{programAddress:i.address});return e.role!==t?{...e,role:t}:e}return\"lookupTableAddress\"in o&&!sl(e.role)?{...o,[Sd]:1,role:t}:e.role!==t?{...e,role:t}:e}}return\"lookupTableAddress\"in o?{...o,[Sd]:1}:{...o,[Sd]:2}})}return n}(e.feePayer.address,e.instructions)),n=t.length;if(n>64)throw new Fs(Ja,{actualCount:n,maxAllowed:64});const r=t.filter(e=>sl(e.role)).length;if(r>12)throw new Fs(Za,{actualCount:r,maxAllowed:12});const i=e.instructions.length;if(i>64)throw new Fs(Ya,{actualCount:i,maxAllowed:64});for(let t=0;t<e.instructions.length;t++){const n=e.instructions[t].accounts?.length??0;if(n>255)throw new Fs(Xa,{actualCount:n,instructionIndex:t,maxAllowed:255})}const o=e.lifetimeConstraint;return{addressTableLookups:kd(t),...o?{lifetimeToken:Ad(o)}:null,header:yd(t),instructions:xd(e.instructions,t),staticAccounts:Ed(t),version:e.version}}function Td(e){let t=0;return void 0!==e.priorityFeeLamports&&(t|=3),void 0!==e.computeUnitLimit&&(t|=4),void 0!==e.loadedAccountsDataSizeLimit&&(t|=8),void 0!==e.heapSize&&(t|=16),t}function Bd(e){const t=[];return void 0!==e.priorityFeeLamports&&t.push({kind:\"u64\",value:e.priorityFeeLamports}),void 0!==e.computeUnitLimit&&t.push({kind:\"u32\",value:e.computeUnitLimit}),void 0!==e.loadedAccountsDataSizeLimit&&t.push({kind:\"u32\",value:e.loadedAccountsDataSizeLimit}),void 0!==e.heapSize&&t.push({kind:\"u32\",value:e.heapSize}),t}function Cd(e){const t=md(gd(e.feePayer.address,e.instructions)),n=t.length;if(n>64)throw new Fs(Ja,{actualCount:n,maxAllowed:64});const r=t.filter(e=>sl(e.role)).length;if(r>12)throw new Fs(Za,{actualCount:r,maxAllowed:12});const i=e.instructions.length;if(i>64)throw new Fs(Ya,{actualCount:i,maxAllowed:64});for(let t=0;t<e.instructions.length;t++){const n=e.instructions[t].accounts?.length??0;if(n>255)throw new Fs(Xa,{actualCount:n,instructionIndex:t,maxAllowed:255})}const o=wd(t),a=e.lifetimeConstraint;return{version:1,...a?{lifetimeToken:Ad(a)}:null,configMask:Td(e.config??{}),configValues:Bd(e.config??{}),header:yd(t),instructionHeaders:e.instructions.map(e=>function(e,t){return{numInstructionAccounts:e.accounts?.length??0,numInstructionDataBytes:e.data?.byteLength??0,programAccountIndex:t[e.programAddress]}}(e,o)),instructionPayloads:e.instructions.map(e=>function(e,t){return{instructionAccountIndices:e.accounts?.map(({address:e})=>t[e])??[],instructionData:e.data??new Uint8Array}}(e,o)),numInstructions:e.instructions.length,numStaticAccounts:t.length,staticAccounts:t.map(e=>e.address)}}function Md(e){const t=e.version;if(\"legacy\"===t)return function(e){const t=md(gd(e.feePayer.address,e.instructions)),n=t.length;if(n>64)throw new Fs(Ja,{actualCount:n,maxAllowed:64});const r=t.filter(e=>sl(e.role)).length;if(r>12)throw new Fs(Za,{actualCount:r,maxAllowed:12});const i=e.instructions.length;if(i>64)throw new Fs(Ya,{actualCount:i,maxAllowed:64});for(let t=0;t<e.instructions.length;t++){const n=e.instructions[t].accounts?.length??0;if(n>255)throw new Fs(Xa,{actualCount:n,instructionIndex:t,maxAllowed:255})}const o=e.lifetimeConstraint;return{...o?{lifetimeToken:Ad(o)}:null,header:yd(t),instructions:vd(e.instructions,t),staticAccounts:t.map(e=>e.address),version:e.version}}(e);if(0===t)return Id(e);if(1===t)return Cd(e);throw new Fs(Da,{version:t})}function Pd(e,t){return _d([e],t)}function _d(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Rd(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Od(e){return 1===e.version?e.config?.computeUnitLimit:function(e){const t=e.instructions,n=t.find(Yl);return n?(r=n.data,Pc().decode(r,1)):void 0;var r}(e)}function Ud(e,t){return void 0!==e&&td(e),1===t.version?function(e,t){const n={...t.config??{},computeUnitLimit:e},r=nd(n)?void 0:Object.freeze(n);if(void 0===r){const{config:e,...n}=t;return Object.freeze(n)}if(t.config&&rd(t.config,r))return t;return Object.freeze({...t,config:r})}(e,t):function(e,t){const n=t.instructions.findIndex(Yl);if(void 0===e)return-1===n?t:ed(n,t);if(Od(t)===e)return t;const r=(i=e,Zl(2,Mc().encode(i)));var i;return-1===n?Pd(r,t):Ql(n,r,t)}(e,t)}function Nd(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}function zd(e,t){if(\"feePayer\"in t&&e===t.feePayer?.address&&function(e){return!!e&&\"address\"in e&&\"string\"==typeof e.address&&1===Object.keys(e).length}(t.feePayer))return t;const n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function Fd(e){const{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,i=[];let o=0;for(let t=0;t<n;t++)i.push({address:e.staticAccounts[o],role:al.WRITABLE_SIGNER}),o++;for(let n=0;n<t.numReadonlySignerAccounts;n++)i.push({address:e.staticAccounts[o],role:al.READONLY_SIGNER}),o++;for(let t=0;t<r;t++)i.push({address:e.staticAccounts[o],role:al.WRITABLE}),o++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)i.push({address:e.staticAccounts[o],role:al.READONLY}),o++;return i}function Ld(e,t){return e.map(e=>function(e,t){const n=t[e.programAddressIndex]?.address;if(!n)throw new Fs(Ma,{index:e.programAddressIndex});const r=e.accountIndices?.map(e=>t[e]),{data:i}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...i&&i.length?{data:i}:{}})}(e,t))}function Dd(e){const t=e[0];if(!t)throw new Fs(Pa);return t}var jd=\"SysvarRecentB1ockHashes11111111111111111111\",$d=\"11111111111111111111111111111111\";function Kd(e,t){return{accounts:[{address:e,role:al.WRITABLE},{address:jd,role:al.READONLY},{address:t,role:al.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:$d}}function qd(e){return e.programAddress===$d&&null!=e.data&&(4===(t=e.data).byteLength&&4===t[0]&&0===t[1]&&0===t[2]&&0===t[3])&&3===e.accounts?.length&&null!=e.accounts[0].address&&e.accounts[0].role===al.WRITABLE&&e.accounts[1].address===jd&&e.accounts[1].role===al.READONLY&&null!=e.accounts[2].address&&sl(e.accounts[2].role);var t}function Hd(e,t,n){const r=t[0];if(r&&qd(r)){const t=r.accounts[0].address;Ku(t);const n=r.accounts[2].address;return Ku(n),{nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}function Wd(e){return\"lifetimeConstraint\"in e&&\"string\"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&qd(e.instructions[0])}function Vd({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let i;const o=r.instructions[0];if(o&&qd(o))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(o,t,n)){if(Wd(r)&&r.lifetimeConstraint.nonce===e)return r;i=[o,...r.instructions.slice(1)]}else i=[Object.freeze(Kd(t,n)),...r.instructions.slice(1)];else i=[Object.freeze(Kd(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(i),lifetimeConstraint:Object.freeze({nonce:e})})}function Gd(e,t){const n=Dd(e.staticAccounts),r=[...Fd(e),...\"addressTableLookups\"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?function(e,t){const n=e.map(e=>e.lookupTableAddress).filter(e=>void 0===t[e]);if(n.length>0)throw new Fs(Ba,{lookupTableAddresses:n});const r=[],i=[];for(const n of e){const e=t[n.lookupTableAddress],o=n.readonlyIndexes,a=n.writableIndexes,s=Math.max(...o,...a);if(s>=e.length)throw new Fs(Ca,{highestKnownIndex:e.length-1,highestRequestedIndex:s,lookupTableAddress:n.lookupTableAddress});const c=o.map(t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:al.READONLY}));r.push(...c);const u=a.map(t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:al.WRITABLE}));i.push(...u)}return[...i,...r]}(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[]],i=Ld(e.instructions,r),o=Hd(e.lifetimeToken,i,t?.lastValidBlockHeight);return bl(Nd({version:0}),e=>zd(n,e),e=>_d(i,e),e=>\"blockhash\"in o?kl(o,e):Vd(o,e))}function Zd(e,t,n){if(e.length!==t.length)throw new Fs(Ga,{numInstructionHeaders:e.length,numInstructionPayloads:t.length});return e.map((e,r)=>function(e,t,n){const r=n[e.programAccountIndex]?.address;if(!r)throw new Fs(Ma,{index:e.programAccountIndex});const i=t.instructionAccountIndices.map(e=>n[e]),o=t.instructionData;return Object.freeze({programAddress:r,...i&&i.length?{accounts:Object.freeze(i)}:{},...o&&o.length?{data:o}:{}})}(e,t[r],n))}function Jd(e,t){const n=Dd(e.staticAccounts),r=Fd(e),i=function(e,t){const n=[[\"priorityFeeLamports\",\"u64\",id],[\"computeUnitLimit\",\"u32\",od],[\"loadedAccountsDataSizeLimit\",\"u32\",ad],[\"heapSize\",\"u32\",sd]],[r]=n.reduce(([n,r],[i,o,a])=>{if(!a(e))return[n,r];const s=t[r];if(s.kind!==o)throw new Fs(Va,{actualKind:s.kind,configName:i,expectedKind:o});return[{...n,[i]:s.value},r+1]},[{},0]);return r}(e.configMask,e.configValues),o=Zd(e.instructionHeaders,e.instructionPayloads,r),a=Hd(e.lifetimeToken,o,t?.lastValidBlockHeight);return bl(Nd({version:1}),e=>nd(i)?e:Object.freeze({...e,config:Object.freeze(i)}),e=>zd(n,e),e=>_d(o,e),e=>\"blockhash\"in a?kl(a,e):Vd(a,e))}function Yd(e,t){const n=e.version;if(\"legacy\"===n)return function(e,t){const n=Dd(e.staticAccounts),r=Fd(e),i=Ld(e.instructions,r),o=Hd(e.lifetimeToken,i,t?.lastValidBlockHeight);return bl(Nd({version:\"legacy\"}),e=>zd(n,e),e=>_d(i,e),e=>\"blockhash\"in o?kl(o,e):Vd(o,e))}(e,t);if(0===n)return Gd(e,t);if(1===n)return Jd(e,t);throw new Fs(Da,{version:n})}function Xd(e){return 1===e.version?e.config?.loadedAccountsDataSizeLimit:function(e){const t=e.instructions,n=t.find(Xl);return n?(r=n.data,Pc().decode(r,1)):void 0;var r}(e)}function Qd(e,t){return 1===t.version?function(e,t){const n={...t.config??{},loadedAccountsDataSizeLimit:e},r=nd(n)?void 0:Object.freeze(n);if(void 0===r){const{config:e,...n}=t;return Object.freeze(n)}if(t.config&&rd(t.config,r))return t;return Object.freeze({...t,config:r})}(e,t):function(e,t){const n=t.instructions.findIndex(Xl);if(void 0===e)return-1===n?t:ed(n,t);if(Xd(t)===e)return t;const r=(i=e,Zl(4,Mc().encode(i)));var i;return-1===n?Pd(r,t):Ql(n,r,t)}(e,t)}function ef(e){const t=Object.values(e);if(0===t.length)throw new Fs(Ua);return t.map(e=>e||new Uint8Array(64).fill(0))}function tf(){return mc(Dc(sc(Hc(),64),{size:Ic()}),ef)}function nf(){return e=e=>\"signaturesFirst\"===function(e){if(0===e.length)throw new Fs($a);return 1===ql().decode(e)?\"messageFirst\":\"signaturesFirst\"}(e.messageBytes),t=gu([[\"signatures\",tf()],[\"messageBytes\",Hc()]]),n=function(){const e=Hc();return Js({getSizeFromValue:e=>{const t=rf(e.messageBytes,0);return e.messageBytes.length+64*t},write:(t,n,r)=>{r=e.write(t.messageBytes,n,r);const i=function(e){return mc(Dc(sc(Hc(),64),{description:\"signatures\",size:e}),ef)}(rf(t.messageBytes,0));return r=i.write(t.signatures,n,r)}})}(),Yc([t,n],t=>e(t)?0:1);var e,t,n}function rf(e,t){if(e.length<t+2)throw new Fs(ja,{messageBytes:e});return e[t+1]}function of(){return e=e=>\"signaturesFirst\"===function(e){if(0===e.length)throw new Fs(Ka);const t=e[0];if(!(128&t))return\"signaturesFirst\";const n=127&t;if(0===n)throw new Fs(qa,{firstByte:t,transactionBytes:e});if(1===n)return\"messageFirst\";throw new Fs(Da,{unsupportedVersion:n})}(e),t=yc(mu([[\"signatures\",jc(cc(Wc(),64),{size:Tc()})],[\"messageBytes\",Wc()]]),af),n=yc(Ys({read(e,t){const n=rf(e,t),r=64*n,i=e.length-t-r;if(i<0)throw new Fs(Ha,{numExpectedSignatures:n,transactionBytes:e.subarray(t),transactionBytesLength:e.length-t});const o=e.subarray(t,t+i),[a,s]=jc(cc(Wc(),64),{size:n}).read(e,t+i);return[{messageBytes:o,signatures:a},s]}}),sf),Xc([t,n],t=>e(t)?0:1);var e,t,n}function af(e){const{messageBytes:t,signatures:n}=e,r=Jc([ql(),gc(Uc(),2),jc(Wu(),{size:Tc()})]),[i,o,a]=r.decode(t),s=a.slice(0,o);if(s.length!==n.length)throw new Fs(Na,{numRequiredSignatures:o,signaturesLength:n.length,signerAddresses:s});const c=cf(s,n);return{messageBytes:t,signatures:Object.freeze(c)}}function sf(e){const{messageBytes:t,signatures:n}=e,r=t[1],i=jc(Wu(),{size:r}).decode(t,42);if(i.length!==n.length)throw new Fs(Na,{numRequiredSignatures:r,signaturesLength:n.length,signerAddresses:i});return{messageBytes:t,signatures:cf(i,n)}}function cf(e,t){const n={};return e.forEach((e,r)=>{const i=t[r];i.every(e=>0===e)?n[e]=null:n[e]=i}),Object.freeze(n)}var uf;function lf(e){const t=Md(e),n=dd().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),i={};for(const e of r)i[e]=null;let o;return Sl(e)?o={blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:Wd(e)&&(o={nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address}),Object.freeze({...o?{lifetimeConstraint:o}:void 0,messageBytes:n,signatures:Object.freeze(i)})}function df(e){uf||(uf=Iu());const t=Object.values(e.signatures)[0];if(!t)throw new Fs(Ra);return uf.decode(t)}async function ff(e,t){let n,r;if(await Promise.all(e.map(async e=>{const i=await il(e.publicKey),o=t.signatures[i];if(void 0===o)return r||=new Set,void r.add(i);if(r)return;const a=await pl(e.privateKey,t.messageBytes);null!==o&&Gs(a,o)||(n||={},n[i]=a)})),r&&r.size>0){const e=Object.keys(t.signatures);throw new Fs(Oa,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function hf(e){const t=[];if(Object.entries(e.signatures).forEach(([e,n])=>{n||t.push(e)}),t.length>0)throw new Fs(_a,{addresses:t})}function pf(e){const t=nf().encode(e);return Mu().decode(t)}function gf(e){return nf().getSizeFromValue(e)}function mf(e){const t=e.messageBytes[0];return!!(128&t)&&1==(127&t)?4096:1232}function yf(e){hf(e),function(e){if(0===e.messageBytes.length)return;const t=mf(e),n=gf(e);if(n>t)throw new Fs(La,{transactionSize:n,transactionSizeLimit:t})}(e)}function wf(e){const t={};return e.forEach(e=>{if(t[e.address]){if(!function(e,t){if(e===t)return!0;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);return n.length===r.length&&n.every(n=>{if(!(n in t))return!1;const r=e[n],i=t[n];return\"function\"==typeof r&&\"function\"==typeof i?r.toString()===i.toString():r===i})}(t[e.address],e))throw new Fs(xa,{address:e.address})}else t[e.address]=e}),Object.values(t)}function vf(e){return\"modifyAndSignTransactions\"in e&&\"function\"==typeof e.modifyAndSignTransactions}function Af(e){return\"signTransactions\"in e&&\"function\"==typeof e.signTransactions}function bf(e){return\"signAndSendTransactions\"in e&&\"function\"==typeof e.signAndSendTransactions}function Sf(e){return Af(e)||vf(e)||bf(e)}function kf(e){return wf([...e.feePayer&&Sf(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(e=>function(e){return wf((e.accounts??[]).flatMap(e=>e.signer?[e.signer]:[]))}(e))])}function xf(e,t){const n=(r=t)&&\"feePayer\"in r&&r.feePayer&&\"string\"==typeof r.feePayer.address&&!Sf(r.feePayer)?e.find(e=>e.address===t.feePayer.address):void 0;var r;return n||0!==t.instructions.length?Object.freeze({...t,...n?{feePayer:n}:null,instructions:t.instructions.map(t=>function(e,t){if(!t.accounts||0===t.accounts.length)return t;const n=new Map(wf(e).map(e=>[e.address,e]));return Object.freeze({...t,accounts:t.accounts.map(e=>{const t=n.get(e.address);return sl(e.role)&&!(\"signer\"in e)&&t?Object.freeze({...e,signer:t}):e})})}(e,t))}):t}async function Ef(e){const t=await il(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map(async n=>Object.freeze({[t]:await pl(e.privateKey,n.content)}))),signTransactions:n=>Promise.all(n.map(async n=>{const r=await ff([e],n);return Object.freeze({[t]:r.signatures[t]})}))};return Object.freeze(n)}async function If(e,t){return await Ef(await yl(e,t))}function Tf(e){const t={address:e,signMessages:e=>Promise.resolve(e.map(()=>Object.freeze({}))),signTransactions:e=>Promise.resolve(e.map(()=>Object.freeze({})))};return Object.freeze(t)}async function Bf(e,t){return await Cf(kf(e).filter(e=>vf(e)||Af(e)),lf(e),t)}async function Cf(e,t,n){const{partialSigners:r,modifyingSigners:i}=Mf(wf(e),{identifySendingSigner:!1});return await Pf(t,i,r,n)}function Mf(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(bf);if(0===t.length)return null;const n=t.filter(e=>!vf(e)&&!Af(e));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter(e=>e!==n&&(vf(e)||Af(e))),i=function(e){const t=e.filter(vf);if(0===t.length)return[];const n=t.filter(e=>!Af(e));return n.length>0?n:[t[0]]}(r),o=r.filter(Af).filter(e=>!i.includes(e));return Object.freeze({modifyingSigners:i,partialSigners:o,sendingSigner:n})}async function Pf(e,t=[],n=[],r){const i=await t.reduce(async(e,t)=>{r?.abortSignal?.throwIfAborted();const[n]=await t.modifyAndSignTransactions([await e],r);return Object.freeze(n)},Promise.resolve(e));r?.abortSignal?.throwIfAborted();const o=await Promise.all(n.map(async e=>{const[t]=await e.signTransactions([i],r);return t}));return Object.freeze({...i,signatures:Object.freeze(o.reduce((e,t)=>({...e,...t}),i.signatures??{}))})}var _f=globalThis.TextEncoder;function Rf(e,t){const n=function(e,t){if(null==t)throw new Fs(Ps,{inputName:e});return t}(e,t);return\"object\"==typeof t&&\"address\"in n?n.address:Array.isArray(n)?n[0]:n}function Of(e,t){return(n,r)=>{if(!r.value){if(\"omitted\"===t)return;return Object.freeze({address:e,role:al.READONLY})}if(Uf(r.value))return Object.freeze({address:r.value.address,role:r.value.role,...\"signer\"in r.value&&r.value.signer?{signer:r.value.signer}:{}});const i=r.isSigner??\"either\",o=!1!==i&&Nf(r.value);if(!o&&!0===i)throw new Fs(_s,{inputName:n});const a=r.isWritable?al.WRITABLE:al.READONLY;return Object.freeze({address:Rf(n,r.value),role:o?(s=a,2|s):a,...o?{signer:r.value}:{}});var s}}function Uf(e){return\"object\"==typeof e&&\"role\"in e&&\"number\"==typeof e.role}function Nf(e){return!!e&&\"object\"==typeof e&&\"address\"in e&&\"string\"==typeof e.address&&Sf(e)}function zf(){return mu([[\"discriminator\",Pc()]])}function Ff(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),nonceAuthority:n()},data:zf().decode(e.data)}}function Lf(){return mu([[\"discriminator\",Pc()],[\"space\",Rc()]])}function Df(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{newAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lf().decode(e.data)}}function jf(){return mu([[\"discriminator\",Pc()],[\"base\",Wu()],[\"seed\",oc(Uu(),Rc())],[\"space\",Rc()],[\"programAddress\",Wu()]])}function $f(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{newAccount:n(),baseAccount:n()},data:jf().decode(e.data)}}function Kf(){return mu([[\"discriminator\",Pc()],[\"programAddress\",Wu()]])}function qf(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Kf().decode(e.data)}}function Hf(){return mu([[\"discriminator\",Pc()],[\"base\",Wu()],[\"seed\",oc(Uu(),Rc())],[\"programAddress\",Wu()]])}function Wf(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),baseAccount:n()},data:Hf().decode(e.data)}}function Vf(){return mu([[\"discriminator\",Pc()],[\"newNonceAuthority\",Wu()]])}function Gf(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),nonceAuthority:n()},data:Vf().decode(e.data)}}function Zf(){return mu([[\"discriminator\",Pc()],[\"lamports\",Rc()],[\"space\",Rc()],[\"programAddress\",Wu()]])}function Jf(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n()},data:Zf().decode(e.data)}}function Yf(){return mu([[\"discriminator\",Pc()],[\"base\",Wu()],[\"seed\",oc(Uu(),Rc())],[\"amount\",Rc()],[\"space\",Rc()],[\"programAddress\",Wu()]])}function Xf(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};let r=e.accounts.length-2;return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n(),baseAccount:(()=>{if(0!==r)return r-=1,n()})()},data:Yf().decode(e.data)}}function Qf(){return mu([[\"discriminator\",Pc()],[\"nonceAuthority\",Wu()]])}function eh(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n()},data:Qf().decode(e.data)}}function th(){return mc(gu([[\"discriminator\",Mc()],[\"amount\",_c()]]),e=>({...e,discriminator:2}))}function nh(){return mu([[\"discriminator\",Pc()],[\"amount\",Rc()]])}function rh(e,t){const n=t?.programAddress??fh,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},i={...e},o=Of(n,\"omitted\");return Object.freeze({accounts:[o(\"source\",r.source),o(\"destination\",r.destination)],data:th().encode(i),programAddress:n})}function ih(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n()},data:nh().decode(e.data)}}function oh(){return mu([[\"discriminator\",Pc()],[\"amount\",Rc()],[\"fromSeed\",oc(Uu(),Rc())],[\"fromOwner\",Wu()]])}function ah(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),baseAccount:n(),destination:n()},data:oh().decode(e.data)}}function sh(){return mu([[\"discriminator\",Pc()]])}function ch(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{nonceAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:sh().decode(e.data)}}function uh(){return mu([[\"discriminator\",Pc()],[\"withdrawAmount\",Rc()]])}function lh(e){if(e.accounts.length<5)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:5});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recipientAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n(),nonceAuthority:n()},data:uh().decode(e.data)}}var dh,fh=\"11111111111111111111111111111111\",hh=((dh=hh||{})[dh.CreateAccount=0]=\"CreateAccount\",dh[dh.Assign=1]=\"Assign\",dh[dh.TransferSol=2]=\"TransferSol\",dh[dh.CreateAccountWithSeed=3]=\"CreateAccountWithSeed\",dh[dh.AdvanceNonceAccount=4]=\"AdvanceNonceAccount\",dh[dh.WithdrawNonceAccount=5]=\"WithdrawNonceAccount\",dh[dh.InitializeNonceAccount=6]=\"InitializeNonceAccount\",dh[dh.AuthorizeNonceAccount=7]=\"AuthorizeNonceAccount\",dh[dh.Allocate=8]=\"Allocate\",dh[dh.AllocateWithSeed=9]=\"AllocateWithSeed\",dh[dh.AssignWithSeed=10]=\"AssignWithSeed\",dh[dh.TransferSolWithSeed=11]=\"TransferSolWithSeed\",dh[dh.UpgradeNonceAccount=12]=\"UpgradeNonceAccount\",dh[dh.CreateAccountAllowPrefund=13]=\"CreateAccountAllowPrefund\",dh);function ph(e){const t=\"data\"in e?e.data:e;if(Vs(t,Mc().encode(0),0))return 0;if(Vs(t,Mc().encode(1),0))return 1;if(Vs(t,Mc().encode(2),0))return 2;if(Vs(t,Mc().encode(3),0))return 3;if(Vs(t,Mc().encode(4),0))return 4;if(Vs(t,Mc().encode(5),0))return 5;if(Vs(t,Mc().encode(6),0))return 6;if(Vs(t,Mc().encode(7),0))return 7;if(Vs(t,Mc().encode(8),0))return 8;if(Vs(t,Mc().encode(9),0))return 9;if(Vs(t,Mc().encode(10),0))return 10;if(Vs(t,Mc().encode(11),0))return 11;if(Vs(t,Mc().encode(12),0))return 12;if(Vs(t,Mc().encode(13),0))return 13;throw new Fs(Ms,{instructionData:t,programName:\"system\"})}function gh(e,t,n){return function(e,t,n,r){if(!zs(e,ka))return!1;const i=t.instructions[e.context.index]?.programAddress;return!(!i||i!==n||void 0!==r&&e.context.code!==r)}(e,t,fh,n)}const mh=new io({level:Lo.config.logLevel,decorators:{error:(e,t,...n)=>{((e,t,n={instructions:{}})=>{zs(e)&&t(e.context,\"%s: %s\",e.message,gh(e.cause,n)?(e.cause.context.code,\"Error message not available in production bundles.\"):e.cause)})(t,e),e(t,...n)}}}),yh=new io({level:to.SILENT}),wh=mh,vh=(e,t,n)=>((e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:i,refreshCache:o=!1,logger:a=oo})=>{const s=i??ao,c=r??e.name??\"anonymousFunction\";return async(...r)=>{const i=s(c,r);if(!o)try{const e=await t.get(i);if(void 0!==e)return e}catch(e){a.error(`Cache get error for key \"${i}\":`,e)}const u=await e(...r);return t.set(i,u,n).catch(e=>{a.error(`Cache set error for key \"${i}\":`,e)}),u}})(e,t,{...n,logger:n.logger??wh});Error;function Ah(e){return e instanceof Error||ie(e)&&\"Error\"===e.constructor.name}const bh=[On,$n,Xn,Kn,qn,Hn,Wn,Vn,Gn,Zn,Jn,Yn,zn,Fn,Ln,Dn,jn];function Sh(e){return function(e){return bh.some(t=>e instanceof t)}(e)?e:new On(e instanceof Error?e:Jt(e))}function kh({logError:e,trackError:t,normalizeErrorFn:n=Sh}){return(r,i)=>async function(e,t,n,r){try{return await r()}catch(r){await t(r);const i=n(r);throw e({error:i},`[SnapError] ${JSON.stringify(i.toJSON(),null,2)}`),i}}(i??e,t,n,r)}function xh(e){return e instanceof Error?e:function(e){if(Ah(e))return e;const t=new Error(\"Unknown error\");return t.cause=e,t}(e)}function Eh(e){return!(e instanceof Xn)}function Ih(){return snap}const{trackError:Th,withCatchAndThrowSnapError:Bh}=function({logError:e,normalizeErrorFn:t,getSnapProvider:n,prepareError:r,shouldTrack:i}){const o=function({getSnapProvider:e,logError:t,prepareError:n=xh,shouldTrack:r=Eh}){return async i=>{if(!r(i))return;const o={error:Un(n(i))};try{return await e().request({method:\"snap_trackError\",params:o})}catch(e){return void t({error:e},\"Failed to track error\")}}}({getSnapProvider:n,logError:e,prepareError:r,shouldTrack:i});return{trackError:o,withCatchAndThrowSnapError:kh({logError:e,trackError:o,normalizeErrorFn:t})}}({getSnapProvider:Ih,logError:wh.error.bind(wh)});const Ch=Z([z([\"btc\",\"eth\",\"ltc\",\"bch\",\"bnb\",\"eos\",\"xrp\",\"xlm\",\"link\",\"dot\",\"yfi\",\"bits\",\"sats\",\"sol\",\"sei\",\"sonic\"]),z([\"usd\",\"aed\",\"amd\",\"ars\",\"aud\",\"bam\",\"bdt\",\"bhd\",\"bmd\",\"brl\",\"cad\",\"chf\",\"clp\",\"cny\",\"cop\",\"crc\",\"czk\",\"dkk\",\"dop\",\"eur\",\"gbp\",\"gel\",\"gtq\",\"hkd\",\"hnl\",\"huf\",\"idr\",\"ils\",\"inr\",\"jpy\",\"kes\",\"krw\",\"kwd\",\"lbp\",\"lkr\",\"mmk\",\"mxn\",\"myr\",\"ngn\",\"nok\",\"nzd\",\"pen\",\"php\",\"pkr\",\"pln\",\"ron\",\"rub\",\"sar\",\"sek\",\"sgd\",\"svc\",\"thb\",\"try\",\"twd\",\"uah\",\"vef\",\"vnd\",\"xdr\",\"zar\",\"zmw\"]),z([\"xag\",\"xau\"])]),Mh=G({id:V(),price:ee($(),0),marketCap:q(j(ee($(),0))),allTimeHigh:q(j(ee($(),0))),allTimeLow:q(j(ee($(),0))),totalVolume:q(j(ee($(),0))),high1d:q(j(ee($(),0))),low1d:q(j(ee($(),0))),circulatingSupply:q(j(ee($(),0))),dilutedMarketCap:q(j(ee($(),0))),marketCapPercentChange1d:q(j($())),priceChange1d:q(j($())),pricePercentChange1h:q(j($())),pricePercentChange1d:q(j($())),pricePercentChange7d:q(j($())),pricePercentChange14d:q(j($())),pricePercentChange30d:q(j($())),pricePercentChange200d:q(j($())),pricePercentChange1y:q(j($())),bondingCurveProgressPercent:q(j($())),liquidity:q(j($())),totalSupply:q(j($())),holderCount:q(j($())),isMutable:q(j(N()))}),Ph=W(He,j(Mh)),_h=Ch;function Rh(e,t){if(t<1)throw new RangeError(\"chunkSize must be at least 1\");const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}const Oh=U(G({decimals:F(),assetId:wo,name:q(V()),symbol:q(V()),iconUrl:q(Ji)})),Uh={name:\"UNKNOWN\",symbol:\"UNKNOWN\",fungible:!0,iconUrl:\"\",units:[{name:\"UNKNOWN\",symbol:\"UNKNOWN\",decimals:9}]};class Nh{#y;#w;#v;#A;#b;#S;static supportedNetworks=[ho.Mainnet,ho.Devnet];constructor(e,t=globalThis.fetch,n=wh){this.#y=t,this.#w=n;const{tokenApi:r,staticApi:i}=e.config,{baseUrl:o,chunkSize:a}=r;v(o,Ji),this.#v=o,this.#A=a,this.#b=i.baseUrl,this.#S=Ki({service:\"token_api\",logger:this.#w})}async#k(e){v(e,U(yo));const t=eo({baseUrl:this.#v,path:\"/v3/assets\",queryParams:{assetIds:e.join(\",\")}}),n=await Zi(this.#S,t,void 0,this.#y),r=JSON.parse(n);return v(r,Oh),r}async getTokensMetadata(e){try{v(e,U(He));const t=e.filter(e=>{const{chainId:t}=tt(e);return Nh.supportedNetworks.includes(t)});t.length!==e.length&&this.#w.warn(`[TokenApiClient] Received some asset types on networks that the Token API doesn't support. They will be ignored. Supported networks: ${Nh.supportedNetworks.join(\", \")}`);const n=Rh(t,this.#A),r=(await Promise.all(n.map(async e=>this.#k(e)))).flat(),i=new Map(r.map(e=>[e.assetId,e])),o=new Map;return e.forEach(e=>{const t=i.get(e),n=this.#x(t,e);o.set(e,n)}),Object.fromEntries(o)}catch(e){throw this.#w.error(e,\"Error fetching token metadata\"),e}}#E(e){return eo({baseUrl:this.#b,path:\"/api/v2/tokenIcons/assets/{assetType}.png\",pathParams:{assetType:e.replace(/:/gu,\"/\")},encodePathParams:!1})}#x(e,t){const n=this.#E(t);if(!e)return this.#w.warn(`No metadata for ${t}. Returning default values.`),{...Uh,iconUrl:n};const r=e.name??Uh.name,i=e.symbol??Uh.symbol,o=e.decimals??9;return{name:r,symbol:i,fungible:!0,iconUrl:e.iconUrl??n,units:[{name:r,symbol:i,decimals:o}]}}}const zh=K({...ct.schema}),Fh=K({fungible:L(!0),type:He,...zh.schema}),Lh=K({fungible:L(!1),id:We}),Dh=Ee(e=>se(e)&&!e.fungible?Lh:Fh),jh=K({address:V(),asset:j(Dh)});var $h;!function(e){e.Base=\"base\",e.Priority=\"priority\"}($h||($h={}));const Kh=K({type:z([`${$h.Base}`,`${$h.Priority}`]),asset:Dh});var qh,Hh,Wh;!function(e){e.Submitted=\"submitted\",e.Unconfirmed=\"unconfirmed\",e.Confirmed=\"confirmed\",e.Failed=\"failed\"}(qh||(qh={})),function(e){e.Send=\"send\",e.Receive=\"receive\",e.Swap=\"swap\",e.BridgeSend=\"bridge:send\",e.BridgeReceive=\"bridge:receive\",e.StakeDeposit=\"stake:deposit\",e.StakeWithdraw=\"stake:withdraw\",e.TokenApprove=\"token:approve\",e.TokenDisapprove=\"token:disapprove\",e.Unknown=\"unknown\"}(Hh||(Hh={})),function(e){e.Benign=\"Benign\",e.Warning=\"Warning\",e.Malicious=\"Malicious\"}(Wh||(Wh={}));const Vh=K({origin:H(V()),securityAlertResponse:H(z([`${Wh.Benign}`,`${Wh.Warning}`,`${Wh.Malicious}`])),typeLabel:H(V())}),Gh=K({status:z([`${qh.Submitted}`,`${qh.Unconfirmed}`,`${qh.Confirmed}`,`${qh.Failed}`]),timestamp:j($())}),Zh=K({id:V(),chain:Ke,account:E,status:z([`${qh.Submitted}`,`${qh.Unconfirmed}`,`${qh.Confirmed}`,`${qh.Failed}`]),timestamp:j($()),type:z([`${Hh.Send}`,`${Hh.Receive}`,`${Hh.Swap}`,`${Hh.BridgeSend}`,`${Hh.BridgeReceive}`,`${Hh.StakeDeposit}`,`${Hh.StakeWithdraw}`,`${Hh.TokenApprove}`,`${Hh.TokenDisapprove}`,`${Hh.Unknown}`]),from:U(jh),to:U(jh),fees:U(Kh),events:U(Gh),details:H(Vh)}),Jh=(K({data:U(Zh),next:j(V())}),[\"http://localhost:3000\"]),Yh=\"metamask\",Xh=BigInt(2**32-1),Qh=BigInt(32);function ep(e,t=!1){return t?{h:Number(e&Xh),l:Number(e>>Qh&Xh)}:{h:0|Number(e>>Qh&Xh),l:0|Number(e&Xh)}}function tp(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:n,l:a}=ep(e[o],t);[r[o],i[o]]=[n,a]}return[r,i]}const np=(e,t,n)=>e>>>n,rp=(e,t,n)=>e<<32-n|t>>>n,ip=(e,t,n)=>e>>>n|t<<32-n,op=(e,t,n)=>e<<32-n|t>>>n,ap=(e,t,n)=>e<<64-n|t>>>n-32,sp=(e,t,n)=>e>>>n-32|t<<64-n,cp=(e,t,n)=>e<<n|t>>>32-n,up=(e,t,n)=>t<<n|e>>>32-n,lp=(e,t,n)=>t<<n-32|e>>>64-n,dp=(e,t,n)=>e<<n-32|t>>>64-n;function fp(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}const hp=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),pp=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,gp=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),mp=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,yp=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),wp=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,vp=\"object\"==typeof globalThis&&\"crypto\"in globalThis?globalThis.crypto:void 0;function Ap(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&\"Uint8Array\"===e.constructor.name}function bp(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(\"positive integer expected, got \"+e)}function Sp(e,...t){if(!Ap(e))throw new Error(\"Uint8Array expected\");if(t.length>0&&!t.includes(e.length))throw new Error(\"Uint8Array expected of length \"+t+\", got length=\"+e.length)}function kp(e){if(\"function\"!=typeof e||\"function\"!=typeof e.create)throw new Error(\"Hash should be wrapped by utils.createHasher\");bp(e.outputLen),bp(e.blockLen)}function xp(e,t=!0){if(e.destroyed)throw new Error(\"Hash instance has been destroyed\");if(t&&e.finished)throw new Error(\"Hash#digest() has already been called\")}function Ep(e,t){Sp(e);const n=t.outputLen;if(e.length<n)throw new Error(\"digestInto() expects output buffer of length at least \"+n)}function Ip(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Tp(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Bp(e,t){return e<<32-t|e>>>t}function Cp(e,t){return e<<t|e>>>32-t>>>0}const Mp=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Pp(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const _p=Mp?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=Pp(e[t]);return e},Rp=\"function\"==typeof Uint8Array.from([]).toHex&&\"function\"==typeof Uint8Array.fromHex,Op=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,\"0\"));function Up(e){if(Sp(e),Rp)return e.toHex();let t=\"\";for(let n=0;n<e.length;n++)t+=Op[e[n]];return t}const Np=48,zp=57,Fp=65,Lp=70,Dp=97,jp=102;function $p(e){return e>=Np&&e<=zp?e-Np:e>=Fp&&e<=Lp?e-(Fp-10):e>=Dp&&e<=jp?e-(Dp-10):void 0}function Kp(e){if(\"string\"!=typeof e)throw new Error(\"hex string expected, got \"+typeof e);if(Rp)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error(\"hex string expected, got unpadded hex of length \"+t);const r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){const n=$p(e.charCodeAt(i)),o=$p(e.charCodeAt(i+1));if(void 0===n||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character \"'+t+'\" at index '+i)}r[t]=16*n+o}return r}const qp=async()=>{};async function Hp(e,t,n){let r=Date.now();for(let i=0;i<e;i++){n(i);const e=Date.now()-r;e>=0&&e<t||(await qp(),r+=e)}}function Wp(e){if(\"string\"!=typeof e)throw new Error(\"string expected\");return new Uint8Array((new TextEncoder).encode(e))}function Vp(e){return\"string\"==typeof e&&(e=Wp(e)),Sp(e),e}function Gp(e){return\"string\"==typeof e&&(e=Wp(e)),Sp(e),e}function Zp(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];Sp(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const i=e[t];n.set(i,r),r+=i.length}return n}class Jp{}function Yp(e){const t=t=>e().update(Vp(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Xp(e=32){if(vp&&\"function\"==typeof vp.getRandomValues)return vp.getRandomValues(new Uint8Array(e));if(vp&&\"function\"==typeof vp.randomBytes)return Uint8Array.from(vp.randomBytes(e));throw new Error(\"crypto.getRandomValues must be defined\")}const Qp=BigInt(0),eg=BigInt(1),tg=BigInt(2),ng=BigInt(7),rg=BigInt(256),ig=BigInt(113),og=[],ag=[],sg=[];for(let e=0,t=eg,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],og.push(2*(5*r+n)),ag.push((e+1)*(e+2)/2%64);let i=Qp;for(let e=0;e<7;e++)t=(t<<eg^(t>>ng)*ig)%rg,t&tg&&(i^=eg<<(eg<<BigInt(e))-eg);sg.push(i)}const cg=tp(sg,!0),ug=cg[0],lg=cg[1],dg=(e,t,n)=>n>32?lp(e,t,n):cp(e,t,n),fg=(e,t,n)=>n>32?dp(e,t,n):up(e,t,n);class hg extends Jp{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,bp(n),!(0<e&&e<200))throw new Error(\"only keccak-f1600 function is supported\");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}clone(){return this._cloneInto()}keccak(){_p(this.state32),function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,i=(t+2)%10,o=n[i],a=n[i+1],s=dg(o,a,1)^n[r],c=fg(o,a,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=ag[n],o=dg(t,i,r),a=fg(t,i,r),s=og[n];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=ug[r],e[1]^=lg[r]}Ip(n)}(this.state32,this.rounds),_p(this.state32),this.posOut=0,this.pos=0}update(e){xp(this),Sp(e=Vp(e));const{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,128&t&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){xp(this,!1),Sp(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error(\"XOF is not possible for this instance\");return this.writeInto(e)}xof(e){return bp(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ep(e,this),this.finished)throw new Error(\"digest() was already called\");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Ip(this.state)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new hg(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const pg=(e,t,n)=>Yp(()=>new hg(t,e,n)),gg=pg(1,136,32);const{memoize:mg}=Br,yg=/^(?:0x)?[0-9a-f]+$/iu,wg=/^0x[0-9a-f]+$/iu,vg=/^0x[0-9a-f]{40}$/u,Ag=/^0x[0-9a-fA-F]{40}$/u,bg=(ne(V(),yg),ne(V(),wg)),Sg=(ne(V(),vg),ne(V(),Ag),e=>\"string\"==typeof e);function kg(e){return Sg(e)&&Ag.test(e)}function xg(e){Fr(function(e){return Sg(e)&&yg.test(e)}(e),\"Value must be a hexadecimal string.\")}const Eg=mg(function(e){Fr(kg(e),\"Invalid hex address.\");const t=Bg(e).toLowerCase(),n=gg(t),{length:r}=t,i=new Array(r);for(let e=0;e<r;e++){const r=1&e,o=n[e>>1],a=0===r?o>>4:15&o;i[e]=a>=8?t[e].toUpperCase():t[e]}return`0x${i.join(\"\")}`});const Ig=mg(function(e){return!!kg(e)&&Eg(e)===e});mg(function(e){return Sg(t=e)&&vg.test(t)||Ig(e);var t});function Tg(e){return e.startsWith(\"0x\")?e:e.startsWith(\"0X\")?`0x${e.substring(2)}`:`0x${e}`}function Bg(e){return e.startsWith(\"0x\")||e.startsWith(\"0X\")?e.substring(2):e}var Cg=n(48).hp;const Mg=48,Pg=58,_g=87;const Rg=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,\"0\"));return e}}();function Og(e){return e instanceof Uint8Array}function Ug(e){Fr(Og(e),\"Value must be a Uint8Array.\")}function Ng(e){if(Ug(e),0===e.length)return\"0x\";const t=Rg(),n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=t[e[r]];return Tg(n.join(\"\"))}function zg(e){Ug(e);const t=Ng(e);return BigInt(t)}function Fg(e){if(\"0x\"===e?.toLowerCase?.())return new Uint8Array;xg(e);const t=Bg(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++){const t=n.charCodeAt(2*e),i=n.charCodeAt(2*e+1),o=t-(t<Pg?Mg:_g),a=i-(i<Pg?Mg:_g);r[e]=16*o+a}return r}function Lg(e){return Fr(\"string\"==typeof e,\"Value must be a string.\"),(new TextEncoder).encode(e)}function Dg(e){if(\"bigint\"==typeof e)return function(e){return Fr(\"bigint\"==typeof e,\"Value must be a bigint.\"),Fr(e>=BigInt(0),\"Value must be a non-negative bigint.\"),Fg(e.toString(16))}(e);if(\"number\"==typeof e)return function(e){return Fr(\"number\"==typeof e,\"Value must be a number.\"),Fr(e>=0,\"Value must be a non-negative number.\"),Fr(Number.isSafeInteger(e),\"Value is not a safe integer. Use `bigIntToBytes` instead.\"),Fg(e.toString(16))}(e);if(\"string\"==typeof e)return e.startsWith(\"0x\")?Fg(e):Lg(e);if(Og(e))return e;throw new TypeError(`Unsupported value type: \"${typeof e}\".`)}function jg(e){const t=new Array(e.length);let n=0;for(let r=0;r<e.length;r++){const i=Dg(e[r]);t[r]=i,n+=i.length}const r=new Uint8Array(n);for(let e=0,n=0;e<t.length;e++)r.set(t[e],n),n+=t[e].length;return r}function $g(e){if(void 0!==Cg&&e instanceof Cg){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Kg,qg=\"ComputeBudget111111111111111111111111111111\",Hg=((Kg=Hg||{})[Kg.RequestUnits=0]=\"RequestUnits\",Kg[Kg.RequestHeapFrame=1]=\"RequestHeapFrame\",Kg[Kg.SetComputeUnitLimit=2]=\"SetComputeUnitLimit\",Kg[Kg.SetComputeUnitPrice=3]=\"SetComputeUnitPrice\",Kg[Kg.SetLoadedAccountsDataSizeLimit=4]=\"SetLoadedAccountsDataSizeLimit\",Kg);function Wg(e){const t=\"data\"in e?e.data:e;if(Vs(t,Oc().encode(0),0))return 0;if(Vs(t,Oc().encode(1),0))return 1;if(Vs(t,Oc().encode(2),0))return 2;if(Vs(t,Oc().encode(3),0))return 3;if(Vs(t,Oc().encode(4),0))return 4;throw new Fs(Ms,{instructionData:t,programName:\"computeBudget\"})}function Vg(){return mu([[\"discriminator\",Uc()],[\"bytes\",Pc()]])}function Gg(e){return{programAddress:e.programAddress,data:Vg().decode(e.data)}}function Zg(){return mu([[\"discriminator\",Uc()],[\"units\",Pc()],[\"additionalFee\",Pc()]])}function Jg(e){return{programAddress:e.programAddress,data:Zg().decode(e.data)}}var Yg=2;function Xg(){return mc(gu([[\"discriminator\",Oc()],[\"units\",Mc()]]),e=>({...e,discriminator:Yg}))}function Qg(){return mu([[\"discriminator\",Uc()],[\"units\",Pc()]])}function em(e,t){const n=t?.programAddress??qg,r={...e};return Object.freeze({data:Xg().encode(r),programAddress:n})}function tm(e){return{programAddress:e.programAddress,data:Qg().decode(e.data)}}var nm=3;function rm(){return mc(gu([[\"discriminator\",Oc()],[\"microLamports\",_c()]]),e=>({...e,discriminator:nm}))}function im(){return mu([[\"discriminator\",Uc()],[\"microLamports\",Rc()]])}function om(e,t){const n=t?.programAddress??qg,r={...e};return Object.freeze({data:rm().encode(r),programAddress:n})}function am(e){return{programAddress:e.programAddress,data:im().decode(e.data)}}function sm(){return mu([[\"discriminator\",Uc()],[\"accountDataSizeLimit\",Pc()]])}function cm(e){return{programAddress:e.programAddress,data:sm().decode(e.data)}}var um=e=>({__option:\"Some\",value:e}),lm=e=>!!(e&&\"object\"==typeof e&&\"__option\"in e&&(\"Some\"===e.__option&&\"value\"in e||\"None\"===e.__option)),dm=e=>\"Some\"===e.__option;function fm(e,t={}){const n=null===t.prefix?mc(lu(),e=>{}):Kc({size:t.prefix??Oc()});return Yc([mc(Zc([n,\"zeroes\"===t.noneValue?(Qs(e),sc(lu(),e.fixedSize)):t.noneValue?Vc(t.noneValue):lu()]),e=>[!1,void 0]),mc(Zc([n,e]),e=>[!0,lm(e)&&dm(e)?e.value:e])],e=>{const t=lm(e)?e:(e=>null!==e?um(e):{__option:\"None\"})(e);return Number(dm(t))})}function hm(e,t={}){const n=null===t.prefix?yc(du(),()=>!1):qc({size:t.prefix??Uc()}),r=\"zeroes\"===t.noneValue?(Qs(e),cc(du(),e.fixedSize)):t.noneValue?Gc(t.noneValue):du();return Xc([yc(Jc([n,r]),()=>({__option:\"None\"})),yc(Jc([n,e]),([,e])=>um(e))],(e,i)=>{if(null===t.prefix&&!t.noneValue)return Number(i<e.length);if(null===t.prefix&&null!=t.noneValue){return Vs(e,\"zeroes\"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,i)?0:1}return Number(n.read(e,i)[0])})}var pm,gm=((pm=gm||{})[pm.Uninitialized=0]=\"Uninitialized\",pm[pm.Initialized=1]=\"Initialized\",pm[pm.Frozen=2]=\"Frozen\",pm);function mm(){return au(gm)}function ym(){return su(gm)}var wm,vm=((wm=vm||{})[wm.MintTokens=0]=\"MintTokens\",wm[wm.FreezeAccount=1]=\"FreezeAccount\",wm[wm.AccountOwner=2]=\"AccountOwner\",wm[wm.CloseAccount=3]=\"CloseAccount\",wm);function Am(){return su(vm)}function bm(){return mu([[\"mint\",Wu()],[\"owner\",Wu()],[\"amount\",Rc()],[\"delegate\",hm(Wu(),{prefix:Pc(),noneValue:\"zeroes\"})],[\"state\",ym()],[\"isNative\",hm(Rc(),{prefix:Pc(),noneValue:\"zeroes\"})],[\"delegatedAmount\",Rc()],[\"closeAuthority\",hm(Wu(),{prefix:Pc(),noneValue:\"zeroes\"})]])}function Sm(){return tc(gu([[\"mint\",Hu()],[\"owner\",Hu()],[\"amount\",_c()],[\"delegate\",fm(Hu(),{prefix:Mc(),noneValue:\"zeroes\"})],[\"state\",mm()],[\"isNative\",fm(_c(),{prefix:Mc(),noneValue:\"zeroes\"})],[\"delegatedAmount\",_c()],[\"closeAuthority\",fm(Hu(),{prefix:Mc(),noneValue:\"zeroes\"})]]),bm())}function km(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function xm(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:km().decode(e.data)}}function Em(){return mc(gu([[\"discriminator\",Oc()],[\"amount\",_c()]]),e=>({...e,discriminator:4}))}function Im(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function Tm(e,t){const n=t?.programAddress??Cy,r={source:{value:e.source??null,isWritable:!0},delegate:{value:e.delegate??null,isWritable:!1},owner:{value:e.owner??null,isWritable:!1}},i={...e},o=(i.multiSigners??[]).map(e=>({address:e.address,role:al.READONLY_SIGNER,signer:e})),a=Of(n,\"programId\");return Object.freeze({accounts:[a(\"source\",r.source),a(\"delegate\",r.delegate),a(\"owner\",r.owner),...o],data:Em().encode(i),programAddress:n})}function Bm(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Im().decode(e.data)}}function Cm(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function Mm(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Cm().decode(e.data)}}function Pm(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function _m(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Pm().decode(e.data)}}function Rm(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function Om(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Rm().decode(e.data)}}function Um(){return mu([[\"discriminator\",Uc()]])}function Nm(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:Um().decode(e.data)}}async function zm(e,t={}){const{programAddress:n=\"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\"}=t;return await rl({programAddress:n,seeds:[Hu().encode(e.owner),Hu().encode(e.tokenProgram),Hu().encode(e.mint)]})}function Fm(){return mc(gu([[\"discriminator\",Oc()]]),e=>({...e,discriminator:0}))}function Lm(e,t){const n=t?.programAddress??By,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value=\"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"),r.systemProgram.value||(r.systemProgram.value=\"11111111111111111111111111111111\");const i=Of(n,\"programId\");return Object.freeze({accounts:[i(\"payer\",r.payer),i(\"ata\",r.ata),i(\"owner\",r.owner),i(\"mint\",r.mint),i(\"systemProgram\",r.systemProgram),i(\"tokenProgram\",r.tokenProgram)],data:Fm().encode({}),programAddress:n})}function Dm(){return mc(gu([[\"discriminator\",Oc()]]),e=>({...e,discriminator:1}))}function jm(e,t){const n=t?.programAddress??By,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value=\"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\"),r.systemProgram.value||(r.systemProgram.value=\"11111111111111111111111111111111\");const i=Of(n,\"programId\");return Object.freeze({accounts:[i(\"payer\",r.payer),i(\"ata\",r.ata),i(\"owner\",r.owner),i(\"mint\",r.mint),i(\"systemProgram\",r.systemProgram),i(\"tokenProgram\",r.tokenProgram)],data:Dm().encode({}),programAddress:n})}function $m(){return mu([[\"discriminator\",Uc()]])}function Km(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:$m().decode(e.data)}}function qm(){return mu([[\"discriminator\",Uc()]])}function Hm(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:qm().decode(e.data)}}function Wm(){return mu([[\"discriminator\",Uc()]])}function Vm(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:Wm().decode(e.data)}}function Gm(){return mu([[\"discriminator\",Uc()],[\"owner\",Wu()]])}function Zm(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Gm().decode(e.data)}}function Jm(){return mu([[\"discriminator\",Uc()],[\"owner\",Wu()]])}function Ym(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:Jm().decode(e.data)}}function Xm(){return mu([[\"discriminator\",Uc()]])}function Qm(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Xm().decode(e.data)}}function ey(){return mu([[\"discriminator\",Uc()],[\"decimals\",Uc()],[\"mintAuthority\",Wu()],[\"freezeAuthority\",hm(Wu())]])}function ty(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:ey().decode(e.data)}}function ny(){return mu([[\"discriminator\",Uc()],[\"decimals\",Uc()],[\"mintAuthority\",Wu()],[\"freezeAuthority\",hm(Wu())]])}function ry(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ny().decode(e.data)}}function iy(){return mu([[\"discriminator\",Uc()],[\"m\",Uc()]])}function oy(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:iy().decode(e.data)}}function ay(){return mu([[\"discriminator\",Uc()],[\"m\",Uc()]])}function sy(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{multisig:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ay().decode(e.data)}}function cy(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function uy(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:cy().decode(e.data)}}function ly(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function dy(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:ly().decode(e.data)}}function fy(){return mu([[\"discriminator\",Uc()]])}function hy(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:fy().decode(e.data)}}function py(){return mu([[\"discriminator\",Uc()],[\"authorityType\",Am()],[\"newAuthority\",hm(Wu())]])}function gy(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:py().decode(e.data)}}function my(){return mu([[\"discriminator\",Uc()]])}function yy(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};let r=e.accounts.length-1;return{programAddress:e.programAddress,accounts:{account:n(),rent:(()=>{if(0!==r)return r-=1,n()})()},data:my().decode(e.data)}}function wy(){return mu([[\"discriminator\",Uc()]])}function vy(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:wy().decode(e.data)}}function Ay(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function by(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:Ay().decode(e.data)}}function Sy(){return mc(gu([[\"discriminator\",Oc()],[\"amount\",_c()],[\"decimals\",Oc()]]),e=>({...e,discriminator:12}))}function ky(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function xy(e,t){const n=t?.programAddress??Cy,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},i={...e},o=(i.multiSigners??[]).map(e=>({address:e.address,role:al.READONLY_SIGNER,signer:e})),a=Of(n,\"programId\");return Object.freeze({accounts:[a(\"source\",r.source),a(\"mint\",r.mint),a(\"destination\",r.destination),a(\"authority\",r.authority),...o],data:Sy().encode(i),programAddress:n})}function Ey(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:ky().decode(e.data)}}function Iy(){return mu([[\"discriminator\",Uc()],[\"uiAmount\",Uu()]])}function Ty(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Iy().decode(e.data)}}var By=\"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\";var Cy=\"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\";var My,Py=((My=Py||{})[My.InitializeMint=0]=\"InitializeMint\",My[My.InitializeAccount=1]=\"InitializeAccount\",My[My.InitializeMultisig=2]=\"InitializeMultisig\",My[My.Transfer=3]=\"Transfer\",My[My.Approve=4]=\"Approve\",My[My.Revoke=5]=\"Revoke\",My[My.SetAuthority=6]=\"SetAuthority\",My[My.MintTo=7]=\"MintTo\",My[My.Burn=8]=\"Burn\",My[My.CloseAccount=9]=\"CloseAccount\",My[My.FreezeAccount=10]=\"FreezeAccount\",My[My.ThawAccount=11]=\"ThawAccount\",My[My.TransferChecked=12]=\"TransferChecked\",My[My.ApproveChecked=13]=\"ApproveChecked\",My[My.MintToChecked=14]=\"MintToChecked\",My[My.BurnChecked=15]=\"BurnChecked\",My[My.InitializeAccount2=16]=\"InitializeAccount2\",My[My.SyncNative=17]=\"SyncNative\",My[My.InitializeAccount3=18]=\"InitializeAccount3\",My[My.InitializeMultisig2=19]=\"InitializeMultisig2\",My[My.InitializeMint2=20]=\"InitializeMint2\",My[My.GetAccountDataSize=21]=\"GetAccountDataSize\",My[My.InitializeImmutableOwner=22]=\"InitializeImmutableOwner\",My[My.AmountToUiAmount=23]=\"AmountToUiAmount\",My[My.UiAmountToAmount=24]=\"UiAmountToAmount\",My[My.WithdrawExcessLamports=25]=\"WithdrawExcessLamports\",My[My.UnwrapLamports=26]=\"UnwrapLamports\",My[My.Batch=27]=\"Batch\",My);function _y(e){const t=\"data\"in e?e.data:e;if(Vs(t,Oc().encode(0),0))return 0;if(Vs(t,Oc().encode(1),0))return 1;if(Vs(t,Oc().encode(2),0))return 2;if(Vs(t,Oc().encode(3),0))return 3;if(Vs(t,Oc().encode(4),0))return 4;if(Vs(t,Oc().encode(5),0))return 5;if(Vs(t,Oc().encode(6),0))return 6;if(Vs(t,Oc().encode(7),0))return 7;if(Vs(t,Oc().encode(8),0))return 8;if(Vs(t,Oc().encode(9),0))return 9;if(Vs(t,Oc().encode(10),0))return 10;if(Vs(t,Oc().encode(11),0))return 11;if(Vs(t,Oc().encode(12),0))return 12;if(Vs(t,Oc().encode(13),0))return 13;if(Vs(t,Oc().encode(14),0))return 14;if(Vs(t,Oc().encode(15),0))return 15;if(Vs(t,Oc().encode(16),0))return 16;if(Vs(t,Oc().encode(17),0))return 17;if(Vs(t,Oc().encode(18),0))return 18;if(Vs(t,Oc().encode(19),0))return 19;if(Vs(t,Oc().encode(20),0))return 20;if(Vs(t,Oc().encode(21),0))return 21;if(Vs(t,Oc().encode(22),0))return 22;if(Vs(t,Oc().encode(23),0))return 23;if(Vs(t,Oc().encode(24),0))return 24;if(Vs(t,Oc().encode(38),0))return 25;if(Vs(t,Oc().encode(45),0))return 26;if(Vs(t,Oc().encode(255),0))return 27;throw new Fs(Ms,{instructionData:t,programName:\"token\"})}function Ry(e){return!(\"exists\"in e)||\"exists\"in e&&e.exists}function Oy(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Cu().encode(t.data[0]);return Object.freeze({...Ny(t),address:e,data:n,exists:!0})}function Uy(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info||{};return(t.data.program||t.data.parsed.type)&&(n.parsedAccountMeta={program:t.data.program,type:t.data.parsed.type}),Object.freeze({...Ny(t),address:e,data:n,exists:!0})}function Ny(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function zy(e,t,n={}){const{abortSignal:r,...i}=n;return Oy(t,(await e.getAccountInfo(t,{...i,encoding:\"base64\"}).send({abortSignal:r})).value)}async function Fy(e,t,n={}){const{abortSignal:r,...i}=n,{value:o}=await e.getAccountInfo(t,{...i,encoding:\"jsonParsed\"}).send({abortSignal:r});return o&&\"object\"==typeof o&&\"parsed\"in o.data?Uy(t,o):Oy(t,o)}async function Ly(e,t,n={}){const{abortSignal:r,...i}=n;return(await e.getMultipleAccounts(t,{...i,encoding:\"base64\"}).send({abortSignal:r})).value.map((e,n)=>Oy(t[n],e))}function Dy(e){if(!e.exists)throw new Fs(ua,{address:e.address})}var jy=(e=>(e[e.Uninitialized=0]=\"Uninitialized\",e[e.Initialized=1]=\"Initialized\",e[e.Frozen=2]=\"Frozen\",e))(jy||{});function $y(){return su(jy)}var Ky=(e=>(e[e.MintTokens=0]=\"MintTokens\",e[e.FreezeAccount=1]=\"FreezeAccount\",e[e.AccountOwner=2]=\"AccountOwner\",e[e.CloseAccount=3]=\"CloseAccount\",e[e.TransferFeeConfig=4]=\"TransferFeeConfig\",e[e.WithheldWithdraw=5]=\"WithheldWithdraw\",e[e.CloseMint=6]=\"CloseMint\",e[e.InterestRate=7]=\"InterestRate\",e[e.PermanentDelegate=8]=\"PermanentDelegate\",e[e.ConfidentialTransferMint=9]=\"ConfidentialTransferMint\",e[e.TransferHookProgramId=10]=\"TransferHookProgramId\",e[e.ConfidentialTransferFeeConfig=11]=\"ConfidentialTransferFeeConfig\",e[e.MetadataPointer=12]=\"MetadataPointer\",e[e.GroupPointer=13]=\"GroupPointer\",e[e.GroupMemberPointer=14]=\"GroupMemberPointer\",e[e.ScaledUiAmount=15]=\"ScaledUiAmount\",e[e.Pause=16]=\"Pause\",e[e.PermissionedBurn=17]=\"PermissionedBurn\",e))(Ky||{});function qy(){return su(Ky)}function Hy(){return cc(Wc(),36)}function Wy(){return cc(Wc(),64)}var Vy,Gy=((Vy=Gy||{})[Vy.Uninitialized=0]=\"Uninitialized\",Vy[Vy.TransferFeeConfig=1]=\"TransferFeeConfig\",Vy[Vy.TransferFeeAmount=2]=\"TransferFeeAmount\",Vy[Vy.MintCloseAuthority=3]=\"MintCloseAuthority\",Vy[Vy.ConfidentialTransferMint=4]=\"ConfidentialTransferMint\",Vy[Vy.ConfidentialTransferAccount=5]=\"ConfidentialTransferAccount\",Vy[Vy.DefaultAccountState=6]=\"DefaultAccountState\",Vy[Vy.ImmutableOwner=7]=\"ImmutableOwner\",Vy[Vy.MemoTransfer=8]=\"MemoTransfer\",Vy[Vy.NonTransferable=9]=\"NonTransferable\",Vy[Vy.InterestBearingConfig=10]=\"InterestBearingConfig\",Vy[Vy.CpiGuard=11]=\"CpiGuard\",Vy[Vy.PermanentDelegate=12]=\"PermanentDelegate\",Vy[Vy.NonTransferableAccount=13]=\"NonTransferableAccount\",Vy[Vy.TransferHook=14]=\"TransferHook\",Vy[Vy.TransferHookAccount=15]=\"TransferHookAccount\",Vy[Vy.ConfidentialTransferFee=16]=\"ConfidentialTransferFee\",Vy[Vy.ConfidentialTransferFeeAmount=17]=\"ConfidentialTransferFeeAmount\",Vy[Vy.MetadataPointer=18]=\"MetadataPointer\",Vy[Vy.TokenMetadata=19]=\"TokenMetadata\",Vy[Vy.GroupPointer=20]=\"GroupPointer\",Vy[Vy.TokenGroup=21]=\"TokenGroup\",Vy[Vy.GroupMemberPointer=22]=\"GroupMemberPointer\",Vy[Vy.TokenGroupMember=23]=\"TokenGroupMember\",Vy[Vy.ConfidentialMintBurn=24]=\"ConfidentialMintBurn\",Vy[Vy.ScaledUiAmountConfig=25]=\"ScaledUiAmountConfig\",Vy[Vy.PausableConfig=26]=\"PausableConfig\",Vy[Vy.PausableAccount=27]=\"PausableAccount\",Vy[Vy.PermissionedBurn=28]=\"PermissionedBurn\",Vy);function Zy(){return su(Gy,{size:Cc()})}function Jy(){return nu([[\"Name\",du()],[\"Symbol\",du()],[\"Uri\",du()],[\"Key\",mu([[\"fields\",Jc([oc(Uu(),Pc())])]])]])}function Yy(){return mu([[\"epoch\",Rc()],[\"maximumFee\",Rc()],[\"transferFeeBasisPoints\",Cc()]])}function Xy(){return nu([[\"Uninitialized\",du()],[\"TransferFeeConfig\",oc(mu([[\"transferFeeConfigAuthority\",Wu()],[\"withdrawWithheldAuthority\",Wu()],[\"withheldAmount\",Rc()],[\"olderTransferFee\",Yy()],[\"newerTransferFee\",Yy()]]),Cc())],[\"TransferFeeAmount\",oc(mu([[\"withheldAmount\",Rc()]]),Cc())],[\"MintCloseAuthority\",oc(mu([[\"closeAuthority\",Wu()]]),Cc())],[\"ConfidentialTransferMint\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"autoApproveNewAccounts\",qc()],[\"auditorElgamalPubkey\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]]),Cc())],[\"ConfidentialTransferAccount\",oc(mu([[\"approved\",qc()],[\"elgamalPubkey\",Wu()],[\"pendingBalanceLow\",Wy()],[\"pendingBalanceHigh\",Wy()],[\"availableBalance\",Wy()],[\"decryptableAvailableBalance\",Hy()],[\"allowConfidentialCredits\",qc()],[\"allowNonConfidentialCredits\",qc()],[\"pendingBalanceCreditCounter\",Rc()],[\"maximumPendingBalanceCreditCounter\",Rc()],[\"expectedPendingBalanceCreditCounter\",Rc()],[\"actualPendingBalanceCreditCounter\",Rc()]]),Cc())],[\"DefaultAccountState\",oc(mu([[\"state\",$y()]]),Cc())],[\"ImmutableOwner\",oc(mu([]),Cc())],[\"MemoTransfer\",oc(mu([[\"requireIncomingTransferMemos\",qc()]]),Cc())],[\"NonTransferable\",oc(mu([]),Cc())],[\"InterestBearingConfig\",oc(mu([[\"rateAuthority\",Wu()],[\"initializationTimestamp\",Rc()],[\"preUpdateAverageRate\",kc()],[\"lastUpdateTimestamp\",Rc()],[\"currentRate\",kc()]]),Cc())],[\"CpiGuard\",oc(mu([[\"lockCpi\",qc()]]),Cc())],[\"PermanentDelegate\",oc(mu([[\"delegate\",Wu()]]),Cc())],[\"NonTransferableAccount\",oc(mu([]),Cc())],[\"TransferHook\",oc(mu([[\"authority\",Wu()],[\"programId\",Wu()]]),Cc())],[\"TransferHookAccount\",oc(mu([[\"transferring\",qc()]]),Cc())],[\"ConfidentialTransferFee\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"elgamalPubkey\",Wu()],[\"harvestToMintEnabled\",qc()],[\"withheldAmount\",Wy()]]),Cc())],[\"ConfidentialTransferFeeAmount\",oc(mu([[\"withheldAmount\",Wy()]]),Cc())],[\"MetadataPointer\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"metadataAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]]),Cc())],[\"TokenMetadata\",oc(mu([[\"updateAuthority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"mint\",Wu()],[\"name\",oc(Uu(),Pc())],[\"symbol\",oc(Uu(),Pc())],[\"uri\",oc(Uu(),Pc())],[\"additionalMetadata\",uu(oc(Uu(),Pc()),oc(Uu(),Pc()))]]),Cc())],[\"GroupPointer\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"groupAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]]),Cc())],[\"TokenGroup\",oc(mu([[\"updateAuthority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"mint\",Wu()],[\"size\",Rc()],[\"maxSize\",Rc()]]),Cc())],[\"GroupMemberPointer\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"memberAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]]),Cc())],[\"TokenGroupMember\",oc(mu([[\"mint\",Wu()],[\"group\",Wu()],[\"memberNumber\",Rc()]]),Cc())],[\"ConfidentialMintBurn\",oc(mu([[\"confidentialSupply\",Wy()],[\"decryptableSupply\",Hy()],[\"supplyElgamalPubkey\",Wu()],[\"pendingBurn\",Wy()]]),Cc())],[\"ScaledUiAmountConfig\",oc(mu([[\"authority\",Wu()],[\"multiplier\",Sc()],[\"newMultiplierEffectiveTimestamp\",Rc()],[\"newMultiplier\",Sc()]]),Cc())],[\"PausableConfig\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"paused\",qc()]]),Cc())],[\"PausableAccount\",oc(mu([]),Cc())],[\"PermissionedBurn\",oc(mu([[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]]),Cc())]],{size:Cc()})}function Qy(){const e=Xy(),t=Cc();return Ys({read:(n,r)=>{const i=[];for(;r+2<=n.length;){const[o]=t.read(n,r);if(0===o)break;const[a,s]=e.read(n,r);i.push(a),r=s}return[i,n.length]}})}function ew(){return mu([[\"mintAuthority\",hm(Wu(),{prefix:Pc(),noneValue:\"zeroes\"})],[\"supply\",Rc()],[\"decimals\",Uc()],[\"isInitialized\",qc()],[\"freezeAuthority\",hm(Wu(),{prefix:Pc(),noneValue:\"zeroes\"})],[\"extensions\",hm(cu(Qy(),[Gc(pc(Oc(),83).encode(1))]),{prefix:null})]])}function tw(e){return function(e,t){try{return\"exists\"in e&&!e.exists?e:Object.freeze({...e,data:t.decode(e.data)})}catch{throw new Fs(da,{address:e.address})}}(e,ew())}async function nw(e,t,n){const r=await async function(e,t,n){const r=await zy(e,t,n);return tw(r)}(e,t,n);return Dy(r),r}function rw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"expectedPendingBalanceCreditCounter\",Rc()],[\"newDecryptableAvailableBalance\",Hy()]])}function iw(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:rw().decode(e.data)}}function ow(){return mc(gu([[\"discriminator\",Oc()],[\"amount\",_c()]]),e=>({...e,discriminator:4}))}function aw(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function sw(e,t){const n=t?.programAddress??Bb,r={source:{value:e.source??null,isWritable:!0},delegate:{value:e.delegate??null,isWritable:!1},owner:{value:e.owner??null,isWritable:!1}},i={...e},o=(i.multiSigners??[]).map(e=>({address:e.address,role:al.READONLY_SIGNER,signer:e})),a=Of(n,\"programId\");return Object.freeze({accounts:[a(\"source\",r.source),a(\"delegate\",r.delegate),a(\"owner\",r.owner),...o],data:ow().encode(i),programAddress:n})}function cw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:aw().decode(e.data)}}function uw(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function lw(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:uw().decode(e.data)}}function dw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()]])}function fw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:dw().decode(e.data)}}function hw(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function pw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:hw().decode(e.data)}}function gw(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function mw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:gw().decode(e.data)}}function yw(){return mu([[\"discriminator\",Uc()]])}function ww(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:yw().decode(e.data)}}function vw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function Aw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:vw().decode(e.data)}}function bw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"newSourceDecryptableAvailableBalance\",Hy()],[\"transferAmountAuditorCiphertextLo\",Wy()],[\"transferAmountAuditorCiphertextHi\",Wy()],[\"equalityProofInstructionOffset\",Ec()],[\"ciphertextValidityProofInstructionOffset\",Ec()],[\"rangeProofInstructionOffset\",Ec()]])}function Sw(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};let r=e.accounts.length-4;const i=()=>{if(0!==r)return r-=1,n()};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:i(),equalityRecord:i(),ciphertextValidityRecord:i(),rangeRecord:i(),authority:n()},data:bw().decode(e.data)}}function kw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"newSourceDecryptableAvailableBalance\",Hy()],[\"transferAmountAuditorCiphertextLo\",Wy()],[\"transferAmountAuditorCiphertextHi\",Wy()],[\"equalityProofInstructionOffset\",Ec()],[\"transferAmountCiphertextValidityProofInstructionOffset\",Ec()],[\"feeSigmaProofInstructionOffset\",Ec()],[\"feeCiphertextValidityProofInstructionOffset\",Ec()],[\"rangeProofInstructionOffset\",Ec()]])}function xw(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};let r=e.accounts.length-4;const i=()=>{if(0!==r)return r-=1,n()};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:i(),equalityRecord:i(),transferAmountCiphertextValidityRecord:i(),feeSigmaRecord:i(),feeCiphertextValidityRecord:i(),rangeRecord:i(),authority:n()},data:kw().decode(e.data)}}function Ew(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()],[\"newDecryptableAvailableBalance\",Hy()],[\"equalityProofInstructionOffset\",Ec()],[\"rangeProofInstructionOffset\",Ec()]])}function Iw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};let r=e.accounts.length-3;const i=()=>{if(0!==r)return r-=1,n()};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvar:i(),equalityRecord:i(),rangeRecord:i(),authority:n()},data:Ew().decode(e.data)}}function Tw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"decryptableZeroBalance\",Hy()],[\"maximumPendingBalanceCreditCounter\",Rc()],[\"proofInstructionOffset\",Ec()]])}function Bw(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvarOrContextState:n(),authority:n()},data:Tw().decode(e.data)}}function Cw(){return mc(gu([[\"discriminator\",Oc()]]),e=>({...e,discriminator:0}))}function Mw(){return mu([[\"discriminator\",Uc()]])}function Pw(e,t){const n=t?.programAddress??Eb,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value=\"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb\"),r.systemProgram.value||(r.systemProgram.value=\"11111111111111111111111111111111\");const i=Of(n,\"programId\");return Object.freeze({accounts:[i(\"payer\",r.payer),i(\"ata\",r.ata),i(\"owner\",r.owner),i(\"mint\",r.mint),i(\"systemProgram\",r.systemProgram),i(\"tokenProgram\",r.tokenProgram)],data:Cw().encode({}),programAddress:n})}function _w(e){if(e.accounts.length<6)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:6});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:Mw().decode(e.data)}}function Rw(){return mc(gu([[\"discriminator\",Oc()]]),e=>({...e,discriminator:1}))}function Ow(){return mu([[\"discriminator\",Uc()]])}function Uw(e,t){const n=t?.programAddress??Eb,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value=\"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb\"),r.systemProgram.value||(r.systemProgram.value=\"11111111111111111111111111111111\");const i=Of(n,\"programId\");return Object.freeze({accounts:[i(\"payer\",r.payer),i(\"ata\",r.ata),i(\"owner\",r.owner),i(\"mint\",r.mint),i(\"systemProgram\",r.systemProgram),i(\"tokenProgram\",r.tokenProgram)],data:Rw().encode({}),programAddress:n})}function Nw(e){if(e.accounts.length<6)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:6});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:Ow().decode(e.data)}}function zw(){return mu([[\"discriminator\",Uc()]])}function Fw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),nativeMint:n(),systemProgram:n()},data:zw().decode(e.data)}}function Lw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()]])}function Dw(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Lw().decode(e.data)}}function jw(){return mu([[\"discriminator\",Uc()],[\"cpiGuardDiscriminator\",Uc()]])}function $w(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:jw().decode(e.data)}}function Kw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferFeeDiscriminator\",Uc()]])}function qw(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Kw().decode(e.data)}}function Hw(){return mu([[\"discriminator\",Uc()],[\"memoTransfersDiscriminator\",Uc()]])}function Ww(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:Hw().decode(e.data)}}function Vw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()]])}function Gw(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Vw().decode(e.data)}}new Uint8Array([250,166,180,250,13,12,184,70]);function Zw(){return mu([[\"discriminator\",cc(Wc(),8)],[\"start\",hm(Rc())],[\"end\",hm(Rc())]])}function Jw(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{metadata:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Zw().decode(e.data)}}function Yw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"proofInstructionOffset\",Ec()]])}function Xw(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),instructionsSysvarOrContextState:n(),authority:n()},data:Yw().decode(e.data)}}function Qw(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()]])}function ev(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Qw().decode(e.data)}}function tv(){return mu([[\"discriminator\",Uc()],[\"cpiGuardDiscriminator\",Uc()]])}function nv(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:tv().decode(e.data)}}function rv(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferFeeDiscriminator\",Uc()]])}function iv(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:rv().decode(e.data)}}function ov(){return mu([[\"discriminator\",Uc()],[\"memoTransfersDiscriminator\",Uc()]])}function av(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:ov().decode(e.data)}}function sv(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()]])}function cv(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:sv().decode(e.data)}}function uv(){return mu([[\"discriminator\",Uc()]])}function lv(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:uv().decode(e.data)}}function dv(){return mu([[\"discriminator\",Uc()]])}function fv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:dv().decode(e.data)}}function hv(){return mu([[\"discriminator\",Uc()],[\"transferFeeDiscriminator\",Uc()]])}function pv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:hv().decode(e.data)}}function gv(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferFeeDiscriminator\",Uc()]])}function mv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:gv().decode(e.data)}}function yv(){return mu([[\"discriminator\",Uc()]])}function wv(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:yv().decode(e.data)}}function vv(){return mu([[\"discriminator\",Uc()],[\"owner\",Wu()]])}function Av(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:vv().decode(e.data)}}function bv(){return mu([[\"discriminator\",Uc()],[\"owner\",Wu()]])}function Sv(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:bv().decode(e.data)}}function kv(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferFeeDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"withdrawWithheldAuthorityElGamalPubkey\",Wu()]])}function xv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:kv().decode(e.data)}}function Ev(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"autoApproveNewAccounts\",qc()],[\"auditorElgamalPubkey\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function Iv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ev().decode(e.data)}}function Tv(){return mu([[\"discriminator\",Uc()],[\"defaultAccountStateDiscriminator\",Uc()],[\"state\",$y()]])}function Bv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Tv().decode(e.data)}}function Cv(){return mu([[\"discriminator\",Uc()],[\"groupMemberPointerDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"memberAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function Mv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cv().decode(e.data)}}function Pv(){return mu([[\"discriminator\",Uc()],[\"groupPointerDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"groupAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function _v(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Pv().decode(e.data)}}function Rv(){return mu([[\"discriminator\",Uc()]])}function Ov(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rv().decode(e.data)}}function Uv(){return mu([[\"discriminator\",Uc()],[\"interestBearingMintDiscriminator\",Uc()],[\"rateAuthority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"rate\",kc()]])}function Nv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Uv().decode(e.data)}}function zv(){return mu([[\"discriminator\",Uc()],[\"metadataPointerDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"metadataAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function Fv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:zv().decode(e.data)}}function Lv(){return mu([[\"discriminator\",Uc()],[\"decimals\",Uc()],[\"mintAuthority\",Wu()],[\"freezeAuthority\",hm(Wu())]])}function Dv(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Lv().decode(e.data)}}function jv(){return mu([[\"discriminator\",Uc()],[\"decimals\",Uc()],[\"mintAuthority\",Wu()],[\"freezeAuthority\",hm(Wu())]])}function $v(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:jv().decode(e.data)}}function Kv(){return mu([[\"discriminator\",Uc()],[\"closeAuthority\",hm(Wu())]])}function qv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Kv().decode(e.data)}}function Hv(){return mu([[\"discriminator\",Uc()],[\"m\",Uc()]])}function Wv(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:Hv().decode(e.data)}}function Vv(){return mu([[\"discriminator\",Uc()]])}function Gv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vv().decode(e.data)}}function Zv(){return mu([[\"discriminator\",Uc()],[\"pausableDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function Jv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Zv().decode(e.data)}}function Yv(){return mu([[\"discriminator\",Uc()],[\"delegate\",Wu()]])}function Xv(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Yv().decode(e.data)}}function Qv(){return mu([[\"discriminator\",Uc()],[\"scaledUiAmountMintDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"multiplier\",Sc()]])}function eA(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Qv().decode(e.data)}}new Uint8Array([121,113,108,39,54,51,0,4]);function tA(){return mu([[\"discriminator\",cc(Wc(),8)],[\"updateAuthority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"maxSize\",Rc()]])}function nA(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),mint:n(),mintAuthority:n()},data:tA().decode(e.data)}}new Uint8Array([152,32,222,176,223,237,116,134]);function rA(){return mu([[\"discriminator\",cc(Wc(),8)]])}function iA(e){if(e.accounts.length<5)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:5});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{member:n(),memberMint:n(),memberMintAuthority:n(),group:n(),groupUpdateAuthority:n()},data:rA().decode(e.data)}}new Uint8Array([210,225,30,162,88,184,77,141]);function oA(){return mu([[\"discriminator\",cc(Wc(),8)],[\"name\",oc(Uu(),Pc())],[\"symbol\",oc(Uu(),Pc())],[\"uri\",oc(Uu(),Pc())]])}function aA(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n(),mint:n(),mintAuthority:n()},data:oA().decode(e.data)}}function sA(){return mu([[\"discriminator\",Uc()],[\"transferFeeDiscriminator\",Uc()],[\"transferFeeConfigAuthority\",hm(Wu())],[\"withdrawWithheldAuthority\",hm(Wu())],[\"transferFeeBasisPoints\",Cc()],[\"maximumFee\",Rc()]])}function cA(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:sA().decode(e.data)}}function uA(){return mu([[\"discriminator\",Uc()],[\"transferHookDiscriminator\",Uc()],[\"authority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})],[\"programId\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function lA(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:uA().decode(e.data)}}function dA(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function fA(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:dA().decode(e.data)}}function hA(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function pA(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:hA().decode(e.data)}}function gA(){return mu([[\"discriminator\",Uc()],[\"pausableDiscriminator\",Uc()]])}function mA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:gA().decode(e.data)}}function yA(){return mu([[\"discriminator\",Uc()],[\"newExtensionTypes\",jc(Zy(),{size:\"remainder\"})]])}function wA(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),payer:n(),systemProgram:n(),owner:n()},data:yA().decode(e.data)}}function vA(){return mu([[\"discriminator\",Uc()]])}function AA(e){if(e.accounts.length<7)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:7});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nestedAssociatedAccountAddress:n(),nestedTokenMintAddress:n(),destinationAssociatedAccountAddress:n(),ownerAssociatedAccountAddress:n(),ownerTokenMintAddress:n(),walletAddress:n(),tokenProgram:n()},data:vA().decode(e.data)}}new Uint8Array([234,18,32,56,89,141,37,181]);function bA(){return mu([[\"discriminator\",cc(Wc(),8)],[\"idempotent\",qc()],[\"key\",oc(Uu(),Pc())]])}function SA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:bA().decode(e.data)}}function kA(){return mu([[\"discriminator\",Uc()],[\"pausableDiscriminator\",Uc()]])}function xA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:kA().decode(e.data)}}function EA(){return mu([[\"discriminator\",Uc()]])}function IA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:EA().decode(e.data)}}function TA(){return mu([[\"discriminator\",Uc()],[\"authorityType\",qy()],[\"newAuthority\",hm(Wu())]])}function BA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:TA().decode(e.data)}}function CA(){return mu([[\"discriminator\",Uc()],[\"transferFeeDiscriminator\",Uc()],[\"transferFeeBasisPoints\",Cc()],[\"maximumFee\",Rc()]])}function MA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),transferFeeConfigAuthority:n()},data:CA().decode(e.data)}}function PA(){return mu([[\"discriminator\",Uc()]])}function _A(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};let r=e.accounts.length-1;return{programAddress:e.programAddress,accounts:{account:n(),rent:(()=>{if(0!==r)return r-=1,n()})()},data:PA().decode(e.data)}}function RA(){return mu([[\"discriminator\",Uc()]])}function OA(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:RA().decode(e.data)}}function UA(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function NA(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:UA().decode(e.data)}}function zA(){return mc(gu([[\"discriminator\",Oc()],[\"amount\",_c()],[\"decimals\",Oc()]]),e=>({...e,discriminator:12}))}function FA(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()]])}function LA(e,t){const n=t?.programAddress??Bb,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},i={...e},o=(i.multiSigners??[]).map(e=>({address:e.address,role:al.READONLY_SIGNER,signer:e})),a=Of(n,\"programId\");return Object.freeze({accounts:[a(\"source\",r.source),a(\"mint\",r.mint),a(\"destination\",r.destination),a(\"authority\",r.authority),...o],data:zA().encode(i),programAddress:n})}function DA(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:FA().decode(e.data)}}function jA(){return mu([[\"discriminator\",Uc()],[\"transferFeeDiscriminator\",Uc()],[\"amount\",Rc()],[\"decimals\",Uc()],[\"fee\",Rc()]])}function $A(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:jA().decode(e.data)}}function KA(){return mu([[\"discriminator\",Uc()],[\"uiAmount\",Uu()]])}function qA(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:KA().decode(e.data)}}function HA(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferDiscriminator\",Uc()],[\"autoApproveNewAccounts\",qc()],[\"auditorElgamalPubkey\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function WA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:HA().decode(e.data)}}function VA(){return mu([[\"discriminator\",Uc()],[\"defaultAccountStateDiscriminator\",Uc()],[\"state\",$y()]])}function GA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),freezeAuthority:n()},data:VA().decode(e.data)}}function ZA(){return mu([[\"discriminator\",Uc()],[\"groupMemberPointerDiscriminator\",Uc()],[\"memberAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function JA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupMemberPointerAuthority:n()},data:ZA().decode(e.data)}}function YA(){return mu([[\"discriminator\",Uc()],[\"groupPointerDiscriminator\",Uc()],[\"groupAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function XA(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupPointerAuthority:n()},data:YA().decode(e.data)}}function QA(){return mu([[\"discriminator\",Uc()],[\"metadataPointerDiscriminator\",Uc()],[\"metadataAddress\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function eb(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),metadataPointerAuthority:n()},data:QA().decode(e.data)}}function tb(){return mu([[\"discriminator\",Uc()],[\"scaledUiAmountMintDiscriminator\",Uc()],[\"multiplier\",Sc()],[\"effectiveTimestamp\",xc()]])}function nb(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:tb().decode(e.data)}}function rb(){return mu([[\"discriminator\",Uc()],[\"interestBearingMintDiscriminator\",Uc()],[\"rate\",kc()]])}function ib(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rateAuthority:n()},data:rb().decode(e.data)}}new Uint8Array([108,37,171,143,248,30,18,110]);function ob(){return mu([[\"discriminator\",cc(Wc(),8)],[\"maxSize\",Rc()]])}function ab(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:ob().decode(e.data)}}new Uint8Array([161,105,88,1,237,221,216,203]);function sb(){return mu([[\"discriminator\",cc(Wc(),8)],[\"newUpdateAuthority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function cb(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:sb().decode(e.data)}}new Uint8Array([221,233,49,45,181,202,220,200]);function ub(){return mu([[\"discriminator\",cc(Wc(),8)],[\"field\",Jy()],[\"value\",oc(Uu(),Pc())]])}function lb(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:ub().decode(e.data)}}new Uint8Array([215,228,166,228,84,100,86,123]);function db(){return mu([[\"discriminator\",cc(Wc(),8)],[\"newUpdateAuthority\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function fb(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:db().decode(e.data)}}function hb(){return mu([[\"discriminator\",Uc()],[\"transferHookDiscriminator\",Uc()],[\"programId\",hm(Wu(),{prefix:null,noneValue:\"zeroes\"})]])}function pb(e){if(e.accounts.length<2)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:2});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:hb().decode(e.data)}}function gb(){return mu([[\"discriminator\",Uc()]])}function mb(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:gb().decode(e.data)}}function yb(){return mu([[\"discriminator\",Uc()],[\"transferFeeDiscriminator\",Uc()],[\"numTokenAccounts\",Uc()]])}function wb(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:yb().decode(e.data)}}function vb(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferFeeDiscriminator\",Uc()],[\"numTokenAccounts\",Uc()],[\"proofInstructionOffset\",Ec()],[\"newDecryptableAvailableBalance\",Hy()]])}function Ab(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),authority:n()},data:vb().decode(e.data)}}function bb(){return mu([[\"discriminator\",Uc()],[\"transferFeeDiscriminator\",Uc()]])}function Sb(e){if(e.accounts.length<3)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:3});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:bb().decode(e.data)}}function kb(){return mu([[\"discriminator\",Uc()],[\"confidentialTransferFeeDiscriminator\",Uc()],[\"proofInstructionOffset\",Ec()],[\"newDecryptableAvailableBalance\",Hy()]])}function xb(e){if(e.accounts.length<4)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:4});let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),authority:n()},data:kb().decode(e.data)}}var Eb=\"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\",Ib=(e=>(e[e.CreateAssociatedToken=0]=\"CreateAssociatedToken\",e[e.CreateAssociatedTokenIdempotent=1]=\"CreateAssociatedTokenIdempotent\",e[e.RecoverNestedAssociatedToken=2]=\"RecoverNestedAssociatedToken\",e))(Ib||{});function Tb(e){const t=\"data\"in e?e.data:e;if(Vs(t,Oc().encode(0),0))return 0;if(Vs(t,Oc().encode(1),0))return 1;if(Vs(t,Oc().encode(2),0))return 2;throw new Fs(Ms,{instructionData:t,programName:\"associatedToken\"})}var Bb=\"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb\";var Cb,Mb=((Cb=Mb||{})[Cb.InitializeMint=0]=\"InitializeMint\",Cb[Cb.InitializeAccount=1]=\"InitializeAccount\",Cb[Cb.InitializeMultisig=2]=\"InitializeMultisig\",Cb[Cb.Transfer=3]=\"Transfer\",Cb[Cb.Approve=4]=\"Approve\",Cb[Cb.Revoke=5]=\"Revoke\",Cb[Cb.SetAuthority=6]=\"SetAuthority\",Cb[Cb.MintTo=7]=\"MintTo\",Cb[Cb.Burn=8]=\"Burn\",Cb[Cb.CloseAccount=9]=\"CloseAccount\",Cb[Cb.FreezeAccount=10]=\"FreezeAccount\",Cb[Cb.ThawAccount=11]=\"ThawAccount\",Cb[Cb.TransferChecked=12]=\"TransferChecked\",Cb[Cb.ApproveChecked=13]=\"ApproveChecked\",Cb[Cb.MintToChecked=14]=\"MintToChecked\",Cb[Cb.BurnChecked=15]=\"BurnChecked\",Cb[Cb.InitializeAccount2=16]=\"InitializeAccount2\",Cb[Cb.SyncNative=17]=\"SyncNative\",Cb[Cb.InitializeAccount3=18]=\"InitializeAccount3\",Cb[Cb.InitializeMultisig2=19]=\"InitializeMultisig2\",Cb[Cb.InitializeMint2=20]=\"InitializeMint2\",Cb[Cb.GetAccountDataSize=21]=\"GetAccountDataSize\",Cb[Cb.InitializeImmutableOwner=22]=\"InitializeImmutableOwner\",Cb[Cb.AmountToUiAmount=23]=\"AmountToUiAmount\",Cb[Cb.UiAmountToAmount=24]=\"UiAmountToAmount\",Cb[Cb.InitializeMintCloseAuthority=25]=\"InitializeMintCloseAuthority\",Cb[Cb.InitializeTransferFeeConfig=26]=\"InitializeTransferFeeConfig\",Cb[Cb.TransferCheckedWithFee=27]=\"TransferCheckedWithFee\",Cb[Cb.WithdrawWithheldTokensFromMint=28]=\"WithdrawWithheldTokensFromMint\",Cb[Cb.WithdrawWithheldTokensFromAccounts=29]=\"WithdrawWithheldTokensFromAccounts\",Cb[Cb.HarvestWithheldTokensToMint=30]=\"HarvestWithheldTokensToMint\",Cb[Cb.SetTransferFee=31]=\"SetTransferFee\",Cb[Cb.InitializeConfidentialTransferMint=32]=\"InitializeConfidentialTransferMint\",Cb[Cb.UpdateConfidentialTransferMint=33]=\"UpdateConfidentialTransferMint\",Cb[Cb.ConfigureConfidentialTransferAccount=34]=\"ConfigureConfidentialTransferAccount\",Cb[Cb.ApproveConfidentialTransferAccount=35]=\"ApproveConfidentialTransferAccount\",Cb[Cb.EmptyConfidentialTransferAccount=36]=\"EmptyConfidentialTransferAccount\",Cb[Cb.ConfidentialDeposit=37]=\"ConfidentialDeposit\",Cb[Cb.ConfidentialWithdraw=38]=\"ConfidentialWithdraw\",Cb[Cb.ConfidentialTransfer=39]=\"ConfidentialTransfer\",Cb[Cb.ApplyConfidentialPendingBalance=40]=\"ApplyConfidentialPendingBalance\",Cb[Cb.EnableConfidentialCredits=41]=\"EnableConfidentialCredits\",Cb[Cb.DisableConfidentialCredits=42]=\"DisableConfidentialCredits\",Cb[Cb.EnableNonConfidentialCredits=43]=\"EnableNonConfidentialCredits\",Cb[Cb.DisableNonConfidentialCredits=44]=\"DisableNonConfidentialCredits\",Cb[Cb.ConfidentialTransferWithFee=45]=\"ConfidentialTransferWithFee\",Cb[Cb.ConfigureConfidentialTransferAccountWithRegistry=46]=\"ConfigureConfidentialTransferAccountWithRegistry\",Cb[Cb.InitializeDefaultAccountState=47]=\"InitializeDefaultAccountState\",Cb[Cb.UpdateDefaultAccountState=48]=\"UpdateDefaultAccountState\",Cb[Cb.Reallocate=49]=\"Reallocate\",Cb[Cb.EnableMemoTransfers=50]=\"EnableMemoTransfers\",Cb[Cb.DisableMemoTransfers=51]=\"DisableMemoTransfers\",Cb[Cb.CreateNativeMint=52]=\"CreateNativeMint\",Cb[Cb.InitializeNonTransferableMint=53]=\"InitializeNonTransferableMint\",Cb[Cb.InitializeInterestBearingMint=54]=\"InitializeInterestBearingMint\",Cb[Cb.UpdateRateInterestBearingMint=55]=\"UpdateRateInterestBearingMint\",Cb[Cb.EnableCpiGuard=56]=\"EnableCpiGuard\",Cb[Cb.DisableCpiGuard=57]=\"DisableCpiGuard\",Cb[Cb.InitializePermanentDelegate=58]=\"InitializePermanentDelegate\",Cb[Cb.InitializeTransferHook=59]=\"InitializeTransferHook\",Cb[Cb.UpdateTransferHook=60]=\"UpdateTransferHook\",Cb[Cb.InitializeConfidentialTransferFee=61]=\"InitializeConfidentialTransferFee\",Cb[Cb.WithdrawWithheldTokensFromMintForConfidentialTransferFee=62]=\"WithdrawWithheldTokensFromMintForConfidentialTransferFee\",Cb[Cb.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=63]=\"WithdrawWithheldTokensFromAccountsForConfidentialTransferFee\",Cb[Cb.HarvestWithheldTokensToMintForConfidentialTransferFee=64]=\"HarvestWithheldTokensToMintForConfidentialTransferFee\",Cb[Cb.EnableHarvestToMint=65]=\"EnableHarvestToMint\",Cb[Cb.DisableHarvestToMint=66]=\"DisableHarvestToMint\",Cb[Cb.WithdrawExcessLamports=67]=\"WithdrawExcessLamports\",Cb[Cb.InitializeMetadataPointer=68]=\"InitializeMetadataPointer\",Cb[Cb.UpdateMetadataPointer=69]=\"UpdateMetadataPointer\",Cb[Cb.InitializeGroupPointer=70]=\"InitializeGroupPointer\",Cb[Cb.UpdateGroupPointer=71]=\"UpdateGroupPointer\",Cb[Cb.InitializeGroupMemberPointer=72]=\"InitializeGroupMemberPointer\",Cb[Cb.UpdateGroupMemberPointer=73]=\"UpdateGroupMemberPointer\",Cb[Cb.InitializeConfidentialMintBurn=74]=\"InitializeConfidentialMintBurn\",Cb[Cb.RotateSupplyElgamalPubkey=75]=\"RotateSupplyElgamalPubkey\",Cb[Cb.UpdateConfidentialMintBurnDecryptableSupply=76]=\"UpdateConfidentialMintBurnDecryptableSupply\",Cb[Cb.ConfidentialMint=77]=\"ConfidentialMint\",Cb[Cb.ConfidentialBurn=78]=\"ConfidentialBurn\",Cb[Cb.ApplyConfidentialPendingBurn=79]=\"ApplyConfidentialPendingBurn\",Cb[Cb.InitializeScaledUiAmountMint=80]=\"InitializeScaledUiAmountMint\",Cb[Cb.UpdateMultiplierScaledUiMint=81]=\"UpdateMultiplierScaledUiMint\",Cb[Cb.InitializePausableConfig=82]=\"InitializePausableConfig\",Cb[Cb.Pause=83]=\"Pause\",Cb[Cb.Resume=84]=\"Resume\",Cb[Cb.InitializeTokenMetadata=85]=\"InitializeTokenMetadata\",Cb[Cb.UpdateTokenMetadataField=86]=\"UpdateTokenMetadataField\",Cb[Cb.RemoveTokenMetadataKey=87]=\"RemoveTokenMetadataKey\",Cb[Cb.UpdateTokenMetadataUpdateAuthority=88]=\"UpdateTokenMetadataUpdateAuthority\",Cb[Cb.EmitTokenMetadata=89]=\"EmitTokenMetadata\",Cb[Cb.InitializeTokenGroup=90]=\"InitializeTokenGroup\",Cb[Cb.UpdateTokenGroupMaxSize=91]=\"UpdateTokenGroupMaxSize\",Cb[Cb.UpdateTokenGroupUpdateAuthority=92]=\"UpdateTokenGroupUpdateAuthority\",Cb[Cb.InitializeTokenGroupMember=93]=\"InitializeTokenGroupMember\",Cb[Cb.UnwrapLamports=94]=\"UnwrapLamports\",Cb[Cb.InitializePermissionedBurn=95]=\"InitializePermissionedBurn\",Cb[Cb.PermissionedBurn=96]=\"PermissionedBurn\",Cb[Cb.PermissionedBurnChecked=97]=\"PermissionedBurnChecked\",Cb[Cb.PermissionedConfidentialBurn=98]=\"PermissionedConfidentialBurn\",Cb[Cb.Batch=99]=\"Batch\",Cb);function Pb(e){const t=\"data\"in e?e.data:e;if(Vs(t,Oc().encode(0),0))return 0;if(Vs(t,Oc().encode(1),0))return 1;if(Vs(t,Oc().encode(2),0))return 2;if(Vs(t,Oc().encode(3),0))return 3;if(Vs(t,Oc().encode(4),0))return 4;if(Vs(t,Oc().encode(5),0))return 5;if(Vs(t,Oc().encode(6),0))return 6;if(Vs(t,Oc().encode(7),0))return 7;if(Vs(t,Oc().encode(8),0))return 8;if(Vs(t,Oc().encode(9),0))return 9;if(Vs(t,Oc().encode(10),0))return 10;if(Vs(t,Oc().encode(11),0))return 11;if(Vs(t,Oc().encode(12),0))return 12;if(Vs(t,Oc().encode(13),0))return 13;if(Vs(t,Oc().encode(14),0))return 14;if(Vs(t,Oc().encode(15),0))return 15;if(Vs(t,Oc().encode(16),0))return 16;if(Vs(t,Oc().encode(17),0))return 17;if(Vs(t,Oc().encode(18),0))return 18;if(Vs(t,Oc().encode(19),0))return 19;if(Vs(t,Oc().encode(20),0))return 20;if(Vs(t,Oc().encode(21),0))return 21;if(Vs(t,Oc().encode(22),0))return 22;if(Vs(t,Oc().encode(23),0))return 23;if(Vs(t,Oc().encode(24),0))return 24;if(Vs(t,Oc().encode(25),0))return 25;if(Vs(t,Oc().encode(26),0)&&Vs(t,Oc().encode(0),1))return 26;if(Vs(t,Oc().encode(26),0)&&Vs(t,Oc().encode(1),1))return 27;if(Vs(t,Oc().encode(26),0)&&Vs(t,Oc().encode(2),1))return 28;if(Vs(t,Oc().encode(26),0)&&Vs(t,Oc().encode(3),1))return 29;if(Vs(t,Oc().encode(26),0)&&Vs(t,Oc().encode(4),1))return 30;if(Vs(t,Oc().encode(26),0)&&Vs(t,Oc().encode(5),1))return 31;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(0),1))return 32;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(1),1))return 33;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(2),1))return 34;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(3),1))return 35;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(4),1))return 36;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(5),1))return 37;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(6),1))return 38;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(7),1))return 39;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(8),1))return 40;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(9),1))return 41;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(10),1))return 42;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(11),1))return 43;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(12),1))return 44;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(13),1))return 45;if(Vs(t,Oc().encode(27),0)&&Vs(t,Oc().encode(14),1))return 46;if(Vs(t,Oc().encode(28),0)&&Vs(t,Oc().encode(0),1))return 47;if(Vs(t,Oc().encode(28),0)&&Vs(t,Oc().encode(1),1))return 48;if(Vs(t,Oc().encode(29),0))return 49;if(Vs(t,Oc().encode(30),0)&&Vs(t,Oc().encode(0),1))return 50;if(Vs(t,Oc().encode(30),0)&&Vs(t,Oc().encode(1),1))return 51;if(Vs(t,Oc().encode(31),0))return 52;if(Vs(t,Oc().encode(32),0))return 53;if(Vs(t,Oc().encode(33),0)&&Vs(t,Oc().encode(0),1))return 54;if(Vs(t,Oc().encode(33),0)&&Vs(t,Oc().encode(1),1))return 55;if(Vs(t,Oc().encode(34),0)&&Vs(t,Oc().encode(0),1))return 56;if(Vs(t,Oc().encode(34),0)&&Vs(t,Oc().encode(1),1))return 57;if(Vs(t,Oc().encode(35),0))return 58;if(Vs(t,Oc().encode(36),0)&&Vs(t,Oc().encode(0),1))return 59;if(Vs(t,Oc().encode(36),0)&&Vs(t,Oc().encode(1),1))return 60;if(Vs(t,Oc().encode(37),0)&&Vs(t,Oc().encode(0),1))return 61;if(Vs(t,Oc().encode(37),0)&&Vs(t,Oc().encode(1),1))return 62;if(Vs(t,Oc().encode(37),0)&&Vs(t,Oc().encode(2),1))return 63;if(Vs(t,Oc().encode(37),0)&&Vs(t,Oc().encode(3),1))return 64;if(Vs(t,Oc().encode(37),0)&&Vs(t,Oc().encode(4),1))return 65;if(Vs(t,Oc().encode(37),0)&&Vs(t,Oc().encode(5),1))return 66;if(Vs(t,Oc().encode(38),0))return 67;if(Vs(t,Oc().encode(39),0)&&Vs(t,Oc().encode(0),1))return 68;if(Vs(t,Oc().encode(39),0)&&Vs(t,Oc().encode(1),1))return 69;if(Vs(t,Oc().encode(40),0)&&Vs(t,Oc().encode(0),1))return 70;if(Vs(t,Oc().encode(40),0)&&Vs(t,Oc().encode(1),1))return 71;if(Vs(t,Oc().encode(41),0)&&Vs(t,Oc().encode(0),1))return 72;if(Vs(t,Oc().encode(41),0)&&Vs(t,Oc().encode(1),1))return 73;if(Vs(t,Oc().encode(42),0)&&Vs(t,Oc().encode(0),1))return 74;if(Vs(t,Oc().encode(42),0)&&Vs(t,Oc().encode(1),1))return 75;if(Vs(t,Oc().encode(42),0)&&Vs(t,Oc().encode(2),1))return 76;if(Vs(t,Oc().encode(42),0)&&Vs(t,Oc().encode(3),1))return 77;if(Vs(t,Oc().encode(42),0)&&Vs(t,Oc().encode(4),1))return 78;if(Vs(t,Oc().encode(42),0)&&Vs(t,Oc().encode(5),1))return 79;if(Vs(t,Oc().encode(43),0)&&Vs(t,Oc().encode(0),1))return 80;if(Vs(t,Oc().encode(43),0)&&Vs(t,Oc().encode(1),1))return 81;if(Vs(t,Oc().encode(44),0)&&Vs(t,Oc().encode(0),1))return 82;if(Vs(t,Oc().encode(44),0)&&Vs(t,Oc().encode(1),1))return 83;if(Vs(t,Oc().encode(44),0)&&Vs(t,Oc().encode(2),1))return 84;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([210,225,30,162,88,184,77,141])),0))return 85;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([221,233,49,45,181,202,220,200])),0))return 86;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([234,18,32,56,89,141,37,181])),0))return 87;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([215,228,166,228,84,100,86,123])),0))return 88;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([250,166,180,250,13,12,184,70])),0))return 89;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([121,113,108,39,54,51,0,4])),0))return 90;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([108,37,171,143,248,30,18,110])),0))return 91;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([161,105,88,1,237,221,216,203])),0))return 92;if(Vs(t,sc(Hc(),8).encode(new Uint8Array([152,32,222,176,223,237,116,134])),0))return 93;if(Vs(t,Oc().encode(45),0))return 94;if(Vs(t,Oc().encode(46),0)&&Vs(t,Oc().encode(0),1))return 95;if(Vs(t,Oc().encode(46),0)&&Vs(t,Oc().encode(1),1))return 96;if(Vs(t,Oc().encode(46),0)&&Vs(t,Oc().encode(2),1))return 97;if(Vs(t,Oc().encode(46),0)&&Vs(t,Oc().encode(3),1))return 98;if(Vs(t,Oc().encode(255),0))return 99;throw new Fs(Ms,{instructionData:t,programName:\"token2022\"})}function _b(){return mu([[\"discriminator\",Uc()],[\"amount\",Rc()]])}function Rb(e){if(e.accounts.length<1)throw new Fs(Cs,{actualAccountMetas:e.accounts.length,expectedAccountMetas:1});let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:_b().decode(e.data)}}Object.freeze({data:void 0,error:void 0,status:\"idle\"});async function Ob(e,t,n){if(0===e.length)return{};const r=await async function(e,t,n={}){const{abortSignal:r,...i}=n;return(await e.getMultipleAccounts(t,{...i,encoding:\"jsonParsed\"}).send({abortSignal:r})).value.map((e,n)=>e&&\"object\"==typeof e&&\"parsed\"in e.data?Uy(t[n],e):Oy(t[n],e))}(t,e,n);return function(e){const t=e.filter(e=>Ry(e)&&e.data instanceof Uint8Array);if(t.length>0){const e=t.map(e=>e.address);throw new Fs(fa,{addresses:e})}}(r),function(e){const t=e.filter(e=>!e.exists);if(t.length>0){const e=t.map(e=>e.address);throw new Fs(la,{addresses:e})}}(r),r.reduce((e,t)=>({...e,[t.address]:t.data.addresses}),{})}async function Ub(e,t,n){const r=(\"addressTableLookups\"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?e.addressTableLookups:[]).map(e=>e.lookupTableAddress),{lastValidBlockHeight:i,...o}=n??{};return Yd(e,{addressesByLookupTableAddress:r.length>0?await Ob(r,t,o):{},lastValidBlockHeight:i})}var Nb=14e5;function zb(e,t){return!t?.preflightCommitment&&((n=e)===(r=\"finalized\")?0:wl(n)<wl(r)?-1:1)<0?{...t,preflightCommitment:e}:t;var n,r}async function Fb({abortSignal:e,commitment:t,rpc:n,transaction:r,...i}){const o=pf(r);return await n.sendTransaction(o,{...zb(t,i),encoding:\"base64\"}).send({abortSignal:e})}const Lb=async e=>new Promise((t,n)=>{if(0===e.length)return void n(new AggregateError([],\"No promises to resolve\"));let r=0;const i=[];e.forEach((o,a)=>{Promise.resolve(o).then(e=>t(e),t=>{i[a]=t,r+=1,r===e.length&&n(new AggregateError(i,\"All promises rejected\"))})})}),Db=async(e,t,n)=>bl(e,Cu().encode,fd().decode,async e=>Ub(e,t,n)),jb=async(e,t,n)=>bl(e,fd().decode,async e=>Ub(e,t,n)),$b=e=>bl(e,nf().encode,Mu().decode),Kb=async e=>bl(e,Cu().encode,of().decode),qb=async e=>{const t=Cu().encode(e),n=fd().decode(t),r=n.staticAccounts.slice(0,n.header.numSignerAccounts).map(e=>[e,null]);return{messageBytes:t,signatures:Object.fromEntries(r)}},Hb=async(e,t,n)=>Lb([Kb(e),Db(e,t,n)]),Wb=qu(\"KeccakSecp256k11111111111111111111111111111\"),Vb=qu(\"Secp256r1SigVerify1111111111111111111111111\"),Gb={Verify:0},Zb=e=>Gb.Verify,Jb=e=>e.programAddress===Wb,Yb=e=>e.programAddress===Vb,Xb=()=>{return e=[[\"numSignatures\",tc(Oc(),Uc())]],tc(gu(e),mu(e));var e},Qb=e=>({programAddress:e.programAddress,data:Xb().decode(e.data??new Uint8Array)});const eS={[fh]:{identifier:ph,instructionEnum:hh,typeToParserMap:{[hh.Assign]:qf,[hh.TransferSol]:ih,[hh.CreateAccount]:Jf,[hh.CreateAccountWithSeed]:Xf,[hh.AdvanceNonceAccount]:Ff,[hh.WithdrawNonceAccount]:lh,[hh.InitializeNonceAccount]:eh,[hh.AuthorizeNonceAccount]:Gf,[hh.Allocate]:Df,[hh.AllocateWithSeed]:$f,[hh.AssignWithSeed]:Wf,[hh.TransferSolWithSeed]:ah,[hh.UpgradeNonceAccount]:ch}},[qg]:{identifier:Wg,instructionEnum:Hg,typeToParserMap:{[Hg.RequestUnits]:Jg,[Hg.RequestHeapFrame]:Gg,[Hg.SetComputeUnitPrice]:am,[Hg.SetComputeUnitLimit]:tm,[Hg.SetLoadedAccountsDataSizeLimit]:cm}},[Cy]:{identifier:_y,instructionEnum:Py,typeToParserMap:{[Py.InitializeMint]:ty,[Py.InitializeAccount]:Vm,[Py.InitializeMultisig]:oy,[Py.Transfer]:by,[Py.Approve]:Bm,[Py.Revoke]:hy,[Py.SetAuthority]:gy,[Py.MintTo]:uy,[Py.Burn]:_m,[Py.CloseAccount]:Nm,[Py.FreezeAccount]:Km,[Py.ThawAccount]:vy,[Py.TransferChecked]:Ey,[Py.ApproveChecked]:Mm,[Py.MintToChecked]:dy,[Py.BurnChecked]:Om,[Py.InitializeAccount2]:Zm,[Py.SyncNative]:yy,[Py.InitializeAccount3]:Ym,[Py.InitializeMultisig2]:sy,[Py.InitializeMint2]:ry,[Py.GetAccountDataSize]:Hm,[Py.InitializeImmutableOwner]:Qm,[Py.AmountToUiAmount]:xm,[Py.UiAmountToAmount]:Ty}},[Bb]:{identifier:Pb,instructionEnum:Mb,typeToParserMap:{[Mb.InitializeMint]:Dv,[Mb.InitializeAccount]:wv,[Mb.InitializeMultisig]:Wv,[Mb.Transfer]:NA,[Mb.Approve]:cw,[Mb.Revoke]:IA,[Mb.SetAuthority]:BA,[Mb.MintTo]:fA,[Mb.Burn]:pw,[Mb.CloseAccount]:ww,[Mb.FreezeAccount]:lv,[Mb.ThawAccount]:OA,[Mb.TransferChecked]:DA,[Mb.ApproveChecked]:lw,[Mb.MintToChecked]:pA,[Mb.BurnChecked]:mw,[Mb.InitializeAccount2]:Av,[Mb.SyncNative]:_A,[Mb.InitializeAccount3]:Sv,[Mb.InitializeMultisig2]:Wv,[Mb.InitializeMint2]:$v,[Mb.GetAccountDataSize]:fv,[Mb.InitializeImmutableOwner]:Ov,[Mb.AmountToUiAmount]:Rb,[Mb.UiAmountToAmount]:qA,[Mb.InitializeMintCloseAuthority]:qv,[Mb.InitializeTransferFeeConfig]:cA,[Mb.TransferCheckedWithFee]:$A,[Mb.WithdrawWithheldTokensFromMint]:Sb,[Mb.WithdrawWithheldTokensFromAccounts]:wb,[Mb.HarvestWithheldTokensToMint]:pv,[Mb.SetTransferFee]:MA,[Mb.InitializeConfidentialTransferMint]:Iv,[Mb.UpdateConfidentialTransferMint]:WA,[Mb.ConfigureConfidentialTransferAccount]:Bw,[Mb.ApproveConfidentialTransferAccount]:fw,[Mb.EmptyConfidentialTransferAccount]:Xw,[Mb.ConfidentialDeposit]:Aw,[Mb.ConfidentialWithdraw]:Iw,[Mb.ConfidentialTransfer]:Sw,[Mb.ApplyConfidentialPendingBalance]:iw,[Mb.EnableConfidentialCredits]:ev,[Mb.DisableConfidentialCredits]:Dw,[Mb.EnableNonConfidentialCredits]:cv,[Mb.DisableNonConfidentialCredits]:Gw,[Mb.ConfidentialTransferWithFee]:xw,[Mb.InitializeDefaultAccountState]:Bv,[Mb.UpdateDefaultAccountState]:GA,[Mb.Reallocate]:wA,[Mb.EnableMemoTransfers]:av,[Mb.DisableMemoTransfers]:Ww,[Mb.CreateNativeMint]:Fw,[Mb.InitializeNonTransferableMint]:Gv,[Mb.InitializeInterestBearingMint]:Nv,[Mb.UpdateRateInterestBearingMint]:ib,[Mb.EnableCpiGuard]:nv,[Mb.DisableCpiGuard]:$w,[Mb.InitializePermanentDelegate]:Xv,[Mb.InitializeTransferHook]:lA,[Mb.UpdateTransferHook]:pb,[Mb.InitializeConfidentialTransferFee]:xv,[Mb.WithdrawWithheldTokensFromMintForConfidentialTransferFee]:xb,[Mb.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee]:Ab,[Mb.HarvestWithheldTokensToMintForConfidentialTransferFee]:mv,[Mb.EnableHarvestToMint]:iv,[Mb.DisableHarvestToMint]:qw,[Mb.WithdrawExcessLamports]:mb,[Mb.InitializeMetadataPointer]:Fv,[Mb.UpdateMetadataPointer]:eb,[Mb.InitializeGroupPointer]:_v,[Mb.UpdateGroupPointer]:XA,[Mb.InitializeGroupMemberPointer]:Mv,[Mb.UpdateGroupMemberPointer]:JA,[Mb.InitializeScaledUiAmountMint]:eA,[Mb.UpdateMultiplierScaledUiMint]:nb,[Mb.InitializePausableConfig]:Jv,[Mb.Pause]:mA,[Mb.Resume]:xA,[Mb.InitializeTokenMetadata]:aA,[Mb.UpdateTokenMetadataField]:lb,[Mb.RemoveTokenMetadataKey]:SA,[Mb.UpdateTokenMetadataUpdateAuthority]:fb,[Mb.EmitTokenMetadata]:Jw,[Mb.InitializeTokenGroup]:nA,[Mb.UpdateTokenGroupMaxSize]:ab,[Mb.UpdateTokenGroupUpdateAuthority]:cb,[Mb.InitializeTokenGroupMember]:iA}},[By]:{identifier:Tb,instructionEnum:Ib,typeToParserMap:{[Ib.CreateAssociatedToken]:_w,[Ib.CreateAssociatedTokenIdempotent]:Nw,[Ib.RecoverNestedAssociatedToken]:AA}},[Wb]:{identifier:Zb,instructionEnum:Gb,typeToParserMap:{[Gb.Verify]:Qb}},[Vb]:{identifier:Zb,instructionEnum:Gb,typeToParserMap:{[Gb.Verify]:Qb}}},tS=e=>{const{programAddress:t}=e,n={...e,dataBase58:Tu().decode(e.data??new Uint8Array)};try{const r=eS[t];if(!r)throw new Error(\"Unsupported program address\");const{identifier:i,typeToParserMap:o,instructionEnum:a}=r,s=i(e),c=a[s],u=o[s];if(!u)throw new Error(\"Unsupported instruction type\");return{type:c,encoded:n,parsed:u(e)}}catch(e){return Th(e),{type:\"Unknown\",encoded:n,parsed:null}}},nS=(e,t)=>{const n=e.accounts.filter(e=>e<t.transaction.message.accountKeys.length).map(e=>({address:t.transaction.message.accountKeys[e],role:0})),r=t.transaction.message.accountKeys[e.programIdIndex];if(!r)throw new Error(\"Program address not found\");return{accounts:n,data:Tu().encode(e.data),programAddress:r}},rS={accountSubscribe:\"accountUnsubscribe\",programSubscribe:\"programUnsubscribe\",signatureSubscribe:\"signatureUnsubscribe\"},iS=z([\"processed\",\"confirmed\",\"finalized\"]);const oS=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:zd(e,t),aS=e=>e.programAddress===qg&&Wg({data:new Uint8Array,...e})===Hg.SetComputeUnitPrice,sS=e=>e.instructions.filter(Boolean).some(aS),cS=e=>e.programAddress===qg&&Wg({data:new Uint8Array,...e})===Hg.SetComputeUnitLimit,uS=e=>e.instructions.filter(Boolean).some(cS),lS=async(e,t,n)=>{try{const r=e.instructions.filter(Boolean),i=function({rpc:e}){return async function(t,n){const{abortSignal:r,...i}=n??{},o=!Wd(t),a=1===t.version,s=pf(bl(t,e=>Ud(Nb,e),e=>a?Qd(67108864,e):e,lf));try{const t=await e.simulateTransaction(s,{...i,encoding:\"base64\",replaceRecentBlockhash:o,sigVerify:!1}).send({abortSignal:r}),{err:n,...c}=t.value;if(null==c.unitsConsumed)throw new Fs(za);if(a&&null==c.loadedAccountsDataSize)throw new Fs(Qa);if(n)throw new Fs(es,{...c,cause:qs(n)});const u=c.unitsConsumed>4294967295n?4294967295:Number(c.unitsConsumed);return a?{computeUnitLimit:u,loadedAccountsDataSizeLimit:c.loadedAccountsDataSize}:null==c.loadedAccountsDataSize?{computeUnitLimit:u}:{computeUnitLimit:u,loadedAccountsDataSizeLimit:c.loadedAccountsDataSize}}catch(e){if(zs(e,es)||zs(e,Qa))throw e;throw new Fs(za,{cause:e})}}}({rpc:t}),o=await i(e,n?.getComputeUnitEstimateConfig).catch(e=>{if((zs(e,Fa)||zs(e,es))&&null!==e.context.unitsConsumed)return{computeUnitLimit:Number(e.context.unitsConsumed)};throw e});return{...(0,Br.cloneDeep)(e),instructions:[...r.filter(e=>!cS(e)),em({units:o.computeUnitLimit},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}};class dS extends Error{constructor(e){super(e),this.name=\"FeeCalculatorError\"}}class fS extends dS{constructor(e){super(e),this.name=\"FeeCalculatorUnsupportedInputTypeError\"}}const hS=e=>{if(!(e=>\"legacy\"===e.version||0===e.version)(e))throw new Error(\"Version 1 transaction messages are not supported\");return{ed25519Signatures:[\"signature\"],instructions:e.instructions.map(t=>{const n=e.staticAccounts[t.programAddressIndex];if(void 0===n)throw new Error(\"Transaction message contains an instruction with an invalid program address index.\");return{accounts:[],data:t.data??new Uint8Array,programAddress:n}})}},pS=e=>({...bl(e.messageBytes,fd().decode,hS),ed25519Signatures:Object.values(e.signatures)}),gS=e=>bl(e,Cu().encode,of().decode,pS),mS=e=>bl(e,Cu().encode,fd().decode,hS);class yS{static calculateFee(e){const t=this.#I(e),{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:i,totalSignaturesCount:o}=this.#T(t),a=this.#B(o),s=this.#C(t),c=this.#M(t),u=this.#P(s,c);return{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:i,totalSignaturesCount:o,baseFee:a,computeUnitLimit:s,computeUnitPriceMicroLamportsPerComputeUnit:c,priorityFee:u,totalFee:Al(a+u)}}static#B(e){return Al(5000n*BigInt(e))}static#C(e){const{instructions:t}=e,n=t.find(cS);return n?tm(n).data.units:0}static#M(e){const{instructions:t}=e,n=t.find(aS);return n?am(n).data.microLamports:0n}static#P(e,t){return bl(e,e=>br(e),e=>e.multipliedBy(t.toString()),e=>e.dividedToIntegerBy(lo.toString()),e=>e.toString(),BigInt,Al)}static#T(e){const{ed25519Signatures:t,instructions:n}=e,r=t.length,i=n.filter(Jb).map(tS).reduce((e,t)=>e+(t.parsed?.data.numSignatures??0),0),o=n.filter(Yb).map(tS).reduce((e,t)=>e+(t.parsed?.data.numSignatures??0),0);return{ed25519SignaturesCount:r,secp256k1SignaturesCount:i,secp256r1SignaturesCount:o,totalSignaturesCount:r+i+o}}static#I(e){if(this.#_(e))return gS(e);if(this.#R(e))return mS(e);if(this.#O(e))return hS(e);if(this.#U(e))return pS(e);if(this.#N(e))return(e=>({ed25519Signatures:e.transaction.signatures,instructions:e.transaction.message.instructions.map(t=>nS(t,e))}))(e);throw new fS(\"The fee calculator could not recognize the input type. It supports SolanaTransactions, kit Transactions, and base64 strings.\")}static#_(e){try{return\"string\"==typeof e&&(gS(e),!0)}catch(e){return!1}}static#R(e){try{return\"string\"==typeof e&&(mS(e),!0)}catch(e){return!1}}static#O(e){return\"object\"==typeof e&&\"instructions\"in e&&\"staticAccounts\"in e}static#N(e){return\"object\"==typeof e&&\"transaction\"in e&&\"object\"==typeof e.transaction&&\"message\"in e.transaction&&\"object\"==typeof e.transaction.message&&\"accountKeys\"in e.transaction.message&&\"object\"==typeof e.transaction.message.accountKeys&&\"instructions\"in e.transaction.message&&\"object\"==typeof e.transaction.message.instructions&&\"signatures\"in e.transaction&&\"object\"==typeof e.transaction.signatures}static#U(e){return\"object\"==typeof e&&\"messageBytes\"in e&&\"object\"==typeof e.messageBytes&&\"signatures\"in e}}const wS=e=>br(e.toString()).dividedBy(fo),vS=e=>br(e.toString()).multipliedBy(fo).integerValue(br.ROUND_DOWN),AS=(e,t)=>br(e.toString()).multipliedBy(br(10).pow(t)).integerValue(br.ROUND_DOWN).toFixed(0),bS=\"signAndSendTransactionWithoutConfirmation\",SS=\"confirmSend\",kS=\"signAndSendTransaction\",xS=\"computeFee\",ES=\"onAddressInput\",IS=\"onAmountInput\",TS=\"signRewardsMessage\",BS=\"signCardMessage\",CS=\"approveCardAmount\",MS=\"signProofOfOwnership\",PS=\"signProofOfOwnershipBatch\",_S=ne(V(),/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),RS=\"metamask:proof-of-ownership:\",OS=(K({nonce:te(V()),address:te(V())}),K({accountId:_S,message:V()})),US=K({items:U(OS)}),NS=K({accountId:_S,signature:V()}),zS=K({accountId:_S,error:te(V())});K({results:U(Z([NS,zS]))});function FS(e){return k(JSON.stringify(e),L(e).validator)}const LS={Required:\"Required\",Invalid:\"Invalid\",InsufficientBalanceToCoverFee:\"InsufficientBalanceToCoverFee\",InsufficientBalance:\"InsufficientBalance\"},DS=x(\"SolAddress\",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var jS;!function(e){e.SendAndConfirmTransaction=\"sendAndConfirmTransaction\",e.SignAndSendTransaction=\"signAndSendTransaction\",e.SignTransaction=\"signTransaction\",e.SignMessage=\"signMessage\",e.SignIn=\"signIn\"}(jS||(jS={}));K({...rt.schema,address:DS,type:L(`${Ye.DataAccount}`),scopes:te(U(Ke)),methods:U(z(Object.values(jS)))});function $S(e,t=1e3){if(!e||\"string\"!=typeof e)return\"\";let n=Xi(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function KS(e){if(!e||\"string\"!=typeof e)return\"\";const t=Xi(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?\"\":t:\"\"}const qS=ne(V(),/^(?!0\\d)(\\d+(\\.\\d+)?)$/u),HS=K({accountId:_S}),WS=K({accountId:_S}),VS=K({accountId:_S}),GS=K({accountId:_S,assets:U(He)}),ZS=K({accountId:_S,pagination:K({limit:F(),next:q(j(V()))})}),JS=K({accountId:_S,options:q(Ct)}),YS=W(He,K({amount:qS,unit:V()})),XS=(U(He),z(Object.values(jS)),z(Object.values(ho))),QS=(z([\"btc\",\"eth\",\"ltc\",\"bch\",\"bnb\",\"eos\",\"xrp\",\"xlm\",\"link\",\"dot\",\"yfi\",\"usd\",\"aed\",\"ars\",\"aud\",\"bdt\",\"bhd\",\"bmd\",\"brl\",\"cad\",\"chf\",\"clp\",\"cny\",\"czk\",\"dkk\",\"eur\",\"gbp\",\"gel\",\"hkd\",\"huf\",\"idr\",\"ils\",\"inr\",\"jpy\",\"krw\",\"kwd\",\"lkr\",\"mmk\",\"mxn\",\"myr\",\"ngn\",\"nok\",\"nzd\",\"php\",\"pkr\",\"pln\",\"rub\",\"sar\",\"sek\",\"sgd\",\"thb\",\"try\",\"twd\",\"uah\",\"vef\",\"vnd\",\"zar\",\"xdr\",\"xag\",\"xau\",\"bits\",\"sats\"]),k(\"Base58\",e=>\"string\"!=typeof e?\"Expected a string, but received: \"+typeof e:!!/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(e)||\"Expected a Base58 encoded string, but received a string with invalid characters\")),ek=ne(V(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),tk=ne(V(),/^m\\/44'\\/501'/u),nk=(ne(V(),/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z$/u),k(\"SolanaAddress\",e=>{if(\"string\"!=typeof e)return\"Expected a string, but received: \"+typeof e;try{return qu(e),!0}catch(e){return\"Invalid Solana address\"}})),rk=z(Object.values(ho)),ik=G({address:Y(V(),V(),e=>{if(!e||\"\"===e)throw new Error(\"Account address is required\");const t=KS(e);if(\"\"===t)throw new Error(\"Invalid Solana address format\");return t})}),ok=L(\"ed25519\"),ak=Y(V(),V(),e=>{const t=function(e){if(!e||\"string\"!=typeof e)return\"\";let t=Xi(e);const n=t.match(/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+)/u);return n?.[1]&&(t=n[1]),/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+$/u.test(t)?t.length>253?\"\":t.toLowerCase():\"\"}(e);if(\"\"===t)throw new Error(\"Invalid domain format\");return t}),sk=Y(V(),V(),e=>{const t=KS(e);if(\"\"===t)throw new Error(\"Invalid Solana address format\");return t}),ck=Y(V(),V(),e=>{const t=$S(e,1e3);if(\"\"===t)throw new Error(\"Statement cannot be empty. Control characters and excessive whitespace are removed for security. Please use plain text only.\");return t}),uk=Y(V(),V(),e=>Qi(e)),lk=Y(V(),V(),e=>$S(e,10)),dk=Y(V(),V(),e=>$S(e,50)),fk=Y(V(),V(),e=>$S(e,100)),hk=Y(V(),V(),e=>function(e){if(!e||\"string\"!=typeof e)return\"\";const t=Xi(e);if(!/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?$/u.test(t))return\"\";const n=new Date(t);return isNaN(n.getTime())?\"\":t}(e)),pk=Y(V(),V(),e=>$S(e,100)),gk=Y(U(V()),U(V()),e=>{var t;return t=e,Array.isArray(t)?t.filter(e=>\"string\"==typeof e).map(e=>Qi(e)).filter(e=>\"\"!==e):[]}),mk=G({domain:q(ak),address:q(sk),statement:q(ck),uri:q(uk),version:q(lk),chainId:q(dk),nonce:q(fk),issuedAt:q(hk),expirationTime:q(hk),notBefore:q(hk),requestId:q(pk),resources:q(gk)}),yk=G({account:ik,message:ek}),wk=z([\"processed\",\"confirmed\",\"finalized\"]),vk=G({preflightCommitment:q(wk),minContextSlot:q($())}),Ak=G({account:ik,transaction:ek,scope:rk,options:q(vk)}),bk=G({...vk.schema,commitment:q(wk),skipPreflight:q(N()),maxRetries:q($()),sourceAssetId:q(He),destAssetId:q(He)}),Sk=G({...Ak.schema,scope:rk,options:q(bk)}),kk=K({method:z([jS.SignAndSendTransaction]),params:Sk}),xk=K({method:z([jS.SignIn]),params:mk}),Ek=K({method:z([jS.SignMessage]),params:yk}),Ik=K({method:z([jS.SignTransaction]),params:Ak}),Tk=K({signature:QS}),Bk=K({signedTransaction:ek}),Ck=K({signature:QS,signedMessage:ek,signatureType:ok}),Mk=K({account:ik,...Ck.schema}),Pk=Z([kk,xk,Ek,Ik]),_k=K({jsonrpc:ge,id:me,method:FS(bS),params:Sk}),Rk=K({transaction:ek,accountId:_S,scope:rk,options:q(bk)}),Ok=K({jsonrpc:ge,id:me,method:FS(kS),params:Rk}),Uk=K({transactionId:QS}),Nk=K({fromAccountId:_S,toAddress:nk,amount:qS,assetId:He}),zk=K({jsonrpc:ge,id:me,method:FS(SS),params:Nk}),Fk=K({value:V(),scope:X(rk,ho.Mainnet)}),Lk=K({jsonrpc:ge,id:me,method:FS(ES),params:Fk}),Dk=K({value:qS,accountId:_S,assetId:He}),jk=K({jsonrpc:ge,id:me,method:FS(IS),params:Dk});function $k(e){const t=bl(e,Pu().encode,Fu().decode);if(!t.startsWith(\"rewards,\"))throw new Error('Message must start with \"rewards,\"');const n=t.split(\",\");if(3!==n.length)throw new Error(\"Message must have exactly 3 parts: rewards,{address},{timestamp}\");const[r,i,o]=n;if(\"rewards\"!==r)throw new Error('Message must start with \"rewards\"');if(!b(i,nk))throw new Error(\"Invalid Solana address\");if(!b(o,qS))throw new Error(\"Invalid timestamp format\");if(o.includes(\".\"))throw new Error(\"Invalid timestamp\");const a=parseInt(o,10);if(a<=0)throw new Error(\"Invalid timestamp\");return{address:i,timestamp:a}}const Kk=re(ek,\"RewardsMessage\",e=>{try{return $k(e),!0}catch(e){return e instanceof Error?e.message:\"Invalid rewards message\"}}),qk=K({accountId:_S,message:Kk}),Hk=K({jsonrpc:ge,id:me,method:FS(TS),params:qk});function Wk(e){const t=bl(e,Pu().encode,Fu().decode),n=t.replaceAll(/\\s+/gu,\" \").trim(),r=/^(\\S+) wants you to sign in with your Solana account: (\\S{32,44}) (.+?) URI: (\\S+) Version: (\\d+) Chain ID: (\\d+) Nonce: (\\w+) Issued At: (\\S+)(?: Expiration Time: (\\S+))?$/u.exec(n);if(!r)throw new Error('Invalid card message format. Expected format: \"{domain} wants you to sign in with your Solana account: {address} {statement} URI: {uri} Version: {version} Chain ID: {chainId} Nonce: {nonce} Issued At: {issuedAt} [Expiration Time: {expirationTime}]\"');const[,i,o,,a,s,c,u,l,d]=r,f=t.indexOf(o),h=t.indexOf(\"URI:\"),p=t.slice(f+o.length,h).trim();if(!i||\"\"===i.trim())throw new Error(\"Invalid domain in card message\");if(!b(o,nk))throw new Error(\"Invalid Solana address in card message\");try{if(!new URL(a).protocol)throw new Error(\"Invalid URI\")}catch{throw new Error(\"Invalid URI in card message\")}const g=new Date(l);if(isNaN(g.getTime()))throw new Error(\"Invalid Issued At date in card message\");if(void 0!==d){const e=new Date(d);if(isNaN(e.getTime()))throw new Error(\"Invalid Expiration Time date in card message\")}return{domain:i,address:o,statement:p,uri:a,version:s,chainId:c,nonce:u,issuedAt:l,...void 0!==d&&{expirationTime:d}}}const Vk=re(ek,\"CardMessage\",e=>{try{return Wk(e),!0}catch(e){return e instanceof Error?e.message:\"Invalid card message\"}}),Gk=K({accountId:_S,message:Vk}),Zk=K({jsonrpc:ge,id:me,method:FS(BS),params:Gk}),Jk=K({accountId:_S,amount:qS,mint:nk,delegate:nk,scope:rk}),Yk=K({jsonrpc:ge,id:me,method:FS(CS),params:Jk}),Xk=K({signature:QS}),Qk=K({valid:N(),errors:U(K({code:z(Object.values(LS))}))}),ex=K({transaction:ek,accountId:_S,scope:rk}),tx=K({jsonrpc:ge,id:me,method:FS(xS),params:ex}),nx=U(K({type:z(Object.values($h)),asset:Dh}));function rx(e){const t=function(e){if(!e.startsWith(RS))throw new Error(`Message must start with \"${RS}\"`);const t=e.slice(28),n=t.lastIndexOf(\":\");if(-1===n)throw new Error('Message must follow the format \"metamask:proof-of-ownership:{nonce}:{address}\"');const r=t.slice(0,n),i=t.slice(n+1);if(0===r.length)throw new Error(\"Message must include a non-empty nonce\");if(0===i.length)throw new Error(\"Message must include a non-empty address\");return{nonce:r,address:i}}(e),{address:n}=t;if(!b(n,nk))throw new Error(\"Invalid Solana address in proof-of-ownership message\");return t}const ix=re(V(),\"ProofOfOwnershipMessage\",e=>{try{return rx(e),!0}catch(e){return e instanceof Error?e.message:\"Invalid proof-of-ownership message\"}}),ox=K({accountId:_S,message:ix}),ax=K({jsonrpc:ge,id:me,method:FS(MS),params:ox}),sx=K({signature:bg}),cx=K({jsonrpc:ge,id:me,method:FS(PS),params:US}),ux=K({accountId:V(),signature:bg}),lx=K({results:U(Z([ux,zS]))});const dx=32,fx=4294967295,hx=\"bip32:44'\",px=/^\\d+$/u,gx=/^bip32:\\d+'?$/u,mx=/^slip10:\\d+'?$/u,yx=/^cip3:\\d+'?$/u,wx=/^bip39:([a-z]+){1}( [a-z]+){11,23}$/u,vx=2147483648;function Ax(e,t,n){return e&t^~e&n}function bx(e,t,n){return e&t^e&n^t&n}class Sx extends Jp{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Tp(this.buffer)}update(e){xp(this),Sp(e=Vp(e));const{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a===r){const t=Tp(e);for(;r<=i-o;o+=r)this.process(t,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){xp(this),Ep(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,Ip(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;!function(e,t,n,r){if(\"function\"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),a=Number(n>>i&o),s=Number(n&o),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,s,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const a=Tp(e),s=this.outputLen;if(s%4)throw new Error(\"_sha2: outputLen should be aligned to 32bit\");const c=s/4,u=this.get();if(c>u.length)throw new Error(\"_sha2: outputLen bigger than state\");for(let e=0;e<c;e++)a.setUint32(4*e,u[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=a,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}}const kx=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),xx=(Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]));const Ex=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ix=new Uint32Array(64);class Tx extends Sx{constructor(e=32){super(64,e,8,!1),this.A=0|kx[0],this.B=0|kx[1],this.C=0|kx[2],this.D=0|kx[3],this.E=0|kx[4],this.F=0|kx[5],this.G=0|kx[6],this.H=0|kx[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:a,H:s}=this;return[e,t,n,r,i,o,a,s]}set(e,t,n,r,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let n=0;n<16;n++,t+=4)Ix[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Ix[e-15],n=Ix[e-2],r=Bp(t,7)^Bp(t,18)^t>>>3,i=Bp(n,17)^Bp(n,19)^n>>>10;Ix[e]=i+Ix[e-7]+r+Ix[e-16]|0}let{A:n,B:r,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(Bp(a,6)^Bp(a,11)^Bp(a,25))+Ax(a,s,c)+Ex[e]+Ix[e]|0,l=(Bp(n,2)^Bp(n,13)^Bp(n,22))+bx(n,r,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=r,r=n,n=t+l|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,i,o,a,s,c,u)}roundClean(){Ip(Ix)}destroy(){this.set(0,0,0,0,0,0,0,0),Ip(this.buffer)}}const Bx=tp([\"0x428a2f98d728ae22\",\"0x7137449123ef65cd\",\"0xb5c0fbcfec4d3b2f\",\"0xe9b5dba58189dbbc\",\"0x3956c25bf348b538\",\"0x59f111f1b605d019\",\"0x923f82a4af194f9b\",\"0xab1c5ed5da6d8118\",\"0xd807aa98a3030242\",\"0x12835b0145706fbe\",\"0x243185be4ee4b28c\",\"0x550c7dc3d5ffb4e2\",\"0x72be5d74f27b896f\",\"0x80deb1fe3b1696b1\",\"0x9bdc06a725c71235\",\"0xc19bf174cf692694\",\"0xe49b69c19ef14ad2\",\"0xefbe4786384f25e3\",\"0x0fc19dc68b8cd5b5\",\"0x240ca1cc77ac9c65\",\"0x2de92c6f592b0275\",\"0x4a7484aa6ea6e483\",\"0x5cb0a9dcbd41fbd4\",\"0x76f988da831153b5\",\"0x983e5152ee66dfab\",\"0xa831c66d2db43210\",\"0xb00327c898fb213f\",\"0xbf597fc7beef0ee4\",\"0xc6e00bf33da88fc2\",\"0xd5a79147930aa725\",\"0x06ca6351e003826f\",\"0x142929670a0e6e70\",\"0x27b70a8546d22ffc\",\"0x2e1b21385c26c926\",\"0x4d2c6dfc5ac42aed\",\"0x53380d139d95b3df\",\"0x650a73548baf63de\",\"0x766a0abb3c77b2a8\",\"0x81c2c92e47edaee6\",\"0x92722c851482353b\",\"0xa2bfe8a14cf10364\",\"0xa81a664bbc423001\",\"0xc24b8b70d0f89791\",\"0xc76c51a30654be30\",\"0xd192e819d6ef5218\",\"0xd69906245565a910\",\"0xf40e35855771202a\",\"0x106aa07032bbd1b8\",\"0x19a4c116b8d2d0c8\",\"0x1e376c085141ab53\",\"0x2748774cdf8eeb99\",\"0x34b0bcb5e19b48a8\",\"0x391c0cb3c5c95a63\",\"0x4ed8aa4ae3418acb\",\"0x5b9cca4f7763e373\",\"0x682e6ff3d6b2b8a3\",\"0x748f82ee5defb2fc\",\"0x78a5636f43172f60\",\"0x84c87814a1f0ab72\",\"0x8cc702081a6439ec\",\"0x90befffa23631e28\",\"0xa4506cebde82bde9\",\"0xbef9a3f7b2c67915\",\"0xc67178f2e372532b\",\"0xca273eceea26619c\",\"0xd186b8c721c0c207\",\"0xeada7dd6cde0eb1e\",\"0xf57d4f7fee6ed178\",\"0x06f067aa72176fba\",\"0x0a637dc5a2c898a6\",\"0x113f9804bef90dae\",\"0x1b710b35131c471b\",\"0x28db77f523047d84\",\"0x32caab7b40c72493\",\"0x3c9ebe0a15c9bebc\",\"0x431d67c49c100d4c\",\"0x4cc5d4becb3e42b6\",\"0x597f299cfc657e2a\",\"0x5fcb6fab3ad6faec\",\"0x6c44198c4a475817\"].map(e=>BigInt(e))),Cx=Bx[0],Mx=Bx[1],Px=new Uint32Array(80),_x=new Uint32Array(80);class Rx extends Sx{constructor(e=64){super(128,e,16,!1),this.Ah=0|xx[0],this.Al=0|xx[1],this.Bh=0|xx[2],this.Bl=0|xx[3],this.Ch=0|xx[4],this.Cl=0|xx[5],this.Dh=0|xx[6],this.Dl=0|xx[7],this.Eh=0|xx[8],this.El=0|xx[9],this.Fh=0|xx[10],this.Fl=0|xx[11],this.Gh=0|xx[12],this.Gl=0|xx[13],this.Hh=0|xx[14],this.Hl=0|xx[15]}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:c,El:u,Fh:l,Fl:d,Gh:f,Gl:h,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,g]}set(e,t,n,r,i,o,a,s,c,u,l,d,f,h,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let n=0;n<16;n++,t+=4)Px[n]=e.getUint32(t),_x[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Px[e-15],n=0|_x[e-15],r=ip(t,n,1)^ip(t,n,8)^np(t,0,7),i=op(t,n,1)^op(t,n,8)^rp(t,n,7),o=0|Px[e-2],a=0|_x[e-2],s=ip(o,a,19)^ap(o,a,61)^np(o,0,6),c=op(o,a,19)^sp(o,a,61)^rp(o,a,6),u=gp(i,c,_x[e-7],_x[e-16]),l=mp(u,r,s,Px[e-7],Px[e-16]);Px[e]=0|l,_x[e]=0|u}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:a,Cl:s,Dh:c,Dl:u,Eh:l,El:d,Fh:f,Fl:h,Gh:p,Gl:g,Hh:m,Hl:y}=this;for(let e=0;e<80;e++){const t=ip(l,d,14)^ip(l,d,18)^ap(l,d,41),w=op(l,d,14)^op(l,d,18)^sp(l,d,41),v=l&f^~l&p,A=yp(y,w,d&h^~d&g,Mx[e],_x[e]),b=wp(A,m,t,v,Cx[e],Px[e]),S=0|A,k=ip(n,r,28)^ap(n,r,34)^ap(n,r,39),x=op(n,r,28)^sp(n,r,34)^sp(n,r,39),E=n&i^n&a^i&a,I=r&o^r&s^o&s;m=0|p,y=0|g,p=0|f,g=0|h,f=0|l,h=0|d,({h:l,l:d}=fp(0|c,0|u,0|b,0|S)),c=0|a,u=0|s,a=0|i,s=0|o,i=0|n,o=0|r;const T=hp(S,x,I);n=pp(T,b,k,E),r=0|T}({h:n,l:r}=fp(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=fp(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=fp(0|this.Ch,0|this.Cl,0|a,0|s)),({h:c,l:u}=fp(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:d}=fp(0|this.Eh,0|this.El,0|l,0|d)),({h:f,l:h}=fp(0|this.Fh,0|this.Fl,0|f,0|h)),({h:p,l:g}=fp(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:y}=fp(0|this.Hh,0|this.Hl,0|m,0|y)),this.set(n,r,i,o,a,s,c,u,l,d,f,h,p,g,m,y)}roundClean(){Ip(Px,_x)}destroy(){Ip(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);const Ox=Yp(()=>new Tx),Ux=Yp(()=>new Rx);class Nx extends Jp{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,kp(e);const n=Vp(t);if(this.iHash=e.create(),\"function\"!=typeof this.iHash.update)throw new Error(\"Expected instance of class which extends utils.Hash\");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),Ip(i)}update(e){return xp(this),this.iHash.update(e),this}digestInto(e){xp(this),Sp(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const zx=(e,t,n)=>new Nx(e,t).update(n).digest();zx.create=(e,t)=>new Nx(e,t);const Fx=BigInt(0),Lx=BigInt(1);function Dx(e,t=\"\"){if(\"boolean\"!=typeof e){throw new Error((t&&`\"${t}\"`)+\"expected boolean, got type=\"+typeof e)}return e}function jx(e,t,n=\"\"){const r=Ap(e),i=e?.length,o=void 0!==t;if(!r||o&&i!==t){throw new Error((n&&`\"${n}\" `)+\"expected Uint8Array\"+(o?` of length ${t}`:\"\")+\", got \"+(r?`length=${i}`:\"type=\"+typeof e))}return e}function $x(e){const t=e.toString(16);return 1&t.length?\"0\"+t:t}function Kx(e){if(\"string\"!=typeof e)throw new Error(\"hex string expected, got \"+typeof e);return\"\"===e?Fx:BigInt(\"0x\"+e)}function qx(e){return Kx(Up(e))}function Hx(e){return Sp(e),Kx(Up(Uint8Array.from(e).reverse()))}function Wx(e,t){return Kp(e.toString(16).padStart(2*t,\"0\"))}function Vx(e,t){return Wx(e,t).reverse()}function Gx(e,t,n){let r;if(\"string\"==typeof t)try{r=Kp(t)}catch(t){throw new Error(e+\" must be hex string or Uint8Array, cause: \"+t)}else{if(!Ap(t))throw new Error(e+\" must be hex string or Uint8Array\");r=Uint8Array.from(t)}const i=r.length;if(\"number\"==typeof n&&i!==n)throw new Error(e+\" of length \"+n+\" expected, got \"+i);return r}function Zx(e){return Uint8Array.from(e)}const Jx=e=>\"bigint\"==typeof e&&Fx<=e;function Yx(e,t,n,r){if(!function(e,t,n){return Jx(e)&&Jx(t)&&Jx(n)&&t<=e&&e<n}(t,n,r))throw new Error(\"expected valid \"+e+\": \"+n+\" <= n < \"+r+\", got \"+t)}function Xx(e){let t;for(t=0;e>Fx;e>>=Lx,t+=1);return t}const Qx=e=>(Lx<<BigInt(e))-Lx;function eE(e,t,n={}){if(!e||\"object\"!=typeof e)throw new Error(\"expected valid options object\");function r(t,n,r){const i=e[t];if(r&&void 0===i)return;const o=typeof i;if(o!==n||null===i)throw new Error(`param \"${t}\" is invalid: expected ${n}, got ${o}`)}Object.entries(t).forEach(([e,t])=>r(e,t,!1)),Object.entries(n).forEach(([e,t])=>r(e,t,!0))}const tE=()=>{throw new Error(\"not implemented\")};function nE(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(void 0!==i)return i;const o=e(n,...r);return t.set(n,o),o}}const rE=BigInt(0),iE=BigInt(1),oE=BigInt(2),aE=BigInt(3),sE=BigInt(4),cE=BigInt(5),uE=BigInt(7),lE=BigInt(8),dE=BigInt(9),fE=BigInt(16);function hE(e,t){const n=e%t;return n>=rE?n:t+n}function pE(e,t,n){let r=e;for(;t-- >rE;)r*=r,r%=n;return r}function gE(e,t){if(e===rE)throw new Error(\"invert: expected non-zero number\");if(t<=rE)throw new Error(\"invert: expected positive modulus, got \"+t);let n=hE(e,t),r=t,i=rE,o=iE,a=iE,s=rE;for(;n!==rE;){const e=r/n,t=r%n,c=i-a*e,u=o-s*e;r=n,n=t,i=a,o=s,a=c,s=u}if(r!==iE)throw new Error(\"invert: does not exist\");return hE(i,t)}function mE(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error(\"Cannot find square root\")}function yE(e,t){const n=(e.ORDER+iE)/sE,r=e.pow(t,n);return mE(e,r,t),r}function wE(e,t){const n=(e.ORDER-cE)/lE,r=e.mul(t,oE),i=e.pow(r,n),o=e.mul(t,i),a=e.mul(e.mul(o,oE),i),s=e.mul(o,e.sub(a,e.ONE));return mE(e,s,t),s}function vE(e){if(e<aE)throw new Error(\"sqrt is not defined for small field\");let t=e-iE,n=0;for(;t%oE===rE;)t/=oE,n++;let r=oE;const i=TE(e);for(;1===EE(i,r);)if(r++>1e3)throw new Error(\"Cannot find square root: probably non-prime P\");if(1===n)return yE;let o=i.pow(r,t);const a=(t+iE)/oE;return function(e,r){if(e.is0(r))return r;if(1!==EE(e,r))throw new Error(\"Cannot find square root\");let i=n,s=e.mul(e.ONE,o),c=e.pow(r,t),u=e.pow(r,a);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,n=e.sqr(c);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw new Error(\"Cannot find square root\");const r=iE<<BigInt(i-t-1),o=e.pow(s,r);i=t,s=e.sqr(o),c=e.mul(c,s),u=e.mul(u,o)}return u}}function AE(e){return e%sE===aE?yE:e%lE===cE?wE:e%fE===dE?function(e){const t=TE(e),n=vE(e),r=n(t,t.neg(t.ONE)),i=n(t,r),o=n(t,t.neg(r)),a=(e+uE)/fE;return(e,t)=>{let n=e.pow(t,a),s=e.mul(n,r);const c=e.mul(n,i),u=e.mul(n,o),l=e.eql(e.sqr(s),t),d=e.eql(e.sqr(c),t);n=e.cmov(n,s,l),s=e.cmov(u,c,d);const f=e.eql(e.sqr(s),t),h=e.cmov(n,s,f);return mE(e,h,t),h}}(e):vE(e)}const bE=(e,t)=>(hE(e,t)&iE)===iE,SE=[\"create\",\"isValid\",\"is0\",\"neg\",\"inv\",\"sqrt\",\"sqr\",\"eql\",\"add\",\"sub\",\"mul\",\"pow\",\"div\",\"addN\",\"subN\",\"mulN\",\"sqrN\"];function kE(e,t,n){if(n<rE)throw new Error(\"invalid exponent, negatives unsupported\");if(n===rE)return e.ONE;if(n===iE)return t;let r=e.ONE,i=t;for(;n>rE;)n&iE&&(r=e.mul(r,i)),i=e.sqr(i),n>>=iE;return r}function xE(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),o=e.inv(i);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),o),r}function EE(e,t){const n=(e.ORDER-iE)/oE,r=e.pow(t,n),i=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!i&&!o&&!a)throw new Error(\"invalid Legendre symbol result\");return i?1:o?0:-1}function IE(e,t){void 0!==t&&bp(t);const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function TE(e,t,n=!1,r={}){if(e<=rE)throw new Error(\"invalid field: expected ORDER > 0, got \"+e);let i,o,a,s=!1;if(\"object\"==typeof t&&null!=t){if(r.sqrt||n)throw new Error(\"cannot specify opts in two arguments\");const e=t;e.BITS&&(i=e.BITS),e.sqrt&&(o=e.sqrt),\"boolean\"==typeof e.isLE&&(n=e.isLE),\"boolean\"==typeof e.modFromBytes&&(s=e.modFromBytes),a=e.allowedLengths}else\"number\"==typeof t&&(i=t),r.sqrt&&(o=r.sqrt);const{nBitLength:c,nByteLength:u}=IE(e,i);if(u>2048)throw new Error(\"invalid field: expected ORDER of <= 2048 bytes\");let l;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:u,MASK:Qx(c),ZERO:rE,ONE:iE,allowedLengths:a,create:t=>hE(t,e),isValid:t=>{if(\"bigint\"!=typeof t)throw new Error(\"invalid field element: expected bigint, got \"+typeof t);return rE<=t&&t<e},is0:e=>e===rE,isValidNot0:e=>!d.is0(e)&&d.isValid(e),isOdd:e=>(e&iE)===iE,neg:t=>hE(-t,e),eql:(e,t)=>e===t,sqr:t=>hE(t*t,e),add:(t,n)=>hE(t+n,e),sub:(t,n)=>hE(t-n,e),mul:(t,n)=>hE(t*n,e),pow:(e,t)=>kE(d,e,t),div:(t,n)=>hE(t*gE(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>gE(t,e),sqrt:o||(t=>(l||(l=AE(e)),l(d,t))),toBytes:e=>n?Vx(e,u):Wx(e,u),fromBytes:(t,r=!0)=>{if(a){if(!a.includes(t.length)||t.length>u)throw new Error(\"Field.fromBytes: expected \"+a+\" bytes, got \"+t.length);const e=new Uint8Array(u);e.set(t,n?0:e.length-t.length),t=e}if(t.length!==u)throw new Error(\"Field.fromBytes: expected \"+u+\" bytes, got \"+t.length);let i=n?Hx(t):qx(t);if(s&&(i=hE(i,e)),!r&&!d.isValid(i))throw new Error(\"invalid field element: outside of range 0..ORDER\");return i},invertBatch:e=>xE(d,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(d)}function BE(e){if(\"bigint\"!=typeof e)throw new Error(\"field order must be bigint\");const t=e.toString(2).length;return Math.ceil(t/8)}function CE(e){const t=BE(e);return t+Math.ceil(t/2)}const ME=BigInt(0),PE=BigInt(1);function _E(e,t){const n=t.negate();return e?n:t}function RE(e,t){const n=xE(e.Fp,t.map(e=>e.Z));return t.map((t,r)=>e.fromAffine(t.toAffine(n[r])))}function OE(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error(\"invalid window size, expected [1..\"+t+\"], got W=\"+e)}function UE(e,t){OE(e,t);const n=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:Qx(e),maxNumber:n,shiftBy:BigInt(e)}}function NE(e,t,n){const{windowSize:r,mask:i,maxNumber:o,shiftBy:a}=n;let s=Number(e&i),c=e>>a;s>r&&(s-=o,c+=PE);const u=t*r;return{nextN:c,offset:u+Math.abs(s)-1,isZero:0===s,isNeg:s<0,isNegF:t%2!=0,offsetF:u}}function zE(e,t){if(!Array.isArray(e))throw new Error(\"array expected\");e.forEach((e,n)=>{if(!(e instanceof t))throw new Error(\"invalid point at index \"+n)})}function FE(e,t){if(!Array.isArray(e))throw new Error(\"array of scalars expected\");e.forEach((e,n)=>{if(!t.isValid(e))throw new Error(\"invalid scalar at index \"+n)})}const LE=new WeakMap,DE=new WeakMap;function jE(e){return DE.get(e)||1}function $E(e){if(e!==ME)throw new Error(\"invalid wNAF\")}class KE{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let r=e;for(;t>ME;)t&PE&&(n=n.add(r)),r=r.double(),t>>=PE;return n}precomputeWindow(e,t){const{windows:n,windowSize:r}=UE(t,this.bits),i=[];let o=e,a=o;for(let e=0;e<n;e++){a=o,i.push(a);for(let e=1;e<r;e++)a=a.add(o),i.push(a);o=a.double()}return i}wNAF(e,t,n){if(!this.Fn.isValid(n))throw new Error(\"invalid scalar\");let r=this.ZERO,i=this.BASE;const o=UE(e,this.bits);for(let e=0;e<o.windows;e++){const{nextN:a,offset:s,isZero:c,isNeg:u,isNegF:l,offsetF:d}=NE(n,e,o);n=a,c?i=i.add(_E(l,t[d])):r=r.add(_E(u,t[s]))}return $E(n),{p:r,f:i}}wNAFUnsafe(e,t,n,r=this.ZERO){const i=UE(e,this.bits);for(let e=0;e<i.windows&&n!==ME;e++){const{nextN:o,offset:a,isZero:s,isNeg:c}=NE(n,e,i);if(n=o,!s){const e=t[a];r=r.add(c?e.negate():e)}}return $E(n),r}getPrecomputes(e,t,n){let r=LE.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&(\"function\"==typeof n&&(r=n(r)),LE.set(t,r))),r}cached(e,t,n){const r=jE(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)}unsafe(e,t,n,r){const i=jE(e);return 1===i?this._unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)}createCache(e,t){OE(t,this.bits),DE.set(e,t),LE.delete(e)}hasCache(e){return 1!==jE(e)}}function qE(e,t,n,r){zE(n,e),FE(r,t);const i=n.length,o=r.length;if(i!==o)throw new Error(\"arrays of points and scalars must have equal length\");const a=e.ZERO,s=Xx(BigInt(i));let c=1;s>12?c=s-3:s>4?c=s-2:s>0&&(c=2);const u=Qx(c),l=new Array(Number(u)+1).fill(a);let d=a;for(let e=Math.floor((t.BITS-1)/c)*c;e>=0;e-=c){l.fill(a);for(let t=0;t<o;t++){const i=r[t],o=Number(i>>BigInt(e)&u);l[o]=l[o].add(n[t])}let t=a;for(let e=l.length-1,n=a;e>0;e--)n=n.add(l[e]),t=t.add(n);if(d=d.add(t),0!==e)for(let e=0;e<c;e++)d=d.double()}return d}function HE(e,t,n){if(t){if(t.ORDER!==e)throw new Error(\"Field.ORDER must match order: Fp == p, Fn == n\");return function(e){const t=SE.reduce((e,t)=>(e[t]=\"function\",e),{ORDER:\"bigint\",MASK:\"bigint\",BYTES:\"number\",BITS:\"number\"});eE(e,t)}(t),t}return TE(e,{isLE:n})}function WE(e,t,n={},r){if(void 0===r&&(r=\"edwards\"===e),!t||\"object\"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const e of[\"p\",\"n\",\"h\"]){const n=t[e];if(!(\"bigint\"==typeof n&&n>ME))throw new Error(`CURVE.${e} must be positive bigint`)}const i=HE(t.p,n.Fp,r),o=HE(t.n,n.Fn,r),a=[\"Gx\",\"Gy\",\"a\",\"weierstrass\"===e?\"b\":\"d\"];for(const e of a)if(!i.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}const VE=(e,t)=>(e+(e>=0?t:-t)/eI)/t;function GE(e){if(![\"compact\",\"recovered\",\"der\"].includes(e))throw new Error('Signature format must be \"compact\", \"recovered\", or \"der\"');return e}function ZE(e,t){const n={};for(let r of Object.keys(t))n[r]=void 0===e[r]?t[r]:e[r];return Dx(n.lowS,\"lowS\"),Dx(n.prehash,\"prehash\"),void 0!==n.format&&GE(n.format),n}class JE extends Error{constructor(e=\"\"){super(e)}}const YE={Err:JE,_tlv:{encode:(e,t)=>{const{Err:n}=YE;if(e<0||e>256)throw new n(\"tlv.encode: wrong tag\");if(1&t.length)throw new n(\"tlv.encode: unpadded data\");const r=t.length/2,i=$x(r);if(i.length/2&128)throw new n(\"tlv.encode: long form length too big\");const o=r>127?$x(i.length/2|128):\"\";return $x(e)+o+i+t},decode(e,t){const{Err:n}=YE;let r=0;if(e<0||e>256)throw new n(\"tlv.encode: wrong tag\");if(t.length<2||t[r++]!==e)throw new n(\"tlv.decode: wrong tlv\");const i=t[r++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new n(\"tlv.decode(long): indefinite length not supported\");if(e>4)throw new n(\"tlv.decode(long): byte length is too big\");const a=t.subarray(r,r+e);if(a.length!==e)throw new n(\"tlv.decode: length bytes not complete\");if(0===a[0])throw new n(\"tlv.decode(long): zero leftmost byte\");for(const e of a)o=o<<8|e;if(r+=e,o<128)throw new n(\"tlv.decode(long): not minimal encoding\")}else o=i;const a=t.subarray(r,r+o);if(a.length!==o)throw new n(\"tlv.decode: wrong value length\");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=YE;if(e<XE)throw new t(\"integer: negative integers are not allowed\");let n=$x(e);if(8&Number.parseInt(n[0],16)&&(n=\"00\"+n),1&n.length)throw new t(\"unexpected DER parsing assertion: unpadded hex\");return n},decode(e){const{Err:t}=YE;if(128&e[0])throw new t(\"invalid signature integer: negative\");if(0===e[0]&&!(128&e[1]))throw new t(\"invalid signature integer: unnecessary leading zero\");return qx(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=YE,i=Gx(\"signature\",e),{v:o,l:a}=r.decode(48,i);if(a.length)throw new t(\"invalid signature: left bytes after parsing\");const{v:s,l:c}=r.decode(2,o),{v:u,l}=r.decode(2,c);if(l.length)throw new t(\"invalid signature: left bytes after parsing\");return{r:n.decode(s),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=YE,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},XE=BigInt(0),QE=BigInt(1),eI=BigInt(2),tI=BigInt(3),nI=BigInt(4);function rI(e,t){const{BYTES:n}=e;let r;if(\"bigint\"==typeof t)r=t;else{let i=Gx(\"private key\",t);try{r=e.fromBytes(i)}catch(e){throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error(\"invalid private key: out of range [1..N-1]\");return r}function iI(e,t={}){const n=WE(\"weierstrass\",e,t),{Fp:r,Fn:i}=n;let o=n.CURVE;const{h:a,n:s}=o;eE(t,{},{allowInfinityPoint:\"boolean\",clearCofactor:\"function\",isTorsionFree:\"function\",fromBytes:\"function\",toBytes:\"function\",endo:\"object\",wrapPrivateKey:\"boolean\"});const{endo:c}=t;if(c&&(!r.is0(o.a)||\"bigint\"!=typeof c.beta||!Array.isArray(c.basises)))throw new Error('invalid endo: expected \"beta\": bigint and \"basises\": array');const u=aI(r,i);function l(){if(!r.isOdd)throw new Error(\"compression is not supported: Field does not have .isOdd()\")}const d=t.toBytes||function(e,t,n){const{x:i,y:o}=t.toAffine(),a=r.toBytes(i);if(Dx(n,\"isCompressed\"),n){l();return Zp(oI(!r.isOdd(o)),a)}return Zp(Uint8Array.of(4),a,r.toBytes(o))},f=t.fromBytes||function(e){jx(e,void 0,\"Point\");const{publicKey:t,publicKeyUncompressed:n}=u,i=e.length,o=e[0],a=e.subarray(1);if(i!==t||2!==o&&3!==o){if(i===n&&4===o){const e=r.BYTES,t=r.fromBytes(a.subarray(0,e)),n=r.fromBytes(a.subarray(e,2*e));if(!p(t,n))throw new Error(\"bad point: is not on curve\");return{x:t,y:n}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}{const e=r.fromBytes(a);if(!r.isValid(e))throw new Error(\"bad point: is not on curve, wrong x\");const t=h(e);let n;try{n=r.sqrt(t)}catch(e){const t=e instanceof Error?\": \"+e.message:\"\";throw new Error(\"bad point: is not on curve, sqrt error\"+t)}l();return!(1&~o)!==r.isOdd(n)&&(n=r.neg(n)),{x:e,y:n}}};function h(e){const t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,o.a)),o.b)}function p(e,t){const n=r.sqr(t),i=h(e);return r.eql(n,i)}if(!p(o.Gx,o.Gy))throw new Error(\"bad curve params: generator point\");const g=r.mul(r.pow(o.a,tI),nI),m=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(g,m)))throw new Error(\"bad curve params: a or b\");function y(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function w(e){if(!(e instanceof k))throw new Error(\"ProjectivePoint expected\")}function v(e){if(!c||!c.basises)throw new Error(\"no endo\");return function(e,t,n){const[[r,i],[o,a]]=t,s=VE(a*e,n),c=VE(-i*e,n);let u=e-s*r-c*o,l=-s*i-c*a;const d=u<XE,f=l<XE;d&&(u=-u),f&&(l=-l);const h=Qx(Math.ceil(Xx(n)/2))+QE;if(u<XE||u>=h||l<XE||l>=h)throw new Error(\"splitScalar (endomorphism): failed, k=\"+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}(e,c.basises,i.ORDER)}const A=nE((e,t)=>{const{X:n,Y:i,Z:o}=e;if(r.eql(o,r.ONE))return{x:n,y:i};const a=e.is0();null==t&&(t=a?r.ONE:r.inv(o));const s=r.mul(n,t),c=r.mul(i,t),u=r.mul(o,t);if(a)return{x:r.ZERO,y:r.ZERO};if(!r.eql(u,r.ONE))throw new Error(\"invZ was invalid\");return{x:s,y:c}}),b=nE(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.Y))return;throw new Error(\"bad point: ZERO\")}const{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw new Error(\"bad point: x or y not field elements\");if(!p(n,i))throw new Error(\"bad point: equation left != right\");if(!e.isTorsionFree())throw new Error(\"bad point: not in prime-order subgroup\");return!0});function S(e,t,n,i,o){return n=new k(r.mul(n.X,e),n.Y,n.Z),t=_E(i,t),n=_E(o,n),t.add(n)}class k{constructor(e,t,n){this.X=y(\"x\",e),this.Y=y(\"y\",t,!0),this.Z=y(\"z\",n),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error(\"invalid affine point\");if(e instanceof k)throw new Error(\"projective point not allowed\");return r.is0(t)&&r.is0(n)?k.ZERO:new k(t,n,r.ONE)}static fromBytes(e){const t=k.fromAffine(f(jx(e,void 0,\"point\")));return t.assertValidity(),t}static fromHex(e){return k.fromBytes(Gx(\"pointHex\",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return E.createCache(this,e),t||this.multiply(tI),this}assertValidity(){b(this)}hasEvenY(){const{y:e}=this.toAffine();if(!r.isOdd)throw new Error(\"Field doesn't support isOdd\");return!r.isOdd(e)}equals(e){w(e);const{X:t,Y:n,Z:i}=this,{X:o,Y:a,Z:s}=e,c=r.eql(r.mul(t,s),r.mul(o,i)),u=r.eql(r.mul(n,s),r.mul(a,i));return c&&u}negate(){return new k(this.X,r.neg(this.Y),this.Z)}double(){const{a:e,b:t}=o,n=r.mul(t,tI),{X:i,Y:a,Z:s}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,d=r.mul(i,i),f=r.mul(a,a),h=r.mul(s,s),p=r.mul(i,a);return p=r.add(p,p),l=r.mul(i,s),l=r.add(l,l),c=r.mul(e,l),u=r.mul(n,h),u=r.add(c,u),c=r.sub(f,u),u=r.add(f,u),u=r.mul(c,u),c=r.mul(p,c),l=r.mul(n,l),h=r.mul(e,h),p=r.sub(d,h),p=r.mul(e,p),p=r.add(p,l),l=r.add(d,d),d=r.add(l,d),d=r.add(d,h),d=r.mul(d,p),u=r.add(u,d),h=r.mul(a,s),h=r.add(h,h),d=r.mul(h,p),c=r.sub(c,d),l=r.mul(h,f),l=r.add(l,l),l=r.add(l,l),new k(c,u,l)}add(e){w(e);const{X:t,Y:n,Z:i}=this,{X:a,Y:s,Z:c}=e;let u=r.ZERO,l=r.ZERO,d=r.ZERO;const f=o.a,h=r.mul(o.b,tI);let p=r.mul(t,a),g=r.mul(n,s),m=r.mul(i,c),y=r.add(t,n),v=r.add(a,s);y=r.mul(y,v),v=r.add(p,g),y=r.sub(y,v),v=r.add(t,i);let A=r.add(a,c);return v=r.mul(v,A),A=r.add(p,m),v=r.sub(v,A),A=r.add(n,i),u=r.add(s,c),A=r.mul(A,u),u=r.add(g,m),A=r.sub(A,u),d=r.mul(f,v),u=r.mul(h,m),d=r.add(u,d),u=r.sub(g,d),d=r.add(g,d),l=r.mul(u,d),g=r.add(p,p),g=r.add(g,p),m=r.mul(f,m),v=r.mul(h,v),g=r.add(g,m),m=r.sub(p,m),m=r.mul(f,m),v=r.add(v,m),p=r.mul(g,v),l=r.add(l,p),p=r.mul(A,v),u=r.mul(y,u),u=r.sub(u,p),p=r.mul(y,g),d=r.mul(A,d),d=r.add(d,p),new k(u,l,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(k.ZERO)}multiply(e){const{endo:n}=t;if(!i.isValidNot0(e))throw new Error(\"invalid scalar: out of range\");let r,o;const a=e=>E.cached(this,e,e=>RE(k,e));if(n){const{k1neg:t,k1:i,k2neg:s,k2:c}=v(e),{p:u,f:l}=a(i),{p:d,f}=a(c);o=l.add(f),r=S(n.beta,u,d,t,s)}else{const{p:t,f:n}=a(e);r=t,o=n}return RE(k,[r,o])[0]}multiplyUnsafe(e){const{endo:n}=t,r=this;if(!i.isValid(e))throw new Error(\"invalid scalar: out of range\");if(e===XE||r.is0())return k.ZERO;if(e===QE)return r;if(E.hasCache(this))return this.multiply(e);if(n){const{k1neg:t,k1:i,k2neg:o,k2:a}=v(e),{p1:s,p2:c}=function(e,t,n,r){let i=t,o=e.ZERO,a=e.ZERO;for(;n>ME||r>ME;)n&PE&&(o=o.add(i)),r&PE&&(a=a.add(i)),i=i.double(),n>>=PE,r>>=PE;return{p1:o,p2:a}}(k,r,i,a);return S(n.beta,s,c,t,o)}return E.unsafe(r,e)}multiplyAndAddUnsafe(e,t,n){const r=this.multiplyUnsafe(t).add(e.multiplyUnsafe(n));return r.is0()?void 0:r}toAffine(e){return A(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return a===QE||(e?e(k,this):E.unsafe(this,s).is0())}clearCofactor(){const{clearCofactor:e}=t;return a===QE?this:e?e(k,this):this.multiplyUnsafe(a)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}toBytes(e=!0){return Dx(e,\"isCompressed\"),this.assertValidity(),d(k,this,e)}toHex(e=!0){return Up(this.toBytes(e))}toString(){return`<Point ${this.is0()?\"ZERO\":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return RE(k,e)}static msm(e,t){return qE(k,i,e,t)}static fromPrivateKey(e){return k.BASE.multiply(rI(i,e))}}k.BASE=new k(o.Gx,o.Gy,r.ONE),k.ZERO=new k(r.ZERO,r.ONE,r.ZERO),k.Fp=r,k.Fn=i;const x=i.BITS,E=new KE(k,t.endo?Math.ceil(x/2):x);return k.BASE.precompute(8),k}function oI(e){return Uint8Array.of(e?2:3)}function aI(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function sI(e,t={}){const{Fn:n}=e,r=t.randomBytes||Xp,i=Object.assign(aI(e.Fp,n),{seed:CE(n.ORDER)});function o(e){try{return!!rI(n,e)}catch(e){return!1}}function a(e=r(i.seed)){return function(e,t,n=!1){const r=e.length,i=BE(t),o=CE(t);if(r<16||r<o||r>1024)throw new Error(\"expected \"+o+\"-1024 bytes of input, got \"+r);const a=hE(n?Hx(e):qx(e),t-iE)+iE;return n?Vx(a,i):Wx(a,i)}(jx(e,i.seed,\"seed\"),n.ORDER)}function s(t,r=!0){return e.BASE.multiply(rI(n,t)).toBytes(r)}function c(t){if(\"bigint\"==typeof t)return!1;if(t instanceof e)return!0;const{secretKey:r,publicKey:o,publicKeyUncompressed:a}=i;if(n.allowedLengths||r===o)return;const s=Gx(\"key\",t).length;return s===o||s===a}const u={isValidSecretKey:o,isValidPublicKey:function(t,n){const{publicKey:r,publicKeyUncompressed:o}=i;try{const i=t.length;return(!0!==n||i===r)&&((!1!==n||i===o)&&!!e.fromBytes(t))}catch(e){return!1}},randomSecretKey:a,isValidPrivateKey:o,randomPrivateKey:a,normPrivateKeyToScalar:e=>rI(n,e),precompute:(t=8,n=e.BASE)=>n.precompute(t,!1)};return Object.freeze({getPublicKey:s,getSharedSecret:function(t,r,i=!0){if(!0===c(t))throw new Error(\"first arg must be private key\");if(!1===c(r))throw new Error(\"second arg must be public key\");const o=rI(n,t);return e.fromHex(r).multiply(o).toBytes(i)},keygen:function(e){const t=a(e);return{secretKey:t,publicKey:s(t)}},Point:e,utils:u,lengths:i})}function cI(e,t,n={}){kp(t),eE(n,{},{hmac:\"function\",lowS:\"boolean\",randomBytes:\"function\",bits2int:\"function\",bits2int_modN:\"function\"});const r=n.randomBytes||Xp,i=n.hmac||((e,...n)=>zx(t,e,Zp(...n))),{Fp:o,Fn:a}=e,{ORDER:s,BITS:c}=a,{keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:h}=sI(e,n),p={prehash:!1,lowS:\"boolean\"==typeof n.lowS&&n.lowS,format:void 0,extraEntropy:!1},g=\"compact\";function m(e){return e>s>>QE}function y(e,t){if(!a.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class w{constructor(e,t,n){this.r=y(\"r\",e),this.s=y(\"s\",t),null!=n&&(this.recovery=n),Object.freeze(this)}static fromBytes(e,t=g){let n;if(function(e,t){GE(t);const n=h.signature;jx(e,\"compact\"===t?n:\"recovered\"===t?n+1:void 0,`${t} signature`)}(e,t),\"der\"===t){const{r:t,s:n}=YE.toSig(jx(e));return new w(t,n)}\"recovered\"===t&&(n=e[0],t=\"compact\",e=e.subarray(1));const r=a.BYTES,i=e.subarray(0,r),o=e.subarray(r,2*r);return new w(a.fromBytes(i),a.fromBytes(o),n)}static fromHex(e,t){return this.fromBytes(Kp(e),t)}addRecoveryBit(e){return new w(this.r,this.s,e)}recoverPublicKey(t){const n=o.ORDER,{r,s:i,recovery:c}=this;if(null==c||![0,1,2,3].includes(c))throw new Error(\"recovery id invalid\");if(s*eI<n&&c>1)throw new Error(\"recovery id is ambiguous for h>1 curve\");const u=2===c||3===c?r+s:r;if(!o.isValid(u))throw new Error(\"recovery id 2 or 3 invalid\");const l=o.toBytes(u),d=e.fromBytes(Zp(oI(!(1&c)),l)),f=a.inv(u),h=A(Gx(\"msgHash\",t)),p=a.create(-h*f),g=a.create(i*f),m=e.BASE.multiplyUnsafe(p).add(d.multiplyUnsafe(g));if(m.is0())throw new Error(\"point at infinify\");return m.assertValidity(),m}hasHighS(){return m(this.s)}toBytes(e=g){if(GE(e),\"der\"===e)return Kp(YE.hexFromSig(this));const t=a.toBytes(this.r),n=a.toBytes(this.s);if(\"recovered\"===e){if(null==this.recovery)throw new Error(\"recovery bit must be present\");return Zp(Uint8Array.of(this.recovery),t,n)}return Zp(t,n)}toHex(e){return Up(this.toBytes(e))}assertValidity(){}static fromCompact(e){return w.fromBytes(Gx(\"sig\",e),\"compact\")}static fromDER(e){return w.fromBytes(Gx(\"sig\",e),\"der\")}normalizeS(){return this.hasHighS()?new w(this.r,a.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes(\"der\")}toDERHex(){return Up(this.toBytes(\"der\"))}toCompactRawBytes(){return this.toBytes(\"compact\")}toCompactHex(){return Up(this.toBytes(\"compact\"))}}const v=n.bits2int||function(e){if(e.length>8192)throw new Error(\"input is too large\");const t=qx(e),n=8*e.length-c;return n>0?t>>BigInt(n):t},A=n.bits2int_modN||function(e){return a.create(v(e))},b=Qx(c);function S(e){return Yx(\"num < 2^\"+c,e,XE,b),a.toBytes(e)}function k(e,n){return jx(e,void 0,\"message\"),n?jx(t(e),void 0,\"prehashed message\"):e}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:h,Point:e,sign:function(n,o,s={}){n=Gx(\"message\",n);const{seed:c,k2sig:u}=function(t,n,i){if([\"recovered\",\"canonical\"].some(e=>e in i))throw new Error(\"sign() legacy options not supported\");const{lowS:o,prehash:s,extraEntropy:c}=ZE(i,p);t=k(t,s);const u=A(t),l=rI(a,n),d=[S(l),S(u)];if(null!=c&&!1!==c){const e=!0===c?r(h.secretKey):c;d.push(Gx(\"extraEntropy\",e))}const f=Zp(...d),g=u;return{seed:f,k2sig:function(t){const n=v(t);if(!a.isValidNot0(n))return;const r=a.inv(n),i=e.BASE.multiply(n).toAffine(),s=a.create(i.x);if(s===XE)return;const c=a.create(r*a.create(g+s*l));if(c===XE)return;let u=(i.x===s?0:2)|Number(i.y&QE),d=c;return o&&m(c)&&(d=a.neg(c),u^=1),new w(s,d,u)}}}(n,o,s),l=function(e,t,n){if(\"number\"!=typeof e||e<2)throw new Error(\"hashLen must be a number\");if(\"number\"!=typeof t||t<2)throw new Error(\"qByteLen must be a number\");if(\"function\"!=typeof n)throw new Error(\"hmacFn must be a function\");const r=e=>new Uint8Array(e),i=e=>Uint8Array.of(e);let o=r(e),a=r(e),s=0;const c=()=>{o.fill(1),a.fill(0),s=0},u=(...e)=>n(a,o,...e),l=(e=r(0))=>{a=u(i(0),e),o=u(),0!==e.length&&(a=u(i(1),e),o=u())},d=()=>{if(s++>=1e3)throw new Error(\"drbg: tried 1000 values\");let e=0;const n=[];for(;e<t;){o=u();const t=o.slice();n.push(t),e+=o.length}return Zp(...n)};return(e,t)=>{let n;for(c(),l(e);!(n=t(d()));)l();return c(),n}}(t.outputLen,a.BYTES,i);return l(c,u)},verify:function(t,n,r,i={}){const{lowS:o,prehash:s,format:c}=ZE(i,p);if(r=Gx(\"publicKey\",r),n=k(Gx(\"message\",n),s),\"strict\"in i)throw new Error(\"options.strict was renamed to lowS\");const u=void 0===c?function(e){let t;const n=\"string\"==typeof e||Ap(e),r=!n&&null!==e&&\"object\"==typeof e&&\"bigint\"==typeof e.r&&\"bigint\"==typeof e.s;if(!n&&!r)throw new Error(\"invalid signature, expected Uint8Array, hex string or Signature instance\");if(r)t=new w(e.r,e.s);else if(n){try{t=w.fromBytes(Gx(\"sig\",e),\"der\")}catch(e){if(!(e instanceof YE.Err))throw e}if(!t)try{t=w.fromBytes(Gx(\"sig\",e),\"compact\")}catch(e){return!1}}return t||!1}(t):w.fromBytes(Gx(\"sig\",t),c);if(!1===u)return!1;try{const t=e.fromBytes(r);if(o&&u.hasHighS())return!1;const{r:i,s}=u,c=A(n),l=a.inv(s),d=a.create(c*l),f=a.create(i*l),h=e.BASE.multiplyUnsafe(d).add(t.multiplyUnsafe(f));if(h.is0())return!1;return a.create(h.x)===i}catch(e){return!1}},recoverPublicKey:function(e,t,n={}){const{prehash:r}=ZE(n,p);return t=k(t,r),w.fromBytes(e,\"recovered\").recoverPublicKey(t).toBytes()},Signature:w,hash:t})}function uI(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0;return{CURVE:t,curveOpts:{Fp:n,Fn:TE(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}function lI(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=function(e){const{CURVE:t,curveOpts:n}=uI(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}(e);return function(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,IE(n.Fn.ORDER,n.Fn.BITS))})}(e,cI(iI(t,n),r,i))}const dI={p:BigInt(\"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f\"),n:BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt(\"0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\"),Gy:BigInt(\"0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\")},fI={beta:BigInt(\"0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee\"),basises:[[BigInt(\"0x3086d221a7d46bcde86c90e49284eb15\"),-BigInt(\"0xe4437ed6010e88286f547fa90abfe4c3\")],[BigInt(\"0x114ca50f7a8e2f3f657c1108d9d44cfd8\"),BigInt(\"0x3086d221a7d46bcde86c90e49284eb15\")]]},hI=BigInt(2);const pI=TE(dI.p,{sqrt:function(e){const t=dI.p,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=pE(l,n,t)*l%t,f=pE(d,n,t)*l%t,h=pE(f,hI,t)*u%t,p=pE(h,i,t)*h%t,g=pE(p,o,t)*p%t,m=pE(g,s,t)*g%t,y=pE(m,c,t)*m%t,w=pE(y,s,t)*g%t,v=pE(w,n,t)*l%t,A=pE(v,a,t)*p%t,b=pE(A,r,t)*u%t,S=pE(b,hI,t);if(!pI.eql(pI.sqr(S),e))throw new Error(\"Cannot find square root\");return S}}),gI=function(e,t){const n=t=>lI({...e,hash:t});return{...n(t),create:n}}({...dI,Fp:pI,lowS:!0,endo:fI},Ox);var mI=n(925);function yI(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&\"Uint8Array\"===e.constructor.name}function wI(e,...t){if(!yI(e))throw new Error(\"Uint8Array expected\");if(t.length>0&&!t.includes(e.length))throw new Error(\"Uint8Array expected of length \"+t+\", got length=\"+e.length)}function vI(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every(e=>\"string\"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function AI(e){if(\"function\"!=typeof e)throw new Error(\"function expected\");return!0}function bI(e,t){if(\"string\"!=typeof t)throw new Error(`${e}: string expected`);return!0}function SI(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function kI(e){if(!Array.isArray(e))throw new Error(\"array expected\")}function xI(e,t){if(!vI(!0,t))throw new Error(`${e}: array of strings expected`)}function EI(e,t){if(!vI(!1,t))throw new Error(`${e}: array of numbers expected`)}function II(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map(e=>e.encode).reduceRight(n,t),decode:e.map(e=>e.decode).reduce(n,t)}}function TI(e){const t=\"string\"==typeof e?e.split(\"\"):e,n=t.length;xI(\"alphabet\",t);const r=new Map(t.map((e,t)=>[e,t]));return{encode:r=>(kI(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet \"${r}\". Allowed: ${e}`);return t[r]})),decode:t=>(kI(t),t.map(t=>{bI(\"alphabet.decode\",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: \"${t}\". Allowed: ${e}`);return n}))}}function BI(e=\"\"){return bI(\"join\",e),{encode:t=>(xI(\"join.decode\",t),t.join(e)),decode:t=>(bI(\"join.decode\",t),t.split(e))}}function CI(e,t=\"=\"){return SI(e),bI(\"padding\",t),{encode(n){for(xI(\"padding.encode\",n);n.length*e%8;)n.push(t);return n},decode(n){xI(\"padding.decode\",n);let r=n.length;if(r*e%8)throw new Error(\"padding: invalid, string should have whole number of bytes\");for(;r>0&&n[r-1]===t;r--){if((r-1)*e%8==0)throw new Error(\"padding: invalid, string has too much padding\")}return n.slice(0,r)}}}function MI(e){return AI(e),{encode:e=>e,decode:t=>e(t)}}function PI(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(kI(e),!e.length)return[];let r=0;const i=[],o=Array.from(e,e=>{if(SI(e),e<0||e>=t)throw new Error(`invalid integer: ${e}`);return e}),a=o.length;for(;;){let e=0,s=!0;for(let i=r;i<a;i++){const a=o[i],c=t*e,u=c+a;if(!Number.isSafeInteger(u)||c/t!==e||u-a!==c)throw new Error(\"convertRadix: carry overflow\");const l=u/n;e=u%n;const d=Math.floor(l);if(o[i]=d,!Number.isSafeInteger(d)||d*n+e!==u)throw new Error(\"convertRadix: carry overflow\");s&&(d?s=!1:r=i)}if(i.push(e),s)break}for(let t=0;t<e.length-1&&0===e[t];t++)i.push(0);return i.reverse()}const _I=(e,t)=>0===t?e:_I(t,e%t),RI=(e,t)=>e+(t-_I(e,t)),OI=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function UI(e,t,n,r){if(kI(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(RI(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${RI(t,n)}`);let i=0,o=0;const a=OI[t],s=OI[n]-1,c=[];for(const r of e){if(SI(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<<t|r,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)c.push((i>>o-n&s)>>>0);const e=OI[o];if(void 0===e)throw new Error(\"invalid carry\");i&=e-1}if(i=i<<n-o&s,!r&&o>=t)throw new Error(\"Excess padding\");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&o>0&&c.push(i>>>0),c}function NI(e){SI(e);return{encode:t=>{if(!yI(t))throw new Error(\"radix.encode input should be Uint8Array\");return PI(Array.from(t),256,e)},decode:t=>(EI(\"radix.decode\",t),Uint8Array.from(PI(t,e,256)))}}function zI(e,t=!1){if(SI(e),e<=0||e>32)throw new Error(\"radix2: bits should be in (0..32]\");if(RI(8,e)>32||RI(e,8)>32)throw new Error(\"radix2: carry overflow\");return{encode:n=>{if(!yI(n))throw new Error(\"radix2.encode input should be Uint8Array\");return UI(Array.from(n),8,e,!t)},decode:n=>(EI(\"radix2.decode\",n),Uint8Array.from(UI(n,e,8,t)))}}function FI(e){return AI(e),function(...t){try{return e.apply(null,t)}catch(e){}}}function LI(e,t){return SI(e),AI(t),{encode(n){if(!yI(n))throw new Error(\"checksum.encode: input should be Uint8Array\");const r=t(n).slice(0,e),i=new Uint8Array(n.length+e);return i.set(n),i.set(r,n.length),i},decode(n){if(!yI(n))throw new Error(\"checksum.decode: input should be Uint8Array\");const r=n.slice(0,-e),i=n.slice(-e),o=t(r).slice(0,e);for(let t=0;t<e;t++)if(o[t]!==i[t])throw new Error(\"Invalid checksum\");return r}}}II(zI(4),TI(\"0123456789ABCDEF\"),BI(\"\")),II(zI(5),TI(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\"),CI(5),BI(\"\")),II(zI(5),TI(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\"),BI(\"\")),II(zI(5),TI(\"0123456789ABCDEFGHIJKLMNOPQRSTUV\"),CI(5),BI(\"\")),II(zI(5),TI(\"0123456789ABCDEFGHIJKLMNOPQRSTUV\"),BI(\"\")),II(zI(5),TI(\"0123456789ABCDEFGHJKMNPQRSTVWXYZ\"),BI(\"\"),MI(e=>e.toUpperCase().replace(/O/g,\"0\").replace(/[IL]/g,\"1\")));const DI=\"function\"==typeof Uint8Array.from([]).toBase64&&\"function\"==typeof Uint8Array.fromBase64,jI=(e,t)=>{bI(\"base64\",e);const n=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,r=t?\"base64url\":\"base64\";if(e.length>0&&!n.test(e))throw new Error(\"invalid base64\");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:\"strict\"})},$I=(DI||II(zI(6),TI(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"),CI(6),BI(\"\")),II(zI(6),TI(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"),BI(\"\")),DI||II(zI(6),TI(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\"),CI(6),BI(\"\")),II(zI(6),TI(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\"),BI(\"\")),e=>II(NI(58),TI(e),BI(\"\"))),KI=$I(\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\"),qI=e=>II(LI(4,t=>e(e(t))),KI),HI=II(TI(\"qpzry9x8gf2tvdw0s3jn54khce6mua7l\"),BI(\"\")),WI=[996825010,642813549,513874426,1027748829,705979059];function VI(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<WI.length;e++)1==(t>>e&1)&&(n^=WI[e]);return n}function GI(e,t,n=1){const r=e.length;let i=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);i=VI(i)^n>>5}i=VI(i);for(let t=0;t<r;t++)i=VI(i)^31&e.charCodeAt(t);for(let e of t)i=VI(i)^e;for(let e=0;e<6;e++)i=VI(i);return i^=n,HI.encode(UI([i%OI[30]],30,5,!1))}function ZI(e){const t=\"bech32\"===e?1:734539939,n=zI(5),r=n.decode,i=n.encode,o=FI(r);function a(e,n,r=90){bI(\"bech32.encode prefix\",e),yI(n)&&(n=Array.from(n)),EI(\"bech32.encode\",n);const i=e.length;if(0===i)throw new TypeError(`Invalid prefix length ${i}`);const o=i+7+n.length;if(!1!==r&&o>r)throw new TypeError(`Length ${o} exceeds limit ${r}`);const a=e.toLowerCase(),s=GI(a,n,t);return`${a}1${HI.encode(n)}${s}`}function s(e,n=90){bI(\"bech32.decode input\",e);const r=e.length;if(r<8||!1!==n&&r>n)throw new TypeError(`invalid string length: ${r} (${e}). Expected (8..${n})`);const i=e.toLowerCase();if(e!==i&&e!==e.toUpperCase())throw new Error(\"String must be lowercase or uppercase\");const o=i.lastIndexOf(\"1\");if(0===o||-1===o)throw new Error('Letter \"1\" must be present between prefix and data only');const a=i.slice(0,o),s=i.slice(o+1);if(s.length<6)throw new Error(\"Data must be at least 6 characters long\");const c=HI.decode(s).slice(0,-6),u=GI(a,c,t);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected \"${u}\"`);return{prefix:a,words:c}}return{encode:a,decode:s,encodeFromBytes:function(e,t){return a(e,i(t))},decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:FI(s),fromWords:r,fromWordsUnsafe:o,toWords:i}}ZI(\"bech32\"),ZI(\"bech32m\"),\"function\"==typeof Uint8Array.from([]).toHex&&\"function\"==typeof Uint8Array.fromHex||II(zI(4),TI(\"0123456789abcdef\"),BI(\"\"),MI(e=>{if(\"string\"!=typeof e||e.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));const JI=BigInt(0),YI=BigInt(1),XI=BigInt(2),QI=BigInt(8);class eT{constructor(e){this.ep=e}static fromBytes(e){tE()}static fromHex(e){tE()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return Up(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}}function tT(e,t,n={}){if(\"function\"!=typeof t)throw new Error('\"hash\" function param is required');eE(n,{},{adjustScalarBytes:\"function\",randomBytes:\"function\",domain:\"function\",prehash:\"function\",mapToCurve:\"function\"});const{prehash:r}=n,{BASE:i,Fp:o,Fn:a}=e,s=n.randomBytes||Xp,c=n.adjustScalarBytes||(e=>e),u=n.domain||((e,t,n)=>{if(Dx(n,\"phflag\"),t.length||n)throw new Error(\"Contexts/pre-hash are not supported\");return e});function l(e){return a.create(Hx(e))}function d(e){const{head:n,prefix:r,scalar:o}=function(e){const n=m.secretKey;e=Gx(\"private key\",e,n);const r=Gx(\"hashed private key\",t(e),2*n),i=c(r.slice(0,n));return{head:i,prefix:r.slice(n,2*n),scalar:l(i)}}(e),a=i.multiply(o),s=a.toBytes();return{head:n,prefix:r,scalar:o,point:a,pointBytes:s}}function f(e){return d(e).pointBytes}function h(e=Uint8Array.of(),...n){const i=Zp(...n);return l(t(u(i,Gx(\"context\",e),!!r)))}const p={zip215:!0};const g=o.BYTES,m={secretKey:g,publicKey:g,signature:2*g,seed:g};function y(e=s(m.seed)){return jx(e,m.seed,\"seed\")}const w={getExtendedPublicKey:d,randomSecretKey:y,isValidSecretKey:function(e){return Ap(e)&&e.length===a.BYTES},isValidPublicKey:function(t,n){try{return!!e.fromBytes(t,n)}catch(e){return!1}},toMontgomery(t){const{y:n}=e.fromBytes(t),r=m.publicKey,i=32===r;if(!i&&57!==r)throw new Error(\"only defined for 25519 and 448\");const a=i?o.div(YI+n,YI-n):o.div(n-YI,n+YI);return o.toBytes(a)},toMontgomerySecret(e){const n=m.secretKey;jx(e,n);const r=t(e.subarray(0,n));return c(r).subarray(0,n)},randomPrivateKey:y,precompute:(t=8,n=e.BASE)=>n.precompute(t,!1)};return Object.freeze({keygen:function(e){const t=w.randomSecretKey(e);return{secretKey:t,publicKey:f(t)}},getPublicKey:f,sign:function(e,t,n={}){e=Gx(\"message\",e),r&&(e=r(e));const{prefix:o,scalar:s,pointBytes:c}=d(t),u=h(n.context,o,e),l=i.multiply(u).toBytes(),f=h(n.context,l,c,e),p=a.create(u+f*s);if(!a.isValid(p))throw new Error(\"sign failed: invalid s\");return jx(Zp(l,a.toBytes(p)),m.signature,\"result\")},verify:function(t,n,o,a=p){const{context:s,zip215:c}=a,u=m.signature;t=Gx(\"signature\",t,u),n=Gx(\"message\",n),o=Gx(\"publicKey\",o,m.publicKey),void 0!==c&&Dx(c,\"zip215\"),r&&(n=r(n));const l=u/2,d=t.subarray(0,l),f=Hx(t.subarray(l,u));let g,y,w;try{g=e.fromBytes(o,c),y=e.fromBytes(d,c),w=i.multiplyUnsafe(f)}catch(e){return!1}if(!c&&g.isSmallOrder())return!1;const v=h(s,y.toBytes(),g.toBytes(),n);return y.add(g.multiplyUnsafe(v)).subtract(w).clearCofactor().is0()},utils:w,Point:e,lengths:m})}function nT(e){const{CURVE:t,curveOpts:n,hash:r,eddsaOpts:i}=function(e){const t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n={Fp:e.Fp,Fn:TE(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},r={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:n,hash:e.hash,eddsaOpts:r}}(e),o=function(e,t={}){const n=WE(\"edwards\",e,t,t.FpFnLE),{Fp:r,Fn:i}=n;let o=n.CURVE;const{h:a}=o;eE(t,{},{uvRatio:\"function\"});const s=XI<<BigInt(8*i.BYTES)-YI,c=e=>r.create(e),u=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(r.div(e,t))}}catch(e){return{isValid:!1,value:JI}}});if(!function(e,t,n,r){const i=e.sqr(n),o=e.sqr(r),a=e.add(e.mul(t.a,i),o),s=e.add(e.ONE,e.mul(t.d,e.mul(i,o)));return e.eql(a,s)}(r,o,o.Gx,o.Gy))throw new Error(\"bad curve params: generator point\");function l(e,t,n=!1){return Yx(\"coordinate \"+e,t,n?YI:JI,s),t}function d(e){if(!(e instanceof p))throw new Error(\"ExtendedPoint expected\")}const f=nE((e,t)=>{const{X:n,Y:i,Z:o}=e,a=e.is0();null==t&&(t=a?QI:r.inv(o));const s=c(n*t),u=c(i*t),l=r.mul(o,t);if(a)return{x:JI,y:YI};if(l!==YI)throw new Error(\"invZ was invalid\");return{x:s,y:u}}),h=nE(e=>{const{a:t,d:n}=o;if(e.is0())throw new Error(\"bad point: ZERO\");const{X:r,Y:i,Z:a,T:s}=e,u=c(r*r),l=c(i*i),d=c(a*a),f=c(d*d),h=c(u*t);if(c(d*c(h+l))!==c(f+c(n*c(u*l))))throw new Error(\"bad point: equation left != right (1)\");if(c(r*i)!==c(a*s))throw new Error(\"bad point: equation left != right (2)\");return!0});class p{constructor(e,t,n,r){this.X=l(\"x\",e),this.Y=l(\"y\",t),this.Z=l(\"z\",n,!0),this.T=l(\"t\",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){if(e instanceof p)throw new Error(\"extended point not allowed\");const{x:t,y:n}=e||{};return l(\"x\",t),l(\"y\",n),new p(t,n,YI,c(t*n))}static fromBytes(e,t=!1){const n=r.BYTES,{a:i,d:a}=o;e=Zx(jx(e,n,\"point\")),Dx(t,\"zip215\");const l=Zx(e),d=e[n-1];l[n-1]=-129&d;const f=Hx(l),h=t?s:r.ORDER;Yx(\"point.y\",f,JI,h);const g=c(f*f),m=c(g-YI),y=c(a*g-i);let{isValid:w,value:v}=u(m,y);if(!w)throw new Error(\"bad point: invalid y coordinate\");const A=(v&YI)===YI,b=!!(128&d);if(!t&&v===JI&&b)throw new Error(\"bad point: x=0 and x_0=1\");return b!==A&&(v=c(-v)),p.fromAffine({x:v,y:f})}static fromHex(e,t=!1){return p.fromBytes(Gx(\"point\",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return g.createCache(this,e),t||this.multiply(XI),this}assertValidity(){h(this)}equals(e){d(e);const{X:t,Y:n,Z:r}=this,{X:i,Y:o,Z:a}=e,s=c(t*a),u=c(i*r),l=c(n*a),f=c(o*r);return s===u&&l===f}is0(){return this.equals(p.ZERO)}negate(){return new p(c(-this.X),this.Y,this.Z,c(-this.T))}double(){const{a:e}=o,{X:t,Y:n,Z:r}=this,i=c(t*t),a=c(n*n),s=c(XI*c(r*r)),u=c(e*i),l=t+n,d=c(c(l*l)-i-a),f=u+a,h=f-s,g=u-a,m=c(d*h),y=c(f*g),w=c(d*g),v=c(h*f);return new p(m,y,v,w)}add(e){d(e);const{a:t,d:n}=o,{X:r,Y:i,Z:a,T:s}=this,{X:u,Y:l,Z:f,T:h}=e,g=c(r*u),m=c(i*l),y=c(s*n*h),w=c(a*f),v=c((r+i)*(u+l)-g-m),A=w-y,b=w+y,S=c(m-t*g),k=c(v*A),x=c(b*S),E=c(v*S),I=c(A*b);return new p(k,x,I,E)}subtract(e){return this.add(e.negate())}multiply(e){if(!i.isValidNot0(e))throw new Error(\"invalid scalar: expected 1 <= sc < curve.n\");const{p:t,f:n}=g.cached(this,e,e=>RE(p,e));return RE(p,[t,n])[0]}multiplyUnsafe(e,t=p.ZERO){if(!i.isValid(e))throw new Error(\"invalid scalar: expected 0 <= sc < curve.n\");return e===JI?p.ZERO:this.is0()||e===YI?this:g.unsafe(this,e,e=>RE(p,e),t)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return g.unsafe(this,o.n).is0()}toAffine(e){return f(this,e)}clearCofactor(){return a===YI?this:this.multiplyUnsafe(a)}toBytes(){const{x:e,y:t}=this.toAffine(),n=r.toBytes(t);return n[n.length-1]|=e&YI?128:0,n}toHex(){return Up(this.toBytes())}toString(){return`<Point ${this.is0()?\"ZERO\":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return RE(p,e)}static msm(e,t){return qE(p,i,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}p.BASE=new p(o.Gx,o.Gy,YI,c(o.Gx*o.Gy)),p.ZERO=new p(JI,YI,YI,JI),p.Fp=r,p.Fn=i;const g=new KE(p,i.BITS);return p.BASE.precompute(8),p}(t,n);return function(e,t){const n=t.Point;return Object.assign({},t,{ExtendedPoint:n,CURVE:e,nBitLength:n.Fn.BITS,nByteLength:n.Fn.BYTES})}(e,tT(o,r,i))}const rT=BigInt(0),iT=BigInt(1),oT=BigInt(2),aT=(BigInt(3),BigInt(5)),sT=BigInt(8),cT=BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed\"),uT={p:cT,n:BigInt(\"0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed\"),h:sT,a:BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec\"),d:BigInt(\"0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3\"),Gx:BigInt(\"0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a\"),Gy:BigInt(\"0x6666666666666666666666666666666666666666666666666666666666666658\")};function lT(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=cT,a=e*e%o*e%o,s=pE(a,oT,o)*a%o,c=pE(s,iT,o)*e%o,u=pE(c,aT,o)*c%o,l=pE(u,t,o)*u%o,d=pE(l,n,o)*l%o,f=pE(d,r,o)*d%o,h=pE(f,i,o)*f%o,p=pE(h,i,o)*f%o,g=pE(p,t,o)*u%o;return{pow_p_5_8:pE(g,oT,o)*e%o,b2:a}}function dT(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const fT=BigInt(\"19681161376707505956807079304988542015446066515923890162744021073123829784752\");function hT(e,t){const n=cT,r=hE(t*t*t,n),i=hE(r*r*t,n);let o=hE(e*r*lT(e*i).pow_p_5_8,n);const a=hE(t*o*o,n),s=o,c=hE(o*fT,n),u=a===e,l=a===hE(-e,n),d=a===hE(-e*fT,n);return u&&(o=s),(l||d)&&(o=c),bE(o,n)&&(o=hE(-o,n)),{isValid:u||l,value:o}}const pT=TE(uT.p,{isLE:!0}),gT=TE(uT.n,{isLE:!0}),mT={...uT,Fp:pT,hash:Ux,adjustScalarBytes:dT,uvRatio:hT},yT=nT(mT);const wT=fT,vT=BigInt(\"25063068953384623474111414158702152701244531502492656460079210482610430750235\"),AT=BigInt(\"54469307008909316920995813868745141605393597292927456921205312896311721017578\"),bT=BigInt(\"1159843021668779879193775521855586647937357759715417654439879720876111806838\"),ST=BigInt(\"40440834346308536858101042469323190826248399146238708352240133220865137265952\"),kT=e=>hT(iT,e),xT=BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"),ET=e=>yT.Point.Fp.create(Hx(e)&xT);function IT(e){const{d:t}=uT,n=cT,r=e=>pT.create(e),i=r(wT*e*e),o=r((i+iT)*bT);let a=BigInt(-1);const s=r((a-t*i)*r(i+t));let{isValid:c,value:u}=hT(o,s),l=r(u*e);bE(l,n)||(l=r(-l)),c||(u=l),c||(a=i);const d=r(a*(i-iT)*ST-s),f=u*u,h=r((u+u)*s),p=r(d*vT),g=r(iT-f),m=r(iT+f);return new yT.Point(r(h*m),r(g*p),r(p*m),r(h*g))}function TT(e){Sp(e,64);const t=IT(ET(e.subarray(0,32))),n=IT(ET(e.subarray(32,64)));return new BT(t.add(n))}class BT extends eT{constructor(e){super(e)}static fromAffine(e){return new BT(yT.Point.fromAffine(e))}assertSame(e){if(!(e instanceof BT))throw new Error(\"RistrettoPoint expected\")}init(e){return new BT(e)}static hashToCurve(e){return TT(Gx(\"ristrettoHash\",e,64))}static fromBytes(e){Sp(e,32);const{a:t,d:n}=uT,r=cT,i=e=>pT.create(e),o=ET(e);if(!function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}(pT.toBytes(o),e)||bE(o,r))throw new Error(\"invalid ristretto255 encoding 1\");const a=i(o*o),s=i(iT+t*a),c=i(iT-t*a),u=i(s*s),l=i(c*c),d=i(t*n*u-l),{isValid:f,value:h}=kT(i(d*l)),p=i(h*c),g=i(h*p*d);let m=i((o+o)*p);bE(m,r)&&(m=i(-m));const y=i(s*g),w=i(m*y);if(!f||bE(w,r)||y===rT)throw new Error(\"invalid ristretto255 encoding 2\");return new BT(new yT.Point(m,y,iT,w))}static fromHex(e){return BT.fromBytes(Gx(\"ristrettoHex\",e,32))}static msm(e,t){return qE(BT,yT.Point.Fn,e,t)}toBytes(){let{X:e,Y:t,Z:n,T:r}=this.ep;const i=cT,o=e=>pT.create(e),a=o(o(n+t)*o(n-t)),s=o(e*t),c=o(s*s),{value:u}=kT(o(a*c)),l=o(u*a),d=o(u*s),f=o(l*d*r);let h;if(bE(r*f,i)){let n=o(t*wT),r=o(e*wT);e=n,t=r,h=o(l*AT)}else h=d;bE(e*f,i)&&(t=o(-t));let p=o((n-t)*h);return bE(p,i)&&(p=o(-p)),pT.toBytes(p)}equals(e){this.assertSame(e);const{X:t,Y:n}=this.ep,{X:r,Y:i}=e.ep,o=e=>pT.create(e),a=o(t*i)===o(n*r),s=o(n*i)===o(t*r);return a||s}is0(){return this.equals(BT.ZERO)}}BT.BASE=new BT(yT.Point.BASE),BT.ZERO=new BT(yT.Point.ZERO),BT.Fp=pT,BT.Fn=gT;const CT=yT.CURVE,MT=\"ed25519\",PT=Lg(\"ed25519 seed\"),_T=e=>!0,RT=!1,OT=33,UT=(()=>{let e=!1;return(t,n)=>{e||(yT.ExtendedPoint.BASE._setWindowSize(4),e=!0);const r=yT.getPublicKey(t);return jg([new Uint8Array([0]),r])}})(),NT=(e,t)=>{throw new Error(\"Ed25519 does not support public key derivation.\")},zT=e=>e,FT=e=>e,LT=32,DT=\"slip10\",jT=33;const $T=yT.CURVE,KT=\"ed25519Bip32\",qT=Lg(\"\");function HT(e,t){const n=e[t];return Fr(void 0!==n,\"Private key is too short.\"),n}const WT=e=>!(7&HT(e,0))&&(!(128&HT(e,31))&&!(64&~HT(e,31))),VT=!0,GT=32,ZT=e=>{return xg(t=Ng(Uint8Array.from(e).reverse())),BigInt(Tg(t));var t},JT=e=>{const t=hE(ZT(e),$T.n);return yT.ExtendedPoint.BASE.multiply(t).toRawBytes()},YT=(e,t)=>JT(e.slice(0,32)),XT=(e,t)=>yT.ExtendedPoint.fromHex(Bg(Ng(e))).add(yT.ExtendedPoint.fromHex(Bg(Ng(t)))).toRawBytes(),QT=e=>e,eB=e=>e,tB=64,nB=\"cip3\",rB=32,iB={secp256k1:c,ed25519:e,ed25519Bip32:t};function oB(e){return iB[e]}function aB(e,t,n,r){kp(e);const i=function(e,t){if(void 0!==t&&\"[object Object]\"!=={}.toString.call(t))throw new Error(\"options should be object or undefined\");return Object.assign(e,t)}({dkLen:32,asyncTick:10},r),{c:o,dkLen:a,asyncTick:s}=i;if(bp(o),bp(a),bp(s),o<1)throw new Error(\"iterations (c) should be >= 1\");const c=Gp(t),u=Gp(n),l=new Uint8Array(a),d=zx.create(e,c),f=d._cloneInto().update(u);return{c:o,dkLen:a,asyncTick:s,DK:l,PRF:d,PRFSalt:f}}function sB(e,t,n,r,i){return e.destroy(),t.destroy(),r&&r.destroy(),Ip(i),n}const cB=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]);new Uint32Array(80);const uB=Math.pow(2,32);Array.from({length:64},(e,t)=>Math.floor(uB*Math.abs(Math.sin(t+1)))),cB.slice(0,4),new Uint32Array(16);const lB=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),dB=Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)),fB=dB.map(e=>(9*e+5)%16),hB=(()=>{const e=[[dB],[fB]];for(let t=0;t<4;t++)for(let n of e)n.push(n[t].map(e=>lB[e]));return e})(),pB=hB[0],gB=hB[1],mB=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),yB=pB.map((e,t)=>e.map(e=>mB[t][e])),wB=gB.map((e,t)=>e.map(e=>mB[t][e])),vB=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),AB=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function bB(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const SB=new Uint32Array(16);class kB extends Sx{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|i}process(e,t){for(let n=0;n<16;n++,t+=4)SB[n]=e.getUint32(t,!0);let n=0|this.h0,r=n,i=0|this.h1,o=i,a=0|this.h2,s=a,c=0|this.h3,u=c,l=0|this.h4,d=l;for(let e=0;e<5;e++){const t=4-e,f=vB[e],h=AB[e],p=pB[e],g=gB[e],m=yB[e],y=wB[e];for(let t=0;t<16;t++){const r=Cp(n+bB(e,i,a,c)+SB[p[t]]+f,m[t])+l|0;n=l,l=c,c=0|Cp(a,10),a=i,i=r}for(let e=0;e<16;e++){const n=Cp(r+bB(t,o,s,u)+SB[g[e]]+h,y[e])+d|0;r=d,d=u,u=0|Cp(s,10),s=o,o=n}}this.set(this.h1+a+u|0,this.h2+c+d|0,this.h3+l+r|0,this.h4+n+o|0,this.h0+i+s|0)}roundClean(){Ip(SB)}destroy(){this.destroyed=!0,Ip(this.buffer),this.set(0,0,0,0,0)}}const xB=Yp(()=>new kB);const EB=Ox;const IB=Ux;async function TB(e,t,n={}){if(n.hmacSha512)return await n.hmacSha512(e,t);if(ZC()){const n=await crypto.subtle.importKey(\"raw\",e,{name:\"HMAC\",hash:\"SHA-512\"},!1,[\"sign\"]),r=await crypto.subtle.sign(\"HMAC\",n,t);return new Uint8Array(r)}return zx(IB,e,t)}async function BB(e,t,n,r,i={}){if(i.pbkdf2Sha512)return await i.pbkdf2Sha512(e,t,n,r);if(ZC()){const i=await crypto.subtle.importKey(\"raw\",e,{name:\"PBKDF2\"},!1,[\"deriveBits\"]),o=await crypto.subtle.deriveBits({name:\"PBKDF2\",salt:t,iterations:n,hash:{name:\"SHA-512\"}},i,8*r);return new Uint8Array(o)}return await async function(e,t,n,r){const{c:i,dkLen:o,asyncTick:a,DK:s,PRF:c,PRFSalt:u}=aB(e,t,n,r);let l;const d=new Uint8Array(4),f=Tp(d),h=new Uint8Array(c.outputLen);for(let e=1,t=0;t<o;e++,t+=c.outputLen){const n=s.subarray(t,t+c.outputLen);f.setInt32(0,e,!1),(l=u._cloneInto(l)).update(d).digestInto(h),n.set(h.subarray(0,n.length)),await Hp(i-1,a,()=>{c._cloneInto(l).update(h).digestInto(h);for(let e=0;e<n.length;e++)n[e]^=h[e]})}return sB(c,u,s,l,h)}(IB,e,t,{c:n,dkLen:r})}function CB(e){return EB(e)}const MB=Symbol(\"Public key guard. Do not export this from the module.\");async function PB({path:e,node:t,curve:n,network:r},i,o){NB(t);const{childIndex:a,isHardened:s}=zB(e,t,n),c={chainCode:t.chainCodeBytes,childIndex:a,isHardened:s,depth:t.depth,parentFingerprint:t.fingerprint,masterFingerprint:t.masterFingerprint,curve:n,network:r};if(t.privateKeyBytes){const e=await RB({privateKey:t.privateKeyBytes,get publicKey(){return t.compressedPublicKeyBytes},childIndex:a,isHardened:s,curve:n}),r=await UB({chainCode:t.chainCodeBytes,extension:e},o);return await _B({privateKey:t.privateKeyBytes,get publicKey(){return t.publicKeyBytes},entropy:r,...c},i,o)}const u=OB({parentPublicKey:t.compressedPublicKeyBytes,childIndex:a}),l=await UB({chainCode:t.chainCodeBytes,extension:u},o);return await _B({publicKey:t.compressedPublicKeyBytes,entropy:l,...c},i,o)}async function _B(e,t,n){const{privateKey:r,publicKey:i,entropy:o,childIndex:a,isHardened:s,depth:c,parentFingerprint:u,masterFingerprint:l,curve:d,network:f}=e;try{return r?await async function({entropy:e,privateKey:t,depth:n,masterFingerprint:r,parentFingerprint:i,childIndex:o,isHardened:a,curve:s,network:c},u){const l=o+(a?vx:0),{privateKey:d,chainCode:f}=function({privateKey:e,entropy:t,curve:n}){const r=t.slice(0,32),i=t.slice(32);if(\"ed25519\"===n.name)return{privateKey:r,chainCode:i};const o=function(e,t,n){Fr(jC(t,32),\"Invalid tweak: Tweak must be a non-zero 32-byte Uint8Array.\");const r=zg(e),i=zg(t);if(i>=n.curve.n)throw new Error(\"Invalid tweak: Tweak is larger than the curve order.\");const o=hE(r+i,n.curve.n),a=Fg(o.toString(16).padStart(64,\"0\"));if(!n.isValidPrivateKey(a))throw new Error(\"Invalid private key or tweak: The resulting private key is invalid.\");return a}(e,r,n);return{privateKey:o,chainCode:i}}({privateKey:t,entropy:e,curve:s});return await IC.fromExtendedKey({privateKey:d,chainCode:f,depth:n+1,masterFingerprint:r,parentFingerprint:i,index:l,curve:s.name,network:c,guard:MB},u)}({entropy:o,privateKey:r,depth:c,masterFingerprint:l,parentFingerprint:u,childIndex:a,isHardened:s,curve:d,network:f},n):await async function({entropy:e,publicKey:t,depth:n,masterFingerprint:r,parentFingerprint:i,childIndex:o,curve:a,network:s},c){const{publicKey:u,chainCode:l}=function({publicKey:e,entropy:t,curve:n}){const r=t.slice(0,32),i=t.slice(32),o=n.publicAdd(e,r);return{publicKey:o,chainCode:i}}({publicKey:t,entropy:e,curve:a});return await IC.fromExtendedKey({publicKey:u,chainCode:l,depth:n+1,masterFingerprint:r,parentFingerprint:i,index:o,curve:a.name,network:s},c)}({entropy:o,publicKey:i,depth:c,masterFingerprint:l,parentFingerprint:u,childIndex:a,curve:d,network:f},n)}catch(r){return await _B(await t(r,e,n),t,n)}}async function RB({privateKey:e,publicKey:t,childIndex:n,isHardened:r,curve:i}){return r?jg([new Uint8Array([0]),e,GC(n+vx)]):(HC(t,i.compressedPublicKeyLength),OB({parentPublicKey:t,childIndex:n}))}function OB({parentPublicKey:e,childIndex:t}){return jg([e,GC(t)])}async function UB({chainCode:e,extension:t},n){return await TB(e,t,n)}function NB(e){Fr(e,\"Invalid parameters: Must specify a node to derive from.\")}function zB(e,t,n){!function(e,t,n){Fr(\"string\"==typeof e,\"Invalid path: Must be a string.\");const r=e.endsWith(\"'\");Fr(!r||t.privateKey,\"Invalid parameters: Cannot derive hardened child keys without a private key.\"),Fr(r||n.deriveUnhardenedKeys,`Invalid path: Cannot derive unhardened child keys with ${n.name}.`)}(e,t,n);const r=e.split(\"'\")[0];Fr(r);const i=parseInt(r,10);if(!px.test(r)||!Number.isInteger(i)||i<0||i>=vx)throw new Error(`Invalid path: The index must be a non-negative decimal integer less than ${vx}.`);return{childIndex:i,isHardened:e.includes(\"'\")}}function FB(e){Fr(e instanceof Uint8Array&&jC(e,dx),\"Invalid key: The key must be a 32-byte, non-zero Uint8Array.\");return LB(rM(e,!1))}function LB(e){return Fr(e instanceof Uint8Array&&jC(e,tM),\"Invalid key: The key must be a 65-byte, non-zero Uint8Array.\"),(t=e.slice(1),gg(t)).slice(-20);var t}async function DB(e,t){return Fr(\"secp256k1\"===e.curve.name,\"Invalid curve: Only secp256k1 is supported by BIP-32.\"),PB(e,jB,t)}async function jB(e,t,n){const{childIndex:r,privateKey:i,publicKey:o,isHardened:a,chainCode:s,curve:c}=t;if(zC(r+1),i){const e=await RB({privateKey:i,publicKey:c.compressPublicKey(o),childIndex:r+1,isHardened:a,curve:c}),u=await UB({chainCode:s,extension:e},n);return{...t,childIndex:r+1,entropy:u}}const u=OB({parentPublicKey:o,childIndex:r+1}),l=await UB({chainCode:s,extension:u});return{...t,childIndex:r+1,entropy:l}}var $B=n(91);const KB=[12,15,18,21,24];function qB(e){const t=e.split(\" \");Fr(KB.includes(t.length),\"Invalid mnemonic phrase: The mnemonic phrase must consist of 12, 15, 18, 21, or 24 words.\"),Fr(t.every(e=>mI.p.includes(e)),\"Invalid mnemonic phrase: The mnemonic phrase contains an unknown word.\")}async function HB(e,t=\"\",n){const r=`mnemonic${t}`.normalize(\"NFKD\");return await BB(function(e,t){if(\"string\"==typeof e)return qB(e),Lg(e.normalize(\"NFKD\"));const n=Array.from(new Uint16Array(e.buffer)).map(e=>t[e]).join(\" \");return qB(n),Lg(n)}(e,mI.p),Lg(r),2048,64,n)}function WB(e){return`bip39:${e.toLowerCase().trim()}`}function VB(e){return e instanceof Uint8Array?e:(Fr(e.startsWith(\"bip39:\"),'Invalid HD path segment: The BIP-39 path must start with \"bip39:\".'),e.slice(6))}async function GB({path:e,curve:t},n){const[r,...i]=e,o=VB(r),a=oB(t);switch(a.masterNodeGenerationSpec){case\"slip10\":return[await HB(o,\"\",n),...i];case\"cip3\":return[(0,$B.x2)(o,mI.p),...i];default:return Lr()}}async function ZB({path:e,curve:t,network:n},r){switch(Fr(e instanceof Uint8Array,\"Invalid path: The path must be a Uint8Array.\"),t.masterNodeGenerationSpec){case\"slip10\":return JB(e,t,n,r);case\"cip3\":return YB(e,t,n,r);default:throw new Error(\"Unsupported master node generation spec.\")}}async function JB(e,t,n,r){Fr(e.length>=16&&e.length<=64,\"Invalid seed: The seed must be between 16 and 64 bytes long.\");const i=await TB(t.secret,e,r),o=i.slice(0,dx),a=i.slice(dx);Fr(t.isValidPrivateKey(o),\"Invalid private key: The private key must greater than 0 and less than the curve order.\");const s=t.getPublicKey(o,!1),c=WC(t.compressPublicKey(s),t.compressedPublicKeyLength);return IC.fromExtendedKey({privateKey:o,publicKey:s,chainCode:a,masterFingerprint:c,network:n,depth:0,parentFingerprint:0,index:0,curve:t.name,guard:MB},r)}async function YB(e,t,n,r){Fr(e.length>=16&&e.length<=64,\"Invalid entropy: The entropy must be between 16 and 64 bytes long.\");const i=await BB(t.secret,e,4096,96,r);i[0]&=248,i[31]&=31,i[31]|=64;const o=i.slice(0,t.privateKeyLength),a=i.slice(t.privateKeyLength);Fr(t.isValidPrivateKey(o),\"Invalid private key.\");const s=t.getPublicKey(o,!1),c=WC(t.compressPublicKey(s),t.compressedPublicKeyLength);return IC.fromExtendedKey({privateKey:o,publicKey:s,chainCode:a,masterFingerprint:c,network:n,depth:0,parentFingerprint:0,index:0,curve:t.name,guard:MB},r)}const XB=e=>e.slice().reverse(),QB=e=>{const t=Ng(XB(e));return BigInt(t)},eC=e=>{const t=e.toString(16);return XB(Fg(t))},tC=e=>jg([e,new Uint8Array(Math.max(32-e.length,0)).fill(0)]),nC=e=>{const t=QB(e.slice(0,28))*BigInt(8);return tC(eC(t))},rC=e=>tC(eC(hE(QB(e),BigInt(2)**BigInt(256)))),iC=(e,t)=>{const n=QB(e)+QB(t);return tC(eC(n)).slice(0,32)},oC=(e,t,n)=>jg([new Uint8Array([e]),t,GC(n,!0)]),aC=2,sC=0,cC=async({parentNode:e,childIndex:t,isHardened:n},r)=>{const i=n?oC(sC,e.privateKeyBytes,t+vx):oC(aC,e.publicKeyBytes,t),o=await UB({chainCode:e.chainCodeBytes,extension:i},r),a=o.subarray(0,32),s=o.subarray(32),c=e.privateKeyBytes.subarray(0,32),u=e.privateKeyBytes.subarray(32);return jg([iC(nC(a),c),iC(s,u)])},uC=3,lC=1,dC=async({parentNode:e,childIndex:t,isHardened:n},r)=>{const i=n?oC(lC,e.privateKeyBytes,t+vx):oC(uC,e.publicKeyBytes,t);return(await UB({chainCode:e.chainCodeBytes,extension:i},r)).subarray(32)},fC=2,hC=async({parentNode:e,childIndex:t,curve:n},r)=>{const i=oC(fC,e.publicKeyBytes,t),o=(await UB({chainCode:e.chainCodeBytes,extension:i},r)).slice(0,32),a=n.getPublicKey(nC(o));return n.publicAdd(e.publicKeyBytes,a)};async function pC(e,t){const{curve:n,node:r,path:i}=e;NB(r);const{childIndex:o,isHardened:a}=zB(i,r,n);if(\"ed25519Bip32\"!==n.name||!r)throw new Error(\"Unsupported curve: Only ed25519Bip32 is supported by CIP3.\");const s=o+(a?vx:0),{privateKeyBytes:c,chainCodeBytes:u,publicKeyBytes:l,masterFingerprint:d,depth:f,fingerprint:h}=r;if(c){const e={privateKeyBytes:c,chainCodeBytes:u,publicKeyBytes:l},r=await cC({parentNode:e,childIndex:o,isHardened:a},t),i=await dC({parentNode:e,childIndex:o,isHardened:a},t);return IC.fromExtendedKey({privateKey:Ng(r),chainCode:Ng(i),masterFingerprint:d,depth:f+1,parentFingerprint:h,index:s,curve:n.name},t)}Fr(!a,\"Invalid parameters: Cannot derive hardened child keys without a private key.\");const p={chainCodeBytes:u,publicKeyBytes:l},g=await hC({parentNode:p,childIndex:o,isHardened:!1,curve:n},t),m=await dC({parentNode:p,childIndex:o,isHardened:!1},t);return IC.fromExtendedKey({publicKey:Ng(g),chainCode:Ng(m),masterFingerprint:d,depth:f+1,parentFingerprint:h,index:s,curve:n.name},t)}async function gC(e,t){return await PB(e,mC,t)}async function mC(e,t,n){const{curve:r,isHardened:i,childIndex:o,entropy:a,chainCode:s}=t;if(\"ed25519\"===r.name)throw e;const c=i?o+vx:o,u=await UB({chainCode:s,extension:jg([1,a.slice(32,64),GC(c)])},n);return{...t,entropy:u}}const yC={bip32:i,bip39:o,slip10:s,cip3:a};async function wC(e,t){const{path:n,depth:r=n.length}=e,i=\"node\"in e?e.node:void 0,o=\"network\"in e?e.network:i?.network,a=\"curve\"in e?e.curve:i?.curve;if(i&&!(i instanceof IC)&&!(i instanceof AM)&&!(i instanceof PC))throw new Error(\"Invalid arguments: Node must be a SLIP-10 node or a BIP-44 node when provided.\");if(!a)throw new Error(\"Invalid arguments: Must specify either a parent node or curve.\");return function(e,t,n){if(0===e.length)throw new Error(\"Invalid HD path segment: The segment must not be empty.\");let r=!1;if(e.forEach((e,t)=>{if(0===t){if(r=e instanceof Uint8Array||wx.test(e),!(e instanceof Uint8Array||r||gx.test(e)||mx.test(e)||yx.test(e)))throw vC()}else if(e instanceof Uint8Array||!gx.test(e)&&!mx.test(e)&&!yx.test(e))throw vC()}),0===n&&(!r||1!==e.length))throw new Error(`Invalid HD path segment: The segment must consist of a single BIP-39 node for depths of 0. Received: \"${String(e)}\".`);if(!t&&!r)throw new Error(\"Invalid derivation parameters: Must specify parent key if the first node of the path segment is not a BIP-39 node.\");if(t&&r)throw new Error(\"Invalid derivation parameters: May not specify parent key if the path segment starts with a BIP-39 node.\");const i=r?e.slice(1):e;if(i.length>0){const e=i[0]?.split(\":\")[0];Fr(e),Fr(i.every(t=>t.startsWith(`${e}:`)),\"Invalid HD path segment: Cannot mix 'bip32' and 'slip10' path segments.\")}}(n,Boolean(i?.privateKey)||Boolean(i?.publicKey),r),await n.reduce(async(e,n,r)=>{const i=await e;if(\"string\"==typeof n){const[e,r]=n.split(\":\");Fr(e),Fr(r),Fr(function(e){return e in yC}(e),`Unknown derivation type: \"${e}\".`);const s=yC[e];return await s.deriveChildKey({path:r,node:i,curve:oB(a),network:o},t)}return Fr(0===r,vC()),await yC.bip39.deriveChildKey({path:n,node:i,curve:oB(a),network:o},t)},Promise.resolve(i))}function vC(){return new Error(\"Invalid HD path segment: The path segment is malformed.\")}var AC,bC,SC,kC,xC=function(e,t,n,r){if(\"a\"===n&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof t?e!==t||!r:!t.has(e))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===n?r:\"a\"===n?r.call(e):r?r.value:t.get(e)},EC=function(e,t,n,r,i){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!i)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof t?e!==t||!i:!t.has(e))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?i.call(e,n):i?i.value=n:t.set(e,n),n};class IC{static async fromJSON(e,t){return AC.fromExtendedKey(e,t)}static async fromExtendedKey(e,t){if(\"string\"==typeof e){const n=pM(e),{chainCode:r,depth:i,parentFingerprint:o,index:a}=n;if(\"private\"===n.type){const{privateKey:e}=n;return AC.fromExtendedKey({depth:i,parentFingerprint:o,index:a,privateKey:e,chainCode:r,curve:\"secp256k1\"},t)}const{publicKey:s}=n;return AC.fromExtendedKey({depth:i,parentFingerprint:o,index:a,publicKey:s,chainCode:r,curve:\"secp256k1\"},t)}const{depth:n,masterFingerprint:r,parentFingerprint:i,index:o,network:a,privateKey:s,publicKey:c,chainCode:u,curve:l,guard:d}=e,f=KC(u,dx);VC(l),TC(n),zC(o),function(e,t){if(0===t&&0!==e)throw new Error(`Invalid index: The index of the root node must be 0. Received: \"${String(e)}\".`)}(o,n),function(e){if(void 0===e)return;if(\"string\"!=typeof e)throw new Error(\"Invalid network: Must be a string if specified.\");if(![\"mainnet\",\"testnet\"].includes(e))throw new Error('Invalid network: Must be either \"mainnet\" or \"testnet\" if specified.')}(a),function(e,t){if(!$C(e))throw new Error(`Invalid parent fingerprint: The fingerprint must be a positive integer. Received: \"${String(e)}\".`);if(0===t&&0!==e)throw new Error(`Invalid parent fingerprint: The fingerprint of the root node must be 0. Received: \"${String(e)}\".`);if(t>0&&0===e)throw new Error(`Invalid parent fingerprint: The fingerprint of a child node must not be 0. Received: \"${String(e)}\".`)}(i,n),function(e,t,n){if(!e)return;if(n>=2&&e===t)throw new Error(`Invalid parent fingerprint: The fingerprint of a child node cannot be equal to the master fingerprint. Received: \"${String(t)}\".`)}(r,i,n);const h=oB(l);if(s){const e=qC(s,h.privateKeyLength);Fr(h.isValidPrivateKey(e),`Invalid private key: Value is not a valid ${l} private key.`);const u=d===MB&&c?KC(c,h.publicKeyLength):void 0;return new AC({depth:n,masterFingerprint:r,parentFingerprint:i,index:o,network:a,chainCode:f,privateKey:e,publicKey:u,curve:l},t,xC(this,AC,\"f\",bC))}if(c){const e=KC(c,h.publicKeyLength);return new AC({depth:n,masterFingerprint:r,parentFingerprint:i,index:o,network:a,chainCode:f,publicKey:e,curve:l},t,xC(this,AC,\"f\",bC))}throw new Error(\"Invalid options: Must provide either a private key or a public key.\")}static async fromDerivationPath({derivationPath:e,network:t,curve:n},r){if(VC(n),!e)throw new Error(\"Invalid options: Must provide a derivation path.\");if(0===e.length)throw new Error(\"Invalid derivation path: May not specify an empty derivation path.\");const i=await GB({path:e,curve:n},r);return await wC({path:i,depth:e.length-1,network:t,curve:n},r)}static async fromSeed({derivationPath:e,network:t,curve:n},r){if(VC(n),\"ed25519Bip32\"===n)throw new Error('Invalid curve: The curve \"ed25519Bip32\" is not supported by the `fromSeed` function.');if(!e)throw new Error(\"Invalid options: Must provide a derivation path.\");if(0===e.length)throw new Error(\"Invalid derivation path: May not specify an empty derivation path.\");return await wC({path:e,depth:e.length-1,network:t,curve:n},r)}constructor({depth:e,masterFingerprint:t,parentFingerprint:n,index:r,network:i=\"mainnet\",chainCode:o,privateKey:a,publicKey:s,curve:c},u={},l){SC.set(this,void 0),kC.set(this,void 0),Fr(l===xC(AC,AC,\"f\",bC),\"SLIP10Node can only be constructed using `SLIP10Node.fromJSON`, `SLIP10Node.fromExtendedKey`, `SLIP10Node.fromDerivationPath`, or `SLIP10Node.fromSeed`.\"),Fr(void 0!==a||void 0!==s,\"SLIP10Node requires either a private key or a public key to be set.\"),this.depth=e,this.masterFingerprint=t,this.parentFingerprint=n,this.index=r,this.network=i,this.chainCodeBytes=o,this.privateKeyBytes=a,this.curve=c,EC(this,SC,s,\"f\"),EC(this,kC,u,\"f\"),Object.freeze(this)}get chainCode(){return Ng(this.chainCodeBytes)}get privateKey(){if(this.privateKeyBytes)return Ng(this.privateKeyBytes)}get publicKey(){return Ng(this.publicKeyBytes)}get publicKeyBytes(){return void 0!==xC(this,SC,\"f\")||(Fr(this.privateKeyBytes,\"Either a private key or public key is required.\"),EC(this,SC,oB(this.curve).getPublicKey(this.privateKeyBytes),\"f\")),xC(this,SC,\"f\")}get compressedPublicKeyBytes(){return oB(this.curve).compressPublicKey(this.publicKeyBytes)}get compressedPublicKey(){return Ng(this.compressedPublicKeyBytes)}get address(){if(\"secp256k1\"!==this.curve)throw new Error(\"Unable to get address for this node: Only secp256k1 is supported.\");return Ng(LB(this.publicKeyBytes))}get fingerprint(){return WC(this.compressedPublicKeyBytes,oB(this.curve).compressedPublicKeyLength)}get extendedKey(){Fr(\"secp256k1\"===this.curve,\"Unable to get extended key for this node: Only secp256k1 is supported.\");const e={depth:this.depth,parentFingerprint:this.parentFingerprint,index:this.index,network:this.network,chainCode:this.chainCodeBytes};return this.privateKeyBytes?gM({...e,type:\"private\",privateKey:this.privateKeyBytes}):gM({...e,type:\"public\",publicKey:this.publicKeyBytes})}neuter(){return new AC({depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,chainCode:this.chainCodeBytes,publicKey:this.publicKeyBytes,curve:this.curve,network:this.network},xC(this,kC,\"f\"),xC(AC,AC,\"f\",bC))}async derive(e){return await async function({path:e,node:t},n){if(0===e.length)throw new Error(\"Invalid HD tree derivation path: Deriving a path of length 0 is not defined.\");const r=t.depth+e.length;return TC(r),await wC({path:e,node:t,depth:r},n)}({path:e,node:this},xC(this,kC,\"f\"))}toJSON(){return{depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,network:this.network,curve:this.curve,privateKey:this.privateKey,publicKey:this.publicKey,chainCode:this.chainCode}}}function TC(e){if(!$C(e))throw new Error(`Invalid HD tree path depth: The depth must be a positive integer. Received: \"${String(e)}\".`)}AC=IC,SC=new WeakMap,kC=new WeakMap,bC={value:Symbol(\"SLIP10Node.constructor\")};var BC,CC=function(e,t,n,r,i){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!i)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof t?e!==t||!i:!t.has(e))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?i.call(e,n):i?i.value=n:t.set(e,n),n},MC=function(e,t,n,r){if(\"a\"===n&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof t?e!==t||!r:!t.has(e))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===n?r:\"a\"===n?r.call(e):r?r.value:t.get(e)};class PC{static async fromJSON(e,t,n){RC(t),_C(e.depth);const r=await AM.fromExtendedKey({depth:e.depth,index:e.index,network:e.network,parentFingerprint:e.parentFingerprint,chainCode:LC(e.chainCode),privateKey:DC(e.privateKey),publicKey:LC(e.publicKey)},n);return new PC(r,t)}static async fromDerivationPath(e,t,n){_C(e.length-1);const r=await AM.fromDerivationPath({derivationPath:e,network:t},n),i=JC(e);return new PC(r,i)}static async fromSeed({derivationPath:e,network:t},n){_C(e.length-1);const r=await AM.fromSeed({derivationPath:e,network:t},n),i=JC(e);return new PC(r,i)}static async fromNode(e,t){if(!(e instanceof AM))throw new Error(\"Invalid node: Expected an instance of BIP44Node.\");return RC(t),_C(e.depth),Promise.resolve(new PC(e,t))}constructor(e,t){BC.set(this,void 0),CC(this,BC,e,\"f\"),this.coin_type=t,this.path=function(e){return`m / ${hx} / ${OC(e)}`}(t),Object.freeze(this)}get depth(){return MC(this,BC,\"f\").depth}get privateKeyBytes(){return MC(this,BC,\"f\").privateKeyBytes}get publicKeyBytes(){return MC(this,BC,\"f\").publicKeyBytes}get chainCodeBytes(){return MC(this,BC,\"f\").chainCodeBytes}get privateKey(){return MC(this,BC,\"f\").privateKey}get publicKey(){return MC(this,BC,\"f\").publicKey}get compressedPublicKey(){return MC(this,BC,\"f\").compressedPublicKey}get compressedPublicKeyBytes(){return MC(this,BC,\"f\").compressedPublicKeyBytes}get chainCode(){return MC(this,BC,\"f\").chainCode}get address(){return MC(this,BC,\"f\").address}get masterFingerprint(){return MC(this,BC,\"f\").masterFingerprint}get parentFingerprint(){return MC(this,BC,\"f\").parentFingerprint}get fingerprint(){return MC(this,BC,\"f\").fingerprint}get index(){return MC(this,BC,\"f\").index}get network(){return MC(this,BC,\"f\").network}get curve(){return MC(this,BC,\"f\").curve}get extendedKey(){return MC(this,BC,\"f\").extendedKey}async deriveBIP44AddressKey({account:e=0,change:t=0,address_index:n}){return await MC(this,BC,\"f\").derive(function({account:e=0,change:t=0,address_index:n}){return[OC(e),NC(t),NC(n)]}({account:e,change:t,address_index:n}))}toJSON(){return{...MC(this,BC,\"f\").toJSON(),coin_type:this.coin_type,path:this.path}}}function _C(e){if(2!==e)throw new Error(`Invalid depth: Coin type nodes must be of depth 2. Received: \"${e}\"`)}function RC(e){if(\"number\"!=typeof e||!Number.isInteger(e)||e<0)throw new Error(\"Invalid coin type: The specified coin type must be a non-negative integer number.\")}function OC(e){return zC(e),`${UC(e)}'`}function UC(e){return zC(e),`bip32:${e}`}function NC(e){if(\"number\"==typeof e)return UC(e);if(!e||!Number.isInteger(e.index)||\"boolean\"!=typeof e.hardened)throw new Error(\"Invalid BIP-32 index: Must be an object containing the index and whether it is hardened.\");return e.hardened?OC(e.index):UC(e.index)}function zC(e){if(!($C(t=e)&&t<=fx))throw new Error(\"Invalid BIP-32 index: Must be a non-negative integer.\");var t}function FC(e){return e.endsWith(\"'\")}function LC(e){return e instanceof Uint8Array?e:Fg(e)}function DC(e){if(void 0!==e)return LC(e)}function jC(e,t){if(e.length!==t)return!1;for(const t of e)if(0!==t)return!0;return!1}function $C(e){return\"number\"==typeof e&&Number.isInteger(e)&&e>=0}function KC(e,t){if(e instanceof Uint8Array)return HC(e,t),e;if(\"string\"==typeof e){const n=Fg(e);return HC(n,t),n}throw new Error(\"Invalid value: Expected an instance of Uint8Array or hexadecimal string.\")}function qC(e,t){if(e instanceof Uint8Array)return Fr(e.length===t,`Invalid value: Must be a ${t}-byte byte array.`),e;if(\"string\"==typeof e)return qC(Fg(e),t);throw new Error(\"Invalid value: Expected an instance of Uint8Array or hexadecimal string.\")}function HC(e,t){if(!jC(e,t))throw new Error(`Invalid value: Must be a non-zero ${t}-byte byte array.`)}BC=new WeakMap;const WC=(e,t)=>{if(!jC(e,t))throw new Error(`Invalid public key: The key must be a ${t}-byte, non-zero byte array.`);var n;return $g((n=CB(e),xB(n))).getUint32(0,!1)};function VC(e){if(!e||\"string\"!=typeof e)throw new Error(\"Invalid curve: Must specify a curve.\");if(!Object.keys(iB).includes(e))throw new Error(`Invalid curve: Only the following curves are supported: ${Object.keys(iB).join(\", \")}.`)}function GC(e,t=!1){const n=new Uint8Array(4);return $g(n).setUint32(0,e,t),n}function ZC(){return Boolean(globalThis.crypto?.subtle)}function JC(e){const t=e[2].split(\":\")[1]?.replace(\"'\",\"\");Fr(t,\"Invalid derivation path: Coin type is not specified.\");const n=Number.parseInt(t,10);return Fr($C(n),\"Invalid derivation path: Coin type is not a valid integer.\"),n}const YC=gI.CURVE,XC=\"secp256k1\",QC=Lg(\"Bitcoin seed\"),eM=!0,tM=65,nM=e=>gI.utils.isValidPrivateKey(e),rM=(()=>{let e=!1;return(t,n=!1)=>(e||(gI.ProjectivePoint.BASE._setWindowSize(4),e=!0),gI.getPublicKey(t,n))})(),iM=(e,t)=>{Fr(jC(t,32),\"Invalid tweak: Tweak must be a non-zero 32-byte Uint8Array.\");const n=gI.ProjectivePoint.fromHex(e).add(gI.ProjectivePoint.fromPrivateKey(t));return n.assertValidity(),n.toRawBytes(!1)},oM=e=>gI.ProjectivePoint.fromHex(e).toRawBytes(!0),aM=e=>gI.ProjectivePoint.fromHex(e).toRawBytes(!1),sM=32,cM=\"slip10\",uM=33,lM=76067358,dM=76066276,fM=70617039,hM=70615956;const pM=e=>{const t=(e=>{const t=qI(CB);try{return t.decode(e)}catch{throw new Error(\"Invalid extended key: Value is not base58-encoded, or the checksum is invalid.\")}})(e);if(78!==t.length)throw new Error(`Invalid extended key: Expected a length of 78, got ${t.length}.`);const n=$g(t),r=n.getUint32(0,!1),{network:i,type:o}=function(e){switch(e){case lM:return{type:\"public\",network:\"mainnet\"};case fM:return{type:\"public\",network:\"testnet\"};case dM:return{type:\"private\",network:\"mainnet\"};case hM:return{type:\"private\",network:\"testnet\"};default:throw new Error(\"Invalid extended key: Expected a public (xpub) or private key (xprv) version.\")}}(r),a=n.getUint8(4);bM(a);const s=n.getUint32(5,!1),c=n.getUint32(9,!1),u=t.slice(13,45);if(!jC(u,32))throw new Error(\"Invalid extended key: Chain code must be a 32-byte non-zero byte array.\");const l=t.slice(45,78);if(!jC(l,33))throw new Error(\"Invalid extended key: Key must be a 33-byte non-zero byte array.\");const d=$g(l);if(\"public\"===o){if(2!==d.getUint8(0)&&3!==d.getUint8(0))throw new Error(\"Invalid extended key: Public key must start with 0x02 or 0x03.\");return{type:o,depth:a,parentFingerprint:s,index:c,network:i,chainCode:u,publicKey:aM(l)}}if(0!==d.getUint8(0))throw new Error(\"Invalid extended key: Private key must start with 0x00.\");return{type:o,depth:a,parentFingerprint:s,index:c,network:i,chainCode:u,privateKey:l.slice(1)}},gM=e=>{const{type:t,depth:n,parentFingerprint:r,index:i,network:o,chainCode:a}=e,s=new Uint8Array(78),c=$g(s),u=function(e,t){switch(e){case\"mainnet\":return\"public\"===t?lM:dM;case\"testnet\":return\"public\"===t?fM:hM;default:return Lr()}}(o,t);if(c.setUint32(0,u,!1),c.setUint8(4,n),c.setUint32(5,r,!1),c.setUint32(9,i,!1),s.set(a,13),\"public\"===t){const{publicKey:t}=e,n=oM(t);s.set(n,45)}if(\"private\"===t){const{privateKey:t}=e;s.set(t,46)}return l=s,qI(CB).encode(l);var l};var mM,yM,wM=function(e,t,n,r){if(\"a\"===n&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof t?e!==t||!r:!t.has(e))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===n?r:\"a\"===n?r.call(e):r?r.value:t.get(e)},vM=function(e,t,n,r,i){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!i)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof t?e!==t||!i:!t.has(e))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?i.call(e,n):i?i.value=n:t.set(e,n),n};class AM{static async fromJSON(e,t){return AM.fromExtendedKey(e,t)}static async fromExtendedKey(e,t){if(\"string\"==typeof e){const n=pM(e),{type:r,chainCode:i,depth:o,parentFingerprint:a,index:s,network:c}=n;if(\"private\"===r){const{privateKey:e}=n;return AM.fromExtendedKey({depth:o,parentFingerprint:a,index:s,network:c,privateKey:e,chainCode:i},t)}const{publicKey:u}=n;return AM.fromExtendedKey({depth:o,parentFingerprint:a,index:s,network:c,publicKey:u,chainCode:i},t)}const{privateKey:n,publicKey:r,chainCode:i,depth:o,parentFingerprint:a,index:s,network:c}=e;bM(o);const u=await IC.fromExtendedKey({privateKey:n,publicKey:r,chainCode:i,depth:o,parentFingerprint:a,index:s,network:c,curve:\"secp256k1\"},t);return new AM(u)}static async fromDerivationPath({derivationPath:e,network:t},n){bM(e.length-1),SM(e,0);const r=await IC.fromDerivationPath({derivationPath:e,network:t,curve:\"secp256k1\"},n);return new AM(r)}static async fromSeed({derivationPath:e,network:t},n){bM(e.length-1),SM(e,0);const r=await IC.fromSeed({derivationPath:e,network:t,curve:\"secp256k1\"},n);return new AM(r)}get depth(){return wM(this,mM,\"f\").depth}get privateKeyBytes(){return wM(this,mM,\"f\").privateKeyBytes}get publicKeyBytes(){return wM(this,mM,\"f\").publicKeyBytes}get chainCodeBytes(){return wM(this,mM,\"f\").chainCodeBytes}get privateKey(){return wM(this,mM,\"f\").privateKey}get publicKey(){return wM(this,mM,\"f\").publicKey}get compressedPublicKey(){return wM(this,mM,\"f\").compressedPublicKey}get compressedPublicKeyBytes(){return wM(this,mM,\"f\").compressedPublicKeyBytes}get chainCode(){return wM(this,mM,\"f\").chainCode}get address(){return wM(this,mM,\"f\").address}get masterFingerprint(){return wM(this,mM,\"f\").masterFingerprint}get parentFingerprint(){return wM(this,mM,\"f\").parentFingerprint}get fingerprint(){return wM(this,mM,\"f\").fingerprint}get index(){return wM(this,mM,\"f\").index}get network(){return wM(this,mM,\"f\").network}get extendedKey(){return wM(this,mM,\"f\").extendedKey}get curve(){return wM(this,mM,\"f\").curve}constructor(e){mM.set(this,void 0),vM(this,mM,e,\"f\"),Object.freeze(this)}neuter(){const e=wM(this,mM,\"f\").neuter();return new AM(e)}async derive(e){if(5===this.depth)throw new Error(\"Illegal operation: This HD tree node is already a leaf node.\");bM(this.depth+e.length),SM(e,this.depth+1);const t=await wM(this,mM,\"f\").derive(e);return new AM(t)}toJSON(){return{depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,network:this.network,privateKey:this.privateKey,publicKey:this.publicKey,chainCode:this.chainCode}}}function bM(e){if(TC(e),e<0||e>5)throw new Error(`Invalid HD tree path depth: The depth must be a positive integer N such that 0 <= N <= 5. Received: \"${e}\"`)}function SM(e,t){e.forEach((e,n)=>{const r=t+n;if(0!==r)switch(Fr(\"string\"==typeof e),r){case 1:if(e!==hx)throw new Error(`Invalid derivation path: The \"purpose\" node (depth 1) must be the string \"${hx}\".`);break;case 2:if(!gx.test(e)||!FC(e))throw new Error('Invalid derivation path: The \"coin_type\" node (depth 2) must be a hardened BIP-32 node.');break;case 3:if(!gx.test(e)||!FC(e))throw new Error('Invalid derivation path: The \"account\" node (depth 3) must be a hardened BIP-32 node.');break;case 4:if(!gx.test(e))throw new Error('Invalid derivation path: The \"change\" node (depth 4) must be a BIP-32 node.');break;case 5:if(!gx.test(e))throw new Error('Invalid derivation path: The \"address_index\" node (depth 5) must be a BIP-32 node.')}else if(!(e instanceof Uint8Array||wx.test(e)))throw new Error('Invalid derivation path: The \"m\" / seed node (depth 0) must be a BIP-39 node.')})}function kM(e){const{id:t,address:n,type:r,options:i,methods:o,scopes:a}=e;return{id:t,address:n,type:r,options:i,methods:o,scopes:a}}mM=new WeakMap,function(e){e.Devnet=\"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1\",e.Mainnet=\"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\",e.Testnet=\"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z\"}(yM||(yM={}));const xM=function(e){if(e.length>=255)throw new TypeError(\"Alphabet too long\");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const r=e.charAt(n),i=r.charCodeAt(0);if(255!==t[i])throw new TypeError(r+\" is ambiguous\");t[i]=n}const n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),o=Math.log(256)/Math.log(n);function a(e){if(\"string\"!=typeof e)throw new TypeError(\"Expected String\");if(0===e.length)return new Uint8Array;let o=0,a=0,s=0;for(;e[o]===r;)a++,o++;const c=(e.length-o)*i+1>>>0,u=new Uint8Array(c);for(;o<e.length;){const r=e.charCodeAt(o);if(r>255)return;let i=t[r];if(255===i)return;let a=0;for(let e=c-1;(0!==i||a<s)&&-1!==e;e--,a++)i+=n*u[e]>>>0,u[e]=i%256>>>0,i=i/256>>>0;if(0!==i)throw new Error(\"Non-zero carry\");s=a,o++}let l=c-s;for(;l!==c&&0===u[l];)l++;const d=new Uint8Array(a+(c-l));let f=a;for(;l!==c;)d[f++]=u[l++];return d}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError(\"Expected Uint8Array\");if(0===t.length)return\"\";let i=0,a=0,s=0;const c=t.length;for(;s!==c&&0===t[s];)s++,i++;const u=(c-s)*o+1>>>0,l=new Uint8Array(u);for(;s!==c;){let e=t[s],r=0;for(let t=u-1;(0!==e||r<a)&&-1!==t;t--,r++)e+=256*l[t]>>>0,l[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error(\"Non-zero carry\");a=r,s++}let d=u-a;for(;d!==u&&0===l[d];)d++;let f=r.repeat(i);for(;d<u;++d)f+=e.charAt(l[d]);return f},decodeUnsafe:a,decode:function(e){const t=a(e);if(t)return t;throw new Error(\"Non-base\"+n+\" character\")}}};const EM=xM(\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\"),IM=JSON.parse('{\"J6\":{\"t$\":{\"R\":{\"Wu\":[\"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\"]}}}}');async function TM({entropySource:e,path:t,curve:n}){return await snap.request({method:\"snap_getBip32Entropy\",params:{path:t,curve:n,...e?{source:e}:{}}})}async function BM({entropySource:e,derivationPath:t}){wh.log({derivationPath:t},\"Generating solana wallet\"),v(t,tk);const n=t.split(\"/\");try{const t=await TM({entropySource:e,path:n,curve:\"ed25519\"});if(!t.privateKey||!t.publicKey)throw new Error(\"Unable to derive private key\");return{privateKeyBytes:Fg(t.privateKey),publicKeyBytes:Fg(t.publicKey)}}catch(e){throw wh.error({error:e},\"Error deriving keypair\"),new Error(e)}}async function CM({coinTypeNode:e,accountIndex:t}){const n=await e.derive([`slip10:${t}'`,\"slip10:0'\"]);if(!n.privateKeyBytes||!n.publicKeyBytes)throw new Error(\"Unable to derive private key\");return{privateKeyBytes:n.privateKeyBytes,publicKeyBytes:n.publicKeyBytes}}function MM(e,t){try{v(e,t)}catch(e){throw new Ln(e.message)}}function PM(e,t){try{v(e,t)}catch(e){throw new On(\"Invalid Response\",{data:{cause:Un(e)}})}}const _M=K({...lt.schema,scope:XS,request:Pk}),RM=(K({scopes:te(U(XS)),entropySource:V(),groupIndex:ee($(),0)}),Wu()),OM=IM.J6.t$.R.Wu;var UM;!function(e){e.GetSelectedAccounts=\"getSelectedAccounts\"}(UM||(UM={}));K({method:L(UM.GetSelectedAccounts)});const NM=U(V());async function zM(e,t,n){await e.request({method:\"snap_manageAccounts\",params:{method:t,params:{...n}}})}async function FM(e){const t=await e.request({method:\"snap_manageAccounts\",params:{method:UM.GetSelectedAccounts}});return v(t,NM),t}class LM{#z=new Map;async run(e,t){const n=this.#z.get(e);if(n)return n;const r=Promise.resolve().then(t).finally(()=>{this.#z.delete(e)});return this.#z.set(e,r),r}}function DM(e){try{if(!(e instanceof Error))return String(e);const t=String(e),{cause:n}=e;return null==n?t:`${t} (${String(n)})`}catch{return\"Unknown error\"}}function jM(e,t){const n=[];return e.forEach((e,r)=>{const i=t[r];i&&\"rejected\"===e.status&&n.push({accountId:i,reason:DM(e.reason)})}),n}class $M extends Error{failures;constructor(e,t=[],n){const r=t.length>0?` (${t.length} failed): ${function(e){const t=e.slice(0,10),n=t.map(e=>{const t=e.reason.length>300?`${e.reason.slice(0,300)}…`:e.reason;return`${e.accountId}: ${t}`}),r=e.length-t.length,i=r>0?`; +${r} more`:\"\";return`${n.join(\"; \")}${i}`}(t)}`:\"\";super(`${e}${r}`,n),this.name=\"SynchronizationError\",this.failures=t}}function KM(e,t,n=\"\"){const r=t.id,i=go(t.chainId),o=t.metadata.decimals??0,a=t.metadata.symbol??\"\",{amount:s}=t.balance,{assetNamespace:c,assetReference:u}=tt(r);if(\"slip44\"===c)return{assetType:r,keyringAccountId:e,network:i,address:n,symbol:a,decimals:o,rawAmount:AS(s,o),uiAmount:s};if(\"token\"===c)return{assetType:r,keyringAccountId:e,network:i,mint:u,symbol:a,decimals:o,rawAmount:AS(s,o),uiAmount:s};throw new Error(`Unsupported Solana asset namespace: \"${c}\"`)}const qM=K({metamask:H(K({correlationId:E}))});var HM;!function(e){e.AccountCreated=\"notify:accountCreated\",e.AccountUpdated=\"notify:accountUpdated\",e.AccountDeleted=\"notify:accountDeleted\",e.RequestApproved=\"notify:requestApproved\",e.RequestRejected=\"notify:requestRejected\",e.AccountBalancesUpdated=\"notify:accountBalancesUpdated\",e.AccountAssetListUpdated=\"notify:accountAssetListUpdated\",e.AccountTransactionsUpdated=\"notify:accountTransactionsUpdated\"}(HM||(HM={}));K({method:L(`${HM.AccountCreated}`),params:K({account:rt,accountNameSuggestion:H(V()),displayConfirmation:H(N()),displayAccountNameSuggestion:H(N()),...qM.schema})}),K({method:L(`${HM.AccountUpdated}`),params:K({account:rt})}),K({method:L(`${HM.AccountDeleted}`),params:K({id:E})}),K({method:L(`${HM.RequestApproved}`),params:K({id:E,result:he})}),K({method:L(`${HM.RequestRejected}`),params:K({id:E})}),K({method:L(`${HM.AccountBalancesUpdated}`),params:K({balances:W(I,W(He,zh))})}),K({method:L(`${HM.AccountTransactionsUpdated}`),params:K({transactions:W(I,U(Zh))})}),K({method:L(`${HM.AccountAssetListUpdated}`),params:K({assets:W(I,K({added:U(Ve),removed:U(Ve)}))})});function WM(e,t){return new br(e.toString()).div(10**t).toFixed()}function VM(e){return e.split(\"/\")[0]}function GM(e,t){return`${e}/token:${t}`}class ZM{#w;#F;#L;#D;#j;#$;#K;#q;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*uo.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,accountsService:i,tokenApiClient:o,cache:a,nftApiClient:s}){this.#w=t.withPrefix(\"[🪙 SnapAssetsAdapter]\"),this.#F=e,this.#L=n,this.#D=r,this.#j=i,this.#$=o,this.#K=a,this.#q=s}#H(e){return{nativeAssetTypes:e.filter(e=>e.endsWith(vo)),tokenAssetTypes:e.filter(e=>e.includes(\"/token:\")),nftAssetTypes:e.filter(e=>e.includes(\"/nft:\"))}}#W(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:i,assetReference:o}=tt(n);t[n]={name:\"Solana\",symbol:\"SOL\",fungible:!0,iconUrl:`${this.#L.config.staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${i}/${o}.png`,units:[{name:\"Solana\",symbol:\"SOL\",decimals:9}]}}return t}async#V(e){const t=await this.#q.getNftsMetadata(e.map(e=>{const{assetReference:t}=tt(e);return t})),n={};return e.forEach((e,r)=>{const i=t[r];if(!i)return;const o={name:i.name,symbol:i.name,imageUrl:i.imageUrl,description:i.description,fungible:!1,isPossibleSpam:!1,attributes:Object.fromEntries(i.attributes.map(e=>[e.key,e.value])),collection:{name:i.collectionName,address:i.onchainCollectionAddress,symbol:i.collectionSymbol,tokenCount:i.collectionCount,creator:\"\",imageUrl:i.collectionImageUrl??\"\"}};n[e]=o}),n}async getAssetsMetadata(e){this.#w.log(\"Fetching metadata for assets\",e);const{nativeAssetTypes:t,tokenAssetTypes:n}=this.#H(e),[r,i]=await Promise.all([this.#W(t),this.#$.getTokensMetadata(n)]);return{...r,...i}}async#G(e,t,n){try{const r=jM(t,n);if(0===r.length)return;this.#w.warn(e,{failures:r}),await Th(new $M(e,r))}catch(e){this.#w.warn(\"Failed to track error\",{trackingError:e})}}async#Z(e,t=[Cy,Bb],n=[ho.Mainnet]){if(0===t.length||0===n.length)return[];const r=e.flatMap(e=>t.flatMap(t=>n.map(n=>({account:e,programId:t,scope:n})))),i=vh(this.#J.bind(this),this.#K,{functionName:\"SnapAssetsAdapter:fetchTokenAccounts\",ttlMilliseconds:ZM.cacheTtlsMilliseconds.tokenAccountsByOwner,generateCacheKey:(e,t)=>{const[n,r,i]=t;return`${e}:${n.id}:${r}:${i}`}}),o=await Promise.allSettled(r.map(async({account:e,programId:t,scope:n})=>await i(e,t,n)));return await this.#G(\"Failed to fetch token accounts\",o,r.map(({account:e})=>e.id)),o.flatMap(e=>\"fulfilled\"===e.status?e.value:[])}async#J(e,t=Cy,n=ho.Mainnet){return(await this.#F.getRpc(n).getTokenAccountsByOwner(qu(e.address),{programId:t},{encoding:\"jsonParsed\"}).send()).value.map(t=>({token:t,scope:n,assetType:GM(n,t.account.data.parsed.info.mint),keyringAccount:e}))}async fetchAccountAssets(e){const[t,n]=await Promise.all([this.#Y(e),this.#Z([e],[Cy,Bb],await this.#L.getActiveNetworks())]),r=n.map(e=>e.assetType),i=await this.#$.getTokensMetadata(r),o=new Map;n.filter(e=>e.assetType.includes(\"/token:\")).forEach(e=>{const{assetType:t,scope:n,keyringAccount:r}=e,{mint:a,tokenAmount:s}=e.token.account.data.parsed.info,{decimals:c,amount:u,uiAmountString:l}=s,d=`${r.id}:${n}:${a}`,f=o.get(d);if(f)return f.rawAmount=(BigInt(f.rawAmount)+BigInt(u)).toString(),void(f.uiAmount=new Ar(f.uiAmount).plus(l??WM(u,c)).toFixed());o.set(d,{assetType:t,keyringAccountId:r.id,network:n,mint:a,symbol:i[t]?.symbol??\"UNKNOWN\",decimals:c,rawAmount:u,uiAmount:l??WM(u,c)})});return[...t,...[...o.values()]]}async getNativeAssetTypes(){return(await this.#L.getActiveNetworks()).map(e=>`${e}/${vo}`)}async#Y(e){const t=await this.getNativeAssetTypes(),n=qu(e.address),r=t.map(async t=>{const r=await this.#F.getRpc(VM(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:VM(t),address:n,symbol:\"SOL\",decimals:9,rawAmount:r.value.toString(),uiAmount:WM(r.value,9)}}),i=await Promise.allSettled(r);return await this.#G(\"Failed to fetch native balances\",i,i.map(()=>e.id)),i.flatMap(e=>\"fulfilled\"===e.status?e.value:[])}async#X(e,t){const n=qu(e.address),r=await this.#q.listAddressSolanaNfts(n),i={};for(const e of t){const{assetReference:t}=tt(e),n=r.find(e=>e.tokenAddress===t);n&&(i[e]={unit:n.nftToken.name,amount:n.balance.toString()})}return i}async save(e){await this.saveMany([e])}async saveMany(e){this.#w.info(\"Saving assets without emitting keyring events\",e),await this.#D.saveMany(e)}async saveManyAndEmit(e){this.#w.info(\"Saving assets\",e);const t=e=>\"0\"===e.rawAmount||\"0\"===e.uiAmount;await this.getAll();await this.#D.saveMany(e);const n=e=>t(e)&&!(e=>e.assetType.includes(vo))(e),r=e=>!n(e)&&!0,i=e.reduce((e,t)=>({...e,[t.keyringAccountId]:{added:[...e[t.keyringAccountId]?.added??[],...r(t)?[t.assetType]:[]],removed:[...e[t.keyringAccountId]?.removed??[],...n(t)?[t.assetType]:[]]}}),{}),o=Object.values(i).map(e=>e.added.length+e.removed.length).every(e=>0===e);o||await zM(snap,HM.AccountAssetListUpdated,{assets:i});const a=e.filter(()=>!0).reduce((e,t)=>({...e,[t.keyringAccountId]:{...e[t.keyringAccountId]??{},[t.assetType]:{unit:t.symbol,amount:t.uiAmount}}}),{});Object.values(a).map(e=>Object.keys(e).length).some(e=>e>0)&&await zM(snap,HM.AccountBalancesUpdated,{balances:a})}static hasChanged(e,t){const n=t.find(t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType);if(!n)return!0;const r=n.rawAmount!==e.rawAmount,i=n.uiAmount!==e.uiAmount;return r||i}async getAll(){return this.#D.getAll()}async#Q(e){const t=await this.#j.findById(e);return t?this.findByAccount(t):[]}async getAccountAssetByID(e,t){return(await this.getAccountAssetsByIDs(e,[t]))[t]??null}async getAccountAssetsByIDs(e,t){if(0===t.length)return{};const n=await this.#Q(e),r=new Map(n.map(e=>[e.assetType,e]));return Object.fromEntries(t.map(e=>[e,r.get(e)??null]))}async getAccountAssetsByScope(e,t){return(await this.#Q(t)).filter(t=>t.assetType.startsWith(e))}async getAccountAssets(e){const t=await this.#L.getActiveNetworks();return(await this.#Q(e)).filter(e=>t.some(t=>e.assetType.startsWith(t)))}async findByAccount(e){const{id:t,address:n}=e,r=await this.#D.findByKeyringAccountId(t),i=await this.getNativeAssetTypes(),o=[];for(const t of i){if(!r.some(e=>e.assetType===t)){const r=VM(t);o.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:\"SOL\",decimals:9,rawAmount:\"0\",uiAmount:\"0\"})}}return[...r,...o]}}var JM;!function(e){e[e.Off=0]=\"Off\",e[e.ReadAssetsControllerWithFallback=1]=\"ReadAssetsControllerWithFallback\",e[e.ReadAssetsControllerWithoutFallback=2]=\"ReadAssetsControllerWithoutFallback\",e[e.ReadAssetsControllerOnly=3]=\"ReadAssetsControllerOnly\"}(JM||(JM={}));const YM={solana:\"networkAssetsSnapsMigrationSolana\",stellar:\"networkAssetsSnapsMigrationStellar\",tron:\"networkAssetsSnapsMigrationTron\"};function XM(e){if(\"object\"!=typeof e||null===e||Array.isArray(e))return JM.Off;const{value:t}=e,n=\"object\"!=typeof t||null===t||Array.isArray(t)?e:t,{stage:r}=n;switch(r){case JM.ReadAssetsControllerWithFallback:case JM.ReadAssetsControllerWithoutFallback:case JM.ReadAssetsControllerOnly:return r;default:return JM.Off}}new Uint8Array([105,37,101,197,75,251,102,26]);new Uint8Array([43,34,13,49,167,88,235,235]),new Uint8Array([157,105,42,146,102,85,241,174]);function QM(e,t,n){const r=t-e;if(r<0)throw new Error(\"Invalid timespan: end time before start time\");const i=n*r/31556736e4;return Math.exp(i)}function eP({currentTimestamp:e,lastUpdateTimestamp:t,initializationTimestamp:n,preUpdateAverageRate:r,currentRate:i}){return QM(n,t,r)*QM(t,e,i)}function tP(e){return Math.pow(10,e)}var nP=18446744073709551615n,rP=/^[+-]?(?:inf(?:inity)?|nan|(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)$/i;function iP(e){if(!rP.test(e))throw new Error(`Invalid ui amount: ${e}`);return/inf/i.test(e)?e.startsWith(\"-\")?-1/0:1/0:Number(e)}function oP(e,t){if(Number.isNaN(e)||e<0||e>Number(nP))throw new Error(`Amount out of range: ${e}`);const n=BigInt(\"round\"===t?Math.round(e):Math.trunc(e));return n>nP?nP:n}function aP(e,t,n,r,i,o,a){return oP(iP(e)/(eP({currentTimestamp:n,lastUpdateTimestamp:r,initializationTimestamp:i,preUpdateAverageRate:o,currentRate:a})/tP(t)),\"round\")}function sP(e,t,n){return oP(iP(e)/(n/tP(t)),\"trunc\")}const cP=Al(5000n);class uP{#ee;constructor(e){this.#ee=e}#te(){const e=this.#ee.getComputeUnitLimit(),t=this.#ee.getComputeUnitPriceMicroLamportsPerComputeUnit();return bl(e,e=>br(e),e=>e.multipliedBy(t.toString()),e=>e.dividedToIntegerBy(lo.toString()),e=>e.toString(),BigInt,Al)}getFee(){const e=this.#te();return Al(cP+e)}}const lP=\"Sending to this address may result in permanent loss of funds.\";class dP extends Error{constructor(e,t){super(e,t),this.name=\"RecipientClassificationError\"}}class fP extends dP{constructor(){super(`Cannot send to this address. This appears to be a mint account, program data account, metadata account, or PDA. ${lP} Only wallet addresses and token accounts are supported.`),this.name=\"RecipientUnsupportedError\"}}class hP extends dP{constructor(){super(`Cannot send to this address. This is a token account for a different token than the one you're trying to send. ${lP}`),this.name=\"RecipientTokenAccountMintMismatchError\"}}class pP{#ne;#re;#F;#w;#ie=4e4;#oe=10000n;constructor(e,t,n,r){this.#ne=e,this.#re=t,this.#F=n,this.#w=r.withPrefix(\"[📩 SendSplTokenBuilder]\")}async buildTransactionMessage(e){this.#w.log(\"Build transfer SPL token transaction message\");const{from:{entropySource:t,derivationPath:n},to:r,mint:i,amount:o,network:a}=e;Fr(i,\"Mint is required\");const s=await this.#re.classify(r,a);if(\"UNSUPPORTED\"===s.type)throw new fP;const[c,u,{privateKeyBytes:l},d]=await Promise.all([this.#F.fetchMint(i,a),this.#ne.uiAmountToAmountForMint(i,a,o.toString()),BM({entropySource:t,derivationPath:n}),this.#F.getLatestBlockhash(a)]),{programAddress:f,data:{decimals:h}}=c,p=await If(l),g=await pP.deriveAssociatedTokenAccountAddress({mint:i,owner:p.address,tokenProgram:f}),m=[],y=f===Bb,w=y?Uw:jm,v=y?LA:xy;switch(s.type){case\"SYSTEM\":{const e=await pP.deriveAssociatedTokenAccountAddress({mint:i,owner:r,tokenProgram:f});m.push(w({mint:i,payer:p,tokenProgram:f,owner:r,ata:e})),m.push(v({source:g,mint:i,destination:e,authority:p,amount:u,decimals:h}));break}case\"TOKEN_ACCOUNT\":if(s.mint!==i)throw new hP;m.push(v({source:g,mint:i,destination:r,authority:p,amount:u,decimals:h}));break;default:throw new fP}const A=bl(Nd({version:0}),e=>zd(p.address,e),e=>kl(d,e),e=>_d(m,e));return Rd([em({units:this.#ie}),om({microLamports:this.#oe})],A)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await zm({mint:e,owner:t,tokenProgram:n}))[0]}getComputeUnitLimit(){return this.#ie}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#oe}}class gP{#F;#w;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#F=e,this.#w=t.withPrefix(\"[🖋️ Signer]\")}async partiallySignBase64String(e,t,n,r,i){this.#w.log(\"Partially sign base64 string\",{base64String:e,account:t,network:n,config:r});const o=\"metamask\"===i;if(\"dapp\"===i){const n=await(async e=>Lb([Kb(e),qb(e)]))(e);return this.#ae(n,t)}const a=this.#F.getRpc(n),s=await Hb(e,a,r);if(\"instructions\"in s)return this.#se(s,t,n,\"metamask\"===i);if(Object.values(s.signatures).every(e=>!e)){const{messageBytes:e}=s,i=await jb(e,a,r);return this.#se(i,t,n,o)}return this.#ae(s,t)}async#se(e,t,n,r){const i=Sl(e)&&!r?e.lifetimeConstraint:await this.#F.getLatestBlockhash(n),o=sS(e),a=gP.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,s=!uS(e)||!o,{privateKeyBytes:c}=await BM({entropySource:t.entropySource,derivationPath:t.derivationPath}),u=await If(c),l=await bl(e,e=>oS(u.address,e),e=>kl(i,e),e=>{return n={microLamports:a},sS(t=e)?t:Rd([om(n,r)],t);var t,n,r},async e=>s?lS(e,this.#F.getRpc(n)):e),d=xf([u],l);return await Bf(d)}async#ae(e,t){const{privateKeyBytes:n}=await BM({entropySource:t.entropySource,derivationPath:t.derivationPath});return ff([await yl(n)],e)}}const mP=(e,t)=>{const{to:n,type:r,status:i}=e,{address:o}=t;if(!(r===Hh.Receive||i===qh.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce((e,t)=>t.address!==o||!t.asset?.fungible||t.asset.type!==mo.SolMainnet&&t.asset.type!==mo.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)},{hasReceivedSOL:!1,receivedSOLAmount:new br(0)});return a&&s.isLessThan(.001)};function yP(e,t){return[mP].some(n=>n(e,t))}class wP{#ce;#ue;#le;#de;#fe;#ne;#L;#w;#he=[Cy,Bb];constructor(e,t,n,r,i,o,a,s){this.#ce=e,this.#ue=t,this.#le=n,this.#de=r,this.#fe=i,this.#ne=o,this.#L=a,this.#w=s.withPrefix(\"[🗝️ KeyringAccountMonitor]\"),this.#pe()}#pe(){this.#w.info(\"Binding handlers\"),Po.forEach(e=>{this.#ce.registerNotificationHandler(\"accountSubscribe\",e,this.#ge.bind(this)),this.#ce.registerNotificationHandler(\"programSubscribe\",e,this.#me.bind(this))}),Po.forEach(e=>{this.#ce.registerConnectionRecoveryHandler(e,this.#ye.bind(this))})}async setMonitoredAccounts(e){this.#w.info(\"Setting monitored accounts\",e);const[t,n,r]=await Promise.all([this.#ue.getAll(),this.#ce.getAll(),this.#L.getActiveNetworks()]),i=t.filter(e=>n.some(t=>e.address===(0,Br.get)(t,\"params[0]\")||e.address===(0,Br.get)(t,\"params[1].filters[0].memcmp.bytes\"))),o=i.filter(t=>!e.includes(t.id)),a=t.filter(t=>e.includes(t.id)).filter(e=>!i.includes(e));await Promise.allSettled([this.#we(o,n),this.#ve(a,r)])}async#ve(e,t){try{this.#w.log(\"Monitoring keyring accounts\",e);const n=this.#fe.synchronize(e),r=e.flatMap(e=>{const n=t=>e.scopes.includes(t);return[...t.filter(n).map(async t=>this.#Ae(e,t)),...t.filter(n).map(async t=>{await Promise.all(this.#he.map(async n=>this.#be(e,n,t)))})]});await Promise.allSettled([...r,n])}catch(e){throw this.#w.error(\"Error monitoring keyring account\",e),e}}async#we(e,t){this.#w.log(\"Stopping to monitor accounts\",e);const n=e.map(e=>e.address),r=t.filter(e=>wP.#Se(e)||wP.#ke(e)).filter(e=>n.includes(wP.#xe(e)));await Promise.allSettled(r.map(async e=>this.#ce.unsubscribe(e.id)))}async#Ae(e,t){this.#w.log(\"Monitoring native asset balance\",{account:e,network:t});const{address:n}=e;await this.#ce.subscribe({method:\"accountSubscribe\",network:t,params:[n,{commitment:\"confirmed\",encoding:\"jsonParsed\"}]})}async#be(e,t,n){this.#w.log(\"Monitoring token program by owner\",{account:e,tokenProgramAddress:t,network:n});const{address:r}=e;await this.#ce.subscribe({method:\"programSubscribe\",network:n,params:[t,{commitment:\"confirmed\",encoding:\"jsonParsed\",filters:[{memcmp:{offset:32,bytes:r,encoding:\"base58\"}}]}]})}async#ge(e,t){this.#w.info(\"Account notification received\",{notification:e,subscription:t});const{network:n}=t,r=(0,Br.get)(t,\"params[0]\");v(r,V());const i=await this.#ue.findByAddress(r);if(!i)throw new Error(`No keyring account found for address: ${r}`);const{lamports:o}=e.params.result.value;v(o,$());await Promise.all([this.#le.save({assetType:`${n}/${vo}`,keyringAccountId:i.id,network:n,address:r,symbol:\"SOL\",decimals:9,rawAmount:o.toString(),uiAmount:WM(o,9)}),this.#Ee(i,n,r)])}async#me(e,t){this.#w.info(\"Handling program notification\",{notification:e,subscription:t});const{network:n}=t,r=(0,Br.get)(t,\"params[0]\");if(v(r,V()),r!==Cy&&r!==Bb)throw new Error(`Program not supported: ${r}`);const{owner:i}=e.params.result.value.account.data.parsed.info;v(i,V());const{mint:o}=e.params.result.value.account.data.parsed.info;v(o,V());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;v(a,V()),v(s,$()),v(c,V());const{pubkey:u}=e.params.result.value;v(u,V());const l=GM(n,o),d=await this.#ue.findByAddress(i);if(!d)throw new Error(`No keyring account found with address: ${i}`);const f=await this.#ne.amountToUiAmountForMint(o,n,Al(BigInt(a))).catch(async e=>(await Th(e),this.#w.error(\"Error converting amount to uiAmount\",e),c)),h=(await this.#le.getAssetsMetadata([l]))[l];await Promise.all([this.#le.save({assetType:l,keyringAccountId:d.id,network:n,mint:o,symbol:h?.symbol??\"UNKNOWN\",decimals:s,rawAmount:a,uiAmount:f}),this.#Ee(d,n,u)])}async#Ee(e,t,n){const r=(await this.#de.fetchLatestSignatures(t,qu(n),{limit:1}))?.[0];if(!r)throw new Error(\"No signature found\");const i=await this.#de.fetchBySignature(r,e,t);if(!i)throw new Error(\"No transaction found\");yP(i,e)?this.#w.info(`Transaction ${r} is spam. Skipping.`):await this.#de.save(i)}async#ye(e){this.#w.info(\"Handling connection recovery\",{network:e});const t=await this.#ue.getAllSelected();t.length?await this.#fe.synchronize(t):this.#w.info(\"No selected accounts found. Skipping connection recovery.\")}static#Se(e){return\"accountSubscribe\"===e.method}static#ke(e){return\"programSubscribe\"===e.method}static#xe(e){if(this.#Se(e))return(0,Br.get)(e,\"params[0]\");if(this.#ke(e))return(0,Br.get)(e,\"params[1].filters[0].memcmp.bytes\");throw new Error(\"Invalid subscription\")}}class vP{#Ie;#Te;#Be;#w;#Ce=new Map;constructor(e,t,n,r){this.#Ie=e,this.#Te=t,this.#Be=n,this.#w=r.withPrefix(\"[🔔 SubscriptionService]\"),this.#pe()}#pe(){this.#Be.on(\"onInactive\",this.#Me.bind(this)),this.#Be.on(\"onWebSocketEvent\",this.#Pe.bind(this)),this.#Be.on(\"onListSubscriptions\",this.#_e.bind(this)),Po.forEach(e=>{this.#Ie.onConnectionRecovery(e,this.#Re.bind(this))})}registerNotificationHandler(e,t,n){this.#w.info(\"Registering notification handler\",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#Ce.has(r)||this.#Ce.set(r,new Set),this.#Ce.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#Ie.onConnectionRecovery(e,t)}async subscribe(e){this.#w.info(\"New subscription request\",e);const{method:t,params:n,network:r,expiryMilliseconds:i}=e,o=await this.#Oe(e),a=await this.#Te.getById(o);if(a){if(\"confirmed\"===a.status)return o;await this.#Te.delete(o)}const s={...e,id:o,status:\"pending\",requestId:o,createdAt:(new Date).toISOString(),...i?{expiresAt:new Date(Date.now()+i).toISOString()}:{}};await this.#Te.save(s);const c=await this.#Ie.findByNetwork(r),u=async e=>{const r={jsonrpc:\"2.0\",id:o,method:t,params:n};e&&await this.#Ue(e,r)};return c&&await u(c.id),s.id}async unsubscribe(e){this.#w.info(\"Unsubscribing from\",e);const t=await this.#Te.getById(e);if(!t)return void this.#w.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:i}=t,o=rS[i];if(await this.#Te.delete(n),\"confirmed\"===t.status){const e=await this.#Ie.findByNetwork(r);e&&await this.#Ue(e.id,{jsonrpc:\"2.0\",id:globalThis.crypto.randomUUID(),method:o,params:[t.rpcSubscriptionId]})}}async getAll(){return this.#Te.getAll()}async#Pe(e){if(\"message\"!==e.type)return;const t=(e=>{const{data:t}=e;let n;if(t&&\"object\"==typeof t&&\"type\"in t)if(\"text\"===t.type)n=\"string\"==typeof t.message?JSON.parse(t.message):t.message;else{if(\"binary\"!==t.type)throw new Error(\"Unknown message data\");{const e=t.message,r=String.fromCharCode(...e);n=JSON.parse(r)}}else n=\"string\"==typeof t?JSON.parse(t):t;return n})(e),n=await this.#Ie.findById(e.id);if(n)switch(this.#w.info(\"Received message\",e),t.method){case\"accountNotification\":case\"programNotification\":case\"signatureNotification\":await this.#Ne(t,n.network);break;default:this.#ze(t)?await this.#Fe(t):this.#Le(t)?await this.#De(t):be(t)?await this.#je(t):this.#w.warn(\"Received unknown message\",t)}}async#Ne(e,t){const{subscription:n}=e.params,r=await this.#Te.findBy(\"rpcSubscriptionId\",n);if(!r)return void this.#w.warn(\"No subscription found for RPC ID:\",n);const i=`${r.method}:${t}`,o=this.#Ce.get(i);if(o&&o.size>0){(await Promise.allSettled(Array.from(o).map(async t=>t(e,r)))).forEach(e=>{\"rejected\"===e.status&&this.#w.error(`Handler failed for ${r.method}:`,e.reason)})}}async#Ue(e,t){this.#w.info(`Sending message to connection ${e}`,t),await snap.request({method:\"snap_sendWebSocketMessage\",params:{id:e,message:JSON.stringify(t)}})}#ze(e){return\"jsonrpc\"in e&&\"2.0\"===e.jsonrpc&&\"id\"in e&&\"result\"in e&&\"number\"==typeof e.result}#Le(e){return\"jsonrpc\"in e&&\"id\"in e&&\"result\"in e&&!0===e.result}async#Fe(e){const{id:t,result:n}=e,r=await this.#Te.getById(String(t));r?(await this.#Te.update({...r,status:\"confirmed\",rpcSubscriptionId:n,confirmedAt:(new Date).toISOString()}),this.#w.info(`Subscription confirmed: request ID: ${t} -> RPC ID: ${n}`)):this.#w.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#De(e){this.#w.info(\"Received unsubscription confirmation\",e)}async#je(e){if(\"id\"in e&&void 0!==e.id){const t=await this.#Te.getById(String(e.id));\"pending\"===t?.status?(await this.#Te.delete(t.id),this.#w.error(`Subscription establishment failed for ${t.id}:`,e.error)):this.#w.error(`Received error for request ID: ${e.id}`,e.error)}else this.#w.error(\"Connection-level error:\",e.error)}async#Oe(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#$e(t),r=(new TextEncoder).encode(n),i=await globalThis.crypto.subtle.digest(\"SHA-256\",r);return Array.from(new Uint8Array(i)).map(e=>e.toString(16).padStart(2,\"0\")).join(\"\")}#$e(e){if(null==e)return JSON.stringify(e);if(\"object\"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>this.#$e(e)).join(\",\")}]`;return`{${Object.keys(e).sort((e,t)=>e.localeCompare(t)).map(t=>`\"${t}\":${this.#$e(e[t])}`).join(\",\")}}`}async#_e(){const e=await this.#Te.getAll();this.#w.info(\"Subscriptions\",{subscriptions:e,notificationHandlers:this.#Ce})}#Ke(e){return{method:e.method,params:e.params,network:e.network,...e.expiryMilliseconds?{expiryMilliseconds:e.expiryMilliseconds}:{},...e.metadata?{metadata:e.metadata}:{}}}async#Re(e){this.#w.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#Te.getAll()).filter(t=>t.network===e).filter(vP.#qe),n=t.map(e=>e.id);await this.#Te.deleteMany(n),await Promise.allSettled(t.map(async e=>{await this.subscribe(this.#Ke(e))}))}async#Me(){this.#w.info(\"Client became inactive\"),await this.#He()}async#He(){this.#w.info(\"Removing expired subscriptions\");const e=(await this.#Te.getAll()).filter(vP.#We);await Promise.allSettled(e.map(async e=>{await this.unsubscribe(e.id)}))}static#We(e){const t=new Date;return Boolean(e.expiresAt&&new Date(e.expiresAt)<t)}static#qe(e){return!vP.#We(e)}}class AP{#ne;#le;#w;constructor(e,t,n){this.#ne=e,this.#le=t,this.#w=n}static createPendingTransaction({signature:e,account:t,scope:n,transactionType:r}){const i=Math.floor(Date.now()/1e3);return{id:e,account:t.id,chain:n,status:qh.Unconfirmed,type:r??Hh.Unknown,timestamp:i,from:[{address:t.address,asset:{unit:bo[n].nativeToken.symbol,type:bo[n].nativeToken.caip19Id,amount:\"0\",fungible:!0}}],to:[],fees:[],events:[{status:qh.Unconfirmed,timestamp:i}]}}async mapRpcTransaction(e,t,n,r){try{const{blockTime:i}=e,{id:o,address:a}=t,s=e.transaction.signatures[0];if(!s)throw new Error(\"Transaction ID is required\");const c=Number(i),u=this.#Ve(e);let l=[],d=[],f=[];const h=(u===qh.Failed?this.#Ge.bind(this):this.#Ze.bind(this))({scope:n,transactionData:e});l=h.fees,d=h.from,f=h.to;const{from:p,to:g}=await this.#Je({scope:n,transactionData:e});let m=[...p,...d],y=[...g,...f];const w=this.#Ye({address:qu(a),status:u,from:m,to:y});w===Hh.Swap&&(m=m.filter(e=>e.address===a),y=y.filter(e=>e.address===a)),w===Hh.Receive&&(y=y.filter(e=>e.address===a),l=[]);const v=[...new Set([...m,...y].filter(e=>e.asset?.fungible).map(e=>e.asset.type))],A=r??await this.#le.getAssetsMetadata(v);return m.forEach(e=>{e.asset?.fungible&&A[e.asset.type]&&(e.asset.unit=A[e.asset.type]?.symbol??\"UNKNOWN\")}),y.forEach(e=>{e.asset?.fungible&&A[e.asset.type]&&(e.asset.unit=A[e.asset.type]?.symbol??\"UNKNOWN\")}),{id:s,account:o,timestamp:c,chain:n,status:u,type:w,from:m,to:y,fees:l,events:[{status:u,timestamp:c}]}}catch(e){return await Th(e),this.#w.warn(e,\"Error mapping transaction\"),null}}#Ve(e){return e.meta?.err||e.meta?.status&&\"Err\"in e.meta.status?qh.Failed:qh.Confirmed}#Ye({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===qh.Failed)return Hh.Unknown;const i=n.filter(t=>t.address===e),o=r.filter(t=>t.address===e),a=i.length>0,s=o.length>0,c=n.every(t=>r.some(n=>n.address===e&&!0===t.asset?.fungible&&!0===n.asset?.fungible&&t.asset.type===n.asset.type)),u=r.every(t=>n.some(n=>n.address===e&&!0===n.asset?.fungible&&!0===t.asset?.fungible&&n.asset.type===t.asset.type));return c&&u?Hh.Send:a&&s?Hh.Swap:a?Hh.Send:Hh.Receive}#Ze({scope:e,transactionData:t}){const n=this.#Xe({scope:e,transactionData:t}),r=[],i=[],o=new Map(t.meta?.preBalances?.map((e,t)=>[t,new br(e.toString())])??[]),a=new Map(t.meta?.postBalances?.map((e,t)=>[t,new br(e.toString())])??[]),s=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],c=new Set([...Array.from(o.keys()),...Array.from(a.keys())]);for(const n of c){const c=s[n]?.toString();if(!c)continue;const u=o.get(n)??new br(0),l=a.get(n)??new br(0),d=0===n?wS(t.meta?.fee??0):new br(0),f=u.minus(l).dividedBy(new br(fo)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();f.isPositive()&&r.push({address:c,asset:{fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol,amount:h}}),f.isNegative()&&i.push({address:c,asset:{fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol,amount:h}})}const u=this.#Qe({scope:e,transactionData:t});return u.from.length>0&&r.push(...u.from),u.to.length>0&&i.push(...u.to),{fees:n,from:r,to:i}}#Ge({scope:e,transactionData:t}){const n=this.#Xe({scope:e,transactionData:t}),r=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],i=[],o=[],{instructions:a}=t.transaction.message;a.forEach(t=>{const{accounts:n,data:a,programIdIndex:s}=t;if(r[s]!==fh)return;const[c,u]=n;if(void 0===c||void 0===u)return;const l=r[c],d=r[u];if(!l||!d)return;const f=EM.decode(a);if(2!==this.#et(f))return;const h=this.#tt(f);i.push({address:l,asset:{amount:h.toString(),fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol}}),o.push({address:d,asset:{amount:h.toString(),fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol}})});return{fees:n,from:this.#nt(i),to:this.#nt(o)}}#Qe({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],i=[],o=t.transaction.message.accountKeys.findIndex(e=>e===fh);return-1===o||n.forEach(n=>{const{accounts:a,data:s,programIdIndex:c}=n;if(c!==o)return;const[u,l]=a;if(void 0===u||void 0===l||u!==l)return;const d=t.transaction.message.accountKeys[u],f=t.transaction.message.accountKeys[l];if(!d||!f||d!==f)return;const h=this.#tt(EM.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol}}),i.push({address:f,asset:{amount:h.toString(),fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol}})}),{from:r,to:i}}async#Je({scope:e,transactionData:t}){const n=[],r=[],i=new Map(t.meta?.preTokenBalances?.map(e=>[e.accountIndex,new br(e.uiTokenAmount.amount)])??[]),o=new Map(t.meta?.postTokenBalances?.map(e=>[e.accountIndex,new br(e.uiTokenAmount.amount)])??[]),a=new Set([...t.meta?.preTokenBalances?.map(e=>e.accountIndex)??[],...t.meta?.postTokenBalances?.map(e=>e.accountIndex)??[]]);for(const s of a){const a=i.get(s)??new br(0),c=(o.get(s)??new br(0)).minus(a);if(c.isZero())continue;const u=t.meta?.preTokenBalances?.find(e=>e.accountIndex===s)??t.meta?.postTokenBalances?.find(e=>e.accountIndex===s);if(!u)continue;const{mint:l,owner:d}=u;if(!d)continue;const f=GM(e,l),h=c.absoluteValue().toString(),p=(await this.#ne.amountToUiAmountForMint(l,e,Al(BigInt(h)))).toString();c.isNegative()&&n.push({address:d,asset:{fungible:!0,type:f,unit:\"\",amount:p}}),c.isPositive()&&r.push({address:d,asset:{fungible:!0,type:f,unit:\"\",amount:p}})}const s=this.#rt({scope:e,transactionData:t});return s.from.length>0&&n.push(...s.from),s.to.length>0&&r.push(...s.to),{from:n,to:r}}#rt({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],i=[];return n.map(e=>nS(e,t)).map(tS).filter(this.#it.bind(this)).forEach(n=>{const o=(0,Br.get)(n,\"parsed.accounts.authority.address\"),a=(0,Br.get)(n,\"parsed.accounts.source.address\");if(!o||!a)return;const s=t.transaction.message.accountKeys.indexOf(qu(a)),{mint:c,uiTokenAmount:{decimals:u}={}}=t.meta?.preTokenBalances?.find(e=>e.accountIndex===s)??{};if(!c||void 0===u)return;const l=n.parsed?.data.amount,d=br(l).dividedBy(new br(10).pow(u)).toString(),f=GM(e,c);r.push({address:o,asset:{amount:d,fungible:!0,type:f,unit:\"\"}}),i.push({address:o,asset:{amount:d,fungible:!0,type:f,unit:\"\"}})}),{from:r,to:i}}#Xe({scope:e,transactionData:t}){const n=this.#ot(t),r=this.#at(t),i=n.minus(r),o=[{type:\"base\",asset:{fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol,amount:r.toString()}}];return i?.isGreaterThan(0)&&o.push({type:\"priority\",asset:{fungible:!0,type:bo[e].nativeToken.caip19Id,unit:bo[e].nativeToken.symbol,amount:i.toString()}}),o}#ot(e){return new br(e.meta?.fee?.toString()??\"0\").dividedBy(fo)}#at(e){const t=e.transaction.signatures.length;return br(5e3).dividedBy(fo).multipliedBy(t)}#nt(e){return e.reduce((e,t)=>{const n=e.find(e=>!0===e?.asset?.fungible&&!0===t.asset?.fungible&&e.asset.type===t.asset.type&&e.address===t.address);if(n&&!0===n.asset?.fungible&&!0===t.asset?.fungible){const e=new br(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e},[])}#et(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}#tt(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return br(t.toString()).dividedBy(fo)}#it(e){if(\"Transfer\"!==e.type&&\"TransferChecked\"!==e.type)return!1;if(!e.parsed)return!1;const{source:t,destination:n,authority:r}=e.parsed.accounts??{};return!!(t&&n&&r)&&t.address===n.address}}function bP(e,t,n){if(\"string\"==typeof e)throw new Error(`An HTML element (\"${String(e)}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error(\"A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.\");return e({...t,key:n})}function SP(e,t,n){return bP(e,t,n)}const kP='<svg width=\"16\" height=\"16\" xmlns=\"http://www.w3.org/2000/svg\"><image width=\"16\" height=\"16\" href=\"data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUFBQUFBQUGBgUICAcICAsKCQkKCxEMDQwNDBEaEBMQEBMQGhcbFhUWGxcpIBwcICkvJyUnLzkzMzlHREddXX0BBQUFBQUFBQYGBQgIBwgICwoJCQoLEQwNDA0MERoQExAQExAaFxsWFRYbFykgHBwgKS8nJScvOTMzOUdER11dff/CABEIAPoA+gMBIgACEQEDEQH/xAA1AAEAAwEBAQEBAAAAAAAAAAAAAQIHBggEBQMBAQADAQEBAQAAAAAAAAAAAAACAwQBBQYH/9oADAMBAAIQAxAAAADxkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACx204cU3mdnnYLG+IQwNvsxhgLfrRh5/egLRh59egkYefXoRCPn6mv5BH2ajuwAAAACZdFZz6/SvzfofWfLWtS2jw7WpNGO01mjJaas+P+k0tRjtNbUY38Leccnq/DxFq5f2ao7cAAAAB+36W8/9p7+DZZxp6nl7LOM3qzbLOMqs2zzjF6suyzjNqqNlnGrU5NkY7zlHP75Wjzv0mg5pAAAAAAs6jqdsMuajacMsam5HLGqORytqkxjlTVbc5lLVpjDKGsfhQlwdb1p3QAAAAAADofSXk7q/cp9MT8n0/cebe1Jpx2tS2fJNqTRkvNLUY7TWaMdqXZ8vnHPvZHmrw/u+JTGL6EAAAAABMDuvQvkLQfo6PQU55P0WLRJztTl0Sc7U5tFnOppzaOzmacujTnSrLo3x8NNFOM8zsuM+H99Aq2AAAAAATMfpWPznbNXOJdqjHi47Wec4l2jnOLdo5zi57JFxrsp5HjadRy9d0CMgAAAAJPqm+j0X8fW/oV82rPvUWRNGObUmjHe1LUZLIUY7TDPk/opk2CP5uPy+U+1qKrwAAAAPo3zPdc+23fu2/BfYXdA/AmjL+/bn1GToZ55Tl6KedmjJ0c87anL0LnuZyUTgH9fm+Q9+Bk0AAAAAAWVdWVFlRZUWVFpo4uoLxV0HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH//EAEEQAAECAwQHBAgDBgcBAAAAAAECBAADBgURF1UQMUFRkpPSEiFSohYgIjBAYaPiBzLBEyRUYnCRFBVDRYGhstH/2gAIAQEAAT8A/qXdF0XRd8ou9a4R3aOz8AO+KUo95Uc1SyoyGcs+3OIvvPhQDrMYUWPmbzhRGFFj5m74URhRY2Zu+FEYT2NmbvhRGE1jZm84URhNY2ZvOFEYTWNmjzhRGEti5o84URhLYuaPP7IjCWxc0ecKIwksXM3nCiMJLFzN5wojCSxczd/2RGEliZm8/siKt/DthYNkTLRbWlNUqWtIKJwA7Xa8JHwFK0w6qN6EJvQ1lkGfO2AeEb1HZDRq2YNpLVrJTLkyk9lCAO4D9TtJ2nQIv0C/QDAOgGL9Lp22Yt5rl1NTLky03rWrUB+p+W2KyqubUr72SpDOSSJEonzKHiPv6dsB7UT1LduLkJuM2afyy0bzvO4RZdmtbIZSGTRHZlS069qlbVK3k6AYGkQDA0DQDonTpTaVMnTpqUSkJKlrUbkhI1kmK3rJdQuRIaKUiz5BPYB7jMV41CD3++sWx3ltv5LNqm9au9Sj+VCRrUo7hFg2IzsBhLZthftmzCO+Yvao7vkNA0AxfA0A6RAMCCpKUqJUAALySbgBFeVsLXUuzbPWQxQr25m2coH/AMiFa/f0rVK6ZmO1hkiemehIIKuwoFBvFyrjGLByIc89MYsnIxz/ALIxZORjn/ZGLJyMc89MYspyP6/2xi0nIvr/AGxi2nI/r/bGLYyL6/2xi5LyM8/7Yxbl5Gef9sYuSsjPPHTGLkrI1c8dMYuSMjXzh0xi63yRfOHTFR/iO9tpktk1bBpJWLpp7fbWtPh1CCTBJPwN3udfqk6vgKcph7Ui3KW02VKEhIK1zL9atQFwJjCu1szZ+fpjCy18zZ+fpjCu1syZefpjCu1syZefpjCq18yZ+fpjCq18yZ+fpjCm18zZ+fpjCi1s0Z+fpjCe1szZ+fpjCe1s0Z+fpjCa180Z+fpjCa1szZ+fpjCa1szZefpjCW1s0Zefpi36Etan2gdrVKcSAblqlX+wTvBAMKB7ou9/T9vPKffJctriki6bLP5Vo3H9DFl2m1tdlIetV9qXMGralW1KtxGgGAYvgQDoBi+L9A0TZUtxKmSp0tK5cwFK0K7wUnWCIrWjlU+4DltethOPsE95lK8CjB+ApipnVPPAtN62yyBPk7FDeNyhsMNHbZ+2kum04TJMxPaSobR+hG0bIEXwDpB0AwIHqO2rZ+2nNXMlM2TMR2VoVqI/Q7jsisKWn049ISVTGc4kyJvy1lCvmII9+DdFH1VNsB0JThalMJyh+1RrKD40jeIkzpLiVLnSZqZkqYkKQtJvSUnUQdAOi+BF+gHQNA0WjZzO1Wc5m8lCZKmC4jaDsUk7FDYYqWnHtOv1t56SqUq8yJwHctH/ANG2B78G4xR1ZKsLttXiVzGSzeAk3mUraUg6wdojEum9zzkp64xMprc85KeuMTKa8Lzkp64xMprwvOSnrjE2mvC85KeuMTaa8LzlJ64xNprwveSnrjE6mvC95KeuMT6Z3POSnrjE+mdzzlJ6oxOpnc85Q6oxPpjc85SeqMT6YOx5yU9cYn0xue8lPXFY1tYFuWKtk1kT1zzNQpCpqAkIuPeoHtHX8APWv9S+L4vGjVo/4+Bs6zHtquA3ZN1TphBNydgG0k9wEYfVR/Ao5qIw9qj+BRzURh/VWXDmojD6qsuHNRGH1VZcOaiMPqqy4c1EYf1Xlf1ZfVGH9WZX9VHVGH1WZX9WX1Rh9VeWfVl9UYf1blJ5qOqMP6tyo81HVGH1W5T9VHVGH1XZSeajqi0qSt+yGxdPrPXLkhQSV9pKgCd/ZJ+As6z3dpu5LVrKMybMNwA/7JOwDaYpun29PMBIRcufMuLib41bh/KNnq3iL4ECO6Bd6m0d0fiBWMp6ldj2esKkBX7xOGpage5Cd6RtPvhDRrPeOJTeRKVMnTFBKEDWSYpSmJNPNSVkLezUj9rM2Aa+wn5DadI9QQDovgQNAivK2S2TPsezZl80jsOZwP5AdaE/PeYJJ99KlrmrQhAJWSAABeSdwikaTRYklLp0Ap/MRcdolJOwfPeY1QDov0iBoBi+AdNb1l/k6FWcwX+/LR7ax/oAjZ/OYUpSiSSSSbyT3kn39BubFZv5860ZqJc5KB/h1zPyJO0/JW6PSanh/vTXjj0mp7OmvHAqens6a8celFO501449Kacztrxx6U05nbXjj0ppzPGnHHpTTeeNOOPSqnM8accelVN54044FVU3njTjj0rprPWnHAqums8accelVNZ4044qav7PYNDLsp0hy7mC4LR3oljxE7VbhE+dNcTVzpswrmLUVKUokqJOsknWfgAbovMXnfF/wAzHai+L4vMdo747R3x2jvgKO+O18zHa+cXnfBJ/rX/AP/EADQRAAEDAQUFBAkFAAAAAAAAAAIAAQQDBRIUU5IREzBCVBUjMkMGICExM0RQUqIQImFyof/aAAgBAgEBPwD6pTpnVK6A3iT2fJ+z/U8GQ3InhyG5FhqzcqehUbkW7qfYnE25eBTA6piADeIlCgNFD2/ELxIhRCiFEKIUQqq93gWXXs+NT3lQu+/qitWC/m/i6e04b+annxcxFOi5iKZGfmRSo78yORS2ftJETk+1+BRgTK4bylQMhT2XO6U12ZOb5c12dMyDTwJWQawUnKNYORlIo9YG2vS4NkWoUM92fwS/H+UziY3hRCiFEKIUQog2+9S4z0ivD4eDY9rYd9xXLu+UvtRWlA6oEVowepBFPhZ4IpsPPBFMiZ4IpUbNBHXjG2x6oKsICbsBXh4AAVQhAAvES7Om9Kel1gJnSnpdYGY3y56Vg5TeQelYSVkHpWGkZJ6Vh6+UaISF9hD64iREIj73Vh2Jg6bSKw98X4ohRCiFEKIUQqVWCPTvEq1YqxuRev6Nw4Aji5MgN5yARN7EU6D1YamRTYXVBqZFMh9QGpkUqJ1AamRSonUBqZFJi54amVaXGpgRb0FKlHKqXn8PLwNqvOrzra6vP+u36t//xAA2EQABBAEBAwkECwEAAAAAAAACAAEDBAWiEjFDBhETFDAyQkRSICFBkhYjM1BTVGBhcrHB0f/aAAgBAwEBPwD70llCGMpJC2RT5jHtxtLp85jm42l0/KDFtvsaXT8pMS3mdLp+U+HbzOl0/KvCN5vS6+l+Cbfb0uqOQq5KBp6x7Ufd7rt/ftkTA3O+5ZC0dk9lvsxRgjBGCMEYI41hMBLl7PpgDvn/AIq1aGpBHBCGzGDcw+3binmbZDuosbYfwo8VbfhosNdfhamR4PIPwtTIsBkX4GpkfJzKPug1MoOSuSmmAZI+jDxntMqVOvQrhBCGyI6v3fsHkAX95J7ELeNPbr/GVddqNxl1+m3HBPk6Db7QJ8tjvjaBRZOhNIMYWgci7GWPbZHGjBGCMFJGjBOxCTEKwmYG4HQTF9cOrsZYtv3sjryP4UdSV+EjpWH4SPH2X3QGjxlx+AaPE338qaHFZSIwOOuYkKoS2ZawPZi6OT4/97F3ZOYN4l0sbeNl08P4oJ7EDcUF1mv+YD5l1uq3mA+ZkMkcjc4GxD2DROze9GCMFICMEYIwVelJbl2B3KtWjqxDFHub260cXNtmYI3i9aNg9aMWRx86OE/Qjry+hdSnM+ZgVatHWjYQb+X6F//Z\" /></svg>';function xP(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}function EP(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:xP(r),key:n}}}const IP=EP(\"Box\"),TP=EP(\"Heading\"),BP=EP(\"Text\"),CP=EP(\"Image\"),MP=EP(\"Skeleton\");var PP;!function(e){e.Accessibility=\"accessibility\",e.Activity=\"activity\",e.AddCard=\"add-card\",e.AddCircle=\"add-circle\",e.AddSquare=\"add-square\",e.Add=\"add\",e.Ai=\"ai\",e.AlternateEmail=\"alternate-email\",e.Apple=\"apple\",e.Apps=\"apps\",e.Arrow2Down=\"arrow-2-down\",e.Arrow2Left=\"arrow-2-left\",e.Arrow2Right=\"arrow-2-right\",e.Arrow2UpRight=\"arrow-2-up-right\",e.Arrow2Up=\"arrow-2-up\",e.ArrowCircleDown=\"arrow-circle-down\",e.ArrowCircleUp=\"arrow-circle-up\",e.ArrowDoubleLeft=\"arrow-double-left\",e.ArrowDoubleRight=\"arrow-double-right\",e.ArrowDown=\"arrow-down\",e.ArrowDropDownCircle=\"arrow-drop-down-circle\",e.ArrowLeft=\"arrow-left\",e.ArrowRight=\"arrow-right\",e.ArrowUp=\"arrow-up\",e.Attachment=\"attachment\",e.Ban=\"ban\",e.BankAssured=\"bank-assured\",e.Bank=\"bank\",e.Bold=\"bold\",e.Book=\"book\",e.Bookmark=\"bookmark\",e.Bridge=\"bridge\",e.Briefcase=\"briefcase\",e.Bulb=\"bulb\",e.BuySell=\"buy-sell\",e.Cake=\"cake\",e.Calculator=\"calculator\",e.Calendar=\"calendar\",e.Call=\"call\",e.Camera=\"camera\",e.Campaign=\"campaign\",e.CardPos=\"card-pos\",e.Card=\"card\",e.Cash=\"cash\",e.Category=\"category\",e.Chart=\"chart\",e.CheckBold=\"check-bold\",e.Check=\"check\",e.CircleX=\"circle-x\",e.ClockFilled=\"clock-filled\",e.Clock=\"clock\",e.Close=\"close\",e.CloudDownload=\"cloud-download\",e.CloudUpload=\"cloud-upload\",e.Cloud=\"cloud\",e.CodeCircle=\"code-circle\",e.Code=\"code\",e.Coin=\"coin\",e.Collapse=\"collapse\",e.Confirmation=\"confirmation\",e.Connect=\"connect\",e.CopySuccess=\"copy-success\",e.Copy=\"copy\",e.CreditCheck=\"credit-check\",e.CurrencyFranc=\"currency-franc\",e.CurrencyLira=\"currency-lira\",e.CurrencyPound=\"currency-pound\",e.CurrencyYuan=\"currency-yuan\",e.Customize=\"customize\",e.Danger=\"danger\",e.DarkFilled=\"dark-filled\",e.Dark=\"dark\",e.Data=\"data\",e.Description=\"description\",e.Details=\"details\",e.Diagram=\"diagram\",e.DocumentCode=\"document-code\",e.Download=\"download\",e.Draft=\"draft\",e.EcoLeaf=\"eco-leaf\",e.EditSquare=\"edit-square\",e.Edit=\"edit\",e.EncryptedAdd=\"encrypted-add\",e.Eraser=\"eraser\",e.Error=\"error\",e.Ethereum=\"ethereum\",e.Exchange=\"exchange\",e.ExpandVertical=\"expand-vertical\",e.Expand=\"expand\",e.ExploreFilled=\"explore-filled\",e.Explore=\"explore\",e.Export=\"export\",e.Extension=\"extension\",e.EyeSlash=\"eye-slash\",e.Eye=\"eye\",e.FaceId=\"face-id\",e.Feedback=\"feedback\",e.File=\"file\",e.Filter=\"filter\",e.Fingerprint=\"fingerprint\",e.Fire=\"fire\",e.FirstPage=\"first-page\",e.Flag=\"flag\",e.FlashSlash=\"flash-slash\",e.Flash=\"flash\",e.Flask=\"flask\",e.Flower=\"flower\",e.Folder=\"folder\",e.Forest=\"forest\",e.FullCircle=\"full-circle\",e.Gas=\"gas\",e.Gift=\"gift\",e.GlobalSearch=\"global-search\",e.Global=\"global\",e.Graph=\"graph\",e.Hardware=\"hardware\",e.HashTag=\"hash-tag\",e.HeartFilled=\"heart-filled\",e.Heart=\"heart\",e.Hierarchy=\"hierarchy\",e.HomeFilled=\"home-filled\",e.Home=\"home\",e.Image=\"image\",e.Info=\"info\",e.Inventory=\"inventory\",e.Joystick=\"joystick\",e.KeepFilled=\"keep-filled\",e.Keep=\"keep\",e.Key=\"key\",e.LastPage=\"last-page\",e.LightFilled=\"light-filled\",e.Light=\"light\",e.Link=\"link\",e.Loading=\"loading\",e.Location=\"location\",e.LockSlash=\"lock-slash\",e.Lock=\"lock\",e.LockedFilled=\"locked-filled\",e.Login=\"login\",e.Logout=\"logout\",e.Mail=\"mail\",e.Map=\"map\",e.Menu=\"menu\",e.MessageQuestion=\"message-question\",e.Messages=\"messages\",e.Mic=\"mic\",e.MinusBold=\"minus-bold\",e.MinusSquare=\"minus-square\",e.Minus=\"minus\",e.Mobile=\"mobile\",e.MoneyBag=\"money-bag\",e.Money=\"money\",e.Monitor=\"monitor\",e.MoreHorizontal=\"more-horizontal\",e.MoreVertical=\"more-vertical\",e.MountainFlag=\"mountain-flag\",e.MusicNote=\"music-note\",e.Notification=\"notification\",e.PageInfo=\"page-info\",e.Palette=\"palette\",e.PasswordCheck=\"password-check\",e.Pending=\"pending\",e.People=\"people\",e.PersonCancel=\"person-cancel\",e.Pin=\"pin\",e.Plant=\"plant\",e.Plug=\"plug\",e.PlusAndMinus=\"plus-and-minus\",e.PolicyAlert=\"policy-alert\",e.Print=\"print\",e.PriorityHigh=\"priority-high\",e.PrivacyTip=\"privacy-tip\",e.ProgrammingArrows=\"programming-arrows\",e.Publish=\"publish\",e.QrCode=\"qr-code\",e.Question=\"question\",e.Receive=\"receive\",e.Received=\"received\",e.Refresh=\"refresh\",e.RemoveMinus=\"remove-minus\",e.Report=\"report\",e.Rocket=\"rocket\",e.SaveFilled=\"save-filled\",e.Save=\"save\",e.Saving=\"saving\",e.ScanBarcode=\"scan-barcode\",e.ScanFocus=\"scan-focus\",e.Scan=\"scan\",e.Search=\"search\",e.SecurityAlert=\"security-alert\",e.SecurityCross=\"security-cross\",e.SecurityKey=\"security-key\",e.SecuritySearch=\"security-search\",e.SecuritySlash=\"security-slash\",e.SecurityTick=\"security-tick\",e.SecurityTime=\"security-time\",e.SecurityUser=\"security-user\",e.Security=\"security\",e.Send=\"send\",e.SentimentDissatisfied=\"sentiment-dissatisfied\",e.SentimentNeutral=\"sentiment-neutral\",e.SentimentSatisfied=\"sentiment-satisfied\",e.SentimentVerySatisfied=\"sentiment-very-satisfied\",e.SettingFilled=\"setting-filled\",e.Setting=\"setting\",e.Share=\"share\",e.ShieldLock=\"shield-lock\",e.ShoppingBag=\"shopping-bag\",e.ShoppingCart=\"shopping-cart\",e.SignalCellular=\"signal-cellular\",e.Slash=\"slash\",e.Sms=\"sms\",e.SnapsMobile=\"snaps-mobile\",e.SnapsPlus=\"snaps-plus\",e.SnapsRound=\"snaps-round\",e.Snaps=\"snaps\",e.SortByAlpha=\"sort-by-alpha\",e.Sort=\"sort\",e.Sparkle=\"sparkle\",e.Speed=\"speed\",e.Speedometer=\"speedometer\",e.Square=\"square\",e.Stake=\"stake\",e.StarFilled=\"star-filled\",e.Star=\"star\",e.Start=\"start\",e.Storefront=\"storefront\",e.Student=\"student\",e.SwapHorizontal=\"swap-horizontal\",e.SwapVertical=\"swap-vertical\",e.TabClose=\"tab-close\",e.TableRow=\"table-row\",e.Tablet=\"tablet\",e.Tag=\"tag\",e.ThumbDownFilled=\"thumb-down-filled\",e.ThumbDown=\"thumb-down\",e.ThumbUpFilled=\"thumb-up-filled\",e.ThumbUp=\"thumb-up\",e.Tint=\"tint\",e.Tooltip=\"tooltip\",e.Translate=\"translate\",e.Trash=\"trash\",e.TrendDown=\"trend-down\",e.TrendUp=\"trend-up\",e.TriangleUp=\"triangle-up\",e.TriangleDown=\"triangle-down\",e.Undo=\"undo\",e.Unfold=\"unfold\",e.UnlockedFilled=\"unlocked-filled\",e.Unpin=\"unpin\",e.UploadFile=\"upload-file\",e.Upload=\"upload\",e.Usb=\"usb\",e.UserCheck=\"user-check\",e.UserCircleAdd=\"user-circle-add\",e.UserCircleRemove=\"user-circle-remove\",e.UserCircle=\"user-circle\",e.User=\"user\",e.VerifiedFilled=\"verified-filled\",e.Verified=\"verified\",e.Videocam=\"videocam\",e.ViewColumn=\"view-column\",e.ViewInAr=\"view-in-ar\",e.VolumeOff=\"volume-off\",e.VolumeUp=\"volume-up\",e.WalletFilled=\"wallet-filled\",e.Wallet=\"wallet\",e.Warning=\"warning\",e.WebTraffic=\"web-traffic\",e.Widgets=\"widgets\",e.WifiOff=\"wifi-off\",e.Wifi=\"wifi\",e.X=\"x\"}(PP||(PP={}));const _P=EP(\"Icon\"),RP=EP(\"Link\"),OP={sm:16,md:24,lg:32,xl:48},UP=({iconUrl:e,size:t=\"sm\"})=>bP(CP,{borderRadius:\"full\",src:e?.trim()?e:'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\" width=\"16\" height=\"16\">\\n  <path fill=\"#999999\" d=\"M42.75 24c0 10.59375-8.53125 19.21875-19.125 19.21875-10.6875 0-19.21875-8.625-19.21875-19.21875 0-10.59375 8.53125-19.21875 19.21875-19.21875 10.59375 0 19.125 8.625 19.125 19.21875zM23.625 14.0625c-3.09375 0-5.90625 2.25-5.90625 5.4375 0 0.84375 0.75 1.59375 1.59375 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375 0-1.125 1.03125-2.25 2.71875-2.25 1.59375 0 2.625 1.125 2.625 2.25 0 0.5625-0.375 1.03125-1.3125 1.59375l0 0c-1.125 0.75-3 1.96875-3 4.5l0 0.46875c0 0.84375 0.75 1.59375 1.6875 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375l0-0.46875c0-0.65625 0.28125-1.125 1.40625-1.78125 1.03125-0.65625 2.8125-1.875 2.8125-4.3125 0-3.1875-2.8125-5.4375-5.8125-5.4375zM23.53125 31.875c-0.84375 0-1.59375 0.65625-1.59375 1.59375 0 0.84375 0.75 1.59375 1.59375 1.59375l0.09375 0c0.84375 0 1.59375-0.75 1.59375-1.59375 0-0.9375-0.75-1.59375-1.59375-1.59375z\"/>\\n</svg>',height:OP[t],width:OP[t]}),NP=({symbol:e,amount:t,iconUrl:n,iconName:r,hideIcon:i=!1,link:o,fiat:a,isFiatLoading:s=!1})=>{const c=void 0===t?e:`${t} ${e}`;return SP(IP,{direction:\"horizontal\",alignment:\"end\",children:[s?bP(MP,{width:80}):null,!s&&a?bP(BP,{color:\"muted\",children:a}):null,i?null:bP(IP,{alignment:\"center\",center:!0,children:r?bP(_P,{name:r,size:\"md\"}):bP(UP,{iconUrl:n})}),o?bP(RP,{href:o,children:c}):bP(BP,{children:c})]})},zP=({title:e,subtitle:t,iconUrl:n})=>SP(IP,{alignment:\"center\",center:!0,children:[bP(IP,{children:null}),bP(TP,{size:\"lg\",children:e}),t?bP(BP,{color:\"muted\",alignment:\"center\",children:t}):null,void 0===n?null:bP(IP,{children:bP(UP,{iconUrl:n,size:\"xl\"})}),bP(IP,{children:null})]}),FP=EP(\"Container\"),LP=EP(\"Section\"),DP=EP(\"Row\"),jP=EP(\"Address\"),$P=EP(\"Footer\"),KP=EP(\"Button\");function qP(e,t,n){const{cluster:r}=bo[e];return eo({baseUrl:\"https://solscan.io\",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const HP=({domain:e,scope:t,address:n})=>bP(IP,{direction:\"horizontal\",alignment:\"center\",children:bP(RP,{href:qP(t,\"address\",n),children:e})});function WP(e,t){return`${e}:${t}`}const VP=JSON.parse('{\"D\":{\"send.title\":{\"message\":\"Send\"},\"send.balance\":{\"message\":\"Balance\"},\"send.maxButton\":{\"message\":\"Max\"},\"send.cancelButton\":{\"message\":\"Cancel\"},\"send.continueButton\":{\"message\":\"Continue\"},\"send.fromField\":{\"message\":\"From\"},\"send.toField\":{\"message\":\"To\"},\"send.amountField\":{\"message\":\"Amount\"},\"send.assetField\":{\"message\":\"Token\"},\"send.toPlaceholder\":{\"message\":\"Enter public address or domain name\"},\"send.fromRequiredError\":{\"message\":\"Account is required\"},\"send.amountRequiredError\":{\"message\":\"Amount is required\"},\"send.amountGreatherThanMinimumBalanceForRentExemptionError\":{\"message\":\"Amount must be greater than {minimumValue}\"},\"send.insuffientSolToCoverFee\":{\"message\":\"Insufficient SOL balance to cover the transaction fee\"},\"send.toRequiredError\":{\"message\":\"To address is required\"},\"send.toInvalidError\":{\"message\":\"Invalid Solana address or domain name\"},\"send.toInvalidErrorDomain\":{\"message\":\"Unable to resolve domain name\"},\"send.toDomainResolutionStatus.initial\":{\"message\":\"Domain\"},\"send.toDomainResolutionStatus.fetching\":{\"message\":\"Resolving domain name...\"},\"send.toDomainResolutionStatus.fetched\":{\"message\":\"Domain name resolved.\"},\"send.toDomainResolutionStatus.error\":{\"message\":\"Unable to resolve domain name.\"},\"send.insufficientBalance\":{\"message\":\"Insufficient balance\"},\"send.simulationTitleAPIError\":{\"message\":\"Because of an error, we couldn\\'t check for security alerts.\"},\"send.simulationMessageAPIError\":{\"message\":\"Only continue if you trust every address involved.\"},\"send.simulationTitleError\":{\"message\":\"Transaction simulation failed\"},\"send.simulationMessageError\":{\"message\":\"This transaction was reverted during simulation.\"},\"send.selectedTokenPriceNotAvailable\":{\"message\":\"Prices for tokens in {currency} are currently not available. You are still able to send tokens.\"},\"send.confirmation.title\":{\"message\":\"Review\"},\"send.confirmation.from\":{\"message\":\"From\"},\"send.confirmation.recipient\":{\"message\":\"Recipient\"},\"send.confirmation.network\":{\"message\":\"Network\"},\"send.confirmation.transactionSpeed\":{\"message\":\"Transaction speed\"},\"send.confirmation.fee\":{\"message\":\"Network fee\"},\"send.confirmation.sendButton\":{\"message\":\"Send\"},\"send.confirmation.cancelButton\":{\"message\":\"Cancel\"},\"send.confirmation.viewTransaction\":{\"message\":\"View transaction\"},\"send.send-pending.title\":{\"message\":\"Sending...\"},\"send.send-pending.subtitle\":{\"message\":\"Your transaction was submitted.\"},\"send.transaction-success.title\":{\"message\":\"Sent\"},\"send.transaction-success.subtitle\":{\"message\":\"{amount} {tokenSymbol} was successfully sent\"},\"send.transaction-failure.title\":{\"message\":\"Transaction failed\"},\"send.transaction-failure.subtitle\":{\"message\":\"Unable to send {amount} {tokenSymbol}\"},\"confirmation.account\":{\"message\":\"Account\"},\"confirmation.recipient\":{\"message\":\"Recipient\"},\"confirmation.network\":{\"message\":\"Network\"},\"confirmation.estimatedChanges\":{\"message\":\"Estimated changes\"},\"confirmation.estimatedChanges.send\":{\"message\":\"You send\"},\"confirmation.estimatedChanges.receive\":{\"message\":\"You receive\"},\"confirmation.estimatedChanges.notAvailable\":{\"message\":\"Not available\"},\"confirmation.estimatedChanges.noChanges\":{\"message\":\"No changes\"},\"confirmation.estimatedChanges.tooltip\":{\"message\":\"Estimated changes are what might happen if you go through with this transaction. This is just a prediction, not a guarantee.\"},\"confirmation.advanced.show\":{\"message\":\"Show advanced\"},\"confirmation.advanced.hide\":{\"message\":\"Hide advanced\"},\"confirmation.cancelButton\":{\"message\":\"Cancel\"},\"confirmation.confirmButton\":{\"message\":\"Confirm\"},\"confirmation.signAndSendTransaction.title\":{\"message\":\"Transaction request\"},\"confirmation.signTransaction.title\":{\"message\":\"Signing request\"},\"confirmation.sendAndConfirmTransaction.title\":{\"message\":\"Sending and confirming transaction\"},\"confirmation.advanced.unknownInstruction\":{\"message\":\"Unknown\"},\"confirmation.advanced.programId\":{\"message\":\"Program ID\"},\"confirmation.advanced.data\":{\"message\":\"Data\"},\"confirmation.fee\":{\"message\":\"Network fee\"},\"confirmation.feeError\":{\"message\":\"Unable to estimate fee\"},\"confirmation.origin\":{\"message\":\"Request from\"},\"confirmation.origin.tooltip\":{\"message\":\"This is the site asking for your confirmation.\"},\"confirmation.simulationErrorTitle\":{\"message\":\"This transaction was reverted during simulation.\"},\"confirmation.simulationErrorSubtitle\":{\"message\":\"{reason}\"},\"confirmation.validationErrorTitle\":{\"message\":\"This is a deceptive request\"},\"confirmation.validationErrorSubtitle\":{\"message\":\"If you approve this request, a third party known for scams will take all your assets.\"},\"confirmation.validationErrorLearnMore\":{\"message\":\"Learn more\"},\"confirmation.validationErrorSecurityAdviced\":{\"message\":\"Security advice by\"},\"confirmation.securityScanInProgressTitle\":{\"message\":\"Checking for security issues\"},\"confirmation.securityScanInProgressMessage\":{\"message\":\"This usually takes a few seconds.\"},\"confirmation.signMessage.title\":{\"message\":\"Sign message\"},\"confirmation.signMessage.message\":{\"message\":\"Message\"},\"confirmation.signIn.title\":{\"message\":\"Sign-in request\"},\"confirmation.signIn.description\":{\"message\":\"A site wants you to sign in to prove you own this account.\"},\"confirmation.signIn.domain\":{\"message\":\"Domain\"},\"confirmation.signIn.unknownDomain\":{\"message\":\"Unknown domain\"},\"confirmation.signIn.signingInWith\":{\"message\":\"Signing in with\"},\"confirmation.signIn.badAccount\":{\"message\":\"This site is asking you to sign in using the wrong account.\"},\"confirmation.signIn.message\":{\"message\":\"Message\"},\"confirmation.signIn.statement\":{\"message\":\"Statement\"},\"confirmation.signIn.version\":{\"message\":\"Version\"},\"confirmation.signIn.chainId\":{\"message\":\"Chain ID\"},\"confirmation.signIn.nonce\":{\"message\":\"Nonce\"},\"confirmation.signIn.issuedAt\":{\"message\":\"Issued at\"},\"confirmation.signIn.expirationTime\":{\"message\":\"Expiration time\"},\"confirmation.signIn.notBefore\":{\"message\":\"Not before\"},\"confirmation.signIn.requestId\":{\"message\":\"Request ID\"},\"confirmation.signIn.resources\":{\"message\":\"Resources\"},\"confirmation.signIn.badDomain\":{\"message\":\"This site is asking you to sign in using the wrong domain.\"},\"transactionScan.errors.accountAlreadyInUse\":{\"message\":\"An account with the same address already exists.\"},\"transactionScan.errors.insufficientSol\":{\"message\":\"Account does not have enough SOL to perform the operation.\"},\"transactionScan.errors.slippageToleranceExceeded\":{\"message\":\"The transaction was reverted because the slippage tolerance was exceeded.\"},\"transactionScan.errors.transactionBlockhashExpired\":{\"message\":\"Please go back and try again\"},\"transactionScan.errors.unknownError\":{\"message\":\"An unknown error occurred.\"}}}'),GP=JSON.parse('{\"D\":{\"send.title\":{\"message\":\"Enviar\"},\"send.balance\":{\"message\":\"Saldo\"},\"send.maxButton\":{\"message\":\"Máx.\"},\"send.cancelButton\":{\"message\":\"Cancelar\"},\"send.continueButton\":{\"message\":\"Continuar\"},\"send.fromField\":{\"message\":\"De\"},\"send.toField\":{\"message\":\"Para\"},\"send.amountField\":{\"message\":\"Monto\"},\"send.assetField\":{\"message\":\"Token\"},\"send.toPlaceholder\":{\"message\":\"Introduzca la dirección pública\"},\"send.fromRequiredError\":{\"message\":\"La cuenta es obligatoria\"},\"send.amountRequiredError\":{\"message\":\"El monto es obligatorio\"},\"send.amountGreatherThanMinimumBalanceForRentExemptionError\":{\"message\":\"El valor debe ser superior a {minimumValue}\"},\"send.insuffientSolToCoverFee\":{\"message\":\"Saldo de SOL insuficiente para cubrir la tarifa de transacción\"},\"send.toRequiredError\":{\"message\":\"La dirección del destinatario es obligatoria\"},\"send.toInvalidError\":{\"message\":\"Dirección de Solana no válida\"},\"send.insufficientBalance\":{\"message\":\"Saldo insuficiente\"},\"send.simulationTitleAPIError\":{\"message\":\"Debido a un error, no pudimos verificar las alertas de seguridad.\"},\"send.simulationMessageAPIError\":{\"message\":\"Continúa solo si confías en todas las direcciones involucradas.\"},\"send.simulationTitleError\":{\"message\":\"Simulación de transacción fallida\"},\"send.simulationMessageError\":{\"message\":\"Esta transacción se revirtió durante la simulación.\"},\"send.selectedTokenPriceNotAvailable\":{\"message\":\"Los precios de los tokens en {currency} no están disponibles actualmente. Aún puede enviar tokens.\"},\"send.confirmation.title\":{\"message\":\"Revisar\"},\"send.confirmation.from\":{\"message\":\"De\"},\"send.confirmation.recipient\":{\"message\":\"Destinatario\"},\"send.confirmation.network\":{\"message\":\"Red\"},\"send.confirmation.transactionSpeed\":{\"message\":\"Velocidad de la transacción\"},\"send.confirmation.fee\":{\"message\":\"Tarifa de red\"},\"send.confirmation.sendButton\":{\"message\":\"Enviar\"},\"send.confirmation.cancelButton\":{\"message\":\"Cancelar\"},\"send.confirmation.viewTransaction\":{\"message\":\"Ver transacción\"},\"send.send-pending.title\":{\"message\":\"Enviando...\"},\"send.send-pending.subtitle\":{\"message\":\"Se envió su transacción.\"},\"send.transaction-success.title\":{\"message\":\"Enviado\"},\"send.transaction-success.subtitle\":{\"message\":\"El envío de {amount} {tokenSymbol} se realizó correctamente\"},\"send.transaction-failure.title\":{\"message\":\"Transacción fallida\"},\"send.transaction-failure.subtitle\":{\"message\":\"Error al enviar {amount} {tokenSymbol}\"},\"confirmation.account\":{\"message\":\"Cuenta\"},\"confirmation.network\":{\"message\":\"Red\"},\"confirmation.estimatedChanges\":{\"message\":\"Cambios estimados\"},\"confirmation.estimatedChanges.send\":{\"message\":\"Usted envía\"},\"confirmation.estimatedChanges.receive\":{\"message\":\"Usted recibe\"},\"confirmation.estimatedChanges.notAvailable\":{\"message\":\"No disponible\"},\"confirmation.estimatedChanges.noChanges\":{\"message\":\"Sin cambios\"},\"confirmation.estimatedChanges.tooltip\":{\"message\":\"Los cambios estimados son los que podrían producirse si sigue adelante con esta transacción. Esto es solo una predicción, no una garantía.\"},\"confirmation.advanced.show\":{\"message\":\"Mostrar avanzadas\"},\"confirmation.advanced.hide\":{\"message\":\"Ocultar avanzadas\"},\"confirmation.cancelButton\":{\"message\":\"Cancelar\"},\"confirmation.confirmButton\":{\"message\":\"Confirmar\"},\"confirmation.signAndSendTransaction.title\":{\"message\":\"Solicitud de transacción\"},\"confirmation.signTransaction.title\":{\"message\":\"Signing request\"},\"confirmation.sendAndConfirmTransaction.title\":{\"message\":\"Sending and confirming transaction\"},\"confirmation.advanced.unknownInstruction\":{\"message\":\"Desconocida\"},\"confirmation.advanced.programId\":{\"message\":\"ID del programa\"},\"confirmation.advanced.data\":{\"message\":\"Datos\"},\"confirmation.fee\":{\"message\":\"Tarifa de red\"},\"confirmation.feeError\":{\"message\":\"No se puede calcular la tarifa\"},\"confirmation.origin\":{\"message\":\"Solicitud de\"},\"confirmation.origin.tooltip\":{\"message\":\"This is the site asking for your confirmation.\"},\"confirmation.simulationErrorTitle\":{\"message\":\"Esta transacción se revirtió durante la simulación.\"},\"confirmation.simulationErrorSubtitle\":{\"message\":\"Motivo: {reason}\"},\"confirmation.validationErrorTitle\":{\"message\":\"Esta es una solicitud engañosa\"},\"confirmation.validationErrorSubtitle\":{\"message\":\"Si aprueba esta solicitud, un tercero conocido por sus estafas se quedará con todos sus activos.\"},\"confirmation.validationErrorLearnMore\":{\"message\":\"Conozca más\"},\"confirmation.validationErrorSecurityAdviced\":{\"message\":\"Asesoramiento de seguridad por\"},\"confirmation.securityScanInProgressTitle\":{\"message\":\"Comprobando problemas de seguridad\"},\"confirmation.securityScanInProgressMessage\":{\"message\":\"Esto suele tardar unos segundos.\"},\"confirmation.signMessage.title\":{\"message\":\"Firmar mensaje\"},\"confirmation.signMessage.message\":{\"message\":\"Mensaje\"},\"confirmation.signIn.title\":{\"message\":\"Solicitud de inicio de sesión\"},\"confirmation.signIn.description\":{\"message\":\"Un sitio quiere que inicie sesión para demostrar que usted es el titular de esta cuenta.\"},\"confirmation.signIn.domain\":{\"message\":\"Domain\"},\"confirmation.signIn.unknownDomain\":{\"message\":\"Dominio desconocido\"},\"confirmation.signIn.signingInWith\":{\"message\":\"Iniciar sesión con\"},\"confirmation.signIn.badAccount\":{\"message\":\"Este sitio le pide que inicie sesión con la cuenta incorrecta.\"},\"confirmation.signIn.message\":{\"message\":\"Mensaje\"},\"confirmation.signIn.statement\":{\"message\":\"Declaración\"},\"confirmation.signIn.version\":{\"message\":\"Versión\"},\"confirmation.signIn.chainId\":{\"message\":\"ID de cadena\"},\"confirmation.signIn.nonce\":{\"message\":\"Nonce\"},\"confirmation.signIn.issuedAt\":{\"message\":\"Emitido a las\"},\"confirmation.signIn.expirationTime\":{\"message\":\"Hora de caducidad\"},\"confirmation.signIn.notBefore\":{\"message\":\"No antes de\"},\"confirmation.signIn.requestId\":{\"message\":\"ID de solicitud\"},\"confirmation.signIn.resources\":{\"message\":\"Recursos\"},\"confirmation.signIn.badDomain\":{\"message\":\"This site is asking you to sign in using the wrong domain.\"},\"transactionScan.errors.accountAlreadyInUse\":{\"message\":\"Ya existe una cuenta con la misma dirección.\"},\"transactionScan.errors.insufficientSol\":{\"message\":\"La cuenta no tiene suficiente SOL para realizar la operación.\"},\"transactionScan.errors.slippageToleranceExceeded\":{\"message\":\"La transacción se revirtió porque se superó la tolerancia de deslizamiento.\"},\"transactionScan.errors.unknownError\":{\"message\":\"An unknown error occurred.\"}}}'),ZP={en:VP.D,es:GP.D};function JP(e){const t=ZP[e]??ZP.en;return(e,n)=>{let r=t?.[e]?.message??e;return n&&r&&Object.keys(n).forEach(e=>{const t=new RegExp(`\\\\{${e}\\\\}`,\"gu\");r=r.replace(t,n[e]??\"\")}),r}}function YP(e){if(e===Yh)return\"MetaMask\";try{return new URL(e).hostname}catch(e){throw new Error(\"Invalid URL\")}}const XP=({label:e,value:t})=>null!=t?SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:e}),bP(BP,{children:t})]}):null,QP=EP(\"Tooltip\"),e_=({labels:e})=>SP(IP,{direction:\"horizontal\",alignment:\"start\",children:[bP(BP,{fontWeight:\"medium\",children:e.title}),bP(QP,{content:e.tooltip,children:bP(_P,{name:\"info\"})})]}),t_=({labels:e,message:t})=>SP(LP,{direction:\"vertical\",children:[bP(e_,{labels:e}),bP(BP,{color:\"alternative\",children:t})]}),n_=({asset:e})=>{const t=\"out\"===e.type,n=null===e.value;let r;if(n)r=`– ${e.symbol}`;else{r=`${t?\"-\":\"+\"}${e.value} ${e.symbol}`}const i=t?\"error\":\"success\";return SP(IP,{direction:\"vertical\",crossAlignment:\"end\",children:[SP(IP,{direction:\"horizontal\",alignment:\"end\",center:!0,children:[e.logo?bP(CP,{src:e.logo,borderRadius:\"full\",height:16,width:16}):null,bP(BP,{color:n?\"alternative\":i,children:r})]}),e.fiat?bP(BP,{color:\"muted\",children:e.fiat}):null]})},r_=({title:e,assets:t})=>t.length>0?SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:e}),bP(IP,{direction:\"vertical\",alignment:\"end\",children:t.map((e,t)=>bP(IP,{children:bP(n_,{asset:e})},`${e.type}-${e.symbol}-${t}`))})]}):null,i_=({assets:e,labels:t,isFetching:n,isUnavailable:r})=>0===e.length?n?SP(LP,{direction:\"vertical\",children:[bP(e_,{labels:t}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(MP,{width:60}),bP(MP,{width:100})]})]}):bP(t_,{labels:t,message:r?t.notAvailable:t.noChanges}):SP(LP,{children:[bP(e_,{labels:t}),bP(r_,{title:t.send,assets:e.filter(e=>\"out\"===e.type)}),bP(r_,{title:t.receive,assets:e.filter(e=>\"in\"===e.type)})]}),o_=1e-6,a_=new br(o_).decimalPlaces();function s_(e,t){const[n]=t.split(\"_\");try{const r=new br(e);if(r.isNaN())return\"0\";if(r.isZero())return\"0\";if(r.abs().lt(o_))return`<${function(e,t){const n=new br(t),r=n.decimalPlaces(),i=n.toFixed(r??0),[o]=e.split(\"_\"),[a,s]=i.split(\".\"),c=new Intl.NumberFormat(o).format(a);return s?`${c}.${s}`:c}(t,o_)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:3}).format(Number(r.toFixed(a_??0)));const i=r.abs().integerValue().toString().length,o=Math.max(0,3-i+1);return new Intl.NumberFormat(t,{maximumFractionDigits:o}).format(r.toFixed(o))}catch(e){return wh.error(e),\"0\"}}function c_(e,t,n){const r=new br(e).toNumber(),[i]=n.split(\"_\");return r.toLocaleString(i,{style:\"currency\",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const u_=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const i=JP(t.locale),{locale:o,currency:a}=t;return bP(i_,{assets:(e?.assets??[]).map(e=>({type:e.type,value:null===e.value?null:s_(e.value,o),symbol:e.symbol,logo:e.logo,fiat:e.price?c_(e.price.toString(),a,o):null})),labels:{title:i(\"confirmation.estimatedChanges\"),tooltip:i(\"confirmation.estimatedChanges.tooltip\"),send:i(\"confirmation.estimatedChanges.send\"),receive:i(\"confirmation.estimatedChanges.receive\"),notAvailable:i(\"confirmation.estimatedChanges.notAvailable\"),noChanges:i(\"confirmation.estimatedChanges.noChanges\")},isFetching:\"fetching\"===n,isUnavailable:\"error\"===n||\"ERROR\"===r})};const l_=\"confirm-sign-in-cancel\",d_=\"confirm-sign-in-confirm\",f_={[l_]:async function({id:e}){await Eo(e,!1)},[d_]:async function({id:e}){await Eo(e,!0)}},h_=({params:e,origin:t,account:n,accountDomain:r,scope:i,preferences:o,networkImage:a})=>{const s=JP(o.locale),c=t?YP(t):null,{domain:u,statement:l,uri:d,version:f,chainId:h,nonce:p,issuedAt:g,expirationTime:m,notBefore:y,requestId:w,resources:v,address:A}=e,b=WP(i,n.address),S=A?WP(i,A):null,k=S!==b,x=u!==c;return SP(FP,{children:[SP(IP,{children:[bP(zP,{title:s(\"confirmation.signIn.title\"),subtitle:s(\"confirmation.signIn.description\")}),o.simulateOnChainActions?bP(u_,{changes:null,scanStatus:null,preferences:o,scanFetchStatus:\"fetched\"}):null,SP(LP,{children:[c?bP(DP,{label:s(\"confirmation.origin\"),tooltip:s(\"confirmation.origin.tooltip\"),children:bP(BP,{children:c})}):null,bP(DP,{variant:x?\"critical\":\"default\",label:s(\"confirmation.signIn.domain\"),tooltip:x?s(\"confirmation.signIn.badDomain\"):void 0,children:bP(BP,{children:u??s(\"confirmation.signIn.unknownDomain\")})}),bP(DP,{label:s(\"confirmation.signIn.signingInWith\"),tooltip:k?s(\"confirmation.signIn.badAccount\"):void 0,variant:k?\"warning\":\"default\",children:r?bP(HP,{domain:r,scope:i,address:n.address}):bP(jP,{address:b,truncate:!0,displayName:!0,avatar:!0})})]}),SP(LP,{children:[bP(BP,{fontWeight:\"medium\",children:s(\"confirmation.signIn.message\")}),bP(BP,{children:l??\"\"}),bP(XP,{label:\"URL\",value:d??\"\"}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:s(\"confirmation.network\")}),SP(IP,{direction:\"horizontal\",alignment:\"center\",children:[bP(IP,{alignment:\"center\",center:!0,children:bP(CP,{borderRadius:\"medium\",src:a??kP})}),bP(BP,{children:bo[i].name})]})]}),S?SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:s(\"confirmation.account\")}),bP(jP,{address:S,truncate:!0,displayName:!0,avatar:!0})]}):null,bP(XP,{label:s(\"confirmation.signIn.version\"),value:f??\"\"}),bP(XP,{label:s(\"confirmation.signIn.chainId\"),value:h??\"\"}),bP(XP,{label:s(\"confirmation.signIn.nonce\"),value:p??\"\"}),bP(XP,{label:s(\"confirmation.signIn.issuedAt\"),value:g??\"\"}),bP(XP,{label:s(\"confirmation.signIn.expirationTime\"),value:m??\"\"}),bP(XP,{label:s(\"confirmation.signIn.notBefore\"),value:y??\"\"}),bP(XP,{label:s(\"confirmation.signIn.requestId\"),value:w??\"\"}),v&&v.length>0?SP(IP,{alignment:\"space-between\",direction:\"vertical\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:s(\"confirmation.signIn.resources\")}),bP(IP,{direction:\"vertical\",children:v.map(e=>bP(BP,{children:e},e))})]}):null]})]}),SP($P,{children:[bP(KP,{name:l_,children:s(\"confirmation.cancelButton\")}),bP(KP,{name:d_,variant:x?\"destructive\":\"primary\",children:s(\"confirmation.confirmButton\")})]})]})};const p_=\"confirm-sign-message-cancel\",g_=\"confirm-sign-message-confirm\",m_={[p_]:async function({id:e}){await Eo(e,!1)},[g_]:async function({id:e}){await Eo(e,!0)}},y_=({message:e,account:t,accountDomain:n,scope:r,locale:i,networkImage:o,origin:a})=>{const s=JP(i),{address:c}=t,u=a?YP(a):null,l=WP(r,c);return SP(FP,{children:[SP(IP,{children:[bP(zP,{title:s(\"confirmation.signMessage.title\")}),SP(LP,{children:[bP(IP,{direction:\"horizontal\",center:!0,children:bP(BP,{fontWeight:\"medium\",children:s(\"confirmation.signMessage.message\")})}),bP(IP,{alignment:\"space-between\",children:bP(BP,{children:e})})]}),SP(LP,{children:[u?SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[SP(IP,{alignment:\"space-between\",direction:\"horizontal\",center:!0,children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:s(\"confirmation.origin\")}),bP(QP,{content:s(\"confirmation.origin.tooltip\"),children:bP(_P,{name:\"question\",color:\"muted\"})})]}),bP(BP,{children:u})]}):null,SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:s(\"confirmation.account\")}),n?bP(HP,{domain:n,scope:r,address:c}):bP(jP,{address:l,truncate:!0,displayName:!0,avatar:!0})]}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:s(\"confirmation.network\")}),SP(IP,{direction:\"horizontal\",alignment:\"center\",children:[bP(IP,{alignment:\"center\",center:!0,children:bP(CP,{borderRadius:\"medium\",src:o??kP})}),bP(BP,{children:bo[r].name})]})]})]})]}),SP($P,{children:[bP(KP,{name:p_,children:s(\"confirmation.cancelButton\")}),bP(KP,{name:g_,children:s(\"confirmation.confirmButton\")})]})]})};const w_=new Set([\"TransferSol\",\"TransferSolWithSeed\",\"Transfer\",\"TransferChecked\",\"TransferCheckedWithFee\"]);const v_=EP(\"Banner\");const A_=({labels:e,isFetching:t,isFetchError:n,error:r,validation:i})=>{if(t)return bP(v_,{title:e.scanInProgressTitle,severity:\"info\",children:bP(BP,{children:e.scanInProgressMessage})});if(n)return bP(v_,{title:e.scanFailedTitle,severity:\"danger\",children:bP(BP,{children:e.scanFailedMessage})});if(r)return bP(v_,{title:r.title,severity:\"warning\",children:bP(BP,{children:r.message})});const o=i?function(e,t){const n=e.description?.trim(),r=\"\"===n?void 0:n;return\"Malicious\"===e.type?{severity:\"danger\",title:t.maliciousTitle,message:r??t.maliciousMessage}:\"Warning\"===e.type?{severity:\"warning\",title:t.warningTitle,message:r??t.warningMessage}:null}(i,e):null;return o?SP(v_,{title:o.title,severity:o.severity,children:[bP(BP,{children:o.message}),bP(BP,{size:\"sm\",children:bP(RP,{href:\"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/\",children:e.learnMore})}),SP(BP,{size:\"sm\",children:[bP(_P,{color:\"primary\",name:\"security-tick\"}),\" \",e.securityAdvisedBy,\" \",bP(RP,{href:\"https://www.blockaid.io\",children:\"Blockaid\"})]})]}):null};const b_=\"confirm-sign-and-send-transaction-show-advanced\",S_=\"confirm-sign-and-send-transaction-cancel\",k_=\"confirm-sign-and-send-transaction-confirm\",x_={[b_]:async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await xo(e,bP(O_,{context:n}),n)},[S_]:async function({id:e}){await Eo(e,!1),await BU.deleteKey(`mapInterfaceNameToId.${So}`)},[k_]:async function({id:e}){await Eo(e,!0),await BU.deleteKey(`mapInterfaceNameToId.${So}`)}},E_=e=>e.replace(/([A-Z])/gu,\" $1\").trim().replace(/^./u,e=>e.toUpperCase()),I_=({address:e,scope:t})=>bP(RP,{href:qP(t,\"address\",e),children:bP(jP,{avatar:!1,address:WP(t,e),truncate:!0})}),T_=({instruction:e,scope:t,locale:n})=>{const r=JP(n),{type:i,encoded:o,parsed:a}=e,{programAddress:s,dataBase58:c}=o,u=null!==a,l=E_(i);return SP(LP,{alignment:\"start\",children:[bP(BP,{color:\"alternative\",fontWeight:\"bold\",children:l}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{color:\"alternative\",alignment:\"start\",children:r(\"confirmation.advanced.programId\")}),bP(I_,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map(([e,n])=>SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{color:\"alternative\",children:E_(e)}),$u(n.address)?bP(I_,{address:n.address,scope:t}):bP(BP,{children:Pr(n.address)?.toString()??\"\"})]})),u&&Object.entries(a.data).map(([e,n])=>SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{color:\"alternative\",children:E_(e)}),$u(n)?bP(I_,{address:n,scope:t}):bP(BP,{children:Pr(n)?.toString()??\"\"})]})),!u&&SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{color:\"alternative\",children:r(\"confirmation.advanced.data\")}),bP(BP,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},B_=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const i=JP(n),o=t?\"arrow-up\":\"arrow-down\";return SP(IP,{alignment:\"start\",children:[SP(KP,{name:b_,children:[i(`confirmation.advanced.${t?\"hide\":\"show\"}`),\"&nbsp;\",bP(_P,{name:o,color:\"primary\"})]}),t&&bP(IP,{children:e.map(e=>bP(T_,{locale:n,scope:r,instruction:e}))})]})};const C_=({origin:e,accountAddress:t,accountDomain:n,destinationAddress:r,destinationDomain:i,scope:o,feeInSol:a,nativePrice:s,fetchingPricesStatus:c,preferences:u,networkImage:l})=>{const{currency:d,locale:f}=u,h=JP(f),p=e&&!(e===Yh)?YP(e):null,g=\"fetching\"===c,m=a&&s&&!(\"error\"===c)?c_((y=s,new br(a).multipliedBy(y).toString()),d,f):null;var y;return SP(LP,{children:[p?SP(IP,{children:[SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[SP(IP,{alignment:\"space-between\",direction:\"horizontal\",center:!0,children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:h(\"confirmation.origin\")}),bP(QP,{content:h(\"confirmation.origin.tooltip\"),children:bP(_P,{name:\"question\",color:\"muted\"})})]}),bP(BP,{children:p})]}),bP(IP,{children:null})]}):null,SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:h(\"confirmation.account\")}),n&&t?bP(HP,{domain:n,scope:o,address:t}):null,!n&&t?bP(jP,{address:WP(o,t),truncate:!0,displayName:!0,avatar:!0}):null]}),r?SP(IP,{children:[bP(IP,{children:null}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:h(\"confirmation.recipient\")}),i?bP(HP,{domain:i,scope:o,address:r}):bP(jP,{address:WP(o,r),truncate:!0,displayName:!0,avatar:!0})]})]}):null,bP(IP,{children:null}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:h(\"confirmation.network\")}),SP(IP,{direction:\"horizontal\",alignment:\"center\",children:[bP(IP,{alignment:\"center\",center:!0,children:bP(CP,{borderRadius:\"medium\",src:l??\"\"})}),bP(BP,{children:bo[o].name})]})]}),bP(IP,{children:null}),SP(IP,{alignment:\"space-between\",direction:\"horizontal\",children:[bP(BP,{fontWeight:\"medium\",color:\"alternative\",children:h(\"confirmation.fee\")}),a?bP(NP,{symbol:bo[o].nativeToken.symbol,amount:s_(a,f),hideIcon:!0,fiat:m,isFiatLoading:g}):bP(QP,{content:h(\"confirmation.feeError\"),children:bP(_P,{name:\"warning\"})})]})]})},M_=\"TransactionBlockhashExpired\",P_={status:\"ERROR\",estimatedChanges:{assets:[]},validation:{type:\"Benign\",reason:null},error:{type:null,code:M_}},__={AccountAlreadyInUse:\"transactionScan.errors.accountAlreadyInUse\",ResultWithNegativeLamports:\"transactionScan.errors.insufficientSol\",SlippageToleranceExceeded:\"transactionScan.errors.slippageToleranceExceeded\",ExceededDesiredSlippageLimit:\"transactionScan.errors.slippageToleranceExceeded\",[M_]:\"transactionScan.errors.transactionBlockhashExpired\"};function R_(e,t){const n=JP(t.locale),{code:r}=e;return n((r&&__[r])??\"transactionScan.errors.unknownError\")}const O_=({context:e})=>{const t=JP(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=bo[e.scope],i=e.tokenPrices[r.caip19Id]?.price??null,o=\"ERROR\"===e.scan?.status,a=\"fetching\"===e.scanFetchStatus||o,s=e.preferences.useSecurityAlerts||o,c=e.scan?.error;return SP(FP,{children:[SP(IP,{children:[s?bP(A_,{labels:{scanInProgressTitle:t(\"confirmation.securityScanInProgressTitle\"),scanInProgressMessage:t(\"confirmation.securityScanInProgressMessage\"),scanFailedTitle:t(\"send.simulationTitleAPIError\"),scanFailedMessage:t(\"send.simulationMessageAPIError\"),maliciousTitle:t(\"confirmation.validationErrorTitle\"),maliciousMessage:t(\"confirmation.validationErrorSubtitle\"),warningTitle:t(\"confirmation.validationErrorTitle\"),warningMessage:t(\"confirmation.validationErrorSubtitle\"),learnMore:t(\"confirmation.validationErrorLearnMore\"),securityAdvisedBy:t(\"confirmation.validationErrorSecurityAdviced\")},isFetching:\"fetching\"===e.scanFetchStatus,isFetchError:\"error\"===e.scanFetchStatus,error:c?{title:t(\"confirmation.simulationErrorTitle\"),message:t(\"confirmation.simulationErrorSubtitle\",{reason:R_(c,e.preferences)})}:null,validation:e.scan?.validation??null}):null,bP(zP,{title:t(`confirmation.${e.method}.title`)}),e.preferences.simulateOnChainActions?bP(u_,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,bP(C_,{accountAddress:e.account?.address??null,accountDomain:e.accountDomain??null,destinationAddress:e.destinationAddress??null,destinationDomain:e.destinationDomain??null,scope:e.scope,feeInSol:n,nativePrice:i,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),bP(B_,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),SP($P,{children:[bP(KP,{name:S_,children:t(\"confirmation.cancelButton\")}),bP(KP,{name:k_,disabled:a,children:t(\"confirmation.confirmButton\")})]})]})},U_={method:jS.SignAndSendTransaction,scope:ho.Mainnet,networkImage:kP,account:null,accountDomain:null,destinationAddress:null,destinationDomain:null,transaction:\"\",scan:null,scanFetchStatus:\"fetching\",feeEstimatedInSol:\"0\",tokenPrices:{},tokenPricesFetchStatus:\"fetching\",origin:\"\",preferences:{locale:\"en\",currency:\"usd\",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},advanced:{shown:!1,instructions:[]}};async function N_(e){const t={...U_,...e},n=To().then(e=>{t.preferences=e}).catch(()=>{t.preferences=U_.preferences}),r=(async(e,t)=>{const n=await Hb(t,e),r=\"instructions\"in n?n:await jb(n.messageBytes,e),{instructions:i}=r;return i.map(tS)})(PU.getRpc(t.scope),t.transaction).then(async e=>{t.advanced.instructions=e;try{t.destinationAddress=function(e){for(const t of e){if(!t.parsed||!w_.has(t.type))continue;const e=t.parsed.accounts?.destination;if(e?.address)return e.address}return null}(e)}catch(e){await Th(e),t.destinationAddress=null}}).catch(async e=>{await Th(e),wh.error(e),t.advanced.instructions=[]}),i=t.account?.address?qU.resolveAddress(t.scope,t.account.address).then(e=>{t.accountDomain=e}):Promise.resolve().then(()=>{t.accountDomain=null});await Promise.all([n,r,i]);const{currency:o,useExternalPricingData:a,useSecurityAlerts:s,simulateOnChainActions:c}=t.preferences,u=await ko(bP(O_,{context:t}),t),l=Io(u),d={...t},f=t.destinationAddress?qU.resolveAddress(t.scope,t.destinationAddress).then(e=>{d.destinationDomain=e}).catch(async e=>{await Th(e),d.destinationDomain=null}):Promise.resolve(),h=[bo[t.scope].nativeToken.caip19Id],p=a?jU.getMultipleSpotPrices(h,o).then(e=>{d.tokenPrices=e,d.tokenPricesFetchStatus=\"fetched\"}).catch(async e=>{await Th(e),d.tokenPricesFetchStatus=\"error\"}):Promise.resolve().then(()=>{d.tokenPricesFetchStatus=\"fetched\",d.tokenPrices={}});await Promise.all([f,p]);let g=null;try{const{totalFee:e}=yS.calculateFee(t.transaction);g=wS(e).toString()}catch(e){await Th(e),g=null}d.feeEstimatedInSol=g,await xo(u,bP(O_,{context:d}),d);const m={...d},y=[];if(c&&y.push(\"simulation\"),s&&y.push(\"validation\"),c||s){const e=oN.scanTransaction({method:m.method,accountAddress:m.account?.address??\"\",transaction:m.transaction,scope:m.scope,origin:m.origin,options:y}).then(async e=>{m.scan=e,m.scanFetchStatus=e?\"fetched\":\"error\"}).catch(async e=>{await Th(e),m.scan=null,m.scanFetchStatus=\"error\"});await Promise.all([e])}else m.scanFetchStatus=\"fetched\",m.scan=null;return await xo(u,bP(O_,{context:m}),m),await BU.setKey(`mapInterfaceNameToId.${So}`,u),await snap.request({method:\"snap_scheduleBackgroundEvent\",params:{duration:\"PT20S\",request:{method:\"refreshConfirmationEstimation\"}}}),l}const z_={OnTransactionAdded:\"onTransactionAdded\",OnTransactionApproved:\"onTransactionApproved\",OnTransactionRejected:\"onTransactionRejected\",RefreshConfirmationEstimation:\"refreshConfirmationEstimation\",CloseWebSocketConnections:\"closeWebSocketConnections\"};function F_({origin:e,transactionType:t}){return void 0!==t?t:e===Yh?Hh.Send:Hh.Unknown}var L_=Symbol.for(\"nodejs.util.inspect.custom\"),D_=new Set([\"then\",\"toJSON\",L_,Symbol.asyncIterator,Symbol.iterator,Symbol.toPrimitive,Symbol.toStringTag,Symbol.asyncDispose,Symbol.dispose].filter(e=>null!=e)),j_=new Set([\"__defineGetter__\",\"__defineSetter__\",\"__lookupGetter__\",\"__lookupSetter__\",\"__proto__\",\"constructor\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"toLocaleString\",\"toString\",\"valueOf\"]);function $_(e,t){if(!D_.has(e))return Reflect.get(Object.prototype,e,t)}function K_(e){return D_.has(e)||j_.has(e)}var q_=/^(-?)(\\d+)(?:[eE]\\+?(\\d+))?$/;function H_(e){return JSON.parse(function(e){const t=[];let n=!1;for(let r=0;r<e.length;r++){let i=!1;if(\"\\\\\"===e[r]&&(t.push(e[r++]),i=!i),'\"'!==e[r]){if(!n){const n=W_(e,r);if(n?.length){r+=n.length-1,n.match(/\\.|[eE]-/)?t.push(n):t.push(V_(n));continue}}t.push(e[r])}else t.push(e[r]),i||(n=!n)}return t.join(\"\")}(e),(e,t)=>function(e){return!!e&&\"object\"==typeof e&&\"$n\"in e&&\"string\"==typeof e.$n}(t)?function({$n:e}){const t=e.match(q_);if(t){const[,n,r,i]=t;if(r.length+(i?Number(i):0)<=1e3)return i?BigInt(`${n}${r}`)*10n**BigInt(i):BigInt(e)}throw new Fs(7,{value:e})}(t):t)}function W_(e,t){if(!e[t]?.match(/[-\\d]/))return null;const n=e.slice(t).match(/^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/);return n?n[0]:null}function V_(e){return`{\"$n\":\"${e}\"}`}var G_=0n;function Z_(){const e=G_;return G_++,e.toString()}function J_(e){return null!==e&&(\"object\"==typeof e||\"function\"==typeof e)}function Y_(e){const t=new Set,n={deferreds:t,settled:!1};return Promise.resolve(e).then(e=>{for(const{resolve:n}of t)n(e);t.clear(),n.settled=!0},e=>{for(const{reject:n}of t)n(e);t.clear(),n.settled=!0}),n}var X_=new WeakMap;function Q_(e,t){return t?async function(e){let t;const n=new Promise((n,r)=>{t={reject:r,resolve:n};for(const i of e){if(!J_(i)){Promise.resolve(i).then(n,r);continue}let e=X_.get(i);void 0===e?(e=Y_(i),e.deferreds.add(t),X_.set(i,e)):e.settled?Promise.resolve(i).then(n,r):e.deferreds.add(t)}});return await n.finally(()=>{for(const n of e)J_(n)&&X_.get(n).deferreds.delete(t)})}([new Promise((e,n)=>{t.aborted?n(t.reason):t.addEventListener(\"abort\",function(){n(this.reason)})}),e]):e}var eR=globalThis.AbortController,tR=(globalThis.EventTarget,Object.freeze({data:void 0,error:void 0,status:\"idle\"}));Symbol();Object.freeze({data:void 0,error:void 0,status:\"idle\"});function nR(e){return function(e){return new Proxy(e.api,{defineProperty:()=>!1,deleteProperty:()=>!1,get:(t,n,r)=>K_(n)?$_(n,r):function(...i){const o=n.toString(),a=Reflect.get(t,o,r);if(!a)throw new Fs(Bs,{method:o,params:i});const s=a(...i);return function({transport:e},t){return{reactiveStore:()=>function(e){let t,n=tR;const r=new Set;function i(e){n.status===e.status&&n.data===e.data&&n.error===e.error||(n=e,r.forEach(e=>e()))}const o=async(r,...o)=>{if(t?.abort(),r?.aborted)throw i({data:n.data,error:r.reason,status:\"error\"}),r.reason;const a=new eR;t=a;const s=r?AbortSignal.any([a.signal,r]):a.signal,c=n.data;i({data:c,error:n.error,status:\"running\"});try{const t=await Q_(e(s,...o),s);if(s.aborted)throw s.reason;return i({data:t,error:void 0,status:\"success\"}),t}catch(e){if(a.signal.aborted)throw a.signal.reason;throw i({data:c,error:e,status:\"error\"}),e}},a=(...e)=>o(void 0,...e);return{dispatch:(...e)=>{a(...e).catch(()=>{})},dispatchAsync:a,getState:()=>n,reset:()=>{t?.abort(),t=void 0,i(tR)},subscribe:e=>(r.add(e),()=>{r.delete(e)}),withSignal:e=>({dispatch:(...t)=>{o(e,...t).catch(()=>{})},dispatchAsync:(...t)=>o(e,...t)})}}(n=>t.execute({signal:n,transport:e})),send:async n=>await t.execute({signal:n?.abortSignal,transport:e})}}(e,s)}})}(e)}function rR(e){return new Proxy({},{defineProperty:()=>!1,deleteProperty:()=>!1,get(...t){const[n,r]=t;if(K_(r))return $_(r,t[2]);const i=r.toString();return function(...t){const n=Object.freeze({methodName:i,params:t}),r=e?.requestTransformer?e?.requestTransformer(n):n;return Object.freeze({execute:async({signal:t,transport:n})=>{const i=function(e){return{id:Z_(),jsonrpc:\"2.0\",method:e.methodName,params:e.params}}(r),o=await n({payload:i,signal:t});return e?.responseTransformer?e.responseTransformer(o,r):o}})}}})}function iR(e){return null!=e&&\"object\"==typeof e&&!Array.isArray(e)&&(\"jsonrpc\"in e&&\"2.0\"===e.jsonrpc&&\"method\"in e&&\"string\"==typeof e.method&&\"params\"in e)}function oR({commitmentPropertyName:e,params:t,optionsObjectPositionInParams:n,overrideCommitment:r}){const i=t[n];if(void 0===i||i&&\"object\"==typeof i&&!Array.isArray(i))if(i&&e in i){if(!i[e]||\"finalized\"===i[e]){const r=[...t],{[e]:o,...a}=i;return Object.keys(a).length>0?r[n]=a:n===r.length-1?r.length--:r[n]=void 0,r}}else if(\"finalized\"!==r){const o=[...t];return o[n]={...i,[e]:r},o}return t}function aR(e){return(t,{keyPath:n})=>(\"bigint\"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var sR={};function cR(e){return function t(n,r){if(Array.isArray(n))return n.map((e,n)=>{const i={...r,keyPath:[...r.keyPath,n]};return t(e,i)});if(\"object\"==typeof n&&null!==n){const e={};for(const i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;const o={...r,keyPath:[...r.keyPath,i]};e[i]=t(n[i],o)}return e}return e.reduce((e,t)=>t(e,r),n)}}function uR(e,t){return n=>cR(e)(n,t)}function lR(e){return t=>{const n=(r=[aR((...n)=>e(t,...n))],i={keyPath:[]},e=>{const t=cR(r);return Object.freeze({...e,params:t(e.params,i)})});var r,i;return n(t)}}var dR={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function fR(e){const t=e?.onIntegerOverflow;return n=>bl(n,t?lR(t):e=>e,function({defaultCommitment:e,optionsObjectPositionByMethod:t}){return n=>{const{params:r,methodName:i}=n;if(!Array.isArray(r))return n;const o=t[i];return null==o?n:Object.freeze({methodName:i,params:oR({commitmentPropertyName:\"sendTransaction\"===i?\"preflightCommitment\":\"commitment\",optionsObjectPositionInParams:o,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:dR}))}function hR(e){return function(t,{keyPath:n}){return\"number\"==typeof t&&Number.isInteger(t)||\"bigint\"==typeof t?function(e,t){return t.some(t=>{if(t.length!==e.length)return!1;for(let n=e.length-1;n>=0;n--){const r=e[n],i=t[n];if(i!==r&&(i!==sR||\"number\"!=typeof r))return!1}return!0})}(n,e)?Number(t):BigInt(t):t}}function pR(e){return uR([hR(e)],{keyPath:[]})}var gR,mR=[[\"data\",\"parsed\",\"info\",\"tokenAmount\",\"decimals\"],[\"data\",\"parsed\",\"info\",\"tokenAmount\",\"uiAmount\"],[\"data\",\"parsed\",\"info\",\"rentExemptReserve\",\"decimals\"],[\"data\",\"parsed\",\"info\",\"rentExemptReserve\",\"uiAmount\"],[\"data\",\"parsed\",\"info\",\"delegatedAmount\",\"decimals\"],[\"data\",\"parsed\",\"info\",\"delegatedAmount\",\"uiAmount\"],[\"data\",\"parsed\",\"info\",\"extensions\",sR,\"state\",\"olderTransferFee\",\"transferFeeBasisPoints\"],[\"data\",\"parsed\",\"info\",\"extensions\",sR,\"state\",\"newerTransferFee\",\"transferFeeBasisPoints\"],[\"data\",\"parsed\",\"info\",\"extensions\",sR,\"state\",\"preUpdateAverageRate\"],[\"data\",\"parsed\",\"info\",\"extensions\",sR,\"state\",\"currentRate\"]],yR=[...mR,[\"data\",\"parsed\",\"info\",\"lastExtendedSlotStartIndex\"],[\"data\",\"parsed\",\"info\",\"slashPenalty\"],[\"data\",\"parsed\",\"info\",\"warmupCooldownRate\"],[\"data\",\"parsed\",\"info\",\"decimals\"],[\"data\",\"parsed\",\"info\",\"numRequiredSigners\"],[\"data\",\"parsed\",\"info\",\"numValidSigners\"],[\"data\",\"parsed\",\"info\",\"stake\",\"delegation\",\"warmupCooldownRate\"],[\"data\",\"parsed\",\"info\",\"exemptionThreshold\"],[\"data\",\"parsed\",\"info\",\"burnPercent\"],[\"data\",\"parsed\",\"info\",\"blockRevenueCommissionBps\"],[\"data\",\"parsed\",\"info\",\"commission\"],[\"data\",\"parsed\",\"info\",\"inflationRewardsCommissionBps\"],[\"data\",\"parsed\",\"info\",\"votes\",sR,\"confirmationCount\"],[\"data\",\"parsed\",\"info\",\"votes\",sR,\"latency\"]],wR=[[\"index\"],[\"instructions\",sR,\"accounts\",sR],[\"instructions\",sR,\"programIdIndex\"],[\"instructions\",sR,\"stackHeight\"]],vR=[[\"accountIndex\"],[\"uiTokenAmount\",\"decimals\"],[\"uiTokenAmount\",\"uiAmount\"]],AR=[[\"addressTableLookups\",sR,\"writableIndexes\",sR],[\"addressTableLookups\",sR,\"readonlyIndexes\",sR],[\"header\",\"numReadonlySignedAccounts\"],[\"header\",\"numReadonlyUnsignedAccounts\"],[\"header\",\"numRequiredSignatures\"],[\"instructions\",sR,\"accounts\",sR],[\"instructions\",sR,\"programIdIndex\"],[\"instructions\",sR,\"stackHeight\"],[\"transactionConfig\",\"computeUnitLimit\"],[\"transactionConfig\",\"heapSize\"],[\"transactionConfig\",\"loadedAccountsDataSizeLimit\"]];function bR(e){return(t,n)=>{const r=n.methodName,i=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return bl(t,e=>((e,t)=>{const n=e;if(\"error\"in n){const{error:e}=n;if(e&&\"object\"==typeof e&&\"code\"in e&&(-32002===e.code||-32002n===e.code)&&\"data\"in e&&e.data){const n=uR([hR([[\"loadedAccountsDataSize\"],...yR.map(e=>[\"accounts\",sR,...e]),...wR.map(e=>[\"innerInstructions\",sR,...e])])],{keyPath:[]})(e.data,t);throw Hs({...e,data:n})}throw Hs(n.error)}return n})(e,n),e=>e.result,e=>pR(i??[])(e,n))}}var SR=[\"getAccountInfo\",\"getAgGenesisCert\",\"getBalance\",\"getBlock\",\"getBlockCommitment\",\"getBlockHeight\",\"getBlockProduction\",\"getBlocks\",\"getBlocksWithLimit\",\"getBlockTime\",\"getClusterNodes\",\"getEpochInfo\",\"getEpochSchedule\",\"getFeeForMessage\",\"getFirstAvailableBlock\",\"getGenesisHash\",\"getHealth\",\"getHighestSnapshotSlot\",\"getIdentity\",\"getInflationGovernor\",\"getInflationRate\",\"getInflationReward\",\"getLargestAccounts\",\"getLatestBlockhash\",\"getLeaderSchedule\",\"getMaxRetransmitSlot\",\"getMaxShredInsertSlot\",\"getMinimumBalanceForRentExemption\",\"getMultipleAccounts\",\"getProgramAccounts\",\"getRecentPerformanceSamples\",\"getRecentPrioritizationFees\",\"getSignaturesForAddress\",\"getSignatureStatuses\",\"getSlot\",\"getSlotLeader\",\"getSlotLeaders\",\"getStakeMinimumDelegation\",\"getSupply\",\"getTokenAccountBalance\",\"getTokenAccountsByDelegate\",\"getTokenAccountsByOwner\",\"getTokenLargestAccounts\",\"getTokenSupply\",\"getTransaction\",\"getTransactionCount\",\"getTransactionsForAddress\",\"getVersion\",\"getVoteAccounts\",\"index\",\"isBlockhashValid\",\"minimumLedgerSlot\",\"requestAirdrop\",\"sendTransaction\",\"simulateTransaction\"];function kR(e){return iR(e)&&SR.includes(e.method)}function xR(e){return function(e){const{fromJson:t,headers:n,toJson:r,url:i}=e,o=n&&function(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}(n);return async function({payload:e,signal:n}){const a={body:r?r(e):JSON.stringify(e),headers:{...o,accept:\"application/json\",\"content-type\":\"application/json; charset=utf-8\"},method:\"POST\",signal:n},s=await fetch(i,a);if(!s.ok)throw new Fs(Ts,{headers:s.headers,message:s.statusText,statusCode:s.status});return t?t(await s.text(),e):await s.json()}}({...e,fromJson:(e,t)=>kR(t)?H_(e):JSON.parse(e),toJson:e=>{return kR(e)?(t=e,function(e){return e.replace(/\\{\\s*\"\\$n\"\\s*:\\s*\"(-?\\d+)\"\\s*\\}/g,\"$1\")}(JSON.stringify(t,(e,t)=>\"bigint\"==typeof t?function(e){return{$n:`${e}`}}(t):t,n))):JSON.stringify(e);var t,n}})}var ER=Object.prototype.toString,IR=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function TR(e,t){let n,r,i,o,a,s,c;if(!0===e)return\"true\";if(!1===e)return\"false\";switch(typeof e){case\"object\":if(null===e)return null;if(\"toJSON\"in e&&\"function\"==typeof e.toJSON)return TR(e.toJSON(),t);if(c=ER.call(e),\"[object Array]\"===c){for(i=\"[\",r=e.length-1,n=0;n<r;n++)i+=TR(e[n],!0)+\",\";return r>-1&&(i+=TR(e[n],!0)),i+\"]\"}if(\"[object Object]\"===c){for(o=IR(e).sort(),r=o.length,i=\"\",n=0;n<r;)a=o[n],s=TR(e[a],!1),void 0!==s&&(i&&(i+=\",\"),i+=JSON.stringify(a)+\":\"+s),n++;return\"{\"+i+\"}\"}return JSON.stringify(e);case\"function\":case\"undefined\":return t?null:void 0;case\"bigint\":return`${e.toString()}n`;case\"string\":return JSON.stringify(e);default:return isFinite(e)?e:null}}function BR(e){const t=TR(e,!1);if(void 0!==t)return\"\"+t}function CR(e,t,n){let r=\"\";if(\"number\"==typeof t[0]){const e=t[0]+1,n=e%10,i=e%100;r=1==n&&11!=i?e+\"st\":2==n&&12!=i?e+\"nd\":3==n&&13!=i?e+\"rd\":e+\"th\"}else r=`\\`${t[0].toString()}\\``;const i=t.length>1?t.slice(1).map(e=>\"number\"==typeof e?`[${e}]`:e).join(\".\"):void 0,o=new Fs(Is,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:i?` at path \\`${i}\\``:\"\",value:n,...void 0!==i?{path:i}:void 0});return Ls(o,CR),o}var MR,PR={defaultCommitment:\"confirmed\",onIntegerOverflow(e,t,n){throw CR(e.methodName,t,n)}},_R=globalThis.AbortController;function RR(e){return iR(e)?BR([e.method,e.params]):void 0}function OR(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function UR(e){return bl(xR({...e,headers:{...e.headers?OR(e.headers):void 0,\"solana-client\":\"js/8.3.0\"}}),e=>function(e,t){let n;return async function(r){const{payload:i,signal:o}=r,a=t(i);if(void 0===a)return await e(r);if(n||(queueMicrotask(()=>{n=void 0}),n={}),null==n[a]){const t=new _R,i=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(MR||={}))return;throw e}})();n[a]={abortController:t,numConsumers:0,responsePromise:i}}const s=n[a];if(s.numConsumers++,o){const e=s.responsePromise;return await new Promise((t,n)=>{const r=()=>{o.removeEventListener(\"abort\",r),s.numConsumers-=1,queueMicrotask(()=>{0===s.numConsumers&&s.abortController.abort(MR||={})}),n(o.reason)};o.addEventListener(\"abort\",r),e.then(t).catch(n).finally(()=>{o.removeEventListener(\"abort\",r)})})}return await s.responsePromise}}(e,RR))}function NR(e){return nR({api:(t=PR,rR({requestTransformer:fR(t),responseTransformer:bR({allowedNumericKeyPaths:(gR||(gR={getAccountInfo:yR.map(e=>[\"value\",...e]),getAgGenesisCert:[[\"block\",\"blockId\",sR],[\"signature\",\"bitmap\",sR],[\"signature\",\"signature\",sR]],getBlock:[...vR.flatMap(e=>[[\"transactions\",sR,\"meta\",\"preTokenBalances\",sR,...e],[\"transactions\",sR,\"meta\",\"postTokenBalances\",sR,...e]]),[\"transactions\",sR,\"meta\",\"rewards\",sR,\"commission\"],...wR.map(e=>[\"transactions\",sR,\"meta\",\"innerInstructions\",sR,...e]),...AR.map(e=>[\"transactions\",sR,\"transaction\",\"message\",...e]),[\"transactions\",sR,\"version\"],[\"rewards\",sR,\"commission\"]],getClusterNodes:[[sR,\"featureSet\"],[sR,\"shredVersion\"]],getInflationGovernor:[[\"initial\"],[\"foundation\"],[\"foundationTerm\"],[\"taper\"],[\"terminal\"]],getInflationRate:[[\"foundation\"],[\"total\"],[\"validator\"]],getInflationReward:[[sR,\"commission\"]],getMultipleAccounts:yR.map(e=>[\"value\",sR,...e]),getProgramAccounts:yR.flatMap(e=>[[\"value\",sR,\"account\",...e],[sR,\"account\",...e]]),getRecentPerformanceSamples:[[sR,\"samplePeriodSecs\"]],getSignaturesForAddress:[[sR,\"transactionIndex\"]],getTokenAccountBalance:[[\"value\",\"decimals\"],[\"value\",\"uiAmount\"]],getTokenAccountsByDelegate:mR.map(e=>[\"value\",sR,\"account\",...e]),getTokenAccountsByOwner:mR.map(e=>[\"value\",sR,\"account\",...e]),getTokenLargestAccounts:[[\"value\",sR,\"decimals\"],[\"value\",sR,\"uiAmount\"]],getTokenSupply:[[\"value\",\"decimals\"],[\"value\",\"uiAmount\"]],getTransaction:[...vR.flatMap(e=>[[\"meta\",\"preTokenBalances\",sR,...e],[\"meta\",\"postTokenBalances\",sR,...e]]),[\"meta\",\"rewards\",sR,\"commission\"],...wR.map(e=>[\"meta\",\"innerInstructions\",sR,...e]),...AR.map(e=>[\"transaction\",\"message\",...e]),[\"version\"]],getTransactionsForAddress:[[\"data\",sR,\"transactionIndex\"],...vR.flatMap(e=>[[\"data\",sR,\"meta\",\"preTokenBalances\",sR,...e],[\"data\",sR,\"meta\",\"postTokenBalances\",sR,...e]]),[\"data\",sR,\"meta\",\"rewards\",sR,\"commission\"],...wR.map(e=>[\"data\",sR,\"meta\",\"innerInstructions\",sR,...e]),...AR.map(e=>[\"data\",sR,\"transaction\",\"message\",...e]),[\"data\",sR,\"version\"]],getVersion:[[\"feature-set\"]],getVoteAccounts:[[\"current\",sR,\"commission\"],[\"current\",sR,\"inflationRewardsCommissionBps\"],[\"delinquent\",sR,\"commission\"],[\"delinquent\",sR,\"inflationRewardsCommissionBps\"]],simulateTransaction:[[\"value\",\"loadedAccountsDataSize\"],...yR.map(e=>[\"value\",\"accounts\",sR,...e]),...wR.map(e=>[\"value\",\"innerInstructions\",sR,...e]),...vR.flatMap(e=>[[\"value\",\"preTokenBalances\",sR,...e],[\"value\",\"postTokenBalances\",sR,...e]])]}),gR)})})),transport:e});var t}const zR=yh,FR=[\"getTransaction\",\"getSignaturesForAddress\"],LR=e=>{const t=UR({url:e}),n=UR({url:e,headers:{\"x-bigtable\":\"disabled\"}});return async(...e)=>{const{payload:r}=e[0],{method:i}=r,o=FR.includes(i);return zR.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${i}. ${o?\"Enabling\":\"Disabling\"} BigTable lookups.`),o?t(...e):n(...e)}},DR=yh;async function jR(e){try{await snap.request({method:\"snap_trackError\",params:{error:Un(new Error(JSON.stringify(e)))}}),DR.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){DR.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}const $R=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{DR.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const i=await e(...t);if(function(e){return!(!Se(e)&&!be(e)&&!zs(e))}(i)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(i)}`,responseData:i,requestParams:n};return await jR(e),i}return i}catch(e){const t=function(e,t){const n={method:t,errorMessage:\"Unknown error\"};return e?.currentUrl&&(n.url=e.currentUrl),e instanceof Error?(n.errorMessage=e.message,n.errorStack=e.stack):\"string\"==typeof e?n.errorMessage=e:e?.message?n.errorMessage=e.message:e?.error&&(n.errorMessage=\"string\"==typeof e.error?e.error:JSON.stringify(e.error)),e?.httpStatus?n.statusCode=e.httpStatus:e?.context?.statusCode?n.statusCode=e.context.statusCode:e?.status?n.statusCode=e.status:e?.statusCode&&(n.statusCode=e.statusCode),e?.response?n.responseData=e.response:e?.data&&(n.responseData=e.data),n}(e,r);throw await jR(t),e instanceof Error?e:new Error(t.errorMessage)}},KR=e=>{if(!(e instanceof Error))return Fi(\"Network request failed\",{name:Ui,cause:e});const t=e;if(void 0!==t.httpStatus||e.name===Ui||e.name===Ni)return t;const n=t.context?.statusCode;if(void 0!==n){const r=t.context?.headers?.get(\"Retry-After\");return Fi(e.message,{httpStatus:n,retryAfterMs:qi(r),cause:e})}return Fi(e.message,{name:Ui,cause:e})},qR=yh,HR=(e,t,n,r)=>{if(n?.aborted)throw n.reason??e;if(e instanceof SyntaxError||\"AbortError\"===e?.name)throw e;const i=KR(e),o=void 0!==r||void 0!==i.retryAfterMs?Math.max(r??0,i.retryAfterMs??0):void 0,a=Object.assign(Fi(i.message,{name:i.name,httpStatus:i.httpStatus,retryAfterMs:o,cause:i.cause}),{currentUrl:t});if(!Li(a))throw a;return a},WR=(e,t)=>async(...n)=>{let r;const i=e.length,o=n[0].signal;for(const[a,s]of e.entries()){const e=t[a];try{const t=AbortSignal.timeout(1e4);return qR.info(`[🚌 FailoverTransport] Attempting to use transport ${a+1} of ${i} (URL: ${e})`),await s({...n[0],signal:o?AbortSignal.any([o,t]):t})}catch(t){r=HR(t,e,o,r?.retryAfterMs);const n=a===i-1;qR.error(`[🚌 FailoverTransport] Transport failed (URL: ${e}): ${t}. ${n?\"No more transports to try.\":\"Trying next transport...\"}`)}}throw r??new Error(\"All Solana RPC transports failed.\")},VR=new Set([\"getAccountInfo\",\"getBalance\",\"getGenesisHash\",\"getLatestBlockhash\",\"getMinimumBalanceForRentExemption\",\"getMultipleAccounts\",\"getSignatureStatuses\",\"getSignaturesForAddress\",\"getSlot\",\"getTokenAccountsByOwner\",\"getTokenLargestAccounts\",\"getTransaction\",\"isBlockhashValid\",\"simulateTransaction\"]),GR=(e,t,n)=>{const r=bl(e,(i=LR,e=>e.map(i)));var i;const o=r[0];if(!o)throw new Error(\"At least one Solana RPC URL is required.\");const a=(({readTransport:e,oneShotTransport:t,policy:n})=>async(...r)=>{const{method:i}=r[0].payload;if(\"string\"==typeof i&&VR.has(i)){const t=r[0].signal;return Gi(n,async()=>e(...r),KR,t)}return t(...r)})({readTransport:WR(r,e),oneShotTransport:o,policy:Ki({service:\"solana_rpc\",chainIdCaip:t,logger:n})});return $R(a)};var ZR;!function(e){e.InvalidSubdomain=\"InvalidSubdomain\",e.PrimaryDomainNotFound=\"PrimaryDomainNotFound\",e.NoRecordData=\"NoRecordData\",e.InvalidRecordData=\"InvalidRecordData\",e.InvalidEvmAddress=\"InvalidEvmAddress\",e.InvalidInjectiveAddress=\"InvalidInjectiveAddress\",e.InvalidARecord=\"InvalidARecord\",e.InvalidAAAARecord=\"InvalidAAAARecord\",e.InvalidRecordInput=\"InvalidRecordInput\",e.AccountDoesNotExist=\"AccountDoesNotExist\",e.NoAccountData=\"NoAccountData\",e.InvalidInput=\"InvalidInput\",e.InvalidDomain=\"InvalidDomain\",e.MissingVerifier=\"MissingVerifier\",e.PythFeedNotFound=\"PythFeedNotFound\",e.InvalidRoa=\"InvalidRoa\",e.InvalidParent=\"InvalidParent\",e.NftAccountNotFound=\"NftRecordNotFound\",e.PdaOwnerNotAllowed=\"PdaOwnerNotAllowed\",e.DomainDoesNotExist=\"DomainDoesNotExist\",e.RecordMalformed=\"RecordMalformed\",e.CouldNotFindNftOwner=\"CouldNotFindNftOwner\",e.InvalidValidation=\"InvalidValidation\",e.InvalidSerializedData=\"InvalidSerializedData\",e.UnsupportedTld=\"UnsupportedTld\",e.DomainExpired=\"DomainExpired\",e.CouldNotFindSrsOwner=\"CouldNotFindSrsOwner\",e.SnsSolResolutionMismatch=\"SnsSolResolutionMismatch\"}(ZR||(ZR={}));class JR extends Error{type;constructor(e,t){super(t),this.name=\"SNSError\",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,JR)}}class YR extends JR{constructor(e){super(ZR.PrimaryDomainNotFound,e)}}class XR extends JR{constructor(e){super(ZR.NoRecordData,e)}}class QR extends JR{constructor(e){super(ZR.AccountDoesNotExist,e)}}class eO extends JR{constructor(e){super(ZR.NoAccountData,e)}}class tO extends JR{constructor(e){super(ZR.InvalidInput,e)}}class nO extends JR{constructor(e){super(ZR.InvalidRoa,e)}}class rO extends JR{constructor(e){super(ZR.NftAccountNotFound,e)}}class iO extends JR{constructor(e){super(ZR.PdaOwnerNotAllowed,e)}}class oO extends JR{constructor(e){super(ZR.DomainDoesNotExist,e)}}class aO extends JR{constructor(e){super(ZR.RecordMalformed,e)}}class sO extends JR{constructor(e){super(ZR.CouldNotFindNftOwner,e)}}class cO extends JR{constructor(e){super(ZR.InvalidValidation,e)}}class uO extends JR{constructor(e){super(ZR.InvalidSerializedData,e)}}class lO extends JR{constructor(e){super(ZR.UnsupportedTld,e)}}const dO=\".sol\",fO=\".sns\",hO=[fO,dO],pO=(e,t=hO)=>{const n=((e,t=hO)=>t.find(t=>e.endsWith(t)))(e,t);if(!n)throw new lO(`Domain \"${e}\" is missing a supported TLD suffix (${t.join(\"/\")})`);return[e.slice(0,-n.length),n]},gO=new WeakSet,mO=Vu(),yO=(Tu(),Pu()),wO=Sm(),vO=Fu(),AO=\"58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx\",bO=\"nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk\",SO=\"33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z\",kO=\"2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo\",xO=vO.encode(\"tokenized_name\"),EO=async({rpc:e,domainAddress:t})=>{try{const n=await(async({domainAddress:e})=>{const[t]=await rl({programAddress:bO,seeds:[xO,mO.encode(e)]});return t})({domainAddress:t}),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const i=await zy(e,r.value[0].address);if(!i.exists)return null;const o=wO.decode(i.data);return\"1\"===o.amount.toString()?o.owner:null}catch(e){if(zs(e,$o))return null;throw e}};var IO;!function(e){e.IPFS=\"IPFS\",e.ARWV=\"ARWV\",e.SOL=\"SOL\",e.ETH=\"ETH\",e.BTC=\"BTC\",e.LTC=\"LTC\",e.DOGE=\"DOGE\",e.Email=\"email\",e.Url=\"url\",e.Discord=\"discord\",e.Github=\"github\",e.Reddit=\"reddit\",e.Twitter=\"twitter\",e.Telegram=\"telegram\",e.Pic=\"pic\",e.SHDW=\"SHDW\",e.POINT=\"POINT\",e.BSC=\"BSC\",e.Injective=\"INJ\",e.Backpack=\"backpack\",e.A=\"A\",e.AAAA=\"AAAA\",e.CNAME=\"CNAME\",e.TXT=\"TXT\",e.Background=\"background\",e.BASE=\"BASE\",e.IPNS=\"IPNS\",e.Bio=\"bio\"}(IO||(IO={}));new Map([[IO.SOL,96],[IO.ETH,20],[IO.BSC,20],[IO.Injective,20],[IO.A,4],[IO.AAAA,16],[IO.Background,32]]);var TO;!function(e){e[e.V1=1]=\"V1\",e[e.V2=2]=\"V2\"}(TO||(TO={}));const BO=async(e,t,n)=>{const r=await(async e=>{const t=vO.encode(\"SPL Name Service\"+e),n=await crypto.subtle.digest(\"SHA-256\",t);return new Uint8Array(n)})(e),i=await(async(e,t,n)=>{const r=[e];r.push(n?mO.encode(n):new Uint8Array(32)),r.push(t?mO.encode(t):new Uint8Array(32));const[i]=await rl({programAddress:\"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX\",seeds:r});return i})(r,t,n);return i},CO=async({domain:e,record:t})=>{const n=t===TO.V2?kO:void 0,r={[TO.V2]:\"\u0002\",[TO.V1]:\"\u0001\"}[t]||\"\\0\",i=e.split(\".\");if(2===i.length){const e=await BO(i[1],AO);return{domainAddress:await BO(r+i[0],e,n),parentAddress:e,isSub:!0}}if(3===i.length&&t){const e=await BO(i[2],AO),t=await BO(\"\\0\"+i[1],e);return{domainAddress:await BO(r+i[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(i.length>=3)throw new tO(\"The domain is malformed\");return{domainAddress:await BO(e,AO),isSub:!1}};var MO,PO=[\"u8\",\"u16\",\"u32\",\"u64\",\"u128\",\"i8\",\"i16\",\"i32\",\"i64\",\"i128\",\"f32\",\"f64\"],_O=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var n=t.substring(1),r=parseInt(n)/8;this.resize_if_necessary(r);var i=\"f\"===t[0]?\"setFloat\".concat(n):\"i\"===t[0]?\"setInt\".concat(n):\"setUint\".concat(n);this.view[i](this.offset,e,!0),this.offset+=r},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),RO=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error(\"Error in schema, the buffer is smaller than expected\")},e.prototype.consume_value=function(e){var t=e.substring(1),n=parseInt(t)/8;this.assert_enough_buffer(n);var r=\"f\"===e[0]?\"getFloat\".concat(t):\"i\"===e[0]?\"getInt\".concat(t):\"getUint\".concat(t),i=this.view[r](this.offset,!0);return this.offset+=n,i},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),OO=(MO=function(e,t){return MO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},MO(e,t)},function(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Class extends value \"+String(t)+\" is not a constructor or null\");function n(){this.constructor=e}MO(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function UO(e,t,n){if(typeof e!==t)throw new Error(\"Expected \".concat(t,\" not \").concat(typeof e,\"(\").concat(e,\") at \").concat(n.join(\".\")))}function NO(e,t,n){if(e!==t)throw new Error(\"Array length \".concat(e,\" does not match schema length \").concat(t,\" at \").concat(n.join(\".\")))}var zO=PO.concat([\"bool\",\"string\"]),FO=[\"option\",\"enum\",\"array\",\"set\",\"map\",\"struct\"],LO=function(e){function t(t,n){var r=\"Invalid schema: \".concat(JSON.stringify(t),\" expected \").concat(n);return e.call(this,r)||this}return OO(t,e),t}(Error);function DO(e){if(\"string\"!=typeof e||!zO.includes(e)){if(e&&\"object\"==typeof e){var t=Object.keys(e);if(1===t.length&&FO.includes(t[0])){var n=t[0];if(\"option\"===n)return DO(e[n]);if(\"enum\"===n)return function(e){if(!Array.isArray(e))throw new LO(e,\"Array\");for(var t=0,n=e;t<n.length;t++){var r=n[t];if(\"object\"!=typeof r||!(\"struct\"in r))throw new Error('Missing \"struct\" key in enum schema');if(\"object\"!=typeof r.struct||1!==Object.keys(r.struct).length)throw new Error('The \"struct\" in each enum must have a single key');DO({struct:r.struct})}}(e[n]);if(\"array\"===n)return function(e){if(\"object\"!=typeof e)throw new LO(e,\"{ type, len? }\");if(e.len&&\"number\"!=typeof e.len)throw new Error(\"Invalid schema: \".concat(e));if(\"type\"in e)return DO(e.type);throw new LO(e,\"{ type, len? }\")}(e[n]);if(\"set\"===n)return DO(e[n]);if(\"map\"===n)return function(e){if(\"object\"!=typeof e||!(\"key\"in e)||!(\"value\"in e))throw new LO(e,\"{ key, value }\");DO(e.key),DO(e.value)}(e[n]);if(\"struct\"===n)return function(e){if(\"object\"!=typeof e)throw new LO(e,\"object\");for(var t in e)DO(e[t])}(e[n])}}throw new LO(e,FO.join(\", \")+\" or \"+zO.join(\", \"))}}!function(){function e(e){this.encoded=new _O,this.fieldPath=[\"value\"],this.checkTypes=e}e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if(\"string\"==typeof t){if(PO.includes(t))return this.encode_integer(e,t);if(\"string\"===t)return this.encode_string(e);if(\"bool\"===t)return this.encode_boolean(e)}if(\"object\"==typeof t){if(\"option\"in t)return this.encode_option(e,t);if(\"enum\"in t)return this.encode_enum(e,t);if(\"array\"in t)return this.encode_array(e,t);if(\"set\"in t)return this.encode_set(e,t);if(\"map\"in t)return this.encode_map(e,t);if(\"struct\"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var n=parseInt(t.substring(1));n<=32||\"f64\"==t?(this.checkTypes&&UO(e,\"number\",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!([\"number\",\"string\",\"bigint\",\"boolean\"].includes(typeof e)||\"object\"==typeof e&&null!==e&&\"toString\"in e))throw new Error(\"Expected bigint, number, boolean or string not \".concat(typeof e,\"(\").concat(e,\") at \").concat(t.join(\".\")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),n))},e.prototype.encode_bigint=function(e,t){for(var n=t/8,r=new Uint8Array(n),i=0;i<n;i++)r[i]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(r))},e.prototype.encode_string=function(e){this.checkTypes&&UO(e,\"string\",this.fieldPath);for(var t=e,n=[],r=0;r<t.length;r++){var i=t.charCodeAt(r);i<128?n.push(i):i<2048?n.push(192|i>>6,128|63&i):i<55296||i>=57344?n.push(224|i>>12,128|i>>6&63,128|63&i):(r++,i=65536+((1023&i)<<10|1023&t.charCodeAt(r)),n.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}this.encoded.store_value(n.length,\"u32\"),this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_boolean=function(e){this.checkTypes&&UO(e,\"boolean\",this.fieldPath),this.encoded.store_value(e?1:0,\"u8\")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,\"u8\"):(this.encoded.store_value(1,\"u8\"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if(\"object\"!=typeof e||null===e)throw new Error(\"Expected object not \".concat(typeof e,\"(\").concat(e,\") at \").concat(t.join(\".\")))}(e,this.fieldPath);for(var n=Object.keys(e)[0],r=0;r<t.enum.length;r++){var i=t.enum[r];if(n===Object.keys(i.struct)[0])return this.encoded.store_value(r,\"u8\"),this.encode_struct(e,i)}throw new Error(\"Enum key (\".concat(n,\") not found in enum schema: \").concat(JSON.stringify(t),\" at \").concat(this.fieldPath.join(\".\")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&\"object\"==typeof e&&\"length\"in e&&\"number\"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error(\"Expected Array-like not \".concat(typeof e,\"(\").concat(e,\") at \").concat(this.fieldPath.join(\".\")))},e.prototype.encode_arraylike=function(e,t){t.array.len?NO(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,\"u32\");for(var n=0;n<e.length;n++)this.encode_value(e[n],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?NO(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,\"u32\"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&UO(e,\"object\",this.fieldPath);var n=e instanceof Set?Array.from(e.values()):Object.values(e);this.encoded.store_value(n.length,\"u32\");for(var r=0,i=n;r<i.length;r++){var o=i[r];this.encode_value(o,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&UO(e,\"object\",this.fieldPath);var n=e instanceof Map,r=n?Array.from(e.keys()):Object.keys(e);this.encoded.store_value(r.length,\"u32\");for(var i=0,o=r;i<o.length;i++){var a=o[i];this.encode_value(a,t.map.key),this.encode_value(n?e.get(a):e[a],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&UO(e,\"object\",this.fieldPath);for(var n=0,r=Object.keys(t.struct);n<r.length;n++){var i=r[n];this.fieldPath.push(i),this.encode_value(e[i],t.struct[i]),this.fieldPath.pop()}}}();var jO,$O,KO=function(){function e(e){this.buffer=new RO(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if(\"string\"==typeof e){if(PO.includes(e))return this.decode_integer(e);if(\"string\"===e)return this.decode_string();if(\"bool\"===e)return this.decode_boolean()}if(\"object\"==typeof e){if(\"option\"in e)return this.decode_option(e);if(\"enum\"in e)return this.decode_enum(e);if(\"array\"in e)return this.decode_array(e);if(\"set\"in e)return this.decode_set(e);if(\"map\"in e)return this.decode_map(e);if(\"struct\"in e)return this.decode_struct(e)}throw new Error(\"Unsupported type: \".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||\"f64\"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith(\"i\"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var n=e/8,r=new Uint8Array(this.buffer.consume_bytes(n)),i=r.reduceRight(function(e,t){return e+t.toString(16).padStart(2,\"0\")},\"\");return t&&r[n-1]?BigInt.asIntN(e,BigInt(\"0x\".concat(i))):BigInt(\"0x\".concat(i))},e.prototype.decode_string=function(){for(var e=this.decode_integer(\"u32\"),t=new Uint8Array(this.buffer.consume_bytes(e)),n=[],r=0;r<e;++r){var i=t[r];if(i<128)n.push(i);else if(i<224)n.push((31&i)<<6|63&t[++r]);else if(i<240)n.push((15&i)<<12|(63&t[++r])<<6|63&t[++r]);else{var o=(7&i)<<18|(63&t[++r])<<12|(63&t[++r])<<6|63&t[++r];n.push(o)}}return String.fromCodePoint.apply(String,n)},e.prototype.decode_boolean=function(){return this.buffer.consume_value(\"u8\")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value(\"u8\");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error(\"Invalid option \".concat(t));return null},e.prototype.decode_enum=function(e){var t,n=this.buffer.consume_value(\"u8\");if(n>e.enum.length)throw new Error(\"Enum option \".concat(n,\" is not available\"));var r=e.enum[n].struct,i=Object.keys(r)[0];return(t={})[i]=this.decode_value(r[i]),t},e.prototype.decode_array=function(e){for(var t=[],n=e.array.len?e.array.len:this.decode_integer(\"u32\"),r=0;r<n;++r)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer(\"u32\"),n=new Set,r=0;r<t;++r)n.add(this.decode_value(e.set));return n},e.prototype.decode_map=function(e){for(var t=this.decode_integer(\"u32\"),n=new Map,r=0;r<t;++r){var i=this.decode_value(e.map.key),o=this.decode_value(e.map.value);n.set(i,o)}return n},e.prototype.decode_struct=function(e){var t={};for(var n in e.struct)t[n]=this.decode_value(e.struct[n]);return t},e}();function qO(e,t,n){return void 0===n&&(n=!0),n&&DO(e),new KO(t).decode(e)}!function(e){e[e.Uninitialized=0]=\"Uninitialized\",e[e.CentralState=1]=\"CentralState\",e[e.ActiveRecord=2]=\"ActiveRecord\",e[e.InactiveRecord=3]=\"InactiveRecord\"}(jO||(jO={}));class HO{tag;nonce;nameAccount;owner;nftMint;static schema={struct:{tag:\"u8\",nonce:\"u8\",nameAccount:{array:{type:\"u8\",len:32}},owner:{array:{type:\"u8\",len:32}},nftMint:{array:{type:\"u8\",len:32}}}};static LEN=98;constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=mO.decode(e.nameAccount),this.owner=mO.decode(e.owner),this.nftMint=mO.decode(e.nftMint)}static deserialize(e){try{return new HO(qO(this.schema,e))}catch{throw new uO(\"Failed to deserialize NftState data\")}}static async retrieve(e,t){const n=await zy(e,t);if(!n.exists)throw new rO(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(bO,{encoding:\"base64\",filters:[{dataSize:BigInt(HO.LEN)},{memcmp:{offset:BigInt(0),bytes:\"3\",encoding:\"base58\"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:\"base58\"}}]}).send();if(1!==n.length)throw new rO(`NFT not found: ${t}`);return this.deserialize(yO.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await rl({programAddress:bO,seeds:[vO.encode(\"nft_record\"),mO.encode(e)]});return t}}!function(e){e[e.None=0]=\"None\",e[e.Solana=1]=\"Solana\",e[e.Ethereum=2]=\"Ethereum\",e[e.UnverifiedSolana=3]=\"UnverifiedSolana\"}($O||($O={}));const WO=e=>{switch(e){case $O.None:return 0;case $O.Ethereum:return 20;case $O.Solana:case $O.UnverifiedSolana:return 32;default:throw new cO(\"Invalid validation enum\")}};class VO{stalenessValidation;rightOfAssociationValidation;contentLength;static schema={struct:{stalenessValidation:\"u16\",rightOfAssociationValidation:\"u16\",contentLength:\"u32\"}};static LEN=8;constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new VO(qO(this.schema,e,!0))}static async retrieve(e,t){const n=await zy(e,t);if(!n.exists)throw new XR(\"Record account not found\");return this.deserialize(n.data.slice(96,96+this.LEN))}}class GO{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=VO.deserialize(e.slice(96,96+VO.LEN));return new GO(t,e.slice(96+VO.LEN))}static async retrieve(e,t){const n=await zy(e,t);if(!n.exists)throw new XR(\"Record account not found\");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await Ly(e,t)).map(e=>e.exists?this.deserialize(e.data):void 0)}getContent(){const e=WO(this.header.stalenessValidation)+WO(this.header.rightOfAssociationValidation),t=e+this.header.contentLength;if(t>this.data.length)throw new uO(\"Record content length exceeds account data\");return this.data.slice(e,t)}getStalenessId(){const e=WO(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=WO(this.header.stalenessValidation),t=e+WO(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}class ZO{parentName;owner;class;data;static schema={struct:{parentName:{array:{type:\"u8\",len:32}},owner:{array:{type:\"u8\",len:32}},class:{array:{type:\"u8\",len:32}}}};static HEADER_LEN=96;constructor(e){this.parentName=mO.decode(e.parentName),this.owner=mO.decode(e.owner),this.class=mO.decode(e.class)}static deserialize(e){try{const t=new ZO(qO(this.schema,e));return t.data=e?.slice(this.HEADER_LEN),t}catch{throw new uO(\"Failed to deserialize RegistryState data\")}}static async retrieve(e,t){const n=await zy(e,t);if(!n.exists)throw new QR(\"The domain account does not exist\");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await Ly(e,t)).map(e=>e.exists?this.deserialize(e.data):void 0)}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}}const JO=57896044618658097711785492504343953926634992332820282019728792003956564819949n,YO=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function XO(e){const t=e%JO;return t>=0n?t:JO+t}function QO(e,t){let n=e;for(;t-- >0n;)n*=n,n%=JO;return n}function eU(e,t){const n=XO(t*t*t),r=function(e){const t=e*e%JO*e%JO,n=QO(t,2n)*t%JO,r=QO(n,1n)*e%JO,i=QO(r,5n)*r%JO,o=QO(i,10n)*i%JO,a=QO(o,20n)*o%JO,s=QO(a,40n)*a%JO,c=QO(s,80n)*s%JO,u=QO(c,80n)*s%JO,l=QO(u,10n)*i%JO;return QO(l,2n)*e%JO}(e*XO(n*n*t));let i=XO(e*n*r);const o=XO(t*i*i),a=i,s=XO(i*YO),c=o===e,u=o===XO(-e),l=o===XO(-e*YO);return c&&(i=a),(u||l)&&(i=s),1n==(1n&XO(i))&&(i=XO(-i)),c||u?i:null}function tU(e){const t=mO.encode(e);if(32!==t.byteLength)return!1;const n=function(e){const t=e.reduce((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`,\"\");return BigInt(`0x${t}`)}(t);return function(e,t){const n=XO(e*e),r=eU(XO(n-1n),XO(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}(n,t[31])}const nU=async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=Hu().encode(e);return await crypto.subtle.importKey(\"raw\",t,{name:\"Ed25519\"},!0,[\"verify\"])}(n),i=vO.encode((o=e,Array.from(o).map(e=>e.toString(16).padStart(2,\"0\")).join(\"\")));var o;return crypto.subtle.verify({name:\"Ed25519\"},r,t,i)},rU=async({rpc:e,domain:t,options:n})=>{const{domainAddress:r}=await CO({domain:t}),i=await HO.getAddress(r),o=await(async({domain:e,record:t})=>{const{domainAddress:n}=await CO({domain:t+\".\"+e,record:TO.V1});return n})({domain:t,record:IO.SOL}),a=await(async({domain:e,record:t})=>{const{domainAddress:n}=await CO({domain:e});return await BO(`\u0002${t}`,n,kO)})({domain:t,record:IO.SOL}),[s,c,u,l]=await Ly(e,[r,i,o,a]);if(!s.exists)throw new oO(`Domain ${t} does not exist`);const d=ZO.deserialize(s.data);if(c.exists){if(HO.deserialize(c.data).tag===jO.ActiveRecord){const t=await EO({rpc:e,domainAddress:r});if(!t)throw new sO;return t}}e:if(l.exists){const e=GO.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new aO(\"Record is malformed\");if(e.header.rightOfAssociationValidation!==$O.Solana||e.header.stalenessValidation!==$O.Solana)throw new cO;if(d.owner!==mO.decode(t))break e;if(h=r,(f=n).length===h.length&&f.every((e,t)=>e===h[t]))return mO.decode(r);throw new nO(`The RoA ID should be ${mO.decode(r)} but is ${mO.decode(n)} `)}var f,h;if(u.exists){const e=new Uint8Array([...u.data.slice(ZO.HEADER_LEN,ZO.HEADER_LEN+32),...mO.encode(o)]),t=u.data.slice(ZO.HEADER_LEN+32,ZO.HEADER_LEN+32+64);if(await nU({data:e,signature:t,address:d.owner}))return mO.decode(u.data.slice(ZO.HEADER_LEN,ZO.HEADER_LEN+32))}if(!tU(d.owner)){if(\"any\"===n.allowPda)return d.owner;if(n.allowPda){const t=await zy(e,d.owner);if(!t.exists)throw new iO(\"Invalid domain owner account\");if(n.programIds.some(e=>t.programAddress===e))return d.owner;throw new iO(`The program ${t.programAddress} is not allowed`)}throw new iO}return d.owner};const iU=async({rpc:e,domain:t,options:n={allowPda:!1}})=>{if(t.endsWith(dO)){const r=t.slice(0,-4);return await(async({rpc:e,domain:t})=>{const[n,r]=pO(t);if(r!==dO)return[n,r];if(gO.has(e))throw new lO(\"Legacy .sol domains are no longer supported\");if(await e.getSlot({commitment:\"finalized\"}).send()>=452825395n)throw gO.add(e),new lO(\"Legacy .sol domains are no longer supported\");return[n,dO]})({rpc:e,domain:t}),rU({rpc:e,domain:r,options:n})}const[r,i]=pO(t);if(i===fO)return rU({rpc:e,domain:r,options:n});throw new lO(`Domain \"${t}\" has an unsupported TLD`)};class oU{tag;nameAccount;static schema={struct:{tag:\"u8\",nameAccount:{array:{type:\"u8\",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=mO.decode(e.nameAccount)}static deserialize(e){try{return new oU(qO(this.schema,e))}catch{throw new uO(\"Failed to deserialize PrimaryDomainState data\")}}static async retrieve(e,t){const n=await zy(e,t);if(!n.exists)throw new YR(\"The favourite account does not exist\");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await Ly(e,t)).map(e=>e.exists?this.deserialize(e.data):void 0)}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}static async getAddress(e,t){const[n]=await rl({programAddress:e,seeds:[vO.encode(\"favourite_domain\"),mO.encode(t)]});return n}}async function aU({rpc:e,domainAddress:t,parentAddress:n}){const r=await(async({domainAddress:e,parentAddress:t})=>await BO(e,t,SO))({domainAddress:t,parentAddress:n}),i=await ZO.retrieve(e,r);if(!i.data)throw new eO(\"The registry data is empty\");return function({data:e,trimFirstNullByte:t=!1}){if(!e)return;const n=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0);return vO.decode(e.subarray(4,4+n)).replace(/^\\0/,t?\"\":\"\\0\")}({data:i.data,trimFirstNullByte:!!n})}const sU=\"ERROR\",cU=\"Benign\",uU=\"Error\",lU={unfair_trade:\"Unfair trade of assets, without adequate compensation to the owner's account\",transfer_farming:\"Substantial transfer of the account's assets to untrusted entities\",writable_accounts_farming:\"Transaction exposes unused writable account, can be utilized in BIT-FLIP attacks patterns\",native_ownership_change:\"The account transferred ownership of its native SOL to untrusted entities\",spl_token_ownership_change:\"The account transferred ownership of its SPL tokens to untrusted entities\",exposure_farming:\"The account delegates ownership, thereby exposing its assets to untrusted spenders\",known_attacker:\"A known attacker's account is involved in the transaction\",invalid_signature:\"One of the transactions provided contains non valid signatures, that can lead misleading simulation results\",honeypot:\"The account invests funds in a token that is part of an orchestrated honeypot scheme\",other:\"The transaction was marked as malicious for other reason, further details would be described in features field\"};function dU(e){return`Security alert: ${lU[e??\"\"]??e??\"Unknown reason\"}`}class fU{securityAlertsApiClient;analyticsService;logger;trackError;constructor({securityAlertsApiClient:e,analyticsService:t,logger:n,trackError:r}){this.securityAlertsApiClient=e,this.analyticsService=t,this.logger=n,this.trackError=r}async trackScanCompleted(e,t){const{origin:n,accountType:r,scope:i}=e;if(!r)return;const o=function(e){return e&&e!==cU&&e!==uU?e:null}(t.validation?.type);if(await this.analyticsService.trackSecurityScanCompleted({origin:n,accountType:r,chainIdCaip:i,scanStatus:t.status,hasSecurityAlerts:Boolean(o)}),!o)return;const a=t.validation?.reason??null;await this.analyticsService.trackSecurityAlertDetected({origin:n,accountType:r,chainIdCaip:i,securityAlertResponse:o,securityAlertReason:a,securityAlertDescription:dU(a)})}async trackScanFailed(e){const{origin:t,accountType:n,scope:r}=e;n&&await this.analyticsService.trackSecurityScanCompleted({origin:t,accountType:n,chainIdCaip:r,scanStatus:sU,hasSecurityAlerts:!1})}}const hU=G({url:j(V()),non_dapp:q(N())}),pU=G({method:te(V()),encoding:L(\"base64\"),account_address:te(V()),metadata:hU,chain:z([\"mainnet\",\"devnet\",\"testnet\",\"localnet\"]),transactions:te(U(te(V()))),options:te(U(z([\"simulation\",\"validation\"])))}),gU=Z([G({type:V(),message:V()}),G({type:V(),message:V(),number:q(j($())),code:q(j(V())),transaction_index:$()}),G({type:V(),message:V(),transaction_index:$(),instruction_index:$(),program_account:j(V())})]),mU=G({usd_price:q(j($())),summary:q(j(V())),value:q(j($())),raw_value:q(j($()))}),yU=G({type:V(),address:q(V()),symbol:q(V()),name:q(V()),logo:q(j(V())),decimals:q($())}),wU=G({asset_type:V(),asset:yU,in:q(j(mU)),out:q(j(mU))}),vU=G({account_assets_diff:q(U(wU))}),AU=G({account_summary:q(vU)}),bU=G({result_type:q(V()),reason:q(j(V()))}),SU=G({simulation:q(j(AU)),validation:q(j(bU))}),kU=G({status:z([\"SUCCESS\",\"ERROR\"]),result:q(SU),error:q(j(V())),error_details:q(j(gU))});var xU=n(48).hp;const EU={[ho.Mainnet]:\"mainnet\",[ho.Devnet]:\"devnet\",[ho.Testnet]:\"testnet\",[ho.Localnet]:\"localnet\"};const IU=function({sourceAssetId:e,destAssetId:t}){if(void 0!==e&&void 0!==t)try{const{chainId:n}=tt(e),{chainId:r}=tt(t);return n===r?Hh.Swap:Hh.BridgeSend}catch{return}};const TU=new class{#w;#st=new Map;constructor(e){this.#w=e.withPrefix(\"[⚡ EventEmitter]\")}on(e,t){this.#w.info(`Adding listener for event ${e}`),this.#st.has(e)||this.#st.set(e,new Set),this.#st.get(e)?.add(t)}off(e,t){this.#w.info(`Removing listener for event ${e}`);const n=this.#st.get(e);n&&(n.delete(t),0===n.size&&this.#st.delete(e))}async emitSync(e,t){this.#w.info(`Emitting event ${e}`);const n=this.#st.get(e);if(n){const e=Array.from(n).map(async e=>await e(t));await Promise.allSettled(e)}}removeAllListeners(e){e?(this.#w.info(`Removing all listeners for event ${e}`),this.#st.delete(e)):(this.#w.info(\"Removing all listeners for all events\"),this.#st.clear())}listenerCount(e){const t=this.#st.get(e);return t?t.size:0}eventNames(){return Array.from(this.#st.keys())}}(wh),BU=new class{#ct=new Ur;#g;constructor(e){this.#g=e}async#ut(e){const t=await Or()({method:\"snap_getState\",params:{...void 0===e?{}:{key:e},encrypted:this.#g.encrypted}});return null==t?void 0:Pr(t)}async#h(e,t){await Or()({method:\"snap_setState\",params:{key:e,value:Mr(t),encrypted:this.#g.encrypted}})}async#lt(){const e=await this.#ut()??{};return t=_r(this.#g.defaultState),n=e,{...t,...Object.fromEntries(Object.entries(n).filter(([e,t])=>null!=t&&(!t||\"object\"!=typeof t||Object.keys(t).length>0)))};var t,n}async get(){return this.#ct.wrapRegularStateOperation(async()=>this.#lt())}async getKey(e){return this.#ct.wrapRegularStateOperation(async()=>this.#ut(e))}async setKey(e,t){await this.#ct.wrapRegularStateWriteOperation(async()=>this.#h(e,t))}async setKeyWith(e,t){await this.#ct.wrapRegularStateWriteOperation(async()=>this.#h(e,t(await this.#ut(e))))}async update(e){return await this.#ct.wrapManageStateOperation(async()=>{const t=e(await this.#lt());return await Or()({method:\"snap_manageState\",params:{operation:\"update\",newState:Mr(t),encrypted:this.#g.encrypted}}),t})}async deleteKey(e){await this.deleteKeys([e])}async deleteKeys(e){await this.update(t=>(e.forEach(e=>{Rr(t,e)}),t))}}({encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},subscriptions:{},webSocketConnections:{closeWebSocketConnectionsBackgroundEventId:null}}});((e,t)=>{const n=async()=>t.deleteKey(\"assets\");e.on(\"onStart\",n),e.on(\"onUpdate\",n),e.on(\"onInstall\",n)})(TU,BU);const CU=new class{#K=new Map;#w;constructor(e){this.#w=e}#dt(e){if(void 0!==e){if(\"number\"!=typeof e)throw new Error(\"TTL must be a number\");if(e<0)throw new Error(\"TTL must be positive\");if(e>Number.MAX_SAFE_INTEGER)throw new Error(\"TTL must be less than 2^53 - 1\")}}#We(e){return e.expiresAt<Date.now()}async#ft(){const e=[];for(const[t,n]of this.#K.entries())this.#We(n)&&e.push(t);await this.mdelete(e)}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#dt(n),this.#K.set(e,{value:t,expiresAt:Math.min(Date.now()+n,Number.MAX_SAFE_INTEGER)})}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){this.#K.clear()}async has(e){const t=this.#K.get(e);return!!t&&(!this.#We(t)||(this.#K.delete(e),!1))}async keys(){return await this.#ft(),Array.from(this.#K.keys())}async size(){return await this.#ft(),this.#K.size}async peek(e){const t=this.#K.get(e);if(t){if(!this.#We(t))return t.value;this.#K.delete(e)}}async mget(e){await this.#ft();const t={};for(const n of e){const e=this.#K.get(n);e?(this.#w.info(`[InMemoryCache] 🎉 Cache hit for key \"${n}\"`),t[n]=e.value):(this.#w.info(`[InMemoryCache] ❌ Cache miss for key \"${n}\"`),t[n]=void 0)}return t}async mset(e){if(0!==e.length){if(1===e.length){Fr(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];return void await this.set(t,n,r)}e.forEach(({ttlMilliseconds:e})=>{this.#dt(e)}),e.forEach(({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#K.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})})}}async mdelete(e){return Object.fromEntries(e.map(e=>[e,this.#K.delete(e)]))}}(yh),MU=new class{#ht;#w;#pt;constructor({getSnapProvider:e,logger:t,trackError:n}){this.#ht=e,this.#w=t.withPrefix(\"[AnalyticsService]\"),this.#pt=n}async trackEvent(e,t){try{await this.#ht().request({method:\"snap_trackEvent\",params:{event:{event:e,properties:t}}})}catch(n){try{await this.#pt(n)}catch(e){this.#w.warn(\"Failed to report analytics error\",{error:e})}this.#w.warn(\"Failed to track event\",{error:n,event:e,properties:t})}}async trackTransactionAdded(e){await this.#gt(Dr,\"Snap transaction added\",e)}async trackTransactionRejected(e){await this.#gt(jr,\"Snap transaction rejected\",e)}async trackTransactionApproved(e){await this.#gt($r,\"Snap transaction approved\",e)}async trackTransactionSubmitted(e){await this.#gt(Kr,\"Snap transaction submitted\",e)}async trackTransactionFinalized({origin:e,accountType:t,chainIdCaip:n,transactionStatus:r,transactionType:i}){await this.trackEvent(qr,{message:\"Snap transaction finalized\",origin:e,account_type:t,chain_id_caip:n,...void 0===r?{}:{transaction_status:r},...void 0===i?{}:{transaction_type:i}})}async trackSecurityAlertDetected({origin:e,accountType:t,chainIdCaip:n,securityAlertResponse:r,securityAlertReason:i,securityAlertDescription:o}){await this.trackEvent(Hr,{message:\"Snap security alert detected\",origin:e,account_type:t,chain_id_caip:n,security_alert_response:r,security_alert_reason:i,security_alert_description:o})}async trackSecurityScanCompleted({origin:e,accountType:t,chainIdCaip:n,scanStatus:r,hasSecurityAlerts:i}){await this.trackEvent(Wr,{message:\"Snap security scan completed\",origin:e,account_type:t,chain_id_caip:n,scan_status:r,has_security_alerts:i})}async trackWebSocketConnectionClosedNotCleanly({origin:e,code:t,reason:n}){await this.trackEvent(\"WebSocket Connection Closed Not Cleanly\",{message:\"Snap WebSocket connection closed not cleanly\",origin:e,code:t,reason:n})}async#gt(e,t,{origin:n,accountType:r,chainIdCaip:i,transactionType:o}){await this.trackEvent(e,{message:t,origin:n,account_type:r,chain_id_caip:i,...void 0===o?{}:{transaction_type:o}})}}({getSnapProvider:Ih,logger:wh,trackError:Th}),PU=new class{#L;#K;#w;#mt={fetchMint:uo.Minute,fetchJsonParsedAccount:uo.Minute};#yt=new Map;constructor(e,t,n){this.#L=e,this.#K=t,this.#w=n}#wt(e){const t=this.#L.getNetworkBy(\"caip2Id\",e),n=NR(GR(t.rpcUrls,e,this.#w));return this.#yt.set(e,n),n}getRpc(e){return v(e,XS),this.#yt.get(e)??this.#wt(e)}async fetchJsonParsedAccount(e,t,n,r){const i=async(e,t,n)=>Fy(this.getRpc(t),qu(e),n);if(r?.skipCache)return i(e,t,n);return vh(async(e,t,n,r)=>Fy(this.getRpc(t),qu(e),{commitment:n,minContextSlot:r}),this.#K,{ttlMilliseconds:this.#mt.fetchJsonParsedAccount,functionName:\"SolanaConnection::fetchJsonParsedAccount\"})(e,t,n?.commitment,n?.minContextSlot)}async fetchMint(e,t,n){return vh(async(e,t,n,r)=>nw(this.getRpc(t),e,{commitment:n,minContextSlot:r}),this.#K,{ttlMilliseconds:this.#mt.fetchMint,functionName:\"SolanaConnection::fetchMint\"})(qu(e),t,n?.commitment,n?.minContextSlot)}async getLatestBlockhash(e){return(await this.getRpc(e).getLatestBlockhash().send()).value}}(Lo,CU,wh),_U=new class{#L;constructor(e){this.#L=e}async getAll(){return(await snap.request({method:\"snap_getWebSockets\"})).map(e=>({...e,network:this.#vt(e.url)}))}async getById(e){return(await this.getAll()).find(t=>t.id===e)??null}async findByNetwork(e){return(await this.getAll()).find(t=>t.network===e)??null}async save(e){const{url:t,protocols:n}=e,r=await snap.request({method:\"snap_openWebSocket\",params:{url:t,...n?{protocols:n}:{}}});return{...e,id:r}}async delete(e){await snap.request({method:\"snap_closeWebSocket\",params:{id:e}})}#vt(e){const t=this.#L.getNetworkBy(\"webSocketUrl\",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(Lo),RU=new class{#At;#bt;#L;#St;#Be;#w;#kt;#xt;#Et=new Map;#It=new Map;#Tt;#Bt=\"webSocketConnections\";constructor(e,t,n,r,i,o){const{maxReconnectAttempts:a,reconnectDelayMilliseconds:s,closeConnectionsGracePeriodMilliseconds:c}=n.config.subscriptions;this.#At=e,this.#bt=t,this.#L=n,this.#St=r,this.#Be=i,this.#w=o.withPrefix(\"[🔌 WebSocketConnectionService]\"),this.#kt=a,this.#xt=s,this.#Tt=c,this.#pe()}#pe(){const e=this.#Ct.bind(this),t=this.#Mt.bind(this),n=this.#Me.bind(this),r=this.#Pt.bind(this),i=this.#Pe.bind(this);this.#Be.on(\"onStart\",e),this.#Be.on(\"onUpdate\",e),this.#Be.on(\"onInstall\",e),this.#Be.on(\"onActive\",t),this.#Be.on(\"onInactive\",n),this.#Be.on(\"onWebSocketEvent\",i),this.#Be.on(\"onListWebSockets\",r)}async#Ct(){this.#w.log(\"Setting up connections\");const{active:e}=await Co();e?await this.#_t():await this.closeAllConnections()}async#_t(){this.#w.log(\"Opening connections for active networks\");const e=await this.#L.getActiveNetworks();this.#It.clear(),await Promise.allSettled(e.map(async e=>{await this.openConnection(e)}))}async openConnection(e){this.#w.log(`Opening connection for network ${e}`);const t=this.#L.getNetworkBy(\"caip2Id\",e),{webSocketUrl:n}=t;await this.#At.findByNetwork(e)?this.#w.log(`✅ Connection for network ${e} already exists`):await this.#At.save({network:e,url:n,protocols:[]})}async closeAllConnections(){this.#w.log(\"Closing all connections\");const e=await this.#At.getAll();await Promise.allSettled(e.map(this.#Rt.bind(this))),await this.#St.setKey(`${this.#Bt}.closeWebSocketConnectionsBackgroundEventId`,null)}async#Rt(e){this.#w.log(`Closing connection for network ${e.network}`),await this.#At.delete(e.id)}onConnectionRecovery(e,t){const n=this.#Et.get(e)??[];this.#Et.set(e,[...n,t])}async findByNetwork(e){return await this.#At.findByNetwork(e)??null}async findById(e){return this.#At.getById(e)}async#Pe(e){if(\"open\"!==e.type&&\"close\"!==e.type)return;const{id:t,type:n}=e;switch(this.#w.log(`Handling connection event \"${n}\" for ${t}`,e),n){case\"open\":await this.#Ot(e);break;case\"close\":await this.#Ut(e);break;default:this.#w.warn(`Unknown connection event type: ${n}`)}}async#Ot(e){const{id:t}=e,n=await this.#At.getById(t);if(!n)return void this.#w.warn(`No connection found with id: ${t}`);this.#w.log(`✅ Connected to ${t}`,e);const{network:r}=n;this.#It.delete(r);const i=this.#Et.get(r)??[];this.#w.log(`Triggering ${i.length} connection recovery handlers`,r);const o=i.map(async e=>{try{await e(r)}catch(e){this.#w.error(\"Error in connection recovery handler\",e)}})??[];await Promise.allSettled(o)}async#Ut(e){const{wasClean:t,origin:n,code:r,reason:i}=e;if(t)return void this.#w.log(\"✅ Connection closed cleanly\",e);const{networks:o}=this.#L.config,a=o.find(e=>e.webSocketUrl.startsWith(n));a?(await this.#bt.trackWebSocketConnectionClosedNotCleanly({origin:n,code:r??0,reason:i??null}),await this.#Nt(a.caip2Id)):this.#w.warn(\"No network found for origin\",n)}async#Nt(e){const t=this.#It.get(e)??0,n=t+1;if(this.#It.set(e,n),n>this.#kt)return void this.#w.error(`❌ Failed to reconnect to ${e} after ${this.#kt}/${this.#kt} attempts. Giving up.`);const r=this.#xt*Math.pow(2,t);this.#w.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#kt})`),await new Promise(t=>{setTimeout(()=>{this.openConnection(e).catch(t=>{this.#w.info(`Error opening connection for ${e}`,t)}).finally(()=>t())},r)})}async#Pt(){const e=await this.#At.getAll();this.#w.log(\"All connections\",{connections:e,connectionRecoveryHandlers:this.#Et})}async#Mt(){this.#w.log(\"Client became active\"),await this.#zt(),await this.#_t()}async#Me(){this.#w.log(\"Client became inactive\"),await this.#zt();const e=Math.floor(this.#Tt/1e3),t=await snap.request({method:\"snap_scheduleBackgroundEvent\",params:{duration:`PT${e}S`,request:{method:\"closeWebSocketConnections\"}}});await this.#St.setKey(`${this.#Bt}.closeWebSocketConnectionsBackgroundEventId`,t),this.#w.log(`Scheduled background event to close connections after ${e}s`,t)}async#zt(){try{const e=await this.#St.getKey(`${this.#Bt}.closeWebSocketConnectionsBackgroundEventId`);if(!e)return;await snap.request({method:\"snap_cancelBackgroundEvent\",params:{id:e}}),this.#w.log(\"🫸 Cancelled background event to close connections\",e)}catch(e){await Th(e),this.#w.warn(\"Failed to cancel background event\",e)}finally{await this.#St.setKey(`${this.#Bt}.closeWebSocketConnectionsBackgroundEventId`,null)}}}(_U,MU,Lo,BU,TU,wh),OU=new class{#St;#Bt=\"subscriptions\";constructor(e){this.#St=e}async getAll(){const e=await this.#St.getKey(`${this.#Bt}`);return Object.values(e??{})}async getById(e){return await this.#St.getKey(`${this.#Bt}.${e}`)}async save(e){await this.#St.setKey(`${this.#Bt}.${e.id}`,e)}async delete(e){await this.#St.deleteKey(`${this.#Bt}.${e}`)}async deleteMany(e){const t=e.map(e=>`${this.#Bt}.${e}`);await this.#St.deleteKeys(t)}async update(e){await this.#St.setKey(`${this.#Bt}.${e.id}`,e)}async findBy(e,t){const n=await this.getAll();if(0!==n.length)return n.find(n=>e in n&&n[e]===t)}async clear(){await this.#St.deleteKey(`${this.#Bt}`)}}(BU),UU=new vP(RU,OU,TU,wh),NU=new class{#F;constructor(e){this.#F=e}async uiAmountToAmountForMint(e,t,n){const r=await this.#F.fetchMint(e,t);return this.#Ft(r,n)}async amountToUiAmountForMint(e,t,n){const r=await this.#F.fetchMint(e,t);return this.#Lt(r,n)}#Ft(e,t){try{const n=function(e,t){return dm(e)?e.value:t?t():null}(e.data?.extensions),{decimals:r}=e.data??{},i=n?.find(e=>\"InterestBearingConfig\"===e.__kind),o=n?.find(e=>\"ScaledUiAmountConfig\"===e.__kind);if(!i&&!o)return Al(BigInt(br(t).multipliedBy(10**r).toFixed(0)));const a=Date.now()/1e3;if(i){return Al(aP(t,r,Number(a),Number(i.lastUpdateTimestamp),Number(i.initializationTimestamp),i.preUpdateAverageRate,i.currentRate))}if(o){let{multiplier:e}=o;a>=o.newMultiplierEffectiveTimestamp&&(e=o.newMultiplier);return Al(sP(t,r,e))}throw new Error(\"Unknown mint extension type\")}catch(n){const r=e?.data?.decimals??9;return Al(BigInt(br(t).multipliedBy(10**r).toFixed(0)))}}#Lt(e,t){try{const n=1000000000n,r=br(this.#Ft(e,n.toString()).toString()).dividedBy(n.toString());return br(t.toString()).dividedBy(r).toString()}catch(n){const r=e.data?.decimals??9;return br(t.toString()).dividedBy(10**r).toString()}}}(PU),zU=new gP(PU,wh),FU=new class{#F;#w;#ie=450;#oe=10000n;constructor(e,t){this.#F=e,this.#w=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:i}=e,o=qu(t.address),a=BigInt(vS(r).toString()),s=await this.#F.getLatestBlockhash(i),c=bl(Nd({version:0}),e=>zd(o,e),e=>kl(s,e),e=>Pd(rh({amount:a,destination:n,source:Tf(o)}),e));return Rd([em({units:this.#ie}),om({microLamports:this.#oe})],c)}catch(e){throw this.#w.error({error:e},\"Error building transaction message\"),e}}getComputeUnitLimit(){return this.#ie}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#oe}}(PU,wh),LU=new class{#F;#w;constructor(e,t){this.#F=e,this.#w=t.withPrefix(\"[👀 RecipientClassifier]\")}async classify(e,t){this.#w.info(\"Classifying recipient\",{recipientAddress:e,network:t});const n=await this.#F.fetchJsonParsedAccount(e,t);try{Dy(n)}catch(e){return{type:\"SYSTEM\"}}const{programAddress:r}=n;if(r===fh)return{type:\"SYSTEM\"};const i=(0,Br.get)(n,\"data.mint\"),o=(0,Br.get)(n,\"data.owner\");return(r===Cy||r===Bb)&&i&&o?{type:\"TOKEN_ACCOUNT\",mint:i}:{type:\"UNSUPPORTED\"}}}(PU,wh),DU=new pP(NU,LU,PU,wh),jU=new class{#y;#w;#v;#A;#K;#S;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=wh){const{baseUrl:i,chunkSize:o,cacheTtlsMilliseconds:a}=e.config.priceApi;v(i,Ji),this.#y=n,this.#w=r,this.#v=i,this.#A=o,this.cacheTtlsMilliseconds=a,this.#K=t,this.#S=Ki({service:\"price_api\",logger:this.#w})}async#Dt(e,t=\"usd\"){try{if(v(e,U(He)),v(t,_h),0===e.length)return{};const n=[...new Set(e)],r=[];for(let e=0;e<n.length;e+=this.#A)r.push(n.slice(e,e+this.#A));const i=await Promise.all(r.map(async e=>{const n=eo({baseUrl:this.#v,path:\"/v3/spot-prices\",queryParams:{vsCurrency:t,assetIds:e.join(\",\"),includeMarketData:\"true\"}}),r=await Zi(this.#S,n,void 0,this.#y),i=JSON.parse(r);return v(i,Ph),i})),o=i.reduce((e,t)=>({...e,...t}),{});return await this.#K.mset(e.map(e=>({key:`PriceApiClient:getMultipleSpotPrices:${e}:${t}`,value:o[e],ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices}))),o}catch(e){throw this.#w.error(e,\"Error fetching spot prices\"),e}}async#jt(e,t=\"usd\"){const n=[...new Set(e)],r=\"PriceApiClient:getMultipleSpotPrices\",i=e=>`${r}:${e}:${t}`,o=await this.#K.mget(n.map(i)),a=(0,Br.mapKeys)(o,(e,t)=>(e=>{const t=new RegExp(`^${r}:(.+):(.+)$`,\"u\"),n=e.match(t);if(!n)throw new Error(\"Invalid cache key\");return n})(t)[1]),s=n.filter(e=>void 0===a[e]);if(0===s.length)return a;const c=await this.#Dt(s,t);return await this.#K.mset(Object.entries(c).map(([e,t])=>({key:i(e),value:t,ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices}))),{...a,...c}}async getMultipleSpotPrices(e,t=\"usd\"){return this.#jt(e,t)}}(Lo,CU),$U=new Nh(Lo),KU=new class{#y;#v;#K;#S;#mt;constructor(e,t,n=globalThis.fetch,r=wh){const{baseUrl:i,cacheTtlsMilliseconds:o}=e.config.nftApi;v(i,Ji),this.#y=n,this.#v=i,this.#mt=o,this.#K=t,this.#S=Ki({service:\"nft_api\",logger:r})}async#$t(e){const t=await Zi(this.#S,e,{headers:{\"Content-Type\":\"application/json\",accept:\"application/json\",version:\"1\"}},this.#y);return JSON.parse(t)}#Kt(e){return{cursor:e.cursor,error:e.error,items:e.items.map(e=>({chain:e.chain,address:e.address,tokenAddress:e.token_address,tokenId:e.token_id,balance:e.balance,acquiredAt:e.acquired_at,isSpam:e.isSpam,nftToken:this.#qt(e.nft_token)}))}}async#Ht(e){let t,n=[];do{const r=eo({baseUrl:this.#v,path:`/users/${e}/solana-tokens`,queryParams:t?{cursor:t}:void 0}),i=await this.#$t(r),o=this.#Kt(i);n=[...n,...o.items],t=o.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return vh(this.#Ht.bind(this),this.#K,{functionName:\"NftApiClient:listAddressSolanaNfts\",ttlMilliseconds:this.#mt.listAddressSolanaNfts})(e)}#qt(e){return{address:e.address,tokenId:e.token_id,tokenStandard:e.token_standard,name:e.name,description:e.description,metadata:e.metadata,imageUrl:e.image_url,mediaUrl:e.media_url,externalUrl:e.external_url,attributes:e.attributes.map(e=>({key:e.key,value:e.value})),tokenAccountAddress:e.token_account_address,creators:e.creators.map(e=>({address:e.address,share:e.share,verified:e.verified})),collectionName:e.collection_name,collectionSymbol:e.collection_symbol,collectionCount:e.collection_count,collectionImageUrl:e.collection_image_url,onchainCollectionAddress:e.onchain_collection_address,floorPrice:e.floor_price?{asset:{type:e.floor_price.asset.type,name:e.floor_price.asset.name,symbol:e.floor_price.asset.symbol,decimals:e.floor_price.asset.decimals,tokenId:e.floor_price.asset.token_id},amount:{rawAmount:e.floor_price.amount.raw_amount,amount:e.floor_price.amount.amount}}:null,lastSalePrice:e.last_sale_price?{asset:{type:e.last_sale_price.asset.type,name:e.last_sale_price.asset.name,symbol:e.last_sale_price.asset.symbol,decimals:e.last_sale_price.asset.decimals,tokenId:e.last_sale_price.asset.token_id},amount:{rawAmount:e.last_sale_price.amount.raw_amount,amount:e.last_sale_price.amount.amount}}:null,rarity:e.rarity?{ranking:{source:e.rarity.ranking.source,value:e.rarity.ranking.value},metadata:{howrare:{rank:e.rarity.metadata.howrare.rank},moonrank:{rank:e.rarity.metadata.moonrank.rank}}}:null}}async#Wt(e){try{const t=eo({baseUrl:this.#v,path:`/nfts/contracts/solana/${e}/1`}),n=await this.#$t(t);return this.#qt(n)}catch(e){return await Th(e),null}}async getNftMetadata(e){return vh(this.#Wt.bind(this),this.#K,{functionName:\"NftApiClient:getNftMetadata\",ttlMilliseconds:this.#mt.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map(async e=>this.getNftMetadata(e)))}}(Lo,CU),qU=new class{#F;#w;tld=\".sns\";constructor(e,t){this.#F=e,this.#w=t}async resolveDomain(e,t){const n=this.#F.getRpc(e);return iU({rpc:n,domain:t})}async resolveAddress(e,t){try{const n=this.#F.getRpc(e);return`${(await(async({rpc:e,walletAddress:t})=>{const n=await oU.getAddress(\"85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29\",t),r=await oU.retrieve(e,n),[i,o]=await Promise.all([ZO.retrieve(e,r.nameAccount),EO({rpc:e,domainAddress:r.nameAccount})]),a=o||i.owner,s=i.parentName!==AO,c=[aU({rpc:e,domainAddress:r.nameAccount,parentAddress:s?i.parentName:void 0})];s&&c.push(aU({rpc:e,domainAddress:i.parentName}));const u=(await Promise.all(c)).join(\".\");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})({rpc:n,walletAddress:qu(t)})).domainName}${this.tld}`}catch(e){return this.#w.error(\"Error resolving address\",e),null}}}(PU,wh),HU=new class{#St;constructor(e){this.#St=e}async findByKeyringAccountId(e){return await this.#St.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#St.getKey(\"assetEntities\")??{};return Object.values(e).flat()}async saveMany(e){await this.#St.update(t=>{const n=(0,Br.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,Br.cloneDeep)(n.assetEntities[e]??[]),i=r.findIndex(e=>e.assetType===t.assetType&&e.keyringAccountId===t.keyringAccountId);-1===i?r.push(t):r[i]=t,n.assetEntities[e]=r}return n})}}(BU),WU=new class{#St;constructor(e){this.#St=e}async getAll(){const e=await this.#St.getKey(\"keyringAccounts\");return Object.values(e??{})}async findById(e){return await this.#St.getKey(`keyringAccounts.${e}`)??null}async findByIds(e){const t=new Set(e.map(e=>e.toLowerCase()));return(await this.getAll()).filter(e=>t.has(e.id.toLowerCase()))}async findByAddress(e){return(await this.getAll()).find(t=>t.address===e)??null}async save(e){await this.#St.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#St.deleteKey(`keyringAccounts.${e}`)}}(BU),VU=new class{#Vt;constructor(e){this.#Vt=e}async getAll(){return this.#Vt.getAll()}async getAllSelected(){const[e,t]=await Promise.all([this.#Vt.getAll(),FM(snap)]);return e.filter(e=>t.includes(e.id))}async findById(e){return this.#Vt.findById(e)}async findByIds(e){return this.#Vt.findByIds(e)}async findByAddress(e){return this.#Vt.findByAddress(e)}async save(e){return this.#Vt.save(e)}async delete(e){return this.#Vt.delete(e)}}(WU),GU=new ZM({connection:PU,logger:wh,configProvider:Lo,assetsRepository:HU,accountsService:VU,tokenApiClient:$U,cache:CU,nftApiClient:KU}),ZU={call:async(e,...t)=>snap.request({method:\"snap_messengerCall\",params:{action:e,params:t}})},JU=new class{#Gt;constructor({messenger:e}){this.#Gt=e}async getFeatureFlag(e){const{remoteFeatureFlags:t}=await this.#Gt.call(\"RemoteFeatureFlagController:getState\");return t[e]}async getFeatureFlags(e){const{remoteFeatureFlags:t}=await this.#Gt.call(\"RemoteFeatureFlagController:getState\");return e.reduce((e,n)=>(e[n]=t[n],e),{})}}({messenger:ZU}),YU=new class{#Gt;constructor({messenger:e}){this.#Gt=e}async getAccountAssetByID(e,t){return this.#Gt.call(\"AssetsController:getAccountAssetByID\",e,t)}async getAccountAssetsByIDs(e,t){return this.#Gt.call(\"AssetsController:getAccountAssetsByIDs\",e,t)}async getAccountAssetsByScope(e,t){return this.#Gt.call(\"AssetsController:getAccountAssetsByScope\",t,e)}async getAssetMetadata(e){return this.#Gt.call(\"AssetsController:getAssetMetadata\",e)}async getAssets(e,t){return this.#Gt.call(\"AssetsController:getAssets\",e,t)}}({messenger:ZU}),XU=new class{#w;#Zt;#Jt;#Yt;constructor(e){const{getAccountAssetByID:t,getAccountAssetsByIDs:n,getAccountAssetsByScope:r}=e;this.#w=wh.withPrefix(\"[CoreAssetsAdapter]\"),this.#Zt=t,this.#Jt=n,this.#Yt=r}async getAccountAssetByID(e,t){this.#w.info(\"Getting account asset by ID\",{accountId:e,assetId:t});const n=await this.#Zt(e,t);return n?KM(e,n):null}async getAccountAssetsByIDs(e,t){this.#w.info(\"Getting account assets by IDs\",{accountId:e,assetIds:t});const n=await this.#Jt(e,t);return t.map(t=>{const r=n[t];return r?KM(e,r):null})}async getAccountAssetsByScope(e,t){this.#w.info(\"Getting account assets by scope\",{scope:e,accountId:t});const n=await this.#Yt(e,t);return Object.values(n).map(e=>KM(t,e))}async getAccountAssets(e){const[t,n]=await Promise.all([this.getAccountAssetsByScope(ho.Mainnet,e),this.getAccountAssetsByScope(ho.Devnet,e)]);return[...t,...n]}}({getAccountAssetByID:YU.getAccountAssetByID.bind(YU),getAccountAssetsByIDs:YU.getAccountAssetsByIDs.bind(YU),getAccountAssetsByScope:YU.getAccountAssetsByScope.bind(YU)}),QU=new class{#Xt;#Qt;#en;cacheTtlsMilliseconds;constructor({snapAdapter:e,coreAdapter:t,remoteFeatureFlagsProvider:n}){this.#Xt=e,this.#Qt=t,this.#en=n,this.cacheTtlsMilliseconds=ZM.cacheTtlsMilliseconds}async isAssetsMigrationEnabled(){return XM(await this.#en.getFeatureFlag(YM.solana))!==JM.Off}static hasChanged(e,t){return ZM.hasChanged(e,t)}async getAssetsMetadata(e){return this.#Xt.getAssetsMetadata(e)}async fetchAccountAssets(e){return this.#Xt.fetchAccountAssets(e)}async fetchAccountAssetsFromRpc(e){return this.#Xt.fetchAccountAssets(e)}async save(e){await this.saveMany([e])}async saveMany(e){return await this.isAssetsMigrationEnabled()?this.#Xt.saveMany(e):this.#Xt.saveManyAndEmit(e)}async getAll(){return this.#Xt.getAll()}async getAccountAssetByID(e,t){return await this.isAssetsMigrationEnabled()?this.#Qt.getAccountAssetByID(e,t):this.#Xt.getAccountAssetByID(e,t)}async getAccountAssetsByIDs(e,t){if(await this.isAssetsMigrationEnabled()){const n=await this.#Qt.getAccountAssetsByIDs(e,t);return Object.fromEntries(t.map((e,t)=>[e,n[t]??null]))}return this.#Xt.getAccountAssetsByIDs(e,t)}async getAccountAssetsByScope(e,t){return await this.isAssetsMigrationEnabled()?this.#Qt.getAccountAssetsByScope(e,t):this.#Xt.getAccountAssetsByScope(e,t)}async getAccountAssets(e){return await this.isAssetsMigrationEnabled()?this.#Qt.getAccountAssets(e):this.#Xt.getAccountAssets(e)}async findByAccount(e){return this.#Xt.findByAccount(e)}}({snapAdapter:GU,coreAdapter:XU,remoteFeatureFlagsProvider:JU}),eN=new class{#St;#Bt=\"transactions\";constructor(e){this.#St=e}async getAll(){const e=await this.#St.getKey(this.#Bt);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#St.getKey(`${this.#Bt}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#St.update(t=>{const n=t[this.#Bt];return e.forEach(e=>{const r=e.id,i=e.account,o=n[i]??[],a=o.findIndex(e=>e.id===r);-1!==a&&(o[a]=e);const s=(0,Br.chain)([...o,e]).uniqBy(\"id\").sortBy(e=>-(e.timestamp??0)).value();t[this.#Bt][i]=s}),t})}}(BU),tN=new AP(NU,QU,wh),nN=new class{#tn;#nn;#j;#le;#F;constructor(e,t,n,r,i){this.#tn=e,this.#nn=t,this.#j=n,this.#le=r,this.#F=i}async fetchBySignature(e,t,n){const r=await this.#F.getRpc(n).getTransaction(gl(e),{encoding:\"json\",maxSupportedTransactionVersion:1}).send();return r?this.#nn.mapRpcTransaction(r,t,n):null}async fetchAssetsTransactions(e,t){const n=e.map(e=>e.assetType),[r,i,o]=await Promise.all([this.#j.getAll(),this.#le.getAssetsMetadata(n),this.#tn.getAll()]),a=e=>r.find(t=>t.id===e),s=new Map,c=async(e,t)=>{const n=`${e.id}:${t}`,r=s.get(n);if(r)return r;const i=(async()=>{const n=this.#F.getRpc(t),r=await Promise.allSettled([Cy,Bb].map(async t=>n.getTokenAccountsByOwner(qu(e.address),{programId:t},{encoding:\"jsonParsed\"}).send())),i=new Map;for(const e of r){if(\"rejected\"===e.status){await Th(e.reason);continue}const{value:t}=e.value;for(const e of t){const{mint:t}=e.account.data.parsed.info,n=i.get(t)??[];n.push(e.pubkey),i.set(t,n)}}return i})();return s.set(n,i),i},u=(await Promise.all(e.map(async e=>{const{network:t}=e,n=a(e.keyringAccountId);if(!n)return[];const r=\"mint\"in e?(await c(n,t)).get(e.mint)??[]:[qu(e.address)],i=await(async e=>{const{network:t}=e,n=\"mint\"in e?e.mint:e.address,r=o.sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)).find(e=>e.from.some(e=>GM(t,n)===(0,Br.get)(e,\"asset.type\"))||e.to.some(e=>GM(t,n)===(0,Br.get)(e,\"asset.type\")));return r||null})(e),s=i?gl(i.id):void 0,u=await Promise.allSettled(r.map(async n=>(await this.#F.getRpc(t).getSignaturesForAddress(n,{limit:5,...s?{until:s}:{}}).send()).map(t=>({signatureResponse:{signature:t.signature,blockTime:Number(t.blockTime??0)},asset:e})))),l=[];for(const e of u)\"rejected\"!==e.status?l.push(e.value):await Th(e.reason);return l.flat()}))).flat(),l=[...new Map(u.map(e=>[`${e.asset.keyringAccountId}:${e.asset.network}:${e.signatureResponse.signature}`,e])).values()],d=t?.limit?l.sort((e,t)=>(t.signatureResponse.blockTime??0)-(e.signatureResponse.blockTime??0)).slice(0,t.limit):l,f=(await Promise.all(d.map(async e=>{try{const{signatureResponse:t,asset:n}=e;return{transaction:await this.#F.getRpc(n.network).getTransaction(gl(t.signature),{encoding:\"json\",maxSupportedTransactionVersion:1}).send(),asset:n}}catch(e){return await Th(e),null}}))).filter(e=>null!==e),h=(await Promise.all(f.map(async e=>{const{transaction:t,asset:n}=e;if(!t)return null;const r=a(n.keyringAccountId);return r?this.#nn.mapRpcTransaction(t,r,n.network,i):null}))).filter(e=>null!==e).filter(e=>{const t=a(e.account);return!!t&&!yP(e,t)});return h}async fetchLatestSignatures(e,t,n){return(await this.#F.getRpc(e).getSignaturesForAddress(t,n).send()).map(({signature:e})=>e)}async findByAccounts(e){return(await Promise.all(e.map(async e=>this.#tn.findByAccountId(e.id)))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#tn.saveMany(e);const t=(0,Br.groupBy)(e,\"account\");await zM(snap,HM.AccountTransactionsUpdated,{transactions:t})}}(eN,tN,VU,QU,PU),rN=new class{#j;#le;#de;#w;#rn=new LM;constructor(e,t,n,r){this.#j=e,this.#le=t,this.#de=n,this.#w=r.withPrefix(\"[🔄 AccountsSynchronizer]\")}async synchronize(e){const t=e??await this.#j.getAll(),n=[...t.map(e=>e.id)].sort((e,t)=>e.localeCompare(t)).join(\",\");return this.#rn.run(n,async()=>{this.#w.info(\"Synchronizing accounts\",t);const e=await Promise.allSettled(t.map(async e=>this.#le.fetchAccountAssets(e))),n=e.flatMap(e=>\"fulfilled\"===e.status?e.value:[]);await this.#G(\"Account synchronization failures\",e,t.map(({id:e})=>e));try{await this.#le.saveMany(n)}catch(e){throw await Th(new Error(\"Failed to save assets\",{cause:e})),e}let r;try{r=await this.#de.fetchAssetsTransactions(n,{limit:20})}catch(e){throw await Th(new Error(\"Failed to fetch transactions\",{cause:e})),e}try{await this.#de.saveMany(r)}catch(e){throw await Th(new Error(\"Failed to save transactions\",{cause:e})),e}})}async#G(e,t,n){try{const r=jM(t,n);if(0===r.length)return;const i=new $M(e,r);await Th(i)}catch(e){this.#w.warn(\"Failed to report synchronization failures\",{reportingError:e})}}}(VU,QU,nN,wh),iN=new class{#y;#in;#S;constructor({scanUrl:e,fetch:t=globalThis.fetch,policy:n}){v(e,Ji),this.#y=t,this.#in=e,this.#S=n}async scanTransaction(e){const t=async()=>{const t=await this.#y(this.#in,{headers:{...Yi},method:\"POST\",body:JSON.stringify(e),signal:AbortSignal.timeout(1e4)});if(!t.ok)throw Object.assign(new Vr(`HTTP error! status: ${t.status}`),{httpStatus:t.status,retryAfterMs:qi(t.headers?.get(\"Retry-After\"))});return await t.json()};try{return await(this.#S?Gi(this.#S,t):t())}catch(e){if(e instanceof Vr)throw e;throw new Vr(\"Security Alerts API error\",{cause:e instanceof Error&&e.name===Ui&&void 0!==e.cause?e.cause:e})}}}({scanUrl:`${Lo.config.securityAlertsApi.baseUrl}/solana/message/scan`,policy:Ki({service:\"security_alerts_api\",logger:wh})}),oN=new class extends fU{async scanTransaction({method:e,accountAddress:t,transaction:n,scope:r,origin:i,options:o=[\"simulation\",\"validation\"],account:a}){try{const s={method:e,encoding:\"base64\",account_address:xU.from(EM.decode(t)).toString(\"base64\"),metadata:this.#on(i),chain:EU[r],transactions:[n],options:o};v(s,pU,\"Solana scan request body\"),this.logger.info(\"Scanning transaction\");const c=await this.securityAlertsApiClient.scanTransaction(s);v(c,kU,\"Solana scan response body\");const u=this.#an(c);return await this.trackScanCompleted({origin:i,scope:r,accountType:a?.type},u),u}catch(e){return await this.trackError(e),this.logger.error(e),await this.trackScanFailed({origin:i,scope:r,accountType:a?.type}),null}}#on(e){return e===Yh?{url:null,non_dapp:!0}:{url:e}}#an(e){return{status:\"SUCCESS\"===e.status||\"ERROR\"===e.status?e.status:\"ERROR\",estimatedChanges:{assets:e.result?.simulation?.account_summary?.account_assets_diff?.map(e=>({type:e.in?\"in\":\"out\",symbol:e.asset.symbol??e.asset_type,name:e.asset.name??e.asset_type,logo:e.asset.logo??null,value:e.in?.value??e.out?.value??null,price:e.in?.usd_price??e.out?.usd_price??null}))??[]},validation:{type:e.result?.validation?.result_type??null,reason:e.result?.validation?.reason??null},error:e?.error_details?{type:\"type\"in e.error_details?e.error_details.type:null,code:(\"code\"in e.error_details?e.error_details.code:null)??null}:null}}}({securityAlertsApiClient:iN,analyticsService:MU,logger:wh,trackError:Th}),aN=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case jS.SignAndSendTransaction:case jS.SignTransaction:return this.#sn(e,t);case jS.SignMessage:return this.#cn(e,t);case jS.SignIn:return this.#un(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#sn(e,t){v(e.request,Z([kk,Ik]));const{request:{method:n,params:{transaction:r}},scope:i,account:o,origin:a}=e,s=F_({origin:a});await snap.request({method:\"snap_scheduleBackgroundEvent\",params:{duration:\"PT1S\",request:{method:z_.OnTransactionAdded,params:{accountId:o,metadata:{scope:i,origin:a,transactionType:s}}}}});return await N_({...U_,scope:i,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:\"snap_scheduleBackgroundEvent\",params:{duration:\"PT1S\",request:{method:z_.OnTransactionApproved,params:{accountId:o,metadata:{scope:i,origin:a,transactionType:s}}}}}),!0):(await snap.request({method:\"snap_scheduleBackgroundEvent\",params:{duration:\"PT1S\",request:{method:z_.OnTransactionRejected,params:{accountId:o,metadata:{scope:i,origin:a,transactionType:s}}}}}),!1)}async#cn(e,t){const n=await async function(e,t){v(e.request,Ek);const{request:{params:{message:n}},scope:r,origin:i}=e,o=Pu().encode(n),a=Fu().decode(o),[s,c]=await Promise.all([To().then(e=>e.locale).catch(()=>\"en\"),qU.resolveAddress(r,t.address)]);return Io(await ko(bP(y_,{message:a,account:t,accountDomain:c,scope:r,locale:s,networkImage:kP,origin:i}),{}))}(e,t);return Boolean(n)}async#un(e,t){const n=await async function(e,t){v(e.request,xk);const{request:{params:n},scope:r,origin:i}=e,[o,a]=await Promise.all([To(),qU.resolveAddress(r,t.address)]);return Io(await ko(bP(h_,{params:n,account:t,accountDomain:a,scope:r,preferences:o,networkImage:kP,origin:i}),{}))}(e,t);return Boolean(n)}},sN=new class{#ce;#ue;#de;#bt;#F;#w;#ln=new Map;#dn=10*uo.Minute;constructor(e,t,n,r,i,o){this.#ce=e,this.#ue=t,this.#de=n,this.#bt=r,this.#F=i,this.#w=o.withPrefix(\"[✍️ SignatureMonitor]\"),this.#pe()}#pe(){Po.forEach(e=>{this.#ce.registerNotificationHandler(\"signatureSubscribe\",e,this.#fn.bind(this)),this.#ce.registerConnectionRecoveryHandler(e,this.#ye.bind(this))})}async monitor(e,t,n,r,i,o){this.#w.info(\"Monitoring signature\",{signature:e,accountId:t,commitment:n,network:r,origin:i,transactionType:o});const a={method:\"signatureSubscribe\",network:r,expiryMilliseconds:this.#dn,params:[e,{commitment:n,enableReceivedNotification:!1}],metadata:{accountId:t,origin:i,...void 0===o?{}:{transactionType:o}}},s=await this.#ce.subscribe(a);this.#ln.set(s,a)}async#fn(e,t){try{const{network:e}=t,n=(0,Br.get)(t,\"params[0]\");v(n,V());const r=(0,Br.get)(t,\"params[1].commitment\");v(r,iS);const i=t.metadata?.accountId;v(i,V());const o=t.metadata?.origin;v(o,V());const a=(0,Br.get)(t,\"metadata.transactionType\"),s=await this.#ue.findById(i);if(!s)throw new Error(`Account not found: ${i}`);const c=await this.#de.fetchBySignature(n,s,e);if(!c)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(await this.#de.save(c),r){case\"confirmed\":case\"finalized\":await this.#bt.trackTransactionFinalized({origin:o,accountType:s.type,chainIdCaip:c.chain,transactionStatus:c.status,transactionType:a??c.type});break;default:this.#w.warn(`⚠️ Commitment ${r} not supported`)}}catch(e){await Th(e),this.#w.error(\"Error handling signature notification\",e)}finally{await this.#ce.unsubscribe(t.id),this.#ln.delete(t.id)}}async#ye(){this.#w.info(\"Handling connection recovery\"),await Promise.all(Array.from(this.#ln.entries()).map(async([e,t])=>{await this.#hn(t,e)}))}async#hn(e,t){try{const{network:n}=e;v(n,V());const r=(0,Br.get)(e,\"params[0]\");v(r,V());const i=(0,Br.get)(e,\"params[1].commitment\");v(i,iS);const o=await this.#pn(r,n);if(!o)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#gn(o,i))return void this.#w.info(\"Signature did not reach the desired commitment while connection was down. Skipping.\");const a={jsonrpc:\"2.0\",method:\"signatureNotification\",params:{subscription:1,result:{context:{slot:BigInt(0)},value:{err:null}}}},s={...e,id:t};await this.#fn(a,s),this.#ln.delete(t)}catch(e){this.#w.error(\"Error handling connection recovery\",e)}}async#pn(e,t){const n=await this.#F.getRpc(t).getSignatureStatuses([gl(e)],{searchTransactionHistory:!0}).send(),r=n.value[0]?.confirmationStatus;if(!r)throw new Error(`Signature ${e} not found via HTTP fetch during connection recovery`);return r}#gn(e,t){return t===e||\"processed\"===t&&(\"confirmed\"===e||\"finalized\"===e)||\"confirmed\"===t&&\"finalized\"===e}}(UU,VU,nN,MU,PU,wh),cN=new wP(UU,VU,QU,nN,rN,NU,Lo,wh),uN=(new class{#j;#mn;#Be;#w;constructor(e,t,n,r){this.#j=e,this.#mn=t,this.#Be=n,this.#w=r.withPrefix(\"[🥾 MonitoredAccountsInitializer]\"),this.#pe()}#pe(){this.#Be.on(\"onActive\",this.#yn.bind(this))}async#yn(){this.#w.info(\"Starting to monitor the selected accounts\");const e=await this.#j.getAllSelected();await this.#mn.setMonitoredAccounts(e.map(e=>e.id))}}(VU,cN,TU,wh),new class{#F;#wn;#vn;#bt;#de;#w;constructor(e,t,n,r,i,o=wh){this.#F=e,this.#wn=t,this.#vn=n,this.#bt=r,this.#de=i,this.#w=o.withPrefix(\"[👛 WalletService]\")}async resolveAccountAddress(e,t,n){this.#w.log(\"Resolving account address\",{keyringAccounts:e,scope:t,request:n});const{method:r,params:i}=n,o=e.filter(e=>e.scopes.includes(t));if(0===o.length)throw new Error(\"No accounts with this scope\");let a;switch(r){case jS.SignIn:{const{address:e}=i;if(!e)throw new Error(\"No address\");a=e;break}case jS.SignAndSendTransaction:case jS.SignMessage:case jS.SignTransaction:{const{account:e}=i;a=e.address;break}default:throw this.#w.warn({method:r},\"Unsupported method\"),new Error(\"Unsupported method\")}if(!o.find(e=>e.address===a))throw new Error(\"Account not found\");return WP(t,a)}async signTransaction(e,t,n,r,i){this.#w.log(\"Signing transaction\",{account:e,transaction:t,scope:n,options:i});const o=i?.minContextSlot?{minContextSlot:BigInt(i.minContextSlot)}:void 0,a=r===Yh?\"metamask\":\"dapp\",s=await this.#wn.partiallySignBase64String(t,e,n,o,a),c={signedTransaction:$b(s)};v(c,Bk);try{hf(s);const t=df(s);await this.#vn.monitor(t,e.id,\"confirmed\",n,r)}catch(e){this.#w.warn(\"Transaction is not fully signed, skipping monitoring\",{error:e})}return c}async signAndSendTransaction(e,t,n,r,i,o){this.#w.log(\"Signing and sending transaction\",e);const a=i?.minContextSlot?{minContextSlot:BigInt(i.minContextSlot)}:void 0,s=r===Yh?\"metamask\":\"dapp\",c=await this.#wn.partiallySignBase64String(t,e,n,a,s),u=df(c),l=function({rpc:e}){return async function(t,n){await Fb({...n,rpc:e,transaction:t})}}({rpc:this.#F.getRpc(n)}),d=qP(n,\"tx\",u);this.#w.info(`Sending transaction: ${d}`),yf(c);const f={...i?.preflightCommitment?{preflightCommitment:i.preflightCommitment}:{},...i?.minContextSlot?{minContextSlot:BigInt(i.minContextSlot)}:{},...i?.maxRetries?{maxRetries:BigInt(i.maxRetries)}:{},skipPreflight:i?.skipPreflight??!0,commitment:\"confirmed\"};await l(c,f);const h=r===Yh?IU({sourceAssetId:i?.sourceAssetId,destAssetId:i?.destAssetId}):void 0,p=o??h,g=F_({origin:r,transactionType:p});await this.#bt.trackTransactionSubmitted({origin:r,accountType:e.type,chainIdCaip:n,transactionType:g});try{await this.#de.save(AP.createPendingTransaction({signature:u,account:e,scope:n,transactionType:g}))}catch(e){await Th(e),this.#w.warn(\"Failed to save pending transaction\",e)}await this.#vn.monitor(u,e.id,i?.commitment??\"confirmed\",n,r,p);const m={signature:u};return v(m,Tk),m}async signMessage(e,t){this.#w.log(\"Signing message\",e,t);const{entropySource:n,derivationPath:r}=e,{privateKeyBytes:i}=await BM({entropySource:n,derivationPath:r});return this.#An(e,t,i)}async signMessages(e){this.#w.info(`Signing message batch for ${e.length} requests`);const t=new Array(e.length),n=new Map;return e.forEach((e,t)=>{const r=n.get(e.account.entropySource)??[];r.push({index:t,request:e}),n.set(e.account.entropySource,r)}),await Promise.all([...n.entries()].map(async([e,n])=>{try{const r=await async function(e){const t=await TM({entropySource:e,path:[\"m\",\"44'\",\"501'\"],curve:\"ed25519\"});return await IC.fromJSON(t)}(e);for(const{index:e,request:i}of n)try{const n=await this.#bn({coinTypeNode:r,account:i.account});t[e]=await this.#An(i.account,i.message,n)}catch(n){t[e]={error:Sh(n).message}}}catch(e){for(const{index:r}of n)t[r]={error:Sh(e).message}}})),t}async#An(e,t,n){const r=qu(e.address),i=function(e,t={}){return Object.freeze({content:\"string\"==typeof e?(new _f).encode(e):e,signatures:Object.freeze({...t})})}(bl(t,Pu().encode,Fu().decode)),o=await If(n),[a]=await o.signMessages([i]);v(a,K());const s=a[r];var c;v(s,(c=Uint8Array,k(\"instance\",e=>e instanceof c||`Expected a \\`${c.name}\\` instance, but received: ${f(e)}`)));const u={signature:Iu().decode(s),signedMessage:t,signatureType:\"ed25519\"};return v(u,Ck),u}async#bn({coinTypeNode:e,account:t}){try{const{privateKeyBytes:n}=await CM({coinTypeNode:e,accountIndex:t.index});return n}catch{throw new Error(\"Unable to derive private key\")}}async signIn(e,t){this.#w.log(\"Signing in\",e,t);const{address:n}=e,r=this.#Sn(t),i=Fu().encode(r),o=Pu().decode(i),a={account:{address:n},...await this.signMessage(e,o)};return v(a,Mk),a}async verifySignature(e,t,n){this.#w.log(\"Verifying signature\",{account:e,signatureBase58:t,messageBase64:n}),v(t,QS),v(n,ek);const r=Tu().encode(t),i=Pu().encode(n),{privateKeyBytes:o}=await BM({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await If(o);return await ml(a.keyPair.publicKey,r,i)}#Sn(e){const{domain:t,address:n,statement:r,uri:i,version:o,chainId:a,nonce:s,issuedAt:c,expirationTime:u,notBefore:l,requestId:d,resources:f}=e;let h=`${t??\"\"} wants you to sign in with your Solana account:\\n`;h+=`${n??\"\"}`,r&&(h+=`\\n\\n${r}`);const p=[];if(i&&p.push(`URI: ${i}`),o&&p.push(`Version: ${o}`),a&&p.push(`Chain ID: ${a}`),s&&p.push(`Nonce: ${s}`),c&&p.push(`Issued At: ${c}`),u&&p.push(`Expiration Time: ${u}`),l&&p.push(`Not Before: ${l}`),d&&p.push(`Request ID: ${d}`),f&&f.length>0){p.push(\"Resources:\");for(const e of f)p.push(`- ${e}`)}return p.length&&(h+=`\\n\\n${p.join(\"\\n\")}`),h}}(PU,zU,sN,MU,nN,wh)),lN=new class{#St;#w;#de;#le;#kn;#xn;#mn;#En=\"Create Solana Account Batch\";constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:i,confirmationHandler:o,keyringAccountMonitor:a}){this.#St=e,this.#w=t.withPrefix(\"[🔑 Keyring]\"),this.#de=n,this.#le=r,this.#kn=i,this.#xn=o,this.#mn=a}async#In(){try{const e=await this.#St.getKey(\"keyringAccounts\")??{};return(0,Br.sortBy)(Object.values(e),[\"entropySource\",\"index\"])}catch(e){throw new Error(\"Error listing accounts\",{cause:e})}}async getAccount(e){try{MM({accountId:e},HS);return kM(await this.getAccountOrThrow(e))}catch(e){throw this.#w.error({error:e},\"Error getting account\"),new On(e)}}async getAccounts(){try{return(await this.#In()).map(kM)}catch(e){throw this.#w.error({error:e},\"Error listing accounts\"),new On(e)}}async getAccountOrThrow(e){const t=await this.#Tn(e);if(!t)throw new Error(`Account \"${e}\" not found`);return t}async#Tn(e){return this.#St.getKey(`keyringAccounts.${e}`)}#Bn(e){return`m/44'/501'/${e}'/0'`}async#Cn(){const e=(await async function(){return await snap.request({method:\"snap_listEntropySources\"})}()).find(({primary:e})=>e);if(!e)throw new Error(\"No default entropy source found - this can never happen\");return e.id}#Mn({id:e,entropySource:t,derivationPath:n,index:r,publicKeyBytes:i}){const o=RM.decode(i.slice(1));return{id:e,entropySource:t,derivationPath:n,index:r,type:Ye.DataAccount,address:o,scopes:[yM.Mainnet,yM.Testnet,yM.Devnet],options:{entropySource:t,derivationPath:n,index:r},methods:[jS.SignAndSendTransaction,jS.SignTransaction,jS.SignMessage,jS.SignIn]}}async createAccounts(e){try{!function(e,t){const{type:n}=e;if(!t.includes(n))throw new Error(`Unsupported create account option type: ${n}`)}(e,[`${At.Bip44DeriveIndex}`,`${At.Bip44DeriveIndexRange}`,`${At.Bip44Discover}`]),await async function(e){try{return await snap.request({method:\"snap_startTrace\",params:{name:e}})}catch(e){return null}}(this.#En);const t=e.entropySource??await this.#Cn(),[n,r]=await Promise.all([TM({entropySource:t,path:[\"m\",\"44'\",\"501'\"],curve:\"ed25519\"}),this.#In()]),i=await IC.fromJSON(n);if(e.type===At.Bip44Discover&&!await this.#Pn(i,e.groupIndex))return await Mo(this.#En),[];const o=new Map;for(const e of r)e.entropySource===t&&o.set(e.index,e);let a;a=e.type===At.Bip44DeriveIndexRange?e.range:{from:e.groupIndex,to:e.groupIndex};let s=0;const c={};for(let e=a.from;e<=a.to;e++)if(!o.has(e)){const n=globalThis.crypto.randomUUID(),r=this.#Bn(e),{publicKeyBytes:a}=await CM({coinTypeNode:i,accountIndex:e}),u=this.#Mn({id:n,entropySource:t,derivationPath:r,index:e,publicKeyBytes:a});o.set(e,u),c[n]=u,s+=1}await this.#St.setKeyWith(\"keyringAccounts\",e=>({...e,...c})),await Mo(this.#En);const u=[];for(let e=a.from;e<=a.to;e++){const t=o.get(e);t&&u.push(kM(t))}return this.#w.info(`Created ${s} new accounts, returned ${u.length} total accounts`),u}catch(e){throw this.#w.error({error:e},\"Error creating accounts batch\"),new On(e)}}async#_n(e){await this.#St.deleteKeys([`keyringAccounts.${e}`,`transactions.${e}`,`assetEntities.${e}`])}async deleteAccount(e){try{MM({accountId:e},WS),await this.#_n(e)}catch(e){throw this.#w.error({error:e},\"Error deleting account\"),new On(e)}}async getAccountAssets(e){try{MM({accountId:e},VS);const t=await this.getAccountOrThrow(e),n=(await this.#le.fetchAccountAssetsFromRpc(t)).filter(e=>e.assetType.endsWith(vo)||Number(e.rawAmount)>0).map(e=>e.assetType);return PM(n,It),n}catch(e){throw this.#w.error({error:e},\"Error listing account assets\"),new On(e)}}async getAccountBalances(e,t){try{MM({accountId:e,assets:t},GS);const n=await this.getAccountOrThrow(e),r=await this.#le.fetchAccountAssetsFromRpc(n),i=r.filter(e=>t.includes(e.assetType)).filter(e=>e.assetType.endsWith(vo)||Number(e.rawAmount)>0).reduce((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e),{});return PM(i,YS),i}catch(e){throw this.#w.error({error:e},\"Error getting account balances\"),new On(e)}}async submitRequest(e){v(e,_M);const{request:{method:t,params:n},scope:r,account:i,origin:o}=e,a=await this.getAccountOrThrow(i);if(!a.scopes.includes(r))throw new Error(`Scope \"${r}\" is not allowed for this account`);if(!a.methods.includes(t))throw new Error(`Method \"${t}\" is not allowed for this account`);if(\"scope\"in n&&r!==n.scope)throw new Error(`Scope \"${r}\" does not match \"${n.scope}\" in request.params`);v(r,XS);if(!await this.#xn.handleKeyringRequest(e,a))throw new Xn;switch(t){case jS.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#kn.signAndSendTransaction(a,e,r,o,t)}case jS.SignTransaction:{this.#Rn(a,e);const{transaction:t,options:i}=n;return this.#kn.signTransaction(a,t,r,o,i)}case jS.SignMessage:{this.#Rn(a,e);const{message:t}=n;return this.#kn.signMessage(a,t)}case jS.SignIn:return this.#kn.signIn(a,n);default:throw new $n(`Unsupported method: ${t}`)}}#Rn(e,t){const{address:n}=e,{account:r}=t.request.params;try{qu(r.address)}catch{throw new Error(\"Invalid Solana address format\")}if(r.address!==n)throw new Error(\"The requested account and/or method has not been authorized by the user.\")}async getAccountTransactions(e,t){try{MM({accountId:e,pagination:t},ZS);const{limit:n,next:r}=t,i=await this.#Tn(e);if(!i)throw new Error(\"Account not found\");const o=await this.#de.findByAccounts([i]),a=r?o.findIndex(e=>e.id===r):0,s=o.slice(a,a+n),c=a+t.limit<o.length;return{data:s,next:c?o[a+t.limit]?.id??null:null}}catch(e){throw this.#w.error({error:e},\"Error listing account transactions\"),new On(e)}}async resolveAccountAddress(e,t){try{v(e,XS);const{method:n,params:r}=t,i={method:n,params:r};v(i,Pk);const o=await this.#In();return{address:await this.#kn.resolveAccountAddress(o,e,i)}}catch(e){return await Th(e),this.#w.error({error:e},\"Error resolving account address\"),null}}async#Pn(e,t){const{publicKeyBytes:n}=await CM({coinTypeNode:e,accountIndex:t}),r=RM.decode(n.slice(1));return(await Promise.all(OM.map(async e=>this.#de.fetchLatestSignatures(e,r,{limit:1})))).some(e=>e.length>0)}async setSelectedAccounts(e){MM(e,U(_S));const t=new Set((await this.#In()).map(e=>e.id));if(!e.every(e=>t.has(e)))throw new Ln(\"Account IDs were not part of existing accounts.\");await this.#mn.setMonitoredAccounts(e)}async exportAccount(e,t){MM({accountId:e,options:t},JS);const n=await this.getAccountOrThrow(e),r=t?.encoding??\"base58\";if(\"base58\"!==r)throw new Error(\"Only base58 private key export is supported\");try{const{privateKeyBytes:e,publicKeyBytes:t}=await BM({entropySource:n.entropySource,derivationPath:n.derivationPath}),i=new Uint8Array(64);i.set(e,0),i.set(t.slice(1),32);const o=EM.encode(i);if(!b(o,QS))throw new Error(\"Derived private key failed encoding validation\");return{type:\"private-key\",encoding:r,privateKey:o}}catch(e){const t=\"Error exporting account\";throw this.#w.error(t),new On(t)}}}({state:BU,transactionsService:nN,logger:wh,assetsService:QU,walletService:uN,confirmationHandler:aN,keyringAccountMonitor:cN}),dN=new class{#F;#On;#w;#K;#re;#Un;#Nn;#le;#mt={minimumBalanceForRentExemption:5*uo.Minute};constructor(e,t,n,r,i,o,a,s){this.#F=e,this.#On=t,this.#K=r,this.#w=n.withPrefix(\"[📬 SendService]\"),this.#re=i,this.#Un=o,this.#Nn=a,this.#le=s}async#zn(e){return vh(async t=>this.#F.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then(e=>Ar(e.toString())),this.#K,{functionName:\"SendService:getMinimumBalanceForRentExemption\",ttlMilliseconds:this.#mt.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){this.#w.log(\"Confirming send transaction\",e);const{fromAccountId:t,toAddress:n,amount:r,assetId:i}=e.params,o=await this.#On.getAccountOrThrow(t),{chainId:a,assetReference:s}=tt(i),c=a,u=i===bo[c].nativeToken.caip19Id,l=u?this.#Un:this.#Nn,d={from:o,to:qu(n),amount:r,network:c,...u?{}:{mint:qu(s)}},f=lf(await l.buildTransactionMessage(d)),h=$b(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:Yh,request:{method:jS.SignAndSendTransaction,params:{account:{address:o.address},transaction:h,scope:c}}};return this.#w.log(\"Submitting keyring request\",p),this.#On.submitRequest(p)}async onAddressInput(e,t){if(\"\"===e)return{valid:!1,errors:[{code:LS.Required}]};try{qu(e);if(\"UNSUPPORTED\"===(await this.#re.classify(e,t)).type)throw new Error(\"Unsupported recipient\");return{valid:!0,errors:[]}}catch{return{valid:!1,errors:[{code:LS.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e;await this.#On.getAccountOrThrow(n);const{chainId:i}=tt(r),o=i,a=bo[o].nativeToken.caip19Id,s=r===a,c=await this.#le.getAccountAssetsByIDs(n,[r,a]),u=c[r],l=c[a];if(!u)throw new Error(`Balance not found for asset ${r} and account ${n}`);if(\"\"===t)return{valid:!1,errors:[{code:LS.Required}]};const d=vS(u.uiAmount??\"0\"),f=vS(l?.uiAmount??\"0\"),h=vS(t),p=await this.#zn(o),g=s?this.#Un:this.#Nn,m=new uP(g).getFee(),y=Ar(m.toString());if(f.isZero())return{valid:!1,errors:[{code:LS.InsufficientBalance}]};if(s){if(h.gt(f))return{valid:!1,errors:[{code:LS.InsufficientBalance}]};if(h.plus(y).plus(p).gt(f))return{valid:!1,errors:[{code:LS.InsufficientBalanceToCoverFee}]}}else{if(h.gt(d))return{valid:!1,errors:[{code:LS.InsufficientBalance}]};if(y.plus(p).gt(f))return{valid:!1,errors:[{code:LS.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(PU,lN,wh,CU,LU,FU,DU,QU),fN=new class{#F;#ne;#w;#ie=4e4;#oe=10000n;constructor(e,t,n){this.#F=e,this.#ne=t,this.#w=n.withPrefix(\"[🔐 ApproveTokenService]\")}async buildApprovalTransactionMessage(e){this.#w.log(\"Building token approval transaction\",{mint:e.mint,delegate:e.delegate,amount:e.amount,network:e.network});const{account:{entropySource:t,derivationPath:n},mint:r,delegate:i,amount:o,network:a}=e,[s,c,{privateKeyBytes:u}]=await Promise.all([this.#F.fetchMint(r,a),this.#F.getLatestBlockhash(a),BM({entropySource:t,derivationPath:n})]),{programAddress:l}=s,d=await If(u),f=(await zm({mint:r,owner:d.address,tokenProgram:l}))[0],[h,p]=await Promise.all([this.#ne.uiAmountToAmountForMint(r,a,o),this.#F.fetchJsonParsedAccount(f,a,void 0,{skipCache:!0})]);let g=!1;try{Dy(p),g=!0}catch{}const m=l===Bb,y=[];if(!g){const e=m?Pw:Lm;y.push(e({ata:f,mint:r,owner:d.address,payer:d,tokenProgram:l}))}const w=m?sw:Tm;y.push(w({source:f,delegate:i,owner:d,amount:h}));const v=[om({microLamports:this.#oe}),...y,em({units:this.#ie})];return bl(Nd({version:0}),e=>zd(d.address,e),e=>kl(c,e),e=>_d(v,e))}}(PU,NU,wh),hN=new class{#j;#kn;#w;#Fn;#Ln;constructor(e,t,n,r,i){this.#j=e,this.#kn=t,this.#w=n.withPrefix(\"[👋 ClientRequestHandler]\"),this.#Fn=r,this.#Ln=i}async handle(e){this.#w.log(\"Handling client request\",e);const{method:t}=e;switch(t){case bS:return this.#Dn(e);case SS:return this.#jn(e);case kS:return this.#$n(e);case xS:return this.#Kn(e);case ES:return this.#qn(e);case IS:return this.#Hn(e);case TS:return this.#Wn(e);case BS:return this.#Vn(e);case CS:return this.#Gn(e);case MS:return this.#Zn(e);case PS:return this.#Jn(e);default:throw new $n}}async#Dn(e){try{v(e,_k)}catch(e){const t=new Ln;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:i}}=e,o=await this.#j.findByAddress(r);if(!o)throw new Ln(`Account not found: ${r}`);return this.#kn.signAndSendTransaction(o,t,i,Yh,n)}async#$n(e){try{v(e,Ok)}catch(e){const t=new Ln;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:i}}=e,o=await this.#j.findById(r);if(!o)throw new Ln(`Account not found: ${r}`);const{signature:a}=await this.#kn.signAndSendTransaction(o,t,i,Yh,n),s={transactionId:a};return v(s,Uk),s}async#jn(e){try{v(e,zk)}catch(e){const t=new Ln;throw t.cause=e,t}return await this.#Fn.confirmSend(e)}async#Kn(e){try{v(e,tx)}catch(e){const t=new Ln;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,{baseFee:r,priorityFee:i}=yS.calculateFee(t),o=bo[n].nativeToken.symbol,a=bo[n].nativeToken.caip19Id,s=[{type:$h.Base,asset:{unit:o,type:a,amount:wS(r).toString(),fungible:!0}},{type:$h.Priority,asset:{unit:o,type:a,amount:wS(i).toString(),fungible:!0}}];return v(s,nx),s}async#qn(e){let t;try{t=A(e,Lk)}catch(e){const t=new Ln;throw t.cause=e,t}const{params:{value:n,scope:r}}=t,i=await this.#Fn.onAddressInput(n,r);return v(i,Qk),i}async#Hn(e){try{v(e,jk)}catch(e){const t=new Ln;throw t.cause=e,t}const t=await this.#Fn.onAmountInput(e);return v(t,Qk),t}async#Wn(e){v(e,Hk);const{params:{accountId:t,message:n}}=e,r=await this.#j.findById(t);if(!r)throw new Ln(`Account not found: ${t}`);const{address:i}=$k(n);if(i!==r.address)throw new Ln(`Address in rewards message (${i}) does not match signing account address (${r.address})`);return await this.#kn.signMessage(r,n)}async#Vn(e){try{v(e,Zk)}catch(e){const t=new Ln;throw t.cause=e,t}const{params:{accountId:t,message:n}}=e,r=await this.#j.findById(t);if(!r)throw new Ln(`Account not found: ${t}`);const{address:i}=Wk(n);if(i!==r.address)throw new Ln(`Address in card message (${i}) does not match signing account address (${r.address})`);return await this.#kn.signMessage(r,n)}async#Gn(e){try{v(e,Yk)}catch(e){const t=new Ln;throw t.cause=e,t}const{params:{accountId:t,amount:n,mint:r,delegate:i,scope:o}}=e,a=await this.#j.findById(t);if(!a)throw new Ln(`Account not found: ${t}`);const s=o,c=lf(await this.#Ln.buildApprovalTransactionMessage({account:a,mint:qu(r),delegate:qu(i),amount:n,network:s})),u=$b(c),{signature:l}=await this.#kn.signAndSendTransaction(a,u,s,Yh,void 0,Hh.TokenApprove),d={signature:l};return v(d,Xk),d}async#Zn(e){v(e,ax);const{params:{accountId:t,message:n}}=e,r=await this.#j.findById(t);if(!r)throw new Ln(`Account not found: ${t}`);const{address:i}=rx(n);if(i!==r.address)throw new Ln(`Address in proof-of-ownership message (${i}) does not match signing account address (${r.address})`);const o=bl(n,Fu().encode,Pu().decode),{signature:a}=await this.#kn.signMessage(r,o),s={signature:this.#Yn(a)};return v(s,sx),s}async#Jn(e){v(e,cx);const{params:{items:t}}=e,n=[...new Set(t.map(({accountId:e})=>e))],r=await this.#j.findByIds(n),i=new Map(r.map(e=>[e.id.toLowerCase(),e])),o=new Array(t.length),a=[],s=[];t.forEach(({accountId:e,message:t},n)=>{const r=i.get(e.toLowerCase());if(r)try{const{address:i}=rx(t);if(i!==r.address)return void(o[n]={accountId:e,error:`Address in proof-of-ownership message (${i}) does not match signing account address (${r.address})`});const c=bl(t,Fu().encode,Pu().decode);a.push({index:n,accountId:e}),s.push({account:r,message:c})}catch(t){o[n]={accountId:e,error:Sh(t).message}}else o[n]={accountId:e,error:`Account not found: ${e}`}});(await this.#kn.signMessages(s)).forEach((e,t)=>{const{index:n,accountId:r}=a[t];!function(e){return Object.hasOwn(e,\"error\")}(e)?o[n]={accountId:r,signature:this.#Yn(e.signature)}:o[n]={accountId:r,error:e.error}});const c={results:o};return v(c,lx),c}#Yn(e){return Ng(Uint8Array.from(Tu().encode(e)))}}(VU,uN,wh,dN,fN),pN={configProvider:Lo,connection:PU,keyring:lN,priceApiClient:jU,state:BU,assetsService:QU,signer:zU,transactionsService:nN,sendSolBuilder:FU,sendSplTokenBuilder:DU,walletService:uN,transactionScanService:oN,analyticsService:MU,confirmationHandler:aN,clientRequestHandler:hN,webSocketConnectionService:RU,subscriptionService:UU,eventEmitter:TU,nameResolutionService:qU,accountsService:VU,accountsSynchronizer:rN,tokenHelper:NU},gN=K({id:V(),jsonrpc:L(\"2.0\"),method:L(z_.OnTransactionAdded),params:K({accountId:_S,metadata:K({scope:XS,origin:V(),transactionType:z(Object.values(Hh))})})}),mN=K({id:V(),jsonrpc:L(\"2.0\"),method:L(z_.OnTransactionApproved),params:K({accountId:_S,metadata:K({scope:XS,origin:V(),transactionType:z(Object.values(Hh))})})}),yN=K({id:V(),jsonrpc:L(\"2.0\"),method:L(z_.OnTransactionRejected),params:K({accountId:_S,metadata:K({scope:XS,origin:V(),transactionType:z(Object.values(Hh))})})}),wN=async(e,t)=>{try{const n=await Hb(e,t),r=(e=>Object.hasOwn(e,\"instructions\"))(n)?n:await jb(n.messageBytes,t);if(!Sl(r))return!1;const{value:i}=await t.isBlockhashValid(r.lifetimeConstraint.blockhash).send();return!i}catch(e){return wh.warn({error:e},\"Could not check transaction blockhash lifetime\"),await Th(e),!1}},vN={[z_.OnTransactionAdded]:async({request:e})=>{try{wh.info(\"[onTransactionAdded] Cronjob triggered\",e),v(e,gN);const{accountId:t,metadata:n}=e.params,r=await lN.getAccountOrThrow(t);await MU.trackTransactionAdded({origin:n.origin,accountType:r.type,chainIdCaip:n.scope,transactionType:n.transactionType})}catch(e){throw wh.error(e),new zn(e)}},[z_.OnTransactionApproved]:async({request:e})=>{try{wh.info(\"[onTransactionApproved] Cronjob triggered\",e),v(e,mN);const{accountId:t,metadata:n}=e.params,r=await lN.getAccountOrThrow(t);await MU.trackTransactionApproved({origin:n.origin,accountType:r.type,chainIdCaip:n.scope,transactionType:n.transactionType})}catch(e){throw wh.error(e),new zn(e)}},[z_.OnTransactionRejected]:async({request:e})=>{try{wh.info(\"[onTransactionRejected] Cronjob triggered\",e),v(e,yN);const{accountId:t,metadata:n}=e.params,r=await lN.getAccountOrThrow(t);await MU.trackTransactionRejected({origin:n.origin,accountType:r.type,chainIdCaip:n.scope,transactionType:n.transactionType})}catch(e){throw wh.error(e),new zn(e)}},[z_.RefreshConfirmationEstimation]:async()=>{const e=wh.withPrefix(\"[refreshConfirmationEstimation]\");e.info(\"Background event triggered\");const t=(await BU.getKey(\"mapInterfaceNameToId\")??{})[So];if(!t)return void e.info(\"No interface context found\");const n=await Bo(t);if(n)try{if(!(n.account?.address&&n.transaction&&n.scope&&n.method))return void e.info(\"Context is missing required fields\");const r=Boolean(n.preferences?.simulateOnChainActions),i=n.origin===Yh;if(r){const e={...n,scanFetchStatus:\"fetching\"};await xo(t,bP(O_,{context:Mr(e)}),e)}else e.info(\"Transaction simulation is disabled in preferences\");const[o,a,s]=await Promise.all([r?oN.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}):Promise.resolve(n.scan),i?Promise.resolve(!1):wN(n.transaction,PU.getRpc(n.scope)),Bo(t)]);if(!s)return void e.info(\"Interface context no longer exists after scan, skipping update\");const c={...s,scanFetchStatus:\"fetched\",scan:a?P_:o};r&&e.info(\"New scan fetched\"),await xo(t,bP(O_,{context:Mr(c)}),c),e.info(\"Background event suceeded\"),await snap.request({method:\"snap_scheduleBackgroundEvent\",params:{duration:\"PT20S\",request:{method:z_.RefreshConfirmationEstimation}}})}catch(n){await Th(n);const r=await Bo(t);if(!r)return void e.info(\"Interface context no longer exists, skipping rollback\");const i={...r,scanFetchStatus:\"fetched\"};await xo(t,bP(O_,{context:Mr(i)}),i),e.warn({error:n},\"Could not update the interface. But rolled back status to fetched.\")}else e.info(\"Interface context no longer exists, skipping refresh\")},[z_.CloseWebSocketConnections]:async()=>{wh.info(\"Closing all WebSocket connections via background event\"),await RU.closeAllConnections()}},AN={...vN},bN={},SN=K({chainId:XS,domain:q(V()),address:q(V())}),kN=\"Solana Name Service\",xN=[\".sns\",\".sol\"],EN=\"getGenesisHash\",IN=\"getLatestBlockhash\",TN=\"getMinimumBalanceForRentExemption\",BN=K({jsonrpc:ge,id:me,method:L(EN),params:q(U())}),CN=K({jsonrpc:ge,id:me,method:L(IN)}),MN=K({jsonrpc:ge,id:me,method:L(TN),params:function(e){const t=D();return new m({type:\"tuple\",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let i=0;i<r;i++)yield[i,n[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${f(e)}`})}([$(),q(K())])}),PN=\"listWebSockets\",_N=\"listSubscriptions\",RN=\"testOnStart\",ON=\"testOnInstall\",UN=\"testOnUpdate\",NN=\"synchronizeAccounts\",zN=\"setAccountSelected\",FN=\"confirmSend\",LN=\"signRewardsMessage\",DN={[PN]:async()=>(await TU.emitSync(\"onListWebSockets\"),null),[_N]:async()=>(await TU.emitSync(\"onListSubscriptions\"),null),[RN]:async()=>(await TU.emitSync(\"onStart\"),null),[ON]:async()=>(await TU.emitSync(\"onInstall\"),null),[UN]:async()=>(await TU.emitSync(\"onUpdate\"),null),[NN]:async()=>(await rN.synchronize(),null),[zN]:async({request:e})=>(await lN.setSelectedAccounts(e.params.accountIds),null),[FN]:async({request:e})=>(await hN.handle(e),null),[LN]:async({request:e})=>hN.handle({...e,method:TS})},jN=[\"local\",\"test\"].includes(Lo.config.environment),$N=[Lt.GetAccounts,Lt.GetAccount,Lt.DeleteAccount,Lt.GetAccountBalances,Lt.SubmitRequest,Lt.GetAccountTransactions,Lt.GetAccountAssets,Lt.SetSelectedAccounts,St.ListAccounts,St.CreateAccount,St.FilterAccountChains,St.DiscoverAccounts,St.ListAccountTransactions,St.ListAccountAssets,PN,_N,RN,ON,UN,NN,zN,FN,LN],KN=(({dappMethods:e,metamaskMethods:t,origins:n=Jh,metamaskOrigin:r=Yh})=>{const i=new Map,o=new Set(e);for(const e of n)i.set(e,o);return i.set(r,new Set(t)),i})({dappMethods:jN?$N:[],metamaskMethods:[Lt.GetAccounts,Lt.GetAccount,Lt.CreateAccounts,Lt.DeleteAccount,Lt.GetAccountBalances,Lt.SubmitRequest,Lt.GetAccountTransactions,Lt.GetAccountAssets,Lt.ResolveAccountAddress,Lt.SetSelectedAccounts,Lt.ExportAccount,St.ListAccounts,St.CreateAccount,St.DiscoverAccounts,St.ListAccountTransactions,St.ListAccountAssets,bS,MS],origins:jN?Jh:[\"https://portfolio.metamask.io\"]});const qN=2n**255n-19n,HN=2n**252n+27742317777372353535851937790883648493n,WN=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,VN=0x6666666666666666666666666666666666666666666666666666666666666658n,GN={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:qN,n:HN,h:8,Gx:WN,Gy:VN},ZN=(e=\"\")=>{throw new Error(e)},JN=e=>\"string\"==typeof e,YN=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&\"object\"==typeof e&&\"Uint8Array\"===e.constructor.name)(e)||\"number\"==typeof t&&t>0&&e.length!==t?ZN(\"Uint8Array of valid length expected\"):e,XN=e=>new Uint8Array(e),QN=(e,t)=>YN(JN(e)?sz(e):XN(YN(e)),t),ez=(e,t=qN)=>{let n=e%t;return n>=0n?n:t+n},tz=e=>e instanceof nz?e:ZN(\"Point expected\");class nz{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new nz(e.x,e.y,1n,ez(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=GN,r=(e=QN(e,32)).slice(),i=e[31];r[31]=-129&i;const o=uz(r);!t||0n<=o&&o<2n**256n||ZN(\"bad y coord 1\"),t||0n<=o&&o<qN||ZN(\"bad y coord 2\");const a=ez(o*o),s=ez(a-1n),c=ez(n*a+1n);let{isValid:u,value:l}=pz(s,c);u||ZN(\"bad y coordinate 3\");const d=1n==(1n&l),f=!!(128&i);return!t&&0n===l&&f&&ZN(\"bad y coord 3\"),f!==d&&(l=ez(-l)),new nz(l,o,1n,ez(l*o))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:a}=tz(e),s=ez(t*a),c=ez(i*r),u=ez(n*a),l=ez(o*r);return s===c&&u===l}is0(){return this.equals(iz)}negate(){return new nz(ez(-this.ex),this.ey,this.ez,ez(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=GN,i=ez(e*e),o=ez(t*t),a=ez(2n*ez(n*n)),s=ez(r*i),c=e+t,u=ez(ez(c*c)-i-o),l=s+o,d=l-a,f=s-o,h=ez(u*d),p=ez(l*f),g=ez(u*f),m=ez(d*l);return new nz(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:i}=this,{ex:o,ey:a,ez:s,et:c}=tz(e),{a:u,d:l}=GN,d=ez(t*o),f=ez(n*a),h=ez(i*l*c),p=ez(r*s),g=ez((t+n)*(o+a)-d-f),m=ez(p-h),y=ez(p+h),w=ez(f-u*d),v=ez(g*m),A=ez(y*w),b=ez(g*w),S=ez(m*y);return new nz(v,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?ZN(\"cannot multiply by 0\"):iz;if(\"bigint\"==typeof e&&0n<e&&e<HN||ZN(\"invalid scalar, must be < L\"),!t&&this.is0()||1n===e)return this;if(this.equals(rz))return Pz(e).p;let n=iz,r=rz;for(let i=this;e>0n;i=i.double(),e>>=1n)1n&e?n=n.add(i):t&&(r=r.add(i));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(GN.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(HN/2n,!1).double();return e=e.add(this),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(iz))return{x:0n,y:1n};const r=dz(n);return 1n!==ez(n*r)&&ZN(\"invalid inverse\"),{x:ez(e*r),y:ez(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=cz(t);return n[31]|=1n&e?128:0,n}toHex(){return az(this.toRawBytes())}}nz.BASE=new nz(WN,VN,1n,ez(WN*VN)),nz.ZERO=new nz(0n,1n,1n,0n);const{BASE:rz,ZERO:iz}=nz,oz=(e,t)=>e.toString(16).padStart(t,\"0\"),az=e=>Array.from(e).map(e=>oz(e,2)).join(\"\"),sz=e=>{const t=e.length;(!JN(e)||t%2)&&ZN(\"hex invalid 1\");const n=XN(t/2);for(let t=0;t<n.length;t++){const r=2*t,i=e.slice(r,r+2),o=Number.parseInt(i,16);(Number.isNaN(o)||o<0)&&ZN(\"hex invalid 2\"),n[t]=o}return n},cz=e=>sz(oz(e,64)).reverse(),uz=e=>BigInt(\"0x\"+az(XN(YN(e)).reverse())),lz=(...e)=>{const t=XN(e.reduce((e,t)=>e+YN(t).length,0));let n=0;return e.forEach(e=>{t.set(e,n),n+=e.length}),t},dz=(e,t=qN)=>{(0n===e||t<=0n)&&ZN(\"no inverse n=\"+e+\" mod=\"+t);let n=ez(e,t),r=t,i=0n,o=1n,a=1n,s=0n;for(;0n!==n;){const e=r/n,t=r%n,c=i-a*e,u=o-s*e;r=n,n=t,i=a,o=s,a=c,s=u}return 1n===r?ez(i,t):ZN(\"no inverse\")},fz=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=qN;return n},hz=19681161376707505956807079304988542015446066515923890162744021073123829784752n,pz=(e,t)=>{const n=ez(t*t*t),r=(e=>{const t=e*e%qN*e%qN,n=fz(t,2n)*t%qN,r=fz(n,1n)*e%qN,i=fz(r,5n)*r%qN,o=fz(i,10n)*i%qN,a=fz(o,20n)*o%qN,s=fz(a,40n)*a%qN,c=fz(s,80n)*s%qN,u=fz(c,80n)*s%qN,l=fz(u,10n)*i%qN;return{pow_p_5_8:fz(l,2n)*e%qN,b2:t}})(e*ez(n*n*t)).pow_p_5_8;let i=ez(e*n*r);const o=ez(t*i*i),a=i,s=ez(i*hz),c=o===e,u=o===ez(-e),l=o===ez(-e*hz);return c&&(i=a),(u||l)&&(i=s),1n==(1n&ez(i))&&(i=ez(-i)),{isValid:c||u,value:i}},gz=e=>ez(uz(e),HN);let mz;const yz=(...e)=>Bz.sha512Async(...e),wz=(...e)=>\"function\"==typeof mz?mz(...e):ZN(\"etc.sha512Sync not set\"),vz=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=gz(t),i=rz.mul(r),o=i.toRawBytes();return{head:t,prefix:n,scalar:r,point:i,pointBytes:o}},Az=e=>yz(QN(e,32)).then(vz),bz=e=>vz(wz(QN(e,32))),Sz=e=>Az(e).then(e=>e.pointBytes);function kz(e,t){return e?yz(t.hashable).then(t.finish):t.finish(wz(t.hashable))}const xz=(e,t,n)=>{const{pointBytes:r,scalar:i}=e,o=gz(t),a=rz.mul(o).toRawBytes();return{hashable:lz(a,r,n),finish:e=>{const t=ez(o+gz(e)*i,HN);return YN(lz(a,cz(t)),64)}}},Ez={zip215:!0},Iz=(e,t,n,r=Ez)=>{t=QN(t),e=QN(e,64);const{zip215:i}=r;let o,a,s,c,u=new Uint8Array;try{o=nz.fromHex(n,i),a=nz.fromHex(e.slice(0,32),i),s=uz(e.slice(32,64)),c=rz.mul(s,!1),u=lz(a.toRawBytes(),o.toRawBytes(),t)}catch(e){}return{hashable:u,finish:e=>{if(null==c)return!1;if(!i&&o.isSmallOrder())return!1;const t=gz(e);return a.add(o.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},Tz=()=>\"object\"==typeof globalThis&&\"crypto\"in globalThis?globalThis.crypto:void 0,Bz={bytesToHex:az,hexToBytes:sz,concatBytes:lz,mod:ez,invert:dz,randomBytes:(e=32)=>{const t=Tz();return t&&t.getRandomValues||ZN(\"crypto.getRandomValues must be defined\"),t.getRandomValues(XN(e))},sha512Async:async(...e)=>{const t=Tz();t&&t.subtle||ZN(\"crypto.subtle or etc.sha512Async must be defined\");const n=lz(...e);return XN(await t.subtle.digest(\"SHA-512\",n.buffer))},sha512Sync:void 0};Object.defineProperties(Bz,{sha512Sync:{configurable:!1,get:()=>mz,set(e){mz||(mz=e)}}});const Cz={getExtendedPublicKeyAsync:Az,getExtendedPublicKey:bz,randomPrivateKey:()=>Bz.randomBytes(32),precompute:(e=8,t=rz)=>(t.multiply(3n),t)};let Mz;const Pz=e=>{const t=Mz||(Mz=(()=>{const e=[];let t=rz,n=t;for(let r=0;r<33;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e})()),n=(e,t)=>{let n=t.negate();return e?n:t};let r=iz,i=rz;const o=BigInt(255),a=BigInt(8);for(let s=0;s<33;s++){const c=128*s;let u=Number(e&o);e>>=a,u>128&&(u-=256,e+=1n);const l=c,d=c+Math.abs(u)-1,f=s%2!=0,h=u<0;0===u?i=i.add(n(f,t[l])):r=r.add(n(h,t[d]))}return{p:r,f:i}};function _z(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Rz=n(48).hp;const Oz=\"8d9df0f7-1363-4d2c-8152-ce4ed78f27d8\",Uz=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function Nz(e){return Rz.from(e).toString(\"base64\").replace(/\\+/gu,\"-\").replace(/\\//gu,\"_\").replace(/[=]/gu,\"\")}function zz(e){const t=e.replace(/-/gu,\"+\").replace(/_/gu,\"/\");return new Uint8Array(Rz.from(t,\"base64\"))}async function Fz(e,t,n){if(\"private\"!==t.type)throw new DOMException(\"Key is not private\",\"NotAllowedError\");if(!t.usages.includes(\"sign\"))throw new DOMException(\"Key usage not allowed\",\"NotAllowedError\");const r=_z(n),i=t[Oz],o=await(async(e,t)=>{const n=QN(e),r=await Az(t),i=await yz(r.prefix,n);return kz(!0,xz(r,i,n))})(r,i),a=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(o);return a}async function Lz(e,t,n,r){if(\"public\"!==t.type)throw new DOMException(\"Key is not public\",\"NotAllowedError\");if(!t.usages.includes(\"verify\"))throw new DOMException(\"Key usage not allowed\",\"NotAllowedError\");const i=_z(n),o=_z(r),a=t[Oz];return await(async(e,t,n,r=Ez)=>kz(!0,Iz(e,t,n,r)))(i,o,a)}function Dz(e){return\"Ed25519\"===e||\"object\"==typeof e&&\"Ed25519\"===e.name}function jz(){const{subtle:e}=globalThis.crypto,t=e.generateKey.bind(e),n=e.exportKey.bind(e),r=e.sign.bind(e),i=e.verify.bind(e),o=e.importKey.bind(e);Object.defineProperty(globalThis,\"isSecureContext\",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,\"generateKey\",{value:async(...e)=>Dz(e[0])?await async function(e,t,n){const r=Cz.randomPrivateKey(),i=await Sz(r),o=Array.from(n);return{privateKey:{algorithm:{name:\"Ed25519\"},extractable:t,type:\"private\",usages:o,[Oz]:r},publicKey:{algorithm:{name:\"Ed25519\"},extractable:!0,type:\"public\",usages:o,[Oz]:i}}}(...e):await t(...e),writable:!0,configurable:!0}),Object.defineProperty(e,\"exportKey\",{value:async(...e)=>Dz(e[1].algorithm)?await async function(e,t){if(!t.extractable)throw new DOMException(\"key is not extractable\",\"InvalidAccessException\");const n=t[Oz];switch(e){case\"raw\":if(\"public\"!==t.type)throw new DOMException(\"Unable to export a raw Ed25519 private key\",\"InvalidAccessError\");return n.buffer;case\"pkcs8\":if(\"private\"!==t.type)throw new DOMException(\"Unable to export a pkcs8 Ed25519 public key\",\"InvalidAccessError\");return new Uint8Array([...Uz,...n]).buffer;case\"jwk\":{const e={crv:\"Ed25519\",ext:t.extractable,key_ops:t.usages,kty:\"OKP\"};if(\"private\"===t.type){const t=await Sz(n);return Object.freeze({...e,d:Nz(n),x:Nz(t)})}return Object.freeze({...e,x:Nz(n)})}case\"spki\":{if(\"public\"!==t.type)throw new DOMException(\"Only public keys can be exported as SPKI\",\"InvalidAccessError\");const e=new Uint8Array([48,5,6,3,43,101,112]),r=new Uint8Array([3,n.length+1,0,...n]);return new Uint8Array([48,e.length+r.length,...e,...r]).buffer}default:throw new Error(`Unsupported export format: ${e}`)}}(...e):await n(...e),writable:!0,configurable:!0}),Object.defineProperty(e,\"sign\",{value:async(...e)=>{const[t,n]=e;return Dz(t)&&Dz(n.algorithm)?await Fz(...e):await r(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,\"verify\",{value:async(...e)=>{const[t,n]=e;return Dz(t)&&Dz(n.algorithm)?await Lz(...e):await i(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,\"importKey\",{value:async(...e)=>Dz(e[2])?await async function(e,t,n,r,i){const o=Array.from(i);switch(e){case\"raw\":{const e=_z(t);if(32!==e.length)throw new DOMException(\"Ed25519 raw keys must be exactly 32-bytes\",\"DataError\");return{algorithm:{name:\"Ed25519\"},extractable:r,type:\"public\",usages:o.filter(e=>\"verify\"===e),[Oz]:e}}case\"pkcs8\":{const e=_z(t);if(48!==e.length)throw new DOMException(\"Invalid PKCS8 key data length\",\"DataError\");if(!e.slice(0,16).every((e,t)=>e===Uz[t]))throw new DOMException(\"Invalid PKCS8 header\",\"DataError\");return{algorithm:{name:\"Ed25519\"},extractable:r,type:\"private\",usages:o.filter(e=>\"sign\"===e),[Oz]:e.slice(16)}}case\"jwk\":{const e=t;if(\"OKP\"!==e.kty||\"Ed25519\"!==e.crv)throw new DOMException(\"Invalid Ed25519 JWK\",\"DataError\");const n=\"d\"in e?\"private\":\"public\";if(\"public\"===n&&!e.x)throw new DOMException(\"Ed25519 JWK is missing public key\",\"DataError\");if(!(\"private\"!==n||e.d&&e.x))throw new DOMException(\"Ed25519 JWK is missing key data\",\"DataError\");const i=\"private\"===n?e.d:e.x;return{algorithm:{name:\"Ed25519\"},extractable:r,type:n,usages:o.filter(e=>\"private\"===n?\"sign\"===e:\"verify\"===e),[Oz]:zz(i)}}case\"spki\":{const e=_z(t);if(48!==e[0])throw new DOMException(\"Invalid SPKI format\",\"DataError\");const n=2;if(48!==e[n]||6!==e[n+2]||3!==e[n+3]||43!==e[n+4]||101!==e[n+5]||112!==e[n+6])throw new DOMException(\"Not an Ed25519 key\",\"DataError\");const r=n+7+2;return{algorithm:{name:\"Ed25519\"},extractable:!0,type:\"public\",usages:o.filter(e=>\"verify\"===e),[Oz]:e.slice(r)}}default:throw new Error(`Unsupported import format: ${e}`)}}(...e):await o(...e),writable:!0,configurable:!0})}const $z=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,\"DOMException\",{value:Error,writable:!0,configurable:!0,enumerable:!0}),jz(),Object.defineProperty(globalThis,\"queueMicrotask\",{value:$z,writable:!0,configurable:!0,enumerable:!0}),br.config({EXPONENTIAL_AT:16});const{onRpcRequest:Kz,onKeyringRequest:qz,onUserInput:Hz,onCronjob:Wz,onProtocolRequest:Vz,onClientRequest:Gz,onWebSocketEvent:Zz,onStart:Jz,onUpdate:Yz,onInstall:Xz,onActive:Qz,onInactive:eF,onNameLookup:tF}=function(e,t,n={}){return Object.fromEntries(Object.entries(t).map(([t,r])=>[t,async i=>e(async()=>r(i),n[t])]))}(Bh,{onRpcRequest:async({origin:e,originMetadata:t,request:n})=>{wh.log(\"[🔄 onRpcRequest]\",n.method,n);const{method:r}=n;tr(e,r,KN);const i=DN[r];if(!i)throw new $n(`RpcRequest method ${r} not found. Available methods: ${Object.keys(DN).toString()}`);return await i({origin:e,originMetadata:t,request:n})??null},onKeyringRequest:async({origin:e,request:t})=>{wh.log(\"[🔑 onKeyringRequest]\",t.method,t),tr(e,t.method,KN),t.method===St.SubmitRequest&&t.params&&!(\"origin\"in t.params)&&(t.params.origin=\"https://metamask.io\");return await er(lN,t)??null},onUserInput:async({id:e,event:t,context:n})=>{if(wh.log(\"[👇 onUserInput]\",e,t),!t.name)return;const r={...x_,...m_,...f_}[t.name];r&&await r({id:e,event:t,context:n,snapContext:pN})},onCronjob:async({request:e})=>{const t=wh.withPrefix(\"[⏱️ onCronjob]\");t.log(e.method,e);const{method:n}=e,r=[...Object.values(bN),...Object.values(z_)];v(n,z(r)),t.log(\"Running cronjob\",{method:n});const i=AN[n];if(!i)throw new $n(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${r.toString()}`);return await i({request:e})??null},onProtocolRequest:async e=>await(async({scope:e,request:t})=>{switch(v(e,XS),t.method){case EN:return v(t,BN),PU.getRpc(e).getGenesisHash().send();case IN:return v(t,CN),(await PU.getLatestBlockhash(e)).blockhash;case TN:return v(t,MN),(await PU.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)??null,onClientRequest:async({request:e})=>await hN.handle(e)??null,onWebSocketEvent:async({event:e})=>{await TU.emitSync(\"onWebSocketEvent\",e)},onStart:async()=>{await TU.emitSync(\"onStart\")},onUpdate:async()=>{await TU.emitSync(\"onUpdate\")},onInstall:async()=>{await TU.emitSync(\"onInstall\")},onActive:async()=>{await TU.emitSync(\"onActive\")},onInactive:async()=>{await TU.emitSync(\"onInactive\")},onNameLookup:async e=>await(async e=>{v(e,SN);const{chainId:t,domain:n,address:r}=e,i=new RegExp(`^.+(${xN.map(e=>`\\\\${e}`).join(\"|\")})$`,\"u\");if(n&&i.test(n)){const e=await qU.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:kN,domainName:n}]}}if(r){const e=await qU.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:kN}]}}return null})(e)??null}),{onAssetsLookup:nF,onAssetsConversion:rF,onAssetHistoricalPrice:iF,onAssetsMarketData:oF}={onAssetsLookup:async()=>({assets:{}}),onAssetsConversion:async()=>({conversionRates:{}}),onAssetHistoricalPrice:async()=>null,onAssetsMarketData:async()=>({marketData:{}})}})(),module.exports=r})();"
    },
    {
      "path": "images/icon.svg",
      "value": "<svg width=\"101\" height=\"101\" viewBox=\"0 0 101 101\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M100.48 69.3817L83.8068 86.8015C83.4444 87.1799 83.0058 87.4816 82.5185 87.6878C82.0312 87.894 81.5055 88.0003 80.9743 88H1.93563C1.55849 88 1.18957 87.8926 0.874202 87.6912C0.558829 87.4897 0.31074 87.2029 0.160416 86.8659C0.0100923 86.529 -0.0359181 86.1566 0.0280382 85.7945C0.0919944 85.4324 0.263131 85.0964 0.520422 84.8278L17.2061 67.408C17.5676 67.0306 18.0047 66.7295 18.4904 66.5234C18.9762 66.3172 19.5002 66.2104 20.0301 66.2095H99.0644C99.4415 66.2095 99.8104 66.3169 100.126 66.5183C100.441 66.7198 100.689 67.0067 100.84 67.3436C100.99 67.6806 101.036 68.0529 100.972 68.415C100.908 68.7771 100.737 69.1131 100.48 69.3817ZM83.8068 34.3032C83.4444 33.9248 83.0058 33.6231 82.5185 33.4169C82.0312 33.2108 81.5055 33.1045 80.9743 33.1048H1.93563C1.55849 33.1048 1.18957 33.2121 0.874202 33.4136C0.558829 33.6151 0.31074 33.9019 0.160416 34.2388C0.0100923 34.5758 -0.0359181 34.9482 0.0280382 35.3103C0.0919944 35.6723 0.263131 36.0083 0.520422 36.277L17.2061 53.6968C17.5676 54.0742 18.0047 54.3752 18.4904 54.5814C18.9762 54.7875 19.5002 54.8944 20.0301 54.8952H99.0644C99.4415 54.8952 99.8104 54.7879 100.126 54.5864C100.441 54.3849 100.689 54.0981 100.84 53.7612C100.99 53.4242 101.036 53.0518 100.972 52.6897C100.908 52.3277 100.737 51.9917 100.48 51.723L83.8068 34.3032ZM1.93563 21.7905H80.9743C81.5055 21.7907 82.0312 21.6845 82.5185 21.4783C83.0058 21.2721 83.4444 20.9704 83.8068 20.592L100.48 3.17219C100.737 2.90357 100.908 2.56758 100.972 2.2055C101.036 1.84342 100.99 1.47103 100.84 1.13408C100.689 0.79713 100.441 0.510296 100.126 0.308823C99.8104 0.107349 99.4415 1.24074e-05 99.0644 0L20.0301 0C19.5002 0.000878397 18.9762 0.107699 18.4904 0.313848C18.0047 0.519998 17.5676 0.821087 17.2061 1.19848L0.524723 18.6183C0.267681 18.8866 0.0966198 19.2223 0.0325185 19.5839C-0.0315829 19.9456 0.0140624 20.3177 0.163856 20.6545C0.31365 20.9913 0.561081 21.2781 0.875804 21.4799C1.19053 21.6817 1.55886 21.7896 1.93563 21.7905Z\" fill=\"url(#paint0_linear_174_4403)\"/>\n<defs>\n<linearGradient id=\"paint0_linear_174_4403\" x1=\"8.52558\" y1=\"90.0973\" x2=\"88.9933\" y2=\"-3.01622\" gradientUnits=\"userSpaceOnUse\">\n<stop offset=\"0.08\" stop-color=\"#9945FF\"/>\n<stop offset=\"0.3\" stop-color=\"#8752F3\"/>\n<stop offset=\"0.5\" stop-color=\"#5497D5\"/>\n<stop offset=\"0.6\" stop-color=\"#43B4CA\"/>\n<stop offset=\"0.72\" stop-color=\"#28E0B9\"/>\n<stop offset=\"0.97\" stop-color=\"#19FB9B\"/>\n</linearGradient>\n</defs>\n</svg>\n"
    }
  ],
  "removable": false,
  "hidden": true,
  "hideSnapBranding": true
}