@matterbridge/frontend 3.6.0-dev-20260911-738f663 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import{a as e}from"./rolldown-runtime.js";import{s as t}from"./vendor_emotion.js";import{c as n,d as r,l as i,o as a,p as o,s,u as c}from"./vendor_node_modules.js";import{$ as l,$t as u,A as d,At as f,B as p,Bt as m,C as h,Ct as g,D as _,Dt as v,E as y,Et as b,F as x,Ft as S,G as C,Gt as w,H as T,Ht as E,I as D,It as O,J as k,Jt as A,K as j,Kt as M,L as N,Lt as P,M as ee,Mt as te,N as ne,Nt as F,O as re,Ot as I,P as ie,Pt as ae,Q as oe,Qt as se,R as ce,Rt as le,S as ue,St as de,T as fe,Tt as L,U as pe,Ut as me,V as he,Vt as ge,W as _e,Wt as ve,X as ye,Xt as be,Y as xe,Yt as R,Z as z,Zt as Se,_ as Ce,_t as we,a as Te,at as Ee,b as De,bt as B,c as Oe,ct as ke,d as Ae,dt as je,et as Me,f as Ne,ft as Pe,g as Fe,gt as Ie,h as Le,ht as Re,i as ze,it as Be,j as Ve,jt as He,k as Ue,kt as We,l as Ge,lt as Ke,m as qe,mt as Je,n as Ye,nt as Xe,o as Ze,ot as Qe,p as $e,pt as et,q as tt,qt as V,r as nt,rt,s as it,st as at,t as ot,tt as st,u as ct,ut as lt,v as ut,vt as dt,w as ft,wt as pt,x as mt,xt as ht,y as gt,yt as H,z as _t,zt as vt}from"./vendor_mui.js";import{b as yt,c as bt,i as xt,o as St,s as Ct,t as wt,v as Tt,x as Et}from"./vendor_mdi.js";import{n as Dt,t as Ot}from"./vendor_notistack.js";import{a as kt,c as At,i as jt,l as Mt,n as Nt,o as Pt,r as Ft,s as It,t as Lt}from"./vendor_rjsf.js";import{t as Rt}from"./vendor_qrcode.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var U=e(t(),1),zt=e(o(),1),W={enableMobile:`enableMobile`,devicesFilterPlugins:`devicesFilterPlugins`,devicesFilterDevices:`devicesFilterDevices`,devicesViewMode:`devicesViewMode`,frontendVersion:`frontendVersion`,matterbridgeVersion:`matterbridgeVersion`,homePageMode:`homePageMode`,logFilterLevel:`logFilterLevel`,logFilterSearch:`logFilterSearch`,logAutoScroll:`logAutoScroll`,logLength:`logLength`,frontendTheme:`frontendTheme`,homePagePlugins:`homePagePlugins`,virtualMode:`virtualMode`,installAutoExit:`installAutoExit`,searchPluginsTotal:`searchPluginsTotal`,searchPluginsMeta:`searchPluginsMeta`,searchPluginsVersions:`searchPluginsVersions`},Bt={Devices_table_order_by:`Devices_table_order_by`,Devices_table_order:`Devices_table_order`,Devices_column_visibility:`Devices_column_visibility`,Plugins_table_order_by:`Plugins_table_order_by`,Plugins_table_order:`Plugins_table_order`,Plugins_column_visibility:`Plugins_column_visibility`,"Registered devices_table_order_by":`Registered devices_table_order_by`,"Registered devices_table_order":`Registered devices_table_order`,"Registered devices_column_visibility":`Registered devices_column_visibility`,Clusters_table_order_by:`Clusters_table_order_by`,Clusters_table_order:`Clusters_table_order`,Clusters_column_visibility:`Clusters_column_visibility`};function Vt(){Object.values(W).forEach(e=>{localStorage.removeItem(e)}),Object.values(Bt).forEach(e=>{localStorage.removeItem(e)})}var G=!1,Ht=()=>{G=!G},K=localStorage.getItem(W.enableMobile)!==`false`,Ut=()=>{K=!0,localStorage.setItem(W.enableMobile,`true`)},Wt=()=>{K=!1,localStorage.setItem(W.enableMobile,`false`)},Gt=void 0,Kt=e=>{Gt=e},qt=!1,Jt=e=>{qt=e},Yt=`/`,Xt=e=>{Yt=e},q=u();function Zt(e){return(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,viewBox:`0 0 296.2 296.2`,...e,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsxs)(`linearGradient`,{id:`lg1`,x1:`16.6`,y1:`16.6`,x2:`279.6`,y2:`279.6`,gradientUnits:`userSpaceOnUse`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,q.jsx)(`stop`,{offset:`.1`,stopColor:`#3faa77`}),(0,q.jsx)(`stop`,{offset:`.3`,stopColor:`#234148`}),(0,q.jsx)(`stop`,{offset:`.7`,stopColor:`#203b44`}),(0,q.jsx)(`stop`,{offset:`.9`,stopColor:`#ad2e6e`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,q.jsxs)(`linearGradient`,{id:`lg2`,x1:`31.1`,y1:`31.1`,x2:`265.1`,y2:`265.1`,gradientUnits:`userSpaceOnUse`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,q.jsx)(`stop`,{offset:`.2`,stopColor:`#285251`}),(0,q.jsx)(`stop`,{offset:`.4`,stopColor:`#234148`}),(0,q.jsx)(`stop`,{offset:`.8`,stopColor:`#203b44`}),(0,q.jsx)(`stop`,{offset:`.9`,stopColor:`#a8316c`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,q.jsxs)(`linearGradient`,{id:`lg3`,x1:`116.2`,y1:`143.9`,x2:`139.8`,y2:`143.9`,gradientUnits:`userSpaceOnUse`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#8bc751`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#0db14b`})]}),(0,q.jsx)(`linearGradient`,{id:`lg4`,x1:`136.1`,y1:`100.8`,x2:`159.6`,y2:`100.8`,xlinkHref:`#lg3`}),(0,q.jsx)(`linearGradient`,{id:`lg5`,x1:`155.3`,y1:`143.9`,x2:`178.9`,y2:`143.9`,xlinkHref:`#lg3`}),(0,q.jsxs)(`linearGradient`,{id:`lg6`,x1:`46.8`,y1:`25.7`,x2:`89.6`,y2:`74.8`,gradientUnits:`userSpaceOnUse`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#b1d34a`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#50b848`})]})]}),(0,q.jsx)(`rect`,{width:`296.2`,height:`296.2`,rx:`56.7`,ry:`56.7`,style:{fill:`url(#lg1)`}}),(0,q.jsx)(`rect`,{x:`16.3`,y:`16.3`,width:`263.6`,height:`263.6`,rx:`50.5`,ry:`50.5`,style:{fill:`url(#lg2)`}}),(0,q.jsx)(`circle`,{cx:`128`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg3)`}}),(0,q.jsx)(`circle`,{cx:`147.8`,cy:`100.8`,r:`11.8`,style:{fill:`url(#lg4)`}}),(0,q.jsx)(`path`,{d:`m244.6 114.5.4-.5L160 33a17 17 0 0 0-24.7-.5l-86.4 83.3a15 15 0 0 0 9.2 26.9h19.3v-4.7l-13.7-12.7v-.1l83.7-80.8 84.2 81-13.9 12.8v4.5h19.5a15 15 0 0 0 7.4-28.1Z`,style:{fill:`url(#lg3)`}}),(0,q.jsx)(`circle`,{cx:`167.1`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg5)`}}),(0,q.jsx)(`path`,{fill:`#fff`,d:`M219 89.3V35.5a10.5 10.5 0 1 0-21 0v33.7l21 20Z`}),(0,q.jsx)(`path`,{d:`M91.4 73.3H83a37 37 0 0 0-14.5-28.4L65 50.2c.1 0 12.6 9 11.7 25.4-5.3-.4-11.2-1.9-16.3-5.3-11.8-7.8-16-23.7-11.9-46 8.7 1.5 34 7 43 22.8 4.1 7.3 4.1 16.1 0 26.2Z`,style:{fill:`url(#lg6)`}}),(0,q.jsx)(`path`,{d:`M65.9 80a49.6 49.6 0 0 0 17.8 2.2l16.6-16c1.6-8.3.5-15.7-3.3-22.4C84.6 22 47.8 17.5 46.2 17.4l-3-.4-.6 3c-3.8 18.4-5.9 50.6 23.2 60ZM48.4 24.4c8.7 1.5 34 7 43 22.8 4.1 7.3 4.1 16.1 0 26.2H83a37 37 0 0 0-14.5-28.4l-3.7 5.3c.1 0 12.6 9 11.7 25.4-5.3-.4-11.2-1.9-16.3-5.3-11.9-7.8-16-23.7-11.9-46Z`,fill:`#1e5857`}),(0,q.jsx)(`path`,{fill:`#fff`,d:`M250.5 90.5a17.4 17.4 0 1 1 0-34.8 17.4 17.4 0 0 1 0 34.8Zm0-22.7a5.4 5.4 0 0 0 0 10.7 5.3 5.3 0 0 0 0-10.7ZM258.8 148.2a15.9 15.9 0 0 0-9.6 28.5c-.8 4.2-5.4 4.6-5.4 4.6h-26v-43l13.6-13-1.8-2-82.2-79-81.2 78.3-2.5 2.6 13.7 13v42.9H53a21.5 21.5 0 1 0 11.7 15h12.6v18.8c0 7.8 6.4 14.1 14.1 14.1h29.3v14.8H64a10.6 10.6 0 0 0-17.7 8 10.6 10.6 0 0 0 17.6 8h157.6a16.3 16.3 0 1 0 0-16h-84.8V229h66.8c7.8 0 14.2-6.3 14.2-14.1v-19.2h27.6c14.3 0 17.8-12.8 18.5-16.6a15.9 15.9 0 0 0-5-30.9ZM43.7 210.8a10.3 10.3 0 1 1 0-20.6 10.3 10.3 0 0 1 0 20.6Zm192 36a5 5 0 1 1 0 10 5 5 0 0 1 0-10Zm-77-34.8h-22v-34h22v34Zm8.4-79.8c2.7 0 5.2 1 7.2 2.5v-10.4L188 137s2.6 1.3 4.6 1.3h6.7v68c0 3.2-2.6 5.7-5.7 5.7h-19v-34h1.4a7.5 7.5 0 0 0 0-15H120a7.5 7.5 0 0 0 0 15h.7v34h-19.3a5.7 5.7 0 0 1-5.7-5.6v-68.1h6.7c2 0 4.6-1.3 4.6-1.3l13.7-12.7v10.4a11.7 11.7 0 0 1 16 1.6v-13a14.9 14.9 0 0 0-25-10.8s-.1.2-.1.2l-.5.5-6.9 7H92.5l55-53.2 55.1 53.2h-11.8l-7-7c0-.2-.2-.3-.4-.5l-.2-.2a14.8 14.8 0 0 0-25 10.9v12.9c2.2-2.5 5.3-4.1 8.9-4.1Zm91.7 36.7a4.9 4.9 0 1 1 0-9.7 4.9 4.9 0 0 1 0 9.7Z`})]})}var J=(0,U.createContext)(null),Qt=(0,U.createContext)(null),Y=(0,U.createContext)(null);function $t({children:e}){let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(localStorage.getItem(W.logFilterLevel)??`info`),[a,o]=(0,U.useState)(localStorage.getItem(W.logFilterSearch)??`*`),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(1),{showSnackbarMessage:d,closeSnackbarMessage:f,closeSnackbar:p,showInstallProgress:m,hideInstallProgress:h,exitInstallProgressSuccess:g,exitInstallProgressError:_,addInstallProgress:v}=(0,U.useContext)(J),y=(0,U.useRef)([]),b=(0,U.useRef)(null),x=(0,U.useRef)(1),S=(0,U.useRef)(Math.floor(Math.random()*999e3)+1e3),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)(null),E=(0,U.useRef)(r),D=(0,U.useRef)(a),O=(0,U.useRef)(0),k=(0,U.useRef)(null),A=(0,U.useRef)(Number(localStorage.getItem(W.logLength)??200)),j=(0,U.useRef)(localStorage.getItem(W.logAutoScroll)!==`false`),M=(0,U.useCallback)(e=>{A.current=e},[]),N=(0,U.useCallback)(e=>{j.current=e},[]),P=(0,U.useMemo)(()=>window.location.href.replace(/^http/,`ws`),[]);(0,U.useEffect)(()=>(G&&console.log(`WebSocket messages started counter interval`),k.current=setInterval(()=>{O.current>0&&(G&&console.log(`WebSocket messages received in the last 10 seconds: ${O.current*6} messages/minute`),O.current=0)},1e4),()=>{G&&console.log(`WebSocket messages stopped counter interval`),k.current&&clearInterval(k.current),k.current=null}),[]),(0,U.useEffect)(()=>{E.current=r},[r]),(0,U.useEffect)(()=>{D.current=a},[a]);let ee=(0,U.useCallback)(()=>Math.floor(Math.random()*999e3)+1e3,[]),te=(0,U.useCallback)((e,t)=>{G&&console.log(`WebSocket filterLogMessages called with level "${e}" and search "${t}"...`),n(n=>n.filter(n=>!([`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(n.level)&&(e===`info`&&n.level===`debug`||e===`notice`&&(n.level===`debug`||n.level===`info`)||e===`warn`&&(n.level===`debug`||n.level===`info`||n.level===`notice`)||e===`error`&&(n.level===`debug`||n.level===`info`||n.level===`notice`||n.level===`warn`)||e===`fatal`&&(n.level===`debug`||n.level===`info`||n.level===`notice`||n.level===`warn`||n.level===`error`))||t!==`*`&&t!==``&&!t.startsWith(`/`)&&!t.endsWith(`/`)&&!n.message.toLowerCase().includes(t.toLowerCase())&&!n.name.toLowerCase().includes(t.toLowerCase())||t.startsWith(`/`)&&t.endsWith(`/`)&&(()=>{try{let e=new RegExp(t.slice(1,-1),`i`);return!e.test(n.message)&&!e.test(n.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${t}":`,e),!1}})())))},[]),ne=(0,U.useCallback)(e=>{if(b.current&&b.current.readyState===WebSocket.OPEN)try{G&&console.log(`WebSocket sending message with id ${e.id}:`,e),e.id===void 0&&(e.id=S.current);let t=JSON.stringify(e);b.current.send(t),G&&console.log(`WebSocket sent message:`,e)}catch(e){G&&console.error(`WebSocket error sending message: ${String(e)}`)}else G&&console.error(`WebSocket message not sent, WebSocket not connected:`,e)},[]),F=(0,U.useCallback)((e,t)=>{n(n=>[...n,{level:e,time:``,name:``,message:t}])},[]),re=(0,U.useCallback)((e,t)=>{G&&console.log(`WebSocket addListener id ${t}:`,e),(t==null||Number.isNaN(t)||t===0)&&console.error(`WebSocket addListener called without id, listener not added:`,e),y.current=[...y.current,{listener:e,id:t}],G&&console.log(`WebSocket addListener total listeners:`,y.current.length)},[]),I=(0,U.useCallback)(e=>{G&&console.log(`WebSocket removeListener:`,e),y.current=y.current.filter(t=>t.listener!==e),G&&console.log(`WebSocket removeListener total listeners:`,y.current.length)},[]),ie=(0,U.useCallback)(()=>{P!==``&&P!=null&&(F(`WebSocket`,`Connecting ${Gt?`with password`:``} to WebSocket: ${P}`),G&&console.log(`WebSocket connecting to: ${P}${Gt?`?password=[redacted]`:``}`),b.current=new WebSocket(P+(Gt?`?password=${encodeURIComponent(Gt)}`:``)),b.current.onmessage=e=>{s||c(!0),O.current+=1;try{let t=JSON.parse(e.data);if(t.id===void 0||t.src===void 0||t.dst===void 0){G&&console.error(`WebSocket undefined message id/src/dst:`,t);return}if(t.src!==`Matterbridge`||t.dst!==`Frontend`){G&&console.error(`WebSocket invalid message src/dst:`,t);return}if(t.error){G&&console.error(`WebSocket error message response:`,t);return}if(t.id===S.current&&t.method===`pong`&&t.response===`pong`){G&&console.log(`WebSocket pong response message id ${t.id}:`,t),w.current&&clearTimeout(w.current),w.current=null;return}if(t.method===`snackbar`&&t.response&&t.response.message){G&&console.log(`WebSocket message id ${t.id} method ${t.method}:`,t),d(t.response.message,t.response.timeout,t.response.severity);return}if(t.method===`close_snackbar`&&t.response&&t.response.message){G&&console.log(`WebSocket message id ${t.id} method ${t.method}:`,t),f(t.response.message);return}if(t.method===`log`){if(!t.response||!t.response.level||!t.response.time||!t.response.name||!t.response.message||(t.response.level===`spawn`&&(t.response.name===`Matterbridge:spawn-init`?m(t.response.message,``,``):t.response.name===`Matterbridge:spawn-exit-success`?g():t.response.name===`Matterbridge:spawn-exit-error`?_():v(t.response.message+`
2
- `)),[`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(t.response.level)&&(E.current===`info`&&t.response.level===`debug`||E.current===`notice`&&(t.response.level===`debug`||t.response.level===`info`)||E.current===`warn`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`)||E.current===`error`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`)||E.current===`fatal`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`||t.response.level===`error`)))||D.current!==`*`&&D.current!==``&&!D.current.startsWith(`/`)&&!D.current.endsWith(`/`)&&!t.response.message.toLowerCase().includes(D.current.toLowerCase())&&!t.response.name.toLowerCase().includes(D.current.toLowerCase())||D.current.startsWith(`/`)&&D.current.endsWith(`/`)&&(()=>{try{let e=new RegExp(D.current.slice(1,-1),`i`);return!e.test(t.response.message)&&!e.test(t.response.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${D.current}":`,e),!1}})()||t.response.name===`Commissioning`&&t.response.message.includes(`is uncommissioned`))return;n(e=>{let n=[...e,{level:t.response.level,time:t.response.time,name:t.response.name,message:t.response.message}];return G&&console.log(`WebSocket new log message added (${n.length}/${A.current}):`,n[n.length-1]),n.length>A.current+A.current*10/100?(G&&console.log(`WebSocket sliced log messages to the last ${A.current} entries`),n.slice(n.length-A.current)):n})}else{if(G&&console.log(`WebSocket received message id ${t.id} method ${t.method}:`,t),t.id===0)y.current.forEach(e=>e.listener(t));else{let e=y.current.find(e=>e.id===t.id);e?e.listener(t):G&&console.warn(`WebSocket no listener found for message id ${t.id}:`,t)}return}}catch(e){console.error(`WebSocket error parsing message: ${String(e)}`,e instanceof Error?e.stack:null)}},b.current.onopen=()=>{G&&console.log(`WebSocket: Connected to WebSocket: ${P}`),F(`WebSocket`,`Connected to WebSocket: ${P}`),c(!0),p(),x.current=1,u(1),T.current=setTimeout(()=>{C.current=setInterval(()=>{ne({id:S.current,method:`ping`,src:`Frontend`,dst:`Matterbridge`,params:{}}),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{G&&console.error(`WebSocketUse: No pong response received from WebSocket: ${P}`),F(`WebSocket`,`No pong response received from WebSocket: ${P}`),c(!1)},5e4)},6e4)},3e5)},b.current.onclose=()=>{G&&console.error(`WebSocket: Disconnected from WebSocket ${qt?`with Ingress`:``}: ${P}`),F(`WebSocket`,`Disconnected from WebSocket: ${P}`),c(!1),p(),h(),T.current&&clearTimeout(T.current),w.current&&clearTimeout(w.current),C.current&&clearInterval(C.current),F(`WebSocket`,`Reconnecting (attempt ${x.current} of 100) to WebSocket${qt?` (Ingress)`:``}: ${P}`),qt?setTimeout(ae,5e3):x.current===1?ae():x.current<100?setTimeout(ae,1e3*x.current):F(`WebSocket`,`Reconnect attempts exceeded limit of 100 retries, refresh the page to reconnect to: ${P}`),x.current+=1,u(x.current)},b.current.onerror=e=>{G&&console.error(`WebSocket: WebSocket error connecting to ${P}:`,e),F(`WebSocket`,`WebSocket error connecting to ${P}`)})},[P]),ae=(0,U.useCallback)(()=>{G&&console.log(`WebSocket attemptReconnect ${x.current}/100 to:`,P),ie()},[ie]);(0,U.useEffect)(()=>(ie(),()=>{b.current&&b.current.readyState===WebSocket.OPEN&&b.current.close()}),[ie]);let oe=(0,U.useMemo)(()=>({messages:t,logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:N,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:te}),[t,A,j,r,a,n,M,N,i,o,te]),se=(0,U.useMemo)(()=>({logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:N,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:te,online:s,retry:l,getUniqueId:ee,addListener:re,removeListener:I,sendMessage:ne,logMessage:F}),[A,j,n,M,N,i,o,s,l,re,I,ne,F]);return(0,q.jsx)(Qt.Provider,{value:oe,children:(0,q.jsx)(Y.Provider,{value:se,children:e})})}function en(){let{retry:e}=(0,U.useContext)(Y);return(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100vw`,height:`100vh`,justifyContent:`center`,alignItems:`center`,fontSize:`20px`,color:`var(--main-text-color)`,backgroundColor:`var(--main-bg-color)`},children:[(0,q.jsx)(Zt,{style:{height:`128px`,width:`128px`,margin:`10px`,marginBottom:`20px`}}),e<100?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(be,{style:{color:`var(--primary-color)`}}),(0,q.jsx)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:(0,q.jsxs)(`span`,{children:[`Reconnecting to Matterbridge `,`(attempt `+e+`)`,`...`]})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:[(0,q.jsx)(`span`,{children:`Unable to connect to Matterbridge after multiple attempts.`}),(0,q.jsx)(`br`,{}),(0,q.jsx)(`span`,{children:`Please check your network connection.`}),(0,q.jsx)(`br`,{})]}),(0,q.jsx)(w,{variant:`contained`,color:`primary`,onClick:()=>{window.location.reload()},style:{marginTop:`20px`},children:`Refresh the Page`})]})]})}var X=wt();function Z({children:e,style:t}){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:`0 0 auto`,width:`100%`,overflow:`hidden`,margin:`0px`,padding:`0px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,boxShadow:`5px 5px 10px var(--div-shadow-color)`,border:`1px solid var(--table-border-color)`,borderRadius:`var(--div-border-radius)`,boxSizing:`border-box`,...t},children:e})}function tn({children:e,style:t}){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,borderBottom:`1px solid var(--table-border-color)`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function Q({children:e,style:t}){return(0,q.jsx)(`div`,{style:{color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,fontSize:`16px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function nn({children:e,style:t}){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function rn({children:e,style:t}){return(0,q.jsx)(`div`,{style:{color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,fontSize:`14px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function an({children:e,style:t}){return(0,q.jsx)(`div`,{style:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,fontSize:`14px`,fontWeight:`normal`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function on({children:e,style:t,onDragOver:n,onDragLeave:r,onDrop:i}){return(0,q.jsx)(`div`,{style:{flex:`0 0 auto`,display:`flex`,flexDirection:`row`,overflow:`hidden`,alignItems:`start`,justifyContent:`space-between`,margin:`0px`,padding:`10px`,gap:`20px`,...t},onDragOver:n,onDragLeave:r,onDrop:i,children:e})}function sn({children:e,style:t,close:n}){return(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,margin:`0px`,padding:`0px`,paddingRight:`10px`,gap:`10px`,...t},children:[e,!1]})}var cn=[`Off`,`Low`,`Medium`,`High`,`On`,`Auto`,`Smart`],ln={display:`flex`,gap:`2px`,justifyContent:`space-evenly`,width:`100%`,height:`40px`},un={margin:`0`,padding:`0`,fontSize:`36px`,fontWeight:`medium`,color:`var(--primary-color)`},dn={margin:`0`,padding:`0`,fontSize:`20px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},fn={margin:`0`,padding:`0`,paddingBottom:`2px`,fontSize:`16px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},pn={display:`flex`,gap:`2px`,justifyContent:`center`,width:`100%`,height:`18px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},mn={margin:`0`,padding:`0`,fontSize:`12px`,fontWeight:`normal`,color:`var(--div-text-color)`},hn={display:`flex`,justifyContent:`center`,width:`100%`,height:`52px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},gn={margin:`0`,padding:`0`,fontSize:`14px`,fontWeight:`bold`,color:`var(--div-text-color)`},_n={display:`flex`,gap:`4px`,justifyContent:`center`,width:`100%`,height:`15px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},vn={margin:`0`,padding:`0px 4px`,borderRadius:`5px`,textAlign:`center`,fontSize:`12px`,fontWeight:`normal`,color:`var(--secondary-color)`},yn=[256,257,268,269],bn=[266,267],xn=[271,272],Sn=[256,257,268,269,266,267,272],Cn=[43,45],wn=[`Closed`,`Open`,`Partial`,`Pedestrian`,`Ventilation`,`Signature`];function Tn(e){if(typeof e!=`object`||!e||!(`position`in e))return`N/A`;let t=e.position;return typeof t!=`number`||!Number.isInteger(t)||t<0||t>=wn.length?`N/A`:wn[t]}function En(e){return typeof e!=`number`||!Number.isInteger(e)||e<0||e>1e4?`N/A`:e===0?wn[0]:e===1e4?wn[1]:wn[2]}function Dn(e){return typeof e!=`object`||!e||!(`position`in e)?`N/A`:En(e.position)}function $({icon:e,iconColor:t,cluster:n,value:r,unit:i,prefix:a}){return G&&console.log(`Render cluster "${n.clusterName}.${n.attributeName}" value(${typeof r}-${Number.isNaN(r)}) "${r}" unit "${i}"`),a??=!1,(0,q.jsxs)(M,{sx:ln,children:[e&&(0,U.cloneElement)(e,{key:`${n.clusterId}-${n.attributeId}-icon`,sx:{...un,color:t??`var(--primary-color)`}}),(0,q.jsxs)(M,{sx:{...ln,gap:`4px`,alignContent:`center`,alignItems:`end`,justifyContent:`center`},children:[i&&a&&(0,q.jsx)(V,{sx:fn,children:i},`${n.clusterId}-${n.attributeId}-unit-prefix`),(0,q.jsx)(V,{sx:dn,children:r==null||typeof r==`number`&&Number.isNaN(r)||r===`NaN`?`---`:r},`${n.clusterId}-${n.attributeId}-value`),i&&!a&&(0,q.jsx)(V,{sx:fn,children:i},`${n.clusterId}-${n.attributeId}-unit-suffix`)]},`${n.clusterId}-${n.attributeId}-valueunitbox`)]},`${n.clusterId}-${n.attributeId}-box`)}function On({device:e,endpoint:t,id:n,deviceType:r,clusters:i}){let a=[`Unknown`,`Good`,`Fair`,`Moderate`,`Poor`,`VeryPoor`,`Ext.Poor`],o=``,s=e=>{if(!e)return null;let t=e.attributeLocalValue;if(!t||typeof t!=`object`||!(`energy`in t))return null;let n=t.energy;return typeof n!=`number`&&typeof n!=`bigint`?null:Math.round(Number(n)/1e6)},c=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyImported`),u=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyExported`),d=s(c),f=s(u),p=c??u,m=d??(f===null?null:`+ ${f}`);G&&console.log(`Device "${e.name}" endpoint "${t}" id "${n}" deviceType "0x${r.toString(16).padStart(4,`0`)}" clusters (${i?.length})`);let h=i.find(e=>e.clusterName===`Descriptor`&&e.attributeName===`tagList`)?.attributeLocalValue;if(h){let e=``;h.map(t=>{t.label&&(e+=t.label+` `)}),o=e.trim()}if(r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batVoltage`).map(e=>o=`${e.attributeLocalValue??0} mV`),Sn.includes(r)&&i.filter(e=>e.clusterName===`LevelControl`&&e.attributeName===`currentLevel`).map(e=>o=`Level ${e.attributeValue}`),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>o=`Position ${e.attributeLocalValue/100}%`),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedHeatingSetpoint`).map(e=>o=`Heat ${e.attributeLocalValue/100}°C `),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedCoolingSetpoint`).map(e=>o+=`Cool ${e.attributeLocalValue/100}°C`),Cn.includes(r)&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`percentCurrent`).map(e=>o=`Speed ${e.attributeValue}%`),r===118&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>o=e.attributeLocalValue===0?`No CO detected`:`CO alarm!`),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`voltage`).map(e=>o=`${e.attributeLocalValue/1e3} V, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activeCurrent`).map(e=>o+=`${e.attributeLocalValue/1e3} A, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activePower`).map(e=>o+=`${e.attributeLocalValue/1e6} kW`),r===39){let e=i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}if(r===116){let e=i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}return(0,q.jsxs)(Z,{style:{margin:`0px`,padding:`5px`,width:`150px`,height:`150px`,borderColor:`var(--div-bg-color)`,borderRadius:`5px`,justifyContent:`space-between`},children:[r===19&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:e.attributeLocalValue===!0?(0,q.jsx)(_e,{}):(0,q.jsx)(pe,{}),iconColor:e.attributeLocalValue===!0?`green`:`red`,cluster:e,value:e.attributeLocalValue===!0?`Online`:`Offline`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batPercentRemaining`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(et,{}),cluster:e,value:e.attributeLocalValue/2,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`wiredCurrentType`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(ke,{}),cluster:e,value:e.attributeLocalValue===0?`AC`:`DC`},`${e.clusterId}-${e.attributeId}`)),r===1293&&i.filter(e=>e.clusterName===`DeviceEnergyManagement`&&e.attributeName===`esaState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Offline`:`Online`},`${e.clusterId}-${e.attributeId}`)),yn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),bn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M7.5,10.5A1.5,1.5 0 0,1 9,12A1.5,1.5 0 0,1 7.5,13.5C6.66,13.5 6,12.83 6,12A1.5,1.5 0 0,1 7.5,10.5M16.5,10.5A1.5,1.5 0 0,1 18,12A1.5,1.5 0 0,1 16.5,13.5A1.5,1.5 0 0,1 15,12A1.5,1.5 0 0,1 16.5,10.5M4.22,2H19.78C21,2 22,3 22,4.22V19.78A2.22,2.22 0 0,1 19.78,22H4.22C3,22 2,21 2,19.78V4.22A2.22,2.22 0 0,1 4.22,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),xn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===259&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===260&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===261&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===2112&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===115&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M14.83,11.17C16.39,12.73 16.39,15.27 14.83,16.83C13.27,18.39 10.73,18.39 9.17,16.83L14.83,11.17M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===124&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8M8.11,10.5H10C9.76,11.88 10,12.67 10.58,13.29C11.68,14.36 12.16,15.71 11.89,17.5H10C10.24,16.12 10,15.33 9.42,14.71C8.32,13.64 7.85,12.29 8.11,10.5M12.11,10.5H14C13.76,11.88 14,12.67 14.58,13.29C15.68,14.36 16.16,15.71 15.89,17.5H14C14.24,16.12 14,15.33 13.42,14.71C12.32,13.64 11.85,12.29 12.11,10.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===117&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M18,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V4A2,2 0 0,0 18,2M10,4A1,1 0 0,1 11,5A1,1 0 0,1 10,6A1,1 0 0,1 9,5A1,1 0 0,1 10,4M7,4A1,1 0 0,1 8,5A1,1 0 0,1 7,6A1,1 0 0,1 6,5A1,1 0 0,1 7,4M18,20H6V8H18V20M14.67,15.33C14.69,16.03 14.41,16.71 13.91,17.21C12.86,18.26 11.15,18.27 10.09,17.21C9.59,16.71 9.31,16.03 9.33,15.33C9.4,14.62 9.63,13.94 10,13.33C10.37,12.5 10.81,11.73 11.33,11L12,10C13.79,12.59 14.67,14.36 14.67,15.33`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===123&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(oe,{}),cluster:e,value:`Oven`},`${e.clusterId}-${e.attributeId}`)),r===112&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Be,{}),cluster:e,value:`Fridge`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`temperatureSetpoint`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===121&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(oe,{}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===122&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M19,18.31V20A2,2 0 0,1 17,22H7A2,2 0 0,1 5,20V16.3C4.54,16.12 3.95,16 3,16A1,1 0 0,1 2,15A1,1 0 0,1 3,14C3.82,14 4.47,14.08 5,14.21V12.3C4.54,12.12 3.95,12 3,12A1,1 0 0,1 2,11A1,1 0 0,1 3,10C3.82,10 4.47,10.08 5,10.21V8.3C4.54,8.12 3.95,8 3,8A1,1 0 0,1 2,7A1,1 0 0,1 3,6C3.82,6 4.47,6.08 5,6.21V4A2,2 0 0,1 7,2H17A2,2 0 0,1 19,4V6.16C20.78,6.47 21.54,7.13 21.71,7.29C22.1,7.68 22.1,8.32 21.71,8.71C21.32,9.1 20.8,9.09 20.29,8.71V8.71C20.29,8.71 19.25,8 17,8C15.74,8 14.91,8.41 13.95,8.9C12.91,9.41 11.74,10 10,10C9.64,10 9.31,10 9,9.96V7.95C9.3,8 9.63,8 10,8C11.26,8 12.09,7.59 13.05,7.11C14.09,6.59 15.27,6 17,6V4H7V20H17V18C18.5,18 18.97,18.29 19,18.31M17,10C15.27,10 14.09,10.59 13.05,11.11C12.09,11.59 11.26,12 10,12C9.63,12 9.3,12 9,11.95V13.96C9.31,14 9.64,14 10,14C11.74,14 12.91,13.41 13.95,12.9C14.91,12.42 15.74,12 17,12C19.25,12 20.29,12.71 20.29,12.71V12.71C20.8,13.1 21.32,13.1 21.71,12.71C22.1,12.32 22.1,11.69 21.71,11.29C21.5,11.08 20.25,10 17,10M17,14C15.27,14 14.09,14.59 13.05,15.11C12.09,15.59 11.26,16 10,16C9.63,16 9.3,16 9,15.95V17.96C9.31,18 9.64,18 10,18C11.74,18 12.91,17.41 13.95,16.9C14.91,16.42 15.74,16 17,16C19.25,16 20.29,16.71 20.29,16.71V16.71C20.8,17.1 21.32,17.1 21.71,16.71C22.1,16.32 22.1,15.69 21.71,15.29C21.5,15.08 20.25,14 17,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===120&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Cooktop`},`${e.clusterId}-${e.attributeId}`)),r===119&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:En(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===515&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===560&&i.filter(e=>e.clusterName===`ClosureControl`&&e.attributeName===`overallCurrentState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:Tn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===574&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===561&&i.filter(e=>e.clusterName===`ClosureDimension`&&e.attributeName===`currentState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:Dn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===778&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===10&&i.filter(e=>e.clusterName===`DoorLock`&&e.attributeName===`lockState`).map(e=>(0,q.jsx)($,{icon:e.attributeValue===`1`?(0,q.jsx)(st,{}):(0,q.jsx)(Me,{}),cluster:e,value:e.attributeValue===`1`?`Locked`:`Unlocked`},`${e.clusterId}-${e.attributeId}`)),r===11&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(st,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===43&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Je,{}),cluster:e,value:cn[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===15&&i.filter(e=>e.clusterName===`Switch`&&e.attributeName===`currentPosition`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M13 5C15.21 5 17 6.79 17 9C17 10.5 16.2 11.77 15 12.46V11.24C15.61 10.69 16 9.89 16 9C16 7.34 14.66 6 13 6S10 7.34 10 9C10 9.89 10.39 10.69 11 11.24V12.46C9.8 11.77 9 10.5 9 9C9 6.79 10.79 5 13 5M20 20.5C19.97 21.32 19.32 21.97 18.5 22H13C12.62 22 12.26 21.85 12 21.57L8 17.37L8.74 16.6C8.93 16.39 9.2 16.28 9.5 16.28H9.7L12 18V9C12 8.45 12.45 8 13 8S14 8.45 14 9V13.47L15.21 13.6L19.15 15.79C19.68 16.03 20 16.56 20 17.14V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.11 2.9 14 4 14H8V12L4 12L4 4H20L20 12H18V14H20V13.96L20.04 14C21.13 14 22 13.09 22 12V4C22 2.9 21.11 2 20 2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`pos`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===39&&i.filter(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(je,{}),cluster:e,value:e.attributeValue,unit:`Mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===771&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(lt,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===772&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(lt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===45&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Ee,{}),cluster:e,value:cn[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===114&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Ee,{}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===67&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(C,{}),cluster:e,value:e.attributeLocalValue===!0?`Leak`:`No leak`},`${e.clusterId}-${e.attributeId}`)),r===65&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Re,{}),cluster:e,value:e.attributeLocalValue===!0?`Freeze`:`No freeze`},`${e.clusterId}-${e.attributeId}`)),r===68&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(tt,{}),cluster:e,value:e.attributeLocalValue===!0?`Rain`:`No rain`},`${e.clusterId}-${e.attributeId}`)),r===116&&i.filter(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12,2C14.65,2 17.19,3.06 19.07,4.93L17.65,6.35C16.15,4.85 14.12,4 12,4C9.88,4 7.84,4.84 6.35,6.35L4.93,4.93C6.81,3.06 9.35,2 12,2M3.66,6.5L5.11,7.94C4.39,9.17 4,10.57 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,10.57 19.61,9.17 18.88,7.94L20.34,6.5C21.42,8.12 22,10.04 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12C2,10.04 2.58,8.12 3.66,6.5M12,6A6,6 0 0,1 18,12C18,13.59 17.37,15.12 16.24,16.24L14.83,14.83C14.08,15.58 13.06,16 12,16C10.94,16 9.92,15.58 9.17,14.83L7.76,16.24C6.63,15.12 6,13.59 6,12A6,6 0 0,1 12,6M12,8A1,1 0 0,0 11,9A1,1 0 0,0 12,10A1,1 0 0,0 13,9A1,1 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`Run mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===1292&&i.filter(e=>e.clusterName===`EnergyEvse`&&e.attributeName===`state`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M19.77,7.23L19.78,7.22L16.06,3.5L15,4.56L17.11,6.67C16.17,7.03 15.5,7.93 15.5,9A2.5,2.5 0 0,0 18,11.5C18.36,11.5 18.69,11.42 19,11.29V18.5A1,1 0 0,1 18,19.5A1,1 0 0,1 17,18.5V14A2,2 0 0,0 15,12H14V5A2,2 0 0,0 12,3H6A2,2 0 0,0 4,5V21H14V13.5H15.5V18.5A2.5,2.5 0 0,0 18,21A2.5,2.5 0 0,0 20.5,18.5V9C20.5,8.31 20.22,7.68 19.77,7.23M18,10A1,1 0 0,1 17,9A1,1 0 0,1 18,8A1,1 0 0,1 19,9A1,1 0 0,1 18,10M8,18V13.5H6L10,6V11H12L8,18Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Free`:`In use`},`${e.clusterId}-${e.attributeId}`)),r===1295&&i.filter(e=>e.clusterName===`WaterHeaterManagement`&&e.attributeName===`tankPercentage`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 2C6.89 2 6 2.89 6 4V16C6 17.11 6.89 18 8 18H9V20H6V22H9C10.11 22 11 21.11 11 20V18H13V20C13 21.11 13.89 22 15 22H18V20H15V18H16C17.11 18 18 17.11 18 16V4C18 2.89 17.11 2 16 2H8M12 4.97A2 2 0 0 1 14 6.97A2 2 0 0 1 12 8.97A2 2 0 0 1 10 6.97A2 2 0 0 1 12 4.97M10 14.5H14V16H10V14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tank `+(e.attributeLocalValue??0)+`%`},`${e.clusterId}-${e.attributeId}`)),r===1297&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Utility`},`${e.clusterId}-${e.attributeId}`)),r===1298&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Reference`},`${e.clusterId}-${e.attributeId}`)),r===1299&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tariff`},`${e.clusterId}-${e.attributeId}`)),r===1300&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Meter`},`${e.clusterId}-${e.attributeId}`)),r===777&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M12.75 7.08C13.57 7.2 14.32 7.5 14.95 8L12.75 10.19V7.08M11.25 7.08V10.19L9.05 8C9.68 7.5 10.43 7.2 11.25 7.08M8 9.05L10.19 11.25H7.08C7.2 10.43 7.5 9.68 8 9.05M7.08 12.75H10.19L8 14.95C7.5 14.32 7.2 13.57 7.08 12.75M11.25 16.92C10.43 16.8 9.68 16.5 9.05 16L11.25 13.81V16.92M12 13C11.45 13 11 12.55 11 12S11.45 11 12 11 13 11.45 13 12 12.55 13 12 13M12.75 16.92V13.81L14.95 16C14.32 16.5 13.57 16.8 12.75 16.92M16 14.95L13.81 12.75H16.92C16.8 13.57 16.5 14.32 16 14.95M13.81 11.25L16 9.05C16.5 9.69 16.8 10.44 16.92 11.25H13.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`HeatPump`},`${e.clusterId}-${e.attributeId}`)),r===23&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M4,2H20A2,2 0 0,1 22,4V14A2,2 0 0,1 20,16H15V20H18V22H13V16H11V22H6V20H9V16H4A2,2 0 0,1 2,14V4A2,2 0 0,1 4,2M4,4V8H11V4H4M4,14H11V10H4V14M20,14V10H13V14H20M20,4H13V8H20V4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Solar`},`${e.clusterId}-${e.attributeId}`)),r===24&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`featureMap`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12 20L5 20V12H2L12 3L14.78 5.5H14V7.17C12.84 7.58 12 8.7 12 10V20M15 9H16V7.5H20V9H21C21.55 9 22 9.45 22 10V21C22 21.55 21.55 22 21 22H15C14.45 22 14 21.55 14 21V10C14 9.45 14.45 9 15 9M16 11V14H20V11H16Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Inverter`},`${e.clusterId}-${e.attributeId}`)),r===40&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===35&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===34&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===41&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===42&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===36&&i.filter(e=>e.clusterName===`ApplicationBasic`&&e.attributeName===`applicationName`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`App`},`${e.clusterId}-${e.attributeId}`)),r===14&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M10,2C8.89,2 8,2.89 8,4V7C8,8.11 8.89,9 10,9H11V11H2V13H6V15H5C3.89,15 3,15.89 3,17V20C3,21.11 3.89,22 5,22H9C10.11,22 11,21.11 11,20V17C11,15.89 10.11,15 9,15H8V13H16V15H15C13.89,15 13,15.89 13,17V20C13,21.11 13.89,22 15,22H19C20.11,22 21,21.11 21,20V17C21,15.89 20.11,15 19,15H18V13H22V11H13V9H14C15.11,9 16,8.11 16,7V4C16,2.89 15.11,2 14,2H10M10,4H14V7H10V4M5,17H9V20H5V17M15,17H19V20H15V17Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Aggregator`},`${e.clusterId}-${e.attributeId}`)),r===322&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Camera`},`${e.clusterId}-${e.attributeId}`)),r===324&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Floodlight`},`${e.clusterId}-${e.attributeId}`)),r===323&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Video bell`},`${e.clusterId}-${e.attributeId}`)),r===320&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Intercom`},`${e.clusterId}-${e.attributeId}`)),r===325&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Snapshot`},`${e.clusterId}-${e.attributeId}`)),r===327&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Cam ctrl`},`${e.clusterId}-${e.attributeId}`)),r===326&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(z,{}),cluster:e,value:`Chime`},`${e.clusterId}-${e.attributeId}`)),r===328&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(z,{}),cluster:e,value:`Doorbell`},`${e.clusterId}-${e.attributeId}`)),r===321&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(z,{}),cluster:e,value:`Audio bell`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!0)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`smokeState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No smoke`:`Smoke!`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!1)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No Co`:`Co!`},`${e.clusterId}-${e.attributeId}`)),r===66&&i.filter(e=>e.clusterName===`ValveConfigurationAndControl`&&e.attributeName===`currentState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M4 22H2V2H4M22 2H20V22H22M17.24 5.34L13.24 9.34A3 3 0 0 0 9.24 13.34L5.24 17.34L6.66 18.76L10.66 14.76A3 3 0 0 0 14.66 10.76L18.66 6.76Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===64&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M10 10H14V22H10V10M7 9H9V7H7V9M4 8H6V6H4V8M4 11H6V9H4V11M1 13H3V11H1V13M1 7H3V5H1V7M1 10H3V8H1V10M18 11H20V9H18V11M21 10H23V8H21V10M21 5V7H23V5H21M21 13H23V11H21V13M15 9H17V7H15V9M18 8H20V6H18V8M10 7H10.33L11 9H13L13.67 7H14V6H10V7Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Irrigation`},`${e.clusterId}-${e.attributeId}`)),r===44&&i.filter(e=>e.clusterName===`AirQuality`&&e.attributeName===`airQuality`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M11,9A4,4 0 0,1 15,13A4,4 0 0,1 11,17A4,4 0 0,1 7,13A4,4 0 0,1 11,9M11,11A2,2 0 0,0 9,13A2,2 0 0,0 11,15A2,2 0 0,0 13,13A2,2 0 0,0 11,11M7,4H14A4,4 0 0,1 18,8V9H16V8A2,2 0 0,0 14,6H7A2,2 0 0,0 5,8V20H16V18H18V22H3V8A4,4 0 0,1 7,4M16,11C18.5,11 18.5,9 21,9V11C18.5,11 18.5,13 16,13V11M16,15C18.5,15 18.5,13 21,13V15C18.5,15 18.5,17 16,17V15Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:a[e.attributeLocalValue??0]},`${e.clusterId}-${e.attributeId}`)),r===770&&i.filter(e=>e.clusterName===`TemperatureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(k,{}),cluster:e,value:e.attributeLocalValue/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===775&&i.filter(e=>e.clusterName===`RelativeHumidityMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue/100,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===69&&i.filter(e=>e.clusterName===`SoilMeasurement`&&e.attributeName===`soilMoistureMeasuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===774&&i.filter(e=>e.clusterName===`FlowMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Qe,{}),cluster:e,value:e.attributeLocalValue/10,unit:`m³/h`},`${e.clusterId}-${e.attributeId}`)),r===773&&i.filter(e=>e.clusterName===`PressureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(at,{}),cluster:e,value:e.attributeLocalValue,unit:`hPa`},`${e.clusterId}-${e.attributeId}`)),r===21&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:e.attributeValue===`true`?(0,q.jsx)(Ke,{}):(0,q.jsx)(l,{}),cluster:e,value:e.attributeValue===`true`?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===263&&i.filter(e=>e.clusterName===`OccupancySensing`&&e.attributeName===`occupancy`).map(e=>(0,q.jsx)($,{icon:e.attributeValue===`{ occupied: true }`?(0,q.jsx)(ye,{}):(0,q.jsx)(xe,{}),cluster:e,value:e.attributeValue===`{ occupied: true }`?`Occupied`:`Unocc.`},`${e.clusterId}-${e.attributeId}`)),r===262&&i.filter(e=>e.clusterName===`IlluminanceMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Xe,{}),cluster:e,value:Math.round(10**(e.attributeLocalValue/1e4)),unit:`lx`},`${e.clusterId}-${e.attributeId}`)),r===2128&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`---`},`${e.clusterId}-${e.attributeId}`)),r===1296&&p&&(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:p,value:m,unit:`kWh`},`${p.clusterId}-${p.attributeId}`),(0,q.jsx)(M,{sx:pn,children:(0,q.jsx)(V,{sx:mn,children:o})}),(0,q.jsx)(M,{sx:hn,children:(0,q.jsx)(V,{sx:gn,children:e.name})}),(0,q.jsxs)(M,{sx:_n,children:[G&&(0,q.jsx)(V,{sx:vn,children:t}),(0,q.jsx)(V,{sx:vn,children:n}),G&&(0,q.jsxs)(V,{sx:vn,children:[`0x`,r.toString(16).padStart(4,`0`)]})]})]})}var kn=(0,U.memo)(On);function An({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)({}),[d,f]=(0,U.useState)({}),p=(0,U.useRef)(o()),m=(0,U.useRef)(s);(0,U.useEffect)(()=>{m.current=s},[s]);let h=(0,U.useRef)(d);(0,U.useEffect)(()=>{h.current=d},[d]);let g=(0,U.useCallback)(e=>{G&&console.log(`DevicesIcons received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=m.current,n=h.current,r=t.find(t=>t.pluginName===e.response.plugin&&t.serial===e.response.serialNumber);if(!r){G&&console.warn(`DevicesIcons updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" number "${e.response.number}" id "${e.response.id}" not found in devices(${t.length})`);return}let i=n[r.serial]?.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);if(!i){G&&console.warn(`DevicesIcons updater device "${r.name}" serial "${r.serial}" cluster "${e.response.cluster}" attribute "${e.response.attribute}" not found in clusters(${n[r.serial]?.length})`);return}i.attributeValue=String(e.response.value),i.attributeLocalValue=e.response.value,f(e=>({...e})),G&&console.log(`DevicesIcons updated "${i.clusterName}.${i.attributeName}" for device "${r.name}" serial "${r.serial}" to "${i.attributeValue}"`)},[]),_=(0,U.useCallback)(e=>{if(G&&console.log(`DevicesIcons received for device "${e.response.deviceName}" serial "${e.response.serialNumber}" deviceTypes (${e.response.deviceTypes.length}) "${e.response.deviceTypes.join(`,`)}" clusters (${e.response.clusters.length}):`,e.response),e.response.clusters.length===0)return;let t=e.response.serialNumber,n=[],r=[];for(let t of e.response.clusters)n.find(e=>e.endpoint===t.endpoint)||n.push({endpoint:t.endpoint,id:t.id,deviceTypes:t.deviceTypes}),![`FixedLabel`,`Identify`,`Groups`,`ScenesManagement`,`PowerTopology`].includes(t.clusterName)&&r.push(t);u(e=>({...e,[t]:n})),f(e=>({...e,[t]:r})),G&&console.log(`DevicesIcons endpoints for "${t}":`,n),G&&console.log(`DevicesIcons deviceTypes for "${t}":`,e.response.deviceTypes),G&&console.log(`DevicesIcons clusters for "${t}":`,r)},[]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`)G&&console.log(`DevicesIcons received refresh_required: changed=${e.response.changed} and sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}});else if(e.method===`state_update`&&e.response)g(e);else if(e.method===`/api/devices`&&e.response){G&&console.log(`DevicesIcons received ${e.response.length} devices:`,e.response),c(e.response),u({}),f({});for(let t of e.response)G&&console.log(`DevicesIcons sending /api/clusters`),r({id:p.current,sender:`DevicesIcons`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:t.pluginName,endpoint:t.endpoint||0,serialNumber:t.serial}})}else e.method===`/api/clusters`&&e.response&&_(e)};return i(e,p.current),G&&console.log(`DevicesIcons WebSocket effect mounted`),()=>{a(e),G&&console.log(`DevicesIcons WebSocket effect unmounted`)}},[i,_,a,r,g]),(0,U.useEffect)(()=>(G&&console.log(`DevicesIcons useEffect online mounting`),n&&(G&&console.log(`DevicesIcons useEffect online sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}})),G&&console.log(`DevicesIcons useEffect online mounted`),()=>{G&&console.log(`DevicesIcons useEffect online unmounted`)}),[n,r]);let v=e?.trim().toLowerCase(),y=v&&v!==`all plugins`;return G&&console.log(`DevicesIcons rendering...`),(0,q.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,paddingBottom:`5px`,gap:`20px`,width:`100%`,overflow:`auto`},children:s.filter(e=>y&&e.pluginName.toLowerCase()!==v?!1:t===``||e.name.toLowerCase().includes(t.toLowerCase())||e.serial.toLowerCase().includes(t.toLowerCase())).map(e=>l[e.serial]&&l[e.serial].map(t=>t.deviceTypes.map(n=>(0,q.jsx)(kn,{device:e,endpoint:t.endpoint,id:t.id,deviceType:n,clusters:(d[e.serial]??[]).filter(e=>e.endpoint===t.endpoint)},`${e.pluginName}-${e.uniqueId}-${t.endpoint}-${t.id}-${n.toString()}`))))})}var jn=(0,U.memo)(An);function Mn(e){return e?e.scrollWidth>e.clientWidth:!1}function Nn({title:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)(!1);return(0,q.jsx)(B,{title:e,open:r,disableHoverListener:!0,disableFocusListener:!0,disableTouchListener:!0,slotProps:{tooltip:{sx:{fontSize:`14px`,fontWeight:`normal`,color:`#ffffff`,backgroundColor:`var(--primary-color)`,maxWidth:500,whiteSpace:`pre-wrap`,wordBreak:`break-word`}}},children:(0,q.jsx)(`span`,{ref:n,onMouseEnter:()=>{i(Mn(n.current))},onMouseLeave:()=>{i(!1)},style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})})}function Pn(e,t,n){let r=e?.[n],i=t?.[n];return r==null&&i==null?0:r==null?-1:i==null?1:typeof r==`boolean`&&typeof i==`boolean`?r===i?0:r?1:-1:typeof r==`number`&&typeof i==`number`?r-i:String(r).localeCompare(String(i))}function Fn({name:e,title:t,columns:n,rows:r,getRowKey:i,footerLeft:a,footerRight:o,onRowClick:s}){let c=t=>{if(typeof i==`string`&&t&&t[i]!=null)return t[i];if(typeof i==`function`){let e=i(t);if(e!=null)return e}let a=n?.[0]?.id;return a&&t&&t[a]!=null?t[a]:(console.warn(`MbfTable(${e}): using fallback stable row key; consider providing getRowKey prop for better React performance`),`rk_${r.indexOf(t)}`)},[l,u]=(0,U.useState)(localStorage.getItem(`${e}_table_order_by`)||null),[d,f]=(0,U.useState)(localStorage.getItem(`${e}_table_order`)||null),[p,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(()=>{try{let t=localStorage.getItem(`${e}_column_visibility`);if(t)return JSON.parse(t)}catch{}return{}}),v=(0,U.useMemo)(()=>{let e={};for(let t of n)t.hidden||(e[t.id]=t.required?!0:g[t.id]!==!1);return e},[n,g]),y=(0,U.useMemo)(()=>{if(!l||!d)return r;let e=n.find(e=>e.id===l);if(!e||e.noSort)return r;let t=r.map((e,t)=>({el:e,index:t}));return t.sort((t,n)=>{let r;return r=typeof e.comparator==`function`?e.comparator(t.el,n.el):Pn(t.el,n.el,l),r===0?t.index-n.index:d===`asc`?r:-r}),t.map(e=>e.el)},[r,l,d,n]),b=t=>{if(l!==t||!l){u(t),f(`asc`),localStorage.setItem(`${e}_table_order_by`,t),localStorage.setItem(`${e}_table_order`,`asc`);return}if(d===`asc`){f(`desc`),localStorage.setItem(`${e}_table_order`,`desc`);return}u(null),f(null),localStorage.removeItem(`${e}_table_order_by`),localStorage.removeItem(`${e}_table_order`)},x=()=>{h(!p)},S=t=>{_(r=>{let i=n.find(e=>e.id===t);if(i&&i.required)return r;let a=v[t]!==!1,o={...r};a?o[t]=!1:delete o[t];try{localStorage.setItem(`${e}_column_visibility`,JSON.stringify(o))}catch{}return o})},C=()=>{_({});try{localStorage.removeItem(`${e}_column_visibility`)}catch{}h(!1)},[T,D]=(0,U.useState)(!1);return T?null:(G&&console.log(`Rendering table ${e}${l&&d?` ordered by ${l}:${d}`:``}`),(0,q.jsxs)(`div`,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,margin:`0`,padding:`0`,gap:`0`,width:`100%`,height:`100%`,overflow:`hidden`},children:[(0,q.jsxs)(me,{open:p,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&x()},disableRestoreFocus:!0,children:[(0,q.jsx)(m,{children:(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,q.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,q.jsx)(`h4`,{style:{margin:0},children:`Configure ${e} columns`})]})}),(0,q.jsx)(ge,{children:(0,q.jsx)(O,{children:n.filter(e=>!e.hidden).map(e=>(0,q.jsx)(P,{control:(0,q.jsx)(ve,{disabled:!!e.required,checked:e.required?!0:v[e.id]!==!1,onChange:()=>S(e.id)}),label:e.label},e.id))})}),(0,q.jsxs)(E,{children:[(0,q.jsx)(w,{onClick:C,children:`Reset`}),(0,q.jsx)(w,{variant:`contained`,onClick:e=>{if(e?.currentTarget&&typeof e.currentTarget.blur==`function`)try{e.currentTarget.blur()}catch{}let t=document.activeElement;if(t&&t instanceof HTMLElement&&typeof t.blur==`function`)try{t.blur()}catch{}x()},children:`Close`})]})]}),(0,q.jsxs)(tn,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,borderBottom:`none`},children:[(0,q.jsx)(Q,{children:e}),t&&(0,q.jsx)(Q,{children:t}),(0,q.jsx)(sn,{close:()=>D(!0),children:(0,q.jsx)(R,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:e=>{if(e?.currentTarget?.blur)try{e.currentTarget.blur()}catch{}x()},"aria-label":`Configure Columns`,children:(0,q.jsx)(B,{title:`Configure ${e} columns`,children:(0,q.jsx)(X.Icon,{path:St,size:`20px`,color:`var(--header-text-color)`})})})})]}),(0,q.jsx)(on,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,minHeight:0,width:`100%`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0`},children:(0,q.jsxs)(`table`,{"aria-label":`${e} table`,style:{width:`100%`,borderCollapse:`collapse`},children:[(0,q.jsx)(`thead`,{style:{position:`sticky`,top:0,zIndex:10,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color`},children:(0,q.jsx)(`tr`,{style:{height:`30px`,minHeight:`30px`},children:n.map(e=>{if(e.hidden||!e.required&&v[e.id]===!1)return null;let t=!e.noSort,n=t&&l===e.id&&!!d;return(0,q.jsxs)(`th`,{onClick:t?()=>b(e.id):void 0,style:{margin:`0`,padding:`5px 10px`,position:`sticky`,top:0,minWidth:e.minWidth,maxWidth:e.maxWidth,textAlign:e.align||`left`,cursor:t?`pointer`:`default`,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,whiteSpace:e.maxWidth?`nowrap`:void 0,overflow:e.maxWidth?`hidden`:void 0,textOverflow:e.maxWidth?`ellipsis`:void 0},"aria-sort":t?n?d===`asc`?`ascending`:`descending`:`none`:void 0,children:[e.label,n&&(0,q.jsxs)(`span`,{style:{marginLeft:6},children:[d===`asc`&&(0,q.jsx)(X.Icon,{path:`M19 17H22L18 21L14 17H17V3H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`}),d===`desc`&&(0,q.jsx)(X.Icon,{path:`M19 7H22L18 3L14 7H17V21H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`})]})]},e.id)})})}),(0,q.jsx)(`tbody`,{children:y.map((e,t)=>{let r=c(e);return(0,q.jsx)(`tr`,{className:t%2==0?`table-content-even`:`table-content-odd`,onClick:s?t=>s(e,r,t):void 0,style:{height:`30px`,minHeight:`30px`,border:`none`,borderCollapse:`collapse`,cursor:s?`pointer`:void 0},children:n.map(t=>{if(t.hidden||!t.required&&v[t.id]===!1)return null;let n=e[t.id],i=typeof t.render==`function`?t.render(n,r,e,t):typeof n==`boolean`?(0,q.jsx)(ve,{checked:n,disabled:!0,size:`small`,sx:{m:0,p:0,color:`var(--table-text-color)`,"&.Mui-disabled":{color:`var(--table-text-color)`,opacity:.7}}}):t.format&&typeof n==`number`?t.format(n):n==null?null:String(n),a=t.tooltip&&t.maxWidth!==void 0&&t.maxWidth!==null&&n!=null&&i!==null?(0,q.jsx)(Nn,{title:String(n),children:i}):i;return(0,q.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,textAlign:t.align||`left`,padding:`5px 10px`,margin:`0`,maxWidth:t.maxWidth,whiteSpace:t.maxWidth?`nowrap`:void 0,overflow:t.maxWidth?`hidden`:void 0,textOverflow:t.maxWidth?`ellipsis`:void 0},children:a},t.id)})},r)})})]})}),(a||o)&&(0,q.jsxs)(nn,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,border:`none`},children:[(0,q.jsx)(rn,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:a}),(0,q.jsx)(rn,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:o})]})]}))}function In(e){return(0,U.memo)(e)}var Ln=In(Fn),Rn=[{label:`Plugin name`,id:`pluginName`,required:!0},{label:`Device type`,id:`type`},{label:`Endpoint`,id:`endpoint`,align:`right`},{label:`Name`,id:`name`,required:!0},{label:`Serial number`,id:`serial`},{label:`Unique ID`,id:`uniqueId`},{label:`Url`,id:`configUrl`},{label:`Config`,id:`configButton`,noSort:!0,render:(e,t,n,r)=>n.configUrl?(0,q.jsx)(R,{onClick:()=>window.open(n.configUrl,`_blank`),"aria-label":`Open Config`,sx:{margin:0,padding:0},children:(0,q.jsx)(T,{fontSize:`small`})}):null},{label:`Cluster`,id:`cluster`}],zn=[{label:`Endpoint`,id:`endpoint`,required:!0},{label:`Id`,id:`id`},{label:`Device Types`,id:`deviceTypes`,render:(e,t,n,r)=>Array.isArray(e)?(0,q.jsx)(q.Fragment,{children:e.map(e=>`0x${e.toString(16).padStart(4,`0`)}`).join(`, `)}):(0,q.jsx)(q.Fragment,{children:e})},{label:`Cluster Name`,id:`clusterName`,required:!0},{label:`Cluster ID`,id:`clusterId`},{label:`Attribute Name`,id:`attributeName`,required:!0},{label:`Attribute ID`,id:`attributeId`},{label:`Attribute Value`,id:`attributeValue`,required:!0,maxWidth:350,tooltip:!0}],Bn=e=>`${e.pluginName}::${e.uniqueId}`,Vn=e=>`${e.endpoint}::${e.clusterName}::${e.attributeName}`;function Hn({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)([]),[d,f]=(0,U.useState)(0),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),x=(0,U.useMemo)(()=>{let n=e?.trim().toLowerCase(),r=n&&n!==`all plugins`,i=s;return r&&(i=i.filter(e=>e.pluginName.toLowerCase()===n)),t!==``&&(i=i.filter(e=>e.name.toLowerCase().includes(t.toLowerCase())||e.serial.toLowerCase().includes(t.toLowerCase()))),i},[s,e,t]),S=(0,U.useRef)(o()),C=(0,U.useRef)(x),w=(0,U.useCallback)(e=>{G&&console.log(`DevicesTable received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=C.current.find(t=>t.pluginName===e.response.plugin&&t.uniqueId===e.response.uniqueId);if(!t){G&&console.warn(`DevicesTable updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" not found in filteredDevicesRef.current`);return}if(p&&h&&t.pluginName===p&&t.uniqueId===y&&e.response.number.toString()===h){let n=l.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);if(!n){G&&console.warn(`DevicesTable updater cluster ${e.response.cluster}.${e.response.attribute} for device "${t.name}" serial "${t.serial}" not found in clusters`);return}n.attributeValue=typeof e.response.value==`object`?JSON.stringify(e.response.value,void 0,1).replaceAll(`"`,``):String(e.response.value),n.attributeLocalValue=e.response.value,u([...l]),G&&console.log(`DevicesTable updated attribute ${n.clusterName}.${n.attributeName} for device "${t.name}" serial "${t.serial}" to "${n.attributeValue}"`)}},[l,h,p,y]);return(0,U.useEffect)(()=>{let e=e=>{if(G&&console.log(`DevicesTable received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`devices`)G&&console.log(`DevicesTable received refresh_required: changed=${e.response.changed} and sending /api/devices request`),r({id:S.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}});else if(e.method===`state_update`&&e.response)w(e);else if(e.method===`/api/devices`)G&&console.log(`DevicesTable received ${e.response.length} devices:`,e.response),c(e.response);else if(e.method===`/api/clusters`){G&&console.log(`DevicesTable received ${e.response.clusters.length} clusters for plugin ${e.response.plugin}:`,e.response),u(e.response.clusters);let t={};for(let n of e.response.clusters)G&&console.log(`Cluster:`,n.endpoint),t[n.endpoint]?t[n.endpoint]++:t[n.endpoint]=1;f(Object.keys(t).length)}};return i(e,S.current),G&&console.log(`DevicesTable added WebSocket listener`),()=>{a(e),G&&console.log(`DevicesTable removed WebSocket listener`)}},[r,i,a,w]),(0,U.useEffect)(()=>{n&&(G&&console.log(`DevicesTable sending api requests with id `,S.current),r({id:S.current,sender:`DevicesTable`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:S.current,sender:`DevicesTable`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:S.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[n,r]),(0,U.useEffect)(()=>{p&&h&&y&&(G&&console.log(`DevicesTable sending /api/clusters`),r({id:S.current,sender:`DevicesTable`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:p,endpoint:Number(h),uniqueId:y}}))},[p,h,y,r]),(0,U.useEffect)(()=>{C.current=x},[x]),G&&console.log(`DevicesTable rendering...`),n?(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,margin:`0px`,padding:`0px`,gap:`20px`,width:`100%`,overflow:`hidden`},children:[(0,q.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,maxHeight:p&&h?`30%`:`100%`,flex:`1 1 auto`,overflow:`hidden`},children:(0,q.jsx)(Ln,{name:`Registered devices`,getRowKey:Bn,onRowClick:e=>{if(e.uniqueId===y){b(null),m(null),g(null),v(null);return}G&&console.log(`DevicesTable handleDeviceClick: selected device "${e.name}" with uniqueId "${e.uniqueId}", plugin "${e.pluginName}", endpoint "${e.endpoint}"`),b(e.uniqueId),m(e.pluginName),g(e.endpoint?e.endpoint.toString():null),v(e.name)},rows:x,columns:Rn,footerLeft:`Total devices: ${x.length.toString()}`})}),p&&h&&(0,q.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,height:`70%`,maxHeight:`70%`,flex:`1 1 auto`,overflow:`hidden`},children:(0,q.jsx)(Ln,{name:`Clusters`,title:_||``,getRowKey:Vn,rows:l,columns:zn,footerLeft:`Total child endpoints: ${d-1}`})})]}):(0,q.jsx)(en,{})}var Un=(0,U.memo)(Hn);function Wn({children:e,style:t,name:n}){let{setCurrentPage:r}=(0,U.useContext)(J);return r(n),G&&console.log(`MbfPage: current page set to ${n}`),(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`20px`,...t},children:e})}function Gn(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,U.useContext)(Y),[a,o]=(0,U.useState)([`All plugins`]),[s,c]=(0,U.useState)(()=>localStorage.getItem(W.devicesFilterPlugins)||`All plugins`),[l,u]=(0,U.useState)(()=>localStorage.getItem(W.devicesFilterDevices)||``),[d,f]=(0,U.useState)(()=>localStorage.getItem(W.devicesViewMode)||`icon`),p=(0,U.useRef)(i());(0,U.useEffect)(()=>{let e=e=>{G&&e.id&&console.log(`Devices received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`plugins`&&!e.response.lock?(G&&console.log(`Devices received refresh_required for plugins lock=${e.response.lock}, sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`/api/plugins`&&e.id===p.current&&e.response&&(G&&console.log(`Devices received ${e.response.length} plugins:`,e.response),o([`All plugins`,...e.response.map(e=>e.name)]))};return n(e,p.current),G&&console.log(`Devices added WebSocket listener`),()=>{r(e),G&&console.log(`Devices removed WebSocket listener`)}},[t,n,r]),(0,U.useEffect)(()=>{e&&(o([`All plugins`]),G&&console.log(`Devices sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[e,t]);let m=e=>{let t=e.target.value;c(t),localStorage.setItem(W.devicesFilterPlugins,t)},h=e=>{u(e.target.value),localStorage.setItem(W.devicesFilterDevices,e.target.value)},g=()=>{u(``),localStorage.removeItem(W.devicesFilterDevices)},_=e=>{f(e),localStorage.setItem(W.devicesViewMode,e)};return G&&console.log(`Devices rendering...`),e?(0,q.jsxs)(Wn,{name:`Devices`,children:[(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`,width:`100%`},children:[(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`},children:[(0,q.jsxs)(M,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,q.jsx)(V,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Plugin:`}),(0,q.jsx)(B,{title:`Filter devices by plugin`,children:(0,q.jsx)(ht,{variant:`outlined`,value:s,onChange:m,sx:{width:`260px`,backgroundColor:`var(--main-bg-color)`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`},"& .MuiSelect-select":{backgroundColor:`var(--main-bg-color)`}},input:(0,q.jsx)(pt,{sx:{backgroundColor:`var(--main-bg-color)`}}),children:a.map(e=>(0,q.jsx)(L,{value:e,children:e},e))})})]}),(0,q.jsxs)(M,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,q.jsx)(V,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Filter by:`}),(0,q.jsx)(B,{title:`Filter devices by name or serial number`,children:(0,q.jsx)(H,{variant:`outlined`,value:l,onChange:h,placeholder:`Enter the device name or serial`,sx:{width:`260px`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`}},slotProps:{input:{endAdornment:l?(0,q.jsx)(F,{position:`end`,children:(0,q.jsx)(R,{"aria-label":`Clear device filter`,size:`small`,onClick:g,edge:`end`,children:(0,q.jsx)(dt,{sx:{fontSize:18,color:`var(--main-label-color)`}})})}):null}}})})]})]}),(0,q.jsxs)(M,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,q.jsx)(V,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`View mode:`}),(0,q.jsx)(R,{onClick:()=>_(`table`),"aria-label":`Table View`,disabled:d===`table`,children:(0,q.jsx)(B,{title:`Table View`,children:(0,q.jsx)(we,{style:{color:d===`table`?`var(--main-icon-color)`:`var(--primary-color)`}})})}),(0,q.jsx)(R,{onClick:()=>_(`icon`),"aria-label":`Icon View`,disabled:d===`icon`,children:(0,q.jsx)(B,{title:`Icon View (beta)`,children:(0,q.jsx)(Ie,{style:{color:d===`icon`?`var(--main-icon-color)`:`var(--primary-color)`}})})})]})]}),d===`table`&&(0,q.jsx)(Un,{filterPlugins:s,filterDevices:l},`table-${e}`),d===`icon`&&(0,q.jsx)(jn,{filterPlugins:s,filterDevices:l},`icon-${e}`)]}):(0,q.jsx)(en,{})}var Kn=(0,U.memo)(Gn);function qn({version:e}){let{online:t}=(0,U.useContext)(Y);return G&&console.log(`HomeBrowserRefresh rendering...`),t?(0,q.jsxs)(Z,{children:[(0,q.jsx)(tn,{children:(0,q.jsx)(Q,{children:`Frontend Update`})}),(0,q.jsxs)(on,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,q.jsxs)(`h4`,{style:{margin:0},children:[`The frontend has been updated to version `,e,`. You are viewing an outdated web UI. Please refresh the page now.`]}),(0,q.jsx)(`div`,{children:(0,q.jsx)(w,{onClick:()=>window.location.reload(),endIcon:(0,q.jsx)(he,{}),style:{marginLeft:`10px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Refresh`})})]})]}):(0,q.jsx)(en,{})}var Jn=(0,U.memo)(qn);function Yn(e){if(G&&console.log(`getQRColor (id: ${e?.id}) received matter:`,e??`undefined`),e===void 0||!e.online||!e.qrPairingCode&&!e.manualPairingCode&&!e.fabricInformations&&!e.sessionInformations)return`red`;if(!e.commissioned&&e.qrPairingCode&&e.manualPairingCode)return`var(--primary-color)`;let t=0,n=0;for(let r of e.sessionInformations??[])r.fabric&&r.isPeerActive&&t++,r.numberOfActiveSubscriptions>0&&(n+=r.numberOfActiveSubscriptions);return e.commissioned&&e.fabricInformations&&e.sessionInformations&&(t===0||n===0)?`var(--secondary-color)`:`var(--div-text-color)`}var Xn=e=>`${e.pluginName}::${e.serial}`,Zn=(e,t)=>e===void 0?t:e===100?x:e>=80?D:e>=60?N:e>=40?et:e>=20?ce:e>=10?_t:p;function Qn({storeId:e,setStoreId:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),{mobile:s}=(0,U.useContext)(J),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!0),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)(0),[y,b]=(0,U.useState)([]),[x,S]=(0,U.useState)(null),[C,O]=(0,U.useState)(`inactive`),k=(0,U.useRef)(o()),A=[{label:`Plugin`,id:`pluginName`},{label:`Name`,id:`name`,required:!0},{label:`Serial`,id:`serial`},{label:`Availability`,id:`availability`,render:(e,t,n,r)=>n.reachable===!0?`Online`:n.reachable===!1?(0,q.jsx)(`span`,{style:{color:`red`},children:`Offline`}):``,comparator:(e,t)=>(e.reachable===!0?1:e.reachable===!1?0:-1)-(t.reachable===!0?1:t.reachable===!1?0:-1)},{label:`Power`,id:`powerSource`,render:(e,t,n,r)=>{if(n.powerSource===`ac`||n.powerSource===`dc`)return(0,q.jsx)(B,{title:n.powerSource===`ac`?`AC current`:`DC current`,children:(0,q.jsx)(ke,{fontSize:`small`,sx:{color:`var(--primary-color)`}})});if(n.powerSource===`ok`){let e=Zn(n.batteryLevel,D);return n.batteryLevel===void 0?(0,q.jsx)(e,{fontSize:`small`,sx:{color:`gray`}}):(0,q.jsx)(B,{title:`Battery level: ${n.batteryLevel}%`,children:(0,q.jsx)(e,{fontSize:`small`,sx:{color:`green`}})})}if(n.powerSource===`warning`){let e=Zn(n.batteryLevel,ce);return n.batteryLevel===void 0?(0,q.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}}):(0,q.jsx)(B,{title:`Battery level: ${n.batteryLevel}%`,children:(0,q.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}})})}if(n.powerSource===`critical`){let e=Zn(n.batteryLevel,p);return n.batteryLevel===void 0?(0,q.jsx)(e,{fontSize:`small`,sx:{color:`red`}}):(0,q.jsx)(B,{title:`Battery level: ${n.batteryLevel}%`,children:(0,q.jsx)(e,{fontSize:`small`,sx:{color:`red`}})})}return(0,q.jsx)(`span`,{})}},{label:`Actions`,id:`selected`,required:!0,render:(n,r,i,a)=>(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`},children:[i.matter===void 0?(0,q.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,q.jsx)(B,{title:`Show the QRCode or the fabrics`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,q.jsx)(R,{onClick:()=>t(e===i.matter?.id?f?.matterbridgeInformation.bridgeMode===`bridge`?`Matterbridge`:null:i.matter?.id||null),"aria-label":`Show the QRCode`,sx:{margin:0,padding:0,color:Yn(i.matter)},children:(0,q.jsx)(ie,{fontSize:`small`})})}),i.configUrl?(0,q.jsx)(B,{title:`Open the configuration page`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,q.jsx)(R,{onClick:()=>N(i),"aria-label":`Open config url`,sx:{margin:0,padding:0},children:(0,q.jsx)(T,{fontSize:`small`})})}):(0,q.jsx)(`div`,{style:{width:`20px`,height:`20px`}}),i.selected===void 0?(0,q.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,q.jsx)(B,{title:`Select/unselect the device`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,q.jsx)(ve,{checked:i.selected,onChange:e=>M(e,i),sx:{margin:`0`,marginLeft:`8px`,padding:`0`},size:`small`})})]})}],j=(0,U.useCallback)(e=>{e.selected=void 0;let t=h.find(t=>t.name===e.pluginName);if(!t)return console.error(`HomeDevices isSelected: plugin ${e.pluginName} not found for device ${e.name} `),e.selected;let n=t.schemaJson?.properties?.whiteList?.selectFrom,r=t.configJson.postfix;return r===``&&(r=void 0),t.hasWhiteList===!0&&t.hasBlackList===!0&&n&&(e.selected=!0,n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(r?e.serial.replace(`-`+r,``):e.serial)&&(e.selected=!0),n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(r?e.serial.replace(`-`+r,``):e.serial)&&(e.selected=!1),n===`serial`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(r?e.serial.replace(`-`+r,``):e.serial)&&(e.selected=!1),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(e.name)&&(e.selected=!0),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(e.name)&&(e.selected=!1),n===`name`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(e.name)&&(e.selected=!1)),e.selected},[h]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`&&e.response.changed!==`matter`)e.response.changed===`plugins`&&e.response.lock?G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} lock=${e.response.lock} skipping /api/plugins request`):(G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and sending /api/plugins request`),r({id:k.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}));else if(e.method===`refresh_required`&&e.response.changed===`matter`)G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and setting matter id ${e.response.matter?.id}`),b(t=>{let n=t.findIndex(t=>t.name.replaceAll(` `,``)===e.response.matter?.id);if(n<0)return G&&console.debug(`HomeDevices: matter id ${e.response.matter?.id} not found`),t;let r=[...t];return r[n]={...r[n],matter:e.response.matter},G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and set matter id ${e.response.matter?.id}`),r});else if(e.method===`restart_required`)G&&console.log(`HomeDevices received restart_required`),l(!0);else if(e.method===`restart_not_required`)G&&console.log(`HomeDevices received restart_not_required`),l(!1);else if(e.method===`matterbridge_status_update`)G&&console.log(`HomeDevices received matterbridge_status_update: ${e.response.status}`),O(e.response.status);else if(e.method===`state_update`&&e.response.plugin&&e.response.serialNumber&&e.response.cluster.includes(`BasicInformation`)&&e.response.attribute===`reachable`){G&&console.log(`HomeDevices updating device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}...`);let t=e.response.value;b(n=>{let r=n.findIndex(t=>t.pluginName===e.response.plugin&&t.serial===e.response.serialNumber);if(r<0)return G&&console.warn(`HomeDevices: device to update not found for plugin ${e.response.plugin} serial ${e.response.serialNumber}`),n;let i=[...n];return i[r]={...i[r],reachable:t},i}),G&&console.log(`HomeDevices updated device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}`)}if(e.id===k.current&&e.method===`/api/settings`)G&&console.log(`HomeDevices (id: ${e.id}) received settings:`,e.response),m(e.response),l(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired),O(e.response.matterbridgeInformation.bridgeStatus);else if(e.id===k.current&&e.method===`/api/plugins`){if(G&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} plugins:`,e.response),e.response){let t=!0;for(let n of e.response)n.enabled&&(n.loaded!==!0||n.started!==!0||n.error===!0)&&(t=!1);if(!t)return;G&&console.log(`HomeDevices reset plugins and mixedDevices, starting a fresh load cycle`),d(!1),g(e.response),v(0),b([]),r({id:k.current,sender:`HomeDevices`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}}),G&&console.log(`HomeDevices sent /api/devices`);for(let t of e.response)t.enabled&&t.loaded===!0&&t.started===!0&&t.error!==!0&&(r({id:k.current,sender:`HomeDevices`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:t.name}}),G&&console.log(`HomeDevices sent /api/select/devices for plugin: ${t.name}`))}}else if(e.id===k.current&&e.method===`/api/devices`){if(G&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} devices:`,e.response),e.response){let t=e.response.map(e=>Object.assign(e,{selected:j(e),origin:`device`}));v(t.length),b(e=>{let n=new Set(t.map(e=>`${e.pluginName}::${e.serial}`)),r=e.filter(e=>e.origin===`select`&&!n.has(`${e.pluginName}::${e.serial}`));return[...t,...r]})}}else if(e.id===k.current&&e.method===`/api/select/devices`&&(G&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} selectDevices for plugin ${e.response&&e.response.length>0?e.response[0].pluginName:`without select devices`}:`,e.response),e.response&&e.response.length>0)){let t=e.response[0].pluginName;b(n=>{let r=n.filter(e=>e.origin!==`select`||e.pluginName!==t),i=r.filter(e=>e.origin===`device`),a=e.response.filter(e=>!i.some(t=>t.pluginName===e.pluginName&&t.serial.includes(e.serial))).map(e=>Object.assign(e,{selected:j(e),origin:`select`}));return[...r,...a]})}};return i(e,k.current),G&&console.log(`HomeDevices added WebSocket listener id ${k.current}`),()=>{a(e),G&&console.log(`HomeDevices removed WebSocket listener`)}},[i,a,r,j]),(0,U.useEffect)(()=>{n&&(G&&console.log(`HomeDevices sending /api/settings and /api/plugins requests`),r({id:k.current,sender:`HomeDevices`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:k.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[n,r]);let M=(e,t)=>{G&&console.log(`handleCheckboxChange: checkbox changed to ${e.target.checked} for device ${t.name} serial ${t.serial}`);let n=e.target.checked;b(e=>{let r=e.findIndex(e=>e.pluginName===t.pluginName&&e.serial===t.serial);if(r<0)return console.error(`handleCheckboxChange: device ${t.name} serial ${t.serial} not found in mixedDevices`),e;let i=[...e];return i[r]={...i[r],selected:n},i}),e.target.checked?r({id:k.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`selectdevice`,plugin:t.pluginName,serial:t.serial,name:t.name}}):r({id:k.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`unselectdevice`,plugin:t.pluginName,serial:t.serial,name:t.name}})},N=e=>{if(G&&console.log(`handleConfigUrl device:`,e.name,`configUrl:`,e.configUrl),e.configUrl){if(e.configUrl.startsWith(`/plugins/`)||e.configUrl.startsWith(`./plugins/`)){let t=`${Yt}${e.configUrl.replace(/^\.?\//,``)}`,n=new URL(t,window.location.origin);n.pathname.endsWith(`/`)||(n.pathname+=`/`);let r=`${n.pathname}${n.search}${n.hash}`;G&&console.log(`handleConfigUrl opening plugin frontend for device:`,e.name,`basePath:`,Yt,`configUrl:`,e.configUrl,`computed pluginFrontendPath:`,r),S({name:e.name,path:r})}else window.open(e.configUrl,`_blank`)}};return G&&console.log(`HomeDevices rendering...`),n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Z,{style:{flex:`1 1 auto`},children:(0,q.jsx)(Ln,{name:`Devices`,getRowKey:Xn,rows:y,columns:A,footerLeft:u?`Waiting for the plugins to fully load...`:`Registered devices: ${_.toString()}/${y.length.toString()}`,footerRight:c?`Restart required`:``})}),(0,q.jsxs)(me,{open:x!==null,onClose:()=>S(null),slotProps:{paper:{sx:{width:K&&s?`100vw`:`75vw`,height:K&&s?`100vh`:`75vh`,maxWidth:K&&s?`100vw`:`75vw`,maxHeight:K&&s?`100vh`:`75vh`,margin:K&&s?`0px`:void 0,display:`flex`,flexDirection:`column`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`}}},children:[(0,q.jsx)(ge,{style:{display:`flex`,flex:`1 1 auto`,minHeight:0,padding:`0px`,margin:`0px`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`},children:x&&(0,q.jsx)(`iframe`,{title:`${x.name} frontend`,src:x.path,onLoad:e=>{let t=e.currentTarget.contentDocument;if(!t?.head)return;let n=getComputedStyle(document.body),r=n.getPropertyValue(`--primary-color`).trim()||`#0d6efd`,i=n.getPropertyValue(`--div-bg-color`).trim()||`#111111`;t.getElementById(`matterbridge-plugin-scrollbar-style`)?.remove();let a=t.createElement(`style`);a.id=`matterbridge-plugin-scrollbar-style`,a.textContent=`
2
+ `)),[`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(t.response.level)&&(E.current===`info`&&t.response.level===`debug`||E.current===`notice`&&(t.response.level===`debug`||t.response.level===`info`)||E.current===`warn`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`)||E.current===`error`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`)||E.current===`fatal`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`||t.response.level===`error`)))||D.current!==`*`&&D.current!==``&&!D.current.startsWith(`/`)&&!D.current.endsWith(`/`)&&!t.response.message.toLowerCase().includes(D.current.toLowerCase())&&!t.response.name.toLowerCase().includes(D.current.toLowerCase())||D.current.startsWith(`/`)&&D.current.endsWith(`/`)&&(()=>{try{let e=new RegExp(D.current.slice(1,-1),`i`);return!e.test(t.response.message)&&!e.test(t.response.name)}catch(e){return console.error(`WebSocket log search invalid regex filter "${D.current}":`,e),!1}})()||t.response.name===`Commissioning`&&t.response.message.includes(`is uncommissioned`))return;n(e=>{let n=[...e,{level:t.response.level,time:t.response.time,name:t.response.name,message:t.response.message}];return G&&console.log(`WebSocket new log message added (${n.length}/${A.current}):`,n[n.length-1]),n.length>A.current+A.current*10/100?(G&&console.log(`WebSocket sliced log messages to the last ${A.current} entries`),n.slice(n.length-A.current)):n})}else{if(G&&console.log(`WebSocket received message id ${t.id} method ${t.method}:`,t),t.id===0)y.current.forEach(e=>e.listener(t));else{let e=y.current.find(e=>e.id===t.id);e?e.listener(t):G&&console.warn(`WebSocket no listener found for message id %s:`,t.id,t)}return}}catch(e){console.error(`WebSocket error parsing message: ${String(e)}`,e instanceof Error?e.stack:null)}},b.current.onopen=()=>{G&&console.log(`WebSocket: Connected to WebSocket: ${P}`),F(`WebSocket`,`Connected to WebSocket: ${P}`),c(!0),p(),x.current=1,u(1),T.current=setTimeout(()=>{C.current=setInterval(()=>{ne({id:S.current,method:`ping`,src:`Frontend`,dst:`Matterbridge`,params:{}}),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{G&&console.error(`WebSocketUse: No pong response received from WebSocket: ${P}`),F(`WebSocket`,`No pong response received from WebSocket: ${P}`),c(!1)},5e4)},6e4)},3e5)},b.current.onclose=()=>{G&&console.error(`WebSocket: Disconnected from WebSocket ${qt?`with Ingress`:``}: ${P}`),F(`WebSocket`,`Disconnected from WebSocket: ${P}`),c(!1),p(),h(),T.current&&clearTimeout(T.current),w.current&&clearTimeout(w.current),C.current&&clearInterval(C.current),F(`WebSocket`,`Reconnecting (attempt ${x.current} of 100) to WebSocket${qt?` (Ingress)`:``}: ${P}`),qt?setTimeout(ae,5e3):x.current===1?ae():x.current<100?setTimeout(ae,1e3*x.current):F(`WebSocket`,`Reconnect attempts exceeded limit of 100 retries, refresh the page to reconnect to: ${P}`),x.current+=1,u(x.current)},b.current.onerror=e=>{G&&console.error(`WebSocket: WebSocket error connecting to ${P}:`,e),F(`WebSocket`,`WebSocket error connecting to ${P}`)})},[P]),ae=(0,U.useCallback)(()=>{G&&console.log(`WebSocket attemptReconnect ${x.current}/100 to:`,P),ie()},[ie]);(0,U.useEffect)(()=>(ie(),()=>{b.current&&b.current.readyState===WebSocket.OPEN&&b.current.close()}),[ie]);let oe=(0,U.useMemo)(()=>({messages:t,logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:N,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:te}),[t,A,j,r,a,n,M,N,i,o,te]),se=(0,U.useMemo)(()=>({logLength:A,logAutoScroll:j,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogLength:M,setLogAutoScroll:N,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:te,online:s,retry:l,getUniqueId:ee,addListener:re,removeListener:I,sendMessage:ne,logMessage:F}),[A,j,n,M,N,i,o,s,l,re,I,ne,F]);return(0,q.jsx)(Qt.Provider,{value:oe,children:(0,q.jsx)(Y.Provider,{value:se,children:e})})}function en(){let{retry:e}=(0,U.useContext)(Y);return(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100vw`,height:`100vh`,justifyContent:`center`,alignItems:`center`,fontSize:`20px`,color:`var(--main-text-color)`,backgroundColor:`var(--main-bg-color)`},children:[(0,q.jsx)(Zt,{style:{height:`128px`,width:`128px`,margin:`10px`,marginBottom:`20px`}}),e<100?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(be,{style:{color:`var(--primary-color)`}}),(0,q.jsx)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:(0,q.jsxs)(`span`,{children:[`Reconnecting to Matterbridge `,`(attempt `+e+`)`,`...`]})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:[(0,q.jsx)(`span`,{children:`Unable to connect to Matterbridge after multiple attempts.`}),(0,q.jsx)(`br`,{}),(0,q.jsx)(`span`,{children:`Please check your network connection.`}),(0,q.jsx)(`br`,{})]}),(0,q.jsx)(w,{variant:`contained`,color:`primary`,onClick:()=>{window.location.reload()},style:{marginTop:`20px`},children:`Refresh the Page`})]})]})}var X=wt();function Z({children:e,style:t}){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:`0 0 auto`,width:`100%`,overflow:`hidden`,margin:`0px`,padding:`0px`,gap:`0px`,backgroundColor:`var(--div-bg-color)`,boxShadow:`5px 5px 10px var(--div-shadow-color)`,border:`1px solid var(--table-border-color)`,borderRadius:`var(--div-border-radius)`,boxSizing:`border-box`,...t},children:e})}function tn({children:e,style:t}){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,borderBottom:`1px solid var(--table-border-color)`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function Q({children:e,style:t}){return(0,q.jsx)(`div`,{style:{color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,fontSize:`16px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function nn({children:e,style:t}){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,width:`100%`,height:`30px`,color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,margin:`0px`,padding:`0px`,boxSizing:`border-box`,...t},children:e})}function rn({children:e,style:t}){return(0,q.jsx)(`div`,{style:{color:`var(--footer-text-color)`,backgroundColor:`var(--footer-bg-color)`,fontSize:`14px`,fontWeight:`bold`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function an({children:e,style:t}){return(0,q.jsx)(`div`,{style:{color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,fontSize:`14px`,fontWeight:`normal`,margin:`0px`,padding:`5px 10px`,...t},children:e})}function on({children:e,style:t,onDragOver:n,onDragLeave:r,onDrop:i}){return(0,q.jsx)(`div`,{style:{flex:`0 0 auto`,display:`flex`,flexDirection:`row`,overflow:`hidden`,alignItems:`start`,justifyContent:`space-between`,margin:`0px`,padding:`10px`,gap:`20px`,...t},onDragOver:n,onDragLeave:r,onDrop:i,children:e})}function sn({children:e,style:t,close:n}){return(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,margin:`0px`,padding:`0px`,paddingRight:`10px`,gap:`10px`,...t},children:[e,!1]})}var cn=[`Off`,`Low`,`Medium`,`High`,`On`,`Auto`,`Smart`],ln={display:`flex`,gap:`2px`,justifyContent:`space-evenly`,width:`100%`,height:`40px`},un={margin:`0`,padding:`0`,fontSize:`36px`,fontWeight:`medium`,color:`var(--primary-color)`},dn={margin:`0`,padding:`0`,fontSize:`20px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},fn={margin:`0`,padding:`0`,paddingBottom:`2px`,fontSize:`16px`,fontWeight:`medium`,color:`var(--div-text-color)`,textAlign:`center`},pn={display:`flex`,gap:`2px`,justifyContent:`center`,width:`100%`,height:`18px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},mn={margin:`0`,padding:`0`,fontSize:`12px`,fontWeight:`normal`,color:`var(--div-text-color)`},hn={display:`flex`,justifyContent:`center`,width:`100%`,height:`52px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},gn={margin:`0`,padding:`0`,fontSize:`14px`,fontWeight:`bold`,color:`var(--div-text-color)`},_n={display:`flex`,gap:`4px`,justifyContent:`center`,width:`100%`,height:`15px`,margin:`0`,padding:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`normal`},vn={margin:`0`,padding:`0px 4px`,borderRadius:`5px`,textAlign:`center`,fontSize:`12px`,fontWeight:`normal`,color:`var(--secondary-color)`},yn=[256,257,268,269],bn=[266,267],xn=[271,272],Sn=[256,257,268,269,266,267,272],Cn=[43,45],wn=[`Closed`,`Open`,`Partial`,`Pedestrian`,`Ventilation`,`Signature`];function Tn(e){if(typeof e!=`object`||!e||!(`position`in e))return`N/A`;let t=e.position;return typeof t!=`number`||!Number.isInteger(t)||t<0||t>=wn.length?`N/A`:wn[t]}function En(e){return typeof e!=`number`||!Number.isInteger(e)||e<0||e>1e4?`N/A`:e===0?wn[0]:e===1e4?wn[1]:wn[2]}function Dn(e){return typeof e!=`object`||!e||!(`position`in e)?`N/A`:En(e.position)}function $({icon:e,iconColor:t,cluster:n,value:r,unit:i,prefix:a}){return G&&console.log(`Render cluster "${n.clusterName}.${n.attributeName}" value(${typeof r}-${Number.isNaN(r)}) "${r}" unit "${i}"`),a??=!1,(0,q.jsxs)(M,{sx:ln,children:[e&&(0,U.cloneElement)(e,{key:`${n.clusterId}-${n.attributeId}-icon`,sx:{...un,color:t??`var(--primary-color)`}}),(0,q.jsxs)(M,{sx:{...ln,gap:`4px`,alignContent:`center`,alignItems:`end`,justifyContent:`center`},children:[i&&a&&(0,q.jsx)(V,{sx:fn,children:i},`${n.clusterId}-${n.attributeId}-unit-prefix`),(0,q.jsx)(V,{sx:dn,children:r==null||typeof r==`number`&&Number.isNaN(r)||r===`NaN`?`---`:r},`${n.clusterId}-${n.attributeId}-value`),i&&!a&&(0,q.jsx)(V,{sx:fn,children:i},`${n.clusterId}-${n.attributeId}-unit-suffix`)]},`${n.clusterId}-${n.attributeId}-valueunitbox`)]},`${n.clusterId}-${n.attributeId}-box`)}function On({device:e,endpoint:t,id:n,deviceType:r,clusters:i}){let a=[`Unknown`,`Good`,`Fair`,`Moderate`,`Poor`,`VeryPoor`,`Ext.Poor`],o=``,s=e=>{if(!e)return null;let t=e.attributeLocalValue;if(!t||typeof t!=`object`||!(`energy`in t))return null;let n=t.energy;return typeof n!=`number`&&typeof n!=`bigint`?null:Math.round(Number(n)/1e6)},c=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyImported`),u=i.find(e=>e.clusterName===`ElectricalEnergyMeasurement`&&e.attributeName===`cumulativeEnergyExported`),d=s(c),f=s(u),p=c??u,m=d??(f===null?null:`+ ${f}`);G&&console.log(`Device "${e.name}" endpoint "${t}" id "${n}" deviceType "0x${r.toString(16).padStart(4,`0`)}" clusters (${i?.length})`);let h=i.find(e=>e.clusterName===`Descriptor`&&e.attributeName===`tagList`)?.attributeLocalValue;if(h){let e=``;h.map(t=>{t.label&&(e+=t.label+` `)}),o=e.trim()}if(r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batVoltage`).map(e=>o=`${e.attributeLocalValue??0} mV`),Sn.includes(r)&&i.filter(e=>e.clusterName===`LevelControl`&&e.attributeName===`currentLevel`).map(e=>o=`Level ${e.attributeValue}`),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>o=`Position ${e.attributeLocalValue/100}%`),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedHeatingSetpoint`).map(e=>o=`Heat ${e.attributeLocalValue/100}°C `),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`occupiedCoolingSetpoint`).map(e=>o+=`Cool ${e.attributeLocalValue/100}°C`),Cn.includes(r)&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`percentCurrent`).map(e=>o=`Speed ${e.attributeValue}%`),r===118&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>o=e.attributeLocalValue===0?`No CO detected`:`CO alarm!`),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`voltage`).map(e=>o=`${e.attributeLocalValue/1e3} V, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activeCurrent`).map(e=>o+=`${e.attributeLocalValue/1e3} A, `),r===1296&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`activePower`).map(e=>o+=`${e.attributeLocalValue/1e6} kW`),r===39){let e=i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`ModeSelect`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}if(r===116){let e=i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`)?.attributeLocalValue;o=(i.find(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`supportedModes`)?.attributeLocalValue)?.find(t=>t.mode===e)?.label||`Unknown`}return(0,q.jsxs)(Z,{style:{margin:`0px`,padding:`5px`,width:`150px`,height:`150px`,borderColor:`var(--div-bg-color)`,borderRadius:`5px`,justifyContent:`space-between`},children:[r===19&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:e.attributeLocalValue===!0?(0,q.jsx)(_e,{}):(0,q.jsx)(pe,{}),iconColor:e.attributeLocalValue===!0?`green`:`red`,cluster:e,value:e.attributeLocalValue===!0?`Online`:`Offline`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`batPercentRemaining`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(et,{}),cluster:e,value:e.attributeLocalValue/2,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===17&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`wiredCurrentType`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(ke,{}),cluster:e,value:e.attributeLocalValue===0?`AC`:`DC`},`${e.clusterId}-${e.attributeId}`)),r===1293&&i.filter(e=>e.clusterName===`DeviceEnergyManagement`&&e.attributeName===`esaState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Offline`:`Online`},`${e.clusterId}-${e.attributeId}`)),yn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),bn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M7.5,10.5A1.5,1.5 0 0,1 9,12A1.5,1.5 0 0,1 7.5,13.5C6.66,13.5 6,12.83 6,12A1.5,1.5 0 0,1 7.5,10.5M16.5,10.5A1.5,1.5 0 0,1 18,12A1.5,1.5 0 0,1 16.5,13.5A1.5,1.5 0 0,1 15,12A1.5,1.5 0 0,1 16.5,10.5M4.22,2H19.78C21,2 22,3 22,4.22V19.78A2.22,2.22 0 0,1 19.78,22H4.22C3,22 2,21 2,19.78V4.22A2.22,2.22 0 0,1 4.22,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),xn.includes(r)&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===259&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===260&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===261&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===2112&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(rt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===115&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M14.83,11.17C16.39,12.73 16.39,15.27 14.83,16.83C13.27,18.39 10.73,18.39 9.17,16.83L14.83,11.17M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===124&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M7,4A1,1 0 0,0 6,5A1,1 0 0,0 7,6A1,1 0 0,0 8,5A1,1 0 0,0 7,4M10,4A1,1 0 0,0 9,5A1,1 0 0,0 10,6A1,1 0 0,0 11,5A1,1 0 0,0 10,4M12,8A6,6 0 0,0 6,14A6,6 0 0,0 12,20A6,6 0 0,0 18,14A6,6 0 0,0 12,8M8.11,10.5H10C9.76,11.88 10,12.67 10.58,13.29C11.68,14.36 12.16,15.71 11.89,17.5H10C10.24,16.12 10,15.33 9.42,14.71C8.32,13.64 7.85,12.29 8.11,10.5M12.11,10.5H14C13.76,11.88 14,12.67 14.58,13.29C15.68,14.36 16.16,15.71 15.89,17.5H14C14.24,16.12 14,15.33 13.42,14.71C12.32,13.64 11.85,12.29 12.11,10.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===117&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M18,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V4A2,2 0 0,0 18,2M10,4A1,1 0 0,1 11,5A1,1 0 0,1 10,6A1,1 0 0,1 9,5A1,1 0 0,1 10,4M7,4A1,1 0 0,1 8,5A1,1 0 0,1 7,6A1,1 0 0,1 6,5A1,1 0 0,1 7,4M18,20H6V8H18V20M14.67,15.33C14.69,16.03 14.41,16.71 13.91,17.21C12.86,18.26 11.15,18.27 10.09,17.21C9.59,16.71 9.31,16.03 9.33,15.33C9.4,14.62 9.63,13.94 10,13.33C10.37,12.5 10.81,11.73 11.33,11L12,10C13.79,12.59 14.67,14.36 14.67,15.33`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===123&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(oe,{}),cluster:e,value:`Oven`},`${e.clusterId}-${e.attributeId}`)),r===112&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Be,{}),cluster:e,value:`Fridge`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`temperatureSetpoint`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===113&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===121&&i.filter(e=>e.clusterName===`OperationalState`&&e.attributeName===`operationalState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(oe,{}),cluster:e,value:e.attributeLocalValue===0?`Normal`:`Error`},`${e.clusterId}-${e.attributeId}`)),r===122&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M19,18.31V20A2,2 0 0,1 17,22H7A2,2 0 0,1 5,20V16.3C4.54,16.12 3.95,16 3,16A1,1 0 0,1 2,15A1,1 0 0,1 3,14C3.82,14 4.47,14.08 5,14.21V12.3C4.54,12.12 3.95,12 3,12A1,1 0 0,1 2,11A1,1 0 0,1 3,10C3.82,10 4.47,10.08 5,10.21V8.3C4.54,8.12 3.95,8 3,8A1,1 0 0,1 2,7A1,1 0 0,1 3,6C3.82,6 4.47,6.08 5,6.21V4A2,2 0 0,1 7,2H17A2,2 0 0,1 19,4V6.16C20.78,6.47 21.54,7.13 21.71,7.29C22.1,7.68 22.1,8.32 21.71,8.71C21.32,9.1 20.8,9.09 20.29,8.71V8.71C20.29,8.71 19.25,8 17,8C15.74,8 14.91,8.41 13.95,8.9C12.91,9.41 11.74,10 10,10C9.64,10 9.31,10 9,9.96V7.95C9.3,8 9.63,8 10,8C11.26,8 12.09,7.59 13.05,7.11C14.09,6.59 15.27,6 17,6V4H7V20H17V18C18.5,18 18.97,18.29 19,18.31M17,10C15.27,10 14.09,10.59 13.05,11.11C12.09,11.59 11.26,12 10,12C9.63,12 9.3,12 9,11.95V13.96C9.31,14 9.64,14 10,14C11.74,14 12.91,13.41 13.95,12.9C14.91,12.42 15.74,12 17,12C19.25,12 20.29,12.71 20.29,12.71V12.71C20.8,13.1 21.32,13.1 21.71,12.71C22.1,12.32 22.1,11.69 21.71,11.29C21.5,11.08 20.25,10 17,10M17,14C15.27,14 14.09,14.59 13.05,15.11C12.09,15.59 11.26,16 10,16C9.63,16 9.3,16 9,15.95V17.96C9.31,18 9.64,18 10,18C11.74,18 12.91,17.41 13.95,16.9C14.91,16.42 15.74,16 17,16C19.25,16 20.29,16.71 20.29,16.71V16.71C20.8,17.1 21.32,17.1 21.71,16.71C22.1,16.32 22.1,15.69 21.71,15.29C21.5,15.08 20.25,14 17,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===120&&i.filter(e=>e.clusterName===`BridgedDeviceBasicInformation`&&e.attributeName===`reachable`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Cooktop`},`${e.clusterId}-${e.attributeId}`)),r===119&&i.filter(e=>e.clusterName===`TemperatureControl`&&e.attributeName===`selectedTemperatureLevel`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M6,14H8L11,17H9L6,14M4,4H5V3A1,1 0 0,1 6,2H10A1,1 0 0,1 11,3V4H13V3A1,1 0 0,1 14,2H18A1,1 0 0,1 19,3V4H20A2,2 0 0,1 22,6V19A2,2 0 0,1 20,21V22H17V21H7V22H4V21A2,2 0 0,1 2,19V6A2,2 0 0,1 4,4M18,7A1,1 0 0,1 19,8A1,1 0 0,1 18,9A1,1 0 0,1 17,8A1,1 0 0,1 18,7M14,7A1,1 0 0,1 15,8A1,1 0 0,1 14,9A1,1 0 0,1 13,8A1,1 0 0,1 14,7M20,6H4V10H20V6M4,19H20V12H4V19M6,7A1,1 0 0,1 7,8A1,1 0 0,1 6,9A1,1 0 0,1 5,8A1,1 0 0,1 6,7M13,14H15L18,17H16L13,14Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===514&&i.filter(e=>e.clusterName===`WindowCovering`&&e.attributeName===`currentPositionLiftPercent100ths`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:En(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===515&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===560&&i.filter(e=>e.clusterName===`ClosureControl`&&e.attributeName===`overallCurrentState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:Tn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===574&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===561&&i.filter(e=>e.clusterName===`ClosureDimension`&&e.attributeName===`currentState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Pe,{}),cluster:e,value:Dn(e.attributeLocalValue)},`${e.clusterId}-${e.attributeId}`)),r===769&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===778&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===10&&i.filter(e=>e.clusterName===`DoorLock`&&e.attributeName===`lockState`).map(e=>(0,q.jsx)($,{icon:e.attributeValue===`1`?(0,q.jsx)(st,{}):(0,q.jsx)(Me,{}),cluster:e,value:e.attributeValue===`1`?`Locked`:`Unlocked`},`${e.clusterId}-${e.attributeId}`)),r===11&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(st,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===43&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Je,{}),cluster:e,value:cn[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===15&&i.filter(e=>e.clusterName===`Switch`&&e.attributeName===`currentPosition`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M13 5C15.21 5 17 6.79 17 9C17 10.5 16.2 11.77 15 12.46V11.24C15.61 10.69 16 9.89 16 9C16 7.34 14.66 6 13 6S10 7.34 10 9C10 9.89 10.39 10.69 11 11.24V12.46C9.8 11.77 9 10.5 9 9C9 6.79 10.79 5 13 5M20 20.5C19.97 21.32 19.32 21.97 18.5 22H13C12.62 22 12.26 21.85 12 21.57L8 17.37L8.74 16.6C8.93 16.39 9.2 16.28 9.5 16.28H9.7L12 18V9C12 8.45 12.45 8 13 8S14 8.45 14 9V13.47L15.21 13.6L19.15 15.79C19.68 16.03 20 16.56 20 17.14V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.11 2.9 14 4 14H8V12L4 12L4 4H20L20 12H18V14H20V13.96L20.04 14C21.13 14 22 13.09 22 12V4C22 2.9 21.11 2 20 2Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`pos`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===39&&i.filter(e=>e.clusterName===`ModeSelect`&&e.attributeName===`currentMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(je,{}),cluster:e,value:e.attributeValue,unit:`Mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===771&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(lt,{}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===772&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(lt,{}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===45&&i.filter(e=>e.clusterName===`FanControl`&&e.attributeName===`fanMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Ee,{}),cluster:e,value:cn[e.attributeLocalValue]??`Unknown`},`${e.clusterId}-${e.attributeId}`)),r===114&&i.filter(e=>e.clusterName===`Thermostat`&&e.attributeName===`localTemperature`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Ee,{}),cluster:e,value:(e.attributeLocalValue??0)/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===67&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(C,{}),cluster:e,value:e.attributeLocalValue===!0?`Leak`:`No leak`},`${e.clusterId}-${e.attributeId}`)),r===65&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Re,{}),cluster:e,value:e.attributeLocalValue===!0?`Freeze`:`No freeze`},`${e.clusterId}-${e.attributeId}`)),r===68&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(tt,{}),cluster:e,value:e.attributeLocalValue===!0?`Rain`:`No rain`},`${e.clusterId}-${e.attributeId}`)),r===116&&i.filter(e=>e.clusterName===`RvcRunMode`&&e.attributeName===`currentMode`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12,2C14.65,2 17.19,3.06 19.07,4.93L17.65,6.35C16.15,4.85 14.12,4 12,4C9.88,4 7.84,4.84 6.35,6.35L4.93,4.93C6.81,3.06 9.35,2 12,2M3.66,6.5L5.11,7.94C4.39,9.17 4,10.57 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,10.57 19.61,9.17 18.88,7.94L20.34,6.5C21.42,8.12 22,10.04 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12C2,10.04 2.58,8.12 3.66,6.5M12,6A6,6 0 0,1 18,12C18,13.59 17.37,15.12 16.24,16.24L14.83,14.83C14.08,15.58 13.06,16 12,16C10.94,16 9.92,15.58 9.17,14.83L7.76,16.24C6.63,15.12 6,13.59 6,12A6,6 0 0,1 12,6M12,8A1,1 0 0,0 11,9A1,1 0 0,0 12,10A1,1 0 0,0 13,9A1,1 0 0,0 12,8Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeValue,unit:`Run mode`,prefix:!0},`${e.clusterId}-${e.attributeId}`)),r===1292&&i.filter(e=>e.clusterName===`EnergyEvse`&&e.attributeName===`state`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M19.77,7.23L19.78,7.22L16.06,3.5L15,4.56L17.11,6.67C16.17,7.03 15.5,7.93 15.5,9A2.5,2.5 0 0,0 18,11.5C18.36,11.5 18.69,11.42 19,11.29V18.5A1,1 0 0,1 18,19.5A1,1 0 0,1 17,18.5V14A2,2 0 0,0 15,12H14V5A2,2 0 0,0 12,3H6A2,2 0 0,0 4,5V21H14V13.5H15.5V18.5A2.5,2.5 0 0,0 18,21A2.5,2.5 0 0,0 20.5,18.5V9C20.5,8.31 20.22,7.68 19.77,7.23M18,10A1,1 0 0,1 17,9A1,1 0 0,1 18,8A1,1 0 0,1 19,9A1,1 0 0,1 18,10M8,18V13.5H6L10,6V11H12L8,18Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Free`:`In use`},`${e.clusterId}-${e.attributeId}`)),r===1295&&i.filter(e=>e.clusterName===`WaterHeaterManagement`&&e.attributeName===`tankPercentage`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 2C6.89 2 6 2.89 6 4V16C6 17.11 6.89 18 8 18H9V20H6V22H9C10.11 22 11 21.11 11 20V18H13V20C13 21.11 13.89 22 15 22H18V20H15V18H16C17.11 18 18 17.11 18 16V4C18 2.89 17.11 2 16 2H8M12 4.97A2 2 0 0 1 14 6.97A2 2 0 0 1 12 8.97A2 2 0 0 1 10 6.97A2 2 0 0 1 12 4.97M10 14.5H14V16H10V14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tank `+(e.attributeLocalValue??0)+`%`},`${e.clusterId}-${e.attributeId}`)),r===1297&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Utility`},`${e.clusterId}-${e.attributeId}`)),r===1298&&i.filter(e=>e.clusterName===`MeterIdentification`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Reference`},`${e.clusterId}-${e.attributeId}`)),r===1299&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Tariff`},`${e.clusterId}-${e.attributeId}`)),r===1300&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Meter`},`${e.clusterId}-${e.attributeId}`)),r===777&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M12.75 7.08C13.57 7.2 14.32 7.5 14.95 8L12.75 10.19V7.08M11.25 7.08V10.19L9.05 8C9.68 7.5 10.43 7.2 11.25 7.08M8 9.05L10.19 11.25H7.08C7.2 10.43 7.5 9.68 8 9.05M7.08 12.75H10.19L8 14.95C7.5 14.32 7.2 13.57 7.08 12.75M11.25 16.92C10.43 16.8 9.68 16.5 9.05 16L11.25 13.81V16.92M12 13C11.45 13 11 12.55 11 12S11.45 11 12 11 13 11.45 13 12 12.55 13 12 13M12.75 16.92V13.81L14.95 16C14.32 16.5 13.57 16.8 12.75 16.92M16 14.95L13.81 12.75H16.92C16.8 13.57 16.5 14.32 16 14.95M13.81 11.25L16 9.05C16.5 9.69 16.8 10.44 16.92 11.25H13.81Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`HeatPump`},`${e.clusterId}-${e.attributeId}`)),r===23&&i.filter(e=>e.clusterName===`PowerSource`&&e.attributeName===`featureMap`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M4,2H20A2,2 0 0,1 22,4V14A2,2 0 0,1 20,16H15V20H18V22H13V16H11V22H6V20H9V16H4A2,2 0 0,1 2,14V4A2,2 0 0,1 4,2M4,4V8H11V4H4M4,14H11V10H4V14M20,14V10H13V14H20M20,4H13V8H20V4Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Solar`},`${e.clusterId}-${e.attributeId}`)),r===24&&i.filter(e=>e.clusterName===`ElectricalPowerMeasurement`&&e.attributeName===`featureMap`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12 20L5 20V12H2L12 3L14.78 5.5H14V7.17C12.84 7.58 12 8.7 12 10V20M15 9H16V7.5H20V9H21C21.55 9 22 9.45 22 10V21C22 21.55 21.55 22 21 22H15C14.45 22 14 21.55 14 21V10C14 9.45 14.45 9 15 9M16 11V14H20V11H16Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Inverter`},`${e.clusterId}-${e.attributeId}`)),r===40&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===35&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===34&&i.filter(e=>e.clusterName===`OnOff`&&e.attributeName===`onOff`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===!0?`On`:`Off`},`${e.clusterId}-${e.attributeId}`)),r===41&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===42&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Controller`},`${e.clusterId}-${e.attributeId}`)),r===36&&i.filter(e=>e.clusterName===`ApplicationBasic`&&e.attributeName===`applicationName`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`App`},`${e.clusterId}-${e.attributeId}`)),r===14&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M10,2C8.89,2 8,2.89 8,4V7C8,8.11 8.89,9 10,9H11V11H2V13H6V15H5C3.89,15 3,15.89 3,17V20C3,21.11 3.89,22 5,22H9C10.11,22 11,21.11 11,20V17C11,15.89 10.11,15 9,15H8V13H16V15H15C13.89,15 13,15.89 13,17V20C13,21.11 13.89,22 15,22H19C20.11,22 21,21.11 21,20V17C21,15.89 20.11,15 19,15H18V13H22V11H13V9H14C15.11,9 16,8.11 16,7V4C16,2.89 15.11,2 14,2H10M10,4H14V7H10V4M5,17H9V20H5V17M15,17H19V20H15V17Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Aggregator`},`${e.clusterId}-${e.attributeId}`)),r===322&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Camera`},`${e.clusterId}-${e.attributeId}`)),r===324&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Floodlight`},`${e.clusterId}-${e.attributeId}`)),r===323&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Video bell`},`${e.clusterId}-${e.attributeId}`)),r===320&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Intercom`},`${e.clusterId}-${e.attributeId}`)),r===325&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Snapshot`},`${e.clusterId}-${e.attributeId}`)),r===327&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(j,{}),cluster:e,value:`Cam ctrl`},`${e.clusterId}-${e.attributeId}`)),r===326&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(z,{}),cluster:e,value:`Chime`},`${e.clusterId}-${e.attributeId}`)),r===328&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(z,{}),cluster:e,value:`Doorbell`},`${e.clusterId}-${e.attributeId}`)),r===321&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(z,{}),cluster:e,value:`Audio bell`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!0)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`smokeState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No smoke`:`Smoke!`},`${e.clusterId}-${e.attributeId}`)),r===118&&i.find(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`featureMap`&&e.attributeLocalValue.smokeAlarm===!1)&&i.filter(e=>e.clusterName===`SmokeCoAlarm`&&e.attributeName===`coState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12 4C16.41 4 20 7.59 20 12S16.41 20 12 20 4 16.41 4 12 7.59 4 12 4M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 11C11.45 11 11 11.45 11 12S11.45 13 12 13 13 12.55 13 12 12.55 11 12 11M10.72 9.3C11.11 9.11 11.54 9 12 9S12.89 9.11 13.29 9.3L14 8.57C13.43 8.22 12.74 8 12 8S10.58 8.22 10 8.57L10.72 9.3M15 12C15 12.46 14.89 12.89 14.7 13.29L15.43 14C15.79 13.43 16 12.74 16 12S15.79 10.58 15.43 10L14.7 10.72C14.89 11.11 15 11.54 15 12M9 12C9 11.54 9.11 11.11 9.3 10.72L8.57 10C8.22 10.58 8 11.26 8 12S8.22 13.43 8.57 14L9.3 13.29C9.11 12.89 9 12.46 9 12M13.29 14.7C12.89 14.89 12.46 15 12 15S11.11 14.89 10.72 14.7L10 15.43C10.58 15.79 11.26 16 12 16S13.43 15.79 14 15.43L13.29 14.7M16.89 8.53L16.17 9.25C16.69 10.04 17 11 17 12S16.69 13.96 16.17 14.75L16.89 15.47C17.59 14.5 18 13.3 18 12S17.59 9.5 16.89 8.53M9.25 7.83C10.04 7.31 11 7 12 7S13.96 7.31 14.75 7.83L15.47 7.11C14.5 6.42 13.3 6 12 6S9.5 6.42 8.53 7.11L9.25 7.83M14.75 16.17C13.96 16.69 13 17 12 17S10.04 16.69 9.25 16.17L8.53 16.89C9.5 17.59 10.7 18 12 18S14.5 17.59 15.47 16.89L14.75 16.17M7.83 14.75C7.31 13.96 7 13 7 12S7.31 10.04 7.83 9.25L7.11 8.53C6.42 9.5 6 10.7 6 12S6.42 14.5 7.11 15.47L7.83 14.75Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`No Co`:`Co!`},`${e.clusterId}-${e.attributeId}`)),r===66&&i.filter(e=>e.clusterName===`ValveConfigurationAndControl`&&e.attributeName===`currentState`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M4 22H2V2H4M22 2H20V22H22M17.24 5.34L13.24 9.34A3 3 0 0 0 9.24 13.34L5.24 17.34L6.66 18.76L10.66 14.76A3 3 0 0 0 14.66 10.76L18.66 6.76Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue===0?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===64&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M10 10H14V22H10V10M7 9H9V7H7V9M4 8H6V6H4V8M4 11H6V9H4V11M1 13H3V11H1V13M1 7H3V5H1V7M1 10H3V8H1V10M18 11H20V9H18V11M21 10H23V8H21V10M21 5V7H23V5H21M21 13H23V11H21V13M15 9H17V7H15V9M18 8H20V6H18V8M10 7H10.33L11 9H13L13.67 7H14V6H10V7Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`Irrigation`},`${e.clusterId}-${e.attributeId}`)),r===44&&i.filter(e=>e.clusterName===`AirQuality`&&e.attributeName===`airQuality`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M11,9A4,4 0 0,1 15,13A4,4 0 0,1 11,17A4,4 0 0,1 7,13A4,4 0 0,1 11,9M11,11A2,2 0 0,0 9,13A2,2 0 0,0 11,15A2,2 0 0,0 13,13A2,2 0 0,0 11,11M7,4H14A4,4 0 0,1 18,8V9H16V8A2,2 0 0,0 14,6H7A2,2 0 0,0 5,8V20H16V18H18V22H3V8A4,4 0 0,1 7,4M16,11C18.5,11 18.5,9 21,9V11C18.5,11 18.5,13 16,13V11M16,15C18.5,15 18.5,13 21,13V15C18.5,15 18.5,17 16,17V15Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:a[e.attributeLocalValue??0]},`${e.clusterId}-${e.attributeId}`)),r===770&&i.filter(e=>e.clusterName===`TemperatureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(k,{}),cluster:e,value:e.attributeLocalValue/100,unit:`°C`},`${e.clusterId}-${e.attributeId}`)),r===775&&i.filter(e=>e.clusterName===`RelativeHumidityMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue/100,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===69&&i.filter(e=>e.clusterName===`SoilMeasurement`&&e.attributeName===`soilMoistureMeasuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:e.attributeLocalValue,unit:`%`},`${e.clusterId}-${e.attributeId}`)),r===774&&i.filter(e=>e.clusterName===`FlowMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Qe,{}),cluster:e,value:e.attributeLocalValue/10,unit:`m³/h`},`${e.clusterId}-${e.attributeId}`)),r===773&&i.filter(e=>e.clusterName===`PressureMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(at,{}),cluster:e,value:e.attributeLocalValue,unit:`hPa`},`${e.clusterId}-${e.attributeId}`)),r===21&&i.filter(e=>e.clusterName===`BooleanState`&&e.attributeName===`stateValue`).map(e=>(0,q.jsx)($,{icon:e.attributeValue===`true`?(0,q.jsx)(Ke,{}):(0,q.jsx)(l,{}),cluster:e,value:e.attributeValue===`true`?`Closed`:`Opened`},`${e.clusterId}-${e.attributeId}`)),r===263&&i.filter(e=>e.clusterName===`OccupancySensing`&&e.attributeName===`occupancy`).map(e=>(0,q.jsx)($,{icon:e.attributeValue===`{ occupied: true }`?(0,q.jsx)(ye,{}):(0,q.jsx)(xe,{}),cluster:e,value:e.attributeValue===`{ occupied: true }`?`Occupied`:`Unocc.`},`${e.clusterId}-${e.attributeId}`)),r===262&&i.filter(e=>e.clusterName===`IlluminanceMeasurement`&&e.attributeName===`measuredValue`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(Xe,{}),cluster:e,value:Math.round(10**(e.attributeLocalValue/1e4)),unit:`lx`},`${e.clusterId}-${e.attributeId}`)),r===2128&&i.filter(e=>e.clusterName===`Descriptor`&&e.attributeName===`clusterRevision`).map(e=>(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M8 6V18H16V6H8M14 10H10V8H14V10M19.4 1.6C19 1.2 18.5 1 18 1H6C5.5 1 5 1.2 4.6 1.6C4.2 2 4 2.5 4 3V21C4 21.5 4.2 22 4.6 22.4C5 22.8 5.5 23 6 23H18C18.5 23 19 22.8 19.4 22.4C19.8 22 20 21.5 20 21V3C20 2.5 19.8 2 19.4 1.6M18 21H6V3H18V21Z`,size:`40px`,color:`var(--primary-color)`}),cluster:e,value:`---`},`${e.clusterId}-${e.attributeId}`)),r===1296&&p&&(0,q.jsx)($,{icon:(0,q.jsx)(X.Icon,{path:`M21 11C21 6.03 16.97 2 12 2S3 6.03 3 11C3 14.92 5.5 18.24 9 19.5V22H11V19.94C11.33 20 11.66 20 12 20S12.67 20 13 19.94V22H15V19.5C18.5 18.24 21 14.92 21 11M12 18C8.14 18 5 14.86 5 11S8.14 4 12 4 19 7.14 19 11 15.86 18 12 18M8 7H16V9H8V7M12.75 10L9.75 13L11 14.25L9.75 15.5L11.25 17L14.25 14L13 12.75L14.25 11.5L12.75 10Z`,size:`40px`,color:`var(--primary-color)`}),cluster:p,value:m,unit:`kWh`},`${p.clusterId}-${p.attributeId}`),(0,q.jsx)(M,{sx:pn,children:(0,q.jsx)(V,{sx:mn,children:o})}),(0,q.jsx)(M,{sx:hn,children:(0,q.jsx)(V,{sx:gn,children:e.name})}),(0,q.jsxs)(M,{sx:_n,children:[G&&(0,q.jsx)(V,{sx:vn,children:t}),(0,q.jsx)(V,{sx:vn,children:n}),G&&(0,q.jsxs)(V,{sx:vn,children:[`0x`,r.toString(16).padStart(4,`0`)]})]})]})}var kn=(0,U.memo)(On);function An({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)({}),[d,f]=(0,U.useState)({}),p=(0,U.useRef)(o()),m=(0,U.useRef)(s);(0,U.useEffect)(()=>{m.current=s},[s]);let h=(0,U.useRef)(d);(0,U.useEffect)(()=>{h.current=d},[d]);let g=(0,U.useCallback)(e=>{G&&console.log(`DevicesIcons received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=m.current,n=h.current,r=t.find(t=>t.pluginName===e.response.plugin&&t.serial===e.response.serialNumber);if(!r){G&&console.warn(`DevicesIcons updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" number "${e.response.number}" id "${e.response.id}" not found in devices(${t.length})`);return}let i=n[r.serial]?.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);if(!i){G&&console.warn(`DevicesIcons updater device "${r.name}" serial "${r.serial}" cluster "${e.response.cluster}" attribute "${e.response.attribute}" not found in clusters(${n[r.serial]?.length})`);return}i.attributeValue=String(e.response.value),i.attributeLocalValue=e.response.value,f(e=>({...e})),G&&console.log(`DevicesIcons updated "${i.clusterName}.${i.attributeName}" for device "${r.name}" serial "${r.serial}" to "${i.attributeValue}"`)},[]),_=(0,U.useCallback)(e=>{if(G&&console.log(`DevicesIcons received for device "${e.response.deviceName}" serial "${e.response.serialNumber}" deviceTypes (${e.response.deviceTypes.length}) "${e.response.deviceTypes.join(`,`)}" clusters (${e.response.clusters.length}):`,e.response),e.response.clusters.length===0)return;let t=e.response.serialNumber,n=[],r=[];for(let t of e.response.clusters)n.find(e=>e.endpoint===t.endpoint)||n.push({endpoint:t.endpoint,id:t.id,deviceTypes:t.deviceTypes}),![`FixedLabel`,`Identify`,`Groups`,`ScenesManagement`,`PowerTopology`].includes(t.clusterName)&&r.push(t);u(e=>({...e,[t]:n})),f(e=>({...e,[t]:r})),G&&console.log(`DevicesIcons endpoints for "${t}":`,n),G&&console.log(`DevicesIcons deviceTypes for "${t}":`,e.response.deviceTypes),G&&console.log(`DevicesIcons clusters for "${t}":`,r)},[]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`)G&&console.log(`DevicesIcons received refresh_required: changed=${e.response.changed} and sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}});else if(e.method===`state_update`&&e.response)g(e);else if(e.method===`/api/devices`&&e.response){G&&console.log(`DevicesIcons received ${e.response.length} devices:`,e.response),c(e.response),u({}),f({});for(let t of e.response)G&&console.log(`DevicesIcons sending /api/clusters`),r({id:p.current,sender:`DevicesIcons`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:t.pluginName,endpoint:t.endpoint||0,serialNumber:t.serial}})}else e.method===`/api/clusters`&&e.response&&_(e)};return i(e,p.current),G&&console.log(`DevicesIcons WebSocket effect mounted`),()=>{a(e),G&&console.log(`DevicesIcons WebSocket effect unmounted`)}},[i,_,a,r,g]),(0,U.useEffect)(()=>(G&&console.log(`DevicesIcons useEffect online mounting`),n&&(G&&console.log(`DevicesIcons useEffect online sending api requests`),r({id:p.current,sender:`DevicesIcons`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}})),G&&console.log(`DevicesIcons useEffect online mounted`),()=>{G&&console.log(`DevicesIcons useEffect online unmounted`)}),[n,r]);let v=e?.trim().toLowerCase(),y=v&&v!==`all plugins`;return G&&console.log(`DevicesIcons rendering...`),(0,q.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,paddingBottom:`5px`,gap:`20px`,width:`100%`,overflow:`auto`},children:s.filter(e=>y&&e.pluginName.toLowerCase()!==v?!1:t===``||e.name.toLowerCase().includes(t.toLowerCase())||e.serial.toLowerCase().includes(t.toLowerCase())).map(e=>l[e.serial]&&l[e.serial].map(t=>t.deviceTypes.map(n=>(0,q.jsx)(kn,{device:e,endpoint:t.endpoint,id:t.id,deviceType:n,clusters:(d[e.serial]??[]).filter(e=>e.endpoint===t.endpoint)},`${e.pluginName}-${e.uniqueId}-${t.endpoint}-${t.id}-${n.toString()}`))))})}var jn=(0,U.memo)(An);function Mn(e){return e?e.scrollWidth>e.clientWidth:!1}function Nn({title:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)(!1);return(0,q.jsx)(B,{title:e,open:r,disableHoverListener:!0,disableFocusListener:!0,disableTouchListener:!0,slotProps:{tooltip:{sx:{fontSize:`14px`,fontWeight:`normal`,color:`#ffffff`,backgroundColor:`var(--primary-color)`,maxWidth:500,whiteSpace:`pre-wrap`,wordBreak:`break-word`}}},children:(0,q.jsx)(`span`,{ref:n,onMouseEnter:()=>{i(Mn(n.current))},onMouseLeave:()=>{i(!1)},style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})})}function Pn(e,t,n){let r=e?.[n],i=t?.[n];return r==null&&i==null?0:r==null?-1:i==null?1:typeof r==`boolean`&&typeof i==`boolean`?r===i?0:r?1:-1:typeof r==`number`&&typeof i==`number`?r-i:String(r).localeCompare(String(i))}function Fn({name:e,title:t,columns:n,rows:r,getRowKey:i,footerLeft:a,footerRight:o,onRowClick:s}){let c=t=>{if(typeof i==`string`&&t&&t[i]!=null)return t[i];if(typeof i==`function`){let e=i(t);if(e!=null)return e}let a=n?.[0]?.id;return a&&t&&t[a]!=null?t[a]:(console.warn(`MbfTable(${e}): using fallback stable row key; consider providing getRowKey prop for better React performance`),`rk_${r.indexOf(t)}`)},[l,u]=(0,U.useState)(localStorage.getItem(`${e}_table_order_by`)||null),[d,f]=(0,U.useState)(localStorage.getItem(`${e}_table_order`)||null),[p,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(()=>{try{let t=localStorage.getItem(`${e}_column_visibility`);if(t)return JSON.parse(t)}catch{}return{}}),v=(0,U.useMemo)(()=>{let e={};for(let t of n)t.hidden||(e[t.id]=t.required?!0:g[t.id]!==!1);return e},[n,g]),y=(0,U.useMemo)(()=>{if(!l||!d)return r;let e=n.find(e=>e.id===l);if(!e||e.noSort)return r;let t=r.map((e,t)=>({el:e,index:t}));return t.sort((t,n)=>{let r;return r=typeof e.comparator==`function`?e.comparator(t.el,n.el):Pn(t.el,n.el,l),r===0?t.index-n.index:d===`asc`?r:-r}),t.map(e=>e.el)},[r,l,d,n]),b=t=>{if(l!==t||!l){u(t),f(`asc`),localStorage.setItem(`${e}_table_order_by`,t),localStorage.setItem(`${e}_table_order`,`asc`);return}if(d===`asc`){f(`desc`),localStorage.setItem(`${e}_table_order`,`desc`);return}u(null),f(null),localStorage.removeItem(`${e}_table_order_by`),localStorage.removeItem(`${e}_table_order`)},x=()=>{h(!p)},S=t=>{_(r=>{let i=n.find(e=>e.id===t);if(i&&i.required)return r;let a=v[t]!==!1,o={...r};a?o[t]=!1:delete o[t];try{localStorage.setItem(`${e}_column_visibility`,JSON.stringify(o))}catch{}return o})},C=()=>{_({});try{localStorage.removeItem(`${e}_column_visibility`)}catch{}h(!1)},[T,D]=(0,U.useState)(!1);return T?null:(G&&console.log(`Rendering table ${e}${l&&d?` ordered by ${l}:${d}`:``}`),(0,q.jsxs)(`div`,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,margin:`0`,padding:`0`,gap:`0`,width:`100%`,height:`100%`,overflow:`hidden`},children:[(0,q.jsxs)(me,{open:p,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&x()},disableRestoreFocus:!0,children:[(0,q.jsx)(m,{children:(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,q.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,q.jsx)(`h4`,{style:{margin:0},children:`Configure ${e} columns`})]})}),(0,q.jsx)(ge,{children:(0,q.jsx)(O,{children:n.filter(e=>!e.hidden).map(e=>(0,q.jsx)(P,{control:(0,q.jsx)(ve,{disabled:!!e.required,checked:e.required?!0:v[e.id]!==!1,onChange:()=>S(e.id)}),label:e.label},e.id))})}),(0,q.jsxs)(E,{children:[(0,q.jsx)(w,{onClick:C,children:`Reset`}),(0,q.jsx)(w,{variant:`contained`,onClick:e=>{if(e?.currentTarget&&typeof e.currentTarget.blur==`function`)try{e.currentTarget.blur()}catch{}let t=document.activeElement;if(t&&t instanceof HTMLElement&&typeof t.blur==`function`)try{t.blur()}catch{}x()},children:`Close`})]})]}),(0,q.jsxs)(tn,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,borderBottom:`none`},children:[(0,q.jsx)(Q,{children:e}),t&&(0,q.jsx)(Q,{children:t}),(0,q.jsx)(sn,{close:()=>D(!0),children:(0,q.jsx)(R,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:e=>{if(e?.currentTarget?.blur)try{e.currentTarget.blur()}catch{}x()},"aria-label":`Configure Columns`,children:(0,q.jsx)(B,{title:`Configure ${e} columns`,children:(0,q.jsx)(X.Icon,{path:St,size:`20px`,color:`var(--header-text-color)`})})})})]}),(0,q.jsx)(on,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,minHeight:0,width:`100%`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0`},children:(0,q.jsxs)(`table`,{"aria-label":`${e} table`,style:{width:`100%`,borderCollapse:`collapse`},children:[(0,q.jsx)(`thead`,{style:{position:`sticky`,top:0,zIndex:10,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color`},children:(0,q.jsx)(`tr`,{style:{height:`30px`,minHeight:`30px`},children:n.map(e=>{if(e.hidden||!e.required&&v[e.id]===!1)return null;let t=!e.noSort,n=t&&l===e.id&&!!d;return(0,q.jsxs)(`th`,{onClick:t?()=>b(e.id):void 0,style:{margin:`0`,padding:`5px 10px`,position:`sticky`,top:0,minWidth:e.minWidth,maxWidth:e.maxWidth,textAlign:e.align||`left`,cursor:t?`pointer`:`default`,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color)`,whiteSpace:e.maxWidth?`nowrap`:void 0,overflow:e.maxWidth?`hidden`:void 0,textOverflow:e.maxWidth?`ellipsis`:void 0},"aria-sort":t?n?d===`asc`?`ascending`:`descending`:`none`:void 0,children:[e.label,n&&(0,q.jsxs)(`span`,{style:{marginLeft:6},children:[d===`asc`&&(0,q.jsx)(X.Icon,{path:`M19 17H22L18 21L14 17H17V3H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`}),d===`desc`&&(0,q.jsx)(X.Icon,{path:`M19 7H22L18 3L14 7H17V21H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`})]})]},e.id)})})}),(0,q.jsx)(`tbody`,{children:y.map((e,t)=>{let r=c(e);return(0,q.jsx)(`tr`,{className:t%2==0?`table-content-even`:`table-content-odd`,onClick:s?t=>s(e,r,t):void 0,style:{height:`30px`,minHeight:`30px`,border:`none`,borderCollapse:`collapse`,cursor:s?`pointer`:void 0},children:n.map(t=>{if(t.hidden||!t.required&&v[t.id]===!1)return null;let n=e[t.id],i=typeof t.render==`function`?t.render(n,r,e,t):typeof n==`boolean`?(0,q.jsx)(ve,{checked:n,disabled:!0,size:`small`,sx:{m:0,p:0,color:`var(--table-text-color)`,"&.Mui-disabled":{color:`var(--table-text-color)`,opacity:.7}}}):t.format&&typeof n==`number`?t.format(n):n==null?null:String(n),a=t.tooltip&&t.maxWidth!==void 0&&t.maxWidth!==null&&n!=null&&i!==null?(0,q.jsx)(Nn,{title:String(n),children:i}):i;return(0,q.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,textAlign:t.align||`left`,padding:`5px 10px`,margin:`0`,maxWidth:t.maxWidth,whiteSpace:t.maxWidth?`nowrap`:void 0,overflow:t.maxWidth?`hidden`:void 0,textOverflow:t.maxWidth?`ellipsis`:void 0},children:a},t.id)})},r)})})]})}),(a||o)&&(0,q.jsxs)(nn,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,border:`none`},children:[(0,q.jsx)(rn,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:a}),(0,q.jsx)(rn,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:o})]})]}))}function In(e){return(0,U.memo)(e)}var Ln=In(Fn),Rn=[{label:`Plugin name`,id:`pluginName`,required:!0},{label:`Device type`,id:`type`},{label:`Endpoint`,id:`endpoint`,align:`right`},{label:`Name`,id:`name`,required:!0},{label:`Serial number`,id:`serial`},{label:`Unique ID`,id:`uniqueId`},{label:`Url`,id:`configUrl`},{label:`Config`,id:`configButton`,noSort:!0,render:(e,t,n,r)=>n.configUrl?(0,q.jsx)(R,{onClick:()=>window.open(n.configUrl,`_blank`),"aria-label":`Open Config`,sx:{margin:0,padding:0},children:(0,q.jsx)(T,{fontSize:`small`})}):null},{label:`Cluster`,id:`cluster`}],zn=[{label:`Endpoint`,id:`endpoint`,required:!0},{label:`Id`,id:`id`},{label:`Device Types`,id:`deviceTypes`,render:(e,t,n,r)=>Array.isArray(e)?(0,q.jsx)(q.Fragment,{children:e.map(e=>`0x${e.toString(16).padStart(4,`0`)}`).join(`, `)}):(0,q.jsx)(q.Fragment,{children:e})},{label:`Cluster Name`,id:`clusterName`,required:!0},{label:`Cluster ID`,id:`clusterId`},{label:`Attribute Name`,id:`attributeName`,required:!0},{label:`Attribute ID`,id:`attributeId`},{label:`Attribute Value`,id:`attributeValue`,required:!0,maxWidth:350,tooltip:!0}],Bn=e=>`${e.pluginName}::${e.uniqueId}`,Vn=e=>`${e.endpoint}::${e.clusterName}::${e.attributeName}`;function Hn({filterPlugins:e,filterDevices:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),[s,c]=(0,U.useState)([]),[l,u]=(0,U.useState)([]),[d,f]=(0,U.useState)(0),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),x=(0,U.useMemo)(()=>{let n=e?.trim().toLowerCase(),r=n&&n!==`all plugins`,i=s;return r&&(i=i.filter(e=>e.pluginName.toLowerCase()===n)),t!==``&&(i=i.filter(e=>e.name.toLowerCase().includes(t.toLowerCase())||e.serial.toLowerCase().includes(t.toLowerCase()))),i},[s,e,t]),S=(0,U.useRef)(o()),C=(0,U.useRef)(x),w=(0,U.useCallback)(e=>{G&&console.log(`DevicesTable received state_update "${e.response.cluster}.${e.response.attribute}" for "${e.response.id}:${e.response.number}": "${e.response.value}"`,e.response);let t=C.current.find(t=>t.pluginName===e.response.plugin&&t.uniqueId===e.response.uniqueId);if(!t){G&&console.warn(`DevicesTable updater device of plugin "${e.response.plugin}" serial "${e.response.serialNumber}" not found in filteredDevicesRef.current`);return}if(p&&h&&t.pluginName===p&&t.uniqueId===y&&e.response.number.toString()===h){let n=l.find(t=>t.endpoint===e.response.number.toString()&&t.clusterName===e.response.cluster&&t.attributeName===e.response.attribute);if(!n){G&&console.warn(`DevicesTable updater cluster ${e.response.cluster}.${e.response.attribute} for device "${t.name}" serial "${t.serial}" not found in clusters`);return}n.attributeValue=typeof e.response.value==`object`?JSON.stringify(e.response.value,void 0,1).replaceAll(`"`,``):String(e.response.value),n.attributeLocalValue=e.response.value,u([...l]),G&&console.log(`DevicesTable updated attribute ${n.clusterName}.${n.attributeName} for device "${t.name}" serial "${t.serial}" to "${n.attributeValue}"`)}},[l,h,p,y]);return(0,U.useEffect)(()=>{let e=e=>{if(G&&console.log(`DevicesTable received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`devices`)G&&console.log(`DevicesTable received refresh_required: changed=${e.response.changed} and sending /api/devices request`),r({id:S.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}});else if(e.method===`state_update`&&e.response)w(e);else if(e.method===`/api/devices`)G&&console.log(`DevicesTable received ${e.response.length} devices:`,e.response),c(e.response);else if(e.method===`/api/clusters`){G&&console.log(`DevicesTable received ${e.response.clusters.length} clusters for plugin ${e.response.plugin}:`,e.response),u(e.response.clusters);let t={};for(let n of e.response.clusters)G&&console.log(`Cluster:`,n.endpoint),t[n.endpoint]?t[n.endpoint]++:t[n.endpoint]=1;f(Object.keys(t).length)}};return i(e,S.current),G&&console.log(`DevicesTable added WebSocket listener`),()=>{a(e),G&&console.log(`DevicesTable removed WebSocket listener`)}},[r,i,a,w]),(0,U.useEffect)(()=>{n&&(G&&console.log(`DevicesTable sending api requests with id `,S.current),r({id:S.current,sender:`DevicesTable`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:S.current,sender:`DevicesTable`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:S.current,sender:`DevicesTable`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[n,r]),(0,U.useEffect)(()=>{p&&h&&y&&(G&&console.log(`DevicesTable sending /api/clusters`),r({id:S.current,sender:`DevicesTable`,method:`/api/clusters`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:p,endpoint:Number(h),uniqueId:y}}))},[p,h,y,r]),(0,U.useEffect)(()=>{C.current=x},[x]),G&&console.log(`DevicesTable rendering...`),n?(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,margin:`0px`,padding:`0px`,gap:`20px`,width:`100%`,overflow:`hidden`},children:[(0,q.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,maxHeight:p&&h?`30%`:`100%`,flex:`1 1 auto`,overflow:`hidden`},children:(0,q.jsx)(Ln,{name:`Registered devices`,getRowKey:Bn,onRowClick:e=>{if(e.uniqueId===y){b(null),m(null),g(null),v(null);return}G&&console.log(`DevicesTable handleDeviceClick: selected device "${e.name}" with uniqueId "${e.uniqueId}", plugin "${e.pluginName}", endpoint "${e.endpoint}"`),b(e.uniqueId),m(e.pluginName),g(e.endpoint?e.endpoint.toString():null),v(e.name)},rows:x,columns:Rn,footerLeft:`Total devices: ${x.length.toString()}`})}),p&&h&&(0,q.jsx)(Z,{style:{margin:`0px`,padding:`0px`,gap:`0px`,width:`100%`,height:`70%`,maxHeight:`70%`,flex:`1 1 auto`,overflow:`hidden`},children:(0,q.jsx)(Ln,{name:`Clusters`,title:_||``,getRowKey:Vn,rows:l,columns:zn,footerLeft:`Total child endpoints: ${d-1}`})})]}):(0,q.jsx)(en,{})}var Un=(0,U.memo)(Hn);function Wn({children:e,style:t,name:n}){let{setCurrentPage:r}=(0,U.useContext)(J);return r(n),G&&console.log(`MbfPage: current page set to ${n}`),(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,margin:`0px`,padding:`0px`,gap:`20px`,...t},children:e})}function Gn(){let{online:e,sendMessage:t,addListener:n,removeListener:r,getUniqueId:i}=(0,U.useContext)(Y),[a,o]=(0,U.useState)([`All plugins`]),[s,c]=(0,U.useState)(()=>localStorage.getItem(W.devicesFilterPlugins)||`All plugins`),[l,u]=(0,U.useState)(()=>localStorage.getItem(W.devicesFilterDevices)||``),[d,f]=(0,U.useState)(()=>localStorage.getItem(W.devicesViewMode)||`icon`),p=(0,U.useRef)(i());(0,U.useEffect)(()=>{let e=e=>{G&&e.id&&console.log(`Devices received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`plugins`&&!e.response.lock?(G&&console.log(`Devices received refresh_required for plugins lock=${e.response.lock}, sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}})):e.method===`/api/plugins`&&e.id===p.current&&e.response&&(G&&console.log(`Devices received ${e.response.length} plugins:`,e.response),o([`All plugins`,...e.response.map(e=>e.name)]))};return n(e,p.current),G&&console.log(`Devices added WebSocket listener`),()=>{r(e),G&&console.log(`Devices removed WebSocket listener`)}},[t,n,r]),(0,U.useEffect)(()=>{e&&(o([`All plugins`]),G&&console.log(`Devices sending /api/plugins request with id ${p.current}`),t({id:p.current,sender:`Devices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[e,t]);let m=e=>{let t=e.target.value;c(t),localStorage.setItem(W.devicesFilterPlugins,t)},h=e=>{u(e.target.value),localStorage.setItem(W.devicesFilterDevices,e.target.value)},g=()=>{u(``),localStorage.removeItem(W.devicesFilterDevices)},_=e=>{f(e),localStorage.setItem(W.devicesViewMode,e)};return G&&console.log(`Devices rendering...`),e?(0,q.jsxs)(Wn,{name:`Devices`,children:[(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`,width:`100%`},children:[(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,padding:0,margin:0,gap:`20px`},children:[(0,q.jsxs)(M,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,q.jsx)(V,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Plugin:`}),(0,q.jsx)(B,{title:`Filter devices by plugin`,children:(0,q.jsx)(ht,{variant:`outlined`,value:s,onChange:m,sx:{width:`260px`,backgroundColor:`var(--main-bg-color)`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`},"& .MuiSelect-select":{backgroundColor:`var(--main-bg-color)`}},input:(0,q.jsx)(pt,{sx:{backgroundColor:`var(--main-bg-color)`}}),children:a.map(e=>(0,q.jsx)(L,{value:e,children:e},e))})})]}),(0,q.jsxs)(M,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,q.jsx)(V,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`Filter by:`}),(0,q.jsx)(B,{title:`Filter devices by name or serial number`,children:(0,q.jsx)(H,{variant:`outlined`,value:l,onChange:h,placeholder:`Enter the device name or serial`,sx:{width:`260px`,"& .MuiOutlinedInput-root":{backgroundColor:`var(--main-bg-color)`}},slotProps:{input:{endAdornment:l?(0,q.jsx)(F,{position:`end`,children:(0,q.jsx)(R,{"aria-label":`Clear device filter`,size:`small`,onClick:g,edge:`end`,children:(0,q.jsx)(dt,{sx:{fontSize:18,color:`var(--main-label-color)`}})})}):null}}})})]})]}),(0,q.jsxs)(M,{sx:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`10px`},children:[(0,q.jsx)(V,{sx:{fontSize:`16px`,fontWeight:`normal`,color:`var(--div-text-color)`,marginLeft:`5px`,whiteSpace:`nowrap`},children:`View mode:`}),(0,q.jsx)(R,{onClick:()=>_(`table`),"aria-label":`Table View`,disabled:d===`table`,children:(0,q.jsx)(B,{title:`Table View`,children:(0,q.jsx)(we,{style:{color:d===`table`?`var(--main-icon-color)`:`var(--primary-color)`}})})}),(0,q.jsx)(R,{onClick:()=>_(`icon`),"aria-label":`Icon View`,disabled:d===`icon`,children:(0,q.jsx)(B,{title:`Icon View (beta)`,children:(0,q.jsx)(Ie,{style:{color:d===`icon`?`var(--main-icon-color)`:`var(--primary-color)`}})})})]})]}),d===`table`&&(0,q.jsx)(Un,{filterPlugins:s,filterDevices:l},`table-${e}`),d===`icon`&&(0,q.jsx)(jn,{filterPlugins:s,filterDevices:l},`icon-${e}`)]}):(0,q.jsx)(en,{})}var Kn=(0,U.memo)(Gn);function qn({version:e}){let{online:t}=(0,U.useContext)(Y);return G&&console.log(`HomeBrowserRefresh rendering...`),t?(0,q.jsxs)(Z,{children:[(0,q.jsx)(tn,{children:(0,q.jsx)(Q,{children:`Frontend Update`})}),(0,q.jsxs)(on,{style:{flexDirection:`row`,flexWrap:`wrap`,justifyContent:`space-between`,alignItems:`center`},children:[(0,q.jsxs)(`h4`,{style:{margin:0},children:[`The frontend has been updated to version `,e,`. You are viewing an outdated web UI. Please refresh the page now.`]}),(0,q.jsx)(`div`,{children:(0,q.jsx)(w,{onClick:()=>window.location.reload(),endIcon:(0,q.jsx)(he,{}),style:{marginLeft:`10px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`},children:`Refresh`})})]})]}):(0,q.jsx)(en,{})}var Jn=(0,U.memo)(qn);function Yn(e){if(G&&console.log(`getQRColor (id: ${e?.id}) received matter:`,e??`undefined`),e===void 0||!e.online||!e.qrPairingCode&&!e.manualPairingCode&&!e.fabricInformations&&!e.sessionInformations)return`red`;if(!e.commissioned&&e.qrPairingCode&&e.manualPairingCode)return`var(--primary-color)`;let t=0,n=0;for(let r of e.sessionInformations??[])r.fabric&&r.isPeerActive&&t++,r.numberOfActiveSubscriptions>0&&(n+=r.numberOfActiveSubscriptions);return e.commissioned&&e.fabricInformations&&e.sessionInformations&&(t===0||n===0)?`var(--secondary-color)`:`var(--div-text-color)`}var Xn=e=>`${e.pluginName}::${e.serial}`,Zn=(e,t)=>e===void 0?t:e===100?x:e>=80?D:e>=60?N:e>=40?et:e>=20?ce:e>=10?_t:p;function Qn({storeId:e,setStoreId:t}){let{online:n,sendMessage:r,addListener:i,removeListener:a,getUniqueId:o}=(0,U.useContext)(Y),{mobile:s}=(0,U.useContext)(J),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!0),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)(0),[y,b]=(0,U.useState)([]),[x,S]=(0,U.useState)(null),[C,O]=(0,U.useState)(`inactive`),k=(0,U.useRef)(o()),A=[{label:`Plugin`,id:`pluginName`},{label:`Name`,id:`name`,required:!0},{label:`Serial`,id:`serial`},{label:`Availability`,id:`availability`,render:(e,t,n,r)=>n.reachable===!0?`Online`:n.reachable===!1?(0,q.jsx)(`span`,{style:{color:`red`},children:`Offline`}):``,comparator:(e,t)=>(e.reachable===!0?1:e.reachable===!1?0:-1)-(t.reachable===!0?1:t.reachable===!1?0:-1)},{label:`Power`,id:`powerSource`,render:(e,t,n,r)=>{if(n.powerSource===`ac`||n.powerSource===`dc`)return(0,q.jsx)(B,{title:n.powerSource===`ac`?`AC current`:`DC current`,children:(0,q.jsx)(ke,{fontSize:`small`,sx:{color:`var(--primary-color)`}})});if(n.powerSource===`ok`){let e=Zn(n.batteryLevel,D);return n.batteryLevel===void 0?(0,q.jsx)(e,{fontSize:`small`,sx:{color:`gray`}}):(0,q.jsx)(B,{title:`Battery level: ${n.batteryLevel}%`,children:(0,q.jsx)(e,{fontSize:`small`,sx:{color:`green`}})})}if(n.powerSource===`warning`){let e=Zn(n.batteryLevel,ce);return n.batteryLevel===void 0?(0,q.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}}):(0,q.jsx)(B,{title:`Battery level: ${n.batteryLevel}%`,children:(0,q.jsx)(e,{fontSize:`small`,sx:{color:`yellow`}})})}if(n.powerSource===`critical`){let e=Zn(n.batteryLevel,p);return n.batteryLevel===void 0?(0,q.jsx)(e,{fontSize:`small`,sx:{color:`red`}}):(0,q.jsx)(B,{title:`Battery level: ${n.batteryLevel}%`,children:(0,q.jsx)(e,{fontSize:`small`,sx:{color:`red`}})})}return(0,q.jsx)(`span`,{})}},{label:`Actions`,id:`selected`,required:!0,render:(n,r,i,a)=>(0,q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`},children:[i.matter===void 0?(0,q.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,q.jsx)(B,{title:`Show the QRCode or the fabrics`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,q.jsx)(R,{onClick:()=>t(e===i.matter?.id?f?.matterbridgeInformation.bridgeMode===`bridge`?`Matterbridge`:null:i.matter?.id||null),"aria-label":`Show the QRCode`,sx:{margin:0,padding:0,color:Yn(i.matter)},children:(0,q.jsx)(ie,{fontSize:`small`})})}),i.configUrl?(0,q.jsx)(B,{title:`Open the configuration page`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,q.jsx)(R,{onClick:()=>N(i),"aria-label":`Open config url`,sx:{margin:0,padding:0},children:(0,q.jsx)(T,{fontSize:`small`})})}):(0,q.jsx)(`div`,{style:{width:`20px`,height:`20px`}}),i.selected===void 0?(0,q.jsx)(`div`,{style:{width:`20px`,height:`20px`}}):(0,q.jsx)(B,{title:`Select/unselect the device`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[30,15]}}]}},children:(0,q.jsx)(ve,{checked:i.selected,onChange:e=>M(e,i),sx:{margin:`0`,marginLeft:`8px`,padding:`0`},size:`small`})})]})}],j=(0,U.useCallback)(e=>{e.selected=void 0;let t=h.find(t=>t.name===e.pluginName);if(!t)return console.error(`HomeDevices isSelected: plugin ${e.pluginName} not found for device ${e.name} `),e.selected;let n=t.schemaJson?.properties?.whiteList?.selectFrom,r=t.configJson.postfix;return r===``&&(r=void 0),t.hasWhiteList===!0&&t.hasBlackList===!0&&n&&(e.selected=!0,n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(r?e.serial.replace(`-`+r,``):e.serial)&&(e.selected=!0),n===`serial`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(r?e.serial.replace(`-`+r,``):e.serial)&&(e.selected=!1),n===`serial`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(r?e.serial.replace(`-`+r,``):e.serial)&&(e.selected=!1),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&t.configJson.whiteList.includes(e.name)&&(e.selected=!0),n===`name`&&t.configJson.whiteList&&t.configJson.whiteList.length>0&&!t.configJson.whiteList.includes(e.name)&&(e.selected=!1),n===`name`&&t.configJson.blackList&&t.configJson.blackList.length>0&&t.configJson.blackList.includes(e.name)&&(e.selected=!1)),e.selected},[h]);(0,U.useEffect)(()=>{let e=e=>{if(e.method===`refresh_required`&&e.response.changed!==`matter`)e.response.changed===`plugins`&&e.response.lock?G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} lock=${e.response.lock} skipping /api/plugins request`):(G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and sending /api/plugins request`),r({id:k.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}));else if(e.method===`refresh_required`&&e.response.changed===`matter`)G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and setting matter id ${e.response.matter?.id}`),b(t=>{let n=t.findIndex(t=>t.name.replaceAll(` `,``)===e.response.matter?.id);if(n<0)return G&&console.debug(`HomeDevices: matter id ${e.response.matter?.id} not found`),t;let r=[...t];return r[n]={...r[n],matter:e.response.matter},G&&console.log(`HomeDevices received refresh_required: changed=${e.response.changed} and set matter id ${e.response.matter?.id}`),r});else if(e.method===`restart_required`)G&&console.log(`HomeDevices received restart_required`),l(!0);else if(e.method===`restart_not_required`)G&&console.log(`HomeDevices received restart_not_required`),l(!1);else if(e.method===`matterbridge_status_update`)G&&console.log(`HomeDevices received matterbridge_status_update: ${e.response.status}`),O(e.response.status);else if(e.method===`state_update`&&e.response.plugin&&e.response.serialNumber&&e.response.cluster.includes(`BasicInformation`)&&e.response.attribute===`reachable`){G&&console.log(`HomeDevices updating device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}...`);let t=e.response.value;b(n=>{let r=n.findIndex(t=>t.pluginName===e.response.plugin&&t.serial===e.response.serialNumber);if(r<0)return G&&console.warn(`HomeDevices: device to update not found for plugin ${e.response.plugin} serial ${e.response.serialNumber}`),n;let i=[...n];return i[r]={...i[r],reachable:t},i}),G&&console.log(`HomeDevices updated device reachability for plugin ${e.response.plugin} serial ${e.response.serialNumber} value ${e.response.value}`)}if(e.id===k.current&&e.method===`/api/settings`)G&&console.log(`HomeDevices (id: ${e.id}) received settings:`,e.response),m(e.response),l(e.response.matterbridgeInformation.restartRequired||e.response.matterbridgeInformation.fixedRestartRequired),O(e.response.matterbridgeInformation.bridgeStatus);else if(e.id===k.current&&e.method===`/api/plugins`){if(G&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} plugins:`,e.response),e.response){let t=!0;for(let n of e.response)n.enabled&&(n.loaded!==!0||n.started!==!0||n.error===!0)&&(t=!1);if(!t)return;G&&console.log(`HomeDevices reset plugins and mixedDevices, starting a fresh load cycle`),d(!1),g(e.response),v(0),b([]),r({id:k.current,sender:`HomeDevices`,method:`/api/devices`,src:`Frontend`,dst:`Matterbridge`,params:{}}),G&&console.log(`HomeDevices sent /api/devices`);for(let t of e.response)t.enabled&&t.loaded===!0&&t.started===!0&&t.error!==!0&&(r({id:k.current,sender:`HomeDevices`,method:`/api/select/devices`,src:`Frontend`,dst:`Matterbridge`,params:{plugin:t.name}}),G&&console.log(`HomeDevices sent /api/select/devices for plugin: ${t.name}`))}}else if(e.id===k.current&&e.method===`/api/devices`){if(G&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} devices:`,e.response),e.response){let t=e.response.map(e=>Object.assign(e,{selected:j(e),origin:`device`}));v(t.length),b(e=>{let n=new Set(t.map(e=>`${e.pluginName}::${e.serial}`)),r=e.filter(e=>e.origin===`select`&&!n.has(`${e.pluginName}::${e.serial}`));return[...t,...r]})}}else if(e.id===k.current&&e.method===`/api/select/devices`&&(G&&console.log(`HomeDevices (id: ${e.id}) received ${e.response?.length} selectDevices for plugin ${e.response&&e.response.length>0?e.response[0].pluginName:`without select devices`}:`,e.response),e.response&&e.response.length>0)){let t=e.response[0].pluginName;b(n=>{let r=n.filter(e=>e.origin!==`select`||e.pluginName!==t),i=r.filter(e=>e.origin===`device`),a=e.response.filter(e=>!i.some(t=>t.pluginName===e.pluginName&&t.serial.includes(e.serial))).map(e=>Object.assign(e,{selected:j(e),origin:`select`}));return[...r,...a]})}};return i(e,k.current),G&&console.log(`HomeDevices added WebSocket listener id ${k.current}`),()=>{a(e),G&&console.log(`HomeDevices removed WebSocket listener`)}},[i,a,r,j]),(0,U.useEffect)(()=>{n&&(G&&console.log(`HomeDevices sending /api/settings and /api/plugins requests`),r({id:k.current,sender:`HomeDevices`,method:`/api/settings`,src:`Frontend`,dst:`Matterbridge`,params:{}}),r({id:k.current,sender:`HomeDevices`,method:`/api/plugins`,src:`Frontend`,dst:`Matterbridge`,params:{}}))},[n,r]);let M=(e,t)=>{G&&console.log(`handleCheckboxChange: checkbox changed to ${e.target.checked} for device ${t.name} serial ${t.serial}`);let n=e.target.checked;b(e=>{let r=e.findIndex(e=>e.pluginName===t.pluginName&&e.serial===t.serial);if(r<0)return console.error(`handleCheckboxChange: device ${t.name} serial ${t.serial} not found in mixedDevices`),e;let i=[...e];return i[r]={...i[r],selected:n},i}),e.target.checked?r({id:k.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`selectdevice`,plugin:t.pluginName,serial:t.serial,name:t.name}}):r({id:k.current,sender:`HomeDevices`,method:`/api/command`,src:`Frontend`,dst:`Matterbridge`,params:{command:`unselectdevice`,plugin:t.pluginName,serial:t.serial,name:t.name}})},N=e=>{if(G&&console.log(`handleConfigUrl device:`,e.name,`configUrl:`,e.configUrl),e.configUrl){if(e.configUrl.startsWith(`/plugins/`)||e.configUrl.startsWith(`./plugins/`)){let t=`${Yt}${e.configUrl.replace(/^\.?\//,``)}`,n=new URL(t,window.location.origin);n.pathname.endsWith(`/`)||(n.pathname+=`/`);let r=`${n.pathname}${n.search}${n.hash}`;G&&console.log(`handleConfigUrl opening plugin frontend for device:`,e.name,`basePath:`,Yt,`configUrl:`,e.configUrl,`computed pluginFrontendPath:`,r),S({name:e.name,path:r})}else window.open(e.configUrl,`_blank`)}};return G&&console.log(`HomeDevices rendering...`),n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Z,{style:{flex:`1 1 auto`},children:(0,q.jsx)(Ln,{name:`Devices`,getRowKey:Xn,rows:y,columns:A,footerLeft:u?`Waiting for the plugins to fully load...`:`Registered devices: ${_.toString()}/${y.length.toString()}`,footerRight:c?`Restart required`:``})}),(0,q.jsxs)(me,{open:x!==null,onClose:()=>S(null),slotProps:{paper:{sx:{width:K&&s?`100vw`:`75vw`,height:K&&s?`100vh`:`75vh`,maxWidth:K&&s?`100vw`:`75vw`,maxHeight:K&&s?`100vh`:`75vh`,margin:K&&s?`0px`:void 0,display:`flex`,flexDirection:`column`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`}}},children:[(0,q.jsx)(ge,{style:{display:`flex`,flex:`1 1 auto`,minHeight:0,padding:`0px`,margin:`0px`,overflow:`hidden`,backgroundColor:`var(--div-bg-color)`},children:x&&(0,q.jsx)(`iframe`,{title:`${x.name} frontend`,src:x.path,onLoad:e=>{let t=e.currentTarget.contentDocument;if(!t?.head)return;let n=getComputedStyle(document.body),r=n.getPropertyValue(`--primary-color`).trim()||`#0d6efd`,i=n.getPropertyValue(`--div-bg-color`).trim()||`#111111`;t.getElementById(`matterbridge-plugin-scrollbar-style`)?.remove();let a=t.createElement(`style`);a.id=`matterbridge-plugin-scrollbar-style`,a.textContent=`
3
3
  html,
4
4
  body {
5
5
  background-color: ${i};
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@matterbridge/frontend",
3
- "version": "3.6.0-dev-20260911-738f663",
3
+ "version": "3.6.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@matterbridge/frontend",
9
- "version": "3.6.0-dev-20260911-738f663",
9
+ "version": "3.6.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@emotion/react": "11.14.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/frontend",
3
- "version": "3.6.0-dev-20260911-738f663",
3
+ "version": "3.6.0",
4
4
  "description": "Matterbridge frontend application",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",