import{w as h,E as j,b as f,r as m,j as e,M as _,B as i,F as p,G as k}from"./index-vDL8KyrI.js";import{C as b}from"./CheckboxField-m1WCeVZk.js";import{I as u}from"./InputField-B5sOh_uD.js";const D=h.create(t=>{const{device:c,removeDevice:n}=t,o=j(),{t:s}=f(["zigbee","common"]),[a,r]=m.useState({block:!1,force:!1}),d=v=>{const{checked:x,name:l}=v.target;r({...a,[l]:x})};return e.jsx(_,{isOpen:o.visible,title:`${s("remove_device")} ${c.friendly_name}`,footer:e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"btn btn-secondary",onClick:o.remove,children:s("common:cancel")}),e.jsx(i,{className:"btn btn-error ms-1",onClick:async()=>{o.remove(),await n(c.ieee_address,a.force,a.block)},children:s("common:delete")})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(b,{label:s("force_remove"),name:"force",onChange:d,checked:a.force}),e.jsx("span",{className:"text-xs opacity-50",children:s("force_remove_notice")}),e.jsx(b,{label:s("block_join"),name:"block",onChange:d,checked:a.block})]})})}),y=h.create(t=>{const{homeassistantEnabled:c,name:n,renameDevice:o}=t,s=j(),{t:a}=f(["zigbee","common"]),[r,d]=m.useState(!1),[v,x]=m.useState(n);return m.useEffect(()=>{x(n)},[n]),e.jsx(_,{isOpen:s.visible,title:`${a("rename_device")} ${n}`,footer:e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"btn btn-secondary",onClick:s.remove,children:a("common:cancel")}),e.jsx(i,{className:"btn btn-primary ms-1",onClick:async()=>{s.remove(),await o(n,v,r)},children:a("rename_device")})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(u,{name:"friendly_name",label:a("common:friendly_name"),onChange:l=>x(l.target.value),value:v,type:"text"}),c&&e.jsx(b,{label:a("update_Home_assistant_entity_id"),name:"update_Home_assistant_entity_id",onChange:l=>d(l.target.checked),checked:r})]})})}),E=m.memo(t=>{const{homeassistantEnabled:c,name:n,renameDevice:o,style:s}=t,{t:a}=f("zigbee");return e.jsx(i,{className:`btn ${s}`,onClick:async()=>await h.show(y,{name:n,renameDevice:o,homeassistantEnabled:c}),title:a("rename_device"),children:e.jsx(p,{icon:k})})});export{E as D,D as R};
