matterbridge
Version:
Matterbridge plugin manager for Matter
4 lines • 230 kB
JavaScript
import{a as e}from"./rolldown-runtime.js";import{c as t}from"./vendor_emotion.js";import{c as n,d as r,f as i,l as a,p as o,s,u as c}from"./vendor_node_modules.js";import{$ as l,A as u,At as d,B as f,Bt as p,C as m,Ct as h,D as g,Dt as _,E as v,Et as y,F as b,Ft as x,G as S,Gt as C,H as w,Ht as T,I as E,It as D,J as O,K as k,L as A,Lt as j,M as ee,Mt as M,N,Nt as P,O as te,Ot as ne,P as re,Pt as ie,Q as ae,R as oe,Rt as F,S as se,St as ce,T as le,Tt as ue,U as de,Ut as fe,V as pe,Vt as I,W as me,Wt as L,X as he,Y as ge,Z as _e,_ as ve,_t as ye,a as be,at as xe,b as Se,bt as R,c as Ce,ct as we,d as Te,dt as z,et as Ee,f as De,ft as B,g as Oe,gt as ke,h as Ae,ht as V,i as je,it as Me,j as Ne,jt as Pe,k as Fe,kt as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,wt as at,x as ot,xt as st,y as ct,yt as H,z as lt,zt as U}from"./vendor_mui.js";import{_ as ut,a as dt,h as ft,j as pt,o as mt,r as ht,s as gt,v as _t}from"./vendor_mdi.js";import{n as vt,t as yt}from"./vendor_notistack.js";import{t as bt}from"./vendor_qrcode.js";import{a as xt,c as St,i as Ct,l as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./vendor_rjsf.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var W=e(t(),1),At=e(o(),1),G=C();function jt({open:e,title:t,message:n,onConfirm:r,onCancel:i}){return(0,G.jsxs)(x,{open:e,children:[(0,G.jsx)(M,{gap:`20px`,children:(0,G.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,G.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,G.jsx)(`h4`,{style:{margin:0},children:t})]})}),(0,G.jsxs)(P,{children:[(0,G.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`center`,margin:`0`,marginBottom:`20px`,maxHeight:`350px`,maxWidth:`350px`},children:(0,G.jsx)(`p`,{style:{flex:1,margin:`0`},children:n})}),(0,G.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`space-around`},children:[(0,G.jsx)(j,{onClick:e=>{Q&&console.log(`Confirmed`),e.preventDefault(),r()},variant:`contained`,color:`primary`,size:`small`,children:`Confirm`}),(0,G.jsx)(j,{onClick:e=>{Q&&console.log(`Canceled`),e.preventDefault(),i()},variant:`contained`,color:`primary`,size:`small`,children:`Cancel`})]})]})]})}var K={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`},Mt={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 Nt(){Object.values(K).forEach(e=>{localStorage.removeItem(e)}),Object.values(Mt).forEach(e=>{localStorage.removeItem(e)})}var Pt=({open:e,output:t,title:n,_command:r,_packageName:i,onInstall:a,onClose:o})=>{let{installAutoExit:s,setInstallAutoExit:c}=(0,W.useContext)(It),l=(0,W.useRef)(null),u=e=>{c(e.target.checked),localStorage.setItem(K.installAutoExit,e.target.checked?`true`:`false`),Q&&console.log(`handleInstallAutoExitChange called with value:`,e.target.checked)};return(0,W.useEffect)(()=>{Q&&console.log(`InstallProgressDialog output effect mounted, scrolling to bottom: ${l.current}`),setTimeout(()=>{Q&&console.log(`Scrolling to bottom:`,l.current),l.current?.scrollIntoView({behavior:`smooth`,block:`end`})},0)},[t]),(0,G.jsxs)(x,{open:e,onClose:(e,t)=>{t===`backdropClick`||t===`escapeKeyDown`||o()},slotProps:{paper:{sx:{width:`70vw`,maxWidth:`70vw`,height:`70vw`,maxHeight:`70vh`,overflow:`hidden`}}},children:[(0,G.jsx)(M,{children:(0,G.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,G.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,G.jsx)(`h4`,{style:{margin:0},children:n})]})}),(0,G.jsxs)(P,{dividers:!0,style:{overflow:`hidden`,display:`flex`,flexDirection:`column`,height:400,paddingBottom:0},children:[(0,G.jsx)(`label`,{style:{display:`block`,marginBottom:`10px`,fontSize:`16px`,fontWeight:`bold`,color:`var(--primary-color)`},children:`Process log`}),(0,G.jsxs)(`ul`,{style:{width:`100%`,height:`100%`,fontFamily:`monospace`,fontSize:`14px`,padding:`10px`,margin:0,marginBottom:`10px`,color:`var(--div-text-color)`,background:`var(--div-bg-color)`,overflow:`auto`,listStyle:`none`,boxSizing:`border-box`,borderRadius:4,border:`4px solid var(--primary-color)`,whiteSpace:`pre-wrap`,display:`block`},children:[t.split(`
`).map((e,t)=>(0,G.jsx)(`li`,{style:{padding:0,margin:0,wordBreak:`break-all`},children:e},t)),(0,G.jsx)(`li`,{ref:l,style:{padding:0,margin:0}})]})]}),(0,G.jsxs)(ie,{sx:{justifyContent:`space-evenly`},children:[a&&(0,G.jsx)(j,{variant:`contained`,onClick:a,children:`Install`}),(0,G.jsx)(j,{onClick:o,children:`Close`}),(0,G.jsx)(Ie,{control:(0,G.jsx)(D,{checked:s,onChange:e=>u(e)}),label:`Close on success`,style:{color:`var(--div-text-color)`}})]})]})},Ft=[],It=(0,W.createContext)(null);function Lt({children:e}){let[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(null),{enqueueSnackbar:a,closeSnackbar:o}=vt(),s=(0,W.useCallback)(e=>{Q&&console.log(`UiProvider closeSnackbarMessage: message ${e}`);let t=Ft.findIndex(t=>t.message===e);t!==-1&&(o(Ft[t].key),Ft.splice(t,1),Q&&console.log(`UiProvider closeSnackbarMessage: message ${e} removed from persistMessages`))},[o]),c=(0,W.useCallback)((e,t,n)=>{Q&&console.log(`UiProvider showSnackbarMessage: message ${e} timeout ${t}`);let r=a(e,{variant:`default`,autoHideDuration:t==null||t>0?(t??5)*1e3:null,persist:t===0,content:t=>(0,G.jsx)(F,{sx:{margin:`0`,padding:`0`,width:`300px`,marginRight:`30px`},children:(0,G.jsx)(p,{severity:n??`info`,variant:`filled`,sx:{color:`#fff`,fontWeight:`normal`,width:`100%`,cursor:`pointer`,padding:`0px 10px`},onClick:()=>o(t),action:(0,G.jsx)(I,{size:`small`,onClick:()=>o(t),sx:{color:`#fff`},children:(0,G.jsx)(tt,{fontSize:`small`})}),children:e},t)},t)});t===0&&(Q&&console.log(`UiProvider showSnackbarMessage: message ${e} timeout ${t} - persist key ${r}`),Ft.push({message:e,key:r}))},[a,o]),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(``),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),v=(0,W.useRef)(null),y=(0,W.useRef)(null),b=()=>{Q&&console.log(`UiProvider handle confirm action ${g}`),u(!1),v.current&&v.current(g)},x=()=>{Q&&console.log(`UiProvider handle cancel action ${g}`),u(!1),y.current&&y.current(g)},S=(0,W.useCallback)((e,t,n,r,i)=>{Q&&console.log(`UiProvider showConfirmCancelDialog for command ${n}`),f(e),h(t),_(n),v.current=r,y.current=i,u(!0)},[]),[C,w]=(0,W.useState)(!1),[T,E]=(0,W.useState)(``),[D,O]=(0,W.useState)(``),[k,A]=(0,W.useState)(``),[j,ee]=(0,W.useState)(``),[M,N]=(0,W.useState)(localStorage.getItem(K.installAutoExit)!==`false`),P=(0,W.useCallback)((e,t,n)=>{Q&&console.log(`UiProvider show install progress for package ${e}`),E(e),O(t),A(n),w(!0)},[]),te=(0,W.useCallback)(e=>{Q&&console.log(`UiProvider addInstallProgress: output ${e}`),ee(t=>t+e+`
`)},[]),ne=(0,W.useCallback)(()=>{Q&&console.log(`UiProvider exitInstallProgressSuccess: package ${k}`),localStorage.getItem(K.installAutoExit)!==`false`&&w(!1)},[k]),re=(0,W.useCallback)(()=>{Q&&console.log(`UiProvider exitInstallProgressError: package ${k}`)},[k]),ie=(0,W.useCallback)(()=>{Q&&console.log(`UiProvider hide install progress`),w(!1)},[]),ae=()=>{Q&&console.log(`UiProvider handle install close action`),w(!1),A(``),ee(``)},oe=(0,W.useMemo)(()=>({mobile:t,setMobile:n,currentPage:r,setCurrentPage:i,showSnackbarMessage:c,closeSnackbarMessage:s,closeSnackbar:o,showConfirmCancelDialog:S,showInstallProgress:P,exitInstallProgressSuccess:ne,exitInstallProgressError:re,hideInstallProgress:ie,addInstallProgress:te,installAutoExit:M,setInstallAutoExit:N}),[t,r,n,i,c,s,o,S,P,ne,re,ie,te,M,N]);return(0,G.jsxs)(It.Provider,{value:oe,children:[(0,G.jsx)(jt,{open:l,title:d,message:m,onConfirm:b,onCancel:x}),(0,G.jsx)(Pt,{open:C,title:T,_command:D,_packageName:k,output:j,onClose:ae}),e]})}var Rt=(0,W.createContext)(null),q=(0,W.createContext)(null);function zt({children:e}){let[t,n]=(0,W.useState)([]),[r,i]=(0,W.useState)(localStorage.getItem(K.logFilterLevel)??`info`),[a,o]=(0,W.useState)(localStorage.getItem(K.logFilterSearch)??`*`),[s,c]=(0,W.useState)(!1),{showSnackbarMessage:l,closeSnackbarMessage:u,closeSnackbar:d,showInstallProgress:f,hideInstallProgress:p,exitInstallProgressSuccess:m,exitInstallProgressError:h,addInstallProgress:g}=(0,W.useContext)(It),_=(0,W.useRef)([]),v=(0,W.useRef)(null),y=(0,W.useRef)(1),b=(0,W.useRef)(Math.floor(Math.random()*999e3)+1e3),x=(0,W.useRef)(null),S=(0,W.useRef)(null),C=(0,W.useRef)(null),w=(0,W.useRef)(r),T=(0,W.useRef)(a),E=(0,W.useRef)(0),D=(0,W.useRef)(null),O=(0,W.useRef)(Number(localStorage.getItem(K.logLength)??200)),k=(0,W.useRef)(localStorage.getItem(K.logAutoScroll)!==`false`),A=(0,W.useMemo)(()=>window.location.href.replace(/^http/,`ws`),[]);(0,W.useEffect)(()=>(Q&&console.log(`WebSocket messages started counter interval`),D.current=setInterval(()=>{E.current>0&&(Q&&console.log(`WebSocket messages received in the last 10 seconds: ${E.current*(60/10)} messages/minute`),E.current=0)},10*1e3),()=>{Q&&console.log(`WebSocket messages stopped counter interval`),D.current&&clearInterval(D.current),D.current=null}),[]),(0,W.useEffect)(()=>{w.current=r},[r]),(0,W.useEffect)(()=>{T.current=a},[a]);let j=(0,W.useCallback)(()=>Math.floor(Math.random()*999e3)+1e3,[]),ee=(0,W.useCallback)((e,t)=>{Q&&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}})())))},[]),M=(0,W.useCallback)(e=>{if(v.current&&v.current.readyState===WebSocket.OPEN)try{Q&&console.log(`WebSocket sending message with id ${e.id}:`,e),e.id===void 0&&(e.id=b.current);let t=JSON.stringify(e);v.current.send(t),Q&&console.log(`WebSocket sent message:`,e)}catch(e){Q&&console.error(`WebSocket error sending message: ${e}`)}else Q&&console.error(`WebSocket message not sent, WebSocket not connected:`,e)},[]),N=(0,W.useCallback)((e,t)=>{n(n=>[...n,{level:e,time:``,name:``,message:t}])},[]),P=(0,W.useCallback)((e,t)=>{Q&&console.log(`WebSocket addListener id ${t}:`,e),(t==null||isNaN(t)||t===0)&&console.error(`WebSocket addListener called without id, listener not added:`,e),_.current=[..._.current,{listener:e,id:t}],Q&&console.log(`WebSocket addListener total listeners:`,_.current.length)},[]),te=(0,W.useCallback)(e=>{Q&&console.log(`WebSocket removeListener:`,e),_.current=_.current.filter(t=>t.listener!==e),Q&&console.log(`WebSocket removeListener total listeners:`,_.current.length)},[]),ne=(0,W.useCallback)(()=>{A===``||A==null||(N(`WebSocket`,`Connecting ${ai?`with password`:``} to WebSocket: ${A}`),Q&&console.log(`WebSocket connecting to: ${A}${ai?`?password=[redacted]`:``}`),v.current=new WebSocket(A+(ai?`?password=${encodeURIComponent(ai)}`:``)),v.current.onmessage=e=>{s||c(!0),E.current+=1;try{let t=JSON.parse(e.data);if(t.id===void 0||t.src===void 0||t.dst===void 0){Q&&console.error(`WebSocket undefined message id/src/dst:`,t);return}if(t.src!==`Matterbridge`||t.dst!==`Frontend`){Q&&console.error(`WebSocket invalid message src/dst:`,t);return}if(t.error){Q&&console.error(`WebSocket error message response:`,t);return}if(t.id===b.current&&t.method===`pong`&&t.response===`pong`){Q&&console.log(`WebSocket pong response message id ${t.id}:`,t),S.current&&clearTimeout(S.current),S.current=null;return}else if(t.method===`snackbar`&&t.response&&t.response.message){Q&&console.log(`WebSocket message id ${t.id} method ${t.method}:`,t),l(t.response.message,t.response.timeout,t.response.severity);return}else if(t.method===`close_snackbar`&&t.response&&t.response.message){Q&&console.log(`WebSocket message id ${t.id} method ${t.method}:`,t),u(t.response.message);return}else 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`?f(t.response.message,``,``):t.response.name===`Matterbridge:spawn-exit-success`?m():t.response.name===`Matterbridge:spawn-exit-error`?h():g(t.response.message+`
`)),[`debug`,`info`,`notice`,`warn`,`error`,`fatal`].includes(t.response.level)&&(w.current===`info`&&t.response.level===`debug`||w.current===`notice`&&(t.response.level===`debug`||t.response.level===`info`)||w.current===`warn`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`)||w.current===`error`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`)||w.current===`fatal`&&(t.response.level===`debug`||t.response.level===`info`||t.response.level===`notice`||t.response.level===`warn`||t.response.level===`error`)))||T.current!==`*`&&T.current!==``&&!T.current.startsWith(`/`)&&!T.current.endsWith(`/`)&&!t.response.message.toLowerCase().includes(T.current.toLowerCase())&&!t.response.name.toLowerCase().includes(T.current.toLowerCase())||T.current.startsWith(`/`)&&T.current.endsWith(`/`)&&(()=>{try{let e=new RegExp(T.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 "${T.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 Q&&console.log(`WebSocket new log message added (${n.length}/${O.current}):`,n[n.length-1]),n.length>O.current+O.current*10/100?(Q&&console.log(`WebSocket sliced log messages to the last ${O.current} entries`),n.slice(n.length-O.current)):n})}else{if(Q&&console.log(`WebSocket received message id ${t.id} method ${t.method}:`,t),t.id===0)_.current.forEach(e=>e.listener(t));else{let e=_.current.find(e=>e.id===t.id);e?e.listener(t):console.warn(`WebSocket no listener found for message id ${t.id}:`,t)}return}}catch(e){console.error(`WebSocket error parsing message: ${e}`,e instanceof Error?e.stack:null)}},v.current.onopen=()=>{Q&&console.log(`WebSocket: Connected to WebSocket: ${A}`),N(`WebSocket`,`Connected to WebSocket: ${A}`),c(!0),d(),y.current=1,C.current=setTimeout(()=>{x.current=setInterval(()=>{M({id:b.current,method:`ping`,src:`Frontend`,dst:`Matterbridge`,params:{}}),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{Q&&console.error(`WebSocketUse: No pong response received from WebSocket: ${A}`),N(`WebSocket`,`No pong response received from WebSocket: ${A}`),c(!1)},1e3*50)},1e3*60)},1e3*300)},v.current.onclose=()=>{Q&&console.error(`WebSocket: Disconnected from WebSocket ${si?`with Ingress`:``}: ${A}`),N(`WebSocket`,`Disconnected from WebSocket: ${A}`),c(!1),d(),p(),C.current&&clearTimeout(C.current),S.current&&clearTimeout(S.current),x.current&&clearInterval(x.current),N(`WebSocket`,`Reconnecting (attempt ${y.current} of 100) to WebSocket${si?` (Ingress)`:``}: ${A}`),si?setTimeout(re,5e3):y.current===1?re():y.current<100?setTimeout(re,1e3*y.current):N(`WebSocket`,`Reconnect attempts exceeded limit of 100 retries, refresh the page to reconnect to: ${A}`),y.current+=1},v.current.onerror=e=>{Q&&console.error(`WebSocket: WebSocket error connecting to ${A}:`,e),N(`WebSocket`,`WebSocket error connecting to ${A}`)})},[A]),re=(0,W.useCallback)(()=>{Q&&console.log(`WebSocket attemptReconnect ${y.current}/100 to:`,A),ne()},[ne]);(0,W.useEffect)(()=>(ne(),()=>{v.current&&v.current.readyState===WebSocket.OPEN&&v.current.close()}),[ne]);let ie=(0,W.useMemo)(()=>({messages:t,logLength:O,logAutoScroll:k,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:ee}),[t,O,k,r,a,n,i,o,ee]),ae=(0,W.useMemo)(()=>({logLength:O,logAutoScroll:k,logFilterLevel:r,logFilterSearch:a,setMessages:n,setLogFilterLevel:i,setLogFilterSearch:o,filterLogMessages:ee,online:s,retry:y.current,getUniqueId:j,addListener:P,removeListener:te,sendMessage:M,logMessage:N}),[O,k,n,i,o,s,y.current,P,te,M,N]);return(0,G.jsx)(Rt.Provider,{value:ie,children:(0,G.jsx)(q.Provider,{value:ae,children:e})})}function Bt(e){return(0,G.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,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`linearGradient`,{id:`lg1`,x1:`16.6`,y1:`16.6`,x2:`279.6`,y2:`279.6`,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,G.jsx)(`stop`,{offset:`.1`,stopColor:`#3faa77`}),(0,G.jsx)(`stop`,{offset:`.3`,stopColor:`#234148`}),(0,G.jsx)(`stop`,{offset:`.7`,stopColor:`#203b44`}),(0,G.jsx)(`stop`,{offset:`.9`,stopColor:`#ad2e6e`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,G.jsxs)(`linearGradient`,{id:`lg2`,x1:`31.1`,y1:`31.1`,x2:`265.1`,y2:`265.1`,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#00b48d`}),(0,G.jsx)(`stop`,{offset:`.2`,stopColor:`#285251`}),(0,G.jsx)(`stop`,{offset:`.4`,stopColor:`#234148`}),(0,G.jsx)(`stop`,{offset:`.8`,stopColor:`#203b44`}),(0,G.jsx)(`stop`,{offset:`.9`,stopColor:`#a8316c`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#c81b74`})]}),(0,G.jsxs)(`linearGradient`,{id:`lg3`,x1:`116.2`,y1:`143.9`,x2:`139.8`,y2:`143.9`,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#8bc751`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#0db14b`})]}),(0,G.jsx)(`linearGradient`,{id:`lg4`,x1:`136.1`,y1:`100.8`,x2:`159.6`,y2:`100.8`,xlinkHref:`#lg3`}),(0,G.jsx)(`linearGradient`,{id:`lg5`,x1:`155.3`,y1:`143.9`,x2:`178.9`,y2:`143.9`,xlinkHref:`#lg3`}),(0,G.jsxs)(`linearGradient`,{id:`lg6`,x1:`46.8`,y1:`25.7`,x2:`89.6`,y2:`74.8`,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{offset:`0`,stopColor:`#b1d34a`}),(0,G.jsx)(`stop`,{offset:`1`,stopColor:`#50b848`})]})]}),(0,G.jsx)(`rect`,{width:`296.2`,height:`296.2`,rx:`56.7`,ry:`56.7`,style:{fill:`url(#lg1)`}}),(0,G.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,G.jsx)(`circle`,{cx:`128`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg3)`}}),(0,G.jsx)(`circle`,{cx:`147.8`,cy:`100.8`,r:`11.8`,style:{fill:`url(#lg4)`}}),(0,G.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,G.jsx)(`circle`,{cx:`167.1`,cy:`143.9`,r:`11.8`,style:{fill:`url(#lg5)`}}),(0,G.jsx)(`path`,{fill:`#fff`,d:`M219 89.3V35.5a10.5 10.5 0 1 0-21 0v33.7l21 20Z`}),(0,G.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,G.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,G.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`})]})}function Vt(){let{retry:e}=(0,W.useContext)(q);return(0,G.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,G.jsx)(Bt,{style:{height:`128px`,width:`128px`,margin:`10px`,marginBottom:`20px`}}),e<100?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T,{style:{color:`var(--primary-color)`}}),(0,G.jsx)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:(0,G.jsxs)(`span`,{children:[`Reconnecting to Matterbridge `,`(attempt `+e+`)`,`...`]})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{style:{marginTop:`20px`,color:`var(--primary-color)`,textAlign:`center`},children:[(0,G.jsx)(`span`,{children:`Unable to connect to Matterbridge after multiple attempts.`}),(0,G.jsx)(`br`,{}),(0,G.jsx)(`span`,{children:`Please check your network connection.`}),(0,G.jsx)(`br`,{})]}),(0,G.jsx)(j,{variant:`contained`,color:`primary`,onClick:()=>{window.location.reload()},style:{marginTop:`20px`},children:`Refresh the Page`})]})]})}var J=pt();function Ht({value:e,maxChars:t}){let n=e;if(e.length>t&&t>3){let r=t-3;n=`${e.substring(0,Math.ceil(r/2))} … ${e.substring(e.length-Math.floor(r/2),e.length)}`}return e===n?(0,G.jsx)(`span`,{children:n}):(0,G.jsx)(B,{title:e,placement:`top`,slotProps:{popper:{modifiers:[{name:`offset`,options:{offset:[0,12]}}]}},children:(0,G.jsx)(`span`,{children:n})})}function Y({children:e,style:t}){return(0,G.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 Ut({children:e,style:t}){return(0,G.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 X({children:e,style:t}){return(0,G.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 Wt({children:e,style:t}){return(0,G.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 Gt({children:e,style:t}){return(0,G.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 Kt({children:e,style:t}){return(0,G.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 qt({children:e,style:t,onDragOver:n,onDragLeave:r,onDrop:i}){return(0,G.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 Jt({children:e,style:t,close:n}){return(0,G.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,margin:`0px`,padding:`0px`,paddingRight:`10px`,gap:`10px`,...t},children:[e,!1]})}function Yt({systemInfo:e,compact:t}){let{mobile:n}=(0,W.useContext)(It),{addListener:r,removeListener:i,getUniqueId:a,sendMessage:o}=(0,W.useContext)(q),[s,c]=(0,W.useState)(e),l=(0,W.useRef)(a());if(Q&&console.log(`SystemInfoTable loading with systemInfo:`,s,`compact:`,t),e&&t&&s.totalMemory&&s.freeMemory){let e=s.totalMemory;s.freeMemory=`${s.freeMemory} / ${e}`,s.totalMemory=``}if(e&&t&&s.heapTotal&&s.heapUsed){let e=s.heapTotal;s.heapUsed=`${s.heapUsed} / ${e}`,s.heapTotal=``}e&&t&&s.osRelease&&s.osType&&(s.osType=`${s.osType} (${s.osRelease})`,s.osRelease=``),e&&t&&s.osArch&&s.osPlatform&&(s.osPlatform=`${s.osPlatform} (${s.osArch})`,s.osArch=``);let u=(e,t,n,r,i)=>{c(a=>({...a,totalMemory:e,freeMemory:t,heapTotal:n,heapUsed:r,rss:i}))},d=e=>{c(t=>({...t,cpuUsage:e.toFixed(2)+` %`}))},f=e=>{c(t=>({...t,processCpuUsage:e.toFixed(2)+` %`}))},p=(e,t)=>{c(n=>({...n,systemUptime:e,processUptime:t}))},m=()=>{Q&&console.log(`SystemInfoTable handleViewHistory clicked`),o({id:l.current,sender:`Header`,method:`/api/viewhistorypage`,src:`Frontend`,dst:`Matterbridge`,params:{}})};(0,W.useEffect)(()=>{let e=e=>{Q&&console.log(`SystemInfoTable received WebSocket Message:`,e),e.method===`memory_update`&&e.response&&e.response.totalMemory&&e.response.freeMemory&&e.response.heapTotal&&e.response.heapUsed&&e.response.rss?(Q&&console.log(`SystemInfoTable received memory_update`,e),u(e.response.totalMemory,e.response.freeMemory,e.response.heapTotal,e.response.heapUsed,e.response.rss)):e.method===`cpu_update`&&e.response&&e.response.cpuUsage?(Q&&console.log(`SystemInfoTable received cpu_update`,e),d(e.response.cpuUsage),f(e.response.processCpuUsage)):e.method===`uptime_update`&&e.response&&e.response.systemUptime&&e.response.processUptime?(Q&&console.log(`SystemInfoTable received uptime_update`,e),p(e.response.systemUptime,e.response.processUptime)):e.method===`/api/viewhistorypage`&&e.id===l.current&&e.success===!0&&(Q&&console.log(`SystemInfoTable received /api/viewhistorypage success`),window.open(`./api/viewhistory`,`_blank`,`noopener,noreferrer`))};return r(e,l.current),Q&&console.log(`SystemInfoTable added WebSocket listener id ${l.current}`),()=>{i(e),Q&&console.log(`SystemInfoTable removed WebSocket listener`)}},[r,i]);let[h,g]=(0,W.useState)(!1);return!s||h?null:(Q&&console.log(`SystemInfoTable rendering...`),(0,G.jsxs)(Y,{style:$&&n?{flex:`1 1 300px`}:{flex:`0 1 auto`,width:`302px`,minWidth:`302px`},children:[(0,G.jsxs)(Ut,{children:[(0,G.jsx)(X,{children:`System info`}),(0,G.jsx)(Jt,{close:()=>g(!0),children:(0,G.jsx)(I,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:m,children:(0,G.jsx)(B,{title:`Open the cpu and memory usage page`,arrow:!0,children:(0,G.jsx)(J.Icon,{path:ht,size:`22px`})})})})]}),(0,G.jsx)(qt,{style:$&&n?{flex:`1 1 auto`,margin:`0px`,padding:`0px`,gap:`0px`}:{flex:`1 1 auto`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0px`},children:(0,G.jsxs)(`table`,{style:{border:`none`,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,G.jsxs)(`colgroup`,{children:[(0,G.jsx)(`col`,{style:{width:`40%`}}),(0,G.jsx)(`col`,{style:{width:`60%`}})]}),(0,G.jsx)(`tbody`,{style:{border:`none`,borderCollapse:`collapse`},children:Object.entries(s).filter(([e,t])=>t!==void 0&&t!==``).map(([e,t],r)=>(0,G.jsxs)(`tr`,{className:r%2==0?`table-content-even`:`table-content-odd`,style:{border:`none`,borderCollapse:`collapse`},children:[(0,G.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`},children:e.replace(`interfaceName`,`Interface name`).replace(`macAddress`,`Mac address`).replace(`ipv4Address`,`IPv4 address`).replace(`ipv6Address`,`IPv6 address`).replace(`nodeVersion`,`Node version`).replace(`hostname`,`Hostname`).replace(`user`,`User`).replace(`osType`,`Os`).replace(`osPlatform`,`Platform`).replace(`freeMemory`,`Memory`).replace(`systemUptime`,`System uptime`).replace(`processUptime`,`Process uptime`).replace(`cpuUsage`,`Host CPU`).replace(`processCpuUsage`,`Process CPU`).replace(`rss`,`Rss`).replace(`heapUsed`,`Heap`)}),(0,G.jsx)(`td`,{style:{border:`none`,borderCollapse:`collapse`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:$&&n?typeof t==`string`?t:t.toString():(0,G.jsx)(Ht,{value:typeof t==`string`?t:t.toString(),maxChars:22})})]},e))})]})})]}))}var Xt=(0,W.memo)(Yt),Zt={margin:`0px`,padding:`0px`,color:`var(--div-text-color)`,transition:`color 0.2s ease`,"& svg":{display:`block`},"& svg path":{fill:`var(--div-text-color)`,transition:`fill 0.2s ease`},"&:hover":{color:`var(--primary-color)`},"&:hover svg path":{fill:`var(--primary-color)`},"&:focus-visible":{outline:`2px solid var(--primary-color)`,outlineOffset:`2px`}},Qt=e=>{if(!e)return``;let t=e.toString().replace(/[^0-9]/g,``);return t.length<5?t:[t.slice(0,4),t.slice(4,7),t.slice(7,11)].filter(Boolean).join(`-`)};function $t({id:e}){let{online:t,sendMessage:n,addListener:r,removeListener:i,getUniqueId:a}=(0,W.useContext)(q),[o,s]=(0,W.useState)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(a()),{mobile:d,showConfirmCancelDialog:f}=(0,W.useContext)(It);Q&&console.log(`QRDiv loading with id = "${e}" storeId = "${c.current}" timeout = ${l.current} and matter:`,o),(0,W.useEffect)(()=>{Q&&console.log(`QRDiv id effect "${e}"`),c.current=e,l.current&&clearTimeout(l.current),l.current=null,e?(Q&&console.log(`QRDiv id effect sending data request for storeId "${e}"`),n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:e,server:!0}})):(Q&&console.log(`QRDiv id effect setting matter to null`),s(null))},[e,n]),(0,W.useEffect)(()=>{let e=e=>{Q&&console.log(`QRDiv received WebSocket Message:`,e),e.method===`refresh_required`&&e.response.changed===`matter`&&e.response.matter&&(Q&&console.log(`QRDiv received refresh_required: changed=${e.response.changed} for storeId "${e.response.matter.id}":`,e.response.matter),c.current===e.response.matter.id&&(Q&&console.log(`QRDiv received refresh_required/matter: setting matter data for storeId "${e.response.matter.id}":`,e.response.matter),l.current&&clearTimeout(l.current),s(e.response.matter)))};return r(e,u.current),Q&&console.log(`QRDiv webSocket effect mounted`),()=>{i(e),l.current&&clearTimeout(l.current),l.current=null,Q&&console.log(`QRDiv webSocket effect unmounted`)}},[r,i]);let p=()=>{Q&&console.log(`QRDiv sent matter startCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,startCommission:!0}})},m=()=>{Q&&console.log(`QRDiv sent matter stopCommission for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,stopCommission:!0}})},h=()=>{Q&&console.log(`QRDiv sent matter advertise for node "${o?.id}"`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,advertise:!0}})},g=e=>{Q&&console.log(`QRDiv sent matter removeFabric for node "${o?.id}" and fabricIndex ${e}`),o&&n({id:u.current,sender:`QRDiv`,method:`/api/matter`,src:`Frontend`,dst:`Matterbridge`,params:{id:o.id,removeFabric:e}})};return!o||!t?(Q&&console.log(`QRDiv rendering undefined state`),null):o.online?o.advertising&&o.qrPairingCode&&o.manualPairingCode?(Q&&console.log(`QRDiv rendering advertising state`),(0,G.jsxs)(Y,{style:$&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,G.jsxs)(Ut,{children:[(0,G.jsx)(X,{children:`QR pairing code`}),(0,G.jsxs)(Jt,{children:[(0,G.jsx)(I,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,G.jsx)(B,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,G.jsx)(J.Icon,{path:ft,size:`22px`})})}),(0,G.jsx)(I,{"aria-label":`stop pairing`,size:`small`,onClick:m,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,G.jsx)(B,{title:`Turn off pairing`,arrow:!0,children:(0,G.jsx)(J.Icon,{path:ut,size:`22px`})})})]})]}),(0,G.jsx)(Kt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,G.jsx)(bt,{value:o.qrPairingCode,size:256,level:`M`,fgColor:`var(--div-text-color)`,bgColor:`var(--div-bg-color)`,style:{margin:`20px`}}),(0,G.jsxs)(Wt,{style:{justifyContent:`space-between`},children:[(0,G.jsxs)(Gt,{style:{fontWeight:`normal`,color:`var(--div-text-color)`},children:[`Manual pairing code: `,Qt(o.manualPairingCode)]}),(0,G.jsx)(Jt,{children:(0,G.jsx)(B,{title:`Copy manual pairing code`,arrow:!0,children:(0,G.jsx)(I,{"aria-label":`copy manual pairing code`,size:`small`,onClick:async()=>{if(!o||!o.manualPairingCode)return;let e=o.manualPairingCode.toString();try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}Q&&console.log(`Manual pairing code copied to clipboard`)}catch(e){console.error(`Failed to copy manual pairing code`,e)}},sx:Zt,children:(0,G.jsx)(J.Icon,{path:mt,size:.85})})})})]})]})):o.commissioned&&o.fabricInformations&&o.sessionInformations?(Q&&console.log(`QRDiv rendering commissioned state`),(0,G.jsxs)(Y,{style:$&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`,overflow:`hidden`},children:[(0,G.jsxs)(Ut,{children:[(0,G.jsx)(X,{children:`Paired fabrics`}),(0,G.jsxs)(Jt,{children:[(0,G.jsx)(I,{"aria-label":`send advertising`,size:`small`,onClick:h,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,G.jsx)(B,{title:`Send again the mDNS advertisement`,arrow:!0,children:(0,G.jsx)(J.Icon,{path:ft,size:`22px`})})}),(0,G.jsx)(I,{"aria-label":`start pairing`,size:`small`,onClick:p,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},children:(0,G.jsx)(B,{title:`Turn on pairing`,arrow:!0,children:(0,G.jsx)(J.Icon,{path:_t,size:`22px`})})})]})]}),(0,G.jsx)(Kt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,G.jsx)(qt,{style:{flexDirection:`column`,justifyContent:`flex-start`,flex:`1 1 auto`,overflow:`auto`,padding:`0px 0px 10px 0px`,gap:`0px`},children:o.fabricInformations.map((e,t)=>(0,G.jsxs)(`div`,{style:{margin:`0px`,padding:`10px`,gap:`0px`,color:`var(--div-text-color)`,backgroundColor:`var(--div-bg-color)`,textAlign:`left`,fontSize:`14px`},children:[(0,G.jsxs)(`div`,{style:{marginLeft:`20px`,marginBottom:`10px`,display:`flex`,flexDirection:`row`,justifyContent:`space-between`,gap:`20px`,alignItems:`center`},children:[(0,G.jsxs)(`p`,{className:`status-blue`,style:{margin:`0px`,padding:`3px 10px`,width:`200px`,fontSize:`14px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`},children:[`Fabric: `,e.fabricIndex]}),(0,G.jsx)(B,{title:`Remove the fabric. You will also need to remove it from the controller.`,arrow:!0,children:(0,G.jsx)(I,{"aria-label":`remove the fabric`,size:`small`,onClick:()=>f(`Remove fabric`,`Are you sure you want to remove this fabric? You will also need to remove it from the controller.`,`RemoveFabric`,()=>g(e.fabricIndex),()=>{}),sx:{...Zt,padding:`2px`},children:(0,G.jsx)(J.Icon,{path:gt,size:1})})})]}),(0,G.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Vendor: `,e.rootVendorId,` `,e.rootVendorName]}),e.label!==``&&(0,G.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Label: `,e.label]}),(0,G.jsxs)(`p`,{style:{margin:`0px 20px 0px 20px`,color:`var(--div-text-color)`},children:[`Sessions: `,o.sessionInformations?o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive===!0).length:`0`,` `,`subscriptions: `,o.sessionInformations?o.sessionInformations.filter(t=>t.fabric?.fabricIndex===e.fabricIndex&&t.isPeerActive===!0&&t.numberOfActiveSubscriptions>0).length:`0`]})]},t))}),(0,G.jsx)(Wt,{style:{justifyContent:`center`},children:(0,G.jsxs)(Gt,{style:{fontWeight:`normal`},children:[`Serial number: `,o.serialNumber]})})]})):!o.commissioned&&!o.advertising?(Q&&console.log(`QRDiv rendering not commissioned and not advertising state`),(0,G.jsxs)(Y,{style:$&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,G.jsx)(Ut,{children:(0,G.jsx)(X,{children:`QR pairing code`})}),(0,G.jsx)(Kt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,G.jsx)(j,{onClick:p,endIcon:(0,G.jsx)(J.Icon,{path:_t,size:1}),style:{margin:`20px`,color:`var(--main-button-color)`,backgroundColor:`var(--main-button-bg-color)`,height:`30px`,minWidth:`90px`},children:`Turn on pairing`}),(0,G.jsx)(Wt,{style:{justifyContent:`center`},children:(0,G.jsxs)(Gt,{style:{fontWeight:`normal`},children:[`Serial number: `,o.serialNumber]})})]})):(Q&&console.log(`QRDiv rendering unknown state`),null):(Q&&console.log(`QRDiv rendering offline state`),(0,G.jsxs)(Y,{style:$&&d?{flex:`1 1 300px`,alignItems:`center`}:{alignItems:`center`,width:`302px`,minWidth:`302px`},children:[(0,G.jsx)(Ut,{style:{height:`30px`,justifyContent:`space-between`},children:(0,G.jsx)(X,{children:`Server node`})}),(0,G.jsx)(Kt,{style:{maxWidth:`280px`,fontWeight:`bold`,color:`var(--secondary-color)`},children:c.current}),(0,G.jsx)(Kt,{style:{fontWeight:`bold`},children:`Server offline`}),(0,G.jsx)(Wt,{style:{justifyContent:`center`},children:(0,G.jsxs)(Gt,{style:{fontWeight:`normal`},children:[`Serial number: `,o.serialNumber]})})]}))}var en=(0,W.memo)($t);function tn(e){return e?e.scrollWidth>e.clientWidth:!1}function nn({title:e,children:t}){let n=(0,W.useRef)(null),[r,i]=(0,W.useState)(!1);return(0,G.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)`}}},children:(0,G.jsx)(`span`,{ref:n,onMouseEnter:()=>{i(tn(n.current))},onMouseLeave:()=>{i(!1)},style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})})}function rn(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 an({name:e,title:t,columns:n,rows:r,getRowKey:i,footerLeft:a,footerRight:o,onRowClick:s}){let c=(0,W.useRef)(new WeakMap),l=(0,W.useRef)(1),u=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 r=n?.[0]?.id;if(r&&t&&t[r]!=null)return t[r];console.warn(`MbfTable(${e}): using fallback stable row key; consider providing getRowKey prop for better React performance`);let a=c.current.get(t);return a||(a=`rk_${l.current++}`,c.current.set(t,a)),a},[d,f]=(0,W.useState)(localStorage.getItem(`${e}_table_order_by`)||null),[p,m]=(0,W.useState)(localStorage.getItem(`${e}_table_order`)||null),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(()=>{try{let t=localStorage.getItem(`${e}_column_visibility`);if(t)return JSON.parse(t)}catch{}return{}}),y=(0,W.useMemo)(()=>{let e={};for(let t of n)t.hidden||(e[t.id]=t.required?!0:_[t.id]!==!1);return e},[n,_]),b=(0,W.useMemo)(()=>{if(!d||!p)return r;let e=n.find(e=>e.id===d);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):rn(t.el,n.el,d),r===0?t.index-n.index:p===`asc`?r:-r}),t.map(e=>e.el)},[r,d,p,n]),S=t=>{if(d!==t||!d){f(t),m(`asc`),localStorage.setItem(`${e}_table_order_by`,t),localStorage.setItem(`${e}_table_order`,`asc`);return}if(p===`asc`){m(`desc`),localStorage.setItem(`${e}_table_order`,`desc`);return}f(null),m(null),localStorage.removeItem(`${e}_table_order_by`),localStorage.removeItem(`${e}_table_order`)},C=()=>{g(!h)},w=t=>{v(r=>{let i=n.find(e=>e.id===t);if(i&&i.required)return r;let a=y[t]!==!1,o={...r};a?o[t]=!1:delete o[t];try{localStorage.setItem(`${e}_column_visibility`,JSON.stringify(o))}catch{}return o})},T=()=>{v({});try{localStorage.removeItem(`${e}_column_visibility`)}catch{}g(!1)},[E,O]=(0,W.useState)(!1);return E?null:(Q&&console.log(`Rendering table ${e}${d&&p?` ordered by ${d}:${p}`:``}`),(0,G.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,G.jsxs)(x,{open:h,onClose:(e,t)=>{t===`backdropClick`||t===`escapeKeyDown`||C()},disableEscapeKeyDown:!0,disableRestoreFocus:!0,children:[(0,G.jsx)(M,{gap:`20px`,children:(0,G.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`20px`},children:[(0,G.jsx)(`img`,{src:`matterbridge.svg`,alt:`Matterbridge Logo`,style:{height:`32px`,width:`32px`}}),(0,G.jsx)(`h4`,{style:{margin:0},children:`Configure ${e} columns`})]})}),(0,G.jsx)(P,{children:(0,G.jsx)(ne,{children:n.filter(e=>!e.hidden).map(e=>(0,G.jsx)(Ie,{control:(0,G.jsx)(D,{disabled:!!e.required,checked:e.required?!0:y[e.id]!==!1,onChange:()=>w(e.id)}),label:e.label},e.id))})}),(0,G.jsxs)(ie,{children:[(0,G.jsx)(j,{onClick:T,children:`Reset`}),(0,G.jsx)(j,{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{}C()},children:`Close`})]})]}),(0,G.jsxs)(Ut,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,borderBottom:`none`},children:[(0,G.jsx)(X,{children:e}),t&&(0,G.jsx)(X,{children:t}),(0,G.jsx)(Jt,{close:()=>O(!0),children:(0,G.jsx)(I,{size:`small`,sx:{color:`var(--header-text-color)`,margin:`0px`,padding:`0px`},onClick:e=>{if(e?.currentTarget?.blur)try{e.currentTarget.blur()}catch{}C()},"aria-label":`Configure Columns`,children:(0,G.jsx)(B,{title:`Configure ${e} columns`,children:(0,G.jsx)(J.Icon,{path:dt,size:`20px`,color:`var(--header-text-color)`})})})})]}),(0,G.jsx)(qt,{style:{flex:`1 1 auto`,display:`flex`,flexDirection:`column`,minHeight:0,width:`100%`,overflow:`auto`,margin:`0px`,padding:`0px`,gap:`0`},children:(0,G.jsxs)(`table`,{"aria-label":`${e} table`,style:{width:`100%`,borderCollapse:`collapse`},children:[(0,G.jsx)(`thead`,{style:{position:`sticky`,top:0,zIndex:10,border:`none`,color:`var(--header-text-color)`,backgroundColor:`var(--header-bg-color`},children:(0,G.jsx)(`tr`,{style:{height:`30px`,minHeight:`30px`},children:n.map(e=>{if(e.hidden||!e.required&&y[e.id]===!1)return null;let t=!e.noSort,n=t&&d===e.id&&!!p;return(0,G.jsxs)(`th`,{onClick:t?()=>S(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?p===`asc`?`ascending`:`descending`:`none`:void 0,children:[e.label,n&&(0,G.jsxs)(`span`,{style:{marginLeft:6},children:[p===`asc`&&(0,G.jsx)(J.Icon,{path:`M19 17H22L18 21L14 17H17V3H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`}),p===`desc`&&(0,G.jsx)(J.Icon,{path:`M19 7H22L18 3L14 7H17V21H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z`,size:`15px`})]})]},e.id)})})}),(0,G.jsx)(`tbody`,{children:b.map((e,t)=>{let r=u(e);return(0,G.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&&y[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,G.jsx)(D,{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,G.jsx)(nn,{title:String(n),children:i}):i;return(0,G.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,G.jsxs)(Wt,{style:{height:`30px`,minHeight:`30px`,justifyContent:`space-between`,border:`none`},children:[(0,G.jsx)(Gt,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:a}),(0,G.jsx)(Gt,{style:{fontSize:`14px`,fontWeight:`normal`,color:`var(--secondary-color)`},children:o})]})]}))}function on(e){return(0,W.memo)(e)}var sn=on(an),cn=e=>e.replace(`git+`,``).replace(`.git`,``).trim(),ln=e=>{let t=cn(e);return t.startsWith(`git://`)&&(t=`https://${t.slice(6)}`),t.startsWith(`ssh://git@github.com/`)&&(t=`https://github.com/${t.slice(21)}`),t.startsWith(`git@github.com:`)&&(t=`https://github.com/${t.slice(15).replace(`:`,`/`)}`),t},un=e=>{if(typeof e==`string`)return e.trim()||null;if(!e||typeof e!=`object`)return null;let t=e.url;return typeof t==`string`&&t.trim()||null},dn=()=>{try{let e=window.localStorage.getItem(K.searchPluginsTotal);if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t)){if(!e||!r||typeof r!=`object`)continue;let t=r;typeof t.total==`number`&&typeof t.asOf==`string`&&(n[e]={total:t.total,asOf:t.asOf})}return n}catch{return{}}},fn=e=>{try{window.localStorage.setItem(K.searchPluginsTotal,JSON.stringify(e))}catch{}},pn=()=>{try{let e=window.localStorage.getItem(K.searchPluginsMeta);if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t)){if(!e||!r||typeof r!=`object`)continue;let t=r;typeof t.asOf==`string`&&(n[e]={homepage:typeof t.homepage==`string`?t.homepage:null,help:typeof t.help==`string`?t.help:null,changelog:typeof t.changelog==`string`?t.changelog:null,asOf:t.asOf})}return n}catch{return{}}},mn=e=>{try{window.localStorage.setItem(K.searchPluginsMeta,JSON.stringify(e))}catch{}},hn=()=>{try{let e=window.localStorage.getItem(K.searchPluginsVersions);if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t)){if(!e||!r||typeof r!=`object`)continue;let t=r;typeof t.asOf==`string`&&Array.isArray(t.versions)&&(n[e]={versions:t.versions.filter(e=>typeof e==`string`),asOf:t.asOf})}return n}catch{return{}}},gn=e=>{try{window.localStorage.setItem(K.searchPluginsVersions,JSON.stringify(e))}catch{}},_n=({open:e,onClose:t,onSelect:n,onVersions:r})=>{let[i,a]=(0,W.useState)(``),o=(0,W.useRef)(``),s=(0,W.useRef)(!1),c=(0,W.useRef)(null),[l,u]=(0,W.useState)([]),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)({done:0,total:0}),[y,b]=(0,W.useState)(null),S=(0,W.useRef)({}),C=()=>{let e=document.activeElement;e&&e instanceof HTMLElement&&e.blur()},w=e=>`${e.getFullYear().toString()}-${(e.getMonth()+1).toString().padStart(2,`0`)}-${e.getDate().toString().padStart(2,`0`)}`,T=(0,W.useCallback)(async(e,t)=>{let n=S.current[e];if(n&&n.asOf===t&&Array.isArray(n.versions)&&n.versions.length>0&&n.versio