"use strict";var p=Object.defineProperty;var c=(t,n)=>p(t,"name",{value:n,configurable:!0});var I=require("@scure/base"),u=require("./anchor.cjs");require("@noble/hashes/sha256");function v(t,n,r){if(!r.meta?.innerInstructions)return;const s=[];for(const i of r.meta.innerInstructions)for(const a of i.instructions){if(a.programId.toString()!==t||!("data"in a))continue;const o=I.base58.decode(a.data);if(n.instructions){const e=d(n.instructions,o);if(e){s.push(Object.assign(e,{type:"instruction"}));continue}}if(n.events){const e=f(n.events,o);e&&s.push(Object.assign(e,{type:"event"}))}}return s}c(v,"parseTransaction");function f(t,n){const r=n.subarray(u.DISCRIMINATOR_SIZE);return d(t,r)}c(f,"decodeEvents");function d(t,n){const r=new Map(t.map(e=>[e.discriminator,e])),s=u.decodeSighash(n),i=r.get(s);if(!i)return;const a=n.subarray(u.DISCRIMINATOR_SIZE),o=i.parse(a);if(o)return{name:i.name,data:o}}c(d,"decodeStructs"),exports.decodeEvents=f,exports.decodeStructs=d,exports.parseTransaction=v;