import{u as v,dh as C,r as N,j as o,F as r,B as g,a5 as F}from"./index-VJpwYvBU.js";import{s as w}from"./startCase-DNIChZAc.js";import{b as $}from"./index-C1LTvZEM.js";function k(n){return n.type==="composite"&&(n.name==="color_xy"||n.name==="color_hs")}function z({children:n,feature:s,deviceValue:m,onRead:l,endpointSpecific:x,parentFeatures:c}){const{t:d}=v("zigbee"),b=s.unit,[y,e]=$(s.name,m,b),h=l!==void 0&&(!!(s.property&&s.access&C.GET)||k(s)),t=c[c.length-1],a=s.name==="state"?s.property:s.name;let p=s.label||w(a);t?.label&&s.name==="state"&&t.type!=="light"&&t.type!=="switch"&&(p=`${t.label} ${s.label.charAt(0).toLowerCase()}${s.label.slice(1)}`);const j=N.useCallback(i=>{i.property&&l?.({[i.property]:""})},[l]);return o.jsxs("div",{className:"list-row p-3",children:[o.jsx("div",{children:c.length>0&&s.type==="composite"&&e==="opacity-0"?null:o.jsx(r,{icon:y,className:e,size:"2xl"})}),o.jsxs("div",{children:[o.jsxs("div",{title:a,children:[p,!x&&s.endpoint?` (${d(i=>i.endpoint)}: ${s.endpoint})`:""]}),o.jsx("div",{className:"text-xs font-semibold opacity-60",children:s.description})]}),o.jsx("div",{className:"list-col-wrap flex flex-col gap-2",children:n}),h&&o.jsx(g,{item:s,onClick:j,className:"btn btn-xs btn-square btn-primary btn-soft",children:o.jsx(r,{icon:F})})]})}export{z as F};
