const ext = typeof browser !== "undefined" ? browser : chrome;

document.getElementById('arm-scanner').addEventListener('click', async () => {
    try {
        const tabs = await ext.tabs.query({ active: true, currentWindow: true });
        const tab = tabs[0];

        await ext.tabs.sendMessage(tab.id, { action: "ARM_SCANNER" });

        window.close();
    } catch (err) {
        console.error("Error sending message:", err);
    }
});