@antseed/gateway-console 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/assets/Activity-CoD1LZfl.js +1 -0
  2. package/dist/assets/{Audit-DqVdOhlJ.js → Audit-CNmmoaeN.js} +1 -1
  3. package/dist/assets/ChainGate-CeDu6YYJ.js +1 -0
  4. package/dist/assets/{ChannelClose-OIfxrL05.js → ChannelClose-C_SM1g28.js} +1 -1
  5. package/dist/assets/{Charts-C40fH8xu.js → Charts-Dm9j6cVy.js} +1 -1
  6. package/dist/assets/{Chat-BvGYJ5Y8.js → Chat-D1yVH5Y-.js} +3 -3
  7. package/dist/assets/{ConnectWallet-CIF1O-b8.js → ConnectWallet-phY-Bf7w.js} +1 -1
  8. package/dist/assets/{DataTable-sbVT8kP1.js → DataTable-D65CSQpj.js} +1 -1
  9. package/dist/assets/{Disclosure-Cx-awmr6.js → Disclosure-DrGE-NkF.js} +1 -1
  10. package/dist/assets/KeyHolder-CmffMcZD.js +1 -0
  11. package/dist/assets/Keys-BovEuhch.js +1 -0
  12. package/dist/assets/Logs-B-T-V-pM.js +1 -0
  13. package/dist/assets/Members-tWNaQdIJ.js +1 -0
  14. package/dist/assets/{Migrate-DSwqmuYZ.js → Migrate-IZJLx1xU.js} +1 -1
  15. package/dist/assets/Models-gJrRx-QV.js +1 -0
  16. package/dist/assets/OperatorActions-DfjEKPUD.js +1 -0
  17. package/dist/assets/{OperatorGateAlert-C3dHqq3P.js → OperatorGateAlert-Bq1ilVp6.js} +1 -1
  18. package/dist/assets/{Overview-zCE_XZV5.js → Overview-CAxieiTF.js} +1 -1
  19. package/dist/assets/PeerPicker-JK4q0ZO9.js +1 -0
  20. package/dist/assets/PolicyEditor-BLo1sheV.js +1 -0
  21. package/dist/assets/PolicyField-CNEZju4W.js +1 -0
  22. package/dist/assets/Presets-DBRoMTo4.js +4 -0
  23. package/dist/assets/Providers-B3qO68z-.js +1 -0
  24. package/dist/assets/RequestLog-vl46fVIZ.js +1 -0
  25. package/dist/assets/{Rewards-EtGJVAbO.js → Rewards-CRiw-wXO.js} +2 -2
  26. package/dist/assets/RewardsClaim-D6P8go-K.js +1 -0
  27. package/dist/assets/Routing-YpzgjNx_.js +1 -0
  28. package/dist/assets/{Segmented-D3p0uCs7.js → Segmented-YOSVapPh.js} +1 -1
  29. package/dist/assets/SelectField-Cog9tKMb.js +1 -0
  30. package/dist/assets/{Settings-mk_D9qwH.js → Settings-CSXJvDLz.js} +2 -2
  31. package/dist/assets/{Switch-C1JjKdQ3.js → Switch-CGhLd0Ay.js} +1 -1
  32. package/dist/assets/{Tabs-4vclgTgN.js → Tabs-DuL015VX.js} +1 -1
  33. package/dist/assets/TextAreaField-Cxpnr6YH.js +1 -0
  34. package/dist/assets/{UsageByModel-DrWRsB8W.js → UsageByModel-5QuGhD1d.js} +1 -1
  35. package/dist/assets/Wallet-BOMYI48H.js +9 -0
  36. package/dist/assets/{WalletConfirm-DR1uVQ0x.js → WalletConfirm-Dc0AMNYH.js} +1 -1
  37. package/dist/assets/WalletFunding-CsUmR_iR.js +1 -0
  38. package/dist/assets/WalletSignIn-_VjhsjCt.js +1 -0
  39. package/dist/assets/Workspaces-Da-rLWlz.js +1 -0
  40. package/dist/assets/{add-D-7UccYb.js → add-Btpjkoo6.js} +1 -1
  41. package/dist/assets/{all-wallets-BGxRkpcp.js → all-wallets-BfrjmkEM.js} +1 -1
  42. package/dist/assets/{app-store-s1uoA2ti.js → app-store-CjAKxMNO.js} +1 -1
  43. package/dist/assets/{apple-BRpXhQwe.js → apple-BcO7LcJZ.js} +1 -1
  44. package/dist/assets/{arrow-bottom-FKCC1_cZ.js → arrow-bottom-DYhsTHhV.js} +1 -1
  45. package/dist/assets/{arrow-bottom-circle-CJkzZmsc.js → arrow-bottom-circle-DH3-k8Pr.js} +1 -1
  46. package/dist/assets/{arrow-left-De1oRzmY.js → arrow-left-i-RgLGSY.js} +1 -1
  47. package/dist/assets/{arrow-right-2NX2NyRD.js → arrow-right-Byrj5OIH.js} +1 -1
  48. package/dist/assets/{arrow-top-CgrB8jyp.js → arrow-top-BvEWR8S0.js} +1 -1
  49. package/dist/assets/{bank-CMkHQ1al.js → bank-CqGqrPxl.js} +1 -1
  50. package/dist/assets/{basic-BkMqokQN.js → basic-DWDkRcdy.js} +1 -1
  51. package/dist/assets/{browser-7RnxNloE.js → browser-CQNym1bY.js} +1 -1
  52. package/dist/assets/{bundle-full-DUUqKkjA.js → bundle-full-C55tgBr2.js} +1 -1
  53. package/dist/assets/{card-B_HxJTZt.js → card-D2zVsWGG.js} +1 -1
  54. package/dist/assets/{ccip-Co0K3XbT.js → ccip-2-SkbDQO.js} +1 -1
  55. package/dist/assets/{checkmark-CFWVDR6z.js → checkmark-FRmQx2A8.js} +1 -1
  56. package/dist/assets/{checkmark-bold-CNBCmpUc.js → checkmark-bold-BQmDzpHv.js} +1 -1
  57. package/dist/assets/{chevron-bottom-CTGYD88S.js → chevron-bottom-iNshLmUE.js} +1 -1
  58. package/dist/assets/{chevron-left-mTki2Hbr.js → chevron-left-DZ-hTSFy.js} +1 -1
  59. package/dist/assets/{chevron-right-DayB9xK6.js → chevron-right-ftn9B4r7.js} +1 -1
  60. package/dist/assets/{chevron-top-9WSiSGRy.js → chevron-top-nKnnD3BB.js} +1 -1
  61. package/dist/assets/{chrome-store-CgM5Miz5.js → chrome-store-Jvo-YJCr.js} +1 -1
  62. package/dist/assets/{clock-BxY5-pG7.js → clock-J68M1oCn.js} +1 -1
  63. package/dist/assets/{close-CDUCKnVv.js → close-Bb5jO3su.js} +1 -1
  64. package/dist/assets/{code-block-D5n56Bu8.js → code-block-6bmX2qDf.js} +1 -1
  65. package/dist/assets/{coinPlaceholder-Ds_PtIse.js → coinPlaceholder-BzR2PaE2.js} +1 -1
  66. package/dist/assets/{compass-C649LqmC.js → compass-_xiCm8H2.js} +1 -1
  67. package/dist/assets/{copy-DYxsyU2w.js → copy-Cn8HQUQ0.js} +1 -1
  68. package/dist/assets/{core-CX6jme4T.js → core-z96MxYDt.js} +3 -3
  69. package/dist/assets/cursor-AmgDWaYf.js +3 -0
  70. package/dist/assets/{cursor-transparent-Dq6J5BgS.js → cursor-transparent-BtLB_SMp.js} +1 -1
  71. package/dist/assets/{desktop-Do922EUE.js → desktop-BbxKfMA_.js} +1 -1
  72. package/dist/assets/{disconnect-DUKdDBRk.js → disconnect-BLztvIUd.js} +1 -1
  73. package/dist/assets/{discord-JwdabNcm.js → discord-CHUWozPc.js} +1 -1
  74. package/dist/assets/{en_US-Y4ZOVFV4-CReY5kLU.js → en_US-Y4ZOVFV4-CAcvlKBB.js} +4 -4
  75. package/dist/assets/{etherscan-DTBHIFki.js → etherscan-D5vLd5La.js} +1 -1
  76. package/dist/assets/{exclamation-triangle-BpP327Fo.js → exclamation-triangle-qrQeSTv8.js} +1 -1
  77. package/dist/assets/{extension-j6JOf27o.js → extension-4gVUPN7H.js} +1 -1
  78. package/dist/assets/{external-link-KPnIyOs2.js → external-link-B14WJWrF.js} +1 -1
  79. package/dist/assets/{facebook-CUm5rmxi.js → facebook-CIMBt82S.js} +1 -1
  80. package/dist/assets/{farcaster-B0vG6PgN.js → farcaster-c2htRu7g.js} +1 -1
  81. package/dist/assets/{filters-lRsk33JN.js → filters-Bv71E2AR.js} +1 -1
  82. package/dist/assets/{github-CxYb478W.js → github-UYR2U4eW.js} +1 -1
  83. package/dist/assets/{google-AoLkuqHM.js → google-n2NyY3Dw.js} +1 -1
  84. package/dist/assets/{help-circle-B4PduW5F.js → help-circle-BLFRE_d4.js} +1 -1
  85. package/dist/assets/{highlighted-body-KQOG7T2V-tu6WaGd1.js → highlighted-body-KQOG7T2V-BPvcfizq.js} +1 -1
  86. package/dist/assets/{id-L7tAEkKG.js → id-Bx-RYygz.js} +1 -1
  87. package/dist/assets/{image-DOQYBepB.js → image-BOkMzreg.js} +1 -1
  88. package/dist/assets/{index-Bgrmz5Gh.js → index-BG30WuBG.js} +15 -15
  89. package/dist/assets/{index-DNT4SsKr.css → index-D8vXwUTI.css} +1 -1
  90. package/dist/assets/{index-DK7xhF9m.js → index-DUGIknuZ.js} +1 -1
  91. package/dist/assets/{index-y9ajgRFv.js → index-DzFVk9QK.js} +1 -1
  92. package/dist/assets/{index-BqGpfOnj.js → index-FSpcDkTF.js} +3 -3
  93. package/dist/assets/{index-17PEzKx_.js → index-RORHmLec.js} +1 -1
  94. package/dist/assets/{index.es-kR-uCv4P.js → index.es-CA2ape1X.js} +4 -4
  95. package/dist/assets/{info-uKWVCo_C.js → info-Cn0tJEtZ.js} +1 -1
  96. package/dist/assets/{info-circle-BvfVUJNy.js → info-circle-Bu4Zfbo-.js} +1 -1
  97. package/dist/assets/{lightbulb-DO32OYdV.js → lightbulb-CEuGFxl3.js} +1 -1
  98. package/dist/assets/{limits-I4Xri5kH.js → limits-Cv54gck6.js} +1 -1
  99. package/dist/assets/{mail-MlMfOV0O.js → mail-DTJ1wl6n.js} +1 -1
  100. package/dist/assets/{mermaid-MCJ5UELQ-CXGXvvLA.js → mermaid-MCJ5UELQ-BedJEojm.js} +3 -3
  101. package/dist/assets/{metamask-sdk-CZTQzdZy.js → metamask-sdk-CQV3kKmz.js} +1 -1
  102. package/dist/assets/{mobile-DxWEXY-d.js → mobile-D5XkpStI.js} +1 -1
  103. package/dist/assets/{models-DGQYrtKn.js → models-DMYWCgsM.js} +1 -1
  104. package/dist/assets/{more-CDCHQLT3.js → more-DdrXAXX1.js} +1 -1
  105. package/dist/assets/{network-placeholder-Bscumk_y.js → network-placeholder-DYxULQKf.js} +1 -1
  106. package/dist/assets/{nftPlaceholder-CZj8ym45.js → nftPlaceholder-DNCBtU2V.js} +1 -1
  107. package/dist/assets/{off-DZcfy0ut.js → off-x6tIm6IU.js} +1 -1
  108. package/dist/assets/{play-store-DMcFVzJl.js → play-store-DH_0xG8x.js} +1 -1
  109. package/dist/assets/{plus-CrMZIqkK.js → plus-D6bTrOQ5.js} +1 -1
  110. package/dist/assets/{qr-code-BmydgyiV.js → qr-code-nZ-ywovk.js} +1 -1
  111. package/dist/assets/{recycle-horizontal-CSrs8rul.js → recycle-horizontal-Dfef9bS8.js} +1 -1
  112. package/dist/assets/{refresh-Bghm7ATF.js → refresh-DjaTupr6.js} +1 -1
  113. package/dist/assets/{reown-logo-BE_YCUWl.js → reown-logo-8xfPxyEW.js} +1 -1
  114. package/dist/assets/{search-BVKO89aW.js → search-CTyg9yLr.js} +1 -1
  115. package/dist/assets/{secp256k1-BYFo74Iy.js → secp256k1-C3GZOk0r.js} +1 -1
  116. package/dist/assets/{send-pY0DB7x7.js → send-BRCwXyYl.js} +1 -1
  117. package/dist/assets/{swapHorizontal-DLJaB22K.js → swapHorizontal-DQysA-xv.js} +1 -1
  118. package/dist/assets/{swapHorizontalBold-DGAu8PHD.js → swapHorizontalBold-CfvpnhxX.js} +1 -1
  119. package/dist/assets/{swapHorizontalMedium-CgNljeNo.js → swapHorizontalMedium-Ei15IdQU.js} +1 -1
  120. package/dist/assets/{swapHorizontalRoundedBold-Cj5OUnOy.js → swapHorizontalRoundedBold-BrdyV7V9.js} +1 -1
  121. package/dist/assets/{swapVertical-BrZopBF4.js → swapVertical-Chu7IZEN.js} +1 -1
  122. package/dist/assets/{telegram-XorPgtmK.js → telegram-WX2YRbPh.js} +1 -1
  123. package/dist/assets/{three-dots-BJhNCCn5.js → three-dots-DxlCOrsx.js} +1 -1
  124. package/dist/assets/{twitch-BEbiCzO2.js → twitch-DnDwl6Wp.js} +1 -1
  125. package/dist/assets/{twitterIcon-CkcUz9fu.js → twitterIcon-BRzgYnIv.js} +1 -1
  126. package/dist/assets/{usage-D2MGES9n.js → usage-CSmvbieU.js} +1 -1
  127. package/dist/assets/{useInfiniteQuery-DWwzEQdC.js → useInfiniteQuery-Dd787Fyg.js} +1 -1
  128. package/dist/assets/{useTx-CIkBd_D3.js → useTx-BMOzJPjG.js} +1 -1
  129. package/dist/assets/{verify-9cqPQDU3.js → verify-BDEQw6N7.js} +1 -1
  130. package/dist/assets/{verify-filled-Da6z020R.js → verify-filled-4pi90YF-.js} +1 -1
  131. package/dist/assets/{w3m-modal-DYYWuCzk.js → w3m-modal-0lsUnIxD.js} +1 -1
  132. package/dist/assets/{wallet-ctGTkC8h.js → wallet-Cdj3wKM9.js} +1 -1
  133. package/dist/assets/{wallet-placeholder-CMKbW-yz.js → wallet-placeholder-9WrqEYA6.js} +1 -1
  134. package/dist/assets/{walletconnect-Cyg39b3w.js → walletconnect-Dxw2wfHl.js} +1 -1
  135. package/dist/assets/{warning-circle-D9mA3kC3.js → warning-circle-BS-8TEUR.js} +1 -1
  136. package/dist/assets/{x-DVGEd37g.js → x-BuEdoHYI.js} +1 -1
  137. package/dist/index.html +2 -2
  138. package/package.json +3 -3
  139. package/dist/assets/Activity-62ACSef_.js +0 -1
  140. package/dist/assets/ChainGate-B1xi2PsC.js +0 -1
  141. package/dist/assets/KeyHolder-CPmUp8lv.js +0 -1
  142. package/dist/assets/Keys-stljGmXA.js +0 -1
  143. package/dist/assets/Logs-C2h0OUd6.js +0 -1
  144. package/dist/assets/Members-CvRczTwo.js +0 -1
  145. package/dist/assets/Models-DRrQ0eaX.js +0 -1
  146. package/dist/assets/OperatorActions-CDFST6SU.js +0 -1
  147. package/dist/assets/PolicyEditor-B52YQzMa.js +0 -1
  148. package/dist/assets/PolicyField-Djk40GaH.js +0 -1
  149. package/dist/assets/Presets-MqSKjh0_.js +0 -4
  150. package/dist/assets/Providers-Deprr6b6.js +0 -1
  151. package/dist/assets/RequestLog-C5PR-cpV.js +0 -1
  152. package/dist/assets/RewardsClaim-DRzi4dnv.js +0 -1
  153. package/dist/assets/Routing-B4sVpf47.js +0 -1
  154. package/dist/assets/SelectField-BSkxMNGk.js +0 -1
  155. package/dist/assets/TextAreaField-CYcKNNwk.js +0 -1
  156. package/dist/assets/Wallet-B73Wye2M.js +0 -9
  157. package/dist/assets/WalletFunding-CctnzIgN.js +0 -1
  158. package/dist/assets/WalletSignIn-CE39ggEH.js +0 -1
  159. package/dist/assets/Workspaces-CmwBRhwh.js +0 -1
  160. package/dist/assets/cursor-BXlarUDb.js +0 -3
