zigbee2mqtt-windfront 1.0.1 → 1.0.2

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.
Files changed (192) hide show
  1. package/dist/assets/{About-NjZYVGGK.js → About-BvUoh1FC.js} +1 -1
  2. package/dist/assets/About-BvUoh1FC.js.br +0 -0
  3. package/dist/assets/{Availability-CRIDrhlB.js → Availability-D-8394Wg.js} +1 -1
  4. package/dist/assets/Availability-D-8394Wg.js.br +0 -0
  5. package/dist/assets/{Bind-2EyqGKNk.js → Bind-2vU4MEda.js} +1 -1
  6. package/dist/assets/Bind-2vU4MEda.js.br +0 -0
  7. package/dist/assets/{Bridge-BxUlX1vE.js → Bridge-BqxyXM2U.js} +1 -1
  8. package/dist/assets/Bridge-BqxyXM2U.js.br +0 -0
  9. package/dist/assets/{CheckboxField-CanRey3x.js → CheckboxField-m1WCeVZk.js} +1 -1
  10. package/dist/assets/CheckboxField-m1WCeVZk.js.br +0 -0
  11. package/dist/assets/{ClusterSinglePicker-CpOqo3Ro.js → ClusterSinglePicker-DrJuGiNl.js} +1 -1
  12. package/dist/assets/ClusterSinglePicker-DrJuGiNl.js.br +0 -0
  13. package/dist/assets/{Clusters-CWxqlz_3.js → Clusters-1Agu340f.js} +1 -1
  14. package/dist/assets/Clusters-1Agu340f.js.br +0 -0
  15. package/dist/assets/{Dashboard-CZJkSLjr.js → Dashboard-qgN8yhOe.js} +1 -1
  16. package/dist/assets/Dashboard-qgN8yhOe.js.br +0 -0
  17. package/dist/assets/{DashboardFeatureWrapper-BPi5Syin.js → DashboardFeatureWrapper-CotxeSO1.js} +1 -1
  18. package/dist/assets/DashboardFeatureWrapper-CotxeSO1.js.br +0 -0
  19. package/dist/assets/{DebouncedInput-suZwHdPO.js → DebouncedInput-DpBqTOhq.js} +1 -1
  20. package/dist/assets/DebouncedInput-DpBqTOhq.js.br +0 -0
  21. package/dist/assets/{DevConsole-HKbEkq5G.js → DevConsole-BqxayO7F.js} +1 -1
  22. package/dist/assets/DevConsole-BqxayO7F.js.br +0 -0
  23. package/dist/assets/{DevConsole-BpLyFXQ6.js → DevConsole-xggBDKxm.js} +1 -1
  24. package/dist/assets/DevConsole-xggBDKxm.js.br +0 -0
  25. package/dist/assets/{DeviceCard-C1UuNxRA.js → DeviceCard-C0AcffeR.js} +1 -1
  26. package/dist/assets/DeviceCard-C0AcffeR.js.br +0 -0
  27. package/dist/assets/{DeviceControlEditName-DJowO9Oo.js → DeviceControlEditName-BXFSFs5f.js} +1 -1
  28. package/dist/assets/DeviceControlEditName-BXFSFs5f.js.br +0 -0
  29. package/dist/assets/{DeviceImage-B6F8WQJo.js → DeviceImage-BpknBFw1.js} +1 -1
  30. package/dist/assets/DeviceImage-BpknBFw1.js.br +0 -0
  31. package/dist/assets/{DeviceInfo-YHgZjzBI.js → DeviceInfo-BJ5kiv6l.js} +1 -1
  32. package/dist/assets/DeviceInfo-BJ5kiv6l.js.br +0 -0
  33. package/dist/assets/{DevicePage-uH6dGCsg.js → DevicePage-BOJ407QW.js} +2 -2
  34. package/dist/assets/DevicePage-BOJ407QW.js.br +0 -0
  35. package/dist/assets/{DevicePicker-DxCWDQnp.js → DevicePicker-CGedN3DH.js} +1 -1
  36. package/dist/assets/DevicePicker-CGedN3DH.js.br +0 -0
  37. package/dist/assets/{DeviceSettings-L5BnZTC6.js → DeviceSettings-chmhK32L.js} +1 -1
  38. package/dist/assets/DeviceSettings-chmhK32L.js.br +0 -0
  39. package/dist/assets/{DeviceSpecificSettings-BqkOD4QF.js → DeviceSpecificSettings-gQVInXHA.js} +1 -1
  40. package/dist/assets/DeviceSpecificSettings-gQVInXHA.js.br +0 -0
  41. package/dist/assets/{Devices-97iPX55p.js → Devices-B1Wz8goW.js} +1 -1
  42. package/dist/assets/Devices-B1Wz8goW.js.br +0 -0
  43. package/dist/assets/{DevicesPage-zt3K4Z20.js → DevicesPage-KqAIbICr.js} +1 -1
  44. package/dist/assets/DevicesPage-KqAIbICr.js.br +0 -0
  45. package/dist/assets/{DisplayValue-CZpYmpLD.js → DisplayValue-CvjefE6V.js} +1 -1
  46. package/dist/assets/DisplayValue-CvjefE6V.js.br +0 -0
  47. package/dist/assets/{Donate-aQHexwC0.js → Donate-CHy3AC3m.js} +1 -1
  48. package/dist/assets/Donate-CHy3AC3m.js.br +0 -0
  49. package/dist/assets/{EndpointPicker-VM2TEDAs.js → EndpointPicker-DOVgHugJ.js} +1 -1
  50. package/dist/assets/EndpointPicker-DOVgHugJ.js.br +1 -0
  51. package/dist/assets/{Exposes-DusK4Z7N.js → Exposes-CoSxWFf1.js} +1 -1
  52. package/dist/assets/Exposes-CoSxWFf1.js.br +0 -0
  53. package/dist/assets/{Feature-b5LHKHrY.js → Feature-Dn8iv4tk.js} +1 -1
  54. package/dist/assets/Feature-Dn8iv4tk.js.br +0 -0
  55. package/dist/assets/{Frontend-BQRD1FRb.js → Frontend-Czkdrkwh.js} +1 -1
  56. package/dist/assets/Frontend-Czkdrkwh.js.br +0 -0
  57. package/dist/assets/{GroupPage-NYbFvZk4.js → GroupPage-DrEN67Yw.js} +2 -2
  58. package/dist/assets/GroupPage-DrEN67Yw.js.br +0 -0
  59. package/dist/assets/{GroupSettings-lZ4wrUYC.js → GroupSettings-2ilNn-oq.js} +1 -1
  60. package/dist/assets/GroupSettings-2ilNn-oq.js.br +0 -0
  61. package/dist/assets/{Groups-C2IY6j-8.js → Groups-SEucKOeq.js} +1 -1
  62. package/dist/assets/Groups-SEucKOeq.js.br +0 -0
  63. package/dist/assets/{GroupsPage-Cl3obGrH.js → GroupsPage-DbDDAb_2.js} +1 -1
  64. package/dist/assets/GroupsPage-DbDDAb_2.js.br +0 -0
  65. package/dist/assets/{HomePage-Dt0sVTff.js → HomePage-hd1rukZk.js} +1 -1
  66. package/dist/assets/HomePage-hd1rukZk.js.br +0 -0
  67. package/dist/assets/{InputField-C_t5k0Dv.js → InputField-B5sOh_uD.js} +1 -1
  68. package/dist/assets/InputField-B5sOh_uD.js.br +0 -0
  69. package/dist/assets/{LastSeen-CeDLL1-q.js → LastSeen-BB0rwxhg.js} +1 -1
  70. package/dist/assets/LastSeen-BB0rwxhg.js.br +0 -0
  71. package/dist/assets/LogsPage-DSJH7zTG.js +1 -0
  72. package/dist/assets/LogsPage-DSJH7zTG.js.br +0 -0
  73. package/dist/assets/{Lqi-DBfyroIH.js → Lqi-C8sPb_IK.js} +1 -1
  74. package/dist/assets/Lqi-C8sPb_IK.js.br +0 -0
  75. package/dist/assets/{NetworkPage-BU4JgKZc.js → NetworkPage-DQ5iYXwC.js} +2 -2
  76. package/dist/assets/NetworkPage-DQ5iYXwC.js.br +0 -0
  77. package/dist/assets/{OtaPage-BZgdsTpp.js → OtaPage-G_ANDaiC.js} +1 -1
  78. package/dist/assets/OtaPage-G_ANDaiC.js.br +0 -0
  79. package/dist/assets/{PowerSource-BF7Gul0J.js → PowerSource-DFW6CjuU.js} +1 -1
  80. package/dist/assets/PowerSource-DFW6CjuU.js.br +0 -0
  81. package/dist/assets/{RawNetworkData-DWbMOxjo.js → RawNetworkData-Xk75QL3K.js} +5 -5
  82. package/dist/assets/RawNetworkData-Xk75QL3K.js.br +0 -0
  83. package/dist/assets/{RawNetworkMap-C7ipJu2k.js → RawNetworkMap-CwUz_5FO.js} +2 -2
  84. package/dist/assets/RawNetworkMap-CwUz_5FO.js.br +0 -0
  85. package/dist/assets/{RecallRemove-Bt_mgpm8.js → RecallRemove-DchDgS_I.js} +1 -1
  86. package/dist/assets/RecallRemove-DchDgS_I.js.br +0 -0
  87. package/dist/assets/{Reporting-Bjl0j1aN.js → Reporting-O9YIpID9.js} +1 -1
  88. package/dist/assets/Reporting-O9YIpID9.js.br +0 -0
  89. package/dist/assets/Scene-CAO-8z4N.js +1 -0
  90. package/dist/assets/Scene-CAO-8z4N.js.br +0 -0
  91. package/dist/assets/{SelectField-pi0T7PIM.js → SelectField-apZm61cq.js} +1 -1
  92. package/dist/assets/SelectField-apZm61cq.js.br +0 -0
  93. package/dist/assets/{Settings-hpQnUDbw.js → Settings-UIZVjcVZ.js} +1 -1
  94. package/dist/assets/Settings-UIZVjcVZ.js.br +0 -0
  95. package/dist/assets/{SettingsList-CoMEU_Fj.js → SettingsList-D3Urvwh_.js} +1 -1
  96. package/dist/assets/SettingsList-D3Urvwh_.js.br +0 -0
  97. package/dist/assets/{SettingsPage-DlrIVuyx.js → SettingsPage-DQDdJq9S.js} +2 -2
  98. package/dist/assets/SettingsPage-DQDdJq9S.js.br +0 -0
  99. package/dist/assets/{State-DTwjupCm.js → State-BlQwMyRC.js} +1 -1
  100. package/dist/assets/State-BlQwMyRC.js.br +0 -0
  101. package/dist/assets/{Table-CNH7RvaJ.js → Table-DDSIa7cd.js} +1 -1
  102. package/dist/assets/Table-DDSIa7cd.js.br +0 -0
  103. package/dist/assets/{TextareaField-B18rY5b7.js → TextareaField-DY32r12P.js} +1 -1
  104. package/dist/assets/TextareaField-DY32r12P.js.br +0 -0
  105. package/dist/assets/{Tools-_0AcB_CD.js → Tools-C7_tyO66.js} +1 -1
  106. package/dist/assets/Tools-C7_tyO66.js.br +0 -0
  107. package/dist/assets/{TouchlinkPage-BkkAokwt.js → TouchlinkPage-YLdAH-xI.js} +1 -1
  108. package/dist/assets/TouchlinkPage-YLdAH-xI.js.br +0 -0
  109. package/dist/assets/{VendorLink-Bn8AGeqD.js → VendorLink-Q4mHbr9a.js} +1 -1
  110. package/dist/assets/VendorLink-Q4mHbr9a.js.br +0 -0
  111. package/dist/assets/{_createCompounder-CG6wppeM.js → _createCompounder-Bmfmbzn9.js} +1 -1
  112. package/dist/assets/_createCompounder-Bmfmbzn9.js.br +0 -0
  113. package/dist/assets/{capitalize-fmjr8MXW.js → capitalize-Cw1mPDhM.js} +1 -1
  114. package/dist/assets/capitalize-Cw1mPDhM.js.br +0 -0
  115. package/dist/assets/{index-B5pN5VmG.js → index-C4Y7ujGQ.js} +1 -1
  116. package/dist/assets/index-C4Y7ujGQ.js.br +0 -0
  117. package/dist/assets/{index-BB8zE-tT.css → index-KcXdcCUK.css} +1 -1
  118. package/dist/assets/index-KcXdcCUK.css.br +0 -0
  119. package/dist/assets/{index-CwJt2ZPU.js → index-vDL8KyrI.js} +3 -3
  120. package/dist/assets/index-vDL8KyrI.js.br +0 -0
  121. package/dist/assets/{jszip.min-WnSa1ljR.js → jszip.min-BITZWNSu.js} +1 -1
  122. package/dist/assets/jszip.min-BITZWNSu.js.br +0 -0
  123. package/dist/assets/snakeCase-B_0CeYWc.js +1 -0
  124. package/dist/assets/snakeCase-B_0CeYWc.js.br +0 -0
  125. package/dist/index.html +2 -2
  126. package/dist/index.html.br +0 -0
  127. package/package.json +2 -2
  128. package/dist/assets/About-NjZYVGGK.js.br +0 -0
  129. package/dist/assets/Availability-CRIDrhlB.js.br +0 -5
  130. package/dist/assets/Bind-2EyqGKNk.js.br +0 -0
  131. package/dist/assets/Bridge-BxUlX1vE.js.br +0 -1
  132. package/dist/assets/CheckboxField-CanRey3x.js.br +0 -0
  133. package/dist/assets/ClusterSinglePicker-CpOqo3Ro.js.br +0 -0
  134. package/dist/assets/Clusters-CWxqlz_3.js.br +0 -0
  135. package/dist/assets/Dashboard-CZJkSLjr.js.br +0 -0
  136. package/dist/assets/DashboardFeatureWrapper-BPi5Syin.js.br +0 -4
  137. package/dist/assets/DebouncedInput-suZwHdPO.js.br +0 -0
  138. package/dist/assets/DevConsole-BpLyFXQ6.js.br +0 -0
  139. package/dist/assets/DevConsole-HKbEkq5G.js.br +0 -0
  140. package/dist/assets/DeviceCard-C1UuNxRA.js.br +0 -0
  141. package/dist/assets/DeviceControlEditName-DJowO9Oo.js.br +0 -0
  142. package/dist/assets/DeviceImage-B6F8WQJo.js.br +0 -0
  143. package/dist/assets/DeviceInfo-YHgZjzBI.js.br +0 -0
  144. package/dist/assets/DevicePage-uH6dGCsg.js.br +0 -0
  145. package/dist/assets/DevicePicker-DxCWDQnp.js.br +0 -0
  146. package/dist/assets/DeviceSettings-L5BnZTC6.js.br +0 -0
  147. package/dist/assets/DeviceSpecificSettings-BqkOD4QF.js.br +0 -0
  148. package/dist/assets/Devices-97iPX55p.js.br +0 -0
  149. package/dist/assets/DevicesPage-zt3K4Z20.js.br +0 -0
  150. package/dist/assets/DisplayValue-CZpYmpLD.js.br +0 -0
  151. package/dist/assets/Donate-aQHexwC0.js.br +0 -0
  152. package/dist/assets/EndpointPicker-VM2TEDAs.js.br +0 -0
  153. package/dist/assets/Exposes-DusK4Z7N.js.br +0 -0
  154. package/dist/assets/Feature-b5LHKHrY.js.br +0 -0
  155. package/dist/assets/Frontend-BQRD1FRb.js.br +0 -0
  156. package/dist/assets/GroupPage-NYbFvZk4.js.br +0 -0
  157. package/dist/assets/GroupSettings-lZ4wrUYC.js.br +0 -0
  158. package/dist/assets/Groups-C2IY6j-8.js.br +0 -0
  159. package/dist/assets/GroupsPage-Cl3obGrH.js.br +0 -0
  160. package/dist/assets/HomePage-Dt0sVTff.js.br +0 -0
  161. package/dist/assets/InputField-C_t5k0Dv.js.br +0 -0
  162. package/dist/assets/LastSeen-CeDLL1-q.js.br +0 -0
  163. package/dist/assets/LogsPage-DV6f_rSq.js +0 -1
  164. package/dist/assets/LogsPage-DV6f_rSq.js.br +0 -0
  165. package/dist/assets/Lqi-DBfyroIH.js.br +0 -0
  166. package/dist/assets/NetworkPage-BU4JgKZc.js.br +0 -0
  167. package/dist/assets/OtaPage-BZgdsTpp.js.br +0 -0
  168. package/dist/assets/PowerSource-BF7Gul0J.js.br +0 -0
  169. package/dist/assets/RawNetworkData-DWbMOxjo.js.br +0 -0
  170. package/dist/assets/RawNetworkMap-C7ipJu2k.js.br +0 -0
  171. package/dist/assets/RecallRemove-Bt_mgpm8.js.br +0 -0
  172. package/dist/assets/Reporting-Bjl0j1aN.js.br +0 -0
  173. package/dist/assets/Scene-DEvlYeva.js +0 -1
  174. package/dist/assets/Scene-DEvlYeva.js.br +0 -0
  175. package/dist/assets/SelectField-pi0T7PIM.js.br +0 -1
  176. package/dist/assets/Settings-hpQnUDbw.js.br +0 -0
  177. package/dist/assets/SettingsList-CoMEU_Fj.js.br +0 -0
  178. package/dist/assets/SettingsPage-DlrIVuyx.js.br +0 -0
  179. package/dist/assets/State-DTwjupCm.js.br +0 -0
  180. package/dist/assets/Table-CNH7RvaJ.js.br +0 -0
  181. package/dist/assets/TextareaField-B18rY5b7.js.br +0 -0
  182. package/dist/assets/Tools-_0AcB_CD.js.br +0 -0
  183. package/dist/assets/TouchlinkPage-BkkAokwt.js.br +0 -0
  184. package/dist/assets/VendorLink-Bn8AGeqD.js.br +0 -0
  185. package/dist/assets/_createCompounder-CG6wppeM.js.br +0 -0
  186. package/dist/assets/capitalize-fmjr8MXW.js.br +0 -0
  187. package/dist/assets/index-B5pN5VmG.js.br +0 -0
  188. package/dist/assets/index-BB8zE-tT.css.br +0 -0
  189. package/dist/assets/index-CwJt2ZPU.js.br +0 -0
  190. package/dist/assets/jszip.min-WnSa1ljR.js.br +0 -0
  191. package/dist/assets/snakeCase-E1FSY3OI.js +0 -1
  192. package/dist/assets/snakeCase-E1FSY3OI.js.br +0 -0
