const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["chunks/UnlockedWallet-B6hSmM5s.js","chunks/index-YPJa-kxZ.js","chunks/_virtual_wxt-plugins-D2Qy6pl9.js","chunks/TeamThemeProvider-BMMWqJEv.js","chunks/debounce-D1Adyjvd.js","chunks/headers-DBBLE3ii.js","chunks/gateway-auth-C4f--iOs.js","chunks/vault-state-DXmi8wtw.js","chunks/compact-runtime-gCeKtXYh.js","chunks/witness-BJx3-Jdf.js"])))=>i.map(i=>d[i]);
import{_ as x,__tla as __tla_0}from"./index-YPJa-kxZ.js";import{ak as s,al as A,am as _,an as k,ap as S,aq as T,c as H,at as g,ar as c,as as f,a as w,__tla as __tla_1}from"./_virtual_wxt-plugins-D2Qy6pl9.js";import{C as U,c as E}from"./contract-state-cache-5DyKqU8u.js";import{f as F,__tla as __tla_2}from"./contract-state-fetch-B2eVmQET.js";import{v as D,__tla as __tla_3}from"./UnlockedWallet-B6hSmM5s.js";import{__tla as __tla_4}from"./TeamThemeProvider-BMMWqJEv.js";import{__tla as __tla_5}from"./debounce-D1Adyjvd.js";import{__tla as __tla_6}from"./headers-DBBLE3ii.js";import{__tla as __tla_7}from"./gateway-auth-C4f--iOs.js";import{__tla as __tla_8}from"./vault-state-DXmi8wtw.js";let p,G,B,j;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})(),(()=>{try{return __tla_2}catch{}})(),(()=>{try{return __tla_3}catch{}})(),(()=>{try{return __tla_4}catch{}})(),(()=>{try{return __tla_5}catch{}})(),(()=>{try{return __tla_6}catch{}})(),(()=>{try{return __tla_7}catch{}})(),(()=>{try{return __tla_8}catch{}})()]).then(async()=>{const{load:M,invalidate:v,cache:z}=E();function $(t){const e=t.reduce((n,o)=>{const r=new Uint8Array(n.length+o.length);return r.set(n,0),r.set(o,n.length),r},new Uint8Array(0));if(e.length>=33){const n=e[0],o=c(f(e.slice(1,33)));return{kind:n===0?"shielded":"unshielded",keyHex:o}}return{kind:"unshielded",keyHex:e.length===32?c(f(e)):""}}p=function(t,e){try{const a=t.data?.state?.asArray();if(!a||a.length<6)return null;const n=s(A,a[0]),o=_(s(k,a[1])),r=a[2].asMap(),i=s(S,a[3]),u=s(T,a[4]),d=s(H,a[5]),l=[];if(r)for(const h of r.keys()){const m=r.get(h);if(!m)continue;const y=s(S,m);if(y<=0n)continue;const C=$(g(h));l.push({kind:C.kind,keyHex:C.keyHex,balance:y})}return{contractAddress:c(e),projectName:n,metadata:o,totalSupply:i,launcher:c(f(u)),isLaunched:d,balances:l}}catch{return null}};B=async function(t){const e=c(t.contractAddress),a=`${t.network}:ft-unshielded:${e}`;return M(a,async()=>{if(t.indexerUrl){const n=await F({indexerUrl:t.indexerUrl,contractAddress:e,operationName:"UFT_CONTRACT_STATE",fetcher:t.fetcher});if(n)return p(n,e)}try{const{getTokenMetaCache:n}=await x(async()=>{const{getTokenMetaCache:r}=await import("./UnlockedWallet-B6hSmM5s.js").then(async m=>{await m.__tla;return m}).then(i=>i.ed);return{getTokenMetaCache:r}},__vite__mapDeps([0,1,2,3,4,5,6,7])),o=n().get(e);if(o?.state&&o?.contractAddress){const{ContractState:r,fromHex:i}=await x(async()=>{const{ContractState:l,fromHex:h}=await import("./compact-runtime-gCeKtXYh.js").then(async m=>{await m.__tla;return m});return{ContractState:l,fromHex:h}},__vite__mapDeps([8,0,1,2,3,4,5,6,7,9])),u=r.deserialize(i(o.state)),d=p(u,o.contractAddress);if(d)return d}}catch{}return null},t.force)};j=function(t){try{const e=c(t.contractAddress),a=w.deserialize(D(t.stateHex)),n=p(a,e);if(n){const o=`${t.network}:ft-unshielded:${e}`;z.set(o,{expiresAt:Date.now()+U,snapshot:n})}return n}catch{return null}};G=function(t){const e=c(t.contractAddress);v(`${t.network}:ft-unshielded:${e}`)}});export{p as decodeUnshieldedFtContractSnapshot,G as invalidateUnshieldedFtContractSnapshot,B as loadUnshieldedFtContractSnapshot,j as preloadUnshieldedFtSnapshotFromState,__tla};