@@ -1 +1 @@
1
- import{H as Xt,c as At,a as Et,t as Qt,b as de,w as he,r as P,d as ge,e as we,f as pe,g as be}from"./index.es-kR-uCv4P.js";import"./index-Bgrmz5Gh.js";import"./events-DQ172AOg.js";function ye(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const o=BigInt(32),s=BigInt(4294967295),c=Number(t>>o&s),f=Number(t&s),i=r?4:0,u=r?0:4;n.setUint32(e+i,c,r),n.setUint32(e+u,f,r)}function me(n,e,t){return n&e^~n&t}function xe(n,e,t){return n&e^n&t^e&t}class Ee extends Xt{constructor(e,t,r,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=At(this.buffer)}update(e){Et(this);const{view:t,buffer:r,blockLen:o}=this;e=Qt(e);const s=e.length;for(let c=0;c<s;){const f=Math.min(o-this.pos,s-c);if(f===o){const i=At(e);for(;o<=s-c;c+=o)this.process(i,c);continue}r.set(e.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Et(this),de(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:s}=this;let{pos:c}=this;t[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(r,0),c=0);for(let h=c;h<o;h++)t[h]=0;ye(r,o-8,BigInt(this.length*8),s),this.process(r,0);const f=At(e),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=i/4,y=this.get();if(u>y.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)f.setUint32(4*h,y[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:o,finished:s,destroyed:c,pos:f}=this;return e.length=o,e.pos=f,e.finished=s,e.destroyed=c,o%t&&e.buffer.set(r),e}}const Be=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]),Q=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),J=new Uint32Array(64);class ve extends Ee{constructor(){super(64,32,8,!1),this.A=Q[0]|0,this.B=Q[1]|0,this.C=Q[2]|0,this.D=Q[3]|0,this.E=Q[4]|0,this.F=Q[5]|0,this.G=Q[6]|0,this.H=Q[7]|0}get(){const{A:e,B:t,C:r,D:o,E:s,F:c,G:f,H:i}=this;return[e,t,r,o,s,c,f,i]}set(e,t,r,o,s,c,f,i){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=f|0,this.H=i|0}process(e,t){for(let h=0;h<16;h++,t+=4)J[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const l=J[h-15],m=J[h-2],N=P(l,7)^P(l,18)^l>>>3,b=P(m,17)^P(m,19)^m>>>10;J[h]=b+J[h-7]+N+J[h-16]|0}let{A:r,B:o,C:s,D:c,E:f,F:i,G:u,H:y}=this;for(let h=0;h<64;h++){const l=P(f,6)^P(f,11)^P(f,25),m=y+l+me(f,i,u)+Be[h]+J[h]|0,b=(P(r,2)^P(r,13)^P(r,22))+xe(r,o,s)|0;y=u,u=i,i=f,f=c+m|0,c=s,s=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,i=i+this.F|0,u=u+this.G|0,y=y+this.H|0,this.set(r,o,s,c,f,i,u,y)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Se=he(()=>new ve);class Jt extends Xt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ge(e);const r=Qt(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")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,s=new Uint8Array(o);s.set(r.length>o?e.create().update(r).digest():r);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=e.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),s.fill(0)}update(e){return Et(this),this.iHash.update(e),this}digestInto(e){Et(this),we(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:r,finished:o,destroyed:s,blockLen:c,outputLen:f}=this;return e=e,e.finished=o,e.destroyed=s,e.blockLen=c,e.outputLen=f,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const te=(n,e,t)=>new Jt(n,e).update(t).digest();te.create=(n,e)=>new Jt(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ct=BigInt(0),ee=BigInt(1),Ae=BigInt(2);function it(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function yt(n){if(!it(n))throw new Error("Uint8Array expected")}function at(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}const Ie=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function ut(n){yt(n);let e="";for(let t=0;t<n.length;t++)e+=Ie[n[t]];return e}function wt(n){const e=n.toString(16);return e.length&1?"0"+e:e}function Zt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ct:BigInt("0x"+n)}const D={_0:48,_9:57,A:65,F:70,a:97,f:102};function jt(n){if(n>=D._0&&n<=D._9)return n-D._0;if(n>=D.A&&n<=D.F)return n-(D.A-10);if(n>=D.a&&n<=D.f)return n-(D.a-10)}function pt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let o=0,s=0;o<t;o++,s+=2){const c=jt(n.charCodeAt(s)),f=jt(n.charCodeAt(s+1));if(c===void 0||f===void 0){const i=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+i+'" at index '+s)}r[o]=c*16+f}return r}function rt(n){return Zt(ut(n))}function Rt(n){return yt(n),Zt(ut(Uint8Array.from(n).reverse()))}function lt(n,e){return pt(n.toString(16).padStart(e*2,"0"))}function Mt(n,e){return lt(n,e).reverse()}function K(n,e,t){let r;if(typeof e=="string")try{r=pt(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(it(e))r=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const o=r.length;if(typeof t=="number"&&o!==t)throw new Error(n+" of length "+t+" expected, got "+o);return r}function bt(...n){let e=0;for(let r=0;r<n.length;r++){const o=n[r];yt(o),e+=o.length}const t=new Uint8Array(e);for(let r=0,o=0;r<n.length;r++){const s=n[r];t.set(s,o),o+=s.length}return t}const It=n=>typeof n=="bigint"&&Ct<=n;function Bt(n,e,t){return It(n)&&It(e)&&It(t)&&e<=n&&n<t}function ot(n,e,t,r){if(!Bt(e,t,r))throw new Error("expected valid "+n+": "+t+" <= n < "+r+", got "+e)}function ne(n){let e;for(e=0;n>Ct;n>>=ee,e+=1);return e}const Vt=n=>(Ae<<BigInt(n-1))-ee,Nt=n=>new Uint8Array(n),Yt=n=>Uint8Array.from(n);function re(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=Nt(n),o=Nt(n),s=0;const c=()=>{r.fill(1),o.fill(0),s=0},f=(...h)=>t(o,r,...h),i=(h=Nt())=>{o=f(Yt([0]),h),r=f(),h.length!==0&&(o=f(Yt([1]),h),r=f())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const l=[];for(;h<e;){r=f();const m=r.slice();l.push(m),h+=r.length}return bt(...l)};return(h,l)=>{c(),i(h);let m;for(;!(m=l(u()));)i();return c(),m}}const Ne={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||it(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function mt(n,e,t={}){const r=(o,s,c)=>{const f=Ne[s];if(typeof f!="function")throw new Error("invalid validator function");const i=n[o];if(!(c&&i===void 0)&&!f(i,n))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+i)};for(const[o,s]of Object.entries(e))r(o,s,!1);for(const[o,s]of Object.entries(t))r(o,s,!0);return n}function Ut(n){const e=new WeakMap;return(t,...r)=>{const o=e.get(t);if(o!==void 0)return o;const s=n(t,...r);return e.set(t,s),s}}const qe=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ot,abool:at,abytes:yt,bitLen:ne,bitMask:Vt,bytesToHex:ut,bytesToNumberBE:rt,bytesToNumberLE:Rt,concatBytes:bt,createHmacDrbg:re,ensureBytes:K,hexToBytes:pt,hexToNumber:Zt,inRange:Bt,isBytes:it,memoized:Ut,numberToBytesBE:lt,numberToBytesLE:Mt,numberToHexUnpadded:wt,validateObject:mt},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z=BigInt(0),_=BigInt(1),nt=BigInt(2),Oe=BigInt(3),_t=BigInt(4),Ft=BigInt(5),Kt=BigInt(8);function V(n,e){const t=n%e;return t>=z?t:e+t}function Le(n,e,t){if(e<z)throw new Error("invalid exponent, negatives unsupported");if(t<=z)throw new Error("invalid modulus");if(t===_)return z;let r=_;for(;e>z;)e&_&&(r=r*n%t),n=n*n%t,e>>=_;return r}function Y(n,e,t){let r=n;for(;e-- >z;)r*=r,r%=t;return r}function Tt(n,e){if(n===z)throw new Error("invert: expected non-zero number");if(e<=z)throw new Error("invert: expected positive modulus, got "+e);let t=V(n,e),r=e,o=z,s=_;for(;t!==z;){const f=r/t,i=r%t,u=o-s*f;r=t,t=i,o=s,s=u}if(r!==_)throw new Error("invert: does not exist");return V(o,e)}function He(n){const e=(n-_)/nt;let t,r,o;for(t=n-_,r=0;t%nt===z;t/=nt,r++);for(o=nt;o<n&&Le(o,e,n)!==n-_;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const c=(n+_)/_t;return function(i,u){const y=i.pow(u,c);if(!i.eql(i.sqr(y),u))throw new Error("Cannot find square root");return y}}const s=(t+_)/nt;return function(f,i){if(f.pow(i,e)===f.neg(f.ONE))throw new Error("Cannot find square root");let u=r,y=f.pow(f.mul(f.ONE,o),t),h=f.pow(i,s),l=f.pow(i,t);for(;!f.eql(l,f.ONE);){if(f.eql(l,f.ZERO))return f.ZERO;let m=1;for(let b=f.sqr(l);m<u&&!f.eql(b,f.ONE);m++)b=f.sqr(b);const N=f.pow(y,_<<BigInt(u-m-1));y=f.sqr(N),h=f.mul(h,N),l=f.mul(l,y),u=m}return h}}function Ue(n){if(n%_t===Oe){const e=(n+_)/_t;return function(r,o){const s=r.pow(o,e);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%Kt===Ft){const e=(n-Ft)/Kt;return function(r,o){const s=r.mul(o,nt),c=r.pow(s,e),f=r.mul(o,c),i=r.mul(r.mul(f,nt),c),u=r.mul(f,r.sub(i,r.ONE));if(!r.eql(r.sqr(u),o))throw new Error("Cannot find square root");return u}}return He(n)}const _e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Te(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=_e.reduce((r,o)=>(r[o]="function",r),e);return mt(n,t)}function ke(n,e,t){if(t<z)throw new Error("invalid exponent, negatives unsupported");if(t===z)return n.ONE;if(t===_)return e;let r=n.ONE,o=e;for(;t>z;)t&_&&(r=n.mul(r,o)),o=n.sqr(o),t>>=_;return r}function ze(n,e){const t=new Array(e.length),r=e.reduce((s,c,f)=>n.is0(c)?s:(t[f]=s,n.mul(s,c)),n.ONE),o=n.inv(r);return e.reduceRight((s,c,f)=>n.is0(c)?s:(t[f]=n.mul(s,t[f]),n.mul(s,c)),o),t}function oe(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function ie(n,e,t=!1,r={}){if(n<=z)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:o,nByteLength:s}=oe(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c;const f=Object.freeze({ORDER:n,isLE:t,BITS:o,BYTES:s,MASK:Vt(o),ZERO:z,ONE:_,create:i=>V(i,n),isValid:i=>{if(typeof i!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof i);return z<=i&&i<n},is0:i=>i===z,isOdd:i=>(i&_)===_,neg:i=>V(-i,n),eql:(i,u)=>i===u,sqr:i=>V(i*i,n),add:(i,u)=>V(i+u,n),sub:(i,u)=>V(i-u,n),mul:(i,u)=>V(i*u,n),pow:(i,u)=>ke(f,i,u),div:(i,u)=>V(i*Tt(u,n),n),sqrN:i=>i*i,addN:(i,u)=>i+u,subN:(i,u)=>i-u,mulN:(i,u)=>i*u,inv:i=>Tt(i,n),sqrt:r.sqrt||(i=>(c||(c=Ue(n)),c(f,i))),invertBatch:i=>ze(f,i),cmov:(i,u,y)=>y?u:i,toBytes:i=>t?Mt(i,s):lt(i,s),fromBytes:i=>{if(i.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+i.length);return t?Rt(i):rt(i)}});return Object.freeze(f)}function se(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function ce(n){const e=se(n);return e+Math.ceil(e/2)}function Ce(n,e,t=!1){const r=n.length,o=se(e),s=ce(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=t?Rt(n):rt(n),f=V(c,e-_)+_;return t?Mt(f,o):lt(f,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pt=BigInt(0),xt=BigInt(1);function qt(n,e){const t=e.negate();return n?t:e}function fe(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function Ot(n,e){fe(n,e);const t=Math.ceil(e/n)+1,r=2**(n-1);return{windows:t,windowSize:r}}function Ze(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)})}function Re(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)})}const Lt=new WeakMap,ae=new WeakMap;function Ht(n){return ae.get(n)||1}function Me(n,e){return{constTimeNegate:qt,hasPrecomputes(t){return Ht(t)!==1},unsafeLadder(t,r,o=n.ZERO){let s=t;for(;r>Pt;)r&xt&&(o=o.add(s)),s=s.double(),r>>=xt;return o},precomputeWindow(t,r){const{windows:o,windowSize:s}=Ot(r,e),c=[];let f=t,i=f;for(let u=0;u<o;u++){i=f,c.push(i);for(let y=1;y<s;y++)i=i.add(f),c.push(i);f=i.double()}return c},wNAF(t,r,o){const{windows:s,windowSize:c}=Ot(t,e);let f=n.ZERO,i=n.BASE;const u=BigInt(2**t-1),y=2**t,h=BigInt(t);for(let l=0;l<s;l++){const m=l*c;let N=Number(o&u);o>>=h,N>c&&(N-=y,o+=xt);const b=m,a=m+Math.abs(N)-1,g=l%2!==0,x=N<0;N===0?i=i.add(qt(g,r[b])):f=f.add(qt(x,r[a]))}return{p:f,f:i}},wNAFUnsafe(t,r,o,s=n.ZERO){const{windows:c,windowSize:f}=Ot(t,e),i=BigInt(2**t-1),u=2**t,y=BigInt(t);for(let h=0;h<c;h++){const l=h*f;if(o===Pt)break;let m=Number(o&i);if(o>>=y,m>f&&(m-=u,o+=xt),m===0)continue;let N=r[l+Math.abs(m)-1];m<0&&(N=N.negate()),s=s.add(N)}return s},getPrecomputes(t,r,o){let s=Lt.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&Lt.set(r,o(s))),s},wNAFCached(t,r,o){const s=Ht(t);return this.wNAF(s,this.getPrecomputes(s,t,o),r)},wNAFCachedUnsafe(t,r,o,s){const c=Ht(t);return c===1?this.unsafeLadder(t,r,s):this.wNAFUnsafe(c,this.getPrecomputes(c,t,o),r,s)},setWindowSize(t,r){fe(r,e),ae.set(t,r),Lt.delete(t)}}}function Ve(n,e,t,r){if(Ze(t,n),Re(r,e),t.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,s=ne(BigInt(t.length)),c=s>12?s-3:s>4?s-2:s?2:1,f=(1<<c)-1,i=new Array(f+1).fill(o),u=Math.floor((e.BITS-1)/c)*c;let y=o;for(let h=u;h>=0;h-=c){i.fill(o);for(let m=0;m<r.length;m++){const N=r[m],b=Number(N>>BigInt(h)&BigInt(f));i[b]=i[b].add(t[m])}let l=o;for(let m=i.length-1,N=o;m>0;m--)N=N.add(i[m]),l=l.add(N);if(y=y.add(l),h!==0)for(let m=0;m<c;m++)y=y.double()}return y}function ue(n){return Te(n.Fp),mt(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...oe(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Gt(n){n.lowS!==void 0&&at("lowS",n.lowS),n.prehash!==void 0&&at("prehash",n.prehash)}function je(n){const e=ue(n);mt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:o}=e;if(t){if(!r.eql(o,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Ye,hexToBytes:Fe}=qe;class Ke extends Error{constructor(e=""){super(e)}}const $={Err:Ke,_tlv:{encode:(n,e)=>{const{Err:t}=$;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,o=wt(r);if(o.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?wt(o.length/2|128):"";return wt(n)+s+o+e},decode(n,e){const{Err:t}=$;let r=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==n)throw new t("tlv.decode: wrong tlv");const o=e[r++],s=!!(o&128);let c=0;if(!s)c=o;else{const i=o&127;if(!i)throw new t("tlv.decode(long): indefinite length not supported");if(i>4)throw new t("tlv.decode(long): byte length is too big");const u=e.subarray(r,r+i);if(u.length!==i)throw new t("tlv.decode: length bytes not complete");if(u[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const y of u)c=c<<8|y;if(r+=i,c<128)throw new t("tlv.decode(long): not minimal encoding")}const f=e.subarray(r,r+c);if(f.length!==c)throw new t("tlv.decode: wrong value length");return{v:f,l:e.subarray(r+c)}}},_int:{encode(n){const{Err:e}=$;if(n<W)throw new e("integer: negative integers are not allowed");let t=wt(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=$;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Ye(n)}},toSig(n){const{Err:e,_int:t,_tlv:r}=$,o=typeof n=="string"?Fe(n):n;yt(o);const{v:s,l:c}=r.decode(48,o);if(c.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:i}=r.decode(2,s),{v:u,l:y}=r.decode(2,i);if(y.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(f),s:t.decode(u)}},hexFromSig(n){const{_tlv:e,_int:t}=$,r=e.encode(2,t.encode(n.r)),o=e.encode(2,t.encode(n.s)),s=r+o;return e.encode(48,s)}},W=BigInt(0),k=BigInt(1);BigInt(2);const Dt=BigInt(3);BigInt(4);function Pe(n){const e=je(n),{Fp:t}=e,r=ie(e.n,e.nBitLength),o=e.toBytes||((b,a,g)=>{const x=a.toAffine();return bt(Uint8Array.from([4]),t.toBytes(x.x),t.toBytes(x.y))}),s=e.fromBytes||(b=>{const a=b.subarray(1),g=t.fromBytes(a.subarray(0,t.BYTES)),x=t.fromBytes(a.subarray(t.BYTES,2*t.BYTES));return{x:g,y:x}});function c(b){const{a,b:g}=e,x=t.sqr(b),E=t.mul(x,b);return t.add(t.add(E,t.mul(b,a)),g)}if(!t.eql(t.sqr(e.Gy),c(e.Gx)))throw new Error("bad generator point: equation left != right");function f(b){return Bt(b,k,e.n)}function i(b){const{allowedPrivateKeyLengths:a,nByteLength:g,wrapPrivateKey:x,n:E}=e;if(a&&typeof b!="bigint"){if(it(b)&&(b=ut(b)),typeof b!="string"||!a.includes(b.length))throw new Error("invalid private key");b=b.padStart(g*2,"0")}let q;try{q=typeof b=="bigint"?b:rt(K("private key",b,g))}catch{throw new Error("invalid private key, expected hex or "+g+" bytes, got "+typeof b)}return x&&(q=V(q,E)),ot("private key",q,k,E),q}function u(b){if(!(b instanceof l))throw new Error("ProjectivePoint expected")}const y=Ut((b,a)=>{const{px:g,py:x,pz:E}=b;if(t.eql(E,t.ONE))return{x:g,y:x};const q=b.is0();a==null&&(a=q?t.ONE:t.inv(E));const L=t.mul(g,a),I=t.mul(x,a),B=t.mul(E,a);if(q)return{x:t.ZERO,y:t.ZERO};if(!t.eql(B,t.ONE))throw new Error("invZ was invalid");return{x:L,y:I}}),h=Ut(b=>{if(b.is0()){if(e.allowInfinityPoint&&!t.is0(b.py))return;throw new Error("bad point: ZERO")}const{x:a,y:g}=b.toAffine();if(!t.isValid(a)||!t.isValid(g))throw new Error("bad point: x or y not FE");const x=t.sqr(g),E=c(a);if(!t.eql(x,E))throw new Error("bad point: equation left != right");if(!b.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class l{constructor(a,g,x){if(this.px=a,this.py=g,this.pz=x,a==null||!t.isValid(a))throw new Error("x required");if(g==null||!t.isValid(g))throw new Error("y required");if(x==null||!t.isValid(x))throw new Error("z required");Object.freeze(this)}static fromAffine(a){const{x:g,y:x}=a||{};if(!a||!t.isValid(g)||!t.isValid(x))throw new Error("invalid affine point");if(a instanceof l)throw new Error("projective point not allowed");const E=q=>t.eql(q,t.ZERO);return E(g)&&E(x)?l.ZERO:new l(g,x,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(a){const g=t.invertBatch(a.map(x=>x.pz));return a.map((x,E)=>x.toAffine(g[E])).map(l.fromAffine)}static fromHex(a){const g=l.fromAffine(s(K("pointHex",a)));return g.assertValidity(),g}static fromPrivateKey(a){return l.BASE.multiply(i(a))}static msm(a,g){return Ve(l,r,a,g)}_setWindowSize(a){N.setWindowSize(this,a)}assertValidity(){h(this)}hasEvenY(){const{y:a}=this.toAffine();if(t.isOdd)return!t.isOdd(a);throw new Error("Field doesn't support isOdd")}equals(a){u(a);const{px:g,py:x,pz:E}=this,{px:q,py:L,pz:I}=a,B=t.eql(t.mul(g,I),t.mul(q,E)),A=t.eql(t.mul(x,I),t.mul(L,E));return B&&A}negate(){return new l(this.px,t.neg(this.py),this.pz)}double(){const{a,b:g}=e,x=t.mul(g,Dt),{px:E,py:q,pz:L}=this;let I=t.ZERO,B=t.ZERO,A=t.ZERO,v=t.mul(E,E),C=t.mul(q,q),U=t.mul(L,L),H=t.mul(E,q);return H=t.add(H,H),A=t.mul(E,L),A=t.add(A,A),I=t.mul(a,A),B=t.mul(x,U),B=t.add(I,B),I=t.sub(C,B),B=t.add(C,B),B=t.mul(I,B),I=t.mul(H,I),A=t.mul(x,A),U=t.mul(a,U),H=t.sub(v,U),H=t.mul(a,H),H=t.add(H,A),A=t.add(v,v),v=t.add(A,v),v=t.add(v,U),v=t.mul(v,H),B=t.add(B,v),U=t.mul(q,L),U=t.add(U,U),v=t.mul(U,H),I=t.sub(I,v),A=t.mul(U,C),A=t.add(A,A),A=t.add(A,A),new l(I,B,A)}add(a){u(a);const{px:g,py:x,pz:E}=this,{px:q,py:L,pz:I}=a;let B=t.ZERO,A=t.ZERO,v=t.ZERO;const C=e.a,U=t.mul(e.b,Dt);let H=t.mul(g,q),j=t.mul(x,L),d=t.mul(E,I),w=t.add(g,x),p=t.add(q,L);w=t.mul(w,p),p=t.add(H,j),w=t.sub(w,p),p=t.add(g,E);let S=t.add(q,I);return p=t.mul(p,S),S=t.add(H,d),p=t.sub(p,S),S=t.add(x,E),B=t.add(L,I),S=t.mul(S,B),B=t.add(j,d),S=t.sub(S,B),v=t.mul(C,p),B=t.mul(U,d),v=t.add(B,v),B=t.sub(j,v),v=t.add(j,v),A=t.mul(B,v),j=t.add(H,H),j=t.add(j,H),d=t.mul(C,d),p=t.mul(U,p),j=t.add(j,d),d=t.sub(H,d),d=t.mul(C,d),p=t.add(p,d),H=t.mul(j,p),A=t.add(A,H),H=t.mul(S,p),B=t.mul(w,B),B=t.sub(B,H),H=t.mul(w,j),v=t.mul(S,v),v=t.add(v,H),new l(B,A,v)}subtract(a){return this.add(a.negate())}is0(){return this.equals(l.ZERO)}wNAF(a){return N.wNAFCached(this,a,l.normalizeZ)}multiplyUnsafe(a){const{endo:g,n:x}=e;ot("scalar",a,W,x);const E=l.ZERO;if(a===W)return E;if(this.is0()||a===k)return this;if(!g||N.hasPrecomputes(this))return N.wNAFCachedUnsafe(this,a,l.normalizeZ);let{k1neg:q,k1:L,k2neg:I,k2:B}=g.splitScalar(a),A=E,v=E,C=this;for(;L>W||B>W;)L&k&&(A=A.add(C)),B&k&&(v=v.add(C)),C=C.double(),L>>=k,B>>=k;return q&&(A=A.negate()),I&&(v=v.negate()),v=new l(t.mul(v.px,g.beta),v.py,v.pz),A.add(v)}multiply(a){const{endo:g,n:x}=e;ot("scalar",a,k,x);let E,q;if(g){const{k1neg:L,k1:I,k2neg:B,k2:A}=g.splitScalar(a);let{p:v,f:C}=this.wNAF(I),{p:U,f:H}=this.wNAF(A);v=N.constTimeNegate(L,v),U=N.constTimeNegate(B,U),U=new l(t.mul(U.px,g.beta),U.py,U.pz),E=v.add(U),q=C.add(H)}else{const{p:L,f:I}=this.wNAF(a);E=L,q=I}return l.normalizeZ([E,q])[0]}multiplyAndAddUnsafe(a,g,x){const E=l.BASE,q=(I,B)=>B===W||B===k||!I.equals(E)?I.multiplyUnsafe(B):I.multiply(B),L=q(this,g).add(q(a,x));return L.is0()?void 0:L}toAffine(a){return y(this,a)}isTorsionFree(){const{h:a,isTorsionFree:g}=e;if(a===k)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:a,clearCofactor:g}=e;return a===k?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(a=!0){return at("isCompressed",a),this.assertValidity(),o(l,this,a)}toHex(a=!0){return at("isCompressed",a),ut(this.toRawBytes(a))}}l.BASE=new l(e.Gx,e.Gy,t.ONE),l.ZERO=new l(t.ZERO,t.ONE,t.ZERO);const m=e.nBitLength,N=Me(l,e.endo?Math.ceil(m/2):m);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:i,weierstrassEquation:c,isWithinCurveOrder:f}}function Ge(n){const e=ue(n);return mt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function De(n){const e=Ge(n),{Fp:t,n:r}=e,o=t.BYTES+1,s=2*t.BYTES+1;function c(d){return V(d,r)}function f(d){return Tt(d,r)}const{ProjectivePoint:i,normPrivateKeyToScalar:u,weierstrassEquation:y,isWithinCurveOrder:h}=Pe({...e,toBytes(d,w,p){const S=w.toAffine(),O=t.toBytes(S.x),T=bt;return at("isCompressed",p),p?T(Uint8Array.from([w.hasEvenY()?2:3]),O):T(Uint8Array.from([4]),O,t.toBytes(S.y))},fromBytes(d){const w=d.length,p=d[0],S=d.subarray(1);if(w===o&&(p===2||p===3)){const O=rt(S);if(!Bt(O,k,t.ORDER))throw new Error("Point is not on curve");const T=y(O);let R;try{R=t.sqrt(T)}catch(F){const M=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+M)}const Z=(R&k)===k;return(p&1)===1!==Z&&(R=t.neg(R)),{x:O,y:R}}else if(w===s&&p===4){const O=t.fromBytes(S.subarray(0,t.BYTES)),T=t.fromBytes(S.subarray(t.BYTES,2*t.BYTES));return{x:O,y:T}}else{const O=o,T=s;throw new Error("invalid Point, expected length of "+O+", or uncompressed "+T+", got "+w)}}}),l=d=>ut(lt(d,e.nByteLength));function m(d){const w=r>>k;return d>w}function N(d){return m(d)?c(-d):d}const b=(d,w,p)=>rt(d.slice(w,p));class a{constructor(w,p,S){this.r=w,this.s=p,this.recovery=S,this.assertValidity()}static fromCompact(w){const p=e.nByteLength;return w=K("compactSignature",w,p*2),new a(b(w,0,p),b(w,p,2*p))}static fromDER(w){const{r:p,s:S}=$.toSig(K("DER",w));return new a(p,S)}assertValidity(){ot("r",this.r,k,r),ot("s",this.s,k,r)}addRecoveryBit(w){return new a(this.r,this.s,w)}recoverPublicKey(w){const{r:p,s:S,recovery:O}=this,T=I(K("msgHash",w));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const R=O===2||O===3?p+e.n:p;if(R>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=(O&1)===0?"02":"03",G=i.fromHex(Z+l(R)),F=f(R),M=c(-T*F),st=c(S*F),X=i.BASE.multiplyAndAddUnsafe(G,M,st);if(!X)throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new a(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return pt(this.toDERHex())}toDERHex(){return $.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return pt(this.toCompactHex())}toCompactHex(){return l(this.r)+l(this.s)}}const g={isValidPrivateKey(d){try{return u(d),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const d=ce(e.n);return Ce(e.randomBytes(d),e.n)},precompute(d=8,w=i.BASE){return w._setWindowSize(d),w.multiply(BigInt(3)),w}};function x(d,w=!0){return i.fromPrivateKey(d).toRawBytes(w)}function E(d){const w=it(d),p=typeof d=="string",S=(w||p)&&d.length;return w?S===o||S===s:p?S===2*o||S===2*s:d instanceof i}function q(d,w,p=!0){if(E(d))throw new Error("first arg must be private key");if(!E(w))throw new Error("second arg must be public key");return i.fromHex(w).multiply(u(d)).toRawBytes(p)}const L=e.bits2int||function(d){if(d.length>8192)throw new Error("input is too large");const w=rt(d),p=d.length*8-e.nBitLength;return p>0?w>>BigInt(p):w},I=e.bits2int_modN||function(d){return c(L(d))},B=Vt(e.nBitLength);function A(d){return ot("num < 2^"+e.nBitLength,d,W,B),lt(d,e.nByteLength)}function v(d,w,p=C){if(["recovered","canonical"].some(tt=>tt in p))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:O}=e;let{lowS:T,prehash:R,extraEntropy:Z}=p;T==null&&(T=!0),d=K("msgHash",d),Gt(p),R&&(d=K("prehashed msgHash",S(d)));const G=I(d),F=u(w),M=[A(F),A(G)];if(Z!=null&&Z!==!1){const tt=Z===!0?O(t.BYTES):Z;M.push(K("extraEntropy",tt))}const st=bt(...M),X=G;function vt(tt){const ct=L(tt);if(!h(ct))return;const St=f(ct),dt=i.BASE.multiply(ct).toAffine(),et=c(dt.x);if(et===W)return;const ht=c(St*c(X+et*F));if(ht===W)return;let gt=(dt.x===et?0:2)|Number(dt.y&k),ft=ht;return T&&m(ht)&&(ft=N(ht),gt^=1),new a(et,ft,gt)}return{seed:st,k2sig:vt}}const C={lowS:e.lowS,prehash:!1},U={lowS:e.lowS,prehash:!1};function H(d,w,p=C){const{seed:S,k2sig:O}=v(d,w,p),T=e;return re(T.hash.outputLen,T.nByteLength,T.hmac)(S,O)}i.BASE._setWindowSize(8);function j(d,w,p,S=U){var gt;const O=d;w=K("msgHash",w),p=K("publicKey",p);const{lowS:T,prehash:R,format:Z}=S;if(Gt(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(Z!==void 0&&Z!=="compact"&&Z!=="der")throw new Error("format must be compact or der");const G=typeof O=="string"||it(O),F=!G&&!Z&&typeof O=="object"&&O!==null&&typeof O.r=="bigint"&&typeof O.s=="bigint";if(!G&&!F)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let M,st;try{if(F&&(M=new a(O.r,O.s)),G){try{Z!=="compact"&&(M=a.fromDER(O))}catch(ft){if(!(ft instanceof $.Err))throw ft}!M&&Z!=="der"&&(M=a.fromCompact(O))}st=i.fromHex(p)}catch{return!1}if(!M||T&&M.hasHighS())return!1;R&&(w=e.hash(w));const{r:X,s:vt}=M,tt=I(w),ct=f(vt),St=c(tt*ct),dt=c(X*ct),et=(gt=i.BASE.multiplyAndAddUnsafe(st,St,dt))==null?void 0:gt.toAffine();return et?c(et.x)===X:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:q,sign:H,verify:j,ProjectivePoint:i,Signature:a,utils:g}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $e(n){return{hash:n,hmac:(e,...t)=>te(n,e,be(...t)),randomBytes:pe}}function We(n,e){const t=r=>De({...n,...$e(r)});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const le=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),$t=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Xe=BigInt(1),kt=BigInt(2),Wt=(n,e)=>(n+e/kt)/e;function Qe(n){const e=le,t=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),f=BigInt(44),i=BigInt(88),u=n*n*n%e,y=u*u*n%e,h=Y(y,t,e)*y%e,l=Y(h,t,e)*y%e,m=Y(l,kt,e)*u%e,N=Y(m,o,e)*m%e,b=Y(N,s,e)*N%e,a=Y(b,f,e)*b%e,g=Y(a,i,e)*a%e,x=Y(g,f,e)*b%e,E=Y(x,t,e)*y%e,q=Y(E,c,e)*N%e,L=Y(q,r,e)*u%e,I=Y(L,kt,e);if(!zt.eql(zt.sqr(I),n))throw new Error("Cannot find square root");return I}const zt=ie(le,void 0,void 0,{sqrt:Qe}),Je=We({a:BigInt(0),b:BigInt(7),Fp:zt,n:$t,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=$t,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Xe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,c=BigInt("0x100000000000000000000000000000000"),f=Wt(s*n,e),i=Wt(-r*n,e);let u=V(n-f*t-i*o,e),y=V(-f*r-i*s,e);const h=u>c,l=y>c;if(h&&(u=e-u),l&&(y=e-y),u>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:u,k2neg:l,k2:y}}}},Se);BigInt(0);Je.ProjectivePoint;export{Je as secp256k1};
1
+ import{H as Xt,c as At,a as Et,t as Qt,b as de,w as he,r as P,d as ge,e as we,f as pe,g as be}from"./index.es-CA2ape1X.js";import"./index-BG30WuBG.js";import"./events-DQ172AOg.js";function ye(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const o=BigInt(32),s=BigInt(4294967295),c=Number(t>>o&s),f=Number(t&s),i=r?4:0,u=r?0:4;n.setUint32(e+i,c,r),n.setUint32(e+u,f,r)}function me(n,e,t){return n&e^~n&t}function xe(n,e,t){return n&e^n&t^e&t}class Ee extends Xt{constructor(e,t,r,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=At(this.buffer)}update(e){Et(this);const{view:t,buffer:r,blockLen:o}=this;e=Qt(e);const s=e.length;for(let c=0;c<s;){const f=Math.min(o-this.pos,s-c);if(f===o){const i=At(e);for(;o<=s-c;c+=o)this.process(i,c);continue}r.set(e.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Et(this),de(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:s}=this;let{pos:c}=this;t[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(r,0),c=0);for(let h=c;h<o;h++)t[h]=0;ye(r,o-8,BigInt(this.length*8),s),this.process(r,0);const f=At(e),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=i/4,y=this.get();if(u>y.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)f.setUint32(4*h,y[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:o,finished:s,destroyed:c,pos:f}=this;return e.length=o,e.pos=f,e.finished=s,e.destroyed=c,o%t&&e.buffer.set(r),e}}const Be=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]),Q=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),J=new Uint32Array(64);class ve extends Ee{constructor(){super(64,32,8,!1),this.A=Q[0]|0,this.B=Q[1]|0,this.C=Q[2]|0,this.D=Q[3]|0,this.E=Q[4]|0,this.F=Q[5]|0,this.G=Q[6]|0,this.H=Q[7]|0}get(){const{A:e,B:t,C:r,D:o,E:s,F:c,G:f,H:i}=this;return[e,t,r,o,s,c,f,i]}set(e,t,r,o,s,c,f,i){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=f|0,this.H=i|0}process(e,t){for(let h=0;h<16;h++,t+=4)J[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const l=J[h-15],m=J[h-2],N=P(l,7)^P(l,18)^l>>>3,b=P(m,17)^P(m,19)^m>>>10;J[h]=b+J[h-7]+N+J[h-16]|0}let{A:r,B:o,C:s,D:c,E:f,F:i,G:u,H:y}=this;for(let h=0;h<64;h++){const l=P(f,6)^P(f,11)^P(f,25),m=y+l+me(f,i,u)+Be[h]+J[h]|0,b=(P(r,2)^P(r,13)^P(r,22))+xe(r,o,s)|0;y=u,u=i,i=f,f=c+m|0,c=s,s=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,i=i+this.F|0,u=u+this.G|0,y=y+this.H|0,this.set(r,o,s,c,f,i,u,y)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Se=he(()=>new ve);class Jt extends Xt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ge(e);const r=Qt(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")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,s=new Uint8Array(o);s.set(r.length>o?e.create().update(r).digest():r);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=e.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),s.fill(0)}update(e){return Et(this),this.iHash.update(e),this}digestInto(e){Et(this),we(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:r,finished:o,destroyed:s,blockLen:c,outputLen:f}=this;return e=e,e.finished=o,e.destroyed=s,e.blockLen=c,e.outputLen=f,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const te=(n,e,t)=>new Jt(n,e).update(t).digest();te.create=(n,e)=>new Jt(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ct=BigInt(0),ee=BigInt(1),Ae=BigInt(2);function it(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function yt(n){if(!it(n))throw new Error("Uint8Array expected")}function at(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}const Ie=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function ut(n){yt(n);let e="";for(let t=0;t<n.length;t++)e+=Ie[n[t]];return e}function wt(n){const e=n.toString(16);return e.length&1?"0"+e:e}function Zt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ct:BigInt("0x"+n)}const D={_0:48,_9:57,A:65,F:70,a:97,f:102};function jt(n){if(n>=D._0&&n<=D._9)return n-D._0;if(n>=D.A&&n<=D.F)return n-(D.A-10);if(n>=D.a&&n<=D.f)return n-(D.a-10)}function pt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let o=0,s=0;o<t;o++,s+=2){const c=jt(n.charCodeAt(s)),f=jt(n.charCodeAt(s+1));if(c===void 0||f===void 0){const i=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+i+'" at index '+s)}r[o]=c*16+f}return r}function rt(n){return Zt(ut(n))}function Rt(n){return yt(n),Zt(ut(Uint8Array.from(n).reverse()))}function lt(n,e){return pt(n.toString(16).padStart(e*2,"0"))}function Mt(n,e){return lt(n,e).reverse()}function K(n,e,t){let r;if(typeof e=="string")try{r=pt(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(it(e))r=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const o=r.length;if(typeof t=="number"&&o!==t)throw new Error(n+" of length "+t+" expected, got "+o);return r}function bt(...n){let e=0;for(let r=0;r<n.length;r++){const o=n[r];yt(o),e+=o.length}const t=new Uint8Array(e);for(let r=0,o=0;r<n.length;r++){const s=n[r];t.set(s,o),o+=s.length}return t}const It=n=>typeof n=="bigint"&&Ct<=n;function Bt(n,e,t){return It(n)&&It(e)&&It(t)&&e<=n&&n<t}function ot(n,e,t,r){if(!Bt(e,t,r))throw new Error("expected valid "+n+": "+t+" <= n < "+r+", got "+e)}function ne(n){let e;for(e=0;n>Ct;n>>=ee,e+=1);return e}const Vt=n=>(Ae<<BigInt(n-1))-ee,Nt=n=>new Uint8Array(n),Yt=n=>Uint8Array.from(n);function re(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=Nt(n),o=Nt(n),s=0;const c=()=>{r.fill(1),o.fill(0),s=0},f=(...h)=>t(o,r,...h),i=(h=Nt())=>{o=f(Yt([0]),h),r=f(),h.length!==0&&(o=f(Yt([1]),h),r=f())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const l=[];for(;h<e;){r=f();const m=r.slice();l.push(m),h+=r.length}return bt(...l)};return(h,l)=>{c(),i(h);let m;for(;!(m=l(u()));)i();return c(),m}}const Ne={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||it(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function mt(n,e,t={}){const r=(o,s,c)=>{const f=Ne[s];if(typeof f!="function")throw new Error("invalid validator function");const i=n[o];if(!(c&&i===void 0)&&!f(i,n))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+i)};for(const[o,s]of Object.entries(e))r(o,s,!1);for(const[o,s]of Object.entries(t))r(o,s,!0);return n}function Ut(n){const e=new WeakMap;return(t,...r)=>{const o=e.get(t);if(o!==void 0)return o;const s=n(t,...r);return e.set(t,s),s}}const qe=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ot,abool:at,abytes:yt,bitLen:ne,bitMask:Vt,bytesToHex:ut,bytesToNumberBE:rt,bytesToNumberLE:Rt,concatBytes:bt,createHmacDrbg:re,ensureBytes:K,hexToBytes:pt,hexToNumber:Zt,inRange:Bt,isBytes:it,memoized:Ut,numberToBytesBE:lt,numberToBytesLE:Mt,numberToHexUnpadded:wt,validateObject:mt},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z=BigInt(0),_=BigInt(1),nt=BigInt(2),Oe=BigInt(3),_t=BigInt(4),Ft=BigInt(5),Kt=BigInt(8);function V(n,e){const t=n%e;return t>=z?t:e+t}function Le(n,e,t){if(e<z)throw new Error("invalid exponent, negatives unsupported");if(t<=z)throw new Error("invalid modulus");if(t===_)return z;let r=_;for(;e>z;)e&_&&(r=r*n%t),n=n*n%t,e>>=_;return r}function Y(n,e,t){let r=n;for(;e-- >z;)r*=r,r%=t;return r}function Tt(n,e){if(n===z)throw new Error("invert: expected non-zero number");if(e<=z)throw new Error("invert: expected positive modulus, got "+e);let t=V(n,e),r=e,o=z,s=_;for(;t!==z;){const f=r/t,i=r%t,u=o-s*f;r=t,t=i,o=s,s=u}if(r!==_)throw new Error("invert: does not exist");return V(o,e)}function He(n){const e=(n-_)/nt;let t,r,o;for(t=n-_,r=0;t%nt===z;t/=nt,r++);for(o=nt;o<n&&Le(o,e,n)!==n-_;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const c=(n+_)/_t;return function(i,u){const y=i.pow(u,c);if(!i.eql(i.sqr(y),u))throw new Error("Cannot find square root");return y}}const s=(t+_)/nt;return function(f,i){if(f.pow(i,e)===f.neg(f.ONE))throw new Error("Cannot find square root");let u=r,y=f.pow(f.mul(f.ONE,o),t),h=f.pow(i,s),l=f.pow(i,t);for(;!f.eql(l,f.ONE);){if(f.eql(l,f.ZERO))return f.ZERO;let m=1;for(let b=f.sqr(l);m<u&&!f.eql(b,f.ONE);m++)b=f.sqr(b);const N=f.pow(y,_<<BigInt(u-m-1));y=f.sqr(N),h=f.mul(h,N),l=f.mul(l,y),u=m}return h}}function Ue(n){if(n%_t===Oe){const e=(n+_)/_t;return function(r,o){const s=r.pow(o,e);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%Kt===Ft){const e=(n-Ft)/Kt;return function(r,o){const s=r.mul(o,nt),c=r.pow(s,e),f=r.mul(o,c),i=r.mul(r.mul(f,nt),c),u=r.mul(f,r.sub(i,r.ONE));if(!r.eql(r.sqr(u),o))throw new Error("Cannot find square root");return u}}return He(n)}const _e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Te(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=_e.reduce((r,o)=>(r[o]="function",r),e);return mt(n,t)}function ke(n,e,t){if(t<z)throw new Error("invalid exponent, negatives unsupported");if(t===z)return n.ONE;if(t===_)return e;let r=n.ONE,o=e;for(;t>z;)t&_&&(r=n.mul(r,o)),o=n.sqr(o),t>>=_;return r}function ze(n,e){const t=new Array(e.length),r=e.reduce((s,c,f)=>n.is0(c)?s:(t[f]=s,n.mul(s,c)),n.ONE),o=n.inv(r);return e.reduceRight((s,c,f)=>n.is0(c)?s:(t[f]=n.mul(s,t[f]),n.mul(s,c)),o),t}function oe(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function ie(n,e,t=!1,r={}){if(n<=z)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:o,nByteLength:s}=oe(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c;const f=Object.freeze({ORDER:n,isLE:t,BITS:o,BYTES:s,MASK:Vt(o),ZERO:z,ONE:_,create:i=>V(i,n),isValid:i=>{if(typeof i!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof i);return z<=i&&i<n},is0:i=>i===z,isOdd:i=>(i&_)===_,neg:i=>V(-i,n),eql:(i,u)=>i===u,sqr:i=>V(i*i,n),add:(i,u)=>V(i+u,n),sub:(i,u)=>V(i-u,n),mul:(i,u)=>V(i*u,n),pow:(i,u)=>ke(f,i,u),div:(i,u)=>V(i*Tt(u,n),n),sqrN:i=>i*i,addN:(i,u)=>i+u,subN:(i,u)=>i-u,mulN:(i,u)=>i*u,inv:i=>Tt(i,n),sqrt:r.sqrt||(i=>(c||(c=Ue(n)),c(f,i))),invertBatch:i=>ze(f,i),cmov:(i,u,y)=>y?u:i,toBytes:i=>t?Mt(i,s):lt(i,s),fromBytes:i=>{if(i.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+i.length);return t?Rt(i):rt(i)}});return Object.freeze(f)}function se(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function ce(n){const e=se(n);return e+Math.ceil(e/2)}function Ce(n,e,t=!1){const r=n.length,o=se(e),s=ce(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=t?Rt(n):rt(n),f=V(c,e-_)+_;return t?Mt(f,o):lt(f,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pt=BigInt(0),xt=BigInt(1);function qt(n,e){const t=e.negate();return n?t:e}function fe(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function Ot(n,e){fe(n,e);const t=Math.ceil(e/n)+1,r=2**(n-1);return{windows:t,windowSize:r}}function Ze(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)})}function Re(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)})}const Lt=new WeakMap,ae=new WeakMap;function Ht(n){return ae.get(n)||1}function Me(n,e){return{constTimeNegate:qt,hasPrecomputes(t){return Ht(t)!==1},unsafeLadder(t,r,o=n.ZERO){let s=t;for(;r>Pt;)r&xt&&(o=o.add(s)),s=s.double(),r>>=xt;return o},precomputeWindow(t,r){const{windows:o,windowSize:s}=Ot(r,e),c=[];let f=t,i=f;for(let u=0;u<o;u++){i=f,c.push(i);for(let y=1;y<s;y++)i=i.add(f),c.push(i);f=i.double()}return c},wNAF(t,r,o){const{windows:s,windowSize:c}=Ot(t,e);let f=n.ZERO,i=n.BASE;const u=BigInt(2**t-1),y=2**t,h=BigInt(t);for(let l=0;l<s;l++){const m=l*c;let N=Number(o&u);o>>=h,N>c&&(N-=y,o+=xt);const b=m,a=m+Math.abs(N)-1,g=l%2!==0,x=N<0;N===0?i=i.add(qt(g,r[b])):f=f.add(qt(x,r[a]))}return{p:f,f:i}},wNAFUnsafe(t,r,o,s=n.ZERO){const{windows:c,windowSize:f}=Ot(t,e),i=BigInt(2**t-1),u=2**t,y=BigInt(t);for(let h=0;h<c;h++){const l=h*f;if(o===Pt)break;let m=Number(o&i);if(o>>=y,m>f&&(m-=u,o+=xt),m===0)continue;let N=r[l+Math.abs(m)-1];m<0&&(N=N.negate()),s=s.add(N)}return s},getPrecomputes(t,r,o){let s=Lt.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&Lt.set(r,o(s))),s},wNAFCached(t,r,o){const s=Ht(t);return this.wNAF(s,this.getPrecomputes(s,t,o),r)},wNAFCachedUnsafe(t,r,o,s){const c=Ht(t);return c===1?this.unsafeLadder(t,r,s):this.wNAFUnsafe(c,this.getPrecomputes(c,t,o),r,s)},setWindowSize(t,r){fe(r,e),ae.set(t,r),Lt.delete(t)}}}function Ve(n,e,t,r){if(Ze(t,n),Re(r,e),t.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,s=ne(BigInt(t.length)),c=s>12?s-3:s>4?s-2:s?2:1,f=(1<<c)-1,i=new Array(f+1).fill(o),u=Math.floor((e.BITS-1)/c)*c;let y=o;for(let h=u;h>=0;h-=c){i.fill(o);for(let m=0;m<r.length;m++){const N=r[m],b=Number(N>>BigInt(h)&BigInt(f));i[b]=i[b].add(t[m])}let l=o;for(let m=i.length-1,N=o;m>0;m--)N=N.add(i[m]),l=l.add(N);if(y=y.add(l),h!==0)for(let m=0;m<c;m++)y=y.double()}return y}function ue(n){return Te(n.Fp),mt(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...oe(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Gt(n){n.lowS!==void 0&&at("lowS",n.lowS),n.prehash!==void 0&&at("prehash",n.prehash)}function je(n){const e=ue(n);mt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:o}=e;if(t){if(!r.eql(o,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Ye,hexToBytes:Fe}=qe;class Ke extends Error{constructor(e=""){super(e)}}const $={Err:Ke,_tlv:{encode:(n,e)=>{const{Err:t}=$;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,o=wt(r);if(o.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?wt(o.length/2|128):"";return wt(n)+s+o+e},decode(n,e){const{Err:t}=$;let r=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==n)throw new t("tlv.decode: wrong tlv");const o=e[r++],s=!!(o&128);let c=0;if(!s)c=o;else{const i=o&127;if(!i)throw new t("tlv.decode(long): indefinite length not supported");if(i>4)throw new t("tlv.decode(long): byte length is too big");const u=e.subarray(r,r+i);if(u.length!==i)throw new t("tlv.decode: length bytes not complete");if(u[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const y of u)c=c<<8|y;if(r+=i,c<128)throw new t("tlv.decode(long): not minimal encoding")}const f=e.subarray(r,r+c);if(f.length!==c)throw new t("tlv.decode: wrong value length");return{v:f,l:e.subarray(r+c)}}},_int:{encode(n){const{Err:e}=$;if(n<W)throw new e("integer: negative integers are not allowed");let t=wt(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=$;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Ye(n)}},toSig(n){const{Err:e,_int:t,_tlv:r}=$,o=typeof n=="string"?Fe(n):n;yt(o);const{v:s,l:c}=r.decode(48,o);if(c.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:i}=r.decode(2,s),{v:u,l:y}=r.decode(2,i);if(y.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(f),s:t.decode(u)}},hexFromSig(n){const{_tlv:e,_int:t}=$,r=e.encode(2,t.encode(n.r)),o=e.encode(2,t.encode(n.s)),s=r+o;return e.encode(48,s)}},W=BigInt(0),k=BigInt(1);BigInt(2);const Dt=BigInt(3);BigInt(4);function Pe(n){const e=je(n),{Fp:t}=e,r=ie(e.n,e.nBitLength),o=e.toBytes||((b,a,g)=>{const x=a.toAffine();return bt(Uint8Array.from([4]),t.toBytes(x.x),t.toBytes(x.y))}),s=e.fromBytes||(b=>{const a=b.subarray(1),g=t.fromBytes(a.subarray(0,t.BYTES)),x=t.fromBytes(a.subarray(t.BYTES,2*t.BYTES));return{x:g,y:x}});function c(b){const{a,b:g}=e,x=t.sqr(b),E=t.mul(x,b);return t.add(t.add(E,t.mul(b,a)),g)}if(!t.eql(t.sqr(e.Gy),c(e.Gx)))throw new Error("bad generator point: equation left != right");function f(b){return Bt(b,k,e.n)}function i(b){const{allowedPrivateKeyLengths:a,nByteLength:g,wrapPrivateKey:x,n:E}=e;if(a&&typeof b!="bigint"){if(it(b)&&(b=ut(b)),typeof b!="string"||!a.includes(b.length))throw new Error("invalid private key");b=b.padStart(g*2,"0")}let q;try{q=typeof b=="bigint"?b:rt(K("private key",b,g))}catch{throw new Error("invalid private key, expected hex or "+g+" bytes, got "+typeof b)}return x&&(q=V(q,E)),ot("private key",q,k,E),q}function u(b){if(!(b instanceof l))throw new Error("ProjectivePoint expected")}const y=Ut((b,a)=>{const{px:g,py:x,pz:E}=b;if(t.eql(E,t.ONE))return{x:g,y:x};const q=b.is0();a==null&&(a=q?t.ONE:t.inv(E));const L=t.mul(g,a),I=t.mul(x,a),B=t.mul(E,a);if(q)return{x:t.ZERO,y:t.ZERO};if(!t.eql(B,t.ONE))throw new Error("invZ was invalid");return{x:L,y:I}}),h=Ut(b=>{if(b.is0()){if(e.allowInfinityPoint&&!t.is0(b.py))return;throw new Error("bad point: ZERO")}const{x:a,y:g}=b.toAffine();if(!t.isValid(a)||!t.isValid(g))throw new Error("bad point: x or y not FE");const x=t.sqr(g),E=c(a);if(!t.eql(x,E))throw new Error("bad point: equation left != right");if(!b.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class l{constructor(a,g,x){if(this.px=a,this.py=g,this.pz=x,a==null||!t.isValid(a))throw new Error("x required");if(g==null||!t.isValid(g))throw new Error("y required");if(x==null||!t.isValid(x))throw new Error("z required");Object.freeze(this)}static fromAffine(a){const{x:g,y:x}=a||{};if(!a||!t.isValid(g)||!t.isValid(x))throw new Error("invalid affine point");if(a instanceof l)throw new Error("projective point not allowed");const E=q=>t.eql(q,t.ZERO);return E(g)&&E(x)?l.ZERO:new l(g,x,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(a){const g=t.invertBatch(a.map(x=>x.pz));return a.map((x,E)=>x.toAffine(g[E])).map(l.fromAffine)}static fromHex(a){const g=l.fromAffine(s(K("pointHex",a)));return g.assertValidity(),g}static fromPrivateKey(a){return l.BASE.multiply(i(a))}static msm(a,g){return Ve(l,r,a,g)}_setWindowSize(a){N.setWindowSize(this,a)}assertValidity(){h(this)}hasEvenY(){const{y:a}=this.toAffine();if(t.isOdd)return!t.isOdd(a);throw new Error("Field doesn't support isOdd")}equals(a){u(a);const{px:g,py:x,pz:E}=this,{px:q,py:L,pz:I}=a,B=t.eql(t.mul(g,I),t.mul(q,E)),A=t.eql(t.mul(x,I),t.mul(L,E));return B&&A}negate(){return new l(this.px,t.neg(this.py),this.pz)}double(){const{a,b:g}=e,x=t.mul(g,Dt),{px:E,py:q,pz:L}=this;let I=t.ZERO,B=t.ZERO,A=t.ZERO,v=t.mul(E,E),C=t.mul(q,q),U=t.mul(L,L),H=t.mul(E,q);return H=t.add(H,H),A=t.mul(E,L),A=t.add(A,A),I=t.mul(a,A),B=t.mul(x,U),B=t.add(I,B),I=t.sub(C,B),B=t.add(C,B),B=t.mul(I,B),I=t.mul(H,I),A=t.mul(x,A),U=t.mul(a,U),H=t.sub(v,U),H=t.mul(a,H),H=t.add(H,A),A=t.add(v,v),v=t.add(A,v),v=t.add(v,U),v=t.mul(v,H),B=t.add(B,v),U=t.mul(q,L),U=t.add(U,U),v=t.mul(U,H),I=t.sub(I,v),A=t.mul(U,C),A=t.add(A,A),A=t.add(A,A),new l(I,B,A)}add(a){u(a);const{px:g,py:x,pz:E}=this,{px:q,py:L,pz:I}=a;let B=t.ZERO,A=t.ZERO,v=t.ZERO;const C=e.a,U=t.mul(e.b,Dt);let H=t.mul(g,q),j=t.mul(x,L),d=t.mul(E,I),w=t.add(g,x),p=t.add(q,L);w=t.mul(w,p),p=t.add(H,j),w=t.sub(w,p),p=t.add(g,E);let S=t.add(q,I);return p=t.mul(p,S),S=t.add(H,d),p=t.sub(p,S),S=t.add(x,E),B=t.add(L,I),S=t.mul(S,B),B=t.add(j,d),S=t.sub(S,B),v=t.mul(C,p),B=t.mul(U,d),v=t.add(B,v),B=t.sub(j,v),v=t.add(j,v),A=t.mul(B,v),j=t.add(H,H),j=t.add(j,H),d=t.mul(C,d),p=t.mul(U,p),j=t.add(j,d),d=t.sub(H,d),d=t.mul(C,d),p=t.add(p,d),H=t.mul(j,p),A=t.add(A,H),H=t.mul(S,p),B=t.mul(w,B),B=t.sub(B,H),H=t.mul(w,j),v=t.mul(S,v),v=t.add(v,H),new l(B,A,v)}subtract(a){return this.add(a.negate())}is0(){return this.equals(l.ZERO)}wNAF(a){return N.wNAFCached(this,a,l.normalizeZ)}multiplyUnsafe(a){const{endo:g,n:x}=e;ot("scalar",a,W,x);const E=l.ZERO;if(a===W)return E;if(this.is0()||a===k)return this;if(!g||N.hasPrecomputes(this))return N.wNAFCachedUnsafe(this,a,l.normalizeZ);let{k1neg:q,k1:L,k2neg:I,k2:B}=g.splitScalar(a),A=E,v=E,C=this;for(;L>W||B>W;)L&k&&(A=A.add(C)),B&k&&(v=v.add(C)),C=C.double(),L>>=k,B>>=k;return q&&(A=A.negate()),I&&(v=v.negate()),v=new l(t.mul(v.px,g.beta),v.py,v.pz),A.add(v)}multiply(a){const{endo:g,n:x}=e;ot("scalar",a,k,x);let E,q;if(g){const{k1neg:L,k1:I,k2neg:B,k2:A}=g.splitScalar(a);let{p:v,f:C}=this.wNAF(I),{p:U,f:H}=this.wNAF(A);v=N.constTimeNegate(L,v),U=N.constTimeNegate(B,U),U=new l(t.mul(U.px,g.beta),U.py,U.pz),E=v.add(U),q=C.add(H)}else{const{p:L,f:I}=this.wNAF(a);E=L,q=I}return l.normalizeZ([E,q])[0]}multiplyAndAddUnsafe(a,g,x){const E=l.BASE,q=(I,B)=>B===W||B===k||!I.equals(E)?I.multiplyUnsafe(B):I.multiply(B),L=q(this,g).add(q(a,x));return L.is0()?void 0:L}toAffine(a){return y(this,a)}isTorsionFree(){const{h:a,isTorsionFree:g}=e;if(a===k)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:a,clearCofactor:g}=e;return a===k?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(a=!0){return at("isCompressed",a),this.assertValidity(),o(l,this,a)}toHex(a=!0){return at("isCompressed",a),ut(this.toRawBytes(a))}}l.BASE=new l(e.Gx,e.Gy,t.ONE),l.ZERO=new l(t.ZERO,t.ONE,t.ZERO);const m=e.nBitLength,N=Me(l,e.endo?Math.ceil(m/2):m);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:i,weierstrassEquation:c,isWithinCurveOrder:f}}function Ge(n){const e=ue(n);return mt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function De(n){const e=Ge(n),{Fp:t,n:r}=e,o=t.BYTES+1,s=2*t.BYTES+1;function c(d){return V(d,r)}function f(d){return Tt(d,r)}const{ProjectivePoint:i,normPrivateKeyToScalar:u,weierstrassEquation:y,isWithinCurveOrder:h}=Pe({...e,toBytes(d,w,p){const S=w.toAffine(),O=t.toBytes(S.x),T=bt;return at("isCompressed",p),p?T(Uint8Array.from([w.hasEvenY()?2:3]),O):T(Uint8Array.from([4]),O,t.toBytes(S.y))},fromBytes(d){const w=d.length,p=d[0],S=d.subarray(1);if(w===o&&(p===2||p===3)){const O=rt(S);if(!Bt(O,k,t.ORDER))throw new Error("Point is not on curve");const T=y(O);let R;try{R=t.sqrt(T)}catch(F){const M=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+M)}const Z=(R&k)===k;return(p&1)===1!==Z&&(R=t.neg(R)),{x:O,y:R}}else if(w===s&&p===4){const O=t.fromBytes(S.subarray(0,t.BYTES)),T=t.fromBytes(S.subarray(t.BYTES,2*t.BYTES));return{x:O,y:T}}else{const O=o,T=s;throw new Error("invalid Point, expected length of "+O+", or uncompressed "+T+", got "+w)}}}),l=d=>ut(lt(d,e.nByteLength));function m(d){const w=r>>k;return d>w}function N(d){return m(d)?c(-d):d}const b=(d,w,p)=>rt(d.slice(w,p));class a{constructor(w,p,S){this.r=w,this.s=p,this.recovery=S,this.assertValidity()}static fromCompact(w){const p=e.nByteLength;return w=K("compactSignature",w,p*2),new a(b(w,0,p),b(w,p,2*p))}static fromDER(w){const{r:p,s:S}=$.toSig(K("DER",w));return new a(p,S)}assertValidity(){ot("r",this.r,k,r),ot("s",this.s,k,r)}addRecoveryBit(w){return new a(this.r,this.s,w)}recoverPublicKey(w){const{r:p,s:S,recovery:O}=this,T=I(K("msgHash",w));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const R=O===2||O===3?p+e.n:p;if(R>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=(O&1)===0?"02":"03",G=i.fromHex(Z+l(R)),F=f(R),M=c(-T*F),st=c(S*F),X=i.BASE.multiplyAndAddUnsafe(G,M,st);if(!X)throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new a(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return pt(this.toDERHex())}toDERHex(){return $.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return pt(this.toCompactHex())}toCompactHex(){return l(this.r)+l(this.s)}}const g={isValidPrivateKey(d){try{return u(d),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const d=ce(e.n);return Ce(e.randomBytes(d),e.n)},precompute(d=8,w=i.BASE){return w._setWindowSize(d),w.multiply(BigInt(3)),w}};function x(d,w=!0){return i.fromPrivateKey(d).toRawBytes(w)}function E(d){const w=it(d),p=typeof d=="string",S=(w||p)&&d.length;return w?S===o||S===s:p?S===2*o||S===2*s:d instanceof i}function q(d,w,p=!0){if(E(d))throw new Error("first arg must be private key");if(!E(w))throw new Error("second arg must be public key");return i.fromHex(w).multiply(u(d)).toRawBytes(p)}const L=e.bits2int||function(d){if(d.length>8192)throw new Error("input is too large");const w=rt(d),p=d.length*8-e.nBitLength;return p>0?w>>BigInt(p):w},I=e.bits2int_modN||function(d){return c(L(d))},B=Vt(e.nBitLength);function A(d){return ot("num < 2^"+e.nBitLength,d,W,B),lt(d,e.nByteLength)}function v(d,w,p=C){if(["recovered","canonical"].some(tt=>tt in p))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:O}=e;let{lowS:T,prehash:R,extraEntropy:Z}=p;T==null&&(T=!0),d=K("msgHash",d),Gt(p),R&&(d=K("prehashed msgHash",S(d)));const G=I(d),F=u(w),M=[A(F),A(G)];if(Z!=null&&Z!==!1){const tt=Z===!0?O(t.BYTES):Z;M.push(K("extraEntropy",tt))}const st=bt(...M),X=G;function vt(tt){const ct=L(tt);if(!h(ct))return;const St=f(ct),dt=i.BASE.multiply(ct).toAffine(),et=c(dt.x);if(et===W)return;const ht=c(St*c(X+et*F));if(ht===W)return;let gt=(dt.x===et?0:2)|Number(dt.y&k),ft=ht;return T&&m(ht)&&(ft=N(ht),gt^=1),new a(et,ft,gt)}return{seed:st,k2sig:vt}}const C={lowS:e.lowS,prehash:!1},U={lowS:e.lowS,prehash:!1};function H(d,w,p=C){const{seed:S,k2sig:O}=v(d,w,p),T=e;return re(T.hash.outputLen,T.nByteLength,T.hmac)(S,O)}i.BASE._setWindowSize(8);function j(d,w,p,S=U){var gt;const O=d;w=K("msgHash",w),p=K("publicKey",p);const{lowS:T,prehash:R,format:Z}=S;if(Gt(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(Z!==void 0&&Z!=="compact"&&Z!=="der")throw new Error("format must be compact or der");const G=typeof O=="string"||it(O),F=!G&&!Z&&typeof O=="object"&&O!==null&&typeof O.r=="bigint"&&typeof O.s=="bigint";if(!G&&!F)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let M,st;try{if(F&&(M=new a(O.r,O.s)),G){try{Z!=="compact"&&(M=a.fromDER(O))}catch(ft){if(!(ft instanceof $.Err))throw ft}!M&&Z!=="der"&&(M=a.fromCompact(O))}st=i.fromHex(p)}catch{return!1}if(!M||T&&M.hasHighS())return!1;R&&(w=e.hash(w));const{r:X,s:vt}=M,tt=I(w),ct=f(vt),St=c(tt*ct),dt=c(X*ct),et=(gt=i.BASE.multiplyAndAddUnsafe(st,St,dt))==null?void 0:gt.toAffine();return et?c(et.x)===X:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:q,sign:H,verify:j,ProjectivePoint:i,Signature:a,utils:g}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $e(n){return{hash:n,hmac:(e,...t)=>te(n,e,be(...t)),randomBytes:pe}}function We(n,e){const t=r=>De({...n,...$e(r)});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const le=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),$t=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Xe=BigInt(1),kt=BigInt(2),Wt=(n,e)=>(n+e/kt)/e;function Qe(n){const e=le,t=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),f=BigInt(44),i=BigInt(88),u=n*n*n%e,y=u*u*n%e,h=Y(y,t,e)*y%e,l=Y(h,t,e)*y%e,m=Y(l,kt,e)*u%e,N=Y(m,o,e)*m%e,b=Y(N,s,e)*N%e,a=Y(b,f,e)*b%e,g=Y(a,i,e)*a%e,x=Y(g,f,e)*b%e,E=Y(x,t,e)*y%e,q=Y(E,c,e)*N%e,L=Y(q,r,e)*u%e,I=Y(L,kt,e);if(!zt.eql(zt.sqr(I),n))throw new Error("Cannot find square root");return I}const zt=ie(le,void 0,void 0,{sqrt:Qe}),Je=We({a:BigInt(0),b:BigInt(7),Fp:zt,n:$t,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=$t,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Xe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,c=BigInt("0x100000000000000000000000000000000"),f=Wt(s*n,e),i=Wt(-r*n,e);let u=V(n-f*t-i*o,e),y=V(-f*r-i*s,e);const h=u>c,l=y>c;if(h&&(u=e-u),l&&(y=e-y),u>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:u,k2neg:l,k2:y}}}},Se);BigInt(0);Je.ProjectivePoint;export{Je as secp256k1};
@@ -1,4 +1,4 @@
1
- import{w as C}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const n=C`<svg fill="none" viewBox="0 0 21 20">
1
+ import{w as C}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const n=C`<svg fill="none" viewBox="0 0 21 20">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as o}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const m=o`<svg fill="none" viewBox="0 0 20 20">
1
+ import{w as o}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const m=o`<svg fill="none" viewBox="0 0 20 20">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as o}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const L=o`<svg width="10" height="10" viewBox="0 0 10 10">
1
+ import{w as o}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const L=o`<svg width="10" height="10" viewBox="0 0 10 10">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as o}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const L=o`<svg
1
+ import{w as o}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const L=o`<svg
2
2
  width="14"
3
3
  height="14"
4
4
  viewBox="0 0 14 14"
@@ -1,4 +1,4 @@
1
- import{w as o}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const p=o`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
1
+ import{w as o}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const p=o`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as l}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const m=l`<svg fill="none" viewBox="0 0 14 14">
1
+ import{w as l}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const m=l`<svg fill="none" viewBox="0 0 14 14">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as t}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const a=t`<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
1
+ import{w as t}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const a=t`<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
2
  <g clip-path="url(#a)">
3
3
  <path fill="url(#b)" d="M0 0h32v32H0z"/>
4
4
  <path fill-rule="evenodd" clip-rule="evenodd" d="M7.034 15.252c4.975-2.167 8.293-3.596 9.953-4.287 4.74-1.971 5.725-2.314 6.366-2.325.142-.002.457.033.662.198.172.14.22.33.243.463.022.132.05.435.028.671-.257 2.7-1.368 9.248-1.933 12.27-.24 1.28-.71 1.708-1.167 1.75-.99.091-1.743-.655-2.703-1.284-1.502-.985-2.351-1.598-3.81-2.558-1.684-1.11-.592-1.721.368-2.718.252-.261 4.619-4.233 4.703-4.594.01-.045.02-.213-.08-.301-.1-.09-.246-.059-.353-.035-.15.034-2.55 1.62-7.198 4.758-.682.468-1.298.696-1.851.684-.61-.013-1.782-.344-2.653-.628-1.069-.347-1.918-.53-1.845-1.12.039-.308.462-.623 1.27-.944Z" fill="#fff"/>
@@ -1,4 +1,4 @@
1
- import{w as t}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const h=t`<svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
1
+ import{w as t}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const h=t`<svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
2
2
  <path d="M7 3.71875C6.0335 3.71875 5.25 2.93525 5.25 1.96875C5.25 1.00225 6.0335 0.21875 7 0.21875C7.9665 0.21875 8.75 1.00225 8.75 1.96875C8.75 2.93525 7.9665 3.71875 7 3.71875Z" fill="#949E9E"/>
3
3
  <path d="M7 8.96875C6.0335 8.96875 5.25 8.18525 5.25 7.21875C5.25 6.25225 6.0335 5.46875 7 5.46875C7.9665 5.46875 8.75 6.25225 8.75 7.21875C8.75 8.18525 7.9665 8.96875 7 8.96875Z" fill="#949E9E"/>
4
4
  <path d="M5.25 12.4688C5.25 13.4352 6.0335 14.2187 7 14.2187C7.9665 14.2187 8.75 13.4352 8.75 12.4688C8.75 11.5023 7.9665 10.7188 7 10.7188C6.0335 10.7188 5.25 11.5023 5.25 12.4688Z" fill="#949E9E"/>
@@ -1,4 +1,4 @@
1
- import{w as i}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const a=i`<svg fill="none" viewBox="0 0 40 40">
1
+ import{w as i}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const a=i`<svg fill="none" viewBox="0 0 40 40">
2
2
  <g clip-path="url(#a)">
3
3
  <g clip-path="url(#b)">
4
4
  <circle cx="20" cy="19.89" r="20" fill="#5A3E85" />
@@ -1,4 +1,4 @@
1
- import{w as o}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const l=o`<svg fill="none" viewBox="0 0 16 16">
1
+ import{w as o}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const l=o`<svg fill="none" viewBox="0 0 16 16">
2
2
  <path
3
3
  fill="currentColor"
4
4
  d="m14.36 4.74.01.42c0 4.34-3.3 9.34-9.34 9.34A9.3 9.3 0 0 1 0 13.03a6.6 6.6 0 0 0 4.86-1.36 3.29 3.29 0 0 1-3.07-2.28c.5.1 1 .07 1.48-.06A3.28 3.28 0 0 1 .64 6.11v-.04c.46.26.97.4 1.49.41A3.29 3.29 0 0 1 1.11 2.1a9.32 9.32 0 0 0 6.77 3.43 3.28 3.28 0 0 1 5.6-3 6.59 6.59 0 0 0 2.08-.8 3.3 3.3 0 0 1-1.45 1.82A6.53 6.53 0 0 0 16 3.04c-.44.66-1 1.23-1.64 1.7Z"
@@ -1 +1 @@
1
- import{l as h}from"./index-Bgrmz5Gh.js";const p=864e5;function k(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function b(t){return new Date(t).toISOString().slice(0,10)}const D="\0others";function U(t){return t.group!==D?t.label||t.group:t.others===void 0?"Other users":`${t.others} other ${t.others===1?"user":"users"}`}function E(t,e,u){const n=new Map;for(const s of(t==null?void 0:t.groups)??[])n.set(s.group.slice(0,10),{spent:h(s.spent),requests:s.requests});const a=[];for(let s=k(e);s<=u;s+=p){const i=b(s),o=n.get(i),l=new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});a.push({label:l,value:(o==null?void 0:o.spent)??0,sub:`${(o==null?void 0:o.requests)??0} requests`})}return a}const q=[{id:"24h",label:"24 hours",ms:p},{id:"7d",label:"7 days",ms:7*p},{id:"30d",label:"30 days",ms:30*p},{id:"90d",label:"90 days",ms:90*p}];function O(t,e=Date.now()){const u=q.find(n=>n.id===t);return t==="24h"?e-u.ms:k(e-u.ms+p)}const d=36e5;function M(t,e=Date.now()){const u=[];if(t==="24h"){const s=Math.floor(e/d)*d+d;for(let i=s-24*d;i<s;i+=d){const o=new Date(i).toLocaleTimeString("en-US",{hour:"numeric",timeZone:"UTC"});u.push({from:i,to:Math.min(i+d,e+1),label:o})}return u}const n=t==="90d"?7*p:p,a=O(t,e);for(let s=a;s<=e;s+=n){const i=new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});u.push({from:s,to:Math.min(s+n,e+1),label:i})}return u}function m(t,e){return e==="spend"?h(t.spent):e==="requests"?t.requests:t.inputTokens+t.outputTokens}const T="__other__";function _(t,e,u=6){const n=new Map;for(const r of t)for(const c of(r==null?void 0:r.groups)??[]){const f=n.get(c.group)??{label:U(c),total:0};f.total+=m(c,e),n.set(c.group,f)}const a=[...n.entries()].filter(([,r])=>r.total>0).sort((r,c)=>c[1].total-r[1].total),s=a.slice(0,u),i=new Set(s.map(([r])=>r)),o=a.slice(u).reduce((r,[,c])=>r+c.total,0),l=s.map(([r,c])=>({key:r,label:c.label,total:c.total}));o>0&&l.push({key:T,label:"Other",total:o});const S=t.map(r=>{const c={};for(const f of(r==null?void 0:r.groups)??[]){const g=i.has(f.group)?f.group:T;c[g]=(c[g]??0)+m(f,e)}return c});return{series:l,columns:S}}function N(t){return t==="24h"?"hour":"day"}function R(t){return/^\d{4}-\d{2}-\d{2}T\d{2}$/.test(t)?Date.parse(`${t}:00:00Z`):/^\d{4}-\d{2}-\d{2}$/.test(t)?Date.parse(`${t}T00:00:00Z`):Number.NaN}function $(t,e){const u=e.map(()=>new Map);for(const n of(t==null?void 0:t.groups)??[]){const a=R(n.group),s=e.findIndex(o=>a>=o.from&&a<o.to);if(s===-1)continue;const i=u[s];for(const o of n.splits??[]){const l=i.get(o.group);if(!l){i.set(o.group,{...o});continue}l.requests+=o.requests,l.failedRequests+=o.failedRequests,l.spent=(h(l.spent)+h(o.spent)).toFixed(6),l.inputTokens+=o.inputTokens,l.cachedInputTokens+=o.cachedInputTokens,l.outputTokens+=o.outputTokens}}return u.map(n=>({groups:[...n.values()]}))}const y=[{key:"input",label:"Input"},{key:"cached",label:"Cached input"},{key:"output",label:"Output"}];function w(t){const e={input:0,cached:0,output:0},u=t.map(n=>{const a={input:0,cached:0,output:0};for(const s of(n==null?void 0:n.groups)??[])a.cached+=s.cachedInputTokens,a.input+=Math.max(0,s.inputTokens-s.cachedInputTokens),a.output+=s.outputTokens;return e.input+=a.input,e.cached+=a.cached,e.output+=a.output,a});return{series:y.map(n=>({...n,total:e[n.key]})),columns:u}}function v(t){return t.reduce((e,u)=>e+((u==null?void 0:u.groups)??[]).reduce((n,a)=>n+a.requests,0),0)}const I=600*1e3;function x(t,e){return t.spent!==null?"spent":t.servedFree?"free":t.costPending?e-(t.finishedAt??t.startedAt)<I?"pending":"not-recorded":null}export{T as O,q as R,M as a,$ as b,v as c,N as d,E as e,x as f,U as g,O as r,_ as s,w as t};
1
+ import{m as h}from"./index-BG30WuBG.js";const p=864e5;function k(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function b(t){return new Date(t).toISOString().slice(0,10)}const D="\0others";function U(t){return t.group!==D?t.label||t.group:t.others===void 0?"Other users":`${t.others} other ${t.others===1?"user":"users"}`}function E(t,e,u){const n=new Map;for(const s of(t==null?void 0:t.groups)??[])n.set(s.group.slice(0,10),{spent:h(s.spent),requests:s.requests});const a=[];for(let s=k(e);s<=u;s+=p){const i=b(s),o=n.get(i),l=new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});a.push({label:l,value:(o==null?void 0:o.spent)??0,sub:`${(o==null?void 0:o.requests)??0} requests`})}return a}const q=[{id:"24h",label:"24 hours",ms:p},{id:"7d",label:"7 days",ms:7*p},{id:"30d",label:"30 days",ms:30*p},{id:"90d",label:"90 days",ms:90*p}];function O(t,e=Date.now()){const u=q.find(n=>n.id===t);return t==="24h"?e-u.ms:k(e-u.ms+p)}const d=36e5;function M(t,e=Date.now()){const u=[];if(t==="24h"){const s=Math.floor(e/d)*d+d;for(let i=s-24*d;i<s;i+=d){const o=new Date(i).toLocaleTimeString("en-US",{hour:"numeric",timeZone:"UTC"});u.push({from:i,to:Math.min(i+d,e+1),label:o})}return u}const n=t==="90d"?7*p:p,a=O(t,e);for(let s=a;s<=e;s+=n){const i=new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});u.push({from:s,to:Math.min(s+n,e+1),label:i})}return u}function m(t,e){return e==="spend"?h(t.spent):e==="requests"?t.requests:t.inputTokens+t.outputTokens}const T="__other__";function _(t,e,u=6){const n=new Map;for(const r of t)for(const c of(r==null?void 0:r.groups)??[]){const f=n.get(c.group)??{label:U(c),total:0};f.total+=m(c,e),n.set(c.group,f)}const a=[...n.entries()].filter(([,r])=>r.total>0).sort((r,c)=>c[1].total-r[1].total),s=a.slice(0,u),i=new Set(s.map(([r])=>r)),o=a.slice(u).reduce((r,[,c])=>r+c.total,0),l=s.map(([r,c])=>({key:r,label:c.label,total:c.total}));o>0&&l.push({key:T,label:"Other",total:o});const S=t.map(r=>{const c={};for(const f of(r==null?void 0:r.groups)??[]){const g=i.has(f.group)?f.group:T;c[g]=(c[g]??0)+m(f,e)}return c});return{series:l,columns:S}}function N(t){return t==="24h"?"hour":"day"}function R(t){return/^\d{4}-\d{2}-\d{2}T\d{2}$/.test(t)?Date.parse(`${t}:00:00Z`):/^\d{4}-\d{2}-\d{2}$/.test(t)?Date.parse(`${t}T00:00:00Z`):Number.NaN}function $(t,e){const u=e.map(()=>new Map);for(const n of(t==null?void 0:t.groups)??[]){const a=R(n.group),s=e.findIndex(o=>a>=o.from&&a<o.to);if(s===-1)continue;const i=u[s];for(const o of n.splits??[]){const l=i.get(o.group);if(!l){i.set(o.group,{...o});continue}l.requests+=o.requests,l.failedRequests+=o.failedRequests,l.spent=(h(l.spent)+h(o.spent)).toFixed(6),l.inputTokens+=o.inputTokens,l.cachedInputTokens+=o.cachedInputTokens,l.outputTokens+=o.outputTokens}}return u.map(n=>({groups:[...n.values()]}))}const y=[{key:"input",label:"Input"},{key:"cached",label:"Cached input"},{key:"output",label:"Output"}];function w(t){const e={input:0,cached:0,output:0},u=t.map(n=>{const a={input:0,cached:0,output:0};for(const s of(n==null?void 0:n.groups)??[])a.cached+=s.cachedInputTokens,a.input+=Math.max(0,s.inputTokens-s.cachedInputTokens),a.output+=s.outputTokens;return e.input+=a.input,e.cached+=a.cached,e.output+=a.output,a});return{series:y.map(n=>({...n,total:e[n.key]})),columns:u}}function v(t){return t.reduce((e,u)=>e+((u==null?void 0:u.groups)??[]).reduce((n,a)=>n+a.requests,0),0)}const I=600*1e3;function x(t,e){return t.spent!==null?"spent":t.servedFree?"free":t.costPending?e-(t.finishedAt??t.startedAt)<I?"pending":"not-recorded":null}export{T as O,q as R,M as a,$ as b,v as c,N as d,E as e,x as f,U as g,O as r,_ as s,w as t};
@@ -1 +1 @@
1
- import{bx as v,by as g,bz as x,bA as l,bB as p}from"./index-Bgrmz5Gh.js";var N=class extends v{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:g()})}getOptimisticResult(e){return e.behavior=g(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var f,P;const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:d,isError:c,isRefetchError:b}=i,r=(P=(f=s.fetchMeta)==null?void 0:f.fetchMore)==null?void 0:P.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:l(t,s.data),hasPreviousPage:x(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:b&&!h&&!n,isRefetching:d&&!o&&!u}}};function w(e,t){return p(e,N)}export{w as u};
1
+ import{bx as v,by as g,bz as x,bA as l,bB as p}from"./index-BG30WuBG.js";var N=class extends v{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:g()})}getOptimisticResult(e){return e.behavior=g(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var f,P;const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:d,isError:c,isRefetchError:b}=i,r=(P=(f=s.fetchMeta)==null?void 0:f.fetchMore)==null?void 0:P.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:l(t,s.data),hasPreviousPage:x(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:b&&!h&&!n,isRefetching:d&&!o&&!u}}};function w(e,t){return p(e,N)}export{w as u};
@@ -1 +1 @@
1
- import{x as J,y as Q,A as D,z as X,D as Z,B as tt,E as F,F as et,G as at,h as U,I as nt,L as rt,J as st,K as ot,M as it,N as z,O as ct,P as W,Q as ut,R as dt,S as Y,T as I,U as lt,V as ft,X as ht,f as wt,Y as pt,c as K,q as O,u as mt,Z as yt,w as Ct}from"./en_US-Y4ZOVFV4-CReY5kLU.js";import{bf as gt,c0 as At,j as R,ac as B,r as b,c1 as Et,aq as Rt}from"./index-Bgrmz5Gh.js";function St({chain:t,currentChainId:e}){if(!t)throw new J;if(e!==t.id)throw new Q({chain:t,currentChainId:e})}const G=new rt(128);async function Tt(t,e){var T,d,p,_,L;const{account:a=t.account,assertChainId:s=!0,chain:r=t.chain,accessList:n,authorizationList:o,blobs:c,data:l,dataSuffix:f=typeof t.dataSuffix=="string"?t.dataSuffix:(T=t.dataSuffix)==null?void 0:T.value,gas:u,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:N,type:w,value:C,...S}=e;if(typeof a>"u")throw new D({docsPath:"/docs/actions/wallet/sendTransaction"});const i=a?W(a):null;try{X(e);const A=await(async()=>{if(e.to)return e.to;if(e.to!==null&&o&&o.length>0)return await Z({authorization:o[0]}).catch(()=>{throw new tt("`to` is required. Could not infer from `authorizationList`.")})})();if((i==null?void 0:i.type)==="json-rpc"||i===null){let x;r!==null&&(x=await F(t,et,"getChainId")({}),s&&St({currentChainId:x,chain:r}));const P=(_=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.transactionRequest)==null?void 0:_.format,k=(P||at)({...nt(S,{format:P}),accessList:n,account:i,authorizationList:o,blobs:c,chainId:x,data:f?U([l??"0x",f]):l,gas:u,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:N,to:A,type:w,value:C},"sendTransaction"),$=G.get(t.uid),V=$?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:V,params:[k]},{retryCount:0})}catch(H){if($===!1)throw H;const E=H;if(E.name==="InvalidInputRpcError"||E.name==="InvalidParamsRpcError"||E.name==="MethodNotFoundRpcError"||E.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[k]},{retryCount:0}).then(v=>(G.set(t.uid,!0),v)).catch(v=>{const M=v;throw M.name==="MethodNotFoundRpcError"||M.name==="MethodNotSupportedRpcError"?(G.set(t.uid,!1),E):M});throw E}}if((i==null?void 0:i.type)==="local"){const x=await F(t,st,"prepareTransactionRequest")({account:i,accessList:n,authorizationList:o,blobs:c,chain:r,data:f?U([l??"0x",f]):l,gas:u,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:N,nonceManager:i.nonceManager,parameters:[...ot,"sidecars"],type:w,value:C,...S,to:A}),P=(L=r==null?void 0:r.serializers)==null?void 0:L.transaction,j=await i.signTransaction(x,{serializer:P});return await F(t,it,"sendRawTransaction")({serializedTransaction:j})}throw(i==null?void 0:i.type)==="smart"?new z({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new z({docsPath:"/docs/actions/wallet/sendTransaction",type:i==null?void 0:i.type})}catch(A){throw A instanceof z?A:ct(A,{...e,account:i,chain:e.chain||void 0})}}async function q(t,e){return q.internal(t,Tt,"sendTransaction",e)}(function(t){async function e(a,s,r,n){const{abi:o,account:c=a.account,address:l,args:f,functionName:u,...m}=n;if(typeof c>"u")throw new D({docsPath:"/docs/contract/writeContract"});const h=c?W(c):null,y=ut({abi:o,args:f,functionName:u});try{return await F(a,s,r)({data:y,to:l,account:h,...m})}catch(g){throw dt(g,{abi:o,address:l,args:f,docsPath:"/docs/contract/writeContract",functionName:u,sender:h==null?void 0:h.address})}}t.internal=e})(q||(q={}));async function Ft(t,e){const{abi:a,chainId:s,connector:r,...n}=e;let o;e.account?o=e.account:o=(await Y(t,{assertChainId:!1,chainId:s,connector:r})).account;const c=t.getClient({chainId:s}),l=I(c,lt,"simulateContract"),{result:f,request:u}=await l({...n,abi:a,account:o});return{chainId:c.chain.id,result:f,request:{...u,chainId:s}}}async function xt(t,e){const{chainId:a,timeout:s=0,...r}=e,n=t.getClient({chainId:a}),c=await I(n,ft,"waitForTransactionReceipt")({...r,timeout:s});if(c.status==="reverted"){const l=I(n,ht,"getTransaction"),{from:f,...u}=await l({hash:c.transactionHash}),h=await I(n,wt,"call")({...u,account:f,data:u.input,gasPrice:u.type!=="eip1559"?u.gasPrice:void 0,maxFeePerGas:u.type==="eip1559"?u.maxFeePerGas:void 0,maxPriorityFeePerGas:u.type==="eip1559"?u.maxPriorityFeePerGas:void 0}),y=h!=null&&h.data?pt(`0x${h.data.substring(138)}`):"unknown reason";throw new Error(y)}return{...c,chainId:n.chain.id}}async function bt(t,e){const{account:a,chainId:s,connector:r,...n}=e;let o;return typeof a=="object"&&(a==null?void 0:a.type)==="local"?o=t.getClient({chainId:s}):o=await Y(t,{account:a??void 0,assertChainId:!1,chainId:s,connector:r}),await I(o,q,"writeContract")({...n,...a?{account:a}:{},chain:s?{id:s}:null})}function It(t){return{mutationFn(e){return bt(t,e)},mutationKey:["writeContract"]}}function qt(t={}){const{mutation:e}=t,a=K(t),s=It(a),{mutate:r,mutateAsync:n,...o}=gt({...e,...s});return{...o,writeContract:r,writeContractAsync:n}}const Ot=O(["function getOperator(address buyer) view returns (address)","function getOperatorNonce(address buyer) view returns (uint256)","function setOperator(address buyer, address operator, uint256 nonce, bytes buyerSig)","function transferOperator(address buyer, address newOperator)","function withdraw(address buyer, uint256 amount)","error NotAuthorized()","error InvalidAmount()","error InvalidAddress()","error InsufficientBalance()","error InvalidSignature()","error InvalidNonce()","error OperatorAlreadySet()"]),_t=O(["function claimBuyerReward(address buyer, uint256 epoch)","error NotRewardRecipient()","error RewardRecipientUnavailable()"]),vt=O(["function channels(bytes32 channelId) view returns (address buyer, address seller, uint128 deposit, uint128 settled, bytes32 metadataHash, uint256 deadline, uint256 settledAt, uint256 closeRequestedAt, uint8 status)","function requestClose(bytes32 channelId)","function withdraw(bytes32 channelId)","error ChannelNotActive()","error NotAuthorized()","error CloseAlreadyRequested()","error CloseNotReady()"]),Mt=O(["function claimBuyerEmissions(address buyer, uint256[] epochs)","error NotAuthorized()","error EpochNotFinalized()"]);function zt({chain:t,runner:e,done:a="Confirmed on chain."}){const s=e.lastHash?At(t,e.lastHash):null,r=s&&R.jsx("a",{className:"gc-link",href:s,target:"_blank",rel:"noopener noreferrer",children:"View transaction"});return R.jsxs(R.Fragment,{children:[e.status&&R.jsxs(B,{tone:"info",children:[e.status," ",e.running&&e.lastHash&&r]}),e.error&&R.jsxs(B,{tone:"danger",children:[e.error," ",!e.running&&r]}),!e.running&&!e.error&&e.confirmed&&R.jsxs(B,{tone:"success",children:[a," ",r]})]})}function Bt(t){const e=K(),{chainId:a}=mt(),{switchChainAsync:s}=yt(),[r,n]=b.useState(null),[o,c]=b.useState(null),[l,f]=b.useState(null),[u,m]=b.useState(null),[h,y]=b.useState(!1);async function g(N,w={}){var S,i,T;let C=null;y(!0),c(null),m(null),f(null);try{a!==t&&(n("Switch network in your wallet…"),await s({chainId:t}));for(const d of N){d.check&&(n(`${d.label}: checking…`),await d.check()),n(`${d.label}: confirm in your wallet…`);const p=await d.send();if(C=p,f(p),n(`${d.label}: waiting for confirmation…`),(await xt(e,{hash:p,chainId:t})).status!=="success")throw new Error(`${d.label} reverted on chain.`)}return n(null),m(C),C}catch(d){n(null);const p=Et(d);return p?(c(p.message),p.refresh&&((S=w.onStale)==null||S.call(w))):d instanceof Rt?(c(d.message),d.refresh&&((i=w.onStale)==null||i.call(w))):(c(Ct(d)),C&&((T=w.onStale)==null||T.call(w))),null}finally{y(!1)}}return{run:g,running:h,status:r,setStatus:n,error:o,lastHash:l,confirmed:u,wrongChain:a!==void 0&&a!==t,setError:c}}export{vt as C,Ot as D,Mt as L,zt as T,_t as U,qt as a,Ft as s,Bt as u};
1
+ import{x as J,y as Q,A as D,z as X,D as Z,B as tt,E as F,F as et,G as at,h as U,I as nt,L as rt,J as st,K as ot,M as it,N as z,O as ct,P as W,Q as ut,R as dt,S as Y,T as I,U as lt,V as ft,X as ht,f as wt,Y as pt,c as K,q as _,u as mt,Z as yt,w as gt}from"./en_US-Y4ZOVFV4-CAcvlKBB.js";import{bw as Ct,c0 as At,j as R,ag as B,r as b,c1 as Et,aM as Rt}from"./index-BG30WuBG.js";function St({chain:t,currentChainId:e}){if(!t)throw new J;if(e!==t.id)throw new Q({chain:t,currentChainId:e})}const G=new rt(128);async function Tt(t,e){var T,d,p,q,L;const{account:a=t.account,assertChainId:s=!0,chain:r=t.chain,accessList:n,authorizationList:o,blobs:c,data:l,dataSuffix:f=typeof t.dataSuffix=="string"?t.dataSuffix:(T=t.dataSuffix)==null?void 0:T.value,gas:u,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:y,maxPriorityFeePerGas:C,nonce:N,type:w,value:g,...S}=e;if(typeof a>"u")throw new D({docsPath:"/docs/actions/wallet/sendTransaction"});const i=a?W(a):null;try{X(e);const A=await(async()=>{if(e.to)return e.to;if(e.to!==null&&o&&o.length>0)return await Z({authorization:o[0]}).catch(()=>{throw new tt("`to` is required. Could not infer from `authorizationList`.")})})();if((i==null?void 0:i.type)==="json-rpc"||i===null){let x;r!==null&&(x=await F(t,et,"getChainId")({}),s&&St({currentChainId:x,chain:r}));const P=(q=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.transactionRequest)==null?void 0:q.format,k=(P||at)({...nt(S,{format:P}),accessList:n,account:i,authorizationList:o,blobs:c,chainId:x,data:f?U([l??"0x",f]):l,gas:u,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:y,maxPriorityFeePerGas:C,nonce:N,to:A,type:w,value:g},"sendTransaction"),$=G.get(t.uid),V=$?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:V,params:[k]},{retryCount:0})}catch(H){if($===!1)throw H;const E=H;if(E.name==="InvalidInputRpcError"||E.name==="InvalidParamsRpcError"||E.name==="MethodNotFoundRpcError"||E.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[k]},{retryCount:0}).then(v=>(G.set(t.uid,!0),v)).catch(v=>{const M=v;throw M.name==="MethodNotFoundRpcError"||M.name==="MethodNotSupportedRpcError"?(G.set(t.uid,!1),E):M});throw E}}if((i==null?void 0:i.type)==="local"){const x=await F(t,st,"prepareTransactionRequest")({account:i,accessList:n,authorizationList:o,blobs:c,chain:r,data:f?U([l??"0x",f]):l,gas:u,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:y,maxPriorityFeePerGas:C,nonce:N,nonceManager:i.nonceManager,parameters:[...ot,"sidecars"],type:w,value:g,...S,to:A}),P=(L=r==null?void 0:r.serializers)==null?void 0:L.transaction,j=await i.signTransaction(x,{serializer:P});return await F(t,it,"sendRawTransaction")({serializedTransaction:j})}throw(i==null?void 0:i.type)==="smart"?new z({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new z({docsPath:"/docs/actions/wallet/sendTransaction",type:i==null?void 0:i.type})}catch(A){throw A instanceof z?A:ct(A,{...e,account:i,chain:e.chain||void 0})}}async function O(t,e){return O.internal(t,Tt,"sendTransaction",e)}(function(t){async function e(a,s,r,n){const{abi:o,account:c=a.account,address:l,args:f,functionName:u,...m}=n;if(typeof c>"u")throw new D({docsPath:"/docs/contract/writeContract"});const h=c?W(c):null,y=ut({abi:o,args:f,functionName:u});try{return await F(a,s,r)({data:y,to:l,account:h,...m})}catch(C){throw dt(C,{abi:o,address:l,args:f,docsPath:"/docs/contract/writeContract",functionName:u,sender:h==null?void 0:h.address})}}t.internal=e})(O||(O={}));async function Ft(t,e){const{abi:a,chainId:s,connector:r,...n}=e;let o;e.account?o=e.account:o=(await Y(t,{assertChainId:!1,chainId:s,connector:r})).account;const c=t.getClient({chainId:s}),l=I(c,lt,"simulateContract"),{result:f,request:u}=await l({...n,abi:a,account:o});return{chainId:c.chain.id,result:f,request:{...u,chainId:s}}}async function xt(t,e){const{chainId:a,timeout:s=0,...r}=e,n=t.getClient({chainId:a}),c=await I(n,ft,"waitForTransactionReceipt")({...r,timeout:s});if(c.status==="reverted"){const l=I(n,ht,"getTransaction"),{from:f,...u}=await l({hash:c.transactionHash}),h=await I(n,wt,"call")({...u,account:f,data:u.input,gasPrice:u.type!=="eip1559"?u.gasPrice:void 0,maxFeePerGas:u.type==="eip1559"?u.maxFeePerGas:void 0,maxPriorityFeePerGas:u.type==="eip1559"?u.maxPriorityFeePerGas:void 0}),y=h!=null&&h.data?pt(`0x${h.data.substring(138)}`):"unknown reason";throw new Error(y)}return{...c,chainId:n.chain.id}}async function bt(t,e){const{account:a,chainId:s,connector:r,...n}=e;let o;return typeof a=="object"&&(a==null?void 0:a.type)==="local"?o=t.getClient({chainId:s}):o=await Y(t,{account:a??void 0,assertChainId:!1,chainId:s,connector:r}),await I(o,O,"writeContract")({...n,...a?{account:a}:{},chain:s?{id:s}:null})}function It(t){return{mutationFn(e){return bt(t,e)},mutationKey:["writeContract"]}}function Ot(t={}){const{mutation:e}=t,a=K(t),s=It(a),{mutate:r,mutateAsync:n,...o}=Ct({...e,...s});return{...o,writeContract:r,writeContractAsync:n}}const _t=_(["function getOperator(address buyer) view returns (address)","function getOperatorNonce(address buyer) view returns (uint256)","function setOperator(address buyer, address operator, uint256 nonce, bytes buyerSig)","function transferOperator(address buyer, address newOperator)","function withdraw(address buyer, uint256 amount)","error NotAuthorized()","error InvalidAmount()","error InvalidAddress()","error InsufficientBalance()","error InvalidSignature()","error InvalidNonce()","error OperatorAlreadySet()"]),qt=_(["function claimBuyerReward(address buyer, uint256 epoch)","error NotRewardRecipient()","error RewardRecipientUnavailable()"]),vt=_(["function channels(bytes32 channelId) view returns (address buyer, address seller, uint128 deposit, uint128 settled, bytes32 metadataHash, uint256 deadline, uint256 settledAt, uint256 closeRequestedAt, uint8 status)","function requestClose(bytes32 channelId)","function withdraw(bytes32 channelId)","error ChannelNotActive()","error NotAuthorized()","error CloseAlreadyRequested()","error CloseNotReady()"]),Mt=_(["function claimBuyerEmissions(address buyer, uint256[] epochs)","error NotAuthorized()","error EpochNotFinalized()"]);function zt({chain:t,runner:e,done:a="Confirmed on chain."}){const s=e.lastHash?At(t,e.lastHash):null,r=s&&R.jsx("a",{className:"gc-link",href:s,target:"_blank",rel:"noopener noreferrer",children:"View transaction"});return R.jsxs(R.Fragment,{children:[e.status&&R.jsxs(B,{tone:"info",children:[e.status," ",e.running&&e.lastHash&&r]}),e.error&&R.jsxs(B,{tone:"danger",children:[e.error," ",!e.running&&r]}),!e.running&&!e.error&&e.confirmed&&R.jsxs(B,{tone:"success",children:[a," ",r]})]})}function Bt(t){const e=K(),{chainId:a}=mt(),{switchChainAsync:s}=yt(),[r,n]=b.useState(null),[o,c]=b.useState(null),[l,f]=b.useState(null),[u,m]=b.useState(null),[h,y]=b.useState(!1);async function C(N,w={}){var S,i,T;let g=null;y(!0),c(null),m(null),f(null);try{a!==t&&(n("Switch network in your wallet…"),await s({chainId:t}));for(const d of N){d.check&&(n(`${d.label}: checking…`),await d.check()),n(`${d.label}: confirm in your wallet…`);const p=await d.send();if(g=p,f(p),n(`${d.label}: waiting for confirmation…`),(await xt(e,{hash:p,chainId:t})).status!=="success")throw new Error(`${d.label} reverted on chain.`)}return n(null),m(g),g}catch(d){n(null);const p=Et(d);return p?(c(p.message),p.refresh&&((S=w.onStale)==null||S.call(w))):d instanceof Rt?(c(d.message),d.refresh&&((i=w.onStale)==null||i.call(w))):(c(gt(d)),g&&((T=w.onStale)==null||T.call(w))),null}finally{y(!1)}}return{run:C,running:h,status:r,setStatus:n,error:o,lastHash:l,confirmed:u,wrongChain:a!==void 0&&a!==t,setError:c}}export{vt as C,_t as D,Mt as L,zt as T,qt as U,Ot as a,Ft as s,Bt as u};
@@ -1,4 +1,4 @@
1
- import{w as l}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const p=l`<svg fill="none" viewBox="0 0 28 28">
1
+ import{w as l}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const p=l`<svg fill="none" viewBox="0 0 28 28">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as l}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const c=l`<svg fill="none" viewBox="0 0 14 14">
1
+ import{w as l}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const c=l`<svg fill="none" viewBox="0 0 14 14">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{a as ve,s as fe,b as ge,p as be,M as g,S as se,R as l,i as v,r as P,c as f,d as a,A as K,e as ce,f as le,C as m,g as Y,h as ye,j as S,E as ie,O as E,k as q,l as oe,m as T,n as H,T as xe,o as Ce,q as ke,t as Se}from"./core-CX6jme4T.js";import{c as u,n as w,r as d,o as F,U as We}from"./index-BqGpfOnj.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const p=be({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),Re={state:p,subscribe(r){return ge(p,()=>r(p))},subscribeKey(r,e){return fe(p,r,e)},showTooltip({message:r,triggerRect:e,variant:t}){p.open=!0,p.message=r,p.triggerRect=e,p.variant=t},hide(){p.open=!1,p.message="",p.triggerRect={width:0,height:0,top:0,left:0}}},O=ve(Re),de={isUnsupportedChainView(){return l.state.view==="UnsupportedChain"||l.state.view==="SwitchNetwork"&&l.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){g.shake();return}if(await se.isSIWXCloseDisabled()){g.shake();return}g.close()}},$e=v`
1
+ import{a as ve,s as fe,b as ge,p as be,M as g,S as se,R as l,i as v,r as P,c as f,d as a,A as K,e as ce,f as le,C as m,g as Y,h as ye,j as S,E as ie,O as E,k as q,l as oe,m as T,n as H,T as xe,o as Ce,q as ke,t as Se}from"./core-z96MxYDt.js";import{c as u,n as w,r as d,o as F,U as We}from"./index-FSpcDkTF.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const p=be({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),Re={state:p,subscribe(r){return ge(p,()=>r(p))},subscribeKey(r,e){return fe(p,r,e)},showTooltip({message:r,triggerRect:e,variant:t}){p.open=!0,p.message=r,p.triggerRect=e,p.variant=t},hide(){p.open=!1,p.message="",p.triggerRect={width:0,height:0,top:0,left:0}}},O=ve(Re),de={isUnsupportedChainView(){return l.state.view==="UnsupportedChain"||l.state.view==="SwitchNetwork"&&l.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){g.shake();return}if(await se.isSIWXCloseDisabled()){g.shake();return}g.close()}},$e=v`
2
2
  :host {
3
3
  display: block;
4
4
  border-radius: clamp(0px, var(--wui-border-radius-l), 44px);
@@ -1,4 +1,4 @@
1
- import{w as o}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const m=o`<svg fill="none" viewBox="0 0 20 20">
1
+ import{w as o}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const m=o`<svg fill="none" viewBox="0 0 20 20">
2
2
  <path
3
3
  fill="currentColor"
4
4
  fill-rule="evenodd"
@@ -1,4 +1,4 @@
1
- import{w as a}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const c=a`
1
+ import{w as a}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const c=a`
2
2
  <svg fill="none" viewBox="0 0 48 44">
3
3
  <path
4
4
  style="fill: var(--wui-color-bg-300);"
@@ -1,4 +1,4 @@
1
- import{w as l}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const r=l`<svg fill="none" viewBox="0 0 96 67">
1
+ import{w as l}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const r=l`<svg fill="none" viewBox="0 0 96 67">
2
2
  <path
3
3
  fill="currentColor"
4
4
  d="M25.32 18.8a32.56 32.56 0 0 1 45.36 0l1.5 1.47c.63.62.63 1.61 0 2.22l-5.15 5.05c-.31.3-.82.3-1.14 0l-2.07-2.03a22.71 22.71 0 0 0-31.64 0l-2.22 2.18c-.31.3-.82.3-1.14 0l-5.15-5.05a1.55 1.55 0 0 1 0-2.22l1.65-1.62Zm56.02 10.44 4.59 4.5c.63.6.63 1.6 0 2.21l-20.7 20.26c-.62.61-1.63.61-2.26 0L48.28 41.83a.4.4 0 0 0-.56 0L33.03 56.21c-.63.61-1.64.61-2.27 0L10.07 35.95a1.55 1.55 0 0 1 0-2.22l4.59-4.5a1.63 1.63 0 0 1 2.27 0L31.6 43.63a.4.4 0 0 0 .57 0l14.69-14.38a1.63 1.63 0 0 1 2.26 0l14.69 14.38a.4.4 0 0 0 .57 0l14.68-14.38a1.63 1.63 0 0 1 2.27 0Z"
@@ -1,4 +1,4 @@
1
- import{w as r}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const n=r`<svg fill="none" viewBox="0 0 20 20">
1
+ import{w as r}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const n=r`<svg fill="none" viewBox="0 0 20 20">
2
2
  <path
3
3
  fill="currentColor"
4
4
  d="M11 6.67a1 1 0 1 0-2 0v2.66a1 1 0 0 0 2 0V6.67ZM10 14.5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"
@@ -1,4 +1,4 @@
1
- import{w as l}from"./core-CX6jme4T.js";import"./index-Bgrmz5Gh.js";import"./index.es-kR-uCv4P.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CReY5kLU.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const r=l`<svg fill="none" viewBox="0 0 41 40">
1
+ import{w as l}from"./core-z96MxYDt.js";import"./index-BG30WuBG.js";import"./index.es-CA2ape1X.js";import"./events-DQ172AOg.js";import"./en_US-Y4ZOVFV4-CAcvlKBB.js";import"./clsx-B-dksMZM.js";import"./index-BwpQbdIU.js";const r=l`<svg fill="none" viewBox="0 0 41 40">
2
2
  <g clip-path="url(#a)">
3
3
  <path fill="#000" d="M.8 0h40v40H.8z" />
4
4
  <path
package/dist/index.html CHANGED
@@ -7,8 +7,8 @@
7
7
  <meta name="referrer" content="no-referrer" />
8
8
  <title>Antseed Console</title>
9
9
  <link rel="icon" type="image/svg+xml" href="/console/assets/antseed-mark-3TDLhfuw.svg" />
10
- <script type="module" crossorigin src="/console/assets/index-Bgrmz5Gh.js"></script>
11
- <link rel="stylesheet" crossorigin href="/console/assets/index-DNT4SsKr.css">
10
+ <script type="module" crossorigin src="/console/assets/index-BG30WuBG.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/console/assets/index-D8vXwUTI.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antseed/gateway-console",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Antseed gateway console: the web app the gateway serves at /console",
5
5
  "type": "module",
6
6
  "files": [
@@ -46,8 +46,8 @@
46
46
  "vite": "^6.0.0",
47
47
  "vitest": "^2.1.9",
48
48
  "wagmi": "^2.14.0",
49
- "@antseed/wallet-config": "0.0.0",
50
- "@antseed/ui": "0.0.0"
49
+ "@antseed/ui": "0.0.0",
50
+ "@antseed/wallet-config": "0.0.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "vite build",
@@ -1 +0,0 @@
1
- import{u as O,a as P,r,i as Q,b as W,c as $,d as T,j as s,P as L,B as C,I,e as h,S as p,f as R,g as b,h as l,k as B,Q as H,l as J,E as X,m as Y,q as M}from"./index-Bgrmz5Gh.js";import{U as Z,M as _,c as ee}from"./UsageByModel-DrWRsB8W.js";import{r as se,R as ae,g as k}from"./usage-D2MGES9n.js";import{S as V}from"./Segmented-D3p0uCs7.js";import{S as v}from"./SelectField-BSkxMNGk.js";import{D as te}from"./DataTable-sbVT8kP1.js";import"./Charts-C40fH8xu.js";import"./roving-DkptacxO.js";const E=[{value:"model",label:"Model"},{value:"key",label:"Key"},{value:"peer",label:"Seller"},{value:"user",label:"End user"},{value:"member",label:"Member",admin:!0},{value:"workspace",label:"Workspace",org:!0},{value:"day",label:"Day"}];function me(){var q;const{viewer:x,workspace:j}=O(),o=P(),[n,F]=r.useState("30d"),[i,N]=r.useState("model"),[d,z]=r.useState("spend"),[c,f]=r.useState(""),[m,S]=r.useState(""),g=Q(x),y=r.useMemo(()=>Date.now(),[n]),A=se(n,y),u={...o,key:c||void 0,member:m||o.member,from:A,to:y},U=W({workspace:j.id,member:o.member}),K=$(j.id,g),D=T({queryKey:M.usage({...u,groupBy:"day"}),queryFn:()=>h.usage.report({...u,groupBy:"day"})}),G=T({queryKey:M.usage({...u,groupBy:i}),queryFn:()=>h.usage.report({...u,groupBy:i})}),t=(q=D.data)==null?void 0:q.totals;return s.jsxs("div",{className:"gc-page",children:[s.jsx(L,{title:"Activity",description:"Spend and token usage over time.",actions:s.jsx(C,{variant:"outline",size:"sm",href:h.usage.exportUrl({...u,groupBy:i}),download:!0,leadingIcon:s.jsx(I.download,{size:14}),children:"Export CSV"})}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(V,{label:"Time range",value:n,onChange:F,options:ae.map(a=>({value:a.id,label:a.label}))}),s.jsx(v,{size:"sm","aria-label":"Filter by key",value:c,onChange:f,options:[{value:"",label:"All keys"},...(U.data??[]).map(a=>({value:a.id,label:a.label}))]}),g&&s.jsx(v,{size:"sm","aria-label":"Filter by member",value:m,onChange:S,options:[{value:"",label:"All members"},...(K.data??[]).map(({member:a})=>({value:a.id,label:a.label}))]}),(c||m)&&s.jsx(C,{variant:"ghost",size:"sm",onClick:()=>{f(""),S("")},children:"Clear filters"})]}),s.jsxs("div",{className:"gc-grid gc-grid--4",children:[s.jsx(p,{label:"Spend",value:t?R(t.spent):"…"}),s.jsx(p,{label:"Requests",value:t?b(t.requests):"…",sub:t?`${b(t.failedRequests)} failed`:void 0}),s.jsx(p,{label:"Input tokens",value:t?l(t.inputTokens):"…",sub:t?`${l(t.cachedInputTokens)} cached`:void 0}),s.jsx(p,{label:"Output tokens",value:t?l(t.outputTokens):"…"})]}),s.jsx(B,{title:d==="tokens"?"Tokens by type":"Usage by model",description:ee(d,n),actions:s.jsx(V,{label:"Chart metric",value:d,onChange:z,options:_}),children:s.jsx(Z,{filter:{...o,key:c||void 0,member:m||o.member},range:n,now:y,metric:d})}),s.jsx(B,{title:"Breakdown",flush:!0,actions:s.jsx(v,{size:"sm","aria-label":"Group by",value:i,onChange:a=>N(a),options:E.filter(a=>(!a.admin||g)&&(!a.org||Y(x))).map(a=>({value:a.value,label:`By ${a.label.toLowerCase()}`}))}),children:s.jsx(H,{query:G,children:a=>{var w;return s.jsx(te,{label:"Usage breakdown",rows:a.groups,rowKey:e=>e.group,initialSort:{key:"spent",direction:"desc"},empty:s.jsx(X,{icon:s.jsx(I.activity,{size:18}),title:"No usage in this range",body:"Requests made with this workspace's keys show up here."}),columns:[{key:"label",header:((w=E.find(e=>e.value===i))==null?void 0:w.label)??"Group",render:e=>s.jsx("span",{className:"gc-ellipsis",title:k(e),children:k(e)}),sortValue:e=>k(e)},{key:"requests",header:"Requests",align:"right",render:e=>b(e.requests),sortValue:e=>e.requests},{key:"failed",header:"Failed",align:"right",secondary:!0,render:e=>b(e.failedRequests),sortValue:e=>e.failedRequests},{key:"input",header:"Input",align:"right",secondary:!0,render:e=>l(e.inputTokens),sortValue:e=>e.inputTokens},{key:"cached",header:"Cached",align:"right",secondary:!0,render:e=>l(e.cachedInputTokens),sortValue:e=>e.cachedInputTokens},{key:"output",header:"Output",align:"right",secondary:!0,render:e=>l(e.outputTokens),sortValue:e=>e.outputTokens},{key:"spent",header:"Spend",align:"right",render:e=>R(e.spent),sortValue:e=>J(e.spent)}]})}})})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{j as r,n,L as a,r as o}from"./index-Bgrmz5Gh.js";function i({chain:s,error:t,children:e}){return t?r.jsx(n,{error:t}):s?r.jsx(o.Suspense,{fallback:r.jsx(a,{rows:2}),children:e(s)}):r.jsx(a,{rows:2})}export{i as C};
@@ -1 +0,0 @@
1
- import{a1 as v,a2 as N,d as g,q as k,j as e,a3 as q,a4 as x,a5 as w,B as R,I as S,P as B,t as y,a6 as E,S as P,a7 as _,f as n,k as d,Q as I,V as A,g as D,a8 as K,a9 as L,z as O,l as c,e as j,aa as T}from"./index-Bgrmz5Gh.js";import{R as F}from"./RequestLog-C5PR-cpV.js";import{r as z,e as M}from"./usage-D2MGES9n.js";import{B as Q}from"./Charts-C40fH8xu.js";import"./useInfiniteQuery-DWwzEQdC.js";import"./DataTable-sbVT8kP1.js";function J(){var m;const h=v(),u=N(),s=((m=u.data)==null?void 0:m.kind)==="key"?u.data.me.key:null,l=Date.now(),o=z("30d",l),f=g({queryKey:k.usage({key:s==null?void 0:s.id,from:o,groupBy:"day"}),queryFn:()=>j.usage.report({key:s.id,from:o,to:l,groupBy:"day"}),enabled:!!s}),b=g({queryKey:["key-periods",s==null?void 0:s.id],enabled:!!s,queryFn:async()=>{const a=await Promise.all(["daily","weekly","monthly"].map(async i=>{const t=await j.usage.report({key:s.id,from:T(i,l)});return[i,c(t.totals.spent)]}));return Object.fromEntries([...a,["total",c(s.usage.spent)]])}});return e.jsxs("div",{className:"gc-keyholder",children:[e.jsxs("header",{className:"gc-topbar",children:[e.jsxs("div",{className:"gc-topbar__inner",children:[e.jsx(q,{to:null,tagged:!0}),e.jsx("div",{className:"gc-topbar__spacer"}),e.jsx(x,{className:"gc-endpoint--inline"}),e.jsx(w,{}),e.jsx(R,{variant:"outline",size:"sm",leadingIcon:e.jsx(S.logout,{size:14}),onClick:()=>void h(),children:"Sign out"})]}),e.jsx("div",{className:"gc-topbar__strip",children:e.jsx(x,{})})]}),e.jsx("main",{className:"gc-main",id:"gc-main",children:s&&e.jsxs("div",{className:"gc-page",children:[e.jsx(B,{title:s.label,description:e.jsxs(e.Fragment,{children:["Key ",e.jsx("code",{children:s.hint})," · ",s.status==="active"?e.jsx(y,{tone:"success",children:"Active"}):e.jsx(y,{tone:"danger",children:"Revoked"})]})}),e.jsx("div",{className:"gc-grid gc-grid--4",children:E.map(a=>{var p;const i=s.limits[a],t=((p=b.data)==null?void 0:p[a])??null,r=i===null?null:c(i);return e.jsx(P,{label:`${_[a]} spend`,value:t===null?"…":n(t),sub:r===null?"No limit":`${n(Math.max(r-(t??0),0))} left of ${n(r)}`,meter:r&&t!==null?t/r:null},a)})}),e.jsx(d,{title:"Spend, last 30 days",children:e.jsx(I,{query:f,rows:1,children:a=>e.jsx(Q,{format:n,label:"Daily spend",points:M(a,o,l)})})}),e.jsx(d,{title:"Key details",children:e.jsx(A,{items:[["Requests",D(s.usage.requests)],["Spent in total",n(s.usage.spent)],["Last used",K(s.lastUsedAt)],["Expires",s.expiresAt?L(s.expiresAt):"Never"],["Top-ups",s.topupEnabled?"Allowed":"Off"],["Routing",O(s.routingPolicy)]]})}),e.jsx(d,{flush:!0,title:"Requests",children:e.jsx(F,{filter:{key:s.id},showKey:!1})})]})})]})}export{J as default};
@@ -1 +0,0 @@
1
- import{ae as ke,r as m,aD as je,aE as fe,j as s,A as ne,aF as ve,W as Se,B as S,u as le,a as Ce,i as ce,c as de,b as Pe,s as ie,P as Le,I as K,T as F,k as Ne,Q as Ae,aG as Ee,y as ue,aH as J,z as me,f as ye,l as Te,a8 as Re,E as Z,aI as pe,C as De,q as U,e as C,t as v,a9 as X,d as Ie,aJ as Me,aK as Ke,aL as Fe,aM as ee,n as Ue,V as _e}from"./index-Bgrmz5Gh.js";import{u as se,a as Oe,P as Be}from"./PolicyField-Djk40GaH.js";import{T as Ye}from"./Tabs-4vclgTgN.js";import{l as te,d as ae,L as We}from"./limits-I4Xri5kH.js";import{t as qe}from"./dates-Pi3-Ywng.js";import{r as ze,e as $e}from"./usage-D2MGES9n.js";import{S as he}from"./Switch-C1JjKdQ3.js";import{D as Ve,u as He,P as Ge}from"./DataTable-sbVT8kP1.js";import{b as Qe}from"./Charts-C40fH8xu.js";import{S as Je}from"./SelectField-BSkxMNGk.js";import"./PolicyEditor-B52YQzMa.js";import"./Segmented-D3p0uCs7.js";import"./roving-DkptacxO.js";import"./Disclosure-Cx-awmr6.js";function Ze({result:e,onClose:l}){var r;const o=ke(),[c,y]=m.useState("curl"),d=je((r=o.data)==null?void 0:r.publicUrl,window.location.origin),i=e?fe(d,e.secret):[],a=i.find(h=>h.id===c);return s.jsx(ne,{isOpen:e!==null,onClose:l,size:"lg",eyebrow:"API key",title:e?`${e.key.label} is ready`:"",children:e&&s.jsxs("div",{className:"gc-stack",children:[s.jsx(ve,{secret:e.secret}),s.jsxs("div",{children:[s.jsx("div",{className:"as-field__label",children:"Use it"}),s.jsxs("p",{className:"gc-muted",children:["Base URL ",s.jsxs("code",{children:[d,"/v1"]}),". Replace ",s.jsx("code",{children:"<model>"})," with a model from the Models page."]})]}),s.jsx(Ye,{value:c,onChange:y,tabs:i.map(h=>({id:h.id,label:h.label}))}),a&&s.jsx(Se,{code:a.code}),s.jsx("div",{className:"gc-actions",children:s.jsx(S,{onClick:l,children:"Done"})})]})})}const Xe="30d";function es({keyId:e}){const[l]=m.useState(()=>Date.now()),o=ze(Xe,l),c=Ie({queryKey:U.usage({key:e,from:o,groupBy:"day",spark:!0}),queryFn:()=>C.usage.report({key:e,from:o,to:l,groupBy:"day"}),staleTime:6e4});return c.data?s.jsx(Qe,{label:"Daily spend, last 30 days",format:ye,per:"a day",emptyText:"no spend",values:$e(c.data,o,l).map(y=>y.value)}):s.jsx("span",{className:"as-spark as-spark--empty","aria-hidden":"true"})}function ss(e){return e.status==="revoked"?s.jsx(v,{tone:"danger",children:"Revoked"}):e.expiresAt&&e.expiresAt<Date.now()?s.jsx(v,{tone:"warning",children:"Expired"}):e.expiresAt?s.jsxs(v,{tone:"neutral",title:`Expires ${X(e.expiresAt)}`,children:["Until ",X(e.expiresAt)]}):s.jsx(v,{tone:"success",children:"Active"})}function re({title:e,note:l,limits:o,policy:c}){return s.jsxs("div",{className:"gc-layer gc-layer--readonly",children:[s.jsxs("div",{className:"gc-inline gc-inline--between",children:[s.jsx("div",{className:"as-field__label",children:e}),s.jsx(v,{children:"Read only"})]}),s.jsx(_e,{items:[["Spend limits",ue(o??null)],["Routing",me(c??null)]]}),s.jsx("p",{className:"gc-fineprint",children:l})]})}function oe({title:e,idPrefix:l,limits:o,onLimitsChange:c,limitsNote:y,policy:d}){return s.jsxs("div",{className:"gc-layer",children:[e&&s.jsx("div",{className:"as-field__label",children:e}),s.jsxs("div",{children:[s.jsx("div",{className:"as-field__label gc-label-row",children:"Spend limits (USD)"}),s.jsx(We,{idPrefix:l,value:o,onChange:c}),s.jsx("p",{className:"gc-fineprint",children:y})]}),s.jsx(Be,{draft:d.draft,setDraft:d.setDraft})]})}function ts({initial:e,layeredHint:l,onSaved:o,onCancel:c}){var z;const{workspace:y,viewer:d,me:i}=le(),a=ce(d),r=pe(e)?e:null,[h,k]=m.useState((e==null?void 0:e.label)??""),[b,P]=m.useState(te(e==null?void 0:e.limits)),[L,N]=m.useState(te(r?r.ownerLimits:e==null?void 0:e.limits)),[j,A]=m.useState(qe((e==null?void 0:e.expiresAt)??null)),[x,E]=m.useState((e==null?void 0:e.topupEnabled)??!1),[n,g]=m.useState((e==null?void 0:e.ownerMemberId)??i.member.id),w=se(e==null?void 0:e.routingPolicy),t=se(r?r.ownerRoutingPolicy:e==null?void 0:e.routingPolicy),p=Me(e,{memberId:i.member.id,workspaceAdmin:a},l),ge=Ke(y.id,a),_=((e==null?void 0:e.buyerIdentity)??((z=ge.data)==null?void 0:z.buyerIdentity))==="default",O=de(y.id,a&&!e),R=Oe(),[B,Y]=m.useState(null),D=p.admin,W=e?p.owner&&(p.layered||!p.admin):!p.admin,T=e!==null&&p.layered;let q=null;T&&(q=p.admin?"Your restrictions as the key owner":"Your restrictions");const xe=e?"Save":"Create key",be=p.layered||!e?"UTC periods; weeks start Monday. Workspace, member and admin limits apply too.":"You can only tighten your key: a higher or cleared limit is ignored.",I=ie({mutationFn:async()=>{const u=j?Date.parse(`${j}T23:59:59Z`):null,$=D?w.build():null,V=W?t.build():null,H=ae(b),G=ae(L);if(e){const f=Fe(p,e,{label:h.trim(),expiresAt:u,topupEnabled:x,adminLimits:H,adminPolicy:$,ownerLimits:G,ownerPolicy:V}),Q=await R.save([f.routingPolicy,f.ownerRoutingPolicy],we=>C.keys.update(e.id,f,we));return Q===ee?ee:{key:Q}}const M={label:h.trim(),workspaceId:y.id,limits:p.admin?H:G,routingPolicy:p.admin?$:V,topupEnabled:p.admin?x:!1,expiresAt:u};return p.admin&&(M.ownerMemberId=n||null),R.save([M.routingPolicy],f=>C.keys.create(M,f))},onSuccess:o,invalidate:[U.group("keys")],toast:u=>u.secret?null:"Key saved",onError:Y});return s.jsxs("form",{className:"gc-stack",onSubmit:u=>{u.preventDefault(),Y(null),I.mutate()},children:[s.jsx(F,{label:"Name",required:!0,placeholder:"e.g. Production backend",value:h,onChange:u=>k(u.target.value)}),!e&&a&&O.data&&s.jsx(Je,{label:"Owner",value:n,onChange:g,options:O.data.map(({member:u})=>({value:u.id,label:u.id===i.member.id?`${u.label} (you)`:u.label}))}),D&&s.jsx(oe,{title:T?"Workspace admin restrictions":null,idPrefix:"key-limit",limits:b,onLimitsChange:P,limitsNote:"UTC periods; weeks start Monday. The workspace and member budgets apply too.",policy:w}),!D&&T&&s.jsx(re,{title:"Set by workspace admins",limits:e.limits,policy:e.routingPolicy,note:"These always apply to this key. Your own restrictions below can only add to them."}),W&&s.jsx(oe,{title:q,idPrefix:"key-owner-limit",limits:L,onLimitsChange:N,limitsNote:be,policy:t}),T&&!p.owner&&s.jsx(re,{title:"Set by the key owner",limits:r==null?void 0:r.ownerLimits,policy:r==null?void 0:r.ownerRoutingPolicy,note:"Only the key's owner changes these. They apply on top of yours."}),s.jsx(F,{label:"Expires",type:"date",value:j,onChange:u=>A(u.target.value),hint:a?"Leave blank for no expiry.":"You can set or bring forward an expiry; only an admin can extend or remove it."}),a&&s.jsx(he,{checked:x,onChange:E,disabled:_&&!x,label:"Allow top-ups",description:_?"Keys paid from the default wallet cannot be topped up.":"Let the key holder add funds to this key with USDC (x402)."}),B?s.jsx(Ue,{error:B,title:"Could not save the key"}):null,s.jsxs("div",{className:"gc-actions",children:[s.jsx(S,{variant:"ghost",onClick:c,children:"Cancel"}),s.jsx(S,{type:"submit",disabled:I.isPending||!h.trim(),children:I.isPending?"Saving…":xe})]}),R.dialog]})}const as=25;function rs({list:e,search:l,showRevoked:o,ownerLabel:c,render:y}){const d=l.trim().toLowerCase(),i=m.useMemo(()=>e.filter(r=>(o||r.status==="active")&&(!d||r.label.toLowerCase().includes(d)||r.hint.toLowerCase().includes(d)||c(r).toLowerCase().includes(d))),[e,o,d,c]),a=He(i,as,`${d}|${o}`);return s.jsxs(s.Fragment,{children:[y(a.items,i.length===0&&e.length>0),s.jsx(Ge,{pager:a,noun:"keys"})]})}function os(e){return(e==null?void 0:e.kind)==="rotate"?{title:"Rotate this key?",confirmLabel:"Rotate key",tone:"primary",body:s.jsxs(s.Fragment,{children:["The current secret for ",s.jsx("strong",{children:e.key.label})," stops working now. You get a new secret to replace it."]})}:{title:"Revoke this key?",confirmLabel:"Revoke key",tone:"danger",body:s.jsxs(s.Fragment,{children:["Requests with ",s.jsx("strong",{children:e==null?void 0:e.key.label})," fail from now on. This cannot be undone."]})}}function ks(){const{workspace:e,me:l,viewer:o}=le(),c=Ce(),y=ce(o),d=de(e.id,y),[i,a]=m.useState(()=>new URLSearchParams(window.location.search).get("new")==="1"?"new":null),[r,h]=m.useState(null),[k,b]=m.useState(null),[P,L]=m.useState(!1),[N,j]=m.useState(""),A=Pe(c),x=ie({mutationFn:async({kind:n,key:g})=>{n==="rotate"?h(await C.keys.rotate(g.id)):await C.keys.revoke(g.id)},onSuccess:()=>b(null),invalidate:[U.group("keys")],toast:(n,{kind:g})=>g==="revoke"?"Key revoked":null}),E=n=>{var g,w;return n.ownerMemberId?n.ownerMemberId===l.member.id?"You":((w=(g=d.data)==null?void 0:g.find(({member:t})=>t.id===n.ownerMemberId))==null?void 0:w.member.label)??"Another member":"—"};return s.jsxs("div",{className:"gc-page",children:[s.jsx(Le,{title:"API keys",description:`Keys for the ${e.name} workspace. Each key spends from this workspace's wallet.`,actions:s.jsx(S,{variant:"brand",leadingIcon:s.jsx(K.plus,{size:14}),onClick:()=>a("new"),children:"Create key"})}),s.jsxs("div",{className:"gc-toolbar",children:[s.jsx(F,{size:"sm",type:"search","aria-label":"Search keys",placeholder:"Search name, hint or owner",value:N,onChange:n=>j(n.target.value)}),s.jsx(he,{checked:P,onChange:L,label:"Show revoked"})]}),s.jsx(Ne,{flush:!0,children:s.jsx(Ae,{query:A,children:n=>s.jsx(rs,{list:n,search:N,showRevoked:P,ownerLabel:E,render:(g,w)=>s.jsx(Ve,{label:"API keys",rows:g,rowKey:t=>t.id,rowLabel:t=>t.label,onRowClick:t=>t.status==="active"&&a(t),actions:t=>t.status==="active"?[{label:"Edit",onSelect:()=>a(t)},{label:"Rotate secret",onSelect:()=>b({kind:"rotate",key:t})},{label:"Revoke",tone:"danger",onSelect:()=>b({kind:"revoke",key:t})}]:[],empty:w?s.jsx(Z,{icon:s.jsx(K.keys,{size:18}),title:"No keys match",body:"Try another search, or show revoked keys."}):s.jsx(Z,{icon:s.jsx(K.keys,{size:18}),title:"No keys yet",body:"Create a key to call models through this gateway.",action:s.jsx(S,{onClick:()=>a("new"),children:"Create key"})}),columns:[{key:"label",header:"Name",sortValue:t=>t.label,render:t=>s.jsx(Ee,{name:t.label,hint:t.hint})},{key:"owner",header:"Owner",secondary:!0,render:E},{key:"limits",header:"Limits",secondary:!0,optional:!0,render:t=>s.jsx("span",{className:"gc-muted",children:ue(J(t).limits)})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:t=>s.jsx("span",{className:"gc-muted",children:me(J(t).policy)})},...y?[{key:"trend",header:"30 days",secondary:!0,render:t=>s.jsx(es,{keyId:t.id})}]:[],{key:"month",header:"This month",align:"right",sortValue:t=>Te(t.usage.spentThisMonth),render:t=>ye(t.usage.spentThisMonth)},{key:"used",header:"Last used",secondary:!0,optional:!0,sortValue:t=>t.lastUsedAt,render:t=>Re(t.lastUsedAt)},{key:"status",header:"Status",secondary:!0,render:ss}]})})})}),s.jsx(ne,{isOpen:i!==null,onClose:()=>a(null),size:"lg",title:i==="new"?"Create API key":"Edit API key",children:i!==null&&s.jsx(ts,{initial:i==="new"?null:i,layeredHint:(A.data??[]).some(pe),onCancel:()=>a(null),onSaved:n=>{a(null),n.secret&&h({key:n.key,secret:n.secret})}})}),s.jsx(Ze,{result:r,onClose:()=>h(null)}),s.jsx(De,{isOpen:k!==null,busy:x.isPending,error:x.error,onClose:()=>{b(null),x.reset()},onConfirm:()=>k&&x.mutate(k),...os(k)})]})}export{ks as default};
@@ -1 +0,0 @@
1
- import{r as s,a as D,b as E,j as e,P as I,B as y,I as U,e as q,T as p,k as M}from"./index-Bgrmz5Gh.js";import{R as B}from"./RequestLog-C5PR-cpV.js";import{f as C}from"./dates-Pi3-Ywng.js";import{S as T}from"./SelectField-BSkxMNGk.js";import"./useInfiniteQuery-DWwzEQdC.js";import"./usage-D2MGES9n.js";import"./DataTable-sbVT8kP1.js";function k(a,o=300){const[l,r]=s.useState(a);return s.useEffect(()=>{const i=window.setTimeout(()=>r(a),o);return()=>window.clearTimeout(i)},[a,o]),l}function H(){const a=D(),[o,l]=s.useState(""),[r,i]=s.useState(""),[n,b]=s.useState(""),[v,h]=s.useState(""),[c,g]=s.useState(""),[d,x]=s.useState(""),F=E(a),f=k(r.trim()),S=k(v.trim()),u=C(c,"start"),m=C(d,"end"),w=u!==void 0&&m!==void 0&&u>m,j=s.useMemo(()=>({...a,key:o||void 0,model:f||void 0,status:n||void 0,q:S||void 0,from:u,to:m}),[a.workspace,a.member,o,f,n,S,u,m]),z=!!(o||r||n||v||c||d);return e.jsxs("div",{className:"gc-page",children:[e.jsx(I,{title:"Logs",description:"Every request through this workspace's keys.",actions:e.jsx(y,{variant:"outline",size:"sm",href:q.usage.exportUrl(j),download:!0,leadingIcon:e.jsx(U.download,{size:14}),children:"Export CSV"})}),e.jsxs("div",{className:"gc-toolbar",children:[e.jsx(p,{size:"sm",type:"search","aria-label":"Search requests",placeholder:"Search model, key, end user or error",value:v,onChange:t=>h(t.target.value),className:"gc-toolbar__grow"}),e.jsx(T,{size:"sm","aria-label":"Filter by key",value:o,onChange:l,options:[{value:"",label:"All keys"},...(F.data??[]).map(t=>({value:t.id,label:t.label}))]}),e.jsx(p,{size:"sm","aria-label":"Filter by model",placeholder:"Model",value:r,onChange:t=>i(t.target.value)}),e.jsx(T,{size:"sm","aria-label":"Filter by status",value:n,onChange:b,options:[{value:"",label:"Any status"},{value:"success",label:"Succeeded"},{value:"error",label:"Failed"}]}),e.jsx(p,{size:"sm",type:"date","aria-label":"From date (UTC)",title:"From (UTC)",value:c,max:d||void 0,onChange:t=>g(t.target.value)}),e.jsx(p,{size:"sm",type:"date","aria-label":"To date (UTC)",title:"To (UTC)",value:d,min:c||void 0,onChange:t=>x(t.target.value),error:w?"Ends before it starts":void 0}),z&&e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>{l(""),i(""),b(""),h(""),g(""),x("")},children:"Clear filters"})]}),e.jsx(M,{flush:!0,children:e.jsx(B,{filter:j})})]})}export{H as default};
@@ -1 +0,0 @@
1
- import{u as W,m as U,r as d,c as ce,O as G,s as N,j as e,P as de,B as f,I as q,k as H,Q,aN as _,y as me,z as ue,E as ae,A as B,C as T,e as w,F as ge,q as P,ah as be,t as F,a9 as se,aO as ne,aP as he,a8 as J,T as I,ac as X,n as ie,aF as pe,ap as ve}from"./index-Bgrmz5Gh.js";import{u as xe,a as je,P as ye}from"./PolicyField-Djk40GaH.js";import{l as ke,d as fe,L as we}from"./limits-I4Xri5kH.js";import{D as Y}from"./DataTable-sbVT8kP1.js";import{S as O}from"./SelectField-BSkxMNGk.js";import"./PolicyEditor-B52YQzMa.js";import"./Segmented-D3p0uCs7.js";import"./roving-DkptacxO.js";import"./Switch-C1JjKdQ3.js";import"./Disclosure-Cx-awmr6.js";const z=(s,t)=>!!s&&!!t&&s.trim().toLowerCase()===t.trim().toLowerCase();function Ce(s,t,o){const n=[],m=Date.now();for(const i of t)z(i.email,s.email)?n.push(`${i.label} already uses ${i.email}.`):z(i.label,s.label)&&n.push(`A member named ${i.label} already exists${i.status==="invited"?" (invited, not joined yet)":""}.`);for(const i of o)i.expiresAt<m||(z(i.email,s.email)?n.push(`A pending invite already goes to ${i.email}.`):z(i.label,s.label)&&n.push(`A pending invite for ${i.label} already exists.`));return[...new Set(n)]}const D=[P.group("members"),P.group("workspaces"),P.group("keys")],K=[...D,P.group("invites")],te=[{value:"member",label:"Member"},{value:"admin",label:"Admin"}];function V(s){return s.status==="disabled"?e.jsx(F,{tone:"danger",children:"Disabled"}):s.status==="invited"?e.jsx(F,{tone:"warning",children:"Invited"}):e.jsx(F,{tone:"success",children:"Active"})}function le(s,t){return s==="owner"?["member","admin","owner"]:t?["member","admin"]:["member"]}function re(s){return s.map(t=>({value:t,label:_[t]}))}function Se({onCreated:s,onCancel:t}){const{me:o,viewer:n,workspace:m}=W(),i=U(n),C=o.workspaces.filter(a=>i||a.role==="admin").map(a=>a.workspace),[c,u]=d.useState(""),[g,p]=d.useState(""),[v,R]=d.useState("member"),[j,E]=d.useState("72"),[y,b]=d.useState({[m.id]:"member"}),S=G(i),M=ne(),x=Ce({label:c,email:g},S.data??[],M.data??[]),h=N({mutationFn:()=>{const a={label:c.trim(),email:g.trim()||null,orgRole:v,workspaces:Object.entries(y).filter(([,k])=>k).map(([k,L])=>({workspaceId:k,role:L})),expiresInHours:Number(j)||72};return w.invites.create(a)},onSuccess:s,invalidate:K}),l=x.length?"Create anyway":"Create invite link";return e.jsxs("form",{className:"gc-stack",onSubmit:a=>{a.preventDefault(),h.mutate()},children:[e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(I,{label:"Name",required:!0,value:c,onChange:a=>u(a.target.value)}),e.jsx(I,{label:"Email (optional)",type:"email",value:g,onChange:a=>p(a.target.value),hint:"Required when they will sign in with your identity provider."})]}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(O,{label:"Organization role",value:v,onChange:a=>R(a),options:re(le(o.member.orgRole,i)),hint:v==="member"?"Sees only the workspaces below.":"Can manage every workspace."}),e.jsx(O,{label:"Link expires after",value:j,onChange:E,options:[{value:"24",label:"1 day"},{value:"72",label:"3 days"},{value:"168",label:"7 days"}]})]}),e.jsxs("fieldset",{className:"gc-checks",children:[e.jsx("legend",{className:"as-field__label",children:"Workspaces"}),C.map(a=>e.jsxs("div",{className:"gc-inline gc-inline--between",children:[e.jsx("span",{children:a.name}),e.jsx(O,{"aria-label":`Role in ${a.name}`,value:y[a.id]??"",onChange:k=>b({...y,[a.id]:k}),options:[{value:"",label:"No access"},...te]})]},a.id))]}),x.length>0&&e.jsx(X,{tone:"warning",title:"Possible duplicate",children:e.jsx("ul",{className:"gc-list",children:x.map(a=>e.jsx("li",{children:a},a))})}),h.error?e.jsx(ie,{error:h.error,title:"Could not create the invite"}):null,e.jsxs("div",{className:"gc-actions",children:[e.jsx(f,{variant:"ghost",onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:h.isPending||!c.trim(),children:h.isPending?"Creating…":l})]})]})}function Ne({member:s,onDone:t}){const{me:o,viewer:n}=W(),m=U(n),[i,C]=d.useState(s.label),[c,u]=d.useState(s.email??""),[g,p]=d.useState(s.orgRole),[v,R]=d.useState(ke(s.limits)),[j,E]=d.useState(s.maxKeys===null?"":String(s.maxKeys)),y=xe(s.routingPolicy),[b,S]=d.useState(null),[M,x]=d.useState(!1),h=je(),l=N({mutationFn:async()=>{const r=j.trim()===""?null:Number(j);if(r!==null&&(!Number.isInteger(r)||r<0))throw new Error("Key limit must be a whole number.");const ee={label:i.trim(),email:c.trim()||null,limits:fe(v),maxKeys:r,routingPolicy:y.build(),...m?{orgRole:g}:{}};return h.save([ee.routingPolicy],oe=>w.members.update(s.id,ee,oe))},onSuccess:t,invalidate:D,toast:"Member saved"}),a=N({mutationFn:()=>s.status==="disabled"?w.members.enable(s.id):w.members.disable(s.id),onSuccess:()=>{x(!1),t()},invalidate:D}),k=N({mutationFn:r=>w.members.removeCredential(s.id,r),onSuccess:()=>{S(null),t()},invalidate:D}),L=s.id===o.member.id,A=s.status==="disabled",$=m&&(s.orgRole!=="owner"||o.member.orgRole==="owner"),Z=L&&s.credentials.length<=1;return e.jsxs("form",{className:"gc-stack",onSubmit:r=>{r.preventDefault(),l.mutate()},children:[e.jsxs("div",{className:"gc-grid gc-grid--2",children:[e.jsx(I,{label:"Name",value:i,onChange:r=>C(r.target.value)}),e.jsx(I,{label:"Email",type:"email",value:c,onChange:r=>u(r.target.value)})]}),e.jsxs("div",{className:"gc-grid gc-grid--2",children:[m&&e.jsx(O,{label:"Organization role",value:g,disabled:L||s.orgRole==="owner"&&o.member.orgRole!=="owner",onChange:r=>p(r),options:re(le(o.member.orgRole,!0))}),e.jsx(I,{label:"Keys they may create",inputMode:"numeric",placeholder:"No limit",value:j,onChange:r=>E(r.target.value)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"as-field__label gc-label-row",children:"Spend limits across their keys (USD)"}),e.jsx(we,{idPrefix:"member-limit",value:v,onChange:R})]}),e.jsx(ye,{draft:y.draft,setDraft:y.setDraft}),e.jsxs("div",{children:[e.jsx("div",{className:"as-field__label gc-label-row",children:"Sign-in methods"}),s.credentials.length===0?e.jsx("p",{className:"gc-muted",children:"None yet."}):e.jsx("ul",{className:"gc-list",children:s.credentials.map(r=>e.jsxs("li",{className:"gc-inline gc-inline--between",children:[e.jsxs("span",{children:[e.jsx(F,{children:r.kind})," ",r.label," ",e.jsxs("span",{className:"gc-muted",children:["· last used ",J(r.lastUsedAt)]})]}),$&&e.jsx(f,{variant:"ghost",size:"sm",disabled:Z,title:Z?"Add another sign-in method first":void 0,onClick:()=>S(r),children:"Remove"})]},r.id))})]}),!$&&e.jsx(X,{tone:"info",children:"Only an owner can change an owner's profile, status or sign-in methods."}),l.error?e.jsx(ie,{error:l.error,title:"Could not save"}):null,e.jsxs("div",{className:"gc-actions gc-actions--split",children:[$&&!L?e.jsx(f,{variant:A?"outline":"danger",size:"sm",onClick:()=>x(!0),children:A?"Enable member":"Disable member"}):e.jsx("span",{}),e.jsxs("div",{className:"gc-actions",children:[e.jsx(f,{variant:"ghost",onClick:t,children:"Cancel"}),$&&e.jsx(f,{type:"submit",disabled:l.isPending,children:l.isPending?"Saving…":"Save"})]})]}),e.jsx(T,{isOpen:M,busy:a.isPending,error:a.error,onClose:()=>x(!1),onConfirm:()=>a.mutate(),title:A?"Enable this member?":"Disable this member?",tone:A?"primary":"danger",confirmLabel:A?"Enable":"Disable",body:A?`${s.label} can sign in again. Their revoked keys stay revoked.`:`${s.label} is signed out and all of their keys are revoked.`}),e.jsx(T,{isOpen:b!==null,busy:k.isPending,error:k.error,onClose:()=>S(null),onConfirm:()=>b&&k.mutate(b.id),title:"Remove this sign-in method?",confirmLabel:"Remove",body:`${(b==null?void 0:b.label)??""} can no longer be used to sign in as ${s.label}.`}),h.dialog]})}function Re({member:s,role:t}){const{workspace:o,me:n}=W(),m=ge(),i=N({mutationFn:c=>w.workspaces.setMember(o.id,s.id,c),invalidate:s.id===n.member.id?[P.workspaceMembers(o.id),P.me]:[P.workspaceMembers(o.id)],toast:(c,u)=>`${s.label} is now a workspace ${u}`,onError:c=>m(`Could not change ${s.label}'s role: ${be(c)}`,"danger")}),C=s.orgRole!=="member";return e.jsx("div",{onClick:c=>c.stopPropagation(),children:e.jsx(O,{size:"sm","aria-label":`Workspace role for ${s.label}`,value:t,disabled:i.isPending||C,title:C?"Organization admins administer every workspace":void 0,onChange:c=>i.mutate(c),options:te})})}function Pe({onEdit:s}){const t=G();return e.jsx(H,{flush:!0,title:"Everyone in the organization",children:e.jsx(Q,{query:t,children:o=>e.jsx(Y,{label:"All members",rows:o,rowKey:n=>n.id,onRowClick:s,rowLabel:n=>n.label,actions:n=>[{label:"Edit member",onSelect:()=>s(n)}],columns:[{key:"name",header:"Name",sortValue:n=>n.label,render:n=>e.jsxs("span",{className:"gc-strong",children:[n.label,n.status!=="active"&&e.jsxs("span",{className:"gc-narrow-only",children:[" ",V(n)]})]})},{key:"email",header:"Email",secondary:!0,render:n=>n.email??"—"},{key:"role",header:"Role",render:n=>_[n.orgRole]},{key:"keys",header:"Key limit",secondary:!0,optional:!0,render:n=>n.maxKeys??"No limit"},{key:"since",header:"Joined",secondary:!0,sortValue:n=>n.createdAt,render:n=>n.status==="invited"?e.jsxs("span",{className:"gc-muted",children:["Invited ",se(n.createdAt)]}):se(n.createdAt)},{key:"status",header:"Status",secondary:!0,render:V}]})})})}function Ee(){const s=ne(),[t,o]=d.useState(null),n=N({mutationFn:m=>w.invites.revoke(m.id),onSuccess:()=>o(null),invalidate:K});return e.jsxs(H,{flush:!0,title:"Pending invites",children:[e.jsx(Q,{query:s,children:m=>e.jsx(Y,{label:"Pending invites",rows:m,rowKey:i=>i.id,rowLabel:i=>`invite for ${i.label}`,empty:e.jsx(ae,{icon:e.jsx(q.members,{size:18}),title:"No pending invites"}),actions:i=>[{label:"Revoke invite",tone:"danger",onSelect:()=>o(i)}],columns:[{key:"name",header:"Name",render:i=>e.jsx("span",{className:"gc-strong",children:i.label})},{key:"email",header:"Email",secondary:!0,render:i=>i.email??"—"},{key:"role",header:"Role",render:i=>_[i.orgRole]},{key:"expires",header:"Expires",secondary:!0,render:i=>e.jsx(he,{at:i.expiresAt,format:J})}]})}),e.jsx(T,{isOpen:t!==null,busy:n.isPending,error:n.error,onClose:()=>o(null),onConfirm:()=>t&&n.mutate(t),title:"Revoke this invite?",confirmLabel:"Revoke",body:"The link stops working."})]})}function Ae({invite:s,onClose:t}){return e.jsx(B,{isOpen:s!==null,onClose:t,title:"Invite link",size:"lg",children:s&&e.jsxs("div",{className:"gc-stack",children:[s.url?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Send this link to ",e.jsx("strong",{children:s.label}),". It works once and expires ",J(s.expiresAt),"."]}),e.jsx(pe,{secret:s.url,note:"This link is shown only once. Anyone with it can join as this member."})]}):e.jsx(X,{tone:"warning",children:"The gateway did not return a link for this invite."}),e.jsxs("div",{className:"gc-actions",children:[s.url&&e.jsx(ve,{value:s.url,label:"Copy link",size:"md"}),e.jsx(f,{onClick:t,children:"Done"})]})]})})}function We(){var h;const{viewer:s,workspace:t,me:o}=W(),n=U(s),[m,i]=d.useState(!1),[C,c]=d.useState(null),[u,g]=d.useState(null),[p,v]=d.useState(null),[R,j]=d.useState(""),E=ce(t.id),y=G(n),b=N({mutationFn:l=>w.workspaces.removeMember(t.id,l.id),onSuccess:()=>v(null),invalidate:K,toast:"Removed from workspace"}),S=N({mutationFn:l=>w.workspaces.setMember(t.id,l,"member"),onSuccess:()=>j(""),invalidate:K,toast:"Added to workspace"}),M=new Set((h=E.data)==null?void 0:h.map(({member:l})=>l.id)),x=(y.data??[]).filter(l=>!M.has(l.id)&&l.status==="active");return e.jsxs("div",{className:"gc-page",children:[e.jsx(de,{title:"Members",description:"Who can use this gateway, their budgets and routing.",actions:e.jsx(f,{variant:"brand",leadingIcon:e.jsx(q.plus,{size:14}),onClick:()=>i(!0),children:"Invite member"})}),e.jsx(H,{flush:!0,title:`${t.name} workspace`,actions:n&&x.length>0?e.jsxs("div",{className:"gc-inline",children:[e.jsx(O,{size:"sm","aria-label":"Add an existing member",value:R,onChange:j,options:[{value:"",label:"Add existing member…"},...x.map(l=>({value:l.id,label:l.label}))]}),e.jsx(f,{size:"sm",variant:"outline",disabled:!R||S.isPending,onClick:()=>S.mutate(R),children:"Add"})]}):void 0,children:e.jsx(Q,{query:E,children:l=>e.jsx(Y,{label:"Workspace members",rows:l,rowKey:a=>a.member.id,onRowClick:n?a=>g(a.member):void 0,rowLabel:a=>a.member.label,actions:a=>[n&&{label:"Edit member",onSelect:()=>g(a.member)},a.member.id!==o.member.id&&{label:"Remove from workspace",tone:"danger",onSelect:()=>v(a.member)}],empty:e.jsx(ae,{icon:e.jsx(q.members,{size:18}),title:"No members in this workspace"}),columns:[{key:"name",header:"Name",sortValue:a=>a.member.label,render:a=>e.jsxs("div",{children:[e.jsx("div",{className:"gc-strong",children:a.member.label}),e.jsx("div",{className:"gc-muted",children:a.member.email??_[a.member.orgRole]})]})},{key:"role",header:"Workspace role",render:a=>e.jsx(Re,{member:a.member,role:a.role})},{key:"limits",header:"Limits",secondary:!0,optional:!0,render:a=>e.jsx("span",{className:"gc-muted",children:me(a.member.limits)})},{key:"policy",header:"Routing",secondary:!0,optional:!0,render:a=>e.jsx("span",{className:"gc-muted",children:ue(a.member.routingPolicy)})},{key:"status",header:"Status",secondary:!0,render:a=>V(a.member)}]})})}),n&&e.jsx(Pe,{onEdit:g}),e.jsx(Ee,{}),e.jsx(B,{isOpen:m,onClose:()=>i(!1),size:"lg",title:"Invite a member",children:m&&e.jsx(Se,{onCancel:()=>i(!1),onCreated:l=>{i(!1),c(l)}})}),e.jsx(Ae,{invite:C,onClose:()=>c(null)}),e.jsx(B,{isOpen:u!==null,onClose:()=>g(null),size:"lg",title:(u==null?void 0:u.label)??"",eyebrow:"Member",children:u&&e.jsx(Ne,{member:u,onDone:()=>g(null)},u.id)}),e.jsx(T,{isOpen:p!==null,busy:b.isPending,error:b.error,onClose:()=>v(null),onConfirm:()=>p&&b.mutate(p),title:"Remove from workspace?",confirmLabel:"Remove",body:`${(p==null?void 0:p.label)??""} loses access to ${t.name}. Their keys in this workspace stop working.`})]})}export{We as default};
@@ -1 +0,0 @@
1
- import{aS as A,r as m,j as e,aT as F,W as B,aU as V,N as w,aV as $,aW as U,aX as R,aY as _,L as z,E as f,I as M,P as O,T as D,x as k,k as K,Q as Y,aZ as q,M as b,g as Q,a_ as v,a$ as S,b0 as I,b1 as W,ap as N,t as u,V as G,B as H,ab as X,v as L,h as Z}from"./index-Bgrmz5Gh.js";import{T as J,a as ee}from"./Tabs-4vclgTgN.js";import{m as se,f as ae,M as P,S as te,a as ne,C as ie,P as C,b as le,V as re,p as oe}from"./models-DGQYrtKn.js";import{S as T}from"./SelectField-BSkxMNGk.js";import{S as ce}from"./Switch-C1JjKdQ3.js";import{D as de}from"./DataTable-sbVT8kP1.js";import"./roving-DkptacxO.js";function ue({model:s,format:i,id:o="gc-api-call",unsupported:l}){const p=A(),[g,r]=m.useState("curl");if(!i)return e.jsx("p",{className:"gc-fineprint",children:l??"The gateway does not serve this model through its API."});const t=F(p,s,i),d=t.find(c=>c.id===g)??t[0];return e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsx(J,{id:o,label:"Request examples",value:d.id,onChange:r,className:"gc-connect-tabs",tabs:t.map(c=>({id:c.id,label:c.label}))}),e.jsx(ee,{tabsId:o,tab:d.id,children:e.jsx(B,{code:d.code,label:d.label})}),e.jsxs("p",{className:"gc-fineprint",children:["Set ",e.jsx("code",{children:V})," to one of your API keys first. ",e.jsx(w,{to:"keys",children:"API keys"})]})]})}function he(s){return s===null?"—":String(Math.round(s))}function E(s){return s===null?"—":Z(s)}function pe({model:s}){return e.jsxs("div",{className:"gc-badges",children:[s.free&&e.jsx(u,{tone:"success",children:"Free"}),s.teeSellers>0&&e.jsx(u,{tone:"info",children:"TEE"})]})}function y(s){return s.displayName??L(s.peerId,8,4)}function fe(){const s=$(),i=U(s.rest),o=R(),[l,p]=m.useState({search:"",type:"",free:!1}),g=m.useMemo(()=>se(o.data),[o.data]),r=m.useMemo(()=>i?ae(o.data,i):null,[o.data,i]),t=_(),d=(n,a)=>p(h=>({...h,[n]:a})),c=i===null?null:{eyebrow:"Model",title:(r==null?void 0:r.name)??i,body:o.isLoading?e.jsx(z,{rows:6}):r?e.jsx(ge,{model:r},r.id):e.jsx(f,{icon:e.jsx(M.models,{size:18}),title:"Model not found",body:`No provider on the network offers ${i} right now.`})},j=e.jsx(K,{flush:!0,children:e.jsx(Y,{query:o,rows:8,children:n=>e.jsx(de,{label:"Models",rows:ne(n,l),rowKey:a=>a.id,selectedKey:(r==null?void 0:r.id)??null,onRowClick:a=>k(S("models",a.id)),rowLabel:a=>a.name,actions:a=>[{label:"Copy model id",onSelect:()=>void t(a.id)}],initialSort:{key:"sellers",direction:"desc"},empty:e.jsx(f,{icon:e.jsx(M.models,{size:18}),title:n.length?"No models match these filters":"No models found yet",body:n.length?void 0:"The buyer is still discovering the network. Check back in a minute."}),columns:[{key:"model",header:"Model",sortValue:a=>a.name.toLowerCase(),render:a=>e.jsxs("div",{className:"gc-cell-lines",children:[e.jsx("div",{className:"gc-strong gc-ellipsis",title:a.id,children:a.name}),a.name!==a.id&&e.jsx("div",{className:"gc-muted gc-ellipsis",children:e.jsx(b,{children:a.id})}),e.jsx(pe,{model:a})]}),after:a=>e.jsx(q,{value:a.id,label:`Copy model id ${a.id}`})},{key:"type",header:"Type",secondary:!0,sortValue:a=>a.type,render:a=>e.jsx("span",{className:"gc-muted",children:P[a.type]})},{key:"sellers",header:"Providers",align:"right",sortValue:a=>a.sellers,render:a=>Q(a.sellers)},{key:"input",header:"Input $/M",align:"right",sortValue:a=>{var h;return((h=a.inputUsdPerMillion)==null?void 0:h.min)??null},render:a=>v(a.inputUsdPerMillion)},{key:"output",header:"Output $/M",align:"right",secondary:!0,sortValue:a=>{var h;return((h=a.outputUsdPerMillion)==null?void 0:h.min)??null},render:a=>v(a.outputUsdPerMillion)},{key:"context",header:"Context",align:"right",secondary:!0,optional:!0,sortValue:a=>a.contextLength,render:a=>E(a.contextLength)}]})})});return e.jsxs("div",{className:"gc-page",children:[e.jsx(O,{title:"Models",description:"Every model on the network. Open one to see its providers, copy a model id and get a ready-to-run API call."}),e.jsxs("div",{className:"gc-toolbar",children:[e.jsx(D,{size:"sm",type:"search","aria-label":"Search models",placeholder:"Search model or alias",value:l.search,onChange:n=>d("search",n.target.value)}),g.length>1&&e.jsx(T,{size:"sm","aria-label":"Filter by type",value:l.type,onChange:n=>d("type",n),options:[{value:"",label:"All types"},...g.map(n=>({value:n,label:P[n]}))]}),e.jsx(ce,{checked:l.free,onChange:n=>d("free",n),label:"Free"})]}),e.jsx(te,{list:j,panel:c,onClose:()=>k("models"),closeLabel:"Close model"})]})}function x(s){return`${s.peerId}:${s.serviceId}`}function ge({model:s}){const[i,o]=m.useState(""),l=s.offers.find(t=>x(t)===i)??null,p=l?I(l.peerId,l.serviceId):s.id,g=W(s.type,l),r=s.offers.some(t=>t.usdPerImage!==null);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gc-stack gc-stack--tight",children:[e.jsxs("span",{className:"gc-seller__meta",children:[e.jsxs("span",{className:"gc-peer-id",children:[e.jsx(b,{title:s.id,children:s.id}),e.jsx(N,{iconOnly:!0,value:s.id,label:"Copy model id"})]}),e.jsx(u,{children:P[s.type]}),s.free&&e.jsx(u,{tone:"success",children:"Free"}),s.teeSellers>0&&e.jsx(u,{tone:"info",children:"TEE"})]}),e.jsx(G,{items:[["Context",E(s.contextLength)],["Capabilities",s.capabilities.length?e.jsx("span",{className:"gc-badges",children:s.capabilities.map(t=>e.jsx(u,{children:ie[t]},t))}):"—"],["Aliases",s.aliases.length?e.jsx(b,{children:s.aliases.join(", ")}):"—"],...r?[]:[["Input $/M",v(s.inputUsdPerMillion)],["Output $/M",v(s.outputUsdPerMillion)]]]})]}),e.jsx(C,{title:`Providers (${s.offers.length})`,children:s.offers.length===0?e.jsx("p",{className:"gc-fineprint",children:"No provider offers this model right now."}):e.jsx("ul",{className:"gc-panel-rows","aria-label":"Providers offering this model",children:s.offers.map(t=>{var j;const d=I(t.peerId,t.serviceId),c=i===x(t);return e.jsx(le,{selected:c,title:e.jsx(w,{to:S("providers",t.peerId),children:y(t)}),meta:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:oe(t)}),e.jsxs("span",{children:["Trust ",he(t.trustScore)]}),t.latencyMsP50!==null&&e.jsx("span",{children:X(t.latencyMsP50)}),t.serviceId!==s.id&&e.jsx(b,{children:t.serviceId})]}),badges:(((j=t.verificationLinks)==null?void 0:j.length)||t.tee||t.free)&&e.jsxs("div",{className:"gc-badges",children:[e.jsx(re,{links:t.verificationLinks}),t.tee&&e.jsx(u,{tone:"info",children:"TEE"}),t.free&&e.jsx(u,{tone:"success",children:"Free"})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(N,{iconOnly:!0,value:d,label:`Copy ${y(t)}'s model id (peer@model)`}),e.jsx(H,{size:"sm",variant:c?"outline":"ghost","aria-pressed":c,title:"Use this provider in the API call below",onClick:()=>o(c?"":x(t)),children:c?"Pinned":"Pin"})]})},x(t))})})}),e.jsxs(C,{title:"API call",actions:s.offers.length>0&&e.jsx(T,{size:"sm","aria-label":"Route the call",value:i,onChange:o,options:[{value:"",label:"Best provider (automatic)"},...s.offers.map(t=>({value:x(t),label:y(t)}))]}),children:[e.jsx("p",{className:"gc-fineprint",children:l?e.jsxs(e.Fragment,{children:["Pinned to ",y(l)," with ",e.jsx("code",{children:L(p,10,12)}),"."]}):e.jsxs(e.Fragment,{children:["The gateway picks the best provider for ",e.jsx("code",{children:s.id})," under your routing policy."]})}),e.jsx(ue,{id:"gc-model-call",model:p,format:g,unsupported:`${P[s.type]} models are not served through the gateway's /v1 API.`})]})]})}export{fe as default};