import{i as e}from"./chunk-aKtaBQYM.js";import{Ft as t,Nt as n,vt as r}from"./mui-BgU4WrXF.js";import{l as i,u as a}from"./IconButton-oialqkv3.js";import{t as o}from"./Container-fY8-hTkD.js";import{a as s,r as c,t as l}from"./Select-Bu2vmaew.js";import{i as u,n as d,r as f,t as p}from"./ExpandMore-D0ycvrdR.js";import{t as m}from"./Typography-7EcQ2i3p.js";import{n as h}from"./MenuItem-BNgF7Xqv.js";import{t as g}from"./TextField-DctlzLY-.js";import{Dt as _,Ft as v,Ut as y,Vt as b,ct as x,pt as S,w as C}from"./index-bel1r0Sr.js";import{n as w,t as T}from"./useSettingsStyles-Bugi6oTj.js";var E=e(t(),1),D=r(),O=()=>{let e=i(),{classes:t}=T(),r=S(),{id:O}=a(),k=n(e=>e.session.server.textEnabled),[A,j]=(0,E.useState)({type:`custom`,attributes:{}}),M=x(async()=>{await C(`/api/commands/send?${new URLSearchParams({groupId:O}).toString()}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(A)}),e(-1)});return(0,D.jsx)(h,{menu:(0,D.jsx)(w,{}),breadcrumbs:[`settingsTitle`,`deviceCommand`],children:(0,D.jsxs)(o,{maxWidth:`xs`,className:t.container,children:[(0,D.jsxs)(u,{defaultExpanded:!0,children:[(0,D.jsx)(d,{expandIcon:(0,D.jsx)(p,{}),children:(0,D.jsx)(m,{variant:`subtitle1`,children:r(`sharedRequired`)})}),(0,D.jsxs)(f,{className:t.details,children:[(0,D.jsxs)(s,{fullWidth:!0,children:[(0,D.jsx)(c,{children:r(`sharedType`)}),(0,D.jsx)(l,{label:r(`sharedType`),value:`custom`,disabled:!0,children:(0,D.jsx)(_,{value:`custom`,children:r(`commandCustom`)})})]}),(0,D.jsx)(g,{value:A.attributes.data,onChange:e=>j({...A,attributes:{...A.attributes,data:e.target.value}}),label:r(`commandData`)}),k&&(0,D.jsx)(v,{control:(0,D.jsx)(b,{checked:A.textChannel,onChange:e=>j({...A,textChannel:e.target.checked})}),label:r(`commandSendSms`)})]})]}),(0,D.jsxs)(`div`,{className:t.buttons,children:[(0,D.jsx)(y,{type:`button`,color:`primary`,variant:`outlined`,onClick:()=>e(-1),children:r(`sharedCancel`)}),(0,D.jsx)(y,{type:`button`,color:`primary`,variant:`contained`,onClick:M,disabled:!A.attributes.data,children:r(`commandSend`)})]})]})})};export{O as default};