(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const n of t.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function s(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function i(e){if(e.ep)return;e.ep=!0;const t=s(e);fetch(e.href,t)}})();document.addEventListener("DOMContentLoaded",()=>{const d=new Map,o=document.getElementById("search"),s=document.getElementById("list"),i=document.getElementById("cancel");function e(){const t=o.value.toLowerCase().trim();Array.from(s.querySelectorAll(".item:not(#cancel)")).forEach(r=>r.remove()),Array.from(d.values()).sort((r,c)=>r.deviceName.localeCompare(c.deviceName)).filter(r=>t?`${r.deviceName} ${r.deviceId}`.toLowerCase().includes(t):!0).forEach(r=>{const c=document.createElement("div");c.className="item",c.id=r.deviceId,c.addEventListener("click",()=>{window.electronAPI.deviceSelected(c.id),window.close()});const a=45,l=`${r.deviceName} (${r.deviceId})`,u=l.length>a?l.substring(0,a):l;c.appendChild(document.createTextNode(u)),s.insertBefore(c,i)})}o.addEventListener("input",()=>{e()}),window.electronAPI.bleScan(t=>{t.forEach(n=>{d.set(n.deviceId,n)}),e()}),i.addEventListener("click",()=>{window.close()}),e()});
