import{s as f,__tla as __tla_0}from"./index-YPJa-kxZ.js";import{__tla as __tla_1}from"./_virtual_wxt-plugins-D2Qy6pl9.js";let u,y,b,g,m,a,i,w;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})()]).then(async()=>{let c;c="bridgeTransfers";u=20;function s(t){return typeof t=="string"&&t.length>0}function d(t){return typeof t=="string"&&/^\d{20,40}$/.test(t)}g=function(t){if(!t||typeof t!="object")return!1;const r=t;if(!s(r.id)||!s(r.sourceTxHash)||r.messageId!==void 0&&!d(r.messageId)||!s(r.recipient)||r.pair!=="testnet"&&r.pair!=="mainnet"||r.direction!=="cardano-to-midnight"&&r.direction!=="midnight-to-cardano"||typeof r.submittedAt!="number"||!Number.isFinite(r.submittedAt)||typeof r.estimatedSeconds!="number"||!s(r.amountBaseUnits))return!1;try{BigInt(r.amountBaseUnits)}catch{return!1}return!0};a=function(t){return[...t].sort((r,e)=>e.submittedAt-r.submittedAt).slice(0,u)};m=function(t,r){if(r.length===0)return[...t];const e=new Map(r.map(n=>[n.id,n]));return t.map(n=>e.get(n.id)??n)};i=async function(){try{const t=f(c),e=(await chrome.storage.local.get(t))?.[t];return Array.isArray(e)?a(e.filter(g)):[]}catch(t){return console.warn("[1AM][bridge] stored transfers could not be read:",t),[]}};async function o(t){try{await chrome.storage.local.set({[f(c)]:a(t)})}catch(r){console.warn("[1AM][bridge] transfers could not be stored:",r)}}y=async function(t){const r=a([t,...await i()]);return await o(r),r};b=async function(t){if(t.length===0)return i();const r=m(await i(),t);return await o(r),r};w=async function(t){const r=(await i()).filter(e=>e.id!==t);return await o(r),r}});export{u as MAX_BRIDGE_TRANSFERS,y as appendBridgeTransfer,b as applyBridgeTransferUpdates,g as isBridgeTransferRecord,m as mergeBridgeTransfers,a as pruneBridgeTransfers,i as readBridgeTransfers,w as removeBridgeTransfer,__tla};