@cedros/login-react 0.0.1 → 0.0.2

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 (147) hide show
  1. package/README.md +142 -2
  2. package/dist/AuthenticationSettings-CMQhep61.js +9 -0
  3. package/dist/AuthenticationSettings-CMQhep61.js.map +1 -0
  4. package/dist/AuthenticationSettings-Cro76kIC.cjs +1 -0
  5. package/dist/AuthenticationSettings-Cro76kIC.cjs.map +1 -0
  6. package/dist/CreditSystemSettings-AM7qDk1E.js +9 -0
  7. package/dist/CreditSystemSettings-AM7qDk1E.js.map +1 -0
  8. package/dist/CreditSystemSettings-CGR-uzuh.cjs +1 -0
  9. package/dist/CreditSystemSettings-CGR-uzuh.cjs.map +1 -0
  10. package/dist/DepositsSection-BVNd63B7.js +47 -0
  11. package/dist/DepositsSection-BVNd63B7.js.map +1 -0
  12. package/dist/DepositsSection-Ct1gjgIg.cjs +1 -0
  13. package/dist/DepositsSection-Ct1gjgIg.cjs.map +1 -0
  14. package/dist/EmailRegisterForm-B-ys4E3C.cjs +1 -0
  15. package/dist/EmailRegisterForm-B-ys4E3C.cjs.map +1 -0
  16. package/dist/EmailRegisterForm-BChCiZ5B.js +961 -0
  17. package/dist/EmailRegisterForm-BChCiZ5B.js.map +1 -0
  18. package/dist/EmailSettings-DFZ13JbX.cjs +1 -0
  19. package/dist/EmailSettings-DFZ13JbX.cjs.map +1 -0
  20. package/dist/EmailSettings-Di4GSWgb.js +9 -0
  21. package/dist/EmailSettings-Di4GSWgb.js.map +1 -0
  22. package/dist/EmbeddedWalletSettings-Cmn_aVL7.js +9 -0
  23. package/dist/EmbeddedWalletSettings-Cmn_aVL7.js.map +1 -0
  24. package/dist/EmbeddedWalletSettings-DRWeIJKb.cjs +1 -0
  25. package/dist/EmbeddedWalletSettings-DRWeIJKb.cjs.map +1 -0
  26. package/dist/{ErrorMessage-Bm1j5mBT.js → ErrorMessage-C8vKB0JG.js} +9 -9
  27. package/dist/ErrorMessage-C8vKB0JG.js.map +1 -0
  28. package/dist/ErrorMessage-CntMyn93.cjs.map +1 -1
  29. package/dist/{GoogleLoginButton-CvDoOc-0.js → GoogleLoginButton-Ceo2sYvX.js} +1 -1
  30. package/dist/{GoogleLoginButton-CvDoOc-0.js.map → GoogleLoginButton-Ceo2sYvX.js.map} +1 -1
  31. package/dist/ServerSettings-D8w8EpoE.cjs +1 -0
  32. package/dist/ServerSettings-D8w8EpoE.cjs.map +1 -0
  33. package/dist/ServerSettings-Wg_odW46.js +9 -0
  34. package/dist/ServerSettings-Wg_odW46.js.map +1 -0
  35. package/dist/{SolanaLoginButton-h32xN2PQ.js → SolanaLoginButton-CqVOcPa7.js} +1 -1
  36. package/dist/{SolanaLoginButton-h32xN2PQ.js.map → SolanaLoginButton-CqVOcPa7.js.map} +1 -1
  37. package/dist/TeamSection-Bj89WSC0.js +128 -0
  38. package/dist/TeamSection-Bj89WSC0.js.map +1 -0
  39. package/dist/TeamSection-DQ4nfUHN.cjs +1 -0
  40. package/dist/TeamSection-DQ4nfUHN.cjs.map +1 -0
  41. package/dist/UsersSection-BiZceDV3.cjs +1 -0
  42. package/dist/UsersSection-BiZceDV3.cjs.map +1 -0
  43. package/dist/UsersSection-W19ddPsw.js +81 -0
  44. package/dist/UsersSection-W19ddPsw.js.map +1 -0
  45. package/dist/WebhookSettings-a1c4iMvr.js +9 -0
  46. package/dist/WebhookSettings-a1c4iMvr.js.map +1 -0
  47. package/dist/WebhookSettings-onJWLytD.cjs +1 -0
  48. package/dist/WebhookSettings-onJWLytD.cjs.map +1 -0
  49. package/dist/WithdrawalsSection-BBw9gWMR.js +20 -0
  50. package/dist/WithdrawalsSection-BBw9gWMR.js.map +1 -0
  51. package/dist/WithdrawalsSection-Cws8inf6.cjs +1 -0
  52. package/dist/WithdrawalsSection-Cws8inf6.cjs.map +1 -0
  53. package/dist/admin/AdminShell.d.ts +38 -0
  54. package/dist/admin/icons.d.ts +2 -0
  55. package/dist/admin/index.d.ts +10 -0
  56. package/dist/admin/plugin.d.ts +3 -0
  57. package/dist/admin/sections/AuthenticationSettings.d.ts +3 -0
  58. package/dist/admin/sections/CreditSystemSettings.d.ts +3 -0
  59. package/dist/admin/sections/DepositsSection.d.ts +3 -0
  60. package/dist/admin/sections/EmailSettings.d.ts +3 -0
  61. package/dist/admin/sections/EmbeddedWalletSettings.d.ts +3 -0
  62. package/dist/admin/sections/FeatureSettings.d.ts +3 -0
  63. package/dist/admin/sections/InvitesSection.d.ts +3 -0
  64. package/dist/admin/sections/MembersSection.d.ts +3 -0
  65. package/dist/admin/sections/ServerSettings.d.ts +3 -0
  66. package/dist/admin/sections/SettingsSections.d.ts +7 -0
  67. package/dist/admin/sections/TeamSection.d.ts +3 -0
  68. package/dist/admin/sections/UsersSection.d.ts +3 -0
  69. package/dist/admin/sections/WebhookSettings.d.ts +3 -0
  70. package/dist/admin/sections/WithdrawalsSection.d.ts +3 -0
  71. package/dist/admin/types.d.ts +167 -0
  72. package/dist/components/admin/AdminUserDetail.d.ts +3 -1
  73. package/dist/components/admin/AdminUserList.d.ts +3 -7
  74. package/dist/components/admin/CedrosAdminDashboard.d.ts +7 -3
  75. package/dist/components/admin/PermissionsSection.d.ts +7 -0
  76. package/dist/components/admin/ProfileDropdown.d.ts +34 -0
  77. package/dist/components/admin/SetupWizard.d.ts +30 -0
  78. package/dist/components/admin/StatsBar.d.ts +17 -0
  79. package/dist/components/admin/settings/AuthenticationSettings.d.ts +4 -0
  80. package/dist/components/admin/settings/AutosaveStatus.d.ts +6 -0
  81. package/dist/components/admin/settings/CreditSystemSettings.d.ts +6 -0
  82. package/dist/components/admin/settings/EmailSettings.d.ts +4 -0
  83. package/dist/components/admin/settings/EmbeddedWalletSettings.d.ts +4 -0
  84. package/dist/components/admin/settings/FeatureSettings.d.ts +4 -0
  85. package/dist/components/admin/settings/MessagingSettings.d.ts +4 -0
  86. package/dist/components/admin/settings/SecuritySettings.d.ts +4 -0
  87. package/dist/components/admin/settings/ServerSettings.d.ts +4 -0
  88. package/dist/components/admin/settings/SettingsPageLayout.d.ts +16 -0
  89. package/dist/components/admin/settings/SsoProvidersSettings.d.ts +4 -0
  90. package/dist/components/admin/settings/WebhookSettings.d.ts +4 -0
  91. package/dist/components/admin/settings/index.d.ts +31 -0
  92. package/dist/components/admin/settings/settingsInputs.d.ts +79 -0
  93. package/dist/components/admin/settings/settingsMetadata.d.ts +18 -0
  94. package/dist/components/deposit/admin/AdminWithdrawalStats.d.ts +10 -0
  95. package/dist/components/deposit/admin/FeatureDisabledMessage.d.ts +15 -0
  96. package/dist/components/deposit/admin/featureDisabled.d.ts +9 -0
  97. package/dist/components/deposit/admin/index.d.ts +5 -0
  98. package/dist/components/invites/InviteForm.d.ts +1 -1
  99. package/dist/components/org/OrgSelector.d.ts +2 -1
  100. package/dist/components/profile/UserProfileSettings.d.ts +35 -0
  101. package/dist/components/profile/index.d.ts +2 -0
  102. package/dist/crypto/secureWipe.d.ts +0 -19
  103. package/dist/crypto/webauthnPrf.d.ts +0 -10
  104. package/dist/email-only.cjs +1 -1
  105. package/dist/email-only.js +2 -2
  106. package/dist/google-only.js +2 -2
  107. package/dist/hooks/useDashboardPermissions.d.ts +45 -0
  108. package/dist/hooks/useProfile.d.ts +35 -0
  109. package/dist/hooks/useServerFeatures.d.ts +55 -0
  110. package/dist/hooks/useSettingsAutosave.d.ts +29 -0
  111. package/dist/hooks/useSetup.d.ts +25 -0
  112. package/dist/hooks/useSsoProviders.d.ts +52 -0
  113. package/dist/index-BHR_WTP2.js +19636 -0
  114. package/dist/index-BHR_WTP2.js.map +1 -0
  115. package/dist/index-JsIJkPin.cjs +2061 -0
  116. package/dist/index-JsIJkPin.cjs.map +1 -0
  117. package/dist/index.cjs +1 -2061
  118. package/dist/index.cjs.map +1 -1
  119. package/dist/index.d.ts +21 -3
  120. package/dist/index.js +117 -14908
  121. package/dist/index.js.map +1 -1
  122. package/dist/login-react.css +1 -1
  123. package/dist/silentWalletEnroll-CQK5i65l.js +42 -0
  124. package/dist/silentWalletEnroll-CQK5i65l.js.map +1 -0
  125. package/dist/silentWalletEnroll-DBfS2sLe.cjs +1 -0
  126. package/dist/silentWalletEnroll-DBfS2sLe.cjs.map +1 -0
  127. package/dist/solana-only.js +2 -2
  128. package/dist/solanaKeypair-BD7Kq1Mw.js +1932 -0
  129. package/dist/solanaKeypair-BD7Kq1Mw.js.map +1 -0
  130. package/dist/solanaKeypair-CBQxm2hw.cjs +1 -0
  131. package/dist/solanaKeypair-CBQxm2hw.cjs.map +1 -0
  132. package/dist/types/adminUser.d.ts +56 -0
  133. package/dist/types/deposit.d.ts +2 -0
  134. package/dist/types/index.d.ts +4 -2
  135. package/dist/types/org.d.ts +34 -2
  136. package/dist/types/profile.d.ts +56 -0
  137. package/dist/types/setup.d.ts +45 -0
  138. package/dist/types/systemSettings.d.ts +5 -1
  139. package/dist/utils/adminUserApi.d.ts +10 -1
  140. package/dist/utils/profileApi.d.ts +26 -0
  141. package/dist/utils/setupApi.d.ts +21 -0
  142. package/package.json +1 -1
  143. package/dist/EmailRegisterForm-D_uCEdX9.cjs +0 -1
  144. package/dist/EmailRegisterForm-D_uCEdX9.cjs.map +0 -1
  145. package/dist/EmailRegisterForm-m3rX3A6X.js +0 -2923
  146. package/dist/EmailRegisterForm-m3rX3A6X.js.map +0 -1
  147. package/dist/ErrorMessage-Bm1j5mBT.js.map +0 -1
