import{useContext as e,createContext as r,useMemo as t}from"react";import{u as n}from"./user-D5cqJNp9.mjs";import{create as a}from"zustand";import{u as o}from"./internal-context-dfitw7Ot.mjs";import{P as i}from"./errors-Dd6zfYtp.mjs";import{g as s}from"./privy-context-Bi6vqCPc.mjs";const l=(e,{chainType:r,walletIndex:t}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==t&&e.walletIndex!==t||void 0!==r&&e.chainType!==r)))??[],d=a((()=>({ethereumExternal:[],areExternalConnectorsReady:!1,ethereumEmbedded:[]}))),m=e=>d.setState({areExternalConnectorsReady:e}),u=/*#__PURE__*/r(!1),c=()=>{if(e(u))throw new i("Multiple PrivyProvider instances found","Found multiple instances of PrivyProvider, ensure there is only one mounted in your application tree.")};function p(){let r=e(u),a=o(),i=d((e=>e.ethereumEmbedded)),s=d((e=>e.ethereumExternal)),m=d((e=>e.areExternalConnectorsReady)),c=n((e=>e.user)),p=n((e=>e.hasResolvedInitialUser)),y=t((()=>[...i,...s].sort(((e,r)=>r.connectedAt-e.connectedAt))),[i,s]),f=l(c,{chainType:"ethereum"}).length>0,h=i.length>0,w=!!m&&!!p&&!!a.walletProxy&&(!f||h);return r?t((()=>({wallets:y,ready:w})),[y,w]):(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1})}const y=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")},f=(e,r)=>{if(r?.imported)return y(r);let t=s(e);if(!t)throw Error("Failed to find primary wallet");return y(t)};export{u as P,d as a,c as b,l as c,f as g,m as s,y as t,p as u};
//# sourceMappingURL=get-entropy-details-for-user-BIWg0YxF.mjs.map
