function i(e, n) {
  return `callback_${n}_${e}`;
}
async function l(e, n) {
  const t = i(e.dataset.id, n), a = new Promise((o) => {
    const s = ({ data: c }) => {
      c.action === t && (window.removeEventListener("message", s), o(c));
    };
    window.addEventListener("message", s);
  });
  return e?.contentWindow?.postMessage({ action: n, callback: t }, "*"), a;
}
export {
  l as callIframe,
  i as getCallbackAction
};
