const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/getNFT-COmRwt_P.js","assets/thirdweb-Co3M1EyP.js","assets/fetchTokenMetadata-dQEbpZ5P.js","assets/uint8-array-DZKEMhA1.js","assets/getNFT-CGRVP4Tk.js","assets/totalSupply-CY4mHg6C.js"])))=>i.map(i=>d[i]);
import{B as h,b as E,x as _,_ as l}from"./thirdweb-Co3M1EyP.js";function k(t,e){switch(e.type){case"ERC721":return{chainId:e.chainId,id:e.tokenId,metadata:t,owner:(e==null?void 0:e.owner)??null,tokenAddress:e.tokenAddress,tokenURI:e.tokenUri,type:e.type};case"ERC1155":return{chainId:e.chainId,id:e.tokenId,metadata:t,owner:(e==null?void 0:e.owner)??null,supply:e.supply,tokenAddress:e.tokenAddress,tokenURI:e.tokenUri,type:e.type};default:throw new Error("Invalid NFT type")}}async function g(t){let e=t.uri;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[u="",I="",r=""]=e.split("/"),[a,s]=u.split(":"),[i,n]=I.split(":");if(!a||a.toLowerCase()!=="eip155")throw new Error(`Invalid EIP namespace, expected EIP155, got: "${a}"`);if(!s)throw new Error("Chain ID not found");if(!n||!h(n))throw new Error("Contract address not found");if(!r)throw new Error("Token ID not found");const o=E(Number(s)),w=_({address:n,chain:o,client:t.client});switch(i){case"erc721":{const{getNFT:c}=await l(async()=>{const{getNFT:d}=await import("./getNFT-COmRwt_P.js");return{getNFT:d}},__vite__mapDeps([0,1,2,3]));return(await c({contract:w,tokenId:BigInt(r)})).metadata.image??null}case"erc1155":{const{getNFT:c}=await l(async()=>{const{getNFT:d}=await import("./getNFT-CGRVP4Tk.js");return{getNFT:d}},__vite__mapDeps([4,1,2,3,5]));return(await c({contract:w,tokenId:BigInt(r)})).metadata.image??null}default:throw new Error(`Invalid ERC namespace, expected ERC721 or ERC1155, got: "${i}"`)}}export{k as parseNFT,g as parseNftUri};
