homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
1 lines • 542 kB
JavaScript
import{a as Gn}from"./chunk-KSBQEY44.js";import{a as jn,b as Wn}from"./chunk-KZE2OTCD.js";import{t as Un,u as si}from"./chunk-SMGTZ45N.js";import{a as Fn}from"./chunk-GAHGBZ7U.js";import{A as Hn,B as Rn,C as $n,g as On,k as In,l as Ln,m as Vn,n as Nn}from"./chunk-NAG4LCT2.js";import{s as ai,t as oe}from"./chunk-2QHNXSQY.js";import{a as ri}from"./chunk-VYTJCKZA.js";import{a as ot}from"./chunk-IL6HHVES.js";import{d as bn}from"./chunk-LKBXKG4K.js";import{C as fe,a as Bn,b as wn,c as En,e as ve,l as he,t as Dn,u as An,w as Pn}from"./chunk-BQZ376DP.js";import{b as Ee}from"./chunk-RFCSHRPV.js";import{$c as oi,A as dn,Bc as K,Dc as Ge,Ea as o,Fc as Tn,G as pn,Gc as Ie,Jb as gt,Kb as M,La as _n,Lb as vt,Ma as ti,Mb as d,Nb as S,Ob as f,P as mn,Pb as W,Q as un,Qa as ne,Qb as tt,R as Ut,Ra as w,Rb as kn,Sb as Et,Ta as xn,Tb as Z,Ua as lt,Ub as J,Vb as X,W as fn,Wa as ce,Wb as I,X as Xt,Xb as Ve,Yb as Te,Yc as ni,Zb as Mn,Zc as A,_ as ei,_b as Oe,aa as P,ab as T,cb as v,d as te,da as ie,db as h,dc as s,ec as l,fa as L,fb as ct,fc as ue,ga as V,gb as ze,ha as R,hb as Ye,ia as $,ib as B,jb as c,kb as p,la as ft,lb as g,lc as re,mb as C,na as kt,nb as _,o as ln,oa as gn,ob as H,oc as Ai,pb as yn,pc as O,qa as Ue,qb as Sn,ra as vn,sa as hn,sc as ii,ta as le,va as Cn,vb as G,wb as Fe,x as cn,xb as k,y as Jt,yb as xe,za as Qe,zb as u}from"./chunk-LTGI3NYM.js";import{a as at,b as st,h as pe}from"./chunk-B4AJQJMI.js";var qn={AccessoryFlags:{1:"REQUIRES_ADDITIONAL_SETUP_BIT_MASK"},Active:{0:"INACTIVE",1:"ACTIVE"},AirParticulateSize:{0:"_2_5_M",1:"_10_M"},AirQuality:{0:"UNKNOWN",1:"EXCELLENT",2:"GOOD",3:"FAIR",4:"INFERIOR",5:"POOR"},CameraOperatingModeIndicator:{0:"DISABLE",1:"ENABLE"},CarbonDioxideDetected:{0:"CO2_LEVELS_NORMAL",1:"CO2_LEVELS_ABNORMAL"},CarbonMonoxideDetected:{0:"CO_LEVELS_NORMAL",1:"CO_LEVELS_ABNORMAL"},ChargingState:{0:"NOT_CHARGING",1:"CHARGING",2:"NOT_CHARGEABLE"},ClosedCaptions:{0:"DISABLED",1:"ENABLED"},ContactSensorState:{0:"CONTACT_DETECTED",1:"CONTACT_NOT_DETECTED"},CurrentAirPurifierState:{0:"INACTIVE",1:"IDLE",2:"PURIFYING_AIR"},CurrentDoorState:{0:"OPEN",1:"CLOSED",2:"OPENING",3:"CLOSING",4:"STOPPED"},CurrentFanState:{0:"INACTIVE",1:"IDLE",2:"BLOWING_AIR"},CurrentHeaterCoolerState:{0:"INACTIVE",1:"IDLE",2:"HEATING",3:"COOLING"},CurrentHeatingCoolingState:{0:"OFF",1:"HEAT",2:"COOL"},CurrentHumidifierDehumidifierState:{0:"INACTIVE",1:"IDLE",2:"HUMIDIFYING",3:"DEHUMIDIFYING"},CurrentMediaState:{0:"PLAY",1:"PAUSE",2:"STOP",4:"LOADING",5:"INTERRUPTED"},CurrentSlatState:{0:"FIXED",1:"JAMMED",2:"SWINGING"},CurrentVisibilityState:{0:"SHOWN",1:"HIDDEN"},EventSnapshotsActive:{0:"DISABLE",1:"ENABLE"},FilterChangeIndication:{0:"FILTER_OK",1:"CHANGE_FILTER"},HomeKitCameraActive:{0:"OFF",1:"ON"},InputDeviceType:{0:"OTHER",1:"TV",2:"RECORDING",3:"TUNER",4:"PLAYBACK",5:"AUDIO_SYSTEM"},InputSourceType:{0:"OTHER",1:"HOME_SCREEN",2:"TUNER",3:"HDMI",4:"COMPOSITE_VIDEO",5:"S_VIDEO",6:"COMPONENT_VIDEO",7:"DVI",8:"AIRPLAY",9:"USB",10:"APPLICATION"},InUse:{0:"NOT_IN_USE",1:"IN_USE"},IsConfigured:{0:"NOT_CONFIGURED",1:"CONFIGURED"},LeakDetected:{0:"LEAK_NOT_DETECTED",1:"LEAK_DETECTED"},LockCurrentState:{0:"UNSECURED",1:"SECURED",2:"JAMMED",3:"UNKNOWN"},LockLastKnownAction:{0:"SECURED_PHYSICALLY_INTERIOR",1:"UNSECURED_PHYSICALLY_INTERIOR",2:"SECURED_PHYSICALLY_EXTERIOR",3:"UNSECURED_PHYSICALLY_EXTERIOR",4:"SECURED_BY_KEYPAD",5:"UNSECURED_BY_KEYPAD",6:"SECURED_REMOTELY",7:"UNSECURED_REMOTELY",8:"SECURED_BY_AUTO_SECURE_TIMEOUT",9:"SECURED_PHYSICALLY",10:"UNSECURED_PHYSICALLY"},LockPhysicalControls:{0:"CONTROL_LOCK_DISABLED",1:"CONTROL_LOCK_ENABLED"},LockTargetState:{0:"UNSECURED",1:"SECURED"},ManagedNetworkEnable:{0:"DISABLED",1:"ENABLED"},ManuallyDisabled:{0:"ENABLED",1:"DISABLED"},OccupancyDetected:{0:"OCCUPANCY_NOT_DETECTED",1:"OCCUPANCY_DETECTED"},PeriodicSnapshotsActive:{0:"DISABLE",1:"ENABLE"},PictureMode:{0:"OTHER",1:"STANDARD",2:"CALIBRATED",3:"CALIBRATED_DARK",4:"VIVID",5:"GAME",6:"COMPUTER",7:"CUSTOM"},PositionState:{0:"DECREASING",1:"INCREASING",2:"STOPPED"},PowerModeSelection:{0:"SHOW",1:"HIDE"},ProgrammableSwitchEvent:{0:"SINGLE_PRESS",1:"DOUBLE_PRESS",2:"LONG_PRESS"},ProgramMode:{0:"NO_PROGRAM_SCHEDULED",1:"PROGRAM_SCHEDULED",2:"PROGRAM_SCHEDULED_MANUAL_MODE"},RecordingAudioActive:{0:"DISABLE",1:"ENABLE"},RemoteKey:{0:"REWIND",1:"FAST_FORWARD",2:"NEXT_TRACK",3:"PREVIOUS_TRACK",4:"ARROW_UP",5:"ARROW_DOWN",6:"ARROW_LEFT",7:"ARROW_RIGHT",8:"SELECT",9:"BACK",10:"EXIT",11:"PLAY_PAUSE",15:"INFORMATION"},RotationDirection:{0:"CLOCKWISE",1:"COUNTER_CLOCKWISE"},RouterStatus:{0:"READY",1:"NOT_READY"},SecuritySystemAlarmType:{0:"NO_ALARM",1:"UNKNOWN"},SecuritySystemCurrentState:{0:"STAY_ARM",1:"AWAY_ARM",2:"NIGHT_ARM",3:"DISARMED",4:"ALARM_TRIGGERED"},SecuritySystemTargetState:{0:"STAY_ARM",1:"AWAY_ARM",2:"NIGHT_ARM",3:"DISARM"},ServiceLabelNamespace:{0:"DOTS",1:"ARABIC_NUMERALS"},SiriInputType:{0:"PUSH_BUTTON_TRIGGERED_APPLE_TV"},SlatType:{0:"HORIZONTAL",1:"VERTICAL"},SleepDiscoveryMode:{0:"NOT_DISCOVERABLE",1:"ALWAYS_DISCOVERABLE"},SmokeDetected:{0:"SMOKE_NOT_DETECTED",1:"SMOKE_DETECTED"},StatusFault:{0:"NO_FAULT",1:"GENERAL_FAULT"},StatusJammed:{0:"NOT_JAMMED",1:"JAMMED"},StatusLowBattery:{0:"BATTERY_LEVEL_NORMAL",1:"BATTERY_LEVEL_LOW"},StatusTampered:{0:"NOT_TAMPERED",1:"TAMPERED"},SwingMode:{0:"SWING_DISABLED",1:"SWING_ENABLED"},TargetAirPurifierState:{0:"MANUAL",1:"AUTO"},TargetDoorState:{0:"OPEN",1:"CLOSED"},TargetFanState:{0:"MANUAL",1:"AUTO"},TargetHeaterCoolerState:{0:"AUTO",1:"HEAT",2:"COOL"},TargetHeatingCoolingState:{0:"OFF",1:"HEAT",2:"COOL",3:"AUTO"},TargetHumidifierDehumidifierState:{0:"HUMIDIFIER_OR_DEHUMIDIFIER",1:"HUMIDIFIER",2:"DEHUMIDIFIER"},TargetMediaState:{0:"PLAY",1:"PAUSE",2:"STOP"},TargetVisibilityState:{0:"SHOWN",1:"HIDDEN"},TemperatureDisplayUnits:{0:"CELSIUS",1:"FAHRENHEIT"},ThirdPartyCameraActive:{0:"OFF",1:"ON"},ValveType:{0:"GENERIC_VALVE",1:"IRRIGATION",2:"SHOWER_HEAD",3:"WATER_FAUCET"},VolumeControlType:{0:"NONE",1:"RELATIVE",2:"RELATIVE_WITH_CURRENT",3:"ABSOLUTE"},VolumeSelector:{0:"INCREMENT",1:"DECREMENT"},WiFiSatelliteStatus:{0:"UNKNOWN",1:"CONNECTED",2:"NOT_CONNECTED"}};var ht=(()=>{class t{transform(e){if(typeof e!="number")return e;let n=1e6/e,i=Math.round(e),a=Math.round(n);return`${i}M (${a}K)`}static \u0275fac=function(n){return new(n||t)};static \u0275pipe=lt({name:"convertMired",type:t,pure:!0})}return t})();var Re=(()=>{class t{$settings=P(Ee);transform(e,n=this.$settings.env.temperatureUnits){return n==="f"?Math.round((e*1.8+32)*10)/10:Math.round(e*10)/10}static \u0275fac=function(n){return new(n||t)};static \u0275pipe=lt({name:"convertTemp",type:t,pure:!0})}return t})();var zn=(()=>{class t{transform(e){return typeof e!="string"?e:e.replace(On," ").replace(Vn,"$1 $2").toLowerCase().replace(Nn,n=>n.toUpperCase()).trim()}static \u0275fac=function(n){return new(n||t)};static \u0275pipe=lt({name:"prettify",type:t,pure:!0})}return t})();var Yn=(()=>{class t{transform(e){return typeof e!="string"||!e?e:`accessories.core.${e.replace(In,i=>i.toLowerCase()).replace(Ln,i=>`_${i.toLowerCase()}`)}`}static \u0275fac=function(n){return new(n||t)};static \u0275pipe=lt({name:"serviceToTranslationString",type:t,pure:!0})}return t})();var V0=(t,r)=>r.name,N0=(t,r)=>r.key;function H0(t,r){t&1&&(d(0),s(1,"translate")),t&2&&f(" (",l(1,1,"settings.display.menu_default"),") ")}function R0(t,r){if(t&1&&(c(0,"option",30),d(1),s(2,"serviceToTranslationString"),s(3,"translate"),v(4,H0,2,3),p()),t&2){let e=r.$implicit,n=u(2);B("value",e),o(),f(" ",l(3,5,l(2,3,e))," "),o(3),h(n.isDefaultType(e)?4:-1)}}function $0(t,r){if(t&1){let e=G();c(0,"li",8)(1,"label",28),d(2),s(3,"translate"),p(),c(4,"div",10)(5,"select",29),X("ngModelChange",function(i){L(e);let a=u();return J(a.localService.customType,i)||(a.localService.customType=i),V(i)}),ze(6,R0,5,7,"option",30,ct),p()()()}if(t&2){let e=u();o(2),S(l(3,2,"accessories.custom_type")),o(3),Z("ngModel",e.localService.customType),o(),Ye(e.customTypeList.sort())}}function U0(t,r){if(t&1){let e=G();c(0,"li",12)(1,"span",13),d(2),s(3,"translate"),p(),c(4,"div",14)(5,"input",31),s(6,"translate"),X("ngModelChange",function(i){L(e);let a=u();return J(a.localService.onDashboard,i)||(a.localService.onDashboard=i),V(i)}),k("ngModelChange",function(){L(e);let i=u();return V(i.onDashboardChange())}),p(),g(7,"label",32),p()()}if(t&2){let e=u();o(2),S(l(3,3,"accessories.show_on_dashboard")),o(3),Z("ngModel",e.localService.onDashboard),T("aria-label",l(6,5,"accessories.show_on_dashboard"))}}function j0(t,r){if(t&1&&(c(0,"small"),d(1),p()),t&2){let e=u().$implicit,n=u(3);o(),S(n.JSON.stringify(e.value,null,2))}}function W0(t,r){if(t&1&&d(0),t&2){let e=u().$implicit;f(" ",e.value," ")}}function G0(t,r){if(t&1&&(c(0,"li",34)(1,"span",35),d(2),s(3,"prettify"),p(),c(4,"span",22),v(5,j0,2,1,"small")(6,W0,1,1),p()()),t&2){let e=r.$implicit;o(2),S(l(3,2,e.key)),o(3),h(typeof e.value=="object"?5:6)}}function q0(t,r){if(t&1&&(c(0,"li",18)(1,"span",33),d(2),s(3,"prettify"),p()(),ze(4,G0,7,4,"li",34,N0),s(6,"keyvalue")),t&2){let e=r.$implicit;o(2),S(l(3,1,e.name)),o(2),Ye(l(6,3,e.attributes))}}function z0(t,r){if(t&1&&(c(0,"li",18)(1,"h6",19),d(2),s(3,"translate"),p()(),ze(4,q0,7,5,null,null,V0)),t&2){let e=u();o(2),S(l(3,1,"accessories.service_info")),o(2),Ye(e.clusterInfo)}}function Y0(t,r){if(t&1){let e=G();c(0,"span",42),k("click",function(){L(e);let i=u().$implicit,a=u(2);return V(a.toggleDetailsVisibility(i))})("keydown.enter",function(){L(e);let i=u().$implicit,a=u(2);return V(a.toggleDetailsVisibility(i))}),d(1),p()}if(t&2){let e=u().$implicit,n=u(2);T("aria-expanded",n.isDetailsVisible[e.uuid]),o(),S(e.description)}}function K0(t,r){if(t&1&&(c(0,"span",38),d(1),p()),t&2){let e=u().$implicit;o(),S(e.description)}}function Q0(t,r){if(t&1&&(c(0,"div"),d(1),p()),t&2){let e=u(2).$implicit;o(),f("Step: ",e.minStep)}}function Z0(t,r){if(t&1&&(c(0,"div"),d(1),p()),t&2){let e=u(2).$implicit;o(),f("Min: ",e.minValue)}}function J0(t,r){if(t&1&&(c(0,"div"),d(1),p()),t&2){let e=u(2).$implicit;o(),f("Max: ",e.maxValue)}}function X0(t,r){t&1&&d(0," \xB7 ")}function ea(t,r){if(t&1&&(d(0),v(1,X0,1,0)),t&2){let e=r.$implicit,n=r.$index,i=r.$count;f(" ",e," "),o(),h(n!==i-1?1:-1)}}function ta(t,r){if(t&1&&(c(0,"div"),d(1," Valid: "),ze(2,ea,2,2,null,null,ct),p()),t&2){let e=u(2).$implicit;o(2),Ye(e.validValues)}}function ia(t,r){if(t&1&&(c(0,"div",39),v(1,Q0,2,1,"div"),v(2,Z0,2,1,"div"),v(3,J0,2,1,"div"),v(4,ta,4,0,"div"),p()),t&2){let e=u().$implicit;o(),h("minStep"in e?1:-1),o(),h("minValue"in e?2:-1),o(),h("maxValue"in e?3:-1),o(),h("validValues"in e?4:-1)}}function na(t,r){t&1&&d(0," Value: ")}function oa(t,r){if(t&1&&d(0),t&2){let e=u().$implicit;f(" ",e.value,"% ")}}function ra(t,r){if(t&1&&(d(0),s(1,"convertTemp")),t&2){let e=u().$implicit,n=u(2);f(" ",l(1,1,n.Number(e.value)),"\xB0 ")}}function aa(t,r){if(t&1&&(d(0),s(1,"convertMired")),t&2){let e=u(2).$implicit;f(" ",l(1,1,e.value)," ")}}function sa(t,r){if(t&1&&d(0),t&2){let e=u(2).$implicit;f(" ",e.value," ")}}function la(t,r){if(t&1&&v(0,aa,2,3)(1,sa,1,1),t&2){let e,n=u().$implicit;h((e=n.type)==="ColorTemperature"?0:1)}}function ca(t,r){if(t&1&&(d(0),s(1,"prettify")),t&2){let e=u().$implicit,n=u(2);f(" (",l(1,1,n.getEnumLabel(e.type,e.value)),") ")}}function da(t,r){if(t&1&&(d(0),s(1,"translate")),t&2){let e=u().$implicit;f(" (",l(1,1,e.value?"status.widget.info.yes":"status.widget.info.no"),") ")}}function pa(t,r){if(t&1&&d(0),t&2){let e=u().$implicit;f(" ",e.value,"% ")}}function ma(t,r){if(t&1&&(d(0),s(1,"convertTemp")),t&2){let e=u().$implicit,n=u(2);f(" ",l(1,1,n.Number(e.value)),"\xB0 ")}}function ua(t,r){if(t&1&&(d(0),s(1,"convertMired")),t&2){let e=u(2).$implicit;f(" ",l(1,1,e.value)," ")}}function fa(t,r){if(t&1&&d(0),t&2){let e=u(2).$implicit;f(" ",e.value," ")}}function ga(t,r){if(t&1&&v(0,ua,2,3)(1,fa,1,1),t&2){let e,n=u().$implicit;h((e=n.type)==="ColorTemperature"?0:1)}}function va(t,r){if(t&1&&(d(0),s(1,"prettify")),t&2){let e=u().$implicit,n=u(2);f(" (",l(1,1,n.getEnumLabel(e.type,e.value)),") ")}}function ha(t,r){if(t&1&&(d(0),s(1,"translate")),t&2){let e=u().$implicit;f(" (",l(1,1,e.value?"status.widget.info.yes":"status.widget.info.no"),") ")}}function Ca(t,r){if(t&1&&(c(0,"li",20)(1,"span",36),v(2,Y0,2,2,"span",37)(3,K0,2,1,"span",38),v(4,ia,5,4,"div",39),c(5,"div",40),v(6,na,1,0),v(7,oa,1,1)(8,ra,2,3)(9,la,2,1),v(10,ca,2,3)(11,da,2,3),p()(),c(12,"span",41),v(13,pa,1,1)(14,ma,2,3)(15,ga,2,1),v(16,va,2,3)(17,ha,2,3),p()()),t&2){let e,n,i=r.$implicit,a=u(2);o(2),h("minStep"in i||"minValue"in i||"maxValue"in i||"validValues"in i?2:3),o(2),h(a.isDetailsVisible[i.uuid]?4:-1),o(2),h(a.isDetailsVisible[i.uuid]?6:-1),o(),h((e=i.unit)==="percentage"?7:e==="celsius"?8:9),o(3),h(a.getEnumLabel(i.type,i.value)?10:i.format==="bool"?11:-1),o(3),h((n=i.unit)==="percentage"?13:n==="celsius"?14:15),o(3),h(a.getEnumLabel(i.type,i.value)?16:i.format==="bool"?17:-1)}}function _a(t,r){if(t&1&&(c(0,"li",18)(1,"h6",19),d(2),s(3,"translate"),p()(),c(4,"li",20)(5,"span",21),d(6),s(7,"translate"),p(),c(8,"span",22),d(9),p()(),c(10,"li",20)(11,"span",21),d(12),s(13,"translate"),p(),c(14,"span",22),d(15),p()(),ze(16,Ca,18,7,"li",20,ct)),t&2){let e=u();o(2),S(l(3,5,"accessories.service_info")),o(4),S(l(7,7,"accessories.service")),o(3),S(e.localService.humanType),o(3),S(l(13,9,"accessories.name")),o(3),S(e.localService.serviceName),o(),Ye(e.localService.serviceCharacteristics)}}function xa(t,r){if(t&1){let e=G();c(0,"span",44),k("click",function(){L(e);let i=u().$implicit,a=u(2);return V(a.toggleDetailsVisibility(i))})("keydown.enter",function(){L(e);let i=u().$implicit,a=u(2);return V(a.toggleDetailsVisibility(i))}),d(1),p()}if(t&2){let e=u().$implicit,n=u(2);T("aria-expanded",n.isDetailsVisible[e.uuid]),o(),S(e.description)}}function ya(t,r){if(t&1&&d(0),t&2){let e=u().$implicit;f(" ",e.description," ")}}function Sa(t,r){if(t&1&&(c(0,"div"),d(1),p()),t&2){let e=u(2).$implicit;o(),f("Step: ",e.minStep)}}function ka(t,r){if(t&1&&(c(0,"div"),d(1),p()),t&2){let e=u(2).$implicit;o(),f("Min: ",e.minValue)}}function Ma(t,r){if(t&1&&(c(0,"div"),d(1),p()),t&2){let e=u(2).$implicit;o(),f("Max: ",e.maxValue)}}function Ta(t,r){t&1&&d(0," \xB7 ")}function ba(t,r){if(t&1&&(d(0),v(1,Ta,1,0)),t&2){let e=r.$implicit,n=r.$index,i=r.$count;f(" ",e," "),o(),h(n!==i-1?1:-1)}}function Ba(t,r){if(t&1&&(c(0,"div"),d(1," Valid: "),ze(2,ba,2,2,null,null,ct),p()),t&2){let e=u(2).$implicit;o(2),Ye(e.validValues)}}function wa(t,r){if(t&1&&(c(0,"div",39),v(1,Sa,2,1,"div"),v(2,ka,2,1,"div"),v(3,Ma,2,1,"div"),v(4,Ba,4,0,"div"),p()),t&2){let e=u().$implicit;o(),h("minStep"in e?1:-1),o(),h("minValue"in e?2:-1),o(),h("maxValue"in e?3:-1),o(),h("validValues"in e?4:-1)}}function Ea(t,r){t&1&&d(0," Value: ")}function Da(t,r){if(t&1&&d(0),t&2){let e=u().$implicit;f(" ",e.value,"% ")}}function Aa(t,r){if(t&1&&(d(0),s(1,"convertTemp")),t&2){let e=u().$implicit,n=u(2);f(" ",l(1,1,n.Number(e.value)),"\xB0 ")}}function Pa(t,r){if(t&1&&(d(0),s(1,"convertMired")),t&2){let e=u(2).$implicit;f(" ",l(1,1,e.value)," ")}}function Fa(t,r){if(t&1&&d(0),t&2){let e=u(2).$implicit;f(" ",e.value," ")}}function Oa(t,r){if(t&1&&v(0,Pa,2,3)(1,Fa,1,1),t&2){let e,n=u().$implicit;h((e=n.type)==="ColorTemperature"?0:1)}}function Ia(t,r){if(t&1&&(d(0),s(1,"prettify")),t&2){let e=u().$implicit,n=u(2);f(" (",l(1,1,n.getEnumLabel(e.type,e.value)),") ")}}function La(t,r){if(t&1&&(d(0),s(1,"translate")),t&2){let e=u().$implicit;f(" (",l(1,1,e.value?"status.widget.info.yes":"status.widget.info.no"),") ")}}function Va(t,r){if(t&1&&d(0),t&2){let e=u().$implicit;f(" ",e.value,"% ")}}function Na(t,r){if(t&1&&(d(0),s(1,"convertTemp")),t&2){let e=u().$implicit,n=u(2);f(" ",l(1,1,n.Number(e.value)),"\xB0 ")}}function Ha(t,r){if(t&1&&(d(0),s(1,"convertMired")),t&2){let e=u(2).$implicit;f(" ",l(1,1,e.value)," ")}}function Ra(t,r){if(t&1&&d(0),t&2){let e=u(2).$implicit;f(" ",e.value," ")}}function $a(t,r){if(t&1&&v(0,Ha,2,3)(1,Ra,1,1),t&2){let e,n=u().$implicit;h((e=n.type)==="ColorTemperature"?0:1)}}function Ua(t,r){if(t&1&&(d(0),s(1,"prettify")),t&2){let e=u().$implicit,n=u(2);f(" (",l(1,1,n.getEnumLabel(e.type,e.value)),") ")}}function ja(t,r){if(t&1&&(d(0),s(1,"translate")),t&2){let e=u().$implicit;f(" (",l(1,1,e.value?"status.widget.info.yes":"status.widget.info.no"),") ")}}function Wa(t,r){if(t&1&&(c(0,"li",20)(1,"span"),v(2,xa,2,2,"span",43)(3,ya,1,1),v(4,wa,5,4,"div",39),c(5,"div",40),v(6,Ea,1,0),v(7,Da,1,1)(8,Aa,2,3)(9,Oa,2,1),v(10,Ia,2,3)(11,La,2,3),p()(),c(12,"span",41),v(13,Va,1,1)(14,Na,2,3)(15,$a,2,1),v(16,Ua,2,3)(17,ja,2,3),p()()),t&2){let e,n,i=r.$implicit,a=u(2);o(2),h("minStep"in i||"minValue"in i||"maxValue"in i||"validValues"in i?2:3),o(2),h(a.isDetailsVisible[i.uuid]?4:-1),o(2),h(a.isDetailsVisible[i.uuid]?6:-1),o(),h((e=i.unit)==="percentage"?7:e==="celsius"?8:9),o(3),h(a.getEnumLabel(i.type,i.value)?10:i.format==="bool"?11:-1),o(3),h((n=i.unit)==="percentage"?13:n==="celsius"?14:15),o(3),h(a.getEnumLabel(i.type,i.value)?16:i.format==="bool"?17:-1)}}function Ga(t,r){if(t&1&&(c(0,"ul",5)(1,"li",18)(2,"h6",19),d(3),s(4,"translate"),p()(),c(5,"li",20)(6,"span",21),d(7),s(8,"translate"),p(),c(9,"span",22),d(10),p()(),c(11,"li",20)(12,"span",21),d(13),s(14,"translate"),p(),c(15,"span",22),d(16),p()(),ze(17,Wa,18,7,"li",20,ct),p()),t&2){let e=r.$implicit;o(3),S(l(4,5,"accessories.service_info")),o(4),S(l(8,7,"accessories.service")),o(3),S(e.humanType),o(3),S(l(14,9,"accessories.name")),o(3),S(e.serviceName),o(),Ye(e.serviceCharacteristics)}}function qa(t,r){if(t&1&&(c(0,"li",20)(1,"span",21),d(2),s(3,"translate"),p(),c(4,"span",22),d(5),p()()),t&2){let e=u(2);o(2),S(l(3,2,"child_bridge.config.platform")),o(3),S(e.matchedCachedAccessory.platform)}}function za(t,r){if(t&1&&(c(0,"li",20)(1,"span",21),d(2),s(3,"translate"),p(),c(4,"span",22),d(5),p()()),t&2){let e=u(2);o(2),S(l(3,2,"child_bridge.config.accessory")),o(3),S(e.matchedCachedAccessory.accessory)}}function Ya(t,r){if(t&1&&(c(0,"li",20)(1,"span",21),d(2),s(3,"translate"),p(),c(4,"span",22),d(5),p()(),v(6,qa,6,4,"li",20),v(7,za,6,4,"li",20)),t&2){let e=u();o(2),S(l(3,4,"accessories.plugin")),o(3),S(e.matchedCachedAccessory.plugin),o(),h(e.matchedCachedAccessory.platform?6:-1),o(),h(e.matchedCachedAccessory.accessory?7:-1)}}function Ka(t,r){if(t&1&&(c(0,"li",20)(1,"span",21),d(2),p(),c(3,"span",22),d(4),p()()),t&2){let e=r.$implicit;o(2),S(e.key),o(2),S(e.value)}}function Qa(t,r){if(t&1&&(c(0,"li",20)(1,"span",21),d(2,"Bridge"),p(),c(3,"span",22),d(4),p()()),t&2){let e=u();o(4),S(e.localService.instance.name)}}function Za(t,r){if(t&1&&(c(0,"li",20)(1,"span",21),d(2),s(3,"translate"),p(),c(4,"span",22),d(5),p()()),t&2){let e=u();o(2),S(l(3,2,"child_bridge.config.name")),o(3),S(e.matchedCachedAccessory.bridge)}}function Ja(t,r){t&1&&g(0,"i",49)}function Xa(t,r){t&1&&g(0,"i",50)}function es(t,r){t&1&&(c(0,"span",51),d(1),s(2,"translate"),p()),t&2&&(o(),f(" ",l(2,1,"common.a11y.copied")," "))}function ts(t,r){if(t&1){let e=G();c(0,"li",20)(1,"span",21),d(2),s(3,"translate"),p(),c(4,"span",22),d(5),p()(),c(6,"li",20)(7,"span",21),d(8),s(9,"translate"),p(),c(10,"span",22),d(11),p()(),c(12,"li",20)(13,"span",45),d(14,"HAP UID"),p(),c(15,"span",46)(16,"span",47),d(17),p(),c(18,"button",48),s(19,"translate"),k("click",function(){L(e);let i=u();return V(i.copyUniqueIdToClipboard())}),v(20,Ja,1,0,"i",49)(21,Xa,1,0,"i",50),p(),v(22,es,3,3,"span",51),p()(),c(23,"li",20)(24,"span",52),d(25,"aid"),p(),c(26,"span",22),d(27),p()(),c(28,"li",20)(29,"span",52),d(30,"iid"),p(),c(31,"span",22),d(32),p()()}if(t&2){let e=u();o(2),S(l(3,10,"accessories.bridge_ip")),o(3),S(e.localService.instance.ipAddress),o(3),S(l(9,12,"accessories.bridge_port")),o(3),S(e.localService.instance.port),o(6),S(e.service.uniqueId),o(),T("aria-label",l(19,14,"common.a11y.copy_to_clipboard")),o(2),h(e.uniqueIdCopied()?20:21),o(2),h(e.uniqueIdCopied()?22:-1),o(5),S(e.localService.aid),o(5),S(e.localService.iid)}}function is(t,r){t&1&&g(0,"i",49)}function ns(t,r){t&1&&g(0,"i",50)}function os(t,r){t&1&&(c(0,"span",51),d(1),s(2,"translate"),p()),t&2&&(o(),f(" ",l(2,1,"common.a11y.copied")," "))}function rs(t,r){if(t&1){let e=G();c(0,"li",20)(1,"span",53),d(2,"UUID"),p(),c(3,"span",46)(4,"span",47),d(5),p(),c(6,"button",48),s(7,"translate"),k("click",function(){L(e);let i=u();return V(i.copyUUIDToClipboard())}),v(8,is,1,0,"i",49)(9,ns,1,0,"i",50),p(),v(10,os,3,3,"span",51),p()(),c(11,"li",54)(12,"span",13),d(13),s(14,"translate"),p(),c(15,"button",55),s(16,"translate"),k("click",function(){L(e);let i=u();return V(i.removeSingleCachedAccessories())}),g(17,"i",56),p()()}if(t&2){let e=u();o(5),S(e.matchedCachedAccessory.UUID),o(),T("aria-label",l(7,6,"common.a11y.copy_to_clipboard")),o(2),h(e.uuidCopied()?8:9),o(2),h(e.uuidCopied()?10:-1),o(3),S(l(14,8,"accessories.button_remove")),o(2),T("aria-label",l(16,10,"accessories.button_remove"))}}var Kn=(()=>{class t{$activeModal=P(ai);$cdr=P(ii);$modal=P(oe);modalData=P(si);injector=P(ie);copyTimeouts=new Map;hapCustomTypeList=[["AirPurifier","Switch","Outlet","Fan","Lightbulb","Heater","Cooler","Humidifier","Dehumidifier","Television","Valve","RobotVacuum","WashingMachine"],["Switch","Outlet","LockMechanism"],["Switch","Outlet","GarageDoorOpener"],["Door","Window","WindowCovering"],["Doorbell","Speaker","SmartSpeaker","Microphone"]];matterCustomTypeList=[["OnOffLight","OnOffLightSwitch","OnOffPlugInUnit","RoboticVacuumCleaner"],["Door","Window","WindowCovering"],["Fan"],["Thermostat"]];accessoryCache=this.modalData.accessoryCache;pairingCache=this.modalData.pairingCache;service=this.modalData.service;localAccessoryCache=[];localPairingCache=[];localService;isDetailsVisible={};accessoryInformation;extraServices=[];matchedCachedAccessory=null;enums=qn;customTypeList=[];isMatterAccessory=!1;clusterInfo=[];uniqueIdCopied=Ue(!1);uuidCopied=Ue(!1);getEnumLabel(e,n){return this.enums[e]?.[String(n)]}originalCustomName;originalCustomType;originalHidden;originalOnDashboard;ngOnInit(){let e=this.accessoryCache,n=this.pairingCache,i=this.service;if(!e||!n||!i){console.error("AccessoryInfoComponent: required data not provided"),this.$activeModal.dismiss("Missing required data");return}if(this.localAccessoryCache=e,this.localPairingCache=n,this.localService=i,this.isMatterAccessory=this.localService.protocol==="matter",this.isMatterAccessory){this.customTypeList=[...new Set(this.matterCustomTypeList.filter(m=>this.localService.deviceType&&m.includes(this.localService.deviceType)).flat())];let a=this.localService.clusters||{};this.clusterInfo=Object.entries(a).map(([m,x])=>({name:m,attributes:x})),this.accessoryInformation=Object.entries(this.localService.accessoryInformation||{}).map(([m,x])=>({key:m,value:x})),this.accessoryInformation.unshift({key:"Device Type",value:this.localService.deviceType||"Unknown"}),this.localService.customType||(this.localService.customType=this.localService.deviceType)}else this.customTypeList=[...new Set(this.hapCustomTypeList.filter(a=>a.includes(this.localService.type)).flat())],this.accessoryInformation=Object.entries(this.localService.accessoryInformation).map(([a,m])=>({key:a,value:m})),this.matchedCachedAccessory=this.matchToCachedAccessory(),this.localService.type==="LockMechanism"&&this.localService.linkedServices&&Object.values(this.localService.linkedServices).filter(a=>a.type==="LockManagement").forEach(a=>this.extraServices.push(a)),this.localService.customType||(this.localService.customType=this.localService.type);this.originalCustomName=this.localService.customName,this.originalCustomType=this.localService.customType,this.originalHidden=this.localService.hidden,this.originalOnDashboard=this.localService.onDashboard}ngOnDestroy(){this.copyTimeouts.forEach(e=>clearTimeout(e)),this.copyTimeouts.clear()}removeSingleCachedAccessories(){this.$activeModal.close();let e=ne([{provide:Un,useValue:{selectedBridge:this.localService.instance.username.replaceAll(":",""),highlightUuid:this.matchedCachedAccessory?.UUID,highlightCacheFile:this.matchedCachedAccessory?.$cacheFile}}],this.injector);this.$modal.open(Gn,{size:"lg",backdrop:"static",injector:e})}isDefaultType(e){return this.isMatterAccessory?e===this.localService.deviceType:e===this.localService.type}toggleDetailsVisibility(e){("minStep"in e||"minValue"in e||"maxValue"in e||"validValues"in e)&&(this.isDetailsVisible[e.uuid]=!this.isDetailsVisible[e.uuid])}dismissModal(){this.localService.customName=this.originalCustomName,this.localService.customType=this.originalCustomType,this.localService.hidden=this.originalHidden,this.localService.onDashboard=this.originalOnDashboard,this.$activeModal.dismiss("Dismiss")}saveModal(){this.$activeModal.close({customName:this.localService.customName,customType:this.localService.customType,hidden:this.localService.hidden,onDashboard:this.localService.onDashboard})}isFormUnchanged(){return this.localService.customName===this.originalCustomName&&this.localService.customType===this.originalCustomType&&this.localService.hidden===this.originalHidden&&this.localService.onDashboard===this.originalOnDashboard}onHiddenChange(){this.localService.hidden&&(this.localService.onDashboard=!1),this.$cdr.markForCheck()}onDashboardChange(){this.$cdr.markForCheck()}copyUniqueIdToClipboard(){return pe(this,null,function*(){let e=this.service.uniqueId;e&&(yield this.copyToClipboard(e,this.uniqueIdCopied))})}copyUUIDToClipboard(){return pe(this,null,function*(){let e=this.matchedCachedAccessory?.UUID;e&&(yield this.copyToClipboard(e,this.uuidCopied))})}copyToClipboard(e,n){return pe(this,null,function*(){try{yield navigator.clipboard.writeText(e)}catch(m){this.fallbackCopyToClipboard(e)}n.set(!0);let i=this.copyTimeouts.get(n);i&&clearTimeout(i);let a=setTimeout(()=>{n.set(!1),this.copyTimeouts.delete(n)},3e3);this.copyTimeouts.set(n,a)})}fallbackCopyToClipboard(e){let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}catch(i){console.error("Fallback: Could not copy text",i)}document.body.removeChild(n)}matchToCachedAccessory(){let e=this.localService.instance.username,n=this.localPairingCache.find(i=>i._username===e);if(n){let i=n._main?"cachedAccessories":`cachedAccessories.${n._id}`,a=this.localAccessoryCache.filter(m=>m.$cacheFile===i);if(a.length){let m=this.localService.accessoryInformation.Name,x=this.localService.accessoryInformation["Serial Number"],E=a.filter(D=>{let N=D.services.find(ge=>ge.constructorName==="AccessoryInformation"),q=N?.characteristics.find(ge=>ge.displayName==="Name"),_e=N?.characteristics.find(ge=>ge.displayName==="Serial Number");return q?.value===m&&_e?.value===x});if(E.length===1)return st(at({},E[0]),{bridge:n.name})}}return null}Number=Number;JSON=JSON;static \u0275fac=function(n){return new(n||t)};static \u0275cmp=w({type:t,selectors:[["app-accessory-info"]],decls:71,vars:54,consts:[["role","dialog","aria-modal","true",1,"modal-content"],[1,"modal-header"],["id","accessory-info-modal-title",1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"list-group","list-group-box","mb-3"],[1,"list-group-item","text-center","grey-text","small"],[3,"innerHTML"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","id","form-name","autocomplete","off",1,"form-control","custom-input",3,"ngModelChange","ngModel"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],["aria-hidden","true",1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","hide-accessory",1,"rendux-input",3,"ngModelChange","ngModel"],["for","hide-accessory","aria-hidden","true",1,"rendux-label","ms-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item"],[1,"mb-0","text-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-left","flex-column","flex-md-row"],[1,"text-start"],[1,"text-start","text-md-end","grey-text","font-monospace"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-primary",3,"click","disabled"],["for","custom-type",1,"mb-2","mb-md-0","w-100","w-md-50"],["id","custom-type",1,"custom-select",3,"ngModelChange","ngModel"],[3,"value"],["type","checkbox","id","show-on-dashboard",1,"rendux-input","mb-0",3,"ngModelChange","ngModel"],["for","show-on-dashboard","aria-hidden","true",1,"rendux-label","ms-3"],[1,"fw-bold"],[1,"list-group-item","d-flex","justify-content-between","align-items-start","align-items-md-center","flex-column","flex-md-row"],[1,"text-start","me-2"],[1,"me-3"],["role","button","tabindex","0",1,"hover-pointer","text-nowrap"],[1,"text-nowrap"],[1,"grey-text","m-0","p-0","font-monospace"],[1,"d-block","d-md-none","font-monospace","grey-text","text-break-all"],[1,"text-start","text-md-end","grey-text","font-monospace","d-none","d-md-block","align-content-center","text-break-all"],["role","button","tabindex","0",1,"hover-pointer","text-nowrap",3,"click","keydown.enter"],["role","button","tabindex","0",1,"hover-pointer"],["role","button","tabindex","0",1,"hover-pointer",3,"click","keydown.enter"],[1,"text-start","align-self-md-center","text-nowrap"],[1,"text-start","text-md-end","grey-text","font-monospace","d-flex","justify-content-between","align-items-center","ms-md-2"],[1,"text-break-all"],["type","button",1,"btn","btn-link","p-0","ms-2","text-primary","flex-shrink-0","align-baseline",3,"click"],["aria-hidden","true",1,"fas","fa-check","green-text"],["aria-hidden","true",1,"fas","fa-copy"],["role","status","aria-live","polite","aria-atomic","true",1,"visually-hidden"],[1,"text-start","font-monospace"],[1,"text-start","align-self-md-center","font-monospace","text-nowrap"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],["type","button",1,"btn","btn-primary","m-0","ms-3","py-1",3,"click"],["aria-hidden","true",1,"fas","fa-arrow-right"]],template:function(n,i){n&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),d(3),p(),c(4,"button",3),s(5,"translate"),k("click",function(){return i.dismissModal()}),p()(),c(6,"div",4)(7,"ul",5)(8,"li",6),g(9,"span",7),s(10,"translate"),g(11,"br")(12,"span",7),s(13,"translate"),p(),c(14,"li",8)(15,"label",9),d(16),s(17,"translate"),p(),c(18,"div",10)(19,"input",11),k("ngModelChange",function(m){return i.localService.customName=m}),p()()(),v(20,$0,8,4,"li",8),c(21,"li",12)(22,"span",13),d(23),s(24,"translate"),p(),c(25,"div",14)(26,"input",15),s(27,"translate"),X("ngModelChange",function(m){return J(i.localService.hidden,m)||(i.localService.hidden=m),m}),k("ngModelChange",function(){return i.onHiddenChange()}),p(),g(28,"label",16),p()(),v(29,U0,8,7,"li",12),p(),c(30,"ul",5),v(31,z0,6,3)(32,_a,18,11),p(),ze(33,Ga,19,11,"ul",5,ct),c(35,"ul",17)(36,"li",18)(37,"h6",19),d(38),s(39,"translate"),p()(),c(40,"li",20)(41,"span",21),d(42),s(43,"translate"),p(),c(44,"span",22),d(45),p()(),v(46,Ya,8,6),ze(47,Ka,5,2,"li",20,ct),v(49,Qa,5,1,"li",20),c(50,"li",20)(51,"span",21),d(52),s(53,"translate"),p(),c(54,"span",22),d(55),p()(),v(56,Za,6,4,"li",20),v(57,ts,33,16),v(58,rs,18,12),p()(),c(59,"div",23)(60,"div",21)(61,"button",24),s(62,"translate"),k("click",function(){return i.dismissModal()}),d(63),s(64,"translate"),p()(),g(65,"div",25),c(66,"div",26)(67,"button",27),s(68,"translate"),k("click",function(){return i.saveModal()}),d(69),s(70,"translate"),p()()()()),n&2&&(T("aria-labelledby","accessory-info-modal-title"),o(3),f(" ",i.localService.customName||i.localService.serviceName," "),o(),T("aria-label",l(5,28,"form.button_close")),o(5),B("innerHTML",l(10,30,"accessories.only_ui"),Qe),o(3),B("innerHTML",l(13,32,"accessories.only_ui_2"),Qe),o(4),S(l(17,34,"accessories.custom_name")),o(3),B("ngModel",i.localService.customName||i.localService.serviceName),o(),h(i.customTypeList.length?20:-1),o(3),S(l(24,36,"accessories.hide_this_accessory")),o(3),Z("ngModel",i.localService.hidden),T("aria-label",l(27,38,"accessories.hide_this_accessory")),o(3),h(i.localService.hidden?-1:29),o(2),h(i.isMatterAccessory?31:32),o(2),Ye(i.extraServices),o(5),S(l(39,40,"accessories.accessory_info")),o(4),S(l(43,42,"accessories.protocol")),o(3),f(" ",i.isMatterAccessory?"Matter":"HAP"," "),o(),h(i.matchedCachedAccessory?46:-1),o(),Ye(i.accessoryInformation),o(2),h(i.isMatterAccessory?49:-1),o(3),S(l(53,44,"users.label_username")),o(3),S(i.localService.instance.username),o(),h(i.matchedCachedAccessory?56:-1),o(),h(i.isMatterAccessory?-1:57),o(),h(i.matchedCachedAccessory?58:-1),o(3),T("aria-label",l(62,46,"form.button_close")),o(2),f(" ",l(64,48,"form.button_close")," "),o(4),B("disabled",i.isFormUnchanged()),T("aria-label",l(68,50,"form.button_save")),o(2),f(" ",l(70,52,"form.button_save")," "))},dependencies:[fe,An,Pn,En,wn,Dn,ve,he,Tn,A,Re,zn,ht,Yn],encapsulation:2,changeDetection:0})}return t})();var ae=(()=>{class t{injector=P(ie);$accessoryCache=P(jn);$pairingsCache=P(Wn);$auth=P(bn);$destroyRef=P(ft);$errors=P(ri);$modal=P(oe);$toastr=P(oi);$translate=P(ni);$ws=P(Fn);accessoryCache=[];pairingCache=[];customAttributesApplied=new Set;combinedServiceIds=new Set;io;stop$=new te;sessionActive=!1;hiddenTypes=new Set(["InputSource","LockManagement","CameraRTPStreamManagement","ProtocolInformation","NFCAccess","BridgedNode","History"]);layoutSaved=new te;accessoryData=new te;hapReadyForControl=!1;matterReadyForControl=!1;accessories={services:[]};accessoryLayout;originalLayout;availableBridges=Ue([]);selectedBridges=Ue(null);bridgeUsernameToNameMap=new Map;rooms=Ue([]);constructor(){this.$auth.user.admin&&this.loadCachedData()}loadCachedData(){return pe(this,null,function*(){let e=!1,n=i=>{console.error(i),e||(e=!0,this.$toastr.warning(this.$errors.toToastMessage(i),this.$translate.instant("toast.title_warning")))};try{this.accessoryCache=yield this.$accessoryCache.getHap()}catch(i){n(i)}try{this.pairingCache=yield this.$pairingsCache.get()}catch(i){n(i)}})}showAccessoryInformation(e){return pe(this,null,function*(){let n=ne([{provide:si,useValue:{service:e,accessoryCache:this.accessoryCache,pairingCache:this.pairingCache}}],this.injector),i=this.$modal.open(Kn,{size:"lg",backdrop:"static",injector:n});try{let a=yield i.result,x=this.rooms().flatMap(N=>N.services).find(N=>N.uniqueId===e.uniqueId)||e,E=st(at({},x),{customName:a.customName,customType:a.customType,hidden:a.hidden,onDashboard:a.onDashboard}),D=this.accessories.services.findIndex(N=>N.uniqueId===E.uniqueId);D!==-1&&(this.accessories.services[D]=E),this.rooms.update(N=>N.map(q=>st(at({},q),{services:q.services.map(_e=>_e.uniqueId===E.uniqueId?E:_e)}))),this.saveLayout()}catch(a){}return!1})}stop(){this.stop$.next(),this.stop$.complete(),this.sessionActive=!1,this.io?.end?.(),this.rooms.set([]),this.accessories={services:[]},this.customAttributesApplied.clear(),this.combinedServiceIds.clear(),this.accessoryLayout=void 0,this.originalLayout=void 0,this.stop$=new te}start(){return pe(this,null,function*(){this.hapReadyForControl=!1,this.matterReadyForControl=!1,this.sessionActive=!0,this.io=this.$ws.connectToNamespace("accessories"),yield this.loadLayout(),this.io.connected.pipe(Ut(this.stop$)).subscribe(()=>{this.io.socket.emit("get-accessories")}),this.io.socket.on("accessories-data",e=>{this.sessionActive&&(this.parseServices(e),this.combineRelatedServices(),this.generateHelpers(),this.sortIntoRooms(),this.orderRooms(),this.refreshRoomsForChangeDetection(),this.applyCustomAttributes(),this.accessoryData.next(e))}),this.io.socket.on("accessories-reload-required",()=>{this.io.socket.emit("accessory-control",{refresh:!0})}),this.io.socket.on("matter-accessories-reload-required",()=>pe(this,null,function*(){this.matterReadyForControl=!1,this.io.socket.emit("accessory-control",{refresh:!0})})),this.io.socket.on("accessory-control-failure",e=>{console.error(e),this.$toastr.error(e,this.$translate.instant("toast.title_error"))}),this.io.socket.on("hap-accessories-ready-for-control",()=>{this.hapReadyForControl=!0}),this.io.socket.on("matter-accessories-ready-for-control",()=>{this.matterReadyForControl=!0})})}saveLayout(){let e=this.rooms().map(i=>({name:i.name,isDefault:i.isDefault,services:i.services.map(a=>({uniqueId:a.uniqueId,nameBasedUniqueId:a.nameBasedUniqueId||void 0,name:a.serviceName,serial:a.accessoryInformation?.["Serial Number"],bridge:a.instance?.username,aid:a.aid,iid:a.iid,uuid:a.uuid,customName:a.customName||void 0,customType:a.customType||void 0,hidden:a.hidden||void 0,onDashboard:a.onDashboard||void 0}))}));!e.some(i=>i.isDefault===!0)&&e.length>0&&(e[0].isDefault=!0),this.accessoryLayout=this.mergeWithUndiscoveredServices(e),this.io.request("save-layout",{user:this.$auth.user.username,layout:this.accessoryLayout}).pipe(Ut(this.stop$),ot(this.$destroyRef)).subscribe({next:()=>this.layoutSaved.next(void 0),error:i=>{console.error(i),this.$toastr.error(this.$errors.toToastMessage(i),this.$translate.instant("toast.title_error"))}})}loadLayout(){return pe(this,null,function*(){if(this.accessoryLayout=yield ln(this.io.request("get-layout",{user:this.$auth.user.username})),this.originalLayout=JSON.parse(JSON.stringify(this.accessoryLayout)),!this.accessoryLayout.some(n=>n.isDefault)&&this.accessoryLayout.length>0){let n=this.accessoryLayout.findIndex(a=>a.name==="Default Room"),i=n!==-1?n:0;this.accessoryLayout[i].isDefault=!0}this.rooms.set(this.accessoryLayout.map(n=>({name:n.name,isDefault:n.isDefault,services:[]})))})}servicesMatch(e,n){return n.protocol==="matter"||n.uniqueId?.startsWith("matter:")?e.uniqueId===n.uniqueId&&e.bridge===(n.instance?.username||n.bridge):e.nameBasedUniqueId&&n.nameBasedUniqueId?e.nameBasedUniqueId===n.nameBasedUniqueId:e.uniqueId===n.uniqueId?!0:e.name===(n.serviceName||n.name)&&e.serial===(n.accessoryInformation?.["Serial Number"]||n.serial)&&e.bridge===(n.instance?.username||n.bridge)&&e.uuid===n.uuid}findInLayout(e){for(let n of this.accessoryLayout)for(let i of n.services)if(i.name&&this.servicesMatch(i,e))return{room:n,service:i};return null}mergeWithUndiscoveredServices(e){if(!this.originalLayout)return e;let n=JSON.parse(JSON.stringify(e)),i=new Set;for(let a of n)for(let m of a.services)for(let x of this.originalLayout){for(let E of x.services)if(E.name&&this.servicesMatch(E,m)){i.add(this.getServiceKey(E));break}if(i.has(this.getServiceKey(m)))break}for(let a of this.originalLayout)for(let m of a.services){if(i.has(this.getServiceKey(m))||!m.name)continue;let x=n.find(E=>E.name===a.name);!x&&(x=n.find(E=>E.isDefault),!x)||x.services.push({uniqueId:m.uniqueId,nameBasedUniqueId:m.nameBasedUniqueId,name:m.name,bridge:m.bridge,serial:m.serial,aid:m.aid,iid:m.iid,uuid:m.uuid,customName:m.customName,customType:m.customType,hidden:m.hidden,onDashboard:m.onDashboard})}return n.filter(a=>a.services.length>0||e.some(m=>m.name===a.name))}getServiceKey(e){return e.nameBasedUniqueId||e.uniqueId}parseServices(e){if(!this.accessories.services.length){this.accessories.services=e;return}e.forEach(n=>{let i=this.accessories.services.findIndex(a=>a.uniqueId===n.uniqueId);n.type==="LockMechanism"&&this.attachLockManagementToMechanism(n),i!==-1?(this.accessories.services[i]=n,this.customAttributesApplied.delete(n.uniqueId)):this.accessories.services.push(n)})}sortIntoRooms(){this.accessories.services.forEach(e=>{if(this.hiddenTypes.has(e.type)||this.hiddenTypes.has(e.deviceType)||this.combinedServiceIds.has(e.uniqueId))return;if(e.linked&&(e.linkedServices={},e.linked.forEach(i=>{e.linkedServices[i]=this.accessories.services.find(a=>a.aid===e.aid&&a.iid===i&&a.instance.username===e.instance.username)})),!this.rooms().find(i=>i.services.find(a=>a.uniqueId===e.uniqueId))){let i=this.findInLayout(e);if(i){let a=e;i.service.customType&&(a.customType=i.service.customType),i.service.customName&&(a.customName=i.service.customName),i.service.hidden&&(a.hidden=i.service.hidden),i.service.onDashboard&&(a.onDashboard=i.service.onDashboard),this.customAttributesApplied.add(e.uniqueId),this.rooms.update(m=>m.map(x=>x.name===i.room.name?st(at({},x),{services:[...x.services,e]}):x))}else{this.customAttributesApplied.add(e.uniqueId);let a=this.rooms().find(m=>m.isDefault===!0)||this.rooms().find(m=>m.name==="Default Room");a?this.rooms.update(m=>m.map(x=>x.name===a.name?st(at({},x),{services:[...x.services,e]}):x)):this.rooms.update(m=>[...m,{name:"Default Room",isDefault:!0,services:[e]}])}}})}orderRooms(){this.rooms.update(e=>e.map(n=>{let i=this.accessoryLayout.find(m=>m.name===n.name);if(!i)return n;let a=n.services.toSorted((m,x)=>{let E=i.services.findIndex(N=>this.servicesMatch(N,m)),D=i.services.findIndex(N=>this.servicesMatch(N,x));return E-D});return st(at({},n),{services:a})}))}refreshRoomsForChangeDetection(){this.rooms.update(e=>e.map(n=>st(at({},n),{services:n.services.map(i=>this.accessories.services.find(m=>m.uniqueId===i.uniqueId)||i)})))}applyCustomAttributes(){this.rooms().forEach(e=>{e.services.forEach(n=>{if(this.customAttributesApplied.has(n.uniqueId))return;let i=this.findInLayout(n);if(!i)return;let a=n;i.service.customType&&(a.customType=i.service.customType),i.service.customName&&(a.customName=i.service.customName),i.service.hidden&&(a.hidden=i.service.hidden),i.service.onDashboard&&(a.onDashboard=i.service.onDashboard),this.customAttributesApplied.add(n.uniqueId)})})}generateHelpers(){this.accessories.services.forEach(e=>{let n=e;n.protocol==="matter"?n.getCluster||(n.getCluster=i=>{let a=n.clusters||{};return a[i]?{attributes:a[i],setAttributes:m=>new Promise(x=>this.matterReadyForControl?(this.io.socket.emit("accessory-control",{set:{uniqueId:e.uniqueId,cluster:i,attributes:m}}),x(void 0)):(console.warn("Matter control attempted but not ready for control:",{matterReadyForControl:this.matterReadyForControl,uniqueId:e.uniqueId,cluster:i}),x(void 0)))}:null}):e.getCharacteristic||(e.getCharacteristic=i=>{let a=e.serviceCharacteristics.find(m=>m.type===i);return a?(a.setValue=m=>new Promise(x=>(this.hapReadyForControl&&this.io.socket.emit("accessory-control",{set:{uniqueId:e.uniqueId,aid:e.aid,siid:e.iid,iid:a.iid,value:m}}),x(void 0))),a):null})})}isSameAccessory(e,n){return e.accessoryInformation.Name===n.accessoryInformation.Name&&e.accessoryInformation["Serial Number"]===n.accessoryInformation["Serial Number"]&&e.instance.username===n.instance.username}attachLockManagementToMechanism(e){let n=[],i=[];for(let a of this.accessories.services)a.type==="LockMechanism"&&this.isSameAccessory(a,e)?n.push(a):a.type==="LockManagement"&&this.isSameAccessory(a,e)&&i.push(a);if(n.length===1&&i.length===1){let a=i[0];e.linkedServices||(e.linkedServices={}),e.linkedServices[a.iid]=a}}attachFanToHeaterCooler(e){let n=[],i=[];for(let a of this.accessories.services)this.isSameAccessory(a,e)&&(a.type==="HeaterCooler"?n.push(a):(a.type==="Fan"||a.type==="Fanv2")&&i.push(a));if(n.length===1&&i.length===1){let a=i[0];e.linkedServices||(e.linkedServices={}),e.linkedServices[a.iid]=a,this.combinedServiceIds.add(a.uniqueId)}}attachFanToHumidifierDehumidifier(e){let n=[],i=[];for(let a of this.accessories.services)this.isSameAccessory(a,e)&&(a.type==="HumidifierDehumidifier"?n.push(a):(a.type==="Fan"||a.type==="Fanv2")&&i.push(a));if(n.length===1&&i.length===1){let a=i[0];e.linkedServices||(e.linkedServices={}),e.linkedServices[a.iid]=a,this.combinedServiceIds.add(a.uniqueId)}}combineRelatedServices(){this.combinedServiceIds.clear();for(let e of this.accessories.services)e.type==="HeaterCooler"?this.attachFanToHeaterCooler(e):e.type==="HumidifierDehumidifier"&&this.attachFanToHumidifierDehumidifier(e);this.rooms.update(e=>e.map(n=>st(at({},n),{services:n.services.filter(i=>!this.combinedServiceIds.has(i.uniqueId))})))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=Xt({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Qn=(()=>{class t{service=O.required();readyForControl=O(!1);static \u0275fac=function(n){return new(n||t)};static \u0275cmp=w({type:t,selectors:[["app-access-code"]],inputs:{service:[1,"service"],readyForControl:[1,"readyForControl"]},decls:18,vars:7,consts:[["tabindex","0",1,"accessory-box"],[1,"d-flex","flex-column","h-100"],[1,"accessory-svg"],["width","32px","height","32px","viewBox","0 0 32 32","xmlns","http://www.w3.org/2000/svg"],["x","6","y","1","width","18","height","30","rx","3","stroke","#7f7f7f","fill","none","stroke-width","2"],["x","9","y","5","width","12","height","3","rx","1","stroke","#7f7f7f","stroke-width","1","fill","#1976d2","fill-opacity","0.5"],["x","9","y","11","width","12","height","16","rx","1","stroke","#7f7f7f","fill","none","stroke-width","1"],["x1","13","y1","11","x2","13","y2","27","stroke","#7f7f7f","stroke-width","1"],["x1","17","y1","11","x2","17","y2","27","stroke","#7f7f7f","stroke-width","1"],["x1","9","y1","15","x2","21","y2","15","stroke","#7f7f7f","stroke-width","1"],["x1","9","y1","19","x2","21","y2","19","stroke","#7f7f7f","stroke-width","1"],["x1","9","y1","23","x2","21","y2","23","stroke","#7f7f7f","stroke-width","1"],[1,"accessory-label","mt-auto"],[1,"accessory-label","grey-text"]],template:function(n,i){n&1&&(C(0,"div",0)(1,"div",1)(2,"div",2),s(3,"translate"),R(),C(4,"svg",3),H(5,"rect",4)(6,"rect",5)(7,"rect",6)(8,"line",7)(9,"line",8)(10,"line",9)(11,"line",10)(12,"line",11),_()(),$(),C(13,"div",12),d(14),_(),C(15,"div",13),d(16),s(17,"translate"),_()()()),n&2&&(o(2),T("aria-label",l(3,3,"accessories.core.access_code")),o(12),S(i.service().customName||i.service().serviceName),o(2),S(l(17,5,"accessories.core.access_code")))},dependencies:[A],encapsulation:2,changeDetection:0})}return t})();var se=new ei("AccessoryManageModalData"),de=(()=>{class t{destroyRef=P(ft);$activeModal=P(ai);cdr=P(ii);$errors=P(ri);$toastr=P(oi);$translate=P(ni);showGenericErrorToast(e){e!==void 0&&console.error(e),this.$toastr.error(this.$errors.toToastMessage(e),this.$translate.instant("toast.title_error"))}modalData=P(se);service;$accessories;ngOnInit(){if(!this.modalData.service||!this.modalData.$accessories){console.error("BaseManageComponent: service or $accessories not provided"),this.$activeModal.dismiss("Missing required data");return}this.service=this.modalData.service,this.$accessories=this.modalData.$accessories,this.setupComponent(),this.subscribeToAccessoryUpdates()}dismissModal(){this.$activeModal.dismiss("Dismiss")}subscribeToAccessoryUpdates(){this.$accessories&&this.$accessories.accessoryData.pipe(ot(this.destroyRef)).subscribe(()=>{let e=this.$accessories.accessories.services.find(n=>n.uniqueId===this.service.uniqueId);e&&(this.service=e),this.handleAccessoryUpdate(),this.cdr.markForCheck()})}createDebouncedSubscription(e,n,i=500){e.pipe(pn(i),ot(this.destroyRef)).subscribe(n)}applySliderGradient(e,n=".noUi-target"){requestAnimationFrame(()=>{document.querySelectorAll(n).forEach(a=>{a.style.background=e})})}blurTarget(e){e.target.blur()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=w({type:t,selectors:[["app-base-manage"]],decls:0,vars:0,template:function(n,i){},encapsulation:2,changeDetection:0})}return t})();var Mt=(function(t){return t.Range="range",t.Steps="steps",t.Positions="positions",t.Count="count",t.Values="values",t})(Mt||{}),Ze=(function(t){return t[t.None=-1]="None",t[t.NoValue=0]="NoValue",t[t.LargeValue=1]="LargeValue",t[t.SmallValue=2]="SmallValue",t})(Ze||{});function as(t){return ci(t)&&typeof t.from=="function"}function ci(t){return typeof t=="object"&&typeof t.to=="function"}function Zn(t){t.parentElement.removeChild(t)}function Pi(t){return t!=null}function Jn(t){t.preventDefault()}function ss(t){return t.filter(function(r){return this[r]?!1:this[r]=!0},{})}function ls(t,r){return Math.round(t/r)*r}function cs(t,r){var e=t.getBoundingClientRect(),n=t.ownerDocument,i=n.documentElement,a=io(n);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(a.x=0),r?e.top+a.y-i.clientTop:e.left+a.x-i.clientLeft}function rt(t){return typeof t=="number"&&!isNaN(t)&&isFinite(t)}function Xn(t,r,e){e>0&&(qe(t,r),setTimeout(function(){li(t,r)},e))}function eo(t){return Math.max(Math.min(t,100),0)}function di(t){return Array.isArray(t)?t:[t]}function ds(t){t=String(t);var r=t.split(".");return r.length>1?r[1].length:0}function qe(t,r){t.classList&&!/\s/.test(r)?t.classList.add(r):t.className+=" "+r}function li(t,r){t.classList&&!/\s/.test(r)?t.classList.remove(r):t.className=t.className.replace(new RegExp("(^|\\b)"+r.split(" ").join("|")+"(\\b|$)","gi")," ")}function ps(t,r){return t.classList?t.classList.contains(r):new RegExp("\\b"+r+"\\b").test(t.className)}function io(t){var r=window.pageXOffset!==void 0,e=(t.compatMode||"")==="CSS1Compat",n=r?window.pageXOffset:e?t.documentElement.scrollLeft:t.body.scrollLeft,i=r?window.pageYOffset:e?t.documentElement.scrollTop:t.body.scrollTop;return{x:n,y:i}}function ms(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function us(){var t=!1;try{var r=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,r)}catch(e){}return t}function fs(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function Oi(t,r){return 100/(r-t)}function Fi(t,r,e){return r*100/(t[e+1]-t[e])}function gs(t,r){return Fi(t,t[0]<0?r+Math.abs(t[0]):r-t[0],0)}function vs(t,r){return r*(t[1]-t[0])/100+t[0]}function jt(t,r){for(var e=1;t>=r[e];)e+=1;return e}function hs(t,r,e){if(e>=t.slice(-1)[0])return 100;var n=jt(e,t),i=t[n-1],a=t[n],m=r[n-1],x=r[n];return m+gs([i,a],e)/Oi(m,x)}function Cs(t,r,e){if(e>=100)return t.slice(-1)[0];var n=jt(e,r),i=t[n-1],a=t[n],m=r[n-1],x=r[n];return vs([i,a],(e-m)*