import{r as l,a as f,b as h,j as o}from"./index-BeDhuS24.js";import{S as g}from"./SelectField-CgXiODUe.js";const j=l.memo(d=>{const{cluster:s,device:a,onChange:p,label:m,...b}=d,i=f(e=>e.bridgeDefinitions),{t:u}=h("zigbee"),c=l.useMemo(()=>{const e=i.clusters[s];if(e)return e.attributes;const t=i.custom_clusters[a.ieee_address];if(t){const n=t[s];if(n)return n.attributes}return[]},[i,a.ieee_address,s]),r=l.useMemo(()=>{const e=[];for(const t in c)e.push(o.jsx("option",{value:t,children:t},t));return e},[c]);return o.jsxs(g,{name:"attribute_picker",label:m,onChange:e=>p(e.target.value,c[e.target.value]),disabled:r.length===0,...b,children:[o.jsx("option",{value:"",disabled:!0,children:u("select_attribute")}),r]})}),C=l.memo(d=>{const{clusters:s,onChange:a,value:p,label:m,disabled:b,...i}=d,{t:u}=h(["zigbee","common"]),c=l.useMemo(()=>{const r=[];if(Array.isArray(s))for(const e of s){const t=[];for(const n of e.clusters)t.push(o.jsx("option",{value:n,children:n},n));r.push(o.jsx("optgroup",{label:u(e.name),children:t},e.name))}else for(const e of s)r.push(o.jsx("option",{value:e,children:e},e));return r},[s,u]);return o.jsxs(g,{name:"attribute_picker",label:m,value:p,onChange:r=>a(r.target.value),disabled:b,...i,children:[o.jsx("option",{value:"",disabled:!0,children:u("select_cluster")}),c]})});export{j as A,C};
