import{a1 as h,a6 as u,u as j,r,j as o,a7 as p,B as d}from"./index-a36IMXuN.js";import{C as f}from"./CheckboxField-CwZ6yoAm.js";const g=h.create(({sourceIdx:l,device:t,removeDevice:m})=>{const a=u(),{t:s}=j(["zigbee","common"]),[n,k]=r.useState({block:!1,force:!1}),i=r.useCallback(e=>{const{checked:c,name:v}=e.target;k(x=>({...x,[v]:c}))},[]),b=r.useCallback(async()=>{a.remove(),await m(l,t.ieee_address,n.force,n.block)},[l,a,m,t.ieee_address,n]);return r.useEffect(()=>{const e=c=>{c.key==="Escape"&&(c.preventDefault(),a.remove())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]),o.jsx(p,{isOpen:a.visible,title:`${s(e=>e.remove_device)} ${t.friendly_name}`,footer:o.jsxs(o.Fragment,{children:[o.jsx(d,{className:"btn btn-neutral",onClick:a.remove,children:s(e=>e.cancel,{ns:"common"})}),o.jsx(d,{className:"btn btn-error ms-1",onClick:b,children:s(e=>e.delete,{ns:"common"})})]}),children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(f,{label:s(e=>e.force_remove),name:"force",onChange:i,checked:n.force}),o.jsx("span",{className:"text-xs opacity-50",children:s(e=>e.force_remove_notice)}),o.jsx(f,{label:s(e=>e.block_join),name:"block",onChange:i,checked:n.block})]})})});export{g as R};