@@ -0,0 +1 @@
1
+ "use strict";const P=require("./ErrorMessage-CntMyn93.cjs");var dt=typeof document<"u"?document.currentScript:null;let F=null,ve=0;const nt=new Map;function Re(){return typeof Worker>"u"?null:(F||(F=new Worker(new URL(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/argon2Worker-Bi5TuQvD.js").href:new URL("assets/argon2Worker-Bi5TuQvD.js",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),typeof document>"u"?require("url").pathToFileURL(__filename).href:dt&&dt.tagName.toUpperCase()==="SCRIPT"&&dt.src||new URL("solanaKeypair-CBQxm2hw.cjs",document.baseURI).href),{type:"module"}),F.onmessage=e=>{const{id:t,key:n,error:o}=e.data,r=nt.get(t);if(r){if(nt.delete(t),o){r.reject(new Error(o));return}if(!n){r.reject(new Error("Argon2 worker returned no key"));return}r.resolve(n)}},F.onerror=e=>{const t=e instanceof ErrorEvent?e.error:new Error("Argon2 worker error");for(const n of nt.values())n.reject(t instanceof Error?t:new Error(String(t)));nt.clear(),F?.terminate(),F=null}),F)}async function Ae(e,t,n=P.DEFAULT_KDF_PARAMS){const o=Re();return o?new Promise((r,s)=>{const a=ve++;nt.set(a,{resolve:r,reject:s});const u={id:a,password:e,salt:t,params:n};o.postMessage(u)}):P.argon2Derive(e,t,n)}function ee(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ie(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function o(){var r=!1;try{r=this instanceof o}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}),n}var ct={exports:{}};const _e=globalThis.crypto,Ne=globalThis.crypto,Te=globalThis.crypto.subtle,Ce=globalThis.crypto.getRandomValues.bind(globalThis.crypto),Oe=globalThis.crypto.randomUUID.bind(globalThis.crypto),Le=Object.freeze(Object.defineProperty({__proto__:null,default:_e,getRandomValues:Ce,randomUUID:Oe,subtle:Te,webcrypto:Ne},Symbol.toStringTag,{value:"Module"})),Ue=Ie(Le);var He=ct.exports,Ht;function De(){return Ht||(Ht=1,(function(e,t){(function(n,o){e.exports=o(Ue)})(He,function(n){var o,r,s,a,u;function i(){o={bits:8,radix:16,minBits:3,maxBits:20,bytesPerChar:2,maxBytesPerChar:6,primitivePolynomials:[null,null,1,3,3,5,3,3,29,17,9,5,83,27,43,3,45,9,39,39,9,5,3,33,27,9,71,39,9,5,83]},r={},s=new Array(1024).join("0"),a=!0,u=["nodeCryptoRandomBytes","browserCryptoGetRandomValues","testRandom"]}function x(){return!!(r&&r.rng&&typeof r.rng=="function")}function y(f,h){var c;if(h===0||h===1)return f;if(h&&h>1024)throw new Error("Padding must be multiples of no larger than 1024 bits.");return h=h||r.bits,f&&(c=f.length%h),c?(s+f).slice(-(h-c+f.length)):f}function w(f){var h="",c,l;for(l=f.length-1;l>=0;l--){if(c=parseInt(f[l],16),isNaN(c))throw new Error("Invalid hex character.");h=y(c.toString(2),4)+h}return h}function S(f){var h="",c,l;for(f=y(f,4),l=f.length;l>=4;l-=4){if(c=parseInt(f.slice(l-4,l),2),isNaN(c))throw new Error("Invalid binary character.");h=c.toString(16)+h}return h}function I(){return!!(n&&typeof n=="object"&&(typeof n.getRandomValues=="function"||typeof n.getRandomValues=="object")&&(typeof Uint32Array=="function"||typeof Uint32Array=="object"))}function v(){return typeof n=="object"&&typeof n.randomBytes=="function"}function T(f){function h(b,g,m,B){var A=0,O,L="",q;for(g&&(O=g.length-1);A<O||L.length<b;)q=Math.abs(parseInt(g[A],m)),L=L+y(q.toString(2),B),A++;return L=L.substr(-b),(L.match(/0/g)||[]).length===L.length?null:L}function c(b){var g,m,B,A,O=null;for(B=16,A=4,m=Math.ceil(b/8);O===null;)g=n.randomBytes(m),O=h(b,g.toString("hex"),B,A);return O}function l(b){var g,m,B,A=null;for(m=10,B=32,g=Math.ceil(b/32);A===null;)A=h(b,n.getRandomValues(new Uint32Array(g)),m,B);return A}function d(b){var g,m,B,A,O,L=null;A=10,O=32,m=Math.ceil(b/32),B=123456789,g=new Uint32Array(m);for(var q=0;q<g.length;q++)g[q]=B;for(;L===null;)L=h(b,g,A,O);return L}if(f&&f==="testRandom")return r.typeCSPRNG=f,d;if(f&&f==="nodeCryptoRandomBytes")return r.typeCSPRNG=f,c;if(f&&f==="browserCryptoGetRandomValues")return r.typeCSPRNG=f,l;if(v())return r.typeCSPRNG="nodeCryptoRandomBytes",c;if(I())return r.typeCSPRNG="browserCryptoGetRandomValues",l}function _(f,h){var c=[],l;for(h&&(f=y(f,h)),l=f.length;l>r.bits;l-=r.bits)c.push(parseInt(f.slice(l-r.bits,l),2));return c.push(parseInt(f.slice(0,l),2)),c}function E(f,h){var c=r.logs[f],l=0,d;for(d=h.length-1;d>=0;d--)l!==0?l=r.exps[(c+r.logs[l])%r.maxShares]^h[d]:l=h[d];return l}function R(f,h,c){var l=0,d,b,g,m;for(g=0,d=h.length;g<d;g++)if(c[g]){for(b=r.logs[c[g]],m=0;m<d;m++)if(g!==m){if(f===h[m]){b=-1;break}b=(b+r.logs[f^h[m]]-r.logs[h[g]^h[m]]+r.maxShares)%r.maxShares}l=b===-1?l:l^r.exps[b]}return l}function p(f,h,c){var l=[],d=[f],b,g;for(b=1;b<c;b++)d[b]=parseInt(r.rng(r.bits),2);for(b=1,g=h+1;b<g;b++)l[b-1]={x:b,y:E(b,d)};return l}function N(f,h,c){var l,d,b,g,m;if(h=parseInt(h,r.radix),f=parseInt(f,10)||r.bits,l=f.toString(36).toUpperCase(),b=Math.pow(2,f)-1,g=b.toString(r.radix).length,d=y(h.toString(r.radix),g),typeof h!="number"||h%1!==0||h<1||h>b)throw new Error("Share id must be an integer between 1 and "+b+", inclusive.");return m=l+d+c,m}var C={init:function(f,h){var c=[],l=[],d=1,b,g;if(i(),f&&(typeof f!="number"||f%1!==0||f<o.minBits||f>o.maxBits))throw new Error("Number of bits must be an integer between "+o.minBits+" and "+o.maxBits+", inclusive.");if(h&&u.indexOf(h)===-1)throw new Error("Invalid RNG type argument : '"+h+"'");for(r.radix=o.radix,r.bits=f||o.bits,r.size=Math.pow(2,r.bits),r.maxShares=r.size-1,b=o.primitivePolynomials[r.bits],g=0;g<r.size;g++)l[g]=d,c[d]=g,d=d<<1,d>=r.size&&(d=d^b,d=d&r.maxShares);if(r.logs=c,r.exps=l,h&&this.setRNG(h),x()||this.setRNG(),!x()||!r.bits||!r.size||!r.maxShares||!r.logs||!r.exps||r.logs.length!==r.size||r.exps.length!==r.size)throw new Error("Initialization failed.")},combine:function(f,h){var c,l,d,b,g="",m,B,A,O=[],L=[];for(h=h||0,c=0,d=f.length;c<d;c++){if(B=this.extractShareComponents(f[c]),m===void 0)m=B.bits;else if(B.bits!==m)throw new Error("Mismatched shares: Different bit settings.");if(r.bits!==m&&this.init(m),O.indexOf(B.id)===-1)for(O.push(B.id),A=_(w(B.data)),l=0,b=A.length;l<b;l++)L[l]=L[l]||[],L[l][O.length-1]=A[l]}for(c=0,d=L.length;c<d;c++)g=y(R(h,O,L[c]).toString(2))+g;return S(h>=1?g:g.slice(g.indexOf("1")+1))},getConfig:function(){var f={};return f.radix=r.radix,f.bits=r.bits,f.maxShares=r.maxShares,f.hasCSPRNG=x(),f.typeCSPRNG=r.typeCSPRNG,f},extractShareComponents:function(f){var h,c,l,d,b={},g,m;if(h=parseInt(f.substr(0,1),36),h&&(typeof h!="number"||h%1!==0||h<o.minBits||h>o.maxBits))throw new Error("Invalid share : Number of bits must be an integer between "+o.minBits+" and "+o.maxBits+", inclusive.");if(d=Math.pow(2,h)-1,l=(Math.pow(2,h)-1).toString(r.radix).length,g="^([a-kA-K3-9]{1})([a-fA-F0-9]{"+l+"})([a-fA-F0-9]+)$",m=new RegExp(g).exec(f),m&&(c=parseInt(m[2],r.radix)),typeof c!="number"||c%1!==0||c<1||c>d)throw new Error("Invalid share : Share id must be an integer between 1 and "+r.maxShares+", inclusive.");if(m&&m[3])return b.bits=h,b.id=c,b.data=m[3],b;throw new Error("The share data provided is invalid : "+f)},setRNG:function(f){var h="Random number generator is invalid ",c=" Supply an CSPRNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.";if(f&&typeof f=="string"&&u.indexOf(f)===-1)throw new Error("Invalid RNG type argument : '"+f+"'");if(f||(f=T()),f&&typeof f=="string"&&(f=T(f)),a){if(f&&typeof f!="function")throw new Error(h+"(Not a function)."+c);if(f&&typeof f(r.bits)!="string")throw new Error(h+"(Output is not a string)."+c);if(f&&!parseInt(f(r.bits),2))throw new Error(h+"(Binary string output not parseable to an Integer)."+c);if(f&&f(r.bits).length>r.bits)throw new Error(h+"(Output length is greater than config.bits)."+c);if(f&&f(r.bits).length<r.bits)throw new Error(h+"(Output length is less than config.bits)."+c)}return r.rng=f,!0},str2hex:function(f,h){var c,l,d="",b,g,m,B;if(typeof f!="string")throw new Error("Input must be a character string.");if(h||(h=o.bytesPerChar),typeof h!="number"||h<1||h>o.maxBytesPerChar||h%1!==0)throw new Error("Bytes per character must be an integer between 1 and "+o.maxBytesPerChar+", inclusive.");for(c=2*h,l=Math.pow(16,c)-1,m=0,B=f.length;m<B;m++){if(g=f[m].charCodeAt(),isNaN(g))throw new Error("Invalid character: "+f[m]);if(g>l)throw b=Math.ceil(Math.log(g+1)/Math.log(256)),new Error("Invalid character code ("+g+"). Maximum allowable is 256^bytes-1 ("+l+"). To convert this character, use at least "+b+" bytes.");d=y(g.toString(16),c)+d}return d},hex2str:function(f,h){var c,l="",d,b;if(typeof f!="string")throw new Error("Input must be a hexadecimal string.");if(h=h||o.bytesPerChar,typeof h!="number"||h%1!==0||h<1||h>o.maxBytesPerChar)throw new Error("Bytes per character must be an integer between 1 and "+o.maxBytesPerChar+", inclusive.");for(c=2*h,f=y(f,c),d=0,b=f.length;d<b;d+=c)l=String.fromCharCode(parseInt(f.slice(d,d+c),16))+l;return l},random:function(f){if(typeof f!="number"||f%1!==0||f<2||f>65536)throw new Error("Number of bits must be an Integer between 1 and 65536.");return S(r.rng(f))},share:function(f,h,c,l){var d,b,g=new Array(h),m=new Array(h),B,A,O;if(l=l||128,typeof f!="string")throw new Error("Secret must be a string.");if(typeof h!="number"||h%1!==0||h<2)throw new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive.");if(h>r.maxShares)throw d=Math.ceil(Math.log(h+1)/Math.LN2),new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive. To create "+h+" shares, use at least "+d+" bits.");if(typeof c!="number"||c%1!==0||c<2)throw new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive.");if(c>r.maxShares)throw d=Math.ceil(Math.log(c+1)/Math.LN2),new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive. To use a threshold of "+c+", use at least "+d+" bits.");if(c>h)throw new Error("Threshold number of shares was "+c+" but must be less than or equal to the "+h+" shares specified as the total to generate.");if(typeof l!="number"||l%1!==0||l<0||l>1024)throw new Error("Zero-pad length must be an integer between 0 and 1024 inclusive.");for(f="1"+w(f),f=_(f,l),B=0,O=f.length;B<O;B++)for(b=p(f[B],h,c),A=0;A<h;A++)g[A]=g[A]||b[A].x.toString(r.radix),m[A]=y(b[A].y.toString(2))+(m[A]||"");for(B=0;B<h;B++)g[B]=N(r.bits,g[B],S(m[B]));return g},newShare:function(f,h){var c,l;if(f&&typeof f=="string"&&(f=parseInt(f,r.radix)),l=f.toString(r.radix),f&&l&&h&&h[0])return c=this.extractShareComponents(h[0]),N(c.bits,l,this.combine(h,f));throw new Error("Invalid 'id' or 'shares' Array argument to newShare().")},_reset:i,_padLeft:y,_hex2bin:w,_bin2hex:S,_hasCryptoGetRandomValues:I,_hasCryptoRandomBytes:v,_getRNG:T,_isSetRNG:x,_splitNumStringToIntArray:_,_horner:E,_lagrange:R,_getShares:p,_constructPublicShareString:N};return C.init(),C})})(ct)),ct.exports}var qe=De();const ne=ee(qe),Me=2,Ge=3;function $e(e){if(e.length!==16)throw new Error(`Invalid seed length: expected 16, got ${e.length}`);const t=re(e),n=ne.share(t,Ge,Me);if(n.length!==3)throw new Error(`Unexpected share count: ${n.length}`);const o=bt(n[0]),r=bt(n[1]),s=bt(n[2]);return{shareA:P.toShamirShare(o),shareB:P.toShamirShare(r),shareC:P.toShamirShare(s)}}function Ze(e,t){const n=Dt(e),o=Dt(t);try{const r=ne.combine([n,o]),s=oe(r);if(s.length!==16)throw new Error(`Reconstructed seed has wrong length: ${s.length}`);return P.toSeed(s)}catch{throw new Error("Failed to reconstruct seed from shares")}}function re(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function oe(e){if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("Invalid hex string: contains non-hex characters");if(e.length%2!==0)throw new Error(`Invalid hex string: length ${e.length} is odd (must be even)`);const t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++)t[n]=parseInt(e.substr(n*2,2),16);return t}function bt(e){const t=e.length%2===0?e:"0"+e;return oe(t)}function Dt(e){const t=re(e);return t.startsWith("0")&&!t.startsWith("00")?t.substring(1):t}function je(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ht(e,...t){if(!je(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function qt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ve(e,t){ht(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Bt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function gt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Z(e,t){return e<<32-t|e>>>t}function ke(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function se(e){return typeof e=="string"&&(e=ke(e)),ht(e),e}class Ke{}function Ye(e){const t=o=>e().update(se(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ze(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);const r=BigInt(32),s=BigInt(4294967295),a=Number(n>>r&s),u=Number(n&s),i=o?4:0,x=o?0:4;e.setUint32(t+i,a,o),e.setUint32(t+x,u,o)}function Xe(e,t,n){return e&t^~e&n}function We(e,t,n){return e&t^e&n^t&n}let Pe=class extends Ke{constructor(t,n,o,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=r,this.buffer=new Uint8Array(t),this.view=gt(this.buffer)}update(t){qt(this),t=se(t),ht(t);const{view:n,buffer:o,blockLen:r}=this,s=t.length;for(let a=0;a<s;){const u=Math.min(r-this.pos,s-a);if(u===r){const i=gt(t);for(;r<=s-a;a+=r)this.process(i,a);continue}o.set(t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){qt(this),Ve(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:r,isLE:s}=this;let{pos:a}=this;n[a++]=128,Bt(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(o,0),a=0);for(let w=a;w<r;w++)n[w]=0;ze(o,r-8,BigInt(this.length*8),s),this.process(o,0);const u=gt(t),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const x=i/4,y=this.get();if(x>y.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<x;w++)u.setUint32(4*w,y[w],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:o,length:r,finished:s,destroyed:a,pos:u}=this;return t.destroyed=a,t.finished=s,t.length=r,t.pos=u,r%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}};const K=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Fe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Y=new Uint32Array(64);class Qe extends Pe{constructor(t=32){super(64,t,8,!1),this.A=K[0]|0,this.B=K[1]|0,this.C=K[2]|0,this.D=K[3]|0,this.E=K[4]|0,this.F=K[5]|0,this.G=K[6]|0,this.H=K[7]|0}get(){const{A:t,B:n,C:o,D:r,E:s,F:a,G:u,H:i}=this;return[t,n,o,r,s,a,u,i]}set(t,n,o,r,s,a,u,i){this.A=t|0,this.B=n|0,this.C=o|0,this.D=r|0,this.E=s|0,this.F=a|0,this.G=u|0,this.H=i|0}process(t,n){for(let w=0;w<16;w++,n+=4)Y[w]=t.getUint32(n,!1);for(let w=16;w<64;w++){const S=Y[w-15],I=Y[w-2],v=Z(S,7)^Z(S,18)^S>>>3,T=Z(I,17)^Z(I,19)^I>>>10;Y[w]=T+Y[w-7]+v+Y[w-16]|0}let{A:o,B:r,C:s,D:a,E:u,F:i,G:x,H:y}=this;for(let w=0;w<64;w++){const S=Z(u,6)^Z(u,11)^Z(u,25),I=y+S+Xe(u,i,x)+Fe[w]+Y[w]|0,T=(Z(o,2)^Z(o,13)^Z(o,22))+We(o,r,s)|0;y=x,x=i,i=u,u=a+I|0,a=s,s=r,r=o,o=I+T|0}o=o+this.A|0,r=r+this.B|0,s=s+this.C|0,a=a+this.D|0,u=u+this.E|0,i=i+this.F|0,x=x+this.G|0,y=y+this.H|0,this.set(o,r,s,a,u,i,x,y)}roundClean(){Bt(Y)}destroy(){this.set(0,0,0,0,0,0,0,0),Bt(this.buffer)}}const ie=Ye(()=>new Qe);function ce(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function It(e,t=""){if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function D(e,t,n=""){const o=ce(e),r=e?.length,s=t!==void 0;if(!o||s&&r!==t){const a=n&&`"${n}" `,u=s?` of length ${t}`:"",i=o?`length=${r}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+u+", got "+i)}return e}function Mt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Je(e,t){D(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function St(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function wt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const fe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",tn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _t(e){if(D(e),fe)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=tn[e[n]];return t}const V={_0:48,_9:57,A:65,F:70,a:97,f:102};function Gt(e){if(e>=V._0&&e<=V._9)return e-V._0;if(e>=V.A&&e<=V.F)return e-(V.A-10);if(e>=V.a&&e<=V.f)return e-(V.a-10)}function ae(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(fe)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const o=new Uint8Array(n);for(let r=0,s=0;r<n;r++,s+=2){const a=Gt(e.charCodeAt(s)),u=Gt(e.charCodeAt(s+1));if(a===void 0||u===void 0){const i=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+i+'" at index '+s)}o[r]=a*16+u}return o}function $t(...e){let t=0;for(let o=0;o<e.length;o++){const r=e[o];D(r),t+=r.length}const n=new Uint8Array(t);for(let o=0,r=0;o<e.length;o++){const s=e[o];n.set(s,r),r+=s.length}return n}function en(e,t={}){const n=(r,s)=>e(s).update(r).digest(),o=e(void 0);return n.outputLen=o.outputLen,n.blockLen=o.blockLen,n.create=r=>e(r),Object.assign(n,t),Object.freeze(n)}function nn(e=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}const rn=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});class on{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,o,r){this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=r,this.buffer=new Uint8Array(t),this.view=wt(this.buffer)}update(t){Mt(this),D(t);const{view:n,buffer:o,blockLen:r}=this,s=t.length;for(let a=0;a<s;){const u=Math.min(r-this.pos,s-a);if(u===r){const i=wt(t);for(;r<=s-a;a+=r)this.process(i,a);continue}o.set(t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Mt(this),Je(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:r,isLE:s}=this;let{pos:a}=this;n[a++]=128,St(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(o,0),a=0);for(let w=a;w<r;w++)n[w]=0;o.setBigUint64(r-8,BigInt(this.length*8),s),this.process(o,0);const u=wt(t),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const x=i/4,y=this.get();if(x>y.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<x;w++)u.setUint32(4*w,y[w],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:n,buffer:o,length:r,finished:s,destroyed:a,pos:u}=this;return t.destroyed=a,t.finished=s,t.length=r,t.pos=u,r%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const M=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ot=BigInt(2**32-1),Zt=BigInt(32);function sn(e,t=!1){return t?{h:Number(e&ot),l:Number(e>>Zt&ot)}:{h:Number(e>>Zt&ot)|0,l:Number(e&ot)|0}}function cn(e,t=!1){const n=e.length;let o=new Uint32Array(n),r=new Uint32Array(n);for(let s=0;s<n;s++){const{h:a,l:u}=sn(e[s],t);[o[s],r[s]]=[a,u]}return[o,r]}const jt=(e,t,n)=>e>>>n,Vt=(e,t,n)=>e<<32-n|t>>>n,tt=(e,t,n)=>e>>>n|t<<32-n,et=(e,t,n)=>e<<32-n|t>>>n,st=(e,t,n)=>e<<64-n|t>>>n-32,it=(e,t,n)=>e>>>n-32|t<<64-n;function k(e,t,n,o){const r=(t>>>0)+(o>>>0);return{h:e+n+(r/2**32|0)|0,l:r|0}}const fn=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),an=(e,t,n,o)=>t+n+o+(e/2**32|0)|0,un=(e,t,n,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),hn=(e,t,n,o,r)=>t+n+o+r+(e/2**32|0)|0,ln=(e,t,n,o,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0)+(r>>>0),dn=(e,t,n,o,r,s)=>t+n+o+r+s+(e/2**32|0)|0,ue=cn(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),bn=ue[0],gn=ue[1],z=new Uint32Array(80),X=new Uint32Array(80);class wn extends on{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:n,Bh:o,Bl:r,Ch:s,Cl:a,Dh:u,Dl:i,Eh:x,El:y,Fh:w,Fl:S,Gh:I,Gl:v,Hh:T,Hl:_}=this;return[t,n,o,r,s,a,u,i,x,y,w,S,I,v,T,_]}set(t,n,o,r,s,a,u,i,x,y,w,S,I,v,T,_){this.Ah=t|0,this.Al=n|0,this.Bh=o|0,this.Bl=r|0,this.Ch=s|0,this.Cl=a|0,this.Dh=u|0,this.Dl=i|0,this.Eh=x|0,this.El=y|0,this.Fh=w|0,this.Fl=S|0,this.Gh=I|0,this.Gl=v|0,this.Hh=T|0,this.Hl=_|0}process(t,n){for(let p=0;p<16;p++,n+=4)z[p]=t.getUint32(n),X[p]=t.getUint32(n+=4);for(let p=16;p<80;p++){const N=z[p-15]|0,C=X[p-15]|0,f=tt(N,C,1)^tt(N,C,8)^jt(N,C,7),h=et(N,C,1)^et(N,C,8)^Vt(N,C,7),c=z[p-2]|0,l=X[p-2]|0,d=tt(c,l,19)^st(c,l,61)^jt(c,l,6),b=et(c,l,19)^it(c,l,61)^Vt(c,l,6),g=un(h,b,X[p-7],X[p-16]),m=hn(g,f,d,z[p-7],z[p-16]);z[p]=m|0,X[p]=g|0}let{Ah:o,Al:r,Bh:s,Bl:a,Ch:u,Cl:i,Dh:x,Dl:y,Eh:w,El:S,Fh:I,Fl:v,Gh:T,Gl:_,Hh:E,Hl:R}=this;for(let p=0;p<80;p++){const N=tt(w,S,14)^tt(w,S,18)^st(w,S,41),C=et(w,S,14)^et(w,S,18)^it(w,S,41),f=w&I^~w&T,h=S&v^~S&_,c=ln(R,C,h,gn[p],X[p]),l=dn(c,E,N,f,bn[p],z[p]),d=c|0,b=tt(o,r,28)^st(o,r,34)^st(o,r,39),g=et(o,r,28)^it(o,r,34)^it(o,r,39),m=o&s^o&u^s&u,B=r&a^r&i^a&i;E=T|0,R=_|0,T=I|0,_=v|0,I=w|0,v=S|0,{h:w,l:S}=k(x|0,y|0,l|0,d|0),x=u|0,y=i|0,u=s|0,i=a|0,s=o|0,a=r|0;const A=fn(d,g,B);o=an(A,l,b,m),r=A|0}({h:o,l:r}=k(this.Ah|0,this.Al|0,o|0,r|0)),{h:s,l:a}=k(this.Bh|0,this.Bl|0,s|0,a|0),{h:u,l:i}=k(this.Ch|0,this.Cl|0,u|0,i|0),{h:x,l:y}=k(this.Dh|0,this.Dl|0,x|0,y|0),{h:w,l:S}=k(this.Eh|0,this.El|0,w|0,S|0),{h:I,l:v}=k(this.Fh|0,this.Fl|0,I|0,v|0),{h:T,l:_}=k(this.Gh|0,this.Gl|0,T|0,_|0),{h:E,l:R}=k(this.Hh|0,this.Hl|0,E|0,R|0),this.set(o,r,s,a,u,i,x,y,w,S,I,v,T,_,E,R)}roundClean(){St(z,X)}destroy(){St(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class xn extends wn{Ah=M[0]|0;Al=M[1]|0;Bh=M[2]|0;Bl=M[3]|0;Ch=M[4]|0;Cl=M[5]|0;Dh=M[6]|0;Dl=M[7]|0;Eh=M[8]|0;El=M[9]|0;Fh=M[10]|0;Fl=M[11]|0;Gh=M[12]|0;Gl=M[13]|0;Hh=M[14]|0;Hl=M[15]|0;constructor(){super(64)}}const pn=en(()=>new xn,rn(3));const he=BigInt(0),kt=BigInt(1);function vt(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}" `;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function mn(e){if(typeof e=="bigint"){if(!ft(e))throw new Error("positive bigint expected, got "+e)}else It(e);return e}function le(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?he:BigInt("0x"+e)}function yn(e){return le(_t(e))}function at(e){return le(_t(Rt(D(e)).reverse()))}function de(e,t){It(t),e=mn(e);const n=ae(e.toString(16).padStart(t*2,"0"));if(n.length!==t)throw new Error("number too large");return n}function En(e,t){return de(e,t).reverse()}function Rt(e){return Uint8Array.from(e)}const ft=e=>typeof e=="bigint"&&he<=e;function Bn(e,t,n){return ft(e)&&ft(t)&&ft(n)&&t<=e&&e<n}function Kt(e,t,n,o){if(!Bn(t,n,o))throw new Error("expected valid "+e+": "+n+" <= n < "+o+", got "+t)}const Sn=e=>(kt<<BigInt(e))-kt;function Nt(e,t={},n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function o(s,a,u){const i=e[s];if(u&&i===void 0)return;const x=typeof i;if(x!==a||i===null)throw new Error(`param "${s}" is invalid: expected ${a}, got ${x}`)}const r=(s,a)=>Object.entries(s).forEach(([u,i])=>o(u,i,a));r(t,!1),r(n,!0)}function Yt(e){const t=new WeakMap;return(n,...o)=>{const r=t.get(n);if(r!==void 0)return r;const s=e(n,...o);return t.set(n,s),s}}const $=BigInt(0),G=BigInt(1),Q=BigInt(2),be=BigInt(3),ge=BigInt(4),we=BigInt(5),vn=BigInt(7),xe=BigInt(8),Rn=BigInt(9),pe=BigInt(16);function U(e,t){const n=e%t;return n>=$?n:t+n}function j(e,t,n){let o=e;for(;t-- >$;)o*=o,o%=n;return o}function zt(e,t){if(e===$)throw new Error("invert: expected non-zero number");if(t<=$)throw new Error("invert: expected positive modulus, got "+t);let n=U(e,t),o=t,r=$,s=G;for(;n!==$;){const u=o/n,i=o%n,x=r-s*u;o=n,n=i,r=s,s=x}if(o!==G)throw new Error("invert: does not exist");return U(r,t)}function Tt(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function me(e,t){const n=(e.ORDER+G)/ge,o=e.pow(t,n);return Tt(e,o,t),o}function An(e,t){const n=(e.ORDER-we)/xe,o=e.mul(t,Q),r=e.pow(o,n),s=e.mul(t,r),a=e.mul(e.mul(s,Q),r),u=e.mul(s,e.sub(a,e.ONE));return Tt(e,u,t),u}function In(e){const t=Ct(e),n=ye(e),o=n(t,t.neg(t.ONE)),r=n(t,o),s=n(t,t.neg(o)),a=(e+vn)/pe;return(u,i)=>{let x=u.pow(i,a),y=u.mul(x,o);const w=u.mul(x,r),S=u.mul(x,s),I=u.eql(u.sqr(y),i),v=u.eql(u.sqr(w),i);x=u.cmov(x,y,I),y=u.cmov(S,w,v);const T=u.eql(u.sqr(y),i),_=u.cmov(x,y,T);return Tt(u,_,i),_}}function ye(e){if(e<be)throw new Error("sqrt is not defined for small field");let t=e-G,n=0;for(;t%Q===$;)t/=Q,n++;let o=Q;const r=Ct(e);for(;Xt(r,o)===1;)if(o++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return me;let s=r.pow(o,t);const a=(t+G)/Q;return function(i,x){if(i.is0(x))return x;if(Xt(i,x)!==1)throw new Error("Cannot find square root");let y=n,w=i.mul(i.ONE,s),S=i.pow(x,t),I=i.pow(x,a);for(;!i.eql(S,i.ONE);){if(i.is0(S))return i.ZERO;let v=1,T=i.sqr(S);for(;!i.eql(T,i.ONE);)if(v++,T=i.sqr(T),v===y)throw new Error("Cannot find square root");const _=G<<BigInt(y-v-1),E=i.pow(w,_);y=v,w=i.sqr(E),S=i.mul(S,w),I=i.mul(I,E)}return I}}function _n(e){return e%ge===be?me:e%xe===we?An:e%pe===Rn?In(e):ye(e)}const Nn=(e,t)=>(U(e,t)&G)===G,Tn=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Cn(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=Tn.reduce((o,r)=>(o[r]="function",o),t);return Nt(e,n),e}function On(e,t,n){if(n<$)throw new Error("invalid exponent, negatives unsupported");if(n===$)return e.ONE;if(n===G)return t;let o=e.ONE,r=t;for(;n>$;)n&G&&(o=e.mul(o,r)),r=e.sqr(r),n>>=G;return o}function Ee(e,t,n=!1){const o=new Array(t.length).fill(n?e.ZERO:void 0),r=t.reduce((a,u,i)=>e.is0(u)?a:(o[i]=a,e.mul(a,u)),e.ONE),s=e.inv(r);return t.reduceRight((a,u,i)=>e.is0(u)?a:(o[i]=e.mul(a,o[i]),e.mul(a,u)),s),o}function Xt(e,t){const n=(e.ORDER-G)/Q,o=e.pow(t,n),r=e.eql(o,e.ONE),s=e.eql(o,e.ZERO),a=e.eql(o,e.neg(e.ONE));if(!r&&!s&&!a)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function Ln(e,t){t!==void 0&&It(t);const n=t!==void 0?t:e.toString(2).length,o=Math.ceil(n/8);return{nBitLength:n,nByteLength:o}}class Un{ORDER;BITS;BYTES;isLE;ZERO=$;ONE=G;_lengths;_sqrt;_mod;constructor(t,n={}){if(t<=$)throw new Error("invalid field: expected ORDER > 0, got "+t);let o;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(o=n.BITS),typeof n.sqrt=="function"&&(this.sqrt=n.sqrt),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=n.allowedLengths?.slice()),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));const{nBitLength:r,nByteLength:s}=Ln(t,o);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return U(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return $<=t&&t<this.ORDER}is0(t){return t===$}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&G)===G}neg(t){return U(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return U(t*t,this.ORDER)}add(t,n){return U(t+n,this.ORDER)}sub(t,n){return U(t-n,this.ORDER)}mul(t,n){return U(t*n,this.ORDER)}pow(t,n){return On(this,t,n)}div(t,n){return U(t*zt(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return zt(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=_n(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?En(t,this.BYTES):de(t,this.BYTES)}fromBytes(t,n=!1){D(t);const{_lengths:o,BYTES:r,isLE:s,ORDER:a,_mod:u}=this;if(o){if(!o.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);const x=new Uint8Array(r);x.set(t,s?0:x.length-t.length),t=x}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let i=s?at(t):yn(t);if(u&&(i=U(i,a)),!n&&!this.isValid(i))throw new Error("invalid field element: outside of range 0..ORDER");return i}invertBatch(t){return Ee(this,t)}cmov(t,n,o){return o?n:t}}function Ct(e,t={}){return new Un(e,t)}const ut=BigInt(0),At=BigInt(1);function Wt(e,t){const n=t.negate();return e?n:t}function xt(e,t){const n=Ee(e.Fp,t.map(o=>o.Z));return t.map((o,r)=>e.fromAffine(o.toAffine(n[r])))}function Be(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function pt(e,t){Be(e,t);const n=Math.ceil(t/e)+1,o=2**(e-1),r=2**e,s=Sn(e),a=BigInt(e);return{windows:n,windowSize:o,mask:s,maxNumber:r,shiftBy:a}}function Pt(e,t,n){const{windowSize:o,mask:r,maxNumber:s,shiftBy:a}=n;let u=Number(e&r),i=e>>a;u>o&&(u-=s,i+=At);const x=t*o,y=x+Math.abs(u)-1,w=u===0,S=u<0,I=t%2!==0;return{nextN:i,offset:y,isZero:w,isNeg:S,isNegF:I,offsetF:x}}const mt=new WeakMap,Se=new WeakMap;function yt(e){return Se.get(e)||1}function Ft(e){if(e!==ut)throw new Error("invalid wNAF")}class Hn{BASE;ZERO;Fn;bits;constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,o=this.ZERO){let r=t;for(;n>ut;)n&At&&(o=o.add(r)),r=r.double(),n>>=At;return o}precomputeWindow(t,n){const{windows:o,windowSize:r}=pt(n,this.bits),s=[];let a=t,u=a;for(let i=0;i<o;i++){u=a,s.push(u);for(let x=1;x<r;x++)u=u.add(a),s.push(u);a=u.double()}return s}wNAF(t,n,o){if(!this.Fn.isValid(o))throw new Error("invalid scalar");let r=this.ZERO,s=this.BASE;const a=pt(t,this.bits);for(let u=0;u<a.windows;u++){const{nextN:i,offset:x,isZero:y,isNeg:w,isNegF:S,offsetF:I}=Pt(o,u,a);o=i,y?s=s.add(Wt(S,n[I])):r=r.add(Wt(w,n[x]))}return Ft(o),{p:r,f:s}}wNAFUnsafe(t,n,o,r=this.ZERO){const s=pt(t,this.bits);for(let a=0;a<s.windows&&o!==ut;a++){const{nextN:u,offset:i,isZero:x,isNeg:y}=Pt(o,a,s);if(o=u,!x){const w=n[i];r=r.add(y?w.negate():w)}}return Ft(o),r}getPrecomputes(t,n,o){let r=mt.get(n);return r||(r=this.precomputeWindow(n,t),t!==1&&(typeof o=="function"&&(r=o(r)),mt.set(n,r))),r}cached(t,n,o){const r=yt(t);return this.wNAF(r,this.getPrecomputes(r,t,o),n)}unsafe(t,n,o,r){const s=yt(t);return s===1?this._unsafeLadder(t,n,r):this.wNAFUnsafe(s,this.getPrecomputes(s,t,o),n,r)}createCache(t,n){Be(n,this.bits),Se.set(t,n),mt.delete(t)}hasCache(t){return yt(t)!==1}}function Qt(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Cn(t),t}else return Ct(e,{isLE:n})}function Dn(e,t,n={},o){if(o===void 0&&(o=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const i of["p","n","h"]){const x=t[i];if(!(typeof x=="bigint"&&x>ut))throw new Error(`CURVE.${i} must be positive bigint`)}const r=Qt(t.p,n.Fp,o),s=Qt(t.n,n.Fn,o),u=["Gx","Gy","a","d"];for(const i of u)if(!r.isValid(t[i]))throw new Error(`CURVE.${i} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:s}}function qn(e,t){return function(o){const r=e(o);return{secretKey:r,publicKey:t(r)}}}const W=BigInt(0),H=BigInt(1),Et=BigInt(2),Mn=BigInt(8);function Gn(e,t,n,o){const r=e.sqr(n),s=e.sqr(o),a=e.add(e.mul(t.a,r),s),u=e.add(e.ONE,e.mul(t.d,e.mul(r,s)));return e.eql(a,u)}function $n(e,t={}){const n=Dn("edwards",e,t,t.FpFnLE),{Fp:o,Fn:r}=n;let s=n.CURVE;const{h:a}=s;Nt(t,{},{uvRatio:"function"});const u=Et<<BigInt(r.BYTES*8)-H,i=_=>o.create(_),x=t.uvRatio||((_,E)=>{try{return{isValid:!0,value:o.sqrt(o.div(_,E))}}catch{return{isValid:!1,value:W}}});if(!Gn(o,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function y(_,E,R=!1){const p=R?H:W;return Kt("coordinate "+_,E,p,u),E}function w(_){if(!(_ instanceof v))throw new Error("EdwardsPoint expected")}const S=Yt((_,E)=>{const{X:R,Y:p,Z:N}=_,C=_.is0();E==null&&(E=C?Mn:o.inv(N));const f=i(R*E),h=i(p*E),c=o.mul(N,E);if(C)return{x:W,y:H};if(c!==H)throw new Error("invZ was invalid");return{x:f,y:h}}),I=Yt(_=>{const{a:E,d:R}=s;if(_.is0())throw new Error("bad point: ZERO");const{X:p,Y:N,Z:C,T:f}=_,h=i(p*p),c=i(N*N),l=i(C*C),d=i(l*l),b=i(h*E),g=i(l*i(b+c)),m=i(d+i(R*i(h*c)));if(g!==m)throw new Error("bad point: equation left != right (1)");const B=i(p*N),A=i(C*f);if(B!==A)throw new Error("bad point: equation left != right (2)");return!0});class v{static BASE=new v(s.Gx,s.Gy,H,i(s.Gx*s.Gy));static ZERO=new v(W,H,H,W);static Fp=o;static Fn=r;X;Y;Z;T;constructor(E,R,p,N){this.X=y("x",E),this.Y=y("y",R),this.Z=y("z",p,!0),this.T=y("t",N),Object.freeze(this)}static CURVE(){return s}static fromAffine(E){if(E instanceof v)throw new Error("extended point not allowed");const{x:R,y:p}=E||{};return y("x",R),y("y",p),new v(R,p,H,i(R*p))}static fromBytes(E,R=!1){const p=o.BYTES,{a:N,d:C}=s;E=Rt(D(E,p,"point")),vt(R,"zip215");const f=Rt(E),h=E[p-1];f[p-1]=h&-129;const c=at(f),l=R?u:o.ORDER;Kt("point.y",c,W,l);const d=i(c*c),b=i(d-H),g=i(C*d-N);let{isValid:m,value:B}=x(b,g);if(!m)throw new Error("bad point: invalid y coordinate");const A=(B&H)===H,O=(h&128)!==0;if(!R&&B===W&&O)throw new Error("bad point: x=0 and x_0=1");return O!==A&&(B=i(-B)),v.fromAffine({x:B,y:c})}static fromHex(E,R=!1){return v.fromBytes(ae(E),R)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(E=8,R=!0){return T.createCache(this,E),R||this.multiply(Et),this}assertValidity(){I(this)}equals(E){w(E);const{X:R,Y:p,Z:N}=this,{X:C,Y:f,Z:h}=E,c=i(R*h),l=i(C*N),d=i(p*h),b=i(f*N);return c===l&&d===b}is0(){return this.equals(v.ZERO)}negate(){return new v(i(-this.X),this.Y,this.Z,i(-this.T))}double(){const{a:E}=s,{X:R,Y:p,Z:N}=this,C=i(R*R),f=i(p*p),h=i(Et*i(N*N)),c=i(E*C),l=R+p,d=i(i(l*l)-C-f),b=c+f,g=b-h,m=c-f,B=i(d*g),A=i(b*m),O=i(d*m),L=i(g*b);return new v(B,A,L,O)}add(E){w(E);const{a:R,d:p}=s,{X:N,Y:C,Z:f,T:h}=this,{X:c,Y:l,Z:d,T:b}=E,g=i(N*c),m=i(C*l),B=i(h*p*b),A=i(f*d),O=i((N+C)*(c+l)-g-m),L=A-B,q=A+B,J=i(m-R*g),rt=i(O*L),lt=i(q*J),Lt=i(O*J),Ut=i(L*q);return new v(rt,lt,Ut,Lt)}subtract(E){return this.add(E.negate())}multiply(E){if(!r.isValidNot0(E))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:R,f:p}=T.cached(this,E,N=>xt(v,N));return xt(v,[R,p])[0]}multiplyUnsafe(E,R=v.ZERO){if(!r.isValid(E))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return E===W?v.ZERO:this.is0()||E===H?this:T.unsafe(this,E,p=>xt(v,p),R)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return T.unsafe(this,s.n).is0()}toAffine(E){return S(this,E)}clearCofactor(){return a===H?this:this.multiplyUnsafe(a)}toBytes(){const{x:E,y:R}=this.toAffine(),p=o.toBytes(R);return p[p.length-1]|=E&H?128:0,p}toHex(){return _t(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const T=new Hn(v,r.BITS);return v.BASE.precompute(8),v}function Zn(e,t,n={}){if(typeof t!="function")throw new Error('"hash" function param is required');Nt(n,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:o}=n,{BASE:r,Fp:s,Fn:a}=e,u=n.randomBytes||nn,i=n.adjustScalarBytes||(c=>c),x=n.domain||((c,l,d)=>{if(vt(d,"phflag"),l.length||d)throw new Error("Contexts/pre-hash are not supported");return c});function y(c){return a.create(at(c))}function w(c){const l=p.secretKey;D(c,p.secretKey,"secretKey");const d=D(t(c),2*l,"hashedSecretKey"),b=i(d.slice(0,l)),g=d.slice(l,2*l),m=y(b);return{head:b,prefix:g,scalar:m}}function S(c){const{head:l,prefix:d,scalar:b}=w(c),g=r.multiply(b),m=g.toBytes();return{head:l,prefix:d,scalar:b,point:g,pointBytes:m}}function I(c){return S(c).pointBytes}function v(c=Uint8Array.of(),...l){const d=$t(...l);return y(t(x(d,D(c,void 0,"context"),!!o)))}function T(c,l,d={}){c=D(c,void 0,"message"),o&&(c=o(c));const{prefix:b,scalar:g,pointBytes:m}=S(l),B=v(d.context,b,c),A=r.multiply(B).toBytes(),O=v(d.context,A,m,c),L=a.create(B+O*g);if(!a.isValid(L))throw new Error("sign failed: invalid s");const q=$t(A,a.toBytes(L));return D(q,p.signature,"result")}const _={zip215:!0};function E(c,l,d,b=_){const{context:g,zip215:m}=b,B=p.signature;c=D(c,B,"signature"),l=D(l,void 0,"message"),d=D(d,p.publicKey,"publicKey"),m!==void 0&&vt(m,"zip215"),o&&(l=o(l));const A=B/2,O=c.subarray(0,A),L=at(c.subarray(A,B));let q,J,rt;try{q=e.fromBytes(d,m),J=e.fromBytes(O,m),rt=r.multiplyUnsafe(L)}catch{return!1}if(!m&&q.isSmallOrder())return!1;const lt=v(g,J.toBytes(),q.toBytes(),l);return J.add(q.multiplyUnsafe(lt)).subtract(rt).clearCofactor().is0()}const R=s.BYTES,p={secretKey:R,publicKey:R,signature:2*R,seed:R};function N(c=u(p.seed)){return D(c,p.seed,"seed")}function C(c){return ce(c)&&c.length===a.BYTES}function f(c,l){try{return!!e.fromBytes(c,l)}catch{return!1}}const h={getExtendedPublicKey:S,randomSecretKey:N,isValidSecretKey:C,isValidPublicKey:f,toMontgomery(c){const{y:l}=e.fromBytes(c),d=p.publicKey,b=d===32;if(!b&&d!==57)throw new Error("only defined for 25519 and 448");const g=b?s.div(H+l,H-l):s.div(l-H,l+H);return s.toBytes(g)},toMontgomerySecret(c){const l=p.secretKey;D(c,l);const d=t(c.subarray(0,l));return i(d).subarray(0,l)}};return Object.freeze({keygen:qn(N,I),getPublicKey:I,sign:T,verify:E,utils:h,Point:e,lengths:p})}const jn=BigInt(1),Jt=BigInt(2),Vn=BigInt(5),kn=BigInt(8),Ot=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Kn={p:Ot,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:kn,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Yn(e){const t=BigInt(10),n=BigInt(20),o=BigInt(40),r=BigInt(80),s=Ot,u=e*e%s*e%s,i=j(u,Jt,s)*u%s,x=j(i,jn,s)*e%s,y=j(x,Vn,s)*x%s,w=j(y,t,s)*y%s,S=j(w,n,s)*w%s,I=j(S,o,s)*S%s,v=j(I,r,s)*I%s,T=j(v,r,s)*I%s,_=j(T,t,s)*y%s;return{pow_p_5_8:j(_,Jt,s)*e%s,b2:u}}function zn(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const te=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Xn(e,t){const n=Ot,o=U(t*t*t,n),r=U(o*o*t,n),s=Yn(e*r).pow_p_5_8;let a=U(e*o*s,n);const u=U(t*a*a,n),i=a,x=U(a*te,n),y=u===e,w=u===U(-e,n),S=u===U(-e*te,n);return y&&(a=i),(w||S)&&(a=x),Nn(a,n)&&(a=U(-a,n)),{isValid:y||w,value:a}}const Wn=$n(Kn,{uvRatio:Xn});function Pn(e){return Zn(Wn,pn,Object.assign({adjustScalarBytes:zn},e))}const Fn=Pn({}),Qn=ie,Jn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function tr(e){if(e.length!==16)throw new Error(`Invalid seed length: expected 16, got ${e.length}`);const t=Qn(e),n=Fn.getPublicKey(t),o=new Uint8Array(64);return o.set(t,0),o.set(n,32),P.wipeBytes(t),{publicKey:n,secretKey:o}}function er(e){const t=tr(e),n=t.publicKey;return P.wipeBytes(t.secretKey),n}function nr(e){if(e.length!==32)throw new Error(`Invalid public key length: expected 32, got ${e.length}`);return rr(e)}function rr(e){let t=0;for(let r=0;r<e.length&&e[r]===0;r++)t++;let n=0n;for(let r=0;r<e.length;r++)n=n*256n+BigInt(e[r]);let o="";for(;n>0n;){const r=Number(n%58n);o=Jn[r]+o,n=n/58n}return"1".repeat(t)+o}exports.abytes=ht;exports.argon2DeriveInWorker=Ae;exports.combineShares=Ze;exports.getDefaultExportFromCjs=ee;exports.getPublicKeyFromSeed=er;exports.publicKeyToBase58=nr;exports.sha256=ie;exports.splitSecret=$e;