@@ -1 +1 @@
1
- import{ac as J,aG as Fe,aH as Ie,aI as Be,m as qe,aJ as Ge,aK as Me,aL as Oe,aM as Ve,aN as He,aO as ee,aP as te,aQ as Le,aR as Pe,aS as ze,aT as Ue,aU as We,aV as De,aW as ae,aX as Xe,aY as re,aZ as Ye,a_ as Ke,a$ as L,b0 as ne,b1 as se,V as Qe,b2 as Ze,b3 as Je,b4 as et,b5 as tt,b6 as at,b7 as rt,b8 as nt,b9 as st,ba as ot,bb as ct,bc as lt,bd as it,be as ut,bf as mt,bg as ft,bh as xt,bi as ht,bj as pt,bk as dt,bl as $,bm as gt,bn as oe,bo as bt,bp as _t,bq as yt,br as Ct,bs as ge,bt as jt,bu as be,bv as vt,bw as St,bx as Tt,r as l,j as s,b as R,B as S,F as Z,aC as Nt,ao as Et,by as kt,bz as wt,C as Rt}from"./index-CwJt2ZPU.js";import{D as V}from"./DisplayValue-CZpYmpLD.js";import{r as _e,a as $t}from"./_createCompounder-CG6wppeM.js";import{r as At,a as Ft}from"./capitalize-fmjr8MXW.js";var P,ce;function It(){if(ce)return P;ce=1;var e=At(),a=_e(),r=a(function(t,o,n){return o=o.toLowerCase(),t+(n?e(o):o)});return P=r,P}var Bt=It();const qt=J(Bt);var z,le;function Gt(){if(le)return z;le=1;var e=_e(),a=Ft(),r=e(function(t,o,n){return t+(n?" ":"")+a(o)});return z=r,z}var Mt=Gt();const Ot=J(Mt),Vt={battery_low:[$,{className:"text-error"}],humidity:[dt,{}],illuminance:[L,{}],pressure:[pt,{}],co2:[ht,{className:"text-warning"}],voltage:[xt,{}],state:[ft,{}],brightness:[L,{}],occupancy:[mt,{}],presence:[ut,{}],current:[it,{}],power:[lt,{}],energy:[ct,{}],frequency:[ot,{}],tamper:[st,{className:"text-error"}],smoke:[nt,{className:"text-error"}],radiation_dose_per_hour:[rt,{className:"text-error"}],radioactive_events_per_minute:[at,{className:"text-warning"}],power_factor:[tt,{}],mode:[et,{}],sound:[Je,{}],position:[Ze,{}],alarm:[Qe,{className:"text-error"}],color_xy:[se,{}],color_hs:[se,{}],color_temp:[ne,{}],color_temp_startup:[ne,{className:"opacity-70"}],illuminance_lux:[L,{}],soil_moisture:[Ke,{}],water_leak:[ae,{}],week:[Ye,{}],workdays_schedule:[re,{}],holidays_schedule:[re,{}],away_mode:[Xe,{}],vibration:[ae,{rotate:270}],power_outage_count:[De,{}],action:[We,{}],angle_x:[Ue,{}],angle_y:[ze,{}],angle_z:[Pe,{}],side:[Le,{}],humidity_alarm:[te,{}],temperature_alarm:[te,{}],approach_distance:[ee,{}],distance:[ee,{}],trigger_count:[He,{flip:"horizontal"}],level_config:[Ve,{}],station:[Oe,{}],effect:[Me,{}],linkquality:[Ge,{}],system_mode:[qe,{}],gradient:[Be,{}],sensitivity:[Ie,{}],test:[Fe,{className:"text-success"}]},Ht=(e,a)=>{let r=$;return e==null||(e>=85?(r=ge,a.push("text-success")):e>=65?r=jt:e>=40?r=be:e>=20?r=vt:(r=$,a.push("text-error"))),r},Lt=(e,a)=>{let r=$;switch(e){case"high":{r=ge,a.push("text-success");break}case"medium":{r=be;break}case"low":{r=$,a.push("text-error");break}}return r},Pt=(e,a,r)=>{let t=oe;return e==null||(a==="°F"&&(e=(e-32)/1.8),e>=30?(t=bt,r.push("text-error")):e>=25?t=_t:e>=20?t=yt:e>=15?t=Ct:e<5&&(t=oe,r.push("text-info"))),t},zt=(e,a,r)=>{let t;const o=[],n={};switch(e){case"battery":{t=Ht(a,o);break}case"battery_state":{t=Lt(a,o);break}case"device_temperature":case"temperature":case"local_temperature":{t=Pt(a,r,o);break}case"humidity":{a!=null&&a>60&&o.push("text-info");break}case"contact":{t=a?St:Tt,a||(o.push("text-primary"),n.flip=!0);break}case"occupancy":{a&&(o.push("text-warning"),n.beat=!0);break}case"presence":{a&&(o.push("text-warning"),n.beat=!0);break}case"tamper":{a&&(n.beatFade=!0,n.shake=!0);break}case"water_leak":{a&&(o.push("text-primary"),n.beatFade=!0);break}case"vibration":{a&&(o.push("text-primary"),n.shake=!0);break}}if(t)return[t,o.join(" "),n];const m=Vt[e]??[void 0,{}];t=m[0];const c=m[1];return c.className&&o.push(c.className),t?[t,o.join(" "),{flip:c.flip,rotate:c.rotate,...n}]:[gt,"opacity-0",{}]},Ut=e=>`${e.type}-${e.name}-${e.label}-${e.property}-${e.access}-${e.category}-${e.endpoint}`;var y=(e=>(e[e.STATE=1]="STATE",e[e.SET=2]="SET",e[e.GET=4]="GET",e[e.STATE_SET=3]="STATE_SET",e[e.STATE_GET=5]="STATE_GET",e[e.ALL=7]="ALL",e))(y||{});const A=l.memo(({feature:e,deviceValue:a})=>s.jsxs("div",{children:[e.property&&s.jsx("span",{className:"font-bold",children:s.jsx(V,{value:a,name:e.name})}),"unit"in e&&s.jsx("span",{className:"text-xs ms-1",children:e.unit})]})),F=l.memo(e=>s.jsxs("div",{className:"alert alert-warning",role:"alert",children:["Unknown access ",s.jsx("pre",{children:e.feature.access})]})),Wt=l.memo(e=>{const{feature:{access:a=y.SET,name:r,property:t,value_off:o,value_on:n},deviceValue:m,onChange:c,minimal:x}=e,{t:i}=R("zigbee"),h=l.useCallback(f=>c({[t]:f}),[t,c]),u=l.useCallback(f=>c({[t]:f.target.checked?n:o}),[n,o,t,c]);if(a&y.SET){const f=m!=null,p=!x||x&&!f;return s.jsxs("div",{children:[p&&s.jsx(S,{className:"btn btn-link",item:o,onClick:h,children:s.jsx(V,{value:o,name:r})}),f?s.jsx("input",{className:"toggle",type:"checkbox",checked:m===n,onChange:u}):s.jsx(Z,{icon:Nt,title:i("unknown")}),p&&s.jsx(S,{className:"btn btn-link",item:n,onClick:h,children:s.jsx(V,{value:n,name:r})})]})}return a&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),k=l.memo(e=>{const{feature:a,onChange:r,parentFeatures:t,onRead:o,device:n,deviceState:m,featureWrapperClass:c,minimal:x,steps:i}=e,{type:h,property:u}=a,[f,p]=l.useState({}),{t:b}=R(["composite","common"]),v=l.useMemo(()=>Et({},m,f),[m,f]),C="features"in a&&a.features||[],j=l.useMemo(()=>{if(h==="composite"&&t!==void 0){if(t.length===1)return!0;if(t.length===2){const g=t[1].type;return g!=null&&g!=="composite"&&g!=="list"}}return!1},[h,t]);l.useEffect(()=>{p({})},[n.ieee_address]);const d=l.useCallback(g=>{p({...f,...g}),j||r(h==="composite"&&u?{[u]:{...f,...g}}:g)},[f,h,u,j,r]),_=l.useCallback(()=>{const g={...m,...f};r(u?{[u]:g}:g)},[u,r,f,m]),E=l.useCallback(g=>{h==="composite"?o==null||o(u?{[u]:g}:g):o==null||o(g)},[o,h,u]);return s.jsxs(s.Fragment,{children:[C.map(g=>s.jsx($e,{feature:g,parentFeatures:t??[],device:n,deviceState:v,onChange:d,onRead:E,featureWrapperClass:c,minimal:x,steps:i==null?void 0:i[g.name]},Ut(g))),j&&s.jsx("div",{children:s.jsx(S,{className:`btn btn-primary ${x?" btn-sm":""}`,onClick:_,children:b("common:apply")})})]})}),Dt=l.memo(e=>s.jsx(k,{...e}));var U,ie;function Xt(){if(ie)return U;ie=1;function e(a,r,t){return a===a&&(t!==void 0&&(a=a<=t?a:t),r!==void 0&&(a=a>=r?a:r)),a}return U=e,U}var W,ue;function Yt(){if(ue)return W;ue=1;var e=/\s/;function a(r){for(var t=r.length;t--&&e.test(r.charAt(t)););return t}return W=a,W}var D,me;function Kt(){if(me)return D;me=1;var e=Yt(),a=/^\s+/;function r(t){return t&&t.slice(0,e(t)+1).replace(a,"")}return D=r,D}var X,fe;function Qt(){if(fe)return X;fe=1;var e=Kt(),a=kt(),r=$t(),t=NaN,o=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,m=/^0o[0-7]+$/i,c=parseInt;function x(i){if(typeof i=="number")return i;if(r(i))return t;if(a(i)){var h=typeof i.valueOf=="function"?i.valueOf():i;i=a(h)?h+"":h}if(typeof i!="string")return i===0?i:+i;i=e(i);var u=n.test(i);return u||m.test(i)?c(i.slice(2),u?2:8):o.test(i)?t:+i}return X=x,X}var Y,xe;function Zt(){if(xe)return Y;xe=1;var e=Xt(),a=Qt();function r(t,o,n){return n===void 0&&(n=o,o=void 0),n!==void 0&&(n=a(n),n=n===n?n:0),o!==void 0&&(o=a(o),o=o===o?o:0),e(a(t),o,n)}return Y=r,Y}var Jt=Zt();const N=J(Jt),ea=[.412453,.35758,.180423,.212671,.71516,.072169,.019334,.119193,.950227],ta=[3.2404813432005266,-1.5371515162713183,-.49853632616888777,-.9692549499965684,1.8759900014898907,.041555926558292815,.05564663913517715,-.20404133836651123,1.0573110696453443],ye=.42,Ce=.0031308,je=12.92,H=.055,M=e=>e<=Ce?je*e:(1+H)*e**ye-H,aa=1/ye,ra=M(Ce),na=1/je,K=e=>e<=ra?e*na:((e+H)/(1+H))**aa,ve=(e,a)=>{const r=[0,0,0];for(let t=0;t<3;t++){r[t]=0;for(let o=0;o<3;o++)r[t]+=a[t*3+o]*e[o]}return r},he=(e,a,r)=>{const t=[K(e),K(a),K(r)];return ve(t,ea)},sa=(e,a,r)=>{const t=ve([e,a,r],ta);return[M(t[0]),M(t[1]),M(t[2])]},Se=(e,a,r)=>{const t=1-e-a;return sa(r/a*e,r,r/a*t)},Te=(e,a,r=10)=>{let t=1;for(let o=0;o<r;o++){const n=Math.max(...Se(e,a,t));t=t/n}return t},I=(e,a,r)=>{if(e/=255,a/=255,r/=255,e<1e-12&&a<1e-12&&r<1e-12){const[c,x,i]=he(1,1,1),h=c+x+i;return[c/h,x/h,0]}const[t,o,n]=he(e,a,r),m=t+o+n;return[t/m,o/m,o]},oa=(e,a,r)=>{r===void 0&&(r=Te(e,a));const[t,o,n]=Se(e,a,r);return[N(t*255,0,255),N(o*255,0,255),N(n*255,0,255)]},B=(e,a,r)=>{e/=255,a/=255,r/=255;const t=Math.max(e,a,r),o=t-Math.min(e,a,r),n=o?(t===e?(a-r)/o+(a<r?6:0):t===a?2+(r-e)/o:4+(e-a)/o)*60:0,m=t?o/t*100:0,c=t*100;return[N(n,0,360),N(m,0,100),N(c,0,100)]},ca=(e,a,r)=>{a/=100,r/=100;const t=~~(e/60),o=e/60-t,n=r*(1-a),m=r*(1-a*o),c=r*(1-a*(1-o)),x=t%6,i=[r,m,n,n,c,r][x]*255,h=[c,r,r,m,n,n][x]*255,u=[n,n,c,r,r,m][x]*255;return[N(i,0,255),N(h,0,255),N(u,0,255)]},q=(e,a,r)=>{const[t,o,n]=[e,a,r].map(m=>Math.round(m).toString(16).padStart(2,"0"));return`#${t}${o}${n}`},la=e=>(e=e.slice(1),Array.from({length:3}).map((a,r)=>Number.parseInt(e.slice(r*2,r*2+2),16))),w=(e,a)=>{switch(a){case"color_xy":{const{x:r=.313,y:t=.329,Y:o=Te(r,t===0?.329:t)}=e,n=t===0?[255,255,255]:oa(r,t,o);return{color_rgb:n,color_hs:B(...n),color_xy:[r,t,o],hex:q(...n)}}case"color_hs":{const{hue:r=0,saturation:t=0}=e,o=100,n=ca(r,t,o);return{color_rgb:n,color_hs:[r,t,o],color_xy:I(...n),hex:q(...n)}}case"color_rgb":{const{r=255,g:t=255,b:o=255}=e;return{color_rgb:[r,t,o],color_hs:B(r,t,o),color_xy:I(r,t,o),hex:q(r,t,o)}}case"hex":{const r=e,t=la(r);return{color_rgb:t,color_hs:B(...t),color_xy:I(...t),hex:r}}default:{const r=[255,255,255];return{color_rgb:r,color_hs:B(...r),color_xy:I(...r),hex:q(...r)}}}},pe=(e,a)=>{switch(a){case"color_xy":return{x:e.color_xy[0],y:e.color_xy[1]};case"color_hs":return{hue:e.color_hs[0],saturation:e.color_hs[1]};case"color_rgb":return{r:e.color_rgb[0],g:e.color_rgb[1],b:e.color_rgb[2]};case"hex":return e.hex}},Ne=e=>`${e[0].toFixed(3)}, ${e[1].toFixed(3)}, ${e[2].toFixed(3)}`,O=e=>`${e[0].toFixed(2)}°, ${e[1].toFixed(2)}%, ${e[2].toFixed(2)}%`,Ee=e=>`${e[0].toFixed(0)}, ${e[1].toFixed(0)}, ${e[2].toFixed(0)}`,ke=e=>e,de=e=>({color_xy:Ne(e.color_xy),color_hs:O(e.color_hs),color_rgb:Ee(e.color_rgb),hex:ke(e.hex)}),ia=e=>{const a=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((r,t)=>+(a[t]??0))},ua=e=>{const a=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((r,t)=>N(+(a[t]??0),0,t?100:360))},ma=e=>{const a=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((r,t)=>N(+(a[t]??0),0,255))},Q=(e,a)=>{switch(a){case"color_xy":{const r=ia(e);return w({x:r[0],y:r[1]},"color_xy")}case"color_hs":{const r=ua(e);return w({hue:r[0],saturation:r[1]},"color_hs")}case"color_rgb":{const r=ma(e);return w({r:r[0],g:r[1],b:r[2]},"color_rgb")}case"hex":return w(e,"hex")}},fa="linear-gradient(to right, white, transparent)",xa="linear-gradient(to right, rgb(255, 0, 0), rgb(255, 255, 0), rgb(0, 255, 0), rgb(0, 255, 255), rgb(0, 0, 255), rgb(255, 0, 255), rgb(255, 0, 0))",G=l.memo(({label:e,...a})=>s.jsxs("label",{className:"input",children:[e,s.jsx("input",{type:"text",className:"grow",...a})]})),we=l.memo(e=>{const{onChange:a,value:r={},format:t,minimal:o}=e,[n,m]=l.useState(w(r,t)),[c,x]=l.useState(de(n)),[i,h]=l.useState({color_rgb:!1,color_hs:!1,color_xy:!1,hex:!1});l.useEffect(()=>{const d=w(r,t);m(d),x(de(d))},[r,t]),l.useEffect(()=>{if(!i.color_xy){const d=Ne(n.color_xy);x(_=>({..._,color_xy:d}))}},[i.color_xy,n.color_xy]),l.useEffect(()=>{if(!i.color_hs){const d=O(n.color_hs);x(_=>({..._,color_hs:d}))}},[i.color_hs,n.color_hs]),l.useEffect(()=>{if(!i.color_rgb){const d=Ee(n.color_rgb);x(_=>({..._,color_rgb:d}))}},[i.color_rgb,n.color_rgb]),l.useEffect(()=>{if(!i.hex){const d=ke(n.hex);x(_=>({..._,hex:d}))}},[i.hex,n.hex]);const u=l.useCallback(d=>{if(d.target.value){const _=Array.from(n.color_hs);_[1]=d.target.valueAsNumber;const E=O(_);x(g=>({...g,color_hs:E})),m(Q(E,"color_hs"))}},[n.color_hs]),f=l.useCallback(d=>{if(d.target.value){const _=Array.from(n.color_hs),E=_[1];_[1]=E===0?100:E,_[0]=d.target.valueAsNumber;const g=O(_);x(Ae=>({...Ae,color_hs:g})),m(Q(g,"color_hs"))}},[n.color_hs]),p=l.useCallback(d=>{const{value:_,name:E}=d.target;x(g=>({...g,[E]:_})),m(Q(_,E))},[]),b=l.useCallback(d=>{h(_=>({..._,[d.target.name]:!0}))},[]),v=l.useCallback(d=>{h(_=>({..._,[d.target.name]:!1})),a(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,a]),C=l.useCallback(()=>{a(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,a]),j=l.useMemo(()=>`hsl(${n.color_hs[0]}, 100%, 50%)`,[n.color_hs[0]]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:100,value:n.color_hs[1],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:fa,backgroundColor:j},onChange:u,onTouchEnd:C,onMouseUp:C})})}),s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:360,value:n.color_hs[0],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:xa},onChange:f,onTouchEnd:C,onMouseUp:C})})}),!o&&s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 justify-around",children:[s.jsx(G,{label:"hex",name:"hex",value:c.hex,onChange:p,onFocus:b,onBlur:v}),s.jsx(G,{label:"rgb",name:"color_rgb",value:c.color_rgb,onChange:p,onFocus:b,onBlur:v}),s.jsx(G,{label:"hsv",name:"color_hs",value:c.color_hs,onChange:p,onFocus:b,onBlur:v}),s.jsx(G,{label:"xyY",name:"color_xy",value:c.color_xy,onChange:p,onFocus:b,onBlur:v})]})]})}),ha=l.memo(e=>{const{deviceValue:a,feature:r,onChange:t,minimal:o}=e,n=l.useMemo(()=>{const c={};for(const x of r.features)c[x.name]=(a==null?void 0:a[x.property])??0;return c},[a,r]),m=l.useCallback(c=>t({color:c}),[t]);return s.jsx(we,{onChange:m,value:n,format:r.name,minimal:o})}),pa={position:[0,25,50,75,100].map(e=>({value:e,name:`${e}`})),tilt:[0,25,50,75,100].map(e=>({value:e,name:`${e}`}))},da=l.memo(e=>s.jsx(k,{...e,steps:pa}));function T(e){return typeof e!="object"}const Re=l.memo(e=>{const{onChange:a,values:r,value:t,minimal:o}=e,{t:n}=R("common"),m=l.useCallback(c=>{const x=r.find(i=>T(i)?i===c.target.value:i.value===Number.parseInt(c.target.value,10));a(x)},[r,a]);return o?s.jsxs("select",{className:"select",onChange:m,value:T(t)?t:t==null?void 0:t.value,children:[s.jsx("option",{value:"",disabled:!0,children:n("select_value")}),r.map(c=>s.jsx("option",{value:T(c)?c:c.value,children:T(c)?c:c.name},T(c)?c:c.name))]}):s.jsx("div",{className:"join join-vertical lg:join-horizontal",children:r.map(c=>s.jsx(S,{className:`btn btn-soft btn-sm join-item${(T(c)?c===t:c.value===(T(t)?t:t==null?void 0:t.value))?" btn-active":""}`,onClick:x=>a(x),item:T(c)?c:c.value,title:T(c)?`${c}`:c.description,children:T(c)?s.jsx(V,{value:c,name:""}):c.name},T(c)?c:c.name))})}),ga=6,ba=l.memo(e=>{const{onChange:a,feature:{access:r=y.SET,values:t,property:o},deviceValue:n,minimal:m}=e;return r&y.SET?s.jsx(Re,{onChange:c=>a({[o]:c}),values:t,value:n||"",minimal:m||t.length>ga}):r&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),_a=l.memo(e=>s.jsx(k,{...e})),ya=l.memo(e=>{const{minimal:a,onChange:r,feature:{length_min:t,length_max:o},deviceValue:n}=e,{t:m}=R(["gradient","common"]),[c,x]=l.useState(t>0?Array(t).fill("#ffffff"):[]);l.useEffect(()=>{n&&Array.isArray(n)&&n.length>0&&x(n)},[n]);const i=l.useCallback((C,j)=>{const d=Array.from(c);d[C]=j,x(d)},[c]),h=l.useCallback(()=>{const C=Array.from(c);C.push("#ffffff"),x(C)},[c]),u=l.useCallback(C=>{const j=Array.from(c);j.splice(C,1),x(j)},[c]),[f,p]=l.useState(!1),[b,v]=l.useState(!1);return l.useEffect(()=>{p(c.length<o),v(c.length>t)},[c,t,o]),s.jsxs("div",{className:"flex flex-col gap-2",children:[c.map((C,j)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 items-center",children:[s.jsx(we,{onChange:d=>{i(j,d.hex)},value:C,format:"hex"}),b&&s.jsx(S,{className:"btn btn-error",onClick:()=>u(j),children:"-"})]},`${C}-${j}`)),f&&s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(S,{className:"btn btn-success",onClick:h,children:"+"})}),s.jsx("div",{children:s.jsx(S,{className:`btn btn-primary ${a?" btn-sm":""}`,onClick:()=>r({gradient:c}),children:m("common:apply")})})]})}),Ca={brightness:[0,25,50,75,100].map(e=>({value:wt(e,[0,100],[0,255]),name:`${e}%`})),color_temp:[1e3,2e3,3e3,4e3,5e3,6500].map(e=>({value:1e6/e,name:`${e}K`}))},ja=l.memo(e=>s.jsx(k,{...e,steps:Ca}));function va(e){return e.type==="composite"&&(e.name==="color_xy"||e.name==="color_hs")}const Sa=l.memo(e=>{var p;const{t:a}=R(["featureDescriptions","featureNames","zigbee"]),{children:r,feature:t,deviceValue:o,onRead:n}=e,m=t.unit,c=l.useMemo(()=>zt(t.name,o,m),[m,t.name,o]),x=l.useMemo(()=>t.property&&t.access&y.GET||va(t),[t]),i=(p=e.parentFeatures)==null?void 0:p[e.parentFeatures.length-1],h=t.name==="state"?t.property:t.name;let u=t.label||a(`featureNames:${h}`,{defaultValue:Ot(qt(h))});i!=null&&i.label&&t.name==="state"&&i.type!=="light"&&i.type!=="switch"&&(u=`${i.label} ${t.label.charAt(0).toLowerCase()}${t.label.slice(1)}`);const f=l.useCallback(b=>{b.property&&(n==null||n({[b.property]:""}))},[n]);return s.jsxs("div",{className:"list-row",children:[s.jsx("div",{children:s.jsx(Z,{icon:c[0],fixedWidth:!0,className:c[1],...c[2],size:"2xl"})}),s.jsxs("div",{children:[s.jsxs("div",{children:[u,t.endpoint?` (${a("zigbee:endpoint")}: ${t.endpoint})`:""]}),s.jsx("div",{className:"text-xs font-semibold opacity-60",children:t.description&&a(t.description)})]}),s.jsx("div",{className:"list-col-wrap flex flex-col gap-2",children:r}),x&&s.jsx(S,{item:t,onClick:f,className:"btn btn-xs btn-square btn-primary",children:s.jsx(Z,{icon:Rt})})]})}),Ta=l.memo(e=>{const{onChange:a,value:r,feature:t,parentFeatures:o}=e,[n,m]=l.useState(r);l.useEffect(()=>{m(r)},[r]);const c=l.useCallback(u=>{m(u),a(u)},[a]),x=l.useCallback((u,f)=>{const p=Array.from(n);typeof u=="object"&&(u={...n[f],...u}),p[f]=u,c(p)},[n,c]),i=l.useCallback(u=>{const f=Array.from(n);f.splice(u,1),c(f)},[n,c]),h=l.useCallback(()=>m([...n,{}]),[n]);return n.length===0?s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(S,{className:"btn btn-success col-1",onClick:h,children:"+"})}):s.jsx(s.Fragment,{children:n.map((u,f)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[s.jsx($e,{feature:t,device:{},deviceState:u,onChange:p=>x(p,f),onRead:p=>{},featureWrapperClass:Sa,parentFeatures:o}),s.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[s.jsx(S,{item:f,className:"btn btn-error btn-square join-item",onClick:i,children:"-"}),n.length-1===f&&s.jsx(S,{className:"btn btn-success btn-square join-item",onClick:h,children:"+"})]})]},f))})}),Na=l.memo(e=>{const{feature:a,minimal:r,parentFeatures:t,onChange:o,deviceValue:n}=e,[m,c]=l.useState({value:a.property?(n==null?void 0:n[a.property])??[]:[]}),{t:x}=R(["list","common"]),i=l.useMemo(()=>{if(t!==void 0){if(t.length===1)return!0;if(t.length===2){const b=t[1].type;return b!=null&&b!=="composite"&&b!=="list"}}return!1},[t]),h=l.useCallback(b=>{c({value:b}),i||o(a.property?{[a.property]:b}:b)},[a.property,o,i]),u=l.useCallback(()=>{o(a.property?{[a.property]:m.value}:m.value)},[a.property,o,m.value]),{access:f=y.SET,item_type:p}=a;return f&y.SET?s.jsxs(s.Fragment,{children:[s.jsx(Ta,{feature:p,parentFeatures:[...t,a],onChange:h,value:m.value}),i&&s.jsx("div",{children:s.jsx(S,{className:`btn btn-primary ${r?" btn-sm":""}`,onClick:u,disabled:m.value.length===0,children:x("common:apply")})})]}):f&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),Ea=l.memo(e=>s.jsx(k,{...e})),ka=l.memo(e=>{const{onChange:a,value:r,valueStep:t,min:o,max:n,unit:m,steps:c,minimal:x,...i}=e,[h,u]=l.useState(r),f=o!=null&&n!=null;l.useEffect(()=>{u(r)},[r]);const p=l.useCallback(v=>!!v.target.value&&u(v.target.valueAsNumber),[]),b=l.useCallback(v=>!v.target.validationMessage&&a(h),[h,a]);return s.jsxs("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:[!x&&c?s.jsx(Re,{values:c,onChange:a,value:h}):null,f?s.jsxs("div",{className:"w-full max-w-xs",children:[s.jsx("input",{min:o,max:n,step:t,type:"range",className:"range range-xs range-primary validator",value:h,onChange:p,onTouchEnd:b,onMouseUp:b,...i}),s.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[s.jsx("span",{children:"|"}),s.jsx("span",{children:"|"})]}),s.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[s.jsx("span",{children:o}),s.jsx("span",{children:n})]})]}):null,(!x||!f)&&s.jsxs("label",{className:"input",children:[m,s.jsx("input",{type:"number",className:"grow validator",value:h,step:t,onChange:p,onBlur:b,min:o,max:n,...i})]})]})}),wa=l.memo(e=>{const{feature:{presets:a,access:r=y.SET,property:t,unit:o,value_max:n,value_min:m,value_step:c},deviceValue:x,steps:i,onChange:h,minimal:u}=e;return r&y.SET?s.jsx(ka,{onChange:f=>h({[t]:f}),value:x??"",min:m,max:n,step:c,steps:a!=null&&a.length?a:i,unit:o,minimal:u}):r&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),Ra=l.memo(e=>s.jsx(k,{...e})),$a=l.memo(e=>{const{onChange:a,value:r,...t}=e,[o,n]=l.useState(r);return l.useEffect(()=>{n(r)},[r]),s.jsx("input",{type:"text",className:"input validator",value:o,onChange:m=>n(m.target.value),onBlur:m=>!m.target.validationMessage&&a(o),...t})}),Aa=l.memo(e=>{const{feature:{access:a=y.SET,property:r},deviceValue:t,onChange:o}=e;return a&y.SET?s.jsx($a,{onChange:n=>o({[r]:n}),value:t??""}):a&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),Fa=e=>`${e.type}-${e.name}-${e.label}-${e.access}-${e.category}-${e.property}-${e.endpoint}`,$e=l.memo(e=>{const{feature:a,device:r,deviceState:t,steps:o,onRead:n,onChange:m,featureWrapperClass:c,minimal:x,parentFeatures:i}=e,h=l.useMemo(()=>a.property?t[a.property]:void 0,[a.property,t[a.property]]),u=l.useMemo(()=>Fa(a),[a]),f=l.useMemo(()=>({device:r,deviceValue:h,onChange:m,onRead:n,featureWrapperClass:c,minimal:x,parentFeatures:i}),[r,h,m,n,c,x,i]),p=l.useMemo(()=>({feature:a,onRead:n,deviceValue:h,parentFeatures:i}),[a,n,h,i]);switch(a.type){case"binary":return s.jsx(c,{...p,children:s.jsx(Wt,{feature:a,...f},u)},u);case"numeric":return s.jsx(c,{...p,children:s.jsx(wa,{feature:a,...f,steps:o},u)},u);case"list":return a.name==="gradient"&&a.length_min!=null&&a.length_max!=null?s.jsx(c,{...p,children:s.jsx(ya,{feature:a,...f},u)},u):s.jsx(c,{...p,children:s.jsx(Na,{feature:a,...f},u)},u);case"text":return s.jsx(c,{...p,children:s.jsx(Aa,{feature:a,...f},u)},u);case"enum":return s.jsx(c,{...p,children:s.jsx(ba,{feature:a,...f},u)},u);case"light":return s.jsx(ja,{feature:a,...f,deviceState:t},u);case"switch":return s.jsx(Ra,{feature:a,...f,deviceState:t},u);case"cover":return s.jsx(da,{feature:a,...f,deviceState:t},u);case"lock":return s.jsx(Ea,{feature:a,...f,deviceState:t},u);case"climate":return s.jsx(Dt,{feature:a,...f,deviceState:t},u);case"fan":return s.jsx(_a,{feature:a,...f,deviceState:t},u);case"composite":{if(a.name==="color_xy"||a.name==="color_hs")return s.jsx(c,{...p,children:s.jsx(ha,{feature:a,...f},u)},u);const b=i&&a.property?t[a.property]:t;return s.jsx(k,{feature:a,...f,deviceState:b},u)}default:return console.error("Unsupported feature",a),s.jsx(c,{...p,children:s.jsx("pre",{children:JSON.stringify(a,null,4)})},u)}});export{$e as F,Sa as a,y as b,zt as c,qt as d,Ut as g,Ot as s};
1
+ import{ac as J,aG as Fe,aH as Ie,aI as Be,m as qe,aJ as Ge,aK as Me,aL as Oe,aM as Ve,aN as He,aO as ee,aP as te,aQ as Le,aR as Pe,aS as ze,aT as Ue,aU as We,aV as De,aW as ae,aX as Xe,aY as re,aZ as Ye,a_ as Ke,a$ as L,b0 as ne,b1 as se,V as Qe,b2 as Ze,b3 as Je,b4 as et,b5 as tt,b6 as at,b7 as rt,b8 as nt,b9 as st,ba as ot,bb as ct,bc as lt,bd as it,be as ut,bf as mt,bg as ft,bh as xt,bi as ht,bj as pt,bk as dt,bl as $,bm as gt,bn as oe,bo as bt,bp as _t,bq as yt,br as Ct,bs as ge,bt as jt,bu as be,bv as vt,bw as St,bx as Tt,r as l,j as s,b as R,B as S,F as Z,aC as Nt,ao as Et,by as kt,bz as wt,C as Rt}from"./index-vDL8KyrI.js";import{D as V}from"./DisplayValue-CvjefE6V.js";import{r as _e,a as $t}from"./_createCompounder-Bmfmbzn9.js";import{r as At,a as Ft}from"./capitalize-Cw1mPDhM.js";var P,ce;function It(){if(ce)return P;ce=1;var e=At(),a=_e(),r=a(function(t,o,n){return o=o.toLowerCase(),t+(n?e(o):o)});return P=r,P}var Bt=It();const qt=J(Bt);var z,le;function Gt(){if(le)return z;le=1;var e=_e(),a=Ft(),r=e(function(t,o,n){return t+(n?" ":"")+a(o)});return z=r,z}var Mt=Gt();const Ot=J(Mt),Vt={battery_low:[$,{className:"text-error"}],humidity:[dt,{}],illuminance:[L,{}],pressure:[pt,{}],co2:[ht,{className:"text-warning"}],voltage:[xt,{}],state:[ft,{}],brightness:[L,{}],occupancy:[mt,{}],presence:[ut,{}],current:[it,{}],power:[lt,{}],energy:[ct,{}],frequency:[ot,{}],tamper:[st,{className:"text-error"}],smoke:[nt,{className:"text-error"}],radiation_dose_per_hour:[rt,{className:"text-error"}],radioactive_events_per_minute:[at,{className:"text-warning"}],power_factor:[tt,{}],mode:[et,{}],sound:[Je,{}],position:[Ze,{}],alarm:[Qe,{className:"text-error"}],color_xy:[se,{}],color_hs:[se,{}],color_temp:[ne,{}],color_temp_startup:[ne,{className:"opacity-70"}],illuminance_lux:[L,{}],soil_moisture:[Ke,{}],water_leak:[ae,{}],week:[Ye,{}],workdays_schedule:[re,{}],holidays_schedule:[re,{}],away_mode:[Xe,{}],vibration:[ae,{rotate:270}],power_outage_count:[De,{}],action:[We,{}],angle_x:[Ue,{}],angle_y:[ze,{}],angle_z:[Pe,{}],side:[Le,{}],humidity_alarm:[te,{}],temperature_alarm:[te,{}],approach_distance:[ee,{}],distance:[ee,{}],trigger_count:[He,{flip:"horizontal"}],level_config:[Ve,{}],station:[Oe,{}],effect:[Me,{}],linkquality:[Ge,{}],system_mode:[qe,{}],gradient:[Be,{}],sensitivity:[Ie,{}],test:[Fe,{className:"text-success"}]},Ht=(e,a)=>{let r=$;return e==null||(e>=85?(r=ge,a.push("text-success")):e>=65?r=jt:e>=40?r=be:e>=20?r=vt:(r=$,a.push("text-error"))),r},Lt=(e,a)=>{let r=$;switch(e){case"high":{r=ge,a.push("text-success");break}case"medium":{r=be;break}case"low":{r=$,a.push("text-error");break}}return r},Pt=(e,a,r)=>{let t=oe;return e==null||(a==="°F"&&(e=(e-32)/1.8),e>=30?(t=bt,r.push("text-error")):e>=25?t=_t:e>=20?t=yt:e>=15?t=Ct:e<5&&(t=oe,r.push("text-info"))),t},zt=(e,a,r)=>{let t;const o=[],n={};switch(e){case"battery":{t=Ht(a,o);break}case"battery_state":{t=Lt(a,o);break}case"device_temperature":case"temperature":case"local_temperature":{t=Pt(a,r,o);break}case"humidity":{a!=null&&a>60&&o.push("text-info");break}case"contact":{t=a?St:Tt,a||(o.push("text-primary"),n.flip=!0);break}case"occupancy":{a&&(o.push("text-warning"),n.beat=!0);break}case"presence":{a&&(o.push("text-warning"),n.beat=!0);break}case"tamper":{a&&(n.beatFade=!0,n.shake=!0);break}case"water_leak":{a&&(o.push("text-primary"),n.beatFade=!0);break}case"vibration":{a&&(o.push("text-primary"),n.shake=!0);break}}if(t)return[t,o.join(" "),n];const m=Vt[e]??[void 0,{}];t=m[0];const c=m[1];return c.className&&o.push(c.className),t?[t,o.join(" "),{flip:c.flip,rotate:c.rotate,...n}]:[gt,"opacity-0",{}]},Ut=e=>`${e.type}-${e.name}-${e.label}-${e.property}-${e.access}-${e.category}-${e.endpoint}`;var y=(e=>(e[e.STATE=1]="STATE",e[e.SET=2]="SET",e[e.GET=4]="GET",e[e.STATE_SET=3]="STATE_SET",e[e.STATE_GET=5]="STATE_GET",e[e.ALL=7]="ALL",e))(y||{});const A=l.memo(({feature:e,deviceValue:a})=>s.jsxs("div",{children:[e.property&&s.jsx("span",{className:"font-bold",children:s.jsx(V,{value:a,name:e.name})}),"unit"in e&&s.jsx("span",{className:"text-xs ms-1",children:e.unit})]})),F=l.memo(e=>s.jsxs("div",{className:"alert alert-warning",role:"alert",children:["Unknown access ",s.jsx("pre",{children:e.feature.access})]})),Wt=l.memo(e=>{const{feature:{access:a=y.SET,name:r,property:t,value_off:o,value_on:n},deviceValue:m,onChange:c,minimal:x}=e,{t:i}=R("zigbee"),h=l.useCallback(f=>c({[t]:f}),[t,c]),u=l.useCallback(f=>c({[t]:f.target.checked?n:o}),[n,o,t,c]);if(a&y.SET){const f=m!=null,p=!x||x&&!f;return s.jsxs("div",{children:[p&&s.jsx(S,{className:"btn btn-link",item:o,onClick:h,children:s.jsx(V,{value:o,name:r})}),f?s.jsx("input",{className:"toggle",type:"checkbox",checked:m===n,onChange:u}):s.jsx(Z,{icon:Nt,title:i("unknown")}),p&&s.jsx(S,{className:"btn btn-link",item:n,onClick:h,children:s.jsx(V,{value:n,name:r})})]})}return a&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),k=l.memo(e=>{const{feature:a,onChange:r,parentFeatures:t,onRead:o,device:n,deviceState:m,featureWrapperClass:c,minimal:x,steps:i}=e,{type:h,property:u}=a,[f,p]=l.useState({}),{t:b}=R(["composite","common"]),v=l.useMemo(()=>Et({},m,f),[m,f]),C="features"in a&&a.features||[],j=l.useMemo(()=>{if(h==="composite"&&t!==void 0){if(t.length===1)return!0;if(t.length===2){const g=t[1].type;return g!=null&&g!=="composite"&&g!=="list"}}return!1},[h,t]);l.useEffect(()=>{p({})},[n.ieee_address]);const d=l.useCallback(g=>{p({...f,...g}),j||r(h==="composite"&&u?{[u]:{...f,...g}}:g)},[f,h,u,j,r]),_=l.useCallback(()=>{const g={...m,...f};r(u?{[u]:g}:g)},[u,r,f,m]),E=l.useCallback(g=>{h==="composite"?o==null||o(u?{[u]:g}:g):o==null||o(g)},[o,h,u]);return s.jsxs(s.Fragment,{children:[C.map(g=>s.jsx($e,{feature:g,parentFeatures:t??[],device:n,deviceState:v,onChange:d,onRead:E,featureWrapperClass:c,minimal:x,steps:i==null?void 0:i[g.name]},Ut(g))),j&&s.jsx("div",{children:s.jsx(S,{className:`btn btn-primary ${x?" btn-sm":""}`,onClick:_,children:b("common:apply")})})]})}),Dt=l.memo(e=>s.jsx(k,{...e}));var U,ie;function Xt(){if(ie)return U;ie=1;function e(a,r,t){return a===a&&(t!==void 0&&(a=a<=t?a:t),r!==void 0&&(a=a>=r?a:r)),a}return U=e,U}var W,ue;function Yt(){if(ue)return W;ue=1;var e=/\s/;function a(r){for(var t=r.length;t--&&e.test(r.charAt(t)););return t}return W=a,W}var D,me;function Kt(){if(me)return D;me=1;var e=Yt(),a=/^\s+/;function r(t){return t&&t.slice(0,e(t)+1).replace(a,"")}return D=r,D}var X,fe;function Qt(){if(fe)return X;fe=1;var e=Kt(),a=kt(),r=$t(),t=NaN,o=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,m=/^0o[0-7]+$/i,c=parseInt;function x(i){if(typeof i=="number")return i;if(r(i))return t;if(a(i)){var h=typeof i.valueOf=="function"?i.valueOf():i;i=a(h)?h+"":h}if(typeof i!="string")return i===0?i:+i;i=e(i);var u=n.test(i);return u||m.test(i)?c(i.slice(2),u?2:8):o.test(i)?t:+i}return X=x,X}var Y,xe;function Zt(){if(xe)return Y;xe=1;var e=Xt(),a=Qt();function r(t,o,n){return n===void 0&&(n=o,o=void 0),n!==void 0&&(n=a(n),n=n===n?n:0),o!==void 0&&(o=a(o),o=o===o?o:0),e(a(t),o,n)}return Y=r,Y}var Jt=Zt();const N=J(Jt),ea=[.412453,.35758,.180423,.212671,.71516,.072169,.019334,.119193,.950227],ta=[3.2404813432005266,-1.5371515162713183,-.49853632616888777,-.9692549499965684,1.8759900014898907,.041555926558292815,.05564663913517715,-.20404133836651123,1.0573110696453443],ye=.42,Ce=.0031308,je=12.92,H=.055,M=e=>e<=Ce?je*e:(1+H)*e**ye-H,aa=1/ye,ra=M(Ce),na=1/je,K=e=>e<=ra?e*na:((e+H)/(1+H))**aa,ve=(e,a)=>{const r=[0,0,0];for(let t=0;t<3;t++){r[t]=0;for(let o=0;o<3;o++)r[t]+=a[t*3+o]*e[o]}return r},he=(e,a,r)=>{const t=[K(e),K(a),K(r)];return ve(t,ea)},sa=(e,a,r)=>{const t=ve([e,a,r],ta);return[M(t[0]),M(t[1]),M(t[2])]},Se=(e,a,r)=>{const t=1-e-a;return sa(r/a*e,r,r/a*t)},Te=(e,a,r=10)=>{let t=1;for(let o=0;o<r;o++){const n=Math.max(...Se(e,a,t));t=t/n}return t},I=(e,a,r)=>{if(e/=255,a/=255,r/=255,e<1e-12&&a<1e-12&&r<1e-12){const[c,x,i]=he(1,1,1),h=c+x+i;return[c/h,x/h,0]}const[t,o,n]=he(e,a,r),m=t+o+n;return[t/m,o/m,o]},oa=(e,a,r)=>{r===void 0&&(r=Te(e,a));const[t,o,n]=Se(e,a,r);return[N(t*255,0,255),N(o*255,0,255),N(n*255,0,255)]},B=(e,a,r)=>{e/=255,a/=255,r/=255;const t=Math.max(e,a,r),o=t-Math.min(e,a,r),n=o?(t===e?(a-r)/o+(a<r?6:0):t===a?2+(r-e)/o:4+(e-a)/o)*60:0,m=t?o/t*100:0,c=t*100;return[N(n,0,360),N(m,0,100),N(c,0,100)]},ca=(e,a,r)=>{a/=100,r/=100;const t=~~(e/60),o=e/60-t,n=r*(1-a),m=r*(1-a*o),c=r*(1-a*(1-o)),x=t%6,i=[r,m,n,n,c,r][x]*255,h=[c,r,r,m,n,n][x]*255,u=[n,n,c,r,r,m][x]*255;return[N(i,0,255),N(h,0,255),N(u,0,255)]},q=(e,a,r)=>{const[t,o,n]=[e,a,r].map(m=>Math.round(m).toString(16).padStart(2,"0"));return`#${t}${o}${n}`},la=e=>(e=e.slice(1),Array.from({length:3}).map((a,r)=>Number.parseInt(e.slice(r*2,r*2+2),16))),w=(e,a)=>{switch(a){case"color_xy":{const{x:r=.313,y:t=.329,Y:o=Te(r,t===0?.329:t)}=e,n=t===0?[255,255,255]:oa(r,t,o);return{color_rgb:n,color_hs:B(...n),color_xy:[r,t,o],hex:q(...n)}}case"color_hs":{const{hue:r=0,saturation:t=0}=e,o=100,n=ca(r,t,o);return{color_rgb:n,color_hs:[r,t,o],color_xy:I(...n),hex:q(...n)}}case"color_rgb":{const{r=255,g:t=255,b:o=255}=e;return{color_rgb:[r,t,o],color_hs:B(r,t,o),color_xy:I(r,t,o),hex:q(r,t,o)}}case"hex":{const r=e,t=la(r);return{color_rgb:t,color_hs:B(...t),color_xy:I(...t),hex:r}}default:{const r=[255,255,255];return{color_rgb:r,color_hs:B(...r),color_xy:I(...r),hex:q(...r)}}}},pe=(e,a)=>{switch(a){case"color_xy":return{x:e.color_xy[0],y:e.color_xy[1]};case"color_hs":return{hue:e.color_hs[0],saturation:e.color_hs[1]};case"color_rgb":return{r:e.color_rgb[0],g:e.color_rgb[1],b:e.color_rgb[2]};case"hex":return e.hex}},Ne=e=>`${e[0].toFixed(3)}, ${e[1].toFixed(3)}, ${e[2].toFixed(3)}`,O=e=>`${e[0].toFixed(2)}°, ${e[1].toFixed(2)}%, ${e[2].toFixed(2)}%`,Ee=e=>`${e[0].toFixed(0)}, ${e[1].toFixed(0)}, ${e[2].toFixed(0)}`,ke=e=>e,de=e=>({color_xy:Ne(e.color_xy),color_hs:O(e.color_hs),color_rgb:Ee(e.color_rgb),hex:ke(e.hex)}),ia=e=>{const a=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((r,t)=>+(a[t]??0))},ua=e=>{const a=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((r,t)=>N(+(a[t]??0),0,t?100:360))},ma=e=>{const a=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((r,t)=>N(+(a[t]??0),0,255))},Q=(e,a)=>{switch(a){case"color_xy":{const r=ia(e);return w({x:r[0],y:r[1]},"color_xy")}case"color_hs":{const r=ua(e);return w({hue:r[0],saturation:r[1]},"color_hs")}case"color_rgb":{const r=ma(e);return w({r:r[0],g:r[1],b:r[2]},"color_rgb")}case"hex":return w(e,"hex")}},fa="linear-gradient(to right, white, transparent)",xa="linear-gradient(to right, rgb(255, 0, 0), rgb(255, 255, 0), rgb(0, 255, 0), rgb(0, 255, 255), rgb(0, 0, 255), rgb(255, 0, 255), rgb(255, 0, 0))",G=l.memo(({label:e,...a})=>s.jsxs("label",{className:"input",children:[e,s.jsx("input",{type:"text",className:"grow",...a})]})),we=l.memo(e=>{const{onChange:a,value:r={},format:t,minimal:o}=e,[n,m]=l.useState(w(r,t)),[c,x]=l.useState(de(n)),[i,h]=l.useState({color_rgb:!1,color_hs:!1,color_xy:!1,hex:!1});l.useEffect(()=>{const d=w(r,t);m(d),x(de(d))},[r,t]),l.useEffect(()=>{if(!i.color_xy){const d=Ne(n.color_xy);x(_=>({..._,color_xy:d}))}},[i.color_xy,n.color_xy]),l.useEffect(()=>{if(!i.color_hs){const d=O(n.color_hs);x(_=>({..._,color_hs:d}))}},[i.color_hs,n.color_hs]),l.useEffect(()=>{if(!i.color_rgb){const d=Ee(n.color_rgb);x(_=>({..._,color_rgb:d}))}},[i.color_rgb,n.color_rgb]),l.useEffect(()=>{if(!i.hex){const d=ke(n.hex);x(_=>({..._,hex:d}))}},[i.hex,n.hex]);const u=l.useCallback(d=>{if(d.target.value){const _=Array.from(n.color_hs);_[1]=d.target.valueAsNumber;const E=O(_);x(g=>({...g,color_hs:E})),m(Q(E,"color_hs"))}},[n.color_hs]),f=l.useCallback(d=>{if(d.target.value){const _=Array.from(n.color_hs),E=_[1];_[1]=E===0?100:E,_[0]=d.target.valueAsNumber;const g=O(_);x(Ae=>({...Ae,color_hs:g})),m(Q(g,"color_hs"))}},[n.color_hs]),p=l.useCallback(d=>{const{value:_,name:E}=d.target;x(g=>({...g,[E]:_})),m(Q(_,E))},[]),b=l.useCallback(d=>{h(_=>({..._,[d.target.name]:!0}))},[]),v=l.useCallback(d=>{h(_=>({..._,[d.target.name]:!1})),a(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,a]),C=l.useCallback(()=>{a(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,a]),j=l.useMemo(()=>`hsl(${n.color_hs[0]}, 100%, 50%)`,[n.color_hs[0]]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:100,value:n.color_hs[1],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:fa,backgroundColor:j},onChange:u,onTouchEnd:C,onMouseUp:C})})}),s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:360,value:n.color_hs[0],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:xa},onChange:f,onTouchEnd:C,onMouseUp:C})})}),!o&&s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 justify-around",children:[s.jsx(G,{label:"hex",name:"hex",value:c.hex,onChange:p,onFocus:b,onBlur:v}),s.jsx(G,{label:"rgb",name:"color_rgb",value:c.color_rgb,onChange:p,onFocus:b,onBlur:v}),s.jsx(G,{label:"hsv",name:"color_hs",value:c.color_hs,onChange:p,onFocus:b,onBlur:v}),s.jsx(G,{label:"xyY",name:"color_xy",value:c.color_xy,onChange:p,onFocus:b,onBlur:v})]})]})}),ha=l.memo(e=>{const{deviceValue:a,feature:r,onChange:t,minimal:o}=e,n=l.useMemo(()=>{const c={};for(const x of r.features)c[x.name]=(a==null?void 0:a[x.property])??0;return c},[a,r]),m=l.useCallback(c=>t({color:c}),[t]);return s.jsx(we,{onChange:m,value:n,format:r.name,minimal:o})}),pa={position:[0,25,50,75,100].map(e=>({value:e,name:`${e}`})),tilt:[0,25,50,75,100].map(e=>({value:e,name:`${e}`}))},da=l.memo(e=>s.jsx(k,{...e,steps:pa}));function T(e){return typeof e!="object"}const Re=l.memo(e=>{const{onChange:a,values:r,value:t,minimal:o}=e,{t:n}=R("common"),m=l.useCallback(c=>{const x=r.find(i=>T(i)?i===c.target.value:i.value===Number.parseInt(c.target.value,10));a(x)},[r,a]);return o?s.jsxs("select",{className:"select",onChange:m,value:T(t)?t:t==null?void 0:t.value,children:[s.jsx("option",{value:"",disabled:!0,children:n("select_value")}),r.map(c=>s.jsx("option",{value:T(c)?c:c.value,children:T(c)?c:c.name},T(c)?c:c.name))]}):s.jsx("div",{className:"join join-vertical lg:join-horizontal",children:r.map(c=>s.jsx(S,{className:`btn btn-soft btn-sm join-item${(T(c)?c===t:c.value===(T(t)?t:t==null?void 0:t.value))?" btn-active":""}`,onClick:x=>a(x),item:T(c)?c:c.value,title:T(c)?`${c}`:c.description,children:T(c)?s.jsx(V,{value:c,name:""}):c.name},T(c)?c:c.name))})}),ga=6,ba=l.memo(e=>{const{onChange:a,feature:{access:r=y.SET,values:t,property:o},deviceValue:n,minimal:m}=e;return r&y.SET?s.jsx(Re,{onChange:c=>a({[o]:c}),values:t,value:n||"",minimal:m||t.length>ga}):r&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),_a=l.memo(e=>s.jsx(k,{...e})),ya=l.memo(e=>{const{minimal:a,onChange:r,feature:{length_min:t,length_max:o},deviceValue:n}=e,{t:m}=R(["gradient","common"]),[c,x]=l.useState(t>0?Array(t).fill("#ffffff"):[]);l.useEffect(()=>{n&&Array.isArray(n)&&n.length>0&&x(n)},[n]);const i=l.useCallback((C,j)=>{const d=Array.from(c);d[C]=j,x(d)},[c]),h=l.useCallback(()=>{const C=Array.from(c);C.push("#ffffff"),x(C)},[c]),u=l.useCallback(C=>{const j=Array.from(c);j.splice(C,1),x(j)},[c]),[f,p]=l.useState(!1),[b,v]=l.useState(!1);return l.useEffect(()=>{p(c.length<o),v(c.length>t)},[c,t,o]),s.jsxs("div",{className:"flex flex-col gap-2",children:[c.map((C,j)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 items-center",children:[s.jsx(we,{onChange:d=>{i(j,d.hex)},value:C,format:"hex"}),b&&s.jsx(S,{className:"btn btn-error",onClick:()=>u(j),children:"-"})]},`${C}-${j}`)),f&&s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(S,{className:"btn btn-success",onClick:h,children:"+"})}),s.jsx("div",{children:s.jsx(S,{className:`btn btn-primary ${a?" btn-sm":""}`,onClick:()=>r({gradient:c}),children:m("common:apply")})})]})}),Ca={brightness:[0,25,50,75,100].map(e=>({value:wt(e,[0,100],[0,255]),name:`${e}%`})),color_temp:[1e3,2e3,3e3,4e3,5e3,6500].map(e=>({value:1e6/e,name:`${e}K`}))},ja=l.memo(e=>s.jsx(k,{...e,steps:Ca}));function va(e){return e.type==="composite"&&(e.name==="color_xy"||e.name==="color_hs")}const Sa=l.memo(e=>{var p;const{t:a}=R(["featureDescriptions","featureNames","zigbee"]),{children:r,feature:t,deviceValue:o,onRead:n}=e,m=t.unit,c=l.useMemo(()=>zt(t.name,o,m),[m,t.name,o]),x=l.useMemo(()=>t.property&&t.access&y.GET||va(t),[t]),i=(p=e.parentFeatures)==null?void 0:p[e.parentFeatures.length-1],h=t.name==="state"?t.property:t.name;let u=t.label||a(`featureNames:${h}`,{defaultValue:Ot(qt(h))});i!=null&&i.label&&t.name==="state"&&i.type!=="light"&&i.type!=="switch"&&(u=`${i.label} ${t.label.charAt(0).toLowerCase()}${t.label.slice(1)}`);const f=l.useCallback(b=>{b.property&&(n==null||n({[b.property]:""}))},[n]);return s.jsxs("div",{className:"list-row",children:[s.jsx("div",{children:s.jsx(Z,{icon:c[0],fixedWidth:!0,className:c[1],...c[2],size:"2xl"})}),s.jsxs("div",{children:[s.jsxs("div",{children:[u,t.endpoint?` (${a("zigbee:endpoint")}: ${t.endpoint})`:""]}),s.jsx("div",{className:"text-xs font-semibold opacity-60",children:t.description&&a(t.description)})]}),s.jsx("div",{className:"list-col-wrap flex flex-col gap-2",children:r}),x&&s.jsx(S,{item:t,onClick:f,className:"btn btn-xs btn-square btn-primary",children:s.jsx(Z,{icon:Rt})})]})}),Ta=l.memo(e=>{const{onChange:a,value:r,feature:t,parentFeatures:o}=e,[n,m]=l.useState(r);l.useEffect(()=>{m(r)},[r]);const c=l.useCallback(u=>{m(u),a(u)},[a]),x=l.useCallback((u,f)=>{const p=Array.from(n);typeof u=="object"&&(u={...n[f],...u}),p[f]=u,c(p)},[n,c]),i=l.useCallback(u=>{const f=Array.from(n);f.splice(u,1),c(f)},[n,c]),h=l.useCallback(()=>m([...n,{}]),[n]);return n.length===0?s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(S,{className:"btn btn-success col-1",onClick:h,children:"+"})}):s.jsx(s.Fragment,{children:n.map((u,f)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[s.jsx($e,{feature:t,device:{},deviceState:u,onChange:p=>x(p,f),onRead:p=>{},featureWrapperClass:Sa,parentFeatures:o}),s.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[s.jsx(S,{item:f,className:"btn btn-error btn-square join-item",onClick:i,children:"-"}),n.length-1===f&&s.jsx(S,{className:"btn btn-success btn-square join-item",onClick:h,children:"+"})]})]},f))})}),Na=l.memo(e=>{const{feature:a,minimal:r,parentFeatures:t,onChange:o,deviceValue:n}=e,[m,c]=l.useState({value:a.property?(n==null?void 0:n[a.property])??[]:[]}),{t:x}=R(["list","common"]),i=l.useMemo(()=>{if(t!==void 0){if(t.length===1)return!0;if(t.length===2){const b=t[1].type;return b!=null&&b!=="composite"&&b!=="list"}}return!1},[t]),h=l.useCallback(b=>{c({value:b}),i||o(a.property?{[a.property]:b}:b)},[a.property,o,i]),u=l.useCallback(()=>{o(a.property?{[a.property]:m.value}:m.value)},[a.property,o,m.value]),{access:f=y.SET,item_type:p}=a;return f&y.SET?s.jsxs(s.Fragment,{children:[s.jsx(Ta,{feature:p,parentFeatures:[...t,a],onChange:h,value:m.value}),i&&s.jsx("div",{children:s.jsx(S,{className:`btn btn-primary ${r?" btn-sm":""}`,onClick:u,disabled:m.value.length===0,children:x("common:apply")})})]}):f&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),Ea=l.memo(e=>s.jsx(k,{...e})),ka=l.memo(e=>{const{onChange:a,value:r,valueStep:t,min:o,max:n,unit:m,steps:c,minimal:x,...i}=e,[h,u]=l.useState(r),f=o!=null&&n!=null;l.useEffect(()=>{u(r)},[r]);const p=l.useCallback(v=>!!v.target.value&&u(v.target.valueAsNumber),[]),b=l.useCallback(v=>!v.target.validationMessage&&a(h),[h,a]);return s.jsxs("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:[!x&&c?s.jsx(Re,{values:c,onChange:a,value:h}):null,f?s.jsxs("div",{className:"w-full max-w-xs",children:[s.jsx("input",{min:o,max:n,step:t,type:"range",className:"range range-xs range-primary validator",value:h,onChange:p,onTouchEnd:b,onMouseUp:b,...i}),s.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[s.jsx("span",{children:"|"}),s.jsx("span",{children:"|"})]}),s.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[s.jsx("span",{children:o}),s.jsx("span",{children:n})]})]}):null,(!x||!f)&&s.jsxs("label",{className:"input",children:[m,s.jsx("input",{type:"number",className:"grow validator",value:h,step:t,onChange:p,onBlur:b,min:o,max:n,...i})]})]})}),wa=l.memo(e=>{const{feature:{presets:a,access:r=y.SET,property:t,unit:o,value_max:n,value_min:m,value_step:c},deviceValue:x,steps:i,onChange:h,minimal:u}=e;return r&y.SET?s.jsx(ka,{onChange:f=>h({[t]:f}),value:x??"",min:m,max:n,step:c,steps:a!=null&&a.length?a:i,unit:o,minimal:u}):r&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),Ra=l.memo(e=>s.jsx(k,{...e})),$a=l.memo(e=>{const{onChange:a,value:r,...t}=e,[o,n]=l.useState(r);return l.useEffect(()=>{n(r)},[r]),s.jsx("input",{type:"text",className:"input validator",value:o,onChange:m=>n(m.target.value),onBlur:m=>!m.target.validationMessage&&a(o),...t})}),Aa=l.memo(e=>{const{feature:{access:a=y.SET,property:r},deviceValue:t,onChange:o}=e;return a&y.SET?s.jsx($a,{onChange:n=>o({[r]:n}),value:t??""}):a&y.STATE?s.jsx(A,{...e}):s.jsx(F,{...e})}),Fa=e=>`${e.type}-${e.name}-${e.label}-${e.access}-${e.category}-${e.property}-${e.endpoint}`,$e=l.memo(e=>{const{feature:a,device:r,deviceState:t,steps:o,onRead:n,onChange:m,featureWrapperClass:c,minimal:x,parentFeatures:i}=e,h=l.useMemo(()=>a.property?t[a.property]:void 0,[a.property,t[a.property]]),u=l.useMemo(()=>Fa(a),[a]),f=l.useMemo(()=>({device:r,deviceValue:h,onChange:m,onRead:n,featureWrapperClass:c,minimal:x,parentFeatures:i}),[r,h,m,n,c,x,i]),p=l.useMemo(()=>({feature:a,onRead:n,deviceValue:h,parentFeatures:i}),[a,n,h,i]);switch(a.type){case"binary":return s.jsx(c,{...p,children:s.jsx(Wt,{feature:a,...f},u)},u);case"numeric":return s.jsx(c,{...p,children:s.jsx(wa,{feature:a,...f,steps:o},u)},u);case"list":return a.name==="gradient"&&a.length_min!=null&&a.length_max!=null?s.jsx(c,{...p,children:s.jsx(ya,{feature:a,...f},u)},u):s.jsx(c,{...p,children:s.jsx(Na,{feature:a,...f},u)},u);case"text":return s.jsx(c,{...p,children:s.jsx(Aa,{feature:a,...f},u)},u);case"enum":return s.jsx(c,{...p,children:s.jsx(ba,{feature:a,...f},u)},u);case"light":return s.jsx(ja,{feature:a,...f,deviceState:t},u);case"switch":return s.jsx(Ra,{feature:a,...f,deviceState:t},u);case"cover":return s.jsx(da,{feature:a,...f,deviceState:t},u);case"lock":return s.jsx(Ea,{feature:a,...f,deviceState:t},u);case"climate":return s.jsx(Dt,{feature:a,...f,deviceState:t},u);case"fan":return s.jsx(_a,{feature:a,...f,deviceState:t},u);case"composite":{if(a.name==="color_xy"||a.name==="color_hs")return s.jsx(c,{...p,children:s.jsx(ha,{feature:a,...f},u)},u);const b=i&&a.property?t[a.property]:t;return s.jsx(k,{feature:a,...f,deviceState:b},u)}default:return console.error("Unsupported feature",a),s.jsx(c,{...p,children:s.jsx("pre",{children:JSON.stringify(a,null,4)})},u)}});export{$e as F,Sa as a,y as b,zt as c,qt as d,Ut as g,Ot as s};
@@ -1 +1 @@
1
- import{b as x,r,s as g,H as l,bK as m,bL as c,j as e,B as h,bM as b,bN as j,d as f,Q as p,J as N,bO as S,bP as T}from"./index-CwJt2ZPU.js";import{I as d}from"./InputField-C_t5k0Dv.js";import{S as A}from"./SelectField-pi0T7PIM.js";const a=g;function C(){const{t:s}=x(["settings","navbar"]),[n,u]=r.useState(a.get(l,"devices")),[i,v]=r.useState(a.get(m,254)),[o,E]=r.useState(a.get(c,4));r.useEffect(()=>{a.set(l,n)},[n]),r.useEffect(()=>{a.set(m,i)},[i]),r.useEffect(()=>{a.set(c,o)},[o]);const _=()=>{a.remove(f),a.remove(p),a.remove(N),a.remove(S),a.remove(l),a.remove(m),a.remove(c),a.remove(T),window.location.reload()};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"alert alert-info alert-vertical sm:alert-horizontal mb-3",children:[s("frontend_notice"),e.jsx("div",{children:e.jsx(h,{className:"btn btn-sm btn-error",onClick:_,children:s("reset_all")})})]}),e.jsxs("div",{children:[s("language")," ",e.jsx(b,{useExistingChildren:!0})]}),e.jsxs("div",{children:[s("theme")," ",e.jsx(j,{useExistingChildren:!0})]}),e.jsx("div",{children:e.jsxs(A,{name:"homepage",label:s("homepage"),onChange:t=>!t.target.validationMessage&&u(t.target.value),value:n,required:!0,children:[e.jsx("option",{value:"devices",children:s("navbar:devices")}),e.jsx("option",{value:"dashboard",children:s("navbar:dashboard")})]})}),e.jsx("div",{children:e.jsx(d,{type:"number",name:"permit_join_time",label:s("permit_join_time"),min:10,max:254,required:!0,value:i,onChange:t=>!t.target.validationMessage&&!!t.target.value&&v(t.target.valueAsNumber)})}),e.jsx("div",{children:e.jsx(d,{type:"number",name:"max_on_screen_notifications",label:s("max_on_screen_notifications"),min:1,max:5,required:!0,value:o,onChange:t=>!t.target.validationMessage&&!!t.target.value&&E(t.target.valueAsNumber)})})]})}export{C as default};
1
+ import{b as x,r,s as g,H as l,bK as m,bL as c,j as e,B as h,bM as b,bN as j,d as f,Q as p,J as N,bO as S,bP as T}from"./index-vDL8KyrI.js";import{I as d}from"./InputField-B5sOh_uD.js";import{S as A}from"./SelectField-apZm61cq.js";const a=g;function C(){const{t:s}=x(["settings","navbar"]),[n,u]=r.useState(a.get(l,"devices")),[i,v]=r.useState(a.get(m,254)),[o,E]=r.useState(a.get(c,4));r.useEffect(()=>{a.set(l,n)},[n]),r.useEffect(()=>{a.set(m,i)},[i]),r.useEffect(()=>{a.set(c,o)},[o]);const _=()=>{a.remove(f),a.remove(p),a.remove(N),a.remove(S),a.remove(l),a.remove(m),a.remove(c),a.remove(T),window.location.reload()};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"alert alert-info alert-vertical sm:alert-horizontal mb-3",children:[s("frontend_notice"),e.jsx("div",{children:e.jsx(h,{className:"btn btn-sm btn-error",onClick:_,children:s("reset_all")})})]}),e.jsxs("div",{children:[s("language")," ",e.jsx(b,{useExistingChildren:!0})]}),e.jsxs("div",{children:[s("theme")," ",e.jsx(j,{useExistingChildren:!0})]}),e.jsx("div",{children:e.jsxs(A,{name:"homepage",label:s("homepage"),onChange:t=>!t.target.validationMessage&&u(t.target.value),value:n,required:!0,children:[e.jsx("option",{value:"devices",children:s("navbar:devices")}),e.jsx("option",{value:"dashboard",children:s("navbar:dashboard")})]})}),e.jsx("div",{children:e.jsx(d,{type:"number",name:"permit_join_time",label:s("permit_join_time"),min:10,max:254,required:!0,value:i,onChange:t=>!t.target.validationMessage&&!!t.target.value&&v(t.target.valueAsNumber)})}),e.jsx("div",{children:e.jsx(d,{type:"number",name:"max_on_screen_notifications",label:s("max_on_screen_notifications"),min:1,max:5,required:!0,value:o,onChange:t=>!t.target.validationMessage&&!!t.target.value&&E(t.target.valueAsNumber)})})]})}export{C as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-97iPX55p.js","./index-CwJt2ZPU.js","./index-BB8zE-tT.css","./RecallRemove-Bt_mgpm8.js","./DashboardFeatureWrapper-BPi5Syin.js","./Feature-b5LHKHrY.js","./DisplayValue-CZpYmpLD.js","./_createCompounder-CG6wppeM.js","./capitalize-fmjr8MXW.js","./InputField-C_t5k0Dv.js","./SelectField-pi0T7PIM.js","./DevicePicker-DxCWDQnp.js","./EndpointPicker-VM2TEDAs.js","./DeviceCard-C1UuNxRA.js","./LastSeen-CeDLL1-q.js","./Lqi-DBfyroIH.js","./PowerSource-BF7Gul0J.js","./snakeCase-E1FSY3OI.js","./DeviceImage-B6F8WQJo.js","./index-B5pN5VmG.js","./GroupSettings-lZ4wrUYC.js","./SettingsList-CoMEU_Fj.js","./CheckboxField-CanRey3x.js"])))=>i.map(i=>d[i]);
2
- import{r,b as g,j as e,L as f,P as j,F as m,f as v,u as b,e as h,a as _,N as p,p as N,l as w,_ as x}from"./index-CwJt2ZPU.js";const y=r.memo(l=>{const{groups:n,currentGroup:s,tab:o="devices"}=l,[c,u]=r.useState(""),{t}=g("common"),d=r.useMemo(()=>n.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==(s==null?void 0:s.id)).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>u(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[n,c,s,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${s?`#${s.id} - ${s.friendly_name}`:t("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:t("type_to_filter"),onChange:a=>u(a.target.value),value:c})]},"search"),d]})}),T=r.lazy(async()=>await x(()=>import("./Devices-97iPX55p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),import.meta.url)),$=r.lazy(async()=>await x(()=>import("./GroupSettings-lZ4wrUYC.js"),__vite__mapDeps([20,1,2,21,22,9,10]),import.meta.url));function L(){const l=b(),{t:n}=g(["groups","common"]),{groupId:s,tab:o}=h(),c=_(i=>i.groups),u=Number.parseInt(s,10),t=s?c.find(i=>i.id===u):void 0;r.useEffect(()=>{!o&&t&&l(`/group/${t.id}/devices`,{replace:!0})},[o,t,l]);const d=({isActive:i})=>i?"tab tab-active":"tab",a=r.useMemo(()=>{if(!t)return e.jsx("div",{className:"flex-auto justify-center items-center",children:n("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:t});case"settings":return e.jsx($,{group:t})}},[o,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:t,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${s}/devices`,className:d,children:[e.jsx(m,{icon:N,className:"me-2"}),n("common:devices")]}),e.jsxs(p,{to:`/group/${s}/settings`,className:d,children:[e.jsx(m,{icon:w,className:"me-2"}),n("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{L as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-B1Wz8goW.js","./index-vDL8KyrI.js","./index-KcXdcCUK.css","./RecallRemove-DchDgS_I.js","./DashboardFeatureWrapper-CotxeSO1.js","./Feature-Dn8iv4tk.js","./DisplayValue-CvjefE6V.js","./_createCompounder-Bmfmbzn9.js","./capitalize-Cw1mPDhM.js","./InputField-B5sOh_uD.js","./SelectField-apZm61cq.js","./DevicePicker-CGedN3DH.js","./EndpointPicker-DOVgHugJ.js","./DeviceCard-C0AcffeR.js","./LastSeen-BB0rwxhg.js","./Lqi-C8sPb_IK.js","./PowerSource-DFW6CjuU.js","./snakeCase-B_0CeYWc.js","./DeviceImage-BpknBFw1.js","./index-C4Y7ujGQ.js","./GroupSettings-2ilNn-oq.js","./SettingsList-D3Urvwh_.js","./CheckboxField-m1WCeVZk.js"])))=>i.map(i=>d[i]);
2
+ import{r,b as g,j as e,L as f,P as j,F as m,f as v,u as b,e as h,a as _,N as p,p as N,l as w,_ as x}from"./index-vDL8KyrI.js";const y=r.memo(l=>{const{groups:n,currentGroup:s,tab:o="devices"}=l,[c,u]=r.useState(""),{t}=g("common"),d=r.useMemo(()=>n.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==(s==null?void 0:s.id)).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>u(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[n,c,s,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${s?`#${s.id} - ${s.friendly_name}`:t("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:t("type_to_filter"),onChange:a=>u(a.target.value),value:c})]},"search"),d]})}),T=r.lazy(async()=>await x(()=>import("./Devices-B1Wz8goW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),import.meta.url)),$=r.lazy(async()=>await x(()=>import("./GroupSettings-2ilNn-oq.js"),__vite__mapDeps([20,1,2,21,22,9,10]),import.meta.url));function L(){const l=b(),{t:n}=g(["groups","common"]),{groupId:s,tab:o}=h(),c=_(i=>i.groups),u=Number.parseInt(s,10),t=s?c.find(i=>i.id===u):void 0;r.useEffect(()=>{!o&&t&&l(`/group/${t.id}/devices`,{replace:!0})},[o,t,l]);const d=({isActive:i})=>i?"tab tab-active":"tab",a=r.useMemo(()=>{if(!t)return e.jsx("div",{className:"flex-auto justify-center items-center",children:n("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:t});case"settings":return e.jsx($,{group:t})}},[o,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:t,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${s}/devices`,className:d,children:[e.jsx(m,{icon:N,className:"me-2"}),n("common:devices")]}),e.jsxs(p,{to:`/group/${s}/settings`,className:d,children:[e.jsx(m,{icon:w,className:"me-2"}),n("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{L as default};
@@ -1 +1 @@
1
- import{b as c,a as l,r as i,W as m,j as e,F as d,A as p,bF as f}from"./index-CwJt2ZPU.js";import{S as g}from"./SettingsList-CoMEU_Fj.js";import"./CheckboxField-CanRey3x.js";import"./InputField-C_t5k0Dv.js";import"./SelectField-pi0T7PIM.js";function _({group:s}){const{t:n}=c(["settings","common"]),o=l(t=>t.bridgeInfo),{sendMessage:r}=i.useContext(m),a=i.useCallback(async t=>{await r("bridge/request/group/options",{id:s.id.toString(),options:t})},[r,s.id]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(d,{icon:p,size:"2xl"}),e.jsx("a",{href:f,target:"_blank",rel:"noreferrer",className:"link link-hover",children:n("common:read_the_docs_info")})]}),e.jsx(g,{schema:o.config_schema.definitions.group??{properties:{}},data:o.config.groups[s.id]??{},set:a})]})}export{_ as default};
1
+ import{b as c,a as l,r as i,W as m,j as e,F as d,A as p,bF as f}from"./index-vDL8KyrI.js";import{S as g}from"./SettingsList-D3Urvwh_.js";import"./CheckboxField-m1WCeVZk.js";import"./InputField-B5sOh_uD.js";import"./SelectField-apZm61cq.js";function _({group:s}){const{t:n}=c(["settings","common"]),o=l(t=>t.bridgeInfo),{sendMessage:r}=i.useContext(m),a=i.useCallback(async t=>{await r("bridge/request/group/options",{id:s.id.toString(),options:t})},[r,s.id]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(d,{icon:p,size:"2xl"}),e.jsx("a",{href:f,target:"_blank",rel:"noreferrer",className:"link link-hover",children:n("common:read_the_docs_info")})]}),e.jsx(g,{schema:o.config_schema.definitions.group??{properties:{}},data:o.config.groups[s.id]??{},set:a})]})}export{_ as default};
@@ -1 +1 @@
1
- import{r,b as _,j as e,a as w,W as C,ae as N,B as k,L as y,I as G,F as S,x as I}from"./index-CwJt2ZPU.js";import{E as M}from"./EndpointPicker-VM2TEDAs.js";import{S as E}from"./SelectField-pi0T7PIM.js";const q=r.memo(t=>{const{t:o}=_("common"),{groups:a,value:c,label:l,onChange:m,...i}=t,g=r.useCallback(u=>{const{value:d}=u.target,x=Number.parseInt(d,10);m(a.find(b=>x===b.id))},[a,m]),p=r.useMemo(()=>{const u=[];for(const d of a)u.push(e.jsx("option",{value:d.id,children:d.friendly_name},d.id));return u},[a]);return e.jsxs(E,{name:"group_picker",label:l,value:c,onChange:g,...i,children:[e.jsx("option",{value:"",disabled:!0,children:o("select_group")}),p]})});function A({device:t}){const{t:o}=_(["groups","zigbee","common"]),a=w(s=>s.groups),{sendMessage:c}=r.useContext(C),[l,m]=r.useState(""),[i,g]=r.useState(""),p=r.useMemo(()=>N(t),[t]),[u,d]=r.useMemo(()=>{const s=[],n=[];for(const f of a){const j=f.members.filter(h=>h.ieee_address===t.ieee_address);if(j.length>0)for(const h of j)s.push([f,h.endpoint]);else n.push(f)}return[s,n]},[a,t.ieee_address]),x=r.useCallback(s=>{g(s.id),m(p.values().next().value)},[p]),b=r.useCallback(async()=>await c("bridge/request/group/members/add",{group:i.toString(),endpoint:l,device:t.ieee_address}),[c,i,t.ieee_address,l]),v=r.useCallback(async([s,n])=>await c("bridge/request/group/members/remove",{device:t.ieee_address,endpoint:n,group:s.id.toString()}),[c,t.ieee_address]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row flex-wrap justify-around items-start gap-3 my-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:o("add_to_group")}),e.jsxs("div",{className:"mb-3",children:[e.jsx(q,{label:o("zigbee:group"),value:i,groups:d,onChange:x,required:!0}),e.jsx(M,{label:o("zigbee:endpoint"),values:p,value:l,onChange:s=>m(s),required:!0})]}),e.jsx(k,{onClick:b,className:"btn btn-primary",disabled:l==null||i==null||l===""||i==="",children:o("add_to_group")})]})}),e.jsx("div",{className:"flex flex-row flex-wrap justify-between items-stretch gap-3 mt-3",children:u.map(([s,n])=>e.jsxs("ul",{className:"flex-auto basis-sm list rounded-box shadow-md",children:[e.jsxs("li",{className:"list-row grow",children:[e.jsxs("div",{children:[e.jsxs(y,{to:`/group/${s.id}/devices`,className:"link link-hover",children:["#",s.id," - ",s.friendly_name,n?` (${o("endpoint")}: ${n})`:""]}),e.jsx("div",{className:"text-xs opacity-50",children:s.description||""})]}),e.jsxs("div",{className:"list-col-wrap text-sm w-full gap-2",children:[e.jsxs("div",{className:"badge badge-soft badge-ghost cursor-default me-2",children:[o("group_members"),": ",s.members.length]}),e.jsxs("div",{className:"badge badge-soft badge-ghost cursor-default me-2",children:[o("group_scenes"),": ",s.scenes.length]})]})]}),e.jsx("li",{className:"flex flex-row flex-wrap gap-1 m-4 justify-around items-center",children:e.jsx(G,{item:[s,n],onClick:v,className:"btn btn-square btn-error btn-sm",title:o("remove_from_group"),modalDescription:o("common:dialog_confirmation_prompt"),modalCancelLabel:o("common:cancel"),children:e.jsx(S,{icon:I})})})]},`${s.id}-${n}`))})]})}export{A as default};
1
+ import{r,b as _,j as e,a as w,W as C,ae as N,B as k,L as y,I as G,F as S,x as I}from"./index-vDL8KyrI.js";import{E as M}from"./EndpointPicker-DOVgHugJ.js";import{S as E}from"./SelectField-apZm61cq.js";const q=r.memo(t=>{const{t:o}=_("common"),{groups:a,value:c,label:l,onChange:m,...i}=t,g=r.useCallback(u=>{const{value:d}=u.target,x=Number.parseInt(d,10);m(a.find(b=>x===b.id))},[a,m]),p=r.useMemo(()=>{const u=[];for(const d of a)u.push(e.jsx("option",{value:d.id,children:d.friendly_name},d.id));return u},[a]);return e.jsxs(E,{name:"group_picker",label:l,value:c,onChange:g,...i,children:[e.jsx("option",{value:"",disabled:!0,children:o("select_group")}),p]})});function A({device:t}){const{t:o}=_(["groups","zigbee","common"]),a=w(s=>s.groups),{sendMessage:c}=r.useContext(C),[l,m]=r.useState(""),[i,g]=r.useState(""),p=r.useMemo(()=>N(t),[t]),[u,d]=r.useMemo(()=>{const s=[],n=[];for(const f of a){const j=f.members.filter(h=>h.ieee_address===t.ieee_address);if(j.length>0)for(const h of j)s.push([f,h.endpoint]);else n.push(f)}return[s,n]},[a,t.ieee_address]),x=r.useCallback(s=>{g(s.id),m(p.values().next().value)},[p]),b=r.useCallback(async()=>await c("bridge/request/group/members/add",{group:i.toString(),endpoint:l,device:t.ieee_address}),[c,i,t.ieee_address,l]),v=r.useCallback(async([s,n])=>await c("bridge/request/group/members/remove",{device:t.ieee_address,endpoint:n,group:s.id.toString()}),[c,t.ieee_address]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row flex-wrap justify-around items-start gap-3 my-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:o("add_to_group")}),e.jsxs("div",{className:"mb-3",children:[e.jsx(q,{label:o("zigbee:group"),value:i,groups:d,onChange:x,required:!0}),e.jsx(M,{label:o("zigbee:endpoint"),values:p,value:l,onChange:s=>m(s),required:!0})]}),e.jsx(k,{onClick:b,className:"btn btn-primary",disabled:l==null||i==null||l===""||i==="",children:o("add_to_group")})]})}),e.jsx("div",{className:"flex flex-row flex-wrap justify-between items-stretch gap-3 mt-3",children:u.map(([s,n])=>e.jsxs("ul",{className:"flex-auto basis-sm list rounded-box shadow-md",children:[e.jsxs("li",{className:"list-row grow",children:[e.jsxs("div",{children:[e.jsxs(y,{to:`/group/${s.id}/devices`,className:"link link-hover",children:["#",s.id," - ",s.friendly_name,n?` (${o("endpoint")}: ${n})`:""]}),e.jsx("div",{className:"text-xs opacity-50",children:s.description||""})]}),e.jsxs("div",{className:"list-col-wrap text-sm w-full gap-2",children:[e.jsxs("div",{className:"badge badge-soft badge-ghost cursor-default me-2",children:[o("group_members"),": ",s.members.length]}),e.jsxs("div",{className:"badge badge-soft badge-ghost cursor-default me-2",children:[o("group_scenes"),": ",s.scenes.length]})]})]}),e.jsx("li",{className:"flex flex-row flex-wrap gap-1 m-4 justify-around items-center",children:e.jsx(G,{item:[s,n],onClick:v,className:"btn btn-square btn-error btn-sm",title:o("remove_from_group"),modalDescription:o("common:dialog_confirmation_prompt"),modalCancelLabel:o("common:cancel"),children:e.jsx(S,{icon:I})})})]},`${s.id}-${n}`))})]})}export{A as default};
@@ -1 +1 @@
1
- import{w as h,E as v,b as j,r as o,j as a,M as N,B as d,a as w,W as C,L as g,F as b,G as k,I as F,x as S,J as G}from"./index-CwJt2ZPU.js";import{I as p}from"./InputField-C_t5k0Dv.js";import{T as E}from"./Table-CNH7RvaJ.js";import"./DebouncedInput-suZwHdPO.js";const R=h.create(i=>{const{name:t,onRename:r}=i,c=v(),{t:l}=j(["groups","common"]),[s,n]=o.useState(t);return o.useEffect(()=>{n(t)},[t]),a.jsx(N,{isOpen:c.visible,title:`${l("rename_group")} ${t}`,footer:a.jsxs(a.Fragment,{children:[a.jsx(d,{className:"btn btn-secondary",onClick:c.remove,children:l("common:cancel")}),a.jsx(d,{className:"btn btn-primary ms-1",onClick:async()=>{s&&(c.remove(),await r(t,s))},children:l("rename_group")})]}),children:a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx(p,{name:"friendly_name",label:l("common:friendly_name"),onChange:u=>n(u.target.value),value:s,type:"text",required:!0})})})});function T(){const[i,t]=o.useState(""),[r,c]=o.useState(""),l=w(e=>e.groups),{sendMessage:s}=o.useContext(C),{t:n}=j(["groups","common"]),u=o.useCallback(async()=>{const e={friendly_name:i};r!==void 0&&(e.id=r),await s("bridge/request/group/add",e)},[i,r,s]),x=o.useCallback(async(e,m)=>await s("bridge/request/group/rename",{from:e,to:m}),[s]),f=o.useCallback(async e=>await s("bridge/request/group/remove",{id:e}),[s]),y=o.useMemo(()=>i?!r||!l.find(e=>e.id.toString()===r):!1,[i,r,l]),_=o.useMemo(()=>[{id:"group_id",header:n("group_id"),accessorFn:e=>e.id,cell:({row:{original:e}})=>{var m;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"avatar"}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx(g,{to:`/group/${e.id}/devices`,className:"link link-hover",children:e.id}),e.description&&a.jsx("div",{className:"text-xs opacity-50",children:e.description}),a.jsx("div",{className:"flex flex-row gap-1 mt-2",children:a.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default",children:[n("scenes"),": ",((m=e.scenes)==null?void 0:m.length)??0]})})]})]})}},{id:"friendly_name",header:n("common:friendly_name"),accessorFn:e=>e.friendly_name,cell:({row:{original:e}})=>a.jsx(g,{to:`/group/${e.id}/devices`,className:"link link-hover",children:e.friendly_name})},{id:"members",header:n("group_members"),accessorFn:e=>e.members.length??0,enableColumnFilter:!1},{header:"",id:"actions",cell:({row:{original:e}})=>a.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[a.jsx(d,{className:"btn btn-primary btn-sm join-item",onClick:async()=>await h.show(R,{name:e.friendly_name,onRename:x}),title:n("rename_group"),disabled:e.friendly_name==="default_bind_group",children:a.jsx(b,{icon:k})}),a.jsx(F,{title:n("remove_group"),item:e.id.toString(),onClick:f,className:"btn btn-error btn-sm join-item",modalDescription:n("common:dialog_confirmation_prompt"),modalCancelLabel:n("common:cancel"),children:a.jsx(b,{icon:S})})]}),enableSorting:!1,enableColumnFilter:!1}],[x,f,n]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"collapse collapse-arrow bg-base-100 shadow mb-3",children:[a.jsx("input",{type:"checkbox"}),a.jsx("div",{className:"collapse-title text-lg font-semibold text-center",children:n("create_group")}),a.jsx("div",{className:"collapse-content",children:a.jsxs("div",{className:"flex flex-row flex-wrap justify-center gap-2",children:[a.jsx(p,{type:"text",name:"friendly_name",label:n("common:friendly_name"),value:i,placeholder:n("friendly_name_placeholder"),onChange:e=>t(e.target.value),required:!0}),a.jsx(p,{type:"number",name:"group_id",label:n("group_id"),value:r,detail:n("common:optional"),min:0,max:255,onChange:e=>c(e.target.value)}),a.jsx(d,{onClick:u,className:"btn btn-primary self-center",disabled:!y,children:n("create_group")})]})})]}),a.jsx(E,{id:"all-groups",columns:_,data:l,pageSizeStoreKey:G})]})}export{T as default};
1
+ import{w as h,E as v,b as j,r as o,j as a,M as N,B as d,a as w,W as C,L as g,F as b,G as k,I as F,x as S,J as G}from"./index-vDL8KyrI.js";import{I as p}from"./InputField-B5sOh_uD.js";import{T as E}from"./Table-DDSIa7cd.js";import"./DebouncedInput-DpBqTOhq.js";const R=h.create(i=>{const{name:t,onRename:r}=i,c=v(),{t:l}=j(["groups","common"]),[s,n]=o.useState(t);return o.useEffect(()=>{n(t)},[t]),a.jsx(N,{isOpen:c.visible,title:`${l("rename_group")} ${t}`,footer:a.jsxs(a.Fragment,{children:[a.jsx(d,{className:"btn btn-secondary",onClick:c.remove,children:l("common:cancel")}),a.jsx(d,{className:"btn btn-primary ms-1",onClick:async()=>{s&&(c.remove(),await r(t,s))},children:l("rename_group")})]}),children:a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx(p,{name:"friendly_name",label:l("common:friendly_name"),onChange:u=>n(u.target.value),value:s,type:"text",required:!0})})})});function T(){const[i,t]=o.useState(""),[r,c]=o.useState(""),l=w(e=>e.groups),{sendMessage:s}=o.useContext(C),{t:n}=j(["groups","common"]),u=o.useCallback(async()=>{const e={friendly_name:i};r!==void 0&&(e.id=r),await s("bridge/request/group/add",e)},[i,r,s]),x=o.useCallback(async(e,m)=>await s("bridge/request/group/rename",{from:e,to:m}),[s]),f=o.useCallback(async e=>await s("bridge/request/group/remove",{id:e}),[s]),y=o.useMemo(()=>i?!r||!l.find(e=>e.id.toString()===r):!1,[i,r,l]),_=o.useMemo(()=>[{id:"group_id",header:n("group_id"),accessorFn:e=>e.id,cell:({row:{original:e}})=>{var m;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"avatar"}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx(g,{to:`/group/${e.id}/devices`,className:"link link-hover",children:e.id}),e.description&&a.jsx("div",{className:"text-xs opacity-50",children:e.description}),a.jsx("div",{className:"flex flex-row gap-1 mt-2",children:a.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default",children:[n("scenes"),": ",((m=e.scenes)==null?void 0:m.length)??0]})})]})]})}},{id:"friendly_name",header:n("common:friendly_name"),accessorFn:e=>e.friendly_name,cell:({row:{original:e}})=>a.jsx(g,{to:`/group/${e.id}/devices`,className:"link link-hover",children:e.friendly_name})},{id:"members",header:n("group_members"),accessorFn:e=>e.members.length??0,enableColumnFilter:!1},{header:"",id:"actions",cell:({row:{original:e}})=>a.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[a.jsx(d,{className:"btn btn-primary btn-sm join-item",onClick:async()=>await h.show(R,{name:e.friendly_name,onRename:x}),title:n("rename_group"),disabled:e.friendly_name==="default_bind_group",children:a.jsx(b,{icon:k})}),a.jsx(F,{title:n("remove_group"),item:e.id.toString(),onClick:f,className:"btn btn-error btn-sm join-item",modalDescription:n("common:dialog_confirmation_prompt"),modalCancelLabel:n("common:cancel"),children:a.jsx(b,{icon:S})})]}),enableSorting:!1,enableColumnFilter:!1}],[x,f,n]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"collapse collapse-arrow bg-base-100 shadow mb-3",children:[a.jsx("input",{type:"checkbox"}),a.jsx("div",{className:"collapse-title text-lg font-semibold text-center",children:n("create_group")}),a.jsx("div",{className:"collapse-content",children:a.jsxs("div",{className:"flex flex-row flex-wrap justify-center gap-2",children:[a.jsx(p,{type:"text",name:"friendly_name",label:n("common:friendly_name"),value:i,placeholder:n("friendly_name_placeholder"),onChange:e=>t(e.target.value),required:!0}),a.jsx(p,{type:"number",name:"group_id",label:n("group_id"),value:r,detail:n("common:optional"),min:0,max:255,onChange:e=>c(e.target.value)}),a.jsx(d,{onClick:u,className:"btn btn-primary self-center",disabled:!y,children:n("create_group")})]})})]}),a.jsx(E,{id:"all-groups",columns:_,data:l,pageSizeStoreKey:G})]})}export{T as default};
@@ -1 +1 @@
1
- import{u as s,r as t,s as r,H as o,j as e}from"./index-CwJt2ZPU.js";const c=r;function u(){const a=s();return t.useEffect(()=>{a(c.get(o)==="dashboard"?"/dashboard":"/devices",{replace:!0})},[a]),e.jsx(e.Fragment,{})}export{u as default};
1
+ import{u as s,r as t,s as r,H as o,j as e}from"./index-vDL8KyrI.js";const c=r;function u(){const a=s();return t.useEffect(()=>{a(c.get(o)==="dashboard"?"/dashboard":"/devices",{replace:!0})},[a]),e.jsx(e.Fragment,{})}export{u as default};
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-CwJt2ZPU.js";const c=i.memo(s=>{const{label:l,detail:t,onChange:a,onBlur:n,...r}=s;return e.jsxs("fieldset",{className:"fieldset",children:[l&&e.jsx("legend",{className:"fieldset-legend",children:l}),e.jsx("input",{className:`input${s.pattern||s.required?" validator":""}`,onChange:a,onBlur:n,...r}),t&&e.jsx("p",{className:"label",children:t})]})});export{c as I};
1
+ import{r as i,j as e}from"./index-vDL8KyrI.js";const c=i.memo(s=>{const{label:l,detail:t,onChange:a,onBlur:n,...r}=s;return e.jsxs("fieldset",{className:"fieldset",children:[l&&e.jsx("legend",{className:"fieldset-legend",children:l}),e.jsx("input",{className:`input${s.pattern||s.required?" validator":""}`,onChange:a,onBlur:n,...r}),t&&e.jsx("p",{className:"label",children:t})]})});export{c as I};
@@ -1 +1 @@
1
- import{aF as c,r as l,b as D,c as m,j as o,a6 as v}from"./index-CwJt2ZPU.js";var s=[60,60,24,7,365/7/12,12];function g(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}function p(e,t){var n=e<0?1:0;e=Math.abs(e);for(var r=e,a=0;e>=s[a]&&a<s.length;a++)e/=s[a];return e=Math.floor(e),a*=2,e>(a===0?9:1)&&(a+=1),t(e,a,r)[n].replace("%s",e.toString())}function u(e,t){var n=new Date;return(+n-+g(e))/1e3}var x=function(e,t,n){var r=u(e);return p(r,c(t))};const h=l.memo(({lastSeen:e,config:t})=>{const{i18n:n}=D(),r=m(e,t);return r?o.jsx("span",{title:v(r),children:x(r,n.language)}):o.jsx(o.Fragment,{children:"N/A"})});export{h as L};
1
+ import{aF as c,r as l,b as D,c as m,j as o,a6 as v}from"./index-vDL8KyrI.js";var s=[60,60,24,7,365/7/12,12];function g(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}function p(e,t){var n=e<0?1:0;e=Math.abs(e);for(var r=e,a=0;e>=s[a]&&a<s.length;a++)e/=s[a];return e=Math.floor(e),a*=2,e>(a===0?9:1)&&(a+=1),t(e,a,r)[n].replace("%s",e.toString())}function u(e,t){var n=new Date;return(+n-+g(e))/1e3}var x=function(e,t,n){var r=u(e);return p(r,c(t))};const h=l.memo(({lastSeen:e,config:t})=>{const{i18n:n}=D(),r=m(e,t);return r?o.jsx("span",{title:v(r),children:x(r,n.language)}):o.jsx(o.Fragment,{children:"N/A"})});export{h as L};
@@ -0,0 +1 @@
1
+ import{r as l,W as _,y as C,a as g,b as w,a1 as y,j as s,a2 as u,F as k,f as N,a3 as S,a4 as E,B as I,a5 as M,a6 as A}from"./index-vDL8KyrI.js";import{C as F}from"./CheckboxField-m1WCeVZk.js";import{D as G}from"./DebouncedInput-DpBqTOhq.js";import{S as d}from"./SelectField-apZm61cq.js";const D={error:"bg-error text-error-content",warning:"bg-warning text-warning-content",info:"bg-info text-info-content",debug:"bg-accent text-accent-content opacity-50"};function T(){const{sendMessage:m}=l.useContext(_),[t,c]=l.useState(""),[n,x]=l.useState("all"),[r,f]=l.useState(!1),h=C(),L=g(e=>e.logsLimit),b=g(e=>e.bridgeInfo.config.advanced.log_level),{t:a}=w("logs"),p=g(e=>e.logs),o=l.useMemo(()=>p.filter(e=>(n==="all"||e.level===n)&&(r||!t||e.message.toLowerCase().includes(t.toLowerCase()))),[t,r,n,p]),j=l.useCallback((e,i)=>t&&e.toLowerCase().includes(t.toLowerCase())?D[i]:y[i],[t]),v=l.useCallback(async e=>{await m("bridge/request/options",{options:{advanced:{log_level:e}}})},[m]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-row flex-wrap gap-3 items-top",children:[s.jsxs(d,{name:"log_level",label:a("show_only"),value:n,onChange:e=>x(e.target.value),children:[s.jsx("option",{value:"all",children:"all"},"all"),u.map(e=>s.jsx("option",{value:e,children:e},e))]}),s.jsxs("fieldset",{className:"fieldset",children:[s.jsx("legend",{className:"fieldset-legend",children:a("filter_by_text")}),s.jsxs("label",{className:"input w-64",children:[s.jsx(k,{icon:N}),s.jsx(G,{className:"",type:"search",onChange:e=>c(e.toString()),placeholder:a("common:search"),value:t,disabled:o.length===0}),s.jsx("kbd",{className:"kbd kbd-sm cursor-pointer",onClick:()=>c(""),onKeyUp:e=>{e.key==="enter"&&c("")},title:a("common:clear"),children:"x"})]})]}),s.jsx(F,{name:"highlight_only",label:a("highlight_only"),checked:r,onChange:e=>f(e.target.checked)}),s.jsx(d,{name:"log_limit",label:a("logs_limit"),onChange:e=>{h(E(Number.parseInt(e.target.value)))},value:L,children:S.map(e=>s.jsx("option",{value:e,children:e},e))}),s.jsx(I,{onClick:()=>{h(M())},className:"btn btn-primary self-center",disabled:o.length===0,children:a("common:clear")}),s.jsx("div",{className:"ml-auto",children:s.jsx(d,{name:"log_level_config",label:a("log_level_config"),value:b,onChange:e=>!e.target.validationMessage&&v(e.target.value),children:u.map(e=>s.jsx("option",{value:e,children:e},e))})})]}),s.jsx("div",{className:"mockup-code w-full mt-1",children:o.length>0?o.map((e,i)=>s.jsx("pre",{"data-prefix":i,className:j(e.message,e.level),children:s.jsxs("code",{children:["[",e.timestamp,"] ",e.message]})},`${e.timestamp}-${e.message}`)):s.jsx("pre",{"data-prefix":"~",children:s.jsxs("code",{children:["[",A(new Date),"] ",a("empty_logs_message")]})})})]})}export{T as default};
@@ -1 +1 @@
1
- import{r,j as t,F as i,aJ as a}from"./index-CwJt2ZPU.js";import{D as n}from"./DisplayValue-CZpYmpLD.js";const x=r.memo(({value:s})=>{let e="";return s&&(s<75?e="text-error":s<125?e="text-warning":s>200&&(e="text-success")),t.jsxs(t.Fragment,{children:[t.jsx(i,{icon:a,className:e})," ",t.jsx("span",{className:e,children:t.jsx(n,{value:s,name:"linkquality"})})]})});export{x as L};
1
+ import{r,j as t,F as i,aJ as a}from"./index-vDL8KyrI.js";import{D as n}from"./DisplayValue-CvjefE6V.js";const x=r.memo(({value:s})=>{let e="";return s&&(s<75?e="text-error":s<125?e="text-warning":s>200&&(e="text-success")),t.jsxs(t.Fragment,{children:[t.jsx(i,{icon:a,className:e})," ",t.jsx("span",{className:e,children:t.jsx(n,{value:s,name:"linkquality"})})]})});export{x as L};
Binary file
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-DWbMOxjo.js","./index-CwJt2ZPU.js","./index-BB8zE-tT.css","./DeviceImage-B6F8WQJo.js","./index-B5pN5VmG.js","./DebouncedInput-suZwHdPO.js","./PowerSource-BF7Gul0J.js","./snakeCase-E1FSY3OI.js","./_createCompounder-CG6wppeM.js","./Lqi-DBfyroIH.js","./DisplayValue-CZpYmpLD.js","./index-C2eewgcx.js","./RawNetworkMap-C7ipJu2k.js","./RawNetworkMap-DkxkTem6.css"])))=>i.map(i=>d[i]);
2
- import{y as _,r as s,W as C,b as N,a as m,z,j as e,F as l,A as d,B as R,C as T,k as E,_ as x}from"./index-CwJt2ZPU.js";import{C as F}from"./CheckboxField-CanRey3x.js";import{S as h}from"./SelectField-pi0T7PIM.js";const M=s.lazy(async()=>await x(()=>import("./RawNetworkData-DWbMOxjo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),S=s.lazy(async()=>await x(()=>import("./RawNetworkMap-C7ipJu2k.js"),__vite__mapDeps([12,1,2,11,3,4,13]),import.meta.url));function L(){const p=_(),{sendMessage:u}=s.useContext(C),{t:r}=N(["network","common"]),n=m(t=>t.networkMapIsLoading),a=m(t=>t.networkMap),[o,f]=s.useState("raw"),[i,g]=s.useState(!1),[c,j]=s.useState("data"),w=s.useCallback(t=>{t.target.value&&f(t.target.value)},[]),y=s.useCallback(t=>{t.target.value&&j(t.target.value)},[]),v=s.useCallback(t=>{g(t.target.checked)},[]),k=s.useCallback(async()=>{p(z()),await u("bridge/request/networkmap",{type:o,routes:i})},[o,i,p,u]),b=s.useMemo(()=>{if(n)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:e.jsx("span",{className:"loading loading-infinity loading-xl"})}),e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:r("loading")})]});if(a)switch(a.type){case"raw":return c==="data"?e.jsx(M,{map:a.value}):e.jsx(S,{map:a.value});case"graphviz":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(l,{icon:d,size:"2xl"}),r("copy_paste_on"),e.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),e.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:a.value})]});case"plantuml":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(l,{icon:d,size:"2xl"}),r("copy_paste_on"),e.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),e.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:a.value})]})}return null},[a,n,c,r]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row justify-center gap-3 mb-3",children:[e.jsxs(h,{name:"type",label:r("type"),value:o,onChange:w,children:[e.jsx("option",{value:"raw",children:"raw"}),e.jsx("option",{value:"graphviz",children:"graphviz"}),e.jsx("option",{value:"plantuml",children:"plantuml"})]}),e.jsx(F,{name:"enable_routes",label:r("enable_routes"),checked:i,onChange:v}),e.jsx(R,{className:"btn btn-primary btn-square self-center ms-3 me-6",onClick:k,title:r(a?"reload":"load"),disabled:n,children:a?e.jsx(l,{icon:T}):e.jsx(l,{icon:E})}),(a==null?void 0:a.type)==="raw"&&e.jsxs(h,{name:"display_type",label:r("display_type"),value:c,onChange:y,children:[e.jsx("option",{value:"data",children:"data"}),e.jsx("option",{value:"map",children:"map"})]})]}),b]})}export{L as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-Xk75QL3K.js","./index-vDL8KyrI.js","./index-KcXdcCUK.css","./DeviceImage-BpknBFw1.js","./index-C4Y7ujGQ.js","./DebouncedInput-DpBqTOhq.js","./PowerSource-DFW6CjuU.js","./snakeCase-B_0CeYWc.js","./_createCompounder-Bmfmbzn9.js","./Lqi-C8sPb_IK.js","./DisplayValue-CvjefE6V.js","./index-C2eewgcx.js","./RawNetworkMap-CwUz_5FO.js","./RawNetworkMap-DkxkTem6.css"])))=>i.map(i=>d[i]);
2
+ import{y as _,r as s,W as C,b as N,a as m,z,j as e,F as l,A as d,B as R,C as T,k as E,_ as x}from"./index-vDL8KyrI.js";import{C as F}from"./CheckboxField-m1WCeVZk.js";import{S as h}from"./SelectField-apZm61cq.js";const M=s.lazy(async()=>await x(()=>import("./RawNetworkData-Xk75QL3K.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),S=s.lazy(async()=>await x(()=>import("./RawNetworkMap-CwUz_5FO.js"),__vite__mapDeps([12,1,2,11,3,4,13]),import.meta.url));function L(){const p=_(),{sendMessage:u}=s.useContext(C),{t:r}=N(["network","common"]),n=m(t=>t.networkMapIsLoading),a=m(t=>t.networkMap),[o,f]=s.useState("raw"),[i,g]=s.useState(!1),[c,j]=s.useState("data"),w=s.useCallback(t=>{t.target.value&&f(t.target.value)},[]),y=s.useCallback(t=>{t.target.value&&j(t.target.value)},[]),v=s.useCallback(t=>{g(t.target.checked)},[]),k=s.useCallback(async()=>{p(z()),await u("bridge/request/networkmap",{type:o,routes:i})},[o,i,p,u]),b=s.useMemo(()=>{if(n)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:e.jsx("span",{className:"loading loading-infinity loading-xl"})}),e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:r("loading")})]});if(a)switch(a.type){case"raw":return c==="data"?e.jsx(M,{map:a.value}):e.jsx(S,{map:a.value});case"graphviz":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(l,{icon:d,size:"2xl"}),r("copy_paste_on"),e.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),e.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:a.value})]});case"plantuml":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(l,{icon:d,size:"2xl"}),r("copy_paste_on"),e.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),e.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:a.value})]})}return null},[a,n,c,r]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row justify-center gap-3 mb-3",children:[e.jsxs(h,{name:"type",label:r("type"),value:o,onChange:w,children:[e.jsx("option",{value:"raw",children:"raw"}),e.jsx("option",{value:"graphviz",children:"graphviz"}),e.jsx("option",{value:"plantuml",children:"plantuml"})]}),e.jsx(F,{name:"enable_routes",label:r("enable_routes"),checked:i,onChange:v}),e.jsx(R,{className:"btn btn-primary btn-square self-center ms-3 me-6",onClick:k,title:r(a?"reload":"load"),disabled:n,children:a?e.jsx(l,{icon:T}):e.jsx(l,{icon:E})}),(a==null?void 0:a.type)==="raw"&&e.jsxs(h,{name:"display_type",label:r("display_type"),value:c,onChange:y,children:[e.jsx("option",{value:"data",children:"data"}),e.jsx("option",{value:"map",children:"map"})]})]}),b]})}export{L as default};
@@ -1 +1 @@
1
- import{r as l,b as g,j as s,B as y,I as h,F as f,K as j,a as N,W as $,L,O as D,Q as z}from"./index-CwJt2ZPU.js";import{D as M}from"./DeviceImage-B6F8WQJo.js";import{T as A}from"./Table-CNH7RvaJ.js";import{M as E,V as P}from"./VendorLink-Bn8AGeqD.js";import{P as B}from"./PowerSource-BF7Gul0J.js";import"./index-B5pN5VmG.js";import"./DebouncedInput-suZwHdPO.js";import"./snakeCase-E1FSY3OI.js";import"./_createCompounder-CG6wppeM.js";const O=l.memo(({label:o,remaining:i,progress:n})=>{if(i&&i>0){const a=Math.floor(i/3600),t=Math.floor(i/60)%60,m=Math.floor(i%60),r=a>0,u=t>0;return s.jsxs(s.Fragment,{children:[s.jsx("progress",{className:"progress w-48",value:n,max:"100"}),s.jsxs("div",{children:[o," ",`${r?`${a}:`:""}${u?`${t}:`:""}${m}`]})]})}return s.jsx("progress",{className:"progress w-48",value:n,max:"100"})}),U=l.memo(o=>{const{t:i}=g(["ota","common"]),{device:n,state:a,onCheckClick:t,onUpdateClick:m,onScheduleClick:r,onUnscheduleClick:u}=o;return a==null||a.state==="idle"?s.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[s.jsx(y,{className:"btn btn-primary btn-sm join-item",onClick:t,item:n.ieee_address,children:i("check")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]}):a.state==="updating"?s.jsx(O,{label:i("remaining_time"),remaining:a.remaining,progress:a.progress}):s.jsx("div",{className:"join join-vertical lg:join-horizontal",children:a.state==="available"?s.jsxs(s.Fragment,{children:[s.jsx(h,{className:"btn btn-error btn-sm join-item",onClick:m,item:n.ieee_address,title:i("update"),modalDescription:i("common:dialog_confirmation_prompt"),modalCancelLabel:i("common:cancel"),children:i("update")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]}):a.state==="scheduled"?s.jsx(h,{className:"btn btn-sm btn-error join-item",onClick:u,item:n.ieee_address,title:i("unschedule"),modalDescription:i("common:dialog_confirmation_prompt"),modalCancelLabel:i("common:cancel"),children:i("unschedule")}):s.jsxs(s.Fragment,{children:[s.jsx(y,{className:"btn btn-primary btn-sm join-item",onClick:t,item:n.ieee_address,children:i("check")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]})})}),S=l.memo(o=>{const{t:i}=g("ota"),n=l.useMemo(()=>{if(o.version==null)return;const a=o.version.toString(16).padStart(8,"0"),t=`${a[0]}.${a[1]}`,m=a.slice(2,4),r=`${a[4]}.${a[5]}`,u=a.slice(6);return[t,m,r,u]},[o.version]);return n===void 0?s.jsx(s.Fragment,{children:"Unknown"}):s.jsxs("div",{className:"join join-vertical",children:[s.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default join-item w-full",children:[i("app"),": ",`${n[0]} build ${n[1]}`]}),s.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default join-item w-full",children:[i("stack"),": ",`${n[2]} build ${n[3]}`]})]})}),q=l.memo(({device:o})=>{var t,m,r,u;const{t:i}=g("zigbee");let n="https://github.com/Koenkk/zigbee-OTA/releases";const a=o.software_build_id||i("unknown");switch((t=o==null?void 0:o.definition)==null?void 0:t.vendor){case"IKEA":n="https://ww8.ikea.com/ikeahomesmart/releasenotes/releasenotes.html";break;case"Inovelli":n="https://help.inovelli.com/en/articles/8503774-what-is-the-latest-firmware-version-for-your-device#h_b74c1e7dc6";break;case"Philips":n=`https://www.philips-hue.com/en-us/support/release-notes/${(m=o.definition)!=null&&m.exposes.find(b=>b.type==="light")?"lamps":"accessories"}`;break;case"Ubisys":n=`https://www.ubisys.de/en/support/firmware/change-logs-${(u=(r=o.definition)==null?void 0:r.model)==null?void 0:u.replace(/[-]/g,"").toLowerCase()}/`;break}return s.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:n,className:"link link-hover",children:a})});function Y(){const o=N(e=>e.devices),i=N(e=>e.deviceStates),{sendMessage:n}=l.useContext($),{t:a}=g(["ota","zigbee","common"]),[t,m]=l.useState([]);l.useEffect(()=>{m([])},[o]);const r=l.useMemo(()=>{var c;const e=[];for(const d of o)if((c=d.definition)!=null&&c.supports_ota&&!d.disabled){const p=i[d.friendly_name]??{};e.push({device:d,state:p.update,batteryState:d.power_source==="Battery"?{batteryPercent:p.battery,batteryState:p.battery_state,batteryLow:p.battery_low}:void 0,selected:t.includes(d.ieee_address)})}return e},[i,o,t]),u=l.useCallback(e=>{e.target.checked?m(r.map(({device:c})=>c.ieee_address)):m([])},[r]),b=l.useCallback((e,c)=>{m(c?[...t,e.ieee_address]:t.filter(d=>d!==e.ieee_address))},[t]),x=l.useCallback(async()=>{await Promise.allSettled(t.map(e=>n("bridge/request/device/ota_update/check",{id:e})))},[n,t]),_=l.useCallback(async()=>{await Promise.allSettled(t.map(e=>n("bridge/request/device/ota_update/update",{id:e})))},[n,t]),k=l.useCallback(async e=>await n("bridge/request/device/ota_update/check",{id:e}),[n]),C=l.useCallback(async e=>await n("bridge/request/device/ota_update/update",{id:e}),[n]),w=l.useCallback(async e=>await n("bridge/request/device/ota_update/schedule",{id:e}),[n]),v=l.useCallback(async e=>await n("bridge/request/device/ota_update/unschedule",{id:e}),[n]),F=l.useMemo(()=>[{id:"select",header:()=>s.jsx("label",{children:s.jsx("input",{type:"checkbox",className:"checkbox",onChange:u,defaultChecked:t.length===r.length})}),accessorFn:()=>"",cell:({row:{original:{device:e,selected:c}}})=>s.jsx("label",{children:s.jsx("input",{type:"checkbox",className:"checkbox",onChange:d=>b(e,d.target.checked),defaultChecked:c})}),enableColumnFilter:!1,enableSorting:!1},{header:a("common:friendly_name"),accessorFn:({device:e})=>[e.friendly_name,e.description,e.ieee_address].join(" "),cell:({row:{original:{device:e,state:c,batteryState:d}}})=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"avatar",children:s.jsx("div",{className:"h-12 w-12",style:{overflow:"visible"},children:s.jsx(M,{device:e,otaState:c==null?void 0:c.state,disabled:!1})})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx(L,{to:`/device/${e.ieee_address}/info`,className:"link link-hover",children:e.friendly_name}),e.friendly_name!==e.ieee_address&&s.jsx("div",{className:"text-xs opacity-80",title:a("zigbee:ieee_address"),children:e.ieee_address}),e.description&&s.jsx("div",{className:"text-xs opacity-50",children:e.description}),s.jsxs("div",{className:"flex flex-row gap-1 mt-2 my-1 items-center",children:[s.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default",title:a("zigbee:firmware_id"),children:[s.jsx(f,{icon:D}),s.jsx(q,{device:e}),e.date_code?s.jsxs("span",{title:a("zigbee:firmware_build_date"),children:[" (",e.date_code,")"]}):void 0]}),d&&s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default",children:s.jsx(B,{device:e,...d})})]})]})]})},{header:a("zigbee:model"),accessorFn:({device:e})=>{var c,d;return[(c=e.definition)==null?void 0:c.model,e.model_id,(d=e.definition)==null?void 0:d.vendor,e.manufacturer].join(" ")},cell:({row:{original:{device:e}}})=>s.jsxs(s.Fragment,{children:[s.jsx(E,{device:e}),s.jsxs("div",{children:[s.jsx("br",{}),s.jsx("span",{className:"badge badge-ghost",title:a("zigbee:manufacturer"),children:s.jsx(P,{device:e})})]})]})},{header:a("firmware_version"),accessorFn:({state:e})=>e==null?void 0:e.installed_version,cell:({row:{original:{state:e}}})=>s.jsx(S,{version:e==null?void 0:e.installed_version}),enableColumnFilter:!1},{header:a("available_firmware_version"),accessorFn:({state:e})=>e==null?void 0:e.latest_version,cell:({row:{original:{state:e}}})=>s.jsx(S,{version:e==null?void 0:e.latest_version}),enableColumnFilter:!1},{header:()=>s.jsxs("div",{className:"join join-vertical",children:[s.jsx(h,{className:"btn btn-error btn-xs join-item",onClick:x,title:a("check_selected"),modalDescription:a("common:dialog_confirmation_prompt"),modalCancelLabel:a("common:cancel"),disabled:t.length===0,children:a("check_selected")}),s.jsx(h,{className:"btn btn-error btn-xs join-item",onClick:_,title:a("update_selected"),modalDescription:a("update_selected_info"),modalCancelLabel:a("common:cancel"),disabled:t.length===0,children:a("update_selected")})]}),accessorFn:({state:e})=>e==null?void 0:e.state,id:"check_all",cell:({row:{original:{device:e,state:c}}})=>s.jsx(U,{device:e,state:c,onCheckClick:k,onUpdateClick:C,onScheduleClick:w,onUnscheduleClick:v}),enableSorting:!1,enableColumnFilter:!1}],[t.length,r.length,u,b,x,_,k,C,w,v,a]);return s.jsx(A,{id:"ota-devices",columns:F,data:r,pageSizeStoreKey:z})}export{Y as default};
1
+ import{r as l,b as g,j as s,B as y,I as h,F as f,K as j,a as N,W as $,L,O as D,Q as z}from"./index-vDL8KyrI.js";import{D as M}from"./DeviceImage-BpknBFw1.js";import{T as A}from"./Table-DDSIa7cd.js";import{M as E,V as P}from"./VendorLink-Q4mHbr9a.js";import{P as B}from"./PowerSource-DFW6CjuU.js";import"./index-C4Y7ujGQ.js";import"./DebouncedInput-DpBqTOhq.js";import"./snakeCase-B_0CeYWc.js";import"./_createCompounder-Bmfmbzn9.js";const O=l.memo(({label:o,remaining:i,progress:n})=>{if(i&&i>0){const a=Math.floor(i/3600),t=Math.floor(i/60)%60,m=Math.floor(i%60),r=a>0,u=t>0;return s.jsxs(s.Fragment,{children:[s.jsx("progress",{className:"progress w-48",value:n,max:"100"}),s.jsxs("div",{children:[o," ",`${r?`${a}:`:""}${u?`${t}:`:""}${m}`]})]})}return s.jsx("progress",{className:"progress w-48",value:n,max:"100"})}),U=l.memo(o=>{const{t:i}=g(["ota","common"]),{device:n,state:a,onCheckClick:t,onUpdateClick:m,onScheduleClick:r,onUnscheduleClick:u}=o;return a==null||a.state==="idle"?s.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[s.jsx(y,{className:"btn btn-primary btn-sm join-item",onClick:t,item:n.ieee_address,children:i("check")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]}):a.state==="updating"?s.jsx(O,{label:i("remaining_time"),remaining:a.remaining,progress:a.progress}):s.jsx("div",{className:"join join-vertical lg:join-horizontal",children:a.state==="available"?s.jsxs(s.Fragment,{children:[s.jsx(h,{className:"btn btn-error btn-sm join-item",onClick:m,item:n.ieee_address,title:i("update"),modalDescription:i("common:dialog_confirmation_prompt"),modalCancelLabel:i("common:cancel"),children:i("update")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]}):a.state==="scheduled"?s.jsx(h,{className:"btn btn-sm btn-error join-item",onClick:u,item:n.ieee_address,title:i("unschedule"),modalDescription:i("common:dialog_confirmation_prompt"),modalCancelLabel:i("common:cancel"),children:i("unschedule")}):s.jsxs(s.Fragment,{children:[s.jsx(y,{className:"btn btn-primary btn-sm join-item",onClick:t,item:n.ieee_address,children:i("check")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]})})}),S=l.memo(o=>{const{t:i}=g("ota"),n=l.useMemo(()=>{if(o.version==null)return;const a=o.version.toString(16).padStart(8,"0"),t=`${a[0]}.${a[1]}`,m=a.slice(2,4),r=`${a[4]}.${a[5]}`,u=a.slice(6);return[t,m,r,u]},[o.version]);return n===void 0?s.jsx(s.Fragment,{children:"Unknown"}):s.jsxs("div",{className:"join join-vertical",children:[s.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default join-item w-full",children:[i("app"),": ",`${n[0]} build ${n[1]}`]}),s.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default join-item w-full",children:[i("stack"),": ",`${n[2]} build ${n[3]}`]})]})}),q=l.memo(({device:o})=>{var t,m,r,u;const{t:i}=g("zigbee");let n="https://github.com/Koenkk/zigbee-OTA/releases";const a=o.software_build_id||i("unknown");switch((t=o==null?void 0:o.definition)==null?void 0:t.vendor){case"IKEA":n="https://ww8.ikea.com/ikeahomesmart/releasenotes/releasenotes.html";break;case"Inovelli":n="https://help.inovelli.com/en/articles/8503774-what-is-the-latest-firmware-version-for-your-device#h_b74c1e7dc6";break;case"Philips":n=`https://www.philips-hue.com/en-us/support/release-notes/${(m=o.definition)!=null&&m.exposes.find(b=>b.type==="light")?"lamps":"accessories"}`;break;case"Ubisys":n=`https://www.ubisys.de/en/support/firmware/change-logs-${(u=(r=o.definition)==null?void 0:r.model)==null?void 0:u.replace(/[-]/g,"").toLowerCase()}/`;break}return s.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:n,className:"link link-hover",children:a})});function Y(){const o=N(e=>e.devices),i=N(e=>e.deviceStates),{sendMessage:n}=l.useContext($),{t:a}=g(["ota","zigbee","common"]),[t,m]=l.useState([]);l.useEffect(()=>{m([])},[o]);const r=l.useMemo(()=>{var c;const e=[];for(const d of o)if((c=d.definition)!=null&&c.supports_ota&&!d.disabled){const p=i[d.friendly_name]??{};e.push({device:d,state:p.update,batteryState:d.power_source==="Battery"?{batteryPercent:p.battery,batteryState:p.battery_state,batteryLow:p.battery_low}:void 0,selected:t.includes(d.ieee_address)})}return e},[i,o,t]),u=l.useCallback(e=>{e.target.checked?m(r.map(({device:c})=>c.ieee_address)):m([])},[r]),b=l.useCallback((e,c)=>{m(c?[...t,e.ieee_address]:t.filter(d=>d!==e.ieee_address))},[t]),x=l.useCallback(async()=>{await Promise.allSettled(t.map(e=>n("bridge/request/device/ota_update/check",{id:e})))},[n,t]),_=l.useCallback(async()=>{await Promise.allSettled(t.map(e=>n("bridge/request/device/ota_update/update",{id:e})))},[n,t]),k=l.useCallback(async e=>await n("bridge/request/device/ota_update/check",{id:e}),[n]),C=l.useCallback(async e=>await n("bridge/request/device/ota_update/update",{id:e}),[n]),w=l.useCallback(async e=>await n("bridge/request/device/ota_update/schedule",{id:e}),[n]),v=l.useCallback(async e=>await n("bridge/request/device/ota_update/unschedule",{id:e}),[n]),F=l.useMemo(()=>[{id:"select",header:()=>s.jsx("label",{children:s.jsx("input",{type:"checkbox",className:"checkbox",onChange:u,defaultChecked:t.length===r.length})}),accessorFn:()=>"",cell:({row:{original:{device:e,selected:c}}})=>s.jsx("label",{children:s.jsx("input",{type:"checkbox",className:"checkbox",onChange:d=>b(e,d.target.checked),defaultChecked:c})}),enableColumnFilter:!1,enableSorting:!1},{header:a("common:friendly_name"),accessorFn:({device:e})=>[e.friendly_name,e.description,e.ieee_address].join(" "),cell:({row:{original:{device:e,state:c,batteryState:d}}})=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"avatar",children:s.jsx("div",{className:"h-12 w-12",style:{overflow:"visible"},children:s.jsx(M,{device:e,otaState:c==null?void 0:c.state,disabled:!1})})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx(L,{to:`/device/${e.ieee_address}/info`,className:"link link-hover",children:e.friendly_name}),e.friendly_name!==e.ieee_address&&s.jsx("div",{className:"text-xs opacity-80",title:a("zigbee:ieee_address"),children:e.ieee_address}),e.description&&s.jsx("div",{className:"text-xs opacity-50",children:e.description}),s.jsxs("div",{className:"flex flex-row gap-1 mt-2 my-1 items-center",children:[s.jsxs("span",{className:"badge badge-soft badge-ghost cursor-default",title:a("zigbee:firmware_id"),children:[s.jsx(f,{icon:D}),s.jsx(q,{device:e}),e.date_code?s.jsxs("span",{title:a("zigbee:firmware_build_date"),children:[" (",e.date_code,")"]}):void 0]}),d&&s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default",children:s.jsx(B,{device:e,...d})})]})]})]})},{header:a("zigbee:model"),accessorFn:({device:e})=>{var c,d;return[(c=e.definition)==null?void 0:c.model,e.model_id,(d=e.definition)==null?void 0:d.vendor,e.manufacturer].join(" ")},cell:({row:{original:{device:e}}})=>s.jsxs(s.Fragment,{children:[s.jsx(E,{device:e}),s.jsxs("div",{children:[s.jsx("br",{}),s.jsx("span",{className:"badge badge-ghost",title:a("zigbee:manufacturer"),children:s.jsx(P,{device:e})})]})]})},{header:a("firmware_version"),accessorFn:({state:e})=>e==null?void 0:e.installed_version,cell:({row:{original:{state:e}}})=>s.jsx(S,{version:e==null?void 0:e.installed_version}),enableColumnFilter:!1},{header:a("available_firmware_version"),accessorFn:({state:e})=>e==null?void 0:e.latest_version,cell:({row:{original:{state:e}}})=>s.jsx(S,{version:e==null?void 0:e.latest_version}),enableColumnFilter:!1},{header:()=>s.jsxs("div",{className:"join join-vertical",children:[s.jsx(h,{className:"btn btn-error btn-xs join-item",onClick:x,title:a("check_selected"),modalDescription:a("common:dialog_confirmation_prompt"),modalCancelLabel:a("common:cancel"),disabled:t.length===0,children:a("check_selected")}),s.jsx(h,{className:"btn btn-error btn-xs join-item",onClick:_,title:a("update_selected"),modalDescription:a("update_selected_info"),modalCancelLabel:a("common:cancel"),disabled:t.length===0,children:a("update_selected")})]}),accessorFn:({state:e})=>e==null?void 0:e.state,id:"check_all",cell:({row:{original:{device:e,state:c}}})=>s.jsx(U,{device:e,state:c,onCheckClick:k,onUpdateClick:C,onScheduleClick:w,onUnscheduleClick:v}),enableSorting:!1,enableColumnFilter:!1}],[t.length,r.length,u,b,x,_,k,C,w,v,a]);return s.jsx(A,{id:"ota-devices",columns:F,data:r,pageSizeStoreKey:z})}export{Y as default};
@@ -1 +1 @@
1
- import{r as j,b as d,j as t,F as c,bA as g,aC as B,bB as E,bb as P,bs as f,bt as k,bu as x,bv as F,bl as b}from"./index-CwJt2ZPU.js";import{s as p}from"./snakeCase-E1FSY3OI.js";const N=j.memo(w=>{const{device:s,batteryPercent:a,batteryState:m,batteryLow:u,showLevel:h,...n}=w,{t:o}=d("zigbee");let r;switch(s!=null&&s.power_source&&(r=s.power_source),r){case"Battery":{let y=o("battery"),l="",e=f,i=!1;if(a!=null)if(l=`${a}%`,a>=85)e=f;else if(a>=65)e=k;else if(a>=40)e=x;else if(a>=20)e=F;else if(a>=10)e=b,i=!0;else return t.jsxs("span",{className:"animate-pulse text-error",role:"alert",children:[a,"%"]});else if(m!=null)switch(l=m,m){case"high":e=f;break;case"medium":e=x;break;case"low":e=b,i=!0;break}else u!=null&&(l=u?"low":"ok",e=u?b:f);return u===!0&&(i=!0),l!==""&&(y+=`, ${o("power_level")}: ${l}`),t.jsxs(t.Fragment,{children:[t.jsx(c,{icon:e,fade:i,title:y,className:i?"text-error":"",...n}),h&&t.jsx("span",{className:"ps-2",children:l})]})}case"Mains (single phase)":case"Mains (3 phase)":case"DC Source":return t.jsx(c,{icon:P,title:o(p(r)),...n});case"Emergency mains and transfer switch":case"Emergency mains constantly powered":return t.jsx(c,{icon:E,title:o(p(r)),...n});default:return(s==null?void 0:s.type)==="GreenPower"?t.jsx(c,{icon:g,title:"Green",...n}):t.jsx(c,{icon:B,title:r?o(p(r)):void 0,...n})}});export{N as P};
1
+ import{r as j,b as d,j as t,F as c,bA as g,aC as B,bB as E,bb as P,bs as f,bt as k,bu as x,bv as F,bl as b}from"./index-vDL8KyrI.js";import{s as p}from"./snakeCase-B_0CeYWc.js";const N=j.memo(w=>{const{device:s,batteryPercent:a,batteryState:m,batteryLow:u,showLevel:h,...n}=w,{t:o}=d("zigbee");let r;switch(s!=null&&s.power_source&&(r=s.power_source),r){case"Battery":{let y=o("battery"),l="",e=f,i=!1;if(a!=null)if(l=`${a}%`,a>=85)e=f;else if(a>=65)e=k;else if(a>=40)e=x;else if(a>=20)e=F;else if(a>=10)e=b,i=!0;else return t.jsxs("span",{className:"animate-pulse text-error",role:"alert",children:[a,"%"]});else if(m!=null)switch(l=m,m){case"high":e=f;break;case"medium":e=x;break;case"low":e=b,i=!0;break}else u!=null&&(l=u?"low":"ok",e=u?b:f);return u===!0&&(i=!0),l!==""&&(y+=`, ${o("power_level")}: ${l}`),t.jsxs(t.Fragment,{children:[t.jsx(c,{icon:e,fade:i,title:y,className:i?"text-error":"",...n}),h&&t.jsx("span",{className:"ps-2",children:l})]})}case"Mains (single phase)":case"Mains (3 phase)":case"DC Source":return t.jsx(c,{icon:P,title:o(p(r)),...n});case"Emergency mains and transfer switch":case"Emergency mains constantly powered":return t.jsx(c,{icon:E,title:o(p(r)),...n});default:return(s==null?void 0:s.type)==="GreenPower"?t.jsx(c,{icon:g,title:"Green",...n}):t.jsx(c,{icon:B,title:r?o(p(r)):void 0,...n})}});export{N as P};