homebridge-config-ui-x 5.0.0-beta.1 → 5.0.0-beta.3

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 (135) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/package.json +3 -3
  3. package/public/3rdpartylicenses.txt +551 -551
  4. package/public/chunk-2OBHR63W.js +1 -0
  5. package/public/chunk-3C6WVST7.js +1 -0
  6. package/public/chunk-3IX3CLER.js +1 -0
  7. package/public/chunk-5ALXJOLQ.js +1 -0
  8. package/public/chunk-5LVGHH2N.js +1 -0
  9. package/public/chunk-6PHMBMFU.js +1 -0
  10. package/public/chunk-6TCHCTXZ.js +1 -0
  11. package/public/chunk-7456RB3C.js +1 -0
  12. package/public/chunk-76S7LYCL.js +1 -0
  13. package/public/chunk-77A3OZ74.js +1 -0
  14. package/public/chunk-7EANS226.js +1 -0
  15. package/public/chunk-7EUQWCP5.js +2 -0
  16. package/public/chunk-7L7RZCFC.js +8 -0
  17. package/public/chunk-ASX35H47.js +1 -0
  18. package/public/chunk-AVJ6EUEE.js +1 -0
  19. package/public/chunk-AX23H5TL.js +1 -0
  20. package/public/chunk-AZXQ73I5.js +1 -0
  21. package/public/chunk-BFDVOBTQ.js +1 -0
  22. package/public/{chunk-THFLPY67.js → chunk-BKUGARB4.js} +1 -1
  23. package/public/chunk-BMXAHMY6.js +1 -0
  24. package/public/chunk-BPMSJ2VF.js +1 -0
  25. package/public/{chunk-GNQUXZMN.js → chunk-CCUID66K.js} +1 -1
  26. package/public/chunk-CW7Q7WEJ.js +1 -0
  27. package/public/chunk-DDXIRKVB.js +1 -0
  28. package/public/chunk-DNOJWLVY.js +1 -0
  29. package/public/chunk-DZY2Q3FG.js +1 -0
  30. package/public/chunk-EA5J2VEJ.js +1 -0
  31. package/public/chunk-FX4GQIE4.js +32 -0
  32. package/public/chunk-GVDR7ZRB.js +1 -0
  33. package/public/chunk-HSJSWZHD.js +1 -0
  34. package/public/chunk-I7ZKPCIW.js +1 -0
  35. package/public/chunk-IPZ4P5DE.js +1 -0
  36. package/public/chunk-IW3EPSTZ.js +23 -0
  37. package/public/chunk-IWYEH4T6.js +1 -0
  38. package/public/chunk-JL6S5IIU.js +1 -0
  39. package/public/chunk-JZZQRLNW.js +1 -0
  40. package/public/chunk-KIJWUGXX.js +1 -0
  41. package/public/chunk-KO3WJGGG.js +1 -0
  42. package/public/chunk-KQJ7ONUG.js +1 -0
  43. package/public/chunk-KTDJZCFW.js +1 -0
  44. package/public/chunk-LDPCT3YF.js +5 -0
  45. package/public/chunk-MHYIZZN4.js +1 -0
  46. package/public/chunk-MOV2HTCQ.js +1 -0
  47. package/public/chunk-NF4NIS42.js +1 -0
  48. package/public/chunk-NW6AFAD7.js +1 -0
  49. package/public/chunk-NZNNTHFQ.js +1 -0
  50. package/public/chunk-O75YP3SB.js +1 -0
  51. package/public/chunk-ODPTCLGS.js +1 -0
  52. package/public/chunk-ORPWYWCL.js +5 -0
  53. package/public/chunk-Q5URFHBE.js +1 -0
  54. package/public/chunk-QE7DO6J3.js +8 -0
  55. package/public/chunk-QHPDGSZ6.js +1 -0
  56. package/public/chunk-QLWY5NWN.js +1 -0
  57. package/public/chunk-QRZNMAFL.js +1 -0
  58. package/public/chunk-RHB2T3FE.js +1 -0
  59. package/public/chunk-RMI35HIS.js +1 -0
  60. package/public/chunk-RO4QXVDE.js +1 -0
  61. package/public/chunk-RWZRB2OY.js +1 -0
  62. package/public/chunk-S62KH3FN.js +6 -0
  63. package/public/chunk-S6EMLS5Q.js +1 -0
  64. package/public/chunk-SVFFEV36.js +1 -0
  65. package/public/chunk-T2YVB4SI.js +1 -0
  66. package/public/chunk-TCSXGQNF.js +1 -0
  67. package/public/chunk-TXOB7R5K.js +7 -0
  68. package/public/chunk-U6ORTLYL.js +1 -0
  69. package/public/chunk-UG5DK2RQ.js +2 -0
  70. package/public/chunk-UJU3NPS7.js +1 -0
  71. package/public/chunk-UYZI56PX.js +1 -0
  72. package/public/chunk-UZU6PLTW.js +1 -0
  73. package/public/chunk-UZW3DWH4.js +1 -0
  74. package/public/chunk-VMXGERJT.js +14 -0
  75. package/public/chunk-VOBHY2IH.js +4 -0
  76. package/public/chunk-WHJOLAED.js +1 -0
  77. package/public/chunk-WHJSVGC7.js +1 -0
  78. package/public/chunk-WMB35VCS.js +1 -0
  79. package/public/{chunk-6QEO3BTW.js → chunk-WNWWUCCZ.js} +14 -14
  80. package/public/chunk-WT2GX4NS.js +1 -0
  81. package/public/chunk-XH6GEPB6.js +1 -0
  82. package/public/chunk-ZLPCX4R4.js +1 -0
  83. package/public/chunk-ZT23DWNL.js +1 -0
  84. package/public/chunk-ZY7HKZ4P.js +20 -0
  85. package/public/index.html +2 -2
  86. package/public/main-ILTX7GFO.js +1 -0
  87. package/public/media/fa-brands-400-6U3GU5Y7.woff2 +0 -0
  88. package/public/media/{fa-brands-400-CNBICIQT.ttf → fa-brands-400-MVB2B5XM.ttf} +0 -0
  89. package/public/media/{fa-regular-400-2FI4ICQD.ttf → fa-regular-400-EGQOOADX.ttf} +0 -0
  90. package/public/media/fa-regular-400-R5EOMW4H.woff2 +0 -0
  91. package/public/media/fa-solid-900-W65KEJAS.woff2 +0 -0
  92. package/public/media/{fa-solid-900-XVWCCN5V.ttf → fa-solid-900-ZUDIWQL5.ttf} +0 -0
  93. package/public/{polyfills-CE2SNIQF.js → polyfills-C6JHVXJJ.js} +2 -2
  94. package/public/prerendered-routes.json +3 -0
  95. package/public/styles-GDLSHXGD.css +1 -0
  96. package/public/chunk-3KSUXL3K.js +0 -20
  97. package/public/chunk-422JXES4.js +0 -23
  98. package/public/chunk-4R6MSI5I.js +0 -14
  99. package/public/chunk-5UYN5OWH.js +0 -1
  100. package/public/chunk-7564WJJL.js +0 -1
  101. package/public/chunk-7R6JSPNH.js +0 -1
  102. package/public/chunk-B6C32ZRK.js +0 -1
  103. package/public/chunk-B6G7GTDI.js +0 -1
  104. package/public/chunk-BQLALGZ5.js +0 -4
  105. package/public/chunk-BROUJ7PT.js +0 -1
  106. package/public/chunk-C4OONTE3.js +0 -1
  107. package/public/chunk-DOLYKWZH.js +0 -1
  108. package/public/chunk-DRWF7R4E.js +0 -1
  109. package/public/chunk-F22FMU37.js +0 -1
  110. package/public/chunk-FBP5C7VG.js +0 -1
  111. package/public/chunk-FPOZAQLC.js +0 -5
  112. package/public/chunk-IGUSDGD6.js +0 -8
  113. package/public/chunk-JM7QCDMZ.js +0 -1
  114. package/public/chunk-K3YXRBTH.js +0 -1
  115. package/public/chunk-K6TZNXIW.js +0 -1
  116. package/public/chunk-LS7T2AVU.js +0 -8
  117. package/public/chunk-NZPTOWFC.js +0 -20
  118. package/public/chunk-RID7V4NP.js +0 -1
  119. package/public/chunk-RIWBPQF3.js +0 -1
  120. package/public/chunk-S4SOWUAW.js +0 -1
  121. package/public/chunk-SJTXTMYT.js +0 -2
  122. package/public/chunk-T5QVI4H2.js +0 -1
  123. package/public/chunk-TBJQ2Y3M.js +0 -1
  124. package/public/chunk-TS27NWVA.js +0 -20
  125. package/public/chunk-VROGSJLF.js +0 -1
  126. package/public/chunk-VVILZWTF.js +0 -1
  127. package/public/chunk-WCDFKYP6.js +0 -5
  128. package/public/chunk-WCQIGCXO.js +0 -1
  129. package/public/chunk-Z47RP4BH.js +0 -1
  130. package/public/chunk-ZEONO5N6.js +0 -1
  131. package/public/main-VTRWQ63R.js +0 -6
  132. package/public/media/fa-brands-400-MDS4TU4L.woff2 +0 -0
  133. package/public/media/fa-regular-400-N56QV3DR.woff2 +0 -0
  134. package/public/media/fa-solid-900-Z3HFQTXF.woff2 +0 -0
  135. package/public/styles-7ETWN6DQ.css +0 -1
@@ -1 +0,0 @@
1
- import{M as S}from"./chunk-WCDFKYP6.js";import{b as k}from"./chunk-F22FMU37.js";import{$ as I,Ga as g,Ka as f,La as y,Pa as u,Rb as M,Ua as n,Va as l,Wa as b,ab as c,bb as B,h as t,jb as s,kb as v,lb as C,wa as e,xa as x,yb as m,zb as d}from"./chunk-IGUSDGD6.js";function h(o,a){if(o&1&&b(0,"i",14),o&2){let T=B();u("fas fa-fw ",T.faIconClass," mb-4")}}var L=(()=>{let a=class a{constructor(p){t(this,"$activeModal");t(this,"title");t(this,"message");t(this,"confirmButtonLabel");t(this,"confirmButtonClass");t(this,"faIconClass");this.$activeModal=p}};t(a,"\u0275fac",function(r){return new(r||a)(x(S))}),t(a,"\u0275cmp",I({type:a,selectors:[["ng-component"]],inputs:{title:"title",message:"message",confirmButtonLabel:"confirmButtonLabel",confirmButtonClass:"confirmButtonClass",faIconClass:"faIconClass"},decls:22,vars:16,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body","w-100","text-center"],["style","font-size: 75px",3,"class",4,"ngIf"],[1,"w-100","text-center"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","button","data-dismiss","modal",3,"click"],[2,"font-size","75px"]],template:function(r,i){r&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),s(3),l(),n(4,"button",3),m(5,"translate"),c("click",function(){return i.$activeModal.dismiss("Dismiss")}),n(6,"span",4),s(7,"\xD7"),l()()(),n(8,"div",5),g(9,h,1,3,"i",6),n(10,"p",7),s(11),l()(),n(12,"div",8)(13,"div",9)(14,"button",10),m(15,"translate"),c("click",function(){return i.$activeModal.dismiss("Dismiss")}),s(16),m(17,"translate"),l()(),b(18,"div",11),n(19,"div",12)(20,"button",13),c("click",function(){return i.$activeModal.close()}),s(21),l()()()()),r&2&&(e(3),v(i.title),e(),f("aria-label",d(5,10,"form.button_close")),e(5),y("ngIf",i.faIconClass),e(2),v(i.message),e(3),f("aria-label",d(15,12,"form.button_close")),e(2),C(" ",d(17,14,"form.button_close")," "),e(4),u("btn ",i.confirmButtonClass||"btn-primary",""),e(),C(" ",i.confirmButtonLabel," "))},dependencies:[M,k],encapsulation:2}));let o=a;return o})();export{L as a};
@@ -1 +0,0 @@
1
- import{c as h}from"./chunk-RIWBPQF3.js";import{k as u}from"./chunk-S4SOWUAW.js";import{a as c}from"./chunk-F22FMU37.js";import{W as o,Z as i,h as r,sc as n}from"./chunk-IGUSDGD6.js";var I=(()=>{let t=class t{constructor(s,a,$,f){r(this,"$auth");r(this,"$router");r(this,"$translate");r(this,"$toastr");this.$auth=s,this.$router=a,this.$translate=$,this.$toastr=f}canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}};r(t,"\u0275fac",function(a){return new(a||t)(i(h),i(n),i(c),i(u))}),r(t,"\u0275prov",o({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();export{I as a};
@@ -1 +0,0 @@
1
- import{a as ae,b as se,c as ce,d as le,e as me,f as ue}from"./chunk-VROGSJLF.js";import{f as pe}from"./chunk-422JXES4.js";import"./chunk-6QEO3BTW.js";import{a as de}from"./chunk-B6C32ZRK.js";import"./chunk-7564WJJL.js";import"./chunk-TS27NWVA.js";import"./chunk-7R6JSPNH.js";import"./chunk-JM7QCDMZ.js";import{c as K}from"./chunk-RIWBPQF3.js";import{M as ie,N as oe,O as ne,Q as re,c as Q,e as U,f as X,i as Y,l as Z,m as ee,y as te}from"./chunk-WCDFKYP6.js";import{m as J}from"./chunk-S4SOWUAW.js";import{b as A,c as q}from"./chunk-F22FMU37.js";import{$ as w,$b as z,Ga as x,Ka as C,La as p,Pb as W,Qb as R,Rb as H,Sb as G,Ua as r,Va as s,Wa as _,X as $,Xa as P,Ya as F,Za as N,aa as B,ab as v,bb as g,h as c,ha as h,ia as y,jb as u,kb as f,lb as S,ob as k,pb as I,qb as T,tb as L,ub as j,vc as V,wa as n,xa as b,yb as l,zb as d}from"./chunk-IGUSDGD6.js";var Ce=()=>({standalone:!0}),_e=(()=>{let t=class t{constructor(a){c(this,"$activeModal");c(this,"roomName");this.$activeModal=a}};c(t,"\u0275fac",function(i){return new(i||t)(b(ie))}),c(t,"\u0275cmp",w({type:t,selectors:[["ng-component"]],inputs:{roomName:"roomName"},decls:30,vars:21,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["role","alert",1,"alert"],[1,"md-form"],["type","text","id","form-name","autofocus","",1,"form-control","px-0",3,"ngModelChange","keyup.enter","ngModel","ngModelOptions"],["for","form-name"],[1,"fas","fa-fw","fa-home"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","button","data-dismiss","modal",1,"btn","btn-primary",3,"click"]],template:function(i,m){i&1&&(r(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),u(4),l(5,"translate"),s(),r(6,"button",3),l(7,"translate"),v("click",function(){return m.$activeModal.dismiss("Dismiss")}),r(8,"span",4),u(9,"\xD7"),s()()(),r(10,"div",5)(11,"div",6),u(12),l(13,"translate"),s(),r(14,"div",7)(15,"input",8),T("ngModelChange",function(E){return I(m.roomName,E)||(m.roomName=E),E}),v("keyup.enter",function(){return m.$activeModal.close(m.roomName)}),s(),r(16,"label",9),_(17,"i",10),u(18),l(19,"translate"),s()()(),r(20,"div",11)(21,"div",12)(22,"button",13),v("click",function(){return m.$activeModal.dismiss("Dismiss")}),u(23),l(24,"translate"),s()(),_(25,"div",14),r(26,"div",15)(27,"button",16),v("click",function(){return m.$activeModal.close(m.roomName)}),u(28),l(29,"translate"),s()()()()()),i&2&&(n(4),f(d(5,8,"accessories.button_add_room")),n(2),C("aria-label",d(7,10,"form.button_close")),n(6),f(d(13,12,"accessories.rooms_not_appear_in_homekit")),n(3),k("ngModel",m.roomName),p("ngModelOptions",L(20,Ce)),n(3),S(" ",d(19,14,"accessories.room_name")," "),n(5),S(" ",d(24,16,"form.button_close")," "),n(5),S(" ",d(29,18,"form.button_save")," "))},dependencies:[ee,Q,U,X,Z,Y,A],encapsulation:2}));let e=t;return e})();var fe=(()=>{let t=class t{constructor(){}};c(t,"\u0275fac",function(i){return new(i||t)}),c(t,"\u0275cmp",w({type:t,selectors:[["app-drag-here-placeholder"]],decls:5,vars:3,consts:[[1,"accessory-box"],[1,"fas","fa-fw","fa-arrow-alt-circle-down","accessory-icon"],[1,"accessory-label"]],template:function(i,m){i&1&&(r(0,"div",0),_(1,"i",1),r(2,"div",2),u(3),l(4,"translate"),s()()),i&2&&(n(3),f(d(4,1,"accessories.control.drag_here")))},dependencies:[A],styles:[".accessory-box[_ngcontent-%COMP%]{opacity:.2}"]}));let e=t;return e})();var we=e=>({"cursor-move":e});function Se(e,t){if(e&1&&(r(0,"div",19)(1,"div",20)(2,"h5",21),u(3),l(4,"translate"),s()()()),e&2){let o=g().$implicit,a=g(2);n(2),p("ngClass",j(4,we,!a.isMobile)),n(),S(" ",o.name==="Default Room"?d(4,2,"accessories.control.default_room"):o.name," ")}}function ke(e,t){if(e&1&&(P(0),_(1,"app-accessory-tile",26),F()),e&2){let o=g().$implicit;n(),p("service",o)}}function Ie(e,t){if(e&1&&(r(0,"div",25),x(1,ke,2,1,"ng-container",0),s()),e&2){let o=t.$implicit,a=g(4);p("ngSwitch",o.type),n(),p("ngIf",!a.hideHidden||!o.hidden)}}function Te(e,t){if(e&1){let o=N();r(0,"div",22),T("dragulaModelChange",function(i){h(o);let m=g().$implicit;return I(m.services,i)||(m.services=i),y(i)}),x(1,Ie,2,2,"div",23),_(2,"div",24)(3,"div",24)(4,"div",24)(5,"div",24)(6,"div",24)(7,"div",24)(8,"div",24)(9,"div",24)(10,"div",24)(11,"div",24)(12,"div",24)(13,"div",24)(14,"div",24)(15,"div",24)(16,"div",24),s()}if(e&2){let o=g().$implicit;p("dragula","services-bag"),k("dragulaModel",o.services),n(),p("ngForOf",o.services)}}function Ae(e,t){if(e&1){let o=N();r(0,"div",27),T("dragulaModelChange",function(i){h(o);let m=g().$implicit;return I(m.services,i)||(m.services=i),y(i)}),_(1,"app-drag-here-placeholder",28),s()}if(e&2){let o=g().$implicit;p("dragula","services-bag"),k("dragulaModel",o.services)}}function Ee(e,t){if(e&1&&(r(0,"div"),x(1,Se,5,6,"div",15),r(2,"div",16),x(3,Te,17,3,"div",17)(4,Ae,2,2,"div",18),s()()),e&2){let o=t.$implicit,a=g(2);n(),p("ngIf",!a.isMobile||o.services.length),n(2),p("ngIf",o.services.length),n(),p("ngIf",!o.services.length&&!a.isMobile)}}function $e(e,t){if(e&1){let o=N();r(0,"div")(1,"div",1)(2,"div",2)(3,"h3",3),u(4),l(5,"translate"),s()(),r(6,"div",4)(7,"div",5)(8,"button",6),l(9,"translate"),l(10,"translate"),v("click",function(){h(o);let i=g();return y(i.addRoom())}),_(11,"i",7),s()(),r(12,"div",5)(13,"button",6),l(14,"translate"),l(15,"translate"),l(16,"translate"),l(17,"translate"),v("click",function(){h(o);let i=g();return y(i.hideHidden=!i.hideHidden)}),_(18,"i",8),s()(),r(19,"div",5)(20,"button",9),l(21,"translate"),l(22,"translate"),v("click",function(){h(o);let i=g();return y(i.toggleLayoutLock())}),_(23,"i",10),s(),r(24,"button",11),l(25,"translate"),l(26,"translate"),v("click",function(){h(o);let i=g();return y(i.toggleLayoutLock())}),_(27,"i",12),s()()()(),r(28,"div",13),T("dragulaModelChange",function(i){h(o);let m=g();return I(m.$accessories.rooms,i)||(m.$accessories.rooms=i),y(i)}),x(29,Ee,5,3,"div",14),s()()}if(e&2){let o=g();n(4),f(d(5,17,"accessories.title_accessories")),n(4),p("hidden",o.isMobile)("ngbTooltip",d(9,19,"accessories.button_add_room")),C("aria-label",d(10,21,"accessories.button_add_room")),n(5),p("hidden",o.isMobile)("ngbTooltip",o.hideHidden?d(14,23,"accessories.button_hidden_show"):d(15,25,"accessories.button_hidden_hide")),C("aria-label",o.hideHidden?d(16,27,"accessories.button_hidden_show"):d(17,29,"accessories.button_hidden_hide")),n(5),p("ngClass",o.hideHidden?"fa-eye-slash":"fa-eye"),n(2),p("disabled",!o.isMobile)("ngbTooltip",d(21,31,"form.button_unlock")),C("aria-label",d(22,33,"form.button_unlock")),n(4),p("disabled",o.isMobile)("ngbTooltip",d(25,35,"form.button_lock")),C("aria-label",d(26,37,"form.button_lock")),n(4),p("dragula","rooms-bag"),k("dragulaModel",o.$accessories.rooms),n(),p("ngForOf",o.$accessories.rooms)}}function Be(e,t){e&1&&(r(0,"p",37),u(1),l(2,"translate"),s()),e&2&&(n(),f(d(2,1,"accessories.settings_link")))}function Ne(e,t){if(e&1&&(r(0,"div")(1,"div",19)(2,"div",29)(3,"h3",30),u(4),l(5,"translate"),s()(),r(6,"div",31)(7,"div",32)(8,"h4",33),u(9),l(10,"translate"),s(),r(11,"div")(12,"p"),u(13),l(14,"translate"),s(),r(15,"p",34)(16,"span"),u(17),l(18,"translate"),s(),r(19,"a",35),u(20," https://github.com/homebridge/homebridge-config-ui-x/wiki/Enabling-Accessory-Control "),s(),r(21,"span"),u(22),l(23,"translate"),s()(),x(24,Be,3,3,"p",36),s()()()()()),e&2){let o=g();n(4),f(d(5,6,"accessories.title_accessories")),n(5),f(d(10,8,"accessories.control_disabled")),n(4),f(d(14,10,"accessories.message_must_use_insecure_mode")),n(4),f(d(18,12,"accessories.message_please_see")),n(5),f(d(23,14,"accessories.message_for_more_information")),n(2),p("ngIf",o.$auth.user.admin)}}var ve=(()=>{let t=class t{constructor(a,i,m,M,E,he){c(this,"$auth");c(this,"dragulaService");c(this,"$modal");c(this,"$settings");c(this,"$md");c(this,"$accessories");c(this,"isMobile",!1);c(this,"hideHidden",!0);c(this,"orderSubscription");this.$auth=a,this.dragulaService=i,this.$modal=m,this.$settings=M,this.$md=E,this.$accessories=he,this.isMobile=this.$md.detect.mobile(),i.createGroup("rooms-bag",{moves:(O,Ve,ye)=>!this.isMobile&&ye.classList.contains("drag-handle")}),i.createGroup("services-bag",{moves:O=>!this.isMobile&&!O.classList.contains("no-drag")}),this.orderSubscription=i.drop().subscribe(()=>{setTimeout(()=>{this.$accessories.saveLayout()})}),window.localStorage.getItem("accessories-layout-locked")&&(this.isMobile=!0)}ngOnInit(){this.$accessories.start()}addRoom(){this.$modal.open(_e,{size:"lg",backdrop:"static"}).result.then(a=>{!a||!a.length||this.$accessories.rooms.find(i=>i.name===a)||(this.$accessories.rooms.push({name:a,services:[]}),this.isMobile&&this.toggleLayoutLock())}).catch(()=>{})}toggleLayoutLock(){this.isMobile=!this.isMobile,this.isMobile?window.localStorage.setItem("accessories-layout-locked","yes"):window.localStorage.removeItem("accessories-layout-locked")}ngOnDestroy(){this.$accessories.stop(),this.orderSubscription.unsubscribe(),this.dragulaService.destroy("rooms-bag"),this.dragulaService.destroy("services-bag")}};c(t,"\u0275fac",function(i){return new(i||t)(b(K),b(se),b(oe),b(J),b(de),b(ae))}),c(t,"\u0275cmp",w({type:t,selectors:[["app-accessories"]],decls:2,vars:2,consts:[[4,"ngIf"],[1,"row","mb-3"],[1,"col-sm-6"],[1,"primary-text","m-0"],[1,"col-sm-6","text-right","d-none","d-sm-block"],["role","group",1,"btn-group"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","status-button","my-0",3,"click","hidden","ngbTooltip"],[1,"fas","fa-fw","fa-folder-plus"],[1,"fas","fa-fw",3,"ngClass"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","status-button","my-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-unlock"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","status-button","my-0","mr-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-lock"],[3,"dragulaModelChange","dragula","dragulaModel"],[4,"ngFor","ngForOf"],["class","row",4,"ngIf"],[1,"row","mb-4"],["class","col-md-12 d-flex flex-wrap justify-content-between noselect services-bag",3,"dragula","dragulaModel","dragulaModelChange",4,"ngIf"],["class","col-md-12 d-flex flex-wrap noselect",3,"dragula","dragulaModel","dragulaModelChange",4,"ngIf"],[1,"row"],[1,"col-md-12"],[1,"primary-text","drag-handle","room-title","m-0",3,"ngClass"],[1,"col-md-12","d-flex","flex-wrap","justify-content-between","noselect","services-bag",3,"dragulaModelChange","dragula","dragulaModel"],["class","accessory-item accessory-tab",3,"ngSwitch",4,"ngFor","ngForOf"],[1,"accessory-box","invisible","py-0","my-0",2,"height","0 !important"],[1,"accessory-item","accessory-tab",3,"ngSwitch"],[3,"service"],[1,"col-md-12","d-flex","flex-wrap","noselect",3,"dragulaModelChange","dragula","dragulaModel"],[1,"no-drag"],[1,"col-12"],[1,"primary-text","m-0","mb-3"],[1,"col-12","text-center"],["role","alert",1,"alert","alert-warning","p-4"],[1,"primary-text","mb-3","mt-0"],[1,"mb-0"],["target","_blank","rel","noopener noreferrer","href","https://github.com/homebridge/homebridge-config-ui-x/wiki/Enabling-Accessory-Control"],["class","mt-3 mb-0",4,"ngIf"],[1,"mt-3","mb-0"]],template:function(i,m){i&1&&x(0,$e,30,39,"div",0)(1,Ne,25,16,"div",0),i&2&&(p("ngIf",m.$settings.env.enableAccessories),n(),p("ngIf",!m.$settings.env.enableAccessories))},dependencies:[W,R,H,G,ne,ce,me,fe,A],styles:[".room-title[_ngcontent-%COMP%]{margin-left:10px}@media (max-width: 575px){.room-title[_ngcontent-%COMP%]{margin-left:7px}}.services-bag[_ngcontent-%COMP%]{min-height:170px}@media (max-width: 575px){.services-bag[_ngcontent-%COMP%]{min-height:initial}}.cursor-move[_ngcontent-%COMP%]{cursor:move}.gu-transit[_ngcontent-%COMP%] .manage-accessory-button[_ngcontent-%COMP%]{display:none}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]}));let e=t;return e})();var De=[{path:"",component:ve}],be=(()=>{let t=class t{};c(t,"\u0275fac",function(i){return new(i||t)}),c(t,"\u0275mod",B({type:t})),c(t,"\u0275inj",$({imports:[V.forChild(De),V]}));let e=t;return e})();var gt=(()=>{let t=class t{};c(t,"\u0275fac",function(i){return new(i||t)}),c(t,"\u0275mod",B({type:t})),c(t,"\u0275inj",$({imports:[z,te,re,le,q.forChild(),pe,ue,be]}));let e=t;return e})();export{gt as AccessoriesModule};
@@ -1,8 +0,0 @@
1
- import{a as F}from"./chunk-GNQUXZMN.js";import{a as S,b as U}from"./chunk-THFLPY67.js";import{a as g}from"./chunk-7564WJJL.js";import{H as w,W as k,Z as L,e as O,g as h,h as a,l as E}from"./chunk-IGUSDGD6.js";var M=O((v,b)=>{(function(l,n){typeof define=="function"&&define.amd?define([],n):typeof v<"u"?n():(n(),l.FileSaver={})})(v,function(){"use strict";function l(e,i){return typeof i>"u"?i={autoBom:!1}:typeof i!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function n(e,i,s){var t=new XMLHttpRequest;t.open("GET",e),t.responseType="blob",t.onload=function(){d(t.response,i,s)},t.onerror=function(){console.error("could not download file")},t.send()}function y(e){var i=new XMLHttpRequest;i.open("HEAD",e,!1);try{i.send()}catch{}return 200<=i.status&&299>=i.status}function c(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(i)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,m=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(e,i,s){var t=o.URL||o.webkitURL,r=document.createElement("a");i=i||e.name||"download",r.download=i,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin===location.origin?c(r):y(r.href)?n(e,i,s):c(r,r.target="_blank")):(r.href=t.createObjectURL(e),setTimeout(function(){t.revokeObjectURL(r.href)},4e4),setTimeout(function(){c(r)},0))}:"msSaveOrOpenBlob"in navigator?function(e,i,s){if(i=i||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(l(e,s),i);else if(y(e))n(e,i,s);else{var t=document.createElement("a");t.href=e,t.target="_blank",setTimeout(function(){c(t)})}}:function(e,i,s,t){if(t=t||open("","_blank"),t&&(t.document.title=t.document.body.innerText="downloading..."),typeof e=="string")return n(e,i,s);var r=e.type==="application/octet-stream",x=/constructor/i.test(o.HTMLElement)||o.safari,A=/CriOS\/[\d]+/.test(navigator.userAgent);if((A||r&&x||m)&&typeof FileReader<"u"){var u=new FileReader;u.onloadend=function(){var f=u.result;f=A?f:f.replace(/^data:[^;]*;/,"data:attachment/file;"),t?t.location.href=f:location=f,t=null},u.readAsDataURL(e)}else{var R=o.URL||o.webkitURL,p=R.createObjectURL(e);t?t.location=p:location.href=p,t=null,setTimeout(function(){R.revokeObjectURL(p)},4e4)}});o.saveAs=d.saveAs=d,typeof b<"u"&&(b.exports=d)})});var j=h(S(),1),T=h(U(),1),z=h(F(),1);var I=(()=>{let n=class n{constructor(c){a(this,"$ws");a(this,"term");a(this,"io");a(this,"fitAddon");a(this,"webLinksAddon");a(this,"resize");a(this,"elementResize");a(this,"pluginName");this.$ws=c}startTerminal(c,o={},m,d){this.pluginName=d,this.elementResize=m,this.io=this.$ws.connectToNamespace("log"),this.term=new j.Terminal(o),setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.fitAddon=new T.FitAddon,this.webLinksAddon=new z.WebLinksAddon,this.resize=new E,this.term.open(c.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),this.io.connected.subscribe(()=>{this.term.reset(),this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows})}),this.io.socket.on("disconnect",()=>{this.term.write(`
2
- \r
3
- \rWebsocket failed to connect. Is the server running?
4
- \r
5
- \r`)}),this.resize.pipe(w(500)).subscribe(e=>{this.io.socket.emit("resize",e)}),this.io.socket.on("stdout",e=>{if(this.pluginName){let i=e.split(`
6
- \r`),s=!1;i.forEach(t=>{if(t){if(s)if(t.match(/36m\[.*?\]/))s=!1;else{this.term.write(`${t}
7
- \r`);return}t.includes(`36m[${this.pluginName}]`)&&(this.term.write(`${t}
8
- \r`),s=!0)}})}else this.term.write(e)}),this.term.onResize(e=>{this.resize.next(e)}),this.elementResize&&this.elementResize.pipe(w(100)).subscribe({next:()=>{this.fitAddon.fit()}})}destroyTerminal(){this.io.end(),this.term.dispose(),this.resize.complete(),this.elementResize&&this.elementResize.complete()}};a(n,"\u0275fac",function(o){return new(o||n)(L(g))}),a(n,"\u0275prov",k({token:n,factory:n.\u0275fac,providedIn:"root"}));let l=n;return l})();export{I as a,M as b};
@@ -1,20 +0,0 @@
1
- import{a as fe}from"./chunk-BROUJ7PT.js";import{a as Ie}from"./chunk-4R6MSI5I.js";import{a as de,b as me,c as pe}from"./chunk-SJTXTMYT.js";import{a as le}from"./chunk-B6C32ZRK.js";import{a as ce}from"./chunk-7R6JSPNH.js";import{M as ne,N as re,O as ae,Q as se,c as Z,e as ee,l as te,y as ie,z as oe}from"./chunk-WCDFKYP6.js";import{c as k,k as I,m as X}from"./chunk-S4SOWUAW.js";import{a as E,b as P,c as Q}from"./chunk-F22FMU37.js";import{$ as j,$b as W,Ab as J,Ba as F,Ga as x,Ka as C,La as d,Qb as K,Rb as H,Ua as l,Va as c,W as B,Wa as v,X as V,Z as T,Za as w,Zb as U,aa as A,ab as b,bb as p,g as ke,h as r,ha as u,i as M,ia as h,jb as _,kb as $,lb as D,ob as L,pb as q,qb as z,qc as Y,sc as G,t as S,vc as O,wa as s,xa as g,yb as m,zb as f}from"./chunk-IGUSDGD6.js";function Se(o,n){o&1&&(l(0,"div",15),v(1,"i",16),c())}function Ve(o,n){if(o&1){let a=w();l(0,"tr")(1,"td",19),_(2),m(3,"date"),c(),l(4,"td",20)(5,"a",21),b("click",function(){let t=u(a).$implicit,i=p(2);return h(i.restore(t.id))}),_(6),m(7,"translate"),v(8,"i",22),c()()()}if(o&2){let a=n.$implicit;s(2),$(J(3,2,a.timestamp,"medium")),s(4),D(" ",f(7,5,"config.restore.copy_to_editor")," ")}}function je(o,n){if(o&1&&(l(0,"table",17)(1,"tbody"),x(2,Ve,9,7,"tr",18),c()()),o&2){let a=p();s(2),d("ngForOf",a.backupList)}}function Ae(o,n){o&1&&(l(0,"div")(1,"h3",12),_(2),m(3,"translate"),c()()),o&2&&(s(2),$(f(3,1,"config.restore.no_backups")))}function De(o,n){if(o&1){let a=w();l(0,"button",23),m(1,"translate"),b("click",function(){u(a);let t=p();return h(t.deleteAllBackups())}),_(2),m(3,"translate"),c()}o&2&&(C("aria-label",f(1,2,"form.button_remove")),s(2),D(" ",f(3,4,"form.button_remove")," "))}var be=(()=>{let n=class n{constructor(e,t,i,y){r(this,"$activeModal");r(this,"$api");r(this,"$toastr");r(this,"$translate");r(this,"loading",!0);r(this,"backupList",[]);this.$activeModal=e,this.$api=t,this.$toastr=i,this.$translate=y}ngOnInit(){this.$api.get("/config-editor/backups").subscribe({next:e=>{this.loading=!1,this.backupList=e},error:e=>{this.loading=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}restore(e){return this.$activeModal.close(e)}deleteAllBackups(){return this.$api.delete("/config-editor/backups").subscribe({next:()=>{this.$activeModal.dismiss(),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success"))},error:e=>{console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}};r(n,"\u0275fac",function(t){return new(t||n)(g(ne),g(k),g(I),g(E))}),r(n,"\u0275cmp",j({type:n,selectors:[["ng-component"]],decls:22,vars:16,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["class","text-center primary-text",4,"ngIf"],["class","table table-borderless table-hover table-sm",4,"ngIf"],[4,"ngIf"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","button","class","btn btn-danger mr-auto",3,"click",4,"ngIf"],[1,"text-center","primary-text"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"table","table-borderless","table-hover","table-sm"],[4,"ngFor","ngForOf"],[1,"w-100"],["nowrap",""],[1,"card-link",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["type","button",1,"btn","btn-danger","mr-auto",3,"click"]],template:function(t,i){t&1&&(l(0,"div",0)(1,"div",1)(2,"h5",2),_(3),m(4,"translate"),c(),l(5,"button",3),m(6,"translate"),b("click",function(){return i.$activeModal.dismiss("Dismiss")}),l(7,"span",4),_(8,"\xD7"),c()()(),l(9,"div",5),x(10,Se,2,0,"div",6)(11,je,3,1,"table",7)(12,Ae,4,3,"div",8),c(),l(13,"div",9)(14,"div",10)(15,"button",11),m(16,"translate"),b("click",function(){return i.$activeModal.dismiss("Dismiss")}),_(17),m(18,"translate"),c()(),v(19,"div",12),l(20,"div",13),x(21,De,4,6,"button",14),c()()()),t&2&&(s(3),$(f(4,8,"config.restore.title_restore_homebridge_backup")),s(2),C("aria-label",f(6,10,"form.button_close")),s(5),d("ngIf",i.loading),s(),d("ngIf",!i.loading&&i.backupList&&i.backupList.length),s(),d("ngIf",!i.loading&&(!i.backupList||!i.backupList.length)),s(3),C("aria-label",f(16,12,"form.button_close")),s(2),D(" ",f(18,14,"form.button_close")," "),s(4),d("ngIf",!i.loading&&i.backupList.length))},dependencies:[K,H,U,P],encapsulation:2}));let o=n;return o})();var _e=ke(Ie(),1);function Pe(o,n){if(o&1){let a=w();l(0,"button",13),m(1,"translate"),m(2,"translate"),b("click",function(){u(a);let t=p();return h(t.onExportConfig())}),v(3,"i",14),c()}o&2&&(d("ngbTooltip",f(1,2,"form.button_download")),C("aria-label",f(2,4,"form.button_download")))}function Re(o,n){if(o&1){let a=w();l(0,"button",15),m(1,"translate"),m(2,"translate"),b("click",function(){u(a);let t=p();return h(t.onCancelRestore())}),v(3,"i",16),c()}if(o&2){let a=p();d("disabled",a.saveInProgress)("ngbTooltip",f(1,3,"form.button_cancel")),C("aria-label",f(2,5,"form.button_cancel"))}}function Ne(o,n){if(o&1){let a=w();l(0,"button",13),m(1,"translate"),m(2,"translate"),b("click",function(){u(a);let t=p();return h(t.onRestore())}),v(3,"i",17),c()}o&2&&(d("ngbTooltip",f(1,2,"form.button_restore")),C("aria-label",f(2,4,"form.button_restore")))}function Oe(o,n){o&1&&v(0,"i",18)}function Be(o,n){o&1&&v(0,"i",19)}function Fe(o,n){if(o&1){let a=w();l(0,"ngx-monaco-editor",20),b("onInit",function(t){u(a);let i=p();return h(i.onEditorInit(t))})("keydown.control.s",function(t){u(a);let i=p();return t.preventDefault(),h(i.onSave())})("keydown.meta.s",function(t){u(a);let i=p();return t.preventDefault(),h(i.onSave())}),c()}if(o&2){let a=p();d("options",a.editorOptions)("model",a.monacoEditorModel)}}function Le(o,n){if(o&1){let a=w();l(0,"ngx-monaco-diff-editor",21),b("onInit",function(t){u(a);let i=p();return h(i.onInitDiffEditor(t))})("keydown.control.s",function(t){u(a);let i=p();return t.preventDefault(),h(i.onSave())})("keydown.meta.s",function(t){u(a);let i=p();return t.preventDefault(),h(i.onSave())}),c()}if(o&2){let a=p();d("options",a.editorOptions)("originalModel",a.monacoEditorModel)("modifiedModel",a.monacoEditorModel)}}function qe(o,n){if(o&1){let a=w();l(0,"textarea",22),z("ngModelChange",function(t){u(a);let i=p();return q(i.homebridgeConfig,t)||(i.homebridgeConfig=t),h(t)}),_(1," "),c()}if(o&2){let a=p();L("ngModel",a.homebridgeConfig)}}var ye=(()=>{let n=class n{constructor(e,t,i,y,we,Ce,xe,$e,Ee){r(this,"$api");r(this,"$md");r(this,"$modal");r(this,"$monacoEditor");r(this,"$route");r(this,"$renderer");r(this,"$settings");r(this,"$toastr");r(this,"$translate");r(this,"homebridgeConfig");r(this,"originalConfig");r(this,"saveInProgress");r(this,"isMobile",!1);r(this,"monacoEditor");r(this,"editorOptions");r(this,"monacoEditorModel");r(this,"editorDecorations",[]);r(this,"lastHeight");r(this,"visualViewPortEventCallback");this.$api=e,this.$md=t,this.$modal=i,this.$monacoEditor=y,this.$route=we,this.$renderer=Ce,this.$settings=xe,this.$toastr=$e,this.$translate=Ee,this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(t=>{this.homebridgeConfig=t.config}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}})}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return M(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let t=window.monaco.editor.getModelMarkers({owner:"json"});for(let i of t)if(i.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}parseConfigFromEditor(){try{return JSON.parse(this.homebridgeConfig)}catch{let t=_e.default.parse(this.homebridgeConfig);return this.homebridgeConfig=JSON.stringify(t,null,4),this.monacoEditor&&this.monacoEditor.getModel().setValue(this.homebridgeConfig),t}}saveConfig(e){return M(this,null,function*(){try{let t=yield S(this.$api.post("/config-editor",e));this.homebridgeConfig=JSON.stringify(t,null,4),this.$modal.open(ce,{size:"lg",backdrop:"static"})}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}})}onRestore(){this.$modal.open(be,{size:"lg",backdrop:"static"}).result.then(e=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${e}`).subscribe({next:t=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(t,null,4),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig,forceMoveMarkers:!0}]))},error:t=>{console.error(t),this.$toastr.error(t.error.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onExportConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.homebridgeConfig)}`,t=document.createElement("a");t.setAttribute("href",e),t.setAttribute("download","config.json"),document.body.appendChild(t),t.click(),t.remove()}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig=""}validateSection(e,t){for(let i of e){if(typeof i!="object"||Array.isArray(i))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(!i[t])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(typeof i[t]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1}return!0}validatePlugins(e,t){for(let i of e)if(typeof i!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:t}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
2
- `).map(t=>` ${t}`).join(`
3
- `),setTimeout(()=>{let t=this.monacoEditor.getModel().findMatches(e);if(t.length){let i=t[0].range,y=new monaco.Range(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn);this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[{range:y,options:{isWholeLine:!0,linesDecorationsClassName:"hb-monaco-editor-line-error"}}])}},200))}setMonacoEditorModel(){if(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.some(t=>t.uri==="http://homebridge/config.json"))return;let e=monaco.Uri.parse("a://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({allowComments:!1,validate:!0,schemas:[{uri:"http://homebridge/config.json",fileMatch:[e.toString()],schema:{type:"object",required:["bridge"],properties:{bridge:{type:"object",required:["name","username","port","pin"],properties:{name:{type:"string",description:`The Homebridge instance name.
4
- This should be unique if you are running multiple instances of Homebridge.`,default:"Homebridge"},username:{type:"string",description:`Homebridge username must be 6 pairs of colon-separated hexadecimal characters (A-F 0-9).
5
- You should change this pin if you need to re-pair your instance with HomeKit.
6
- Example: 0E:89:49:64:91:86`,default:"0E:89:49:64:91:86",pattern:"^([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}$"},port:{type:"number",description:`The port Homebridge listens on.
7
- If running more than one instance of Homebridge on the same server make sure each instance is given a unique port.`,default:51173,minimum:1025,maximum:65534},pin:{type:"string",description:`The Homebridge instance pin.
8
- This is used when pairing Homebridge to HomeKit.
9
- Example: 630-27-655`,default:"630-27-655",pattern:"^([0-9]{3}-[0-9]{2}-[0-9]{3})$"},manufacturer:{type:"string",description:"The bridge manufacturer to be displayed in HomeKit"},firmwareRevision:{type:"string",description:"The bridge firmware version to be displayed in HomeKit"},model:{type:"string",description:"The bridge model to be displayed in HomeKit"},bind:{description:`A string or an array of strings with the name(s) of the network interface(s) Homebridge should bind to.
10
-
11
- Requires Homebridge v1.3 or later.`,type:["string","array"],items:{type:"string",description:"Network Interface name that Homebridge should bind to."}}},default:{name:"Homebridge",username:"0E:89:49:64:91:86",port:51173,pin:"6302-7655"}},mdns:{type:"object",properties:{interface:{type:"string",description:`The interface or IP address of the interface you want Homebridge to listen on. This is useful if your server has multiple interfaces.
12
-
13
- Depreciated as of Homebridge v1.3.0 - use bridge.bind instead.`},legacyAdvertiser:{type:"boolean",description:"Set to `false` to use the new mdns library, ciao."}},default:{legacyAdvertiser:!1}},plugins:{type:"array",description:"An array of plugins that should be selectively enabled. Remove this array to enable all plugins.",items:{type:"string",description:`The full plugin npm package name.
14
- Example: homebridge-dummy`},default:["homebridge-config-ui-x"]},disabledPlugins:{type:"array",description:`An array of plugins that should be disabled.
15
-
16
- Requires Homebridge v1.3 or later.`,items:{type:"string",description:`The full plugin npm package name.
17
- Example: homebridge-dummy`},default:[]},ports:{type:"object",description:"The range of ports that should be used for certain accessories like cameras and TVs",required:["start","end"],properties:{start:{type:"number",default:52100,minimum:1025,maximum:65534},end:{type:"number",default:52150,minimum:1025,maximum:65534}},default:{start:52100,end:52150}},platforms:{type:"array",description:`Any plugin that exposes a platform should have it's config entered in this array.
18
- Separate each plugin config block using a comma.`,items:{type:"object",required:["platform"],anyOf:[{type:"object",required:["platform"],properties:{platform:{type:"string",description:"This is used by Homebridge to identify which plugin this platform belongs to.",not:{enum:["config"]}},name:{type:"string",description:"The name of the platform."}}},{type:"object",properties:{platform:{type:"string",description:`Homebridge UI platform name must be set to "config".
19
- Do Not Change!`,oneOf:[{enum:"config"}]},name:{type:"string",description:"The name used in the Homebridge log."}}}]}},accessories:{type:"array",description:`Any plugin that exposes an accessory should have it's config entered in this array.
20
- Separate each plugin config block using a comma.`,items:{type:"object",required:["accessory","name"],properties:{accessory:{type:"string",description:"This is used by Homebridge to identify which plugin this accessory belongs to."},name:{type:"string",description:"The name of the accessory."}}}}}}}]}),this.monacoEditorModel.uri=monaco.Uri.parse("a://homebridge/config.json")}visualViewPortChanged(){this.lastHeight<window.visualViewport.height&&document.activeElement.blur(),window.visualViewport.height<window.innerHeight?(this.$md.enableTouchMove(),this.lastHeight=window.visualViewport.height):window.visualViewport.height===window.innerHeight&&(this.$md.disableTouchMove(),this.lastHeight=window.visualViewport.height)}ngOnDestroy(){let e=document.querySelector(".content");this.$renderer.removeStyle(e,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove()),this.monacoEditor&&this.monacoEditor.dispose()}};r(n,"\u0275fac",function(t){return new(t||n)(g(k),g(le),g(re),g(fe),g(Y),g(F),g(X),g(I),g(E))}),r(n,"\u0275cmp",j({type:n,selectors:[["ng-component"]],decls:18,vars:18,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100"],[1,"row"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-right"],["class","btn btn-elegant waves-effect my-0","container","body","placement","bottom","openDelay","150","triggers","hover",3,"ngbTooltip","click",4,"ngIf"],["class","btn btn-danger waves-effect my-0","container","body","placement","bottom","openDelay","150","triggers","hover",3,"disabled","ngbTooltip","click",4,"ngIf"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","waves-effect","my-0","mr-0",3,"click","disabled","ngbTooltip"],["class","fas fa-fw fa-floppy-disk",4,"ngIf"],["class","fas fa-fw fa-spinner fa-pulse",4,"ngIf"],["class","flex-grow-1 h-100 w-100 mt-3 mb-0",3,"options","model","onInit","keydown.control.s","keydown.meta.s",4,"ngIf"],["class","flex-grow-1 h-100 w-100 mt-3 mb-0",3,"options","originalModel","modifiedModel","onInit","keydown.control.s","keydown.meta.s",4,"ngIf"],["wrap","off","class","hb-plain-text-editor align-self-end h-100 w-100 my-3","autocomplete","off","autocorrect","off","autocapitalize","off","spellcheck","false",3,"ngModel","ngModelChange",4,"ngIf"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","waves-effect","my-0",3,"click","ngbTooltip"],[1,"fas","fa-fw","fa-download"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-danger","waves-effect","my-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-times"],[1,"fas","fa-fw","fa-history"],[1,"fas","fa-fw","fa-floppy-disk"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],[1,"flex-grow-1","h-100","w-100","mt-3","mb-0",3,"onInit","keydown.control.s","keydown.meta.s","options","model"],[1,"flex-grow-1","h-100","w-100","mt-3","mb-0",3,"onInit","keydown.control.s","keydown.meta.s","options","originalModel","modifiedModel"],["wrap","off","autocomplete","off","autocorrect","off","autocapitalize","off","spellcheck","false",1,"hb-plain-text-editor","align-self-end","h-100","w-100","my-3",3,"ngModelChange","ngModel"]],template:function(t,i){t&1&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),_(4),m(5,"translate"),c()(),l(6,"div",4),x(7,Pe,4,6,"button",5)(8,Re,4,7,"button",6)(9,Ne,4,6,"button",5),l(10,"button",7),m(11,"translate"),m(12,"translate"),b("click",function(){return i.onSave()}),x(13,Oe,1,0,"i",8)(14,Be,1,0,"i",9),c()()(),x(15,Fe,1,2,"ngx-monaco-editor",10)(16,Le,1,3,"ngx-monaco-diff-editor",11)(17,qe,2,1,"textarea",12),c()),t&2&&(s(4),$(f(5,12,"menu.config_json_editor")),s(3),d("ngIf",!i.originalConfig),s(),d("ngIf",i.originalConfig),s(),d("ngIf",!i.originalConfig),s(),d("disabled",i.saveInProgress)("ngbTooltip",f(11,14,"form.button_save")),C("aria-label",f(12,16,"form.button_save")),s(3),d("ngIf",!i.saveInProgress),s(),d("ngIf",i.saveInProgress),s(),d("ngIf",!i.isMobile&&!i.originalConfig),s(),d("ngIf",!i.isMobile&&i.originalConfig),s(),d("ngIf",i.isMobile))},dependencies:[H,Z,ee,te,de,me,ae,P],encapsulation:2}));let o=n;return o})();var N=(()=>{let n=class n{constructor(e,t,i,y){r(this,"$api");r(this,"$router");r(this,"$toastr");r(this,"$translate");this.$api=e,this.$router=t,this.$toastr=i,this.$translate=y}resolve(){return M(this,null,function*(){try{let e=yield S(this.$api.get("/config-editor"));return JSON.stringify(e,null,4)}catch(e){console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}};r(n,"\u0275fac",function(t){return new(t||n)(T(k),T(G),T(I),T(E))}),r(n,"\u0275prov",B({token:n,factory:n.\u0275fac}));let o=n;return o})();var ze=[{path:"",component:ye,resolve:{config:N}}],ve=(()=>{let n=class n{};r(n,"\u0275fac",function(t){return new(t||n)}),r(n,"\u0275mod",A({type:n})),r(n,"\u0275inj",V({imports:[O.forChild(ze),O]}));let o=n;return o})();var Ct=(()=>{let n=class n{};r(n,"\u0275fac",function(t){return new(t||n)}),r(n,"\u0275mod",A({type:n})),r(n,"\u0275inj",V({providers:[N],imports:[W,ie,oe,pe,se,Q.forChild(),ve]}));let o=n;return o})();export{Ct as ConfigEditorModule};
@@ -1 +0,0 @@
1
- import{f as Se}from"./chunk-422JXES4.js";import{b as ye}from"./chunk-TS27NWVA.js";import"./chunk-7R6JSPNH.js";import"./chunk-JM7QCDMZ.js";import{c as H}from"./chunk-RIWBPQF3.js";import{G as we,M as N,N as Ce,Q as $e,b as J,c as B,d as w,e as D,f as K,g as M,j as C,m as W,o as X,p as Y,q as Z,w as he,y as ge,z as xe}from"./chunk-WCDFKYP6.js";import{a as Ge,c as I,k as E}from"./chunk-S4SOWUAW.js";import{a as S,b as T,c as ve}from"./chunk-F22FMU37.js";import{$ as k,$b as fe,Ab as ce,Ga as U,Ka as h,La as u,Pb as L,Qb as ue,Rb as G,Ua as s,Va as m,W as le,Wa as c,X as Q,Z as q,Za as V,aa as R,ab as g,bb as $,fb as pe,g as Ae,gb as me,h as o,ha as j,hb as de,i as se,ia as F,jb as d,kb as x,lb as b,qc as be,sc as _e,t as oe,ub as y,vc as ne,wa as t,xa as f,yb as l,zb as p}from"./chunk-IGUSDGD6.js";function qe(n,a){n&1&&(s(0,"p",15)(1,"small"),d(2),l(3,"translate"),m()()),n&2&&(t(2),x(p(3,1,"login.invalid_credentials")))}var Ie=(()=>{let a=class a{constructor(r,e,i,_){o(this,"$activeModal");o(this,"$api");o(this,"$toastr");o(this,"$translate");o(this,"formGroup",new M({password:new C("",[w.required])}));o(this,"invalidCredentials",!1);this.$activeModal=r,this.$api=e,this.$toastr=i,this.$translate=_}disable2fa(){this.invalidCredentials=!1,this.$api.post("/users/otp/deactivate",this.formGroup.value).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))},error:()=>{this.formGroup.setValue({password:""}),this.invalidCredentials=!0}})}};o(a,"\u0275fac",function(e){return new(e||a)(f(N),f(I),f(E),f(S))}),o(a,"\u0275cmp",k({type:a,selectors:[["ng-component"]],decls:28,vars:24,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],[1,"form-group"],["type","password","autocomplete","current-password",1,"form-control",3,"formControl","placeholder"],["class","red-text",4,"ngIf"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","button","data-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"red-text"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"div",1)(2,"h5",2),d(3),l(4,"translate"),m(),s(5,"button",3),l(6,"translate"),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),s(7,"span",4),d(8,"\xD7"),m()()(),s(9,"div",5)(10,"p"),d(11),l(12,"translate"),m(),s(13,"div",6),c(14,"input",7),l(15,"translate"),m(),U(16,qe,4,3,"p",8),m(),s(17,"div",9)(18,"div",10)(19,"button",11),l(20,"translate"),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),d(21),l(22,"translate"),m()(),c(23,"div",12),s(24,"div",13)(25,"button",14),g("click",function(){return i.disable2fa()}),d(26),l(27,"translate"),m()()()()),e&2&&(t(3),x(p(4,10,"users.setup_2fa_disable")),t(2),h("aria-label",p(6,12,"form.button_close")),t(6),x(p(12,14,"users.setup_2fa_disable_current_password")),t(3),u("formControl",i.formGroup.controls.password)("placeholder",p(15,16,"users.label_password")),t(2),u("ngIf",i.invalidCredentials),t(3),h("aria-label",p(20,18,"form.button_close")),t(2),b(" ",p(22,20,"form.button_close")," "),t(4),u("disabled",i.formGroup.invalid),t(),b(" ",p(27,22,"form.button_disable")," "))},dependencies:[G,B,D,X,T],encapsulation:2}));let n=a;return n})();var Ee=Ae(Ge(),1);var Pe=["qrcode"],ze=n=>({timeDiffError:n});function Oe(n,a){if(n&1&&(s(0,"div",15)(1,"h3"),d(2),l(3,"translate"),m(),s(4,"p"),d(5),l(6,"translate"),m()()),n&2){let v=$();t(2),x(p(3,2,"users.setup_2fa_cannot_setup_2fa")),t(3),x(ce(6,4,"users.setup_2fa_server_time_out",y(7,ze,v.timeDiffError)))}}function Qe(n,a){n&1&&(s(0,"div")(1,"p"),d(2),l(3,"translate"),m()()),n&2&&(t(2),x(p(3,1,"users.setup_2fa_scan_qr_code")))}function Re(n,a){if(n&1&&(s(0,"div",18)(1,"p"),d(2),l(3,"translate"),m(),s(4,"div",19),c(5,"input",20),m()()),n&2){let v=$();t(2),x(p(3,2,"users.setup_2fa_enter_code")),t(3),u("formControl",v.formGroup.controls.code)}}function Le(n,a){if(n&1){let v=V();s(0,"button",21),g("click",function(){j(v);let e=$();return F(e.enable2fa())}),d(1),l(2,"translate"),m()}if(n&2){let v=$();u("disabled",v.formGroup.invalid),t(),b(" ",p(2,2,"form.button_enable")," ")}}var ke=(()=>{let a=class a{constructor(r,e,i,_){o(this,"$activeModal");o(this,"$api");o(this,"$toastr");o(this,"$translate");o(this,"user");o(this,"qrcodeElement");o(this,"timeDiffError",null);o(this,"otpString");o(this,"formGroup",new M({code:new C("",[w.required,w.minLength(6),w.maxLength(6)])}));this.$activeModal=r,this.$api=e,this.$toastr=i,this.$translate=_}ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:r=>{this.checkTimeDiff(r.timestamp),this.timeDiffError||(this.otpString=r.otpauth)},error:r=>{this.$activeModal.dismiss(),console.error(r),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}checkTimeDiff(r){let e=(0,Ee.default)(r).diff(new Date,"millisecond");if(e<-5e3||e>5e3){this.timeDiffError=e;return}this.timeDiffError=null}enable2fa(){this.$api.post("/users/otp/activate",this.formGroup.value).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()},error:r=>{console.error(r),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}};o(a,"\u0275fac",function(e){return new(e||a)(f(N),f(I),f(E),f(S))}),o(a,"\u0275cmp",k({type:a,selectors:[["ng-component"]],viewQuery:function(e,i){if(e&1&&pe(Pe,7),e&2){let _;me(_=de())&&(i.qrcodeElement=_.first)}},inputs:{user:"user"},decls:27,vars:21,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["class","text-center",4,"ngIf"],["type","warning",3,"dismissible"],[4,"ngIf"],[1,"text-center","w-100","d-flex","justify-content-center"],[1,"mx-auto","my-2",2,"width","180px","height","180px",3,"data"],["class","mt-4",4,"ngIf"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","button","class","btn btn-primary","data-dismiss","modal",3,"disabled","click",4,"ngIf"],[1,"mt-4"],[1,"form-group"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control",3,"formControl"],["type","button","data-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"div",1)(2,"h5",2),d(3),l(4,"translate"),m(),s(5,"button",3),l(6,"translate"),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),s(7,"span",4),d(8,"\xD7"),m()()(),s(9,"div",5),U(10,Oe,7,9,"div",6),s(11,"ngb-alert",7),d(12),l(13,"translate"),m(),U(14,Qe,4,3,"div",8),s(15,"div",9),c(16,"app-qrcode",10),m(),U(17,Re,6,4,"div",11),m(),s(18,"div",12)(19,"div",13)(20,"button",14),l(21,"translate"),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),d(22),l(23,"translate"),m()(),c(24,"div",15),s(25,"div",16),U(26,Le,3,4,"button",17),m()()()),e&2&&(t(3),x(p(4,11,"users.setup_2fa")),t(2),h("aria-label",p(6,13,"form.button_close")),t(5),u("ngIf",i.timeDiffError),t(),u("dismissible",!1),t(),b(" ",p(13,15,"users.setup_2fa_warning")," "),t(2),u("ngIf",!i.timeDiffError),t(2),u("data",i.otpString),t(),u("ngIf",!i.timeDiffError),t(3),h("aria-label",p(21,17,"form.button_close")),t(2),b(" ",p(23,19,"form.button_close")," "),t(4),u("ngIf",!i.timeDiffError))},dependencies:[G,B,D,he,X,we,ye,T],encapsulation:2}));let n=a;return n})();var Ue=n=>({active:n}),Te=n=>({"is-invalid":n}),Be=(()=>{let a=class a{constructor(r,e,i,_){o(this,"$activeModal");o(this,"$api");o(this,"$toastr");o(this,"$translate");o(this,"form",new M({username:new C("",[w.required]),name:new C("",[w.required]),password:new C("",[w.compose([w.required,w.minLength(4)])]),passwordConfirm:new C("",[w.required]),admin:new C(!0)},this.matchPassword));o(this,"page",{title:"users.title_add_user",save:"users.button_add_new_user",password:"users.label_password"});this.$activeModal=r,this.$api=e,this.$toastr=i,this.$translate=_}matchPassword(r){let e=r.get("password").value,i=r.get("passwordConfirm").value;if(e!==i)r.get("passwordConfirm").setErrors({matchPassword:!0});else return null}onSubmit({value:r}){this.$api.post("/users",r).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:e=>{this.$toastr.error(e.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}};o(a,"\u0275fac",function(e){return new(e||a)(f(N),f(I),f(E),f(S))}),o(a,"\u0275cmp",k({type:a,selectors:[["ng-component"]],decls:59,vars:57,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],[1,"container","px-1"],[1,"md-form"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","px-0"],["for","form-username",3,"ngClass"],[1,"fas","fa-fw","fa-user-shield"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","px-0"],["for","form-name",3,"ngClass"],[1,"fas","fa-fw","fa-user"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","px-0",3,"ngClass"],["for","form-pass"],[1,"fas","fa-fw","fa-lock"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","px-0",3,"ngClass"],["for","form-pass-confirm"],[1,"form-group","row","align-items-center"],[1,"col-6","col-form-label","grey-text"],[1,"fas","fa-fw","fa-user-secret"],[1,"col-6","text-right"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ml-3",2,"min-width","50px"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"form",1),g("ngSubmit",function(){return i.onSubmit(i.form)}),s(2,"div",2)(3,"h5",3),d(4),l(5,"translate"),m(),s(6,"button",4),l(7,"translate"),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),s(8,"span",5),d(9,"\xD7"),m()()(),s(10,"div",6)(11,"div",7)(12,"div",8),c(13,"input",9),l(14,"translate"),s(15,"label",10),c(16,"i",11),d(17),l(18,"translate"),m()(),s(19,"div",8),c(20,"input",12),l(21,"translate"),s(22,"label",13),c(23,"i",14),d(24),l(25,"translate"),m()(),s(26,"div",8),c(27,"input",15),l(28,"translate"),s(29,"label",16),c(30,"i",17),d(31),l(32,"translate"),m()(),s(33,"div",8),c(34,"input",18),l(35,"translate"),s(36,"label",19),c(37,"i",17),d(38),l(39,"translate"),m()(),s(40,"div",20)(41,"label",21),c(42,"i",22),d(43),l(44,"translate"),m(),s(45,"div",23),c(46,"input",24),l(47,"translate"),c(48,"label",25),m()()()(),s(49,"div",26)(50,"div",27)(51,"button",28),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),d(52),l(53,"translate"),m()(),c(54,"div",29),s(55,"div",30)(56,"button",31),d(57),l(58,"translate"),m()()()()()),e&2&&(t(),u("formGroup",i.form),t(3),x(p(5,21,"users.title_add_user")),t(2),h("aria-label",p(7,23,"form.button_close")),t(7),h("disabled",i.page.title==="users.title_edit_user"?!0:null)("aria-label",p(14,25,"users.label_username")),t(2),u("ngClass",y(49,Ue,i.page.title==="users.title_edit_user")),t(2),b(" ",p(18,27,"users.label_username")," "),t(3),h("aria-label",p(21,29,"users.label_full_name")),t(2),u("ngClass",y(51,Ue,i.page.title==="users.title_edit_user")),t(2),b(" ",p(25,31,"users.label_full_name")," "),t(3),u("ngClass",y(53,Te,i.form.controls.password.dirty&&i.form.controls.password.errors)),h("aria-label",p(28,33,i.page.password)),t(4),b(" ",p(32,35,i.page.password)," "),t(3),u("ngClass",y(55,Te,i.form.controls.passwordConfirm.dirty&&i.form.controls.passwordConfirm.errors)),h("aria-label",p(35,37,"users.label_confirm_password")),t(4),b(" ",p(39,39,"users.label_confirm_password")," "),t(5),b(" ",p(44,41,"users.label_admin_user")," "),t(3),h("aria-label",p(47,43,"users.label_admin_user")),t(6),b(" ",p(53,45,"form.button_close")," "),t(4),u("disabled",!i.form.valid),t(),b(" ",p(58,47,"form.button_save")," "))},dependencies:[L,W,B,J,D,K,Y,Z,T],encapsulation:2}));let n=a;return n})();var De=n=>({active:n}),Me=n=>({"is-invalid":n}),Ne=(()=>{let a=class a{constructor(r,e,i,_,re){o(this,"$activeModal");o(this,"$api");o(this,"$auth");o(this,"$toastr");o(this,"$translate");o(this,"user");o(this,"form",new M({username:new C("",[w.required]),name:new C("",[w.required]),password:new C(""),passwordConfirm:new C(""),admin:new C(!0)},this.matchPassword));o(this,"page",{title:"users.title_edit_user",save:"form.button_save",password:"users.label_new_password"});o(this,"isCurrentUser",!1);this.$activeModal=r,this.$api=e,this.$auth=i,this.$toastr=_,this.$translate=re}ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user)}matchPassword(r){let e=r.get("password").value,i=r.get("passwordConfirm").value;if(e!==i)r.get("passwordConfirm").setErrors({matchPassword:!0});else return null}onSubmit({value:r}){this.$api.patch(`/users/${this.user.id}`,r).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&r.username!==this.$auth.user.username&&this.$auth.logout()},error:e=>{console.error(e),this.$toastr.error(e.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}};o(a,"\u0275fac",function(e){return new(e||a)(f(N),f(I),f(H),f(E),f(S))}),o(a,"\u0275cmp",k({type:a,selectors:[["ng-component"]],inputs:{user:"user"},decls:59,vars:56,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-dismiss","modal",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],[1,"container","px-1"],[1,"md-form"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","px-0"],["for","form-username",3,"ngClass"],[1,"fas","fa-fw","fa-user-shield"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","px-0"],["for","form-name",3,"ngClass"],[1,"fas","fa-fw","fa-user"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","px-0",3,"ngClass"],["for","form-pass"],[1,"fas","fa-fw","fa-lock"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","px-0",3,"ngClass"],["for","form-pass-confirm"],[1,"form-group","row","align-items-center"],[1,"col-6","col-form-label","grey-text"],[1,"fas","fa-fw","fa-user-secret"],[1,"col-6","text-right"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ml-3",2,"min-width","50px"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-right"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"form",1),g("ngSubmit",function(){return i.onSubmit(i.form)}),s(2,"div",2)(3,"h5",3),d(4),l(5,"translate"),m(),s(6,"button",4),l(7,"translate"),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),s(8,"span",5),d(9,"\xD7"),m()()(),s(10,"div",6)(11,"div",7)(12,"div",8),c(13,"input",9),l(14,"translate"),s(15,"label",10),c(16,"i",11),d(17),l(18,"translate"),m()(),s(19,"div",8),c(20,"input",12),l(21,"translate"),s(22,"label",13),c(23,"i",14),d(24),l(25,"translate"),m()(),s(26,"div",8),c(27,"input",15),l(28,"translate"),s(29,"label",16),c(30,"i",17),d(31),l(32,"translate"),m()(),s(33,"div",8),c(34,"input",18),l(35,"translate"),s(36,"label",19),c(37,"i",17),d(38),l(39,"translate"),m()(),s(40,"div",20)(41,"label",21),c(42,"i",22),d(43),l(44,"translate"),m(),s(45,"div",23),c(46,"input",24),l(47,"translate"),c(48,"label",25),m()()()(),s(49,"div",26)(50,"div",27)(51,"button",28),g("click",function(){return i.$activeModal.dismiss("Dismiss")}),d(52),l(53,"translate"),m()(),c(54,"div",29),s(55,"div",30)(56,"button",31),d(57),l(58,"translate"),m()()()()()),e&2&&(t(),u("formGroup",i.form),t(3),x(p(5,20,"users.title_edit_user")),t(2),h("aria-label",p(7,22,"form.button_close")),t(7),h("aria-label",p(14,24,"users.label_username")),t(2),u("ngClass",y(48,De,i.page.title==="users.title_edit_user")),t(2),b(" ",p(18,26,"users.label_username")," "),t(3),h("aria-label",p(21,28,"users.label_full_name")),t(2),u("ngClass",y(50,De,i.page.title==="users.title_edit_user")),t(2),b(" ",p(25,30,"users.label_full_name")," "),t(3),u("ngClass",y(52,Me,i.form.controls.password.dirty&&i.form.controls.password.errors)),h("aria-label",p(28,32,i.page.password)),t(4),b(" ",p(32,34,i.page.password)," "),t(3),u("ngClass",y(54,Me,i.form.controls.passwordConfirm.dirty&&i.form.controls.passwordConfirm.errors)),h("aria-label",p(35,36,"users.label_confirm_password")),t(4),b(" ",p(39,38,"users.label_confirm_password")," "),t(5),b(" ",p(44,40,"users.label_admin_user")," "),t(3),h("aria-label",p(47,42,"users.label_admin_user")),t(6),b(" ",p(53,44,"form.button_close")," "),t(4),u("disabled",!i.form.valid),t(),b(" ",p(58,46,"form.button_save")," "))},dependencies:[L,W,B,J,D,K,Y,Z,T],encapsulation:2}));let n=a;return n})();function Ke(n,a){if(n&1){let v=V();s(0,"button",20),g("click",function(){j(v);let e=$().$implicit,i=$();return F(i.deleteUser(e.id))}),d(1),l(2,"translate"),m()}n&2&&(t(),b(" ",p(2,1,"form.button_delete")," "))}function We(n,a){if(n&1){let v=V();s(0,"button",21),g("click",function(){j(v);let e=$().$implicit,i=$();return F(i.setup2fa(e))}),d(1),l(2,"translate"),m()}n&2&&(t(),b(" ",p(2,1,"users.setup_2fa")," "))}function Xe(n,a){if(n&1){let v=V();s(0,"button",19),g("click",function(){j(v);let e=$().$implicit,i=$();return F(i.disable2fa(e))}),d(1),l(2,"translate"),m()}n&2&&(t(),b(" ",p(2,1,"users.setup_2fa_disable")," "))}function Ye(n,a){if(n&1){let v=V();s(0,"div",8)(1,"div",9)(2,"div",10)(3,"div",11)(4,"span",12),c(5,"h4",13)(6,"h5",14),m()(),s(7,"div",15),U(8,Ke,3,3,"button",16)(9,We,3,3,"button",17)(10,Xe,3,3,"button",18),s(11,"button",19),g("click",function(){let e=j(v).$implicit,i=$();return F(i.openEditUser(e))}),d(12),l(13,"translate"),m()()()()()}if(n&2){let v=a.$implicit,r=$();t(5),u("innerText",v.name),t(),u("innerText",v.username),t(2),u("ngIf",r.$auth.user.username!==v.username),t(),u("ngIf",r.$auth.user.username===v.username&&!v.otpActive),t(),u("ngIf",r.$auth.user.username===v.username&&v.otpActive),t(2),x(p(13,6,"form.button_edit"))}}var je=(()=>{let a=class a{constructor(r,e,i,_,re,Ve){o(this,"$api");o(this,"$auth");o(this,"$modal");o(this,"$route");o(this,"$toastr");o(this,"$translate");o(this,"homebridgeUsers");this.$api=r,this.$auth=e,this.$modal=i,this.$route=_,this.$toastr=re,this.$translate=Ve}ngOnInit(){this.$route.data.subscribe(r=>{this.homebridgeUsers=r.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(r=>{this.homebridgeUsers=r})}openAddNewUser(){this.$modal.open(Be,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(r){let e=this.$modal.open(Ne,{size:"lg",backdrop:"static"});e.componentInstance.user=r,e.result.finally(()=>{this.reloadUsers()})}deleteUser(r){this.$api.delete(`/users/${r}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:e=>{console.error(e),this.$toastr.error(e.error.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(r){let e=this.$modal.open(ke,{size:"lg",backdrop:"static"});e.componentInstance.user=r,e.result.finally(()=>{this.reloadUsers()})}disable2fa(r){let e=this.$modal.open(Ie,{size:"lg",backdrop:"static"});e.componentInstance.user=r,e.result.finally(()=>{this.reloadUsers()})}};o(a,"\u0275fac",function(e){return new(e||a)(f(I),f(H),f(Ce),f(be),f(E),f(S))}),o(a,"\u0275cmp",k({type:a,selectors:[["app-users"]],decls:11,vars:7,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"primary-text","m-0"],[1,"col-3","text-right"],[1,"btn","btn-elegant","waves-effect","m-0",3,"click"],[1,"fas","fa-fw","fa-plus"],[1,"row"],["class","col-md-6 mb-4",4,"ngFor","ngForOf"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[3,"innerText"],[1,"small","text-truncate","primary-text",3,"innerText"],[1,"d-flex","flex-row","justify-content-between",2,"gap","10px"],["class","btn btn-elegant btn-sml m-0",3,"click",4,"ngIf"],["class","btn btn-primary mt-0 m-0",3,"click",4,"ngIf"],["class","btn btn-primary m-0",3,"click",4,"ngIf"],[1,"btn","btn-primary","m-0",3,"click"],[1,"btn","btn-elegant","btn-sml","m-0",3,"click"],[1,"btn","btn-primary","mt-0","m-0",3,"click"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"div",1)(2,"h3",2),d(3),l(4,"translate"),m()(),s(5,"div",3)(6,"button",4),l(7,"translate"),g("click",function(){return i.openAddNewUser()}),c(8,"i",5),m()()(),s(9,"div",6),U(10,Ye,14,8,"div",7),m()),e&2&&(t(3),x(p(4,3,"users.title_users")),t(3),h("aria-label",p(7,5,"users.button_add_user")),t(4),u("ngForOf",i.homebridgeUsers))},dependencies:[ue,G,T],encapsulation:2}));let n=a;return n})();var ie=(()=>{let a=class a{constructor(r,e,i,_){o(this,"$api");o(this,"$router");o(this,"$toastr");o(this,"$translate");this.$api=r,this.$router=e,this.$toastr=i,this.$translate=_}resolve(){return se(this,null,function*(){try{return yield oe(this.$api.get("/users"))}catch(r){console.error(r),this.$toastr.error(r.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}};o(a,"\u0275fac",function(e){return new(e||a)(q(I),q(_e),q(E),q(S))}),o(a,"\u0275prov",le({token:a,factory:a.\u0275fac}));let n=a;return n})();var Ze=[{path:"",component:je,resolve:{homebridgeUsers:ie}}],Fe=(()=>{let a=class a{};o(a,"\u0275fac",function(e){return new(e||a)}),o(a,"\u0275mod",R({type:a})),o(a,"\u0275inj",Q({imports:[ne.forChild(Ze),ne]}));let n=a;return n})();var Qt=(()=>{let a=class a{};o(a,"\u0275fac",function(e){return new(e||a)}),o(a,"\u0275mod",R({type:a})),o(a,"\u0275inj",Q({providers:[ie],imports:[fe,ge,xe,ve.forChild(),$e,Se,Fe]}));let n=a;return n})();export{Qt as UsersModule};
@@ -1 +0,0 @@
1
- import{a as H,b as h,c as $,m as S}from"./chunk-S4SOWUAW.js";import{Lb as I,W as p,X as j,Y as E,Z as a,aa as y,g as O,h as l,i as d,ic as x,p as f,t as u,u as T,v as w,x as v}from"./chunk-IGUSDGD6.js";var k=O(H(),1);var g=new E("JWT_OPTIONS"),m=(()=>{class o{constructor(e=null){this.tokenGetter=e&&e.tokenGetter||function(){}}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:{t+="==";break}case 3:{t+="=";break}default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(t)}b64decode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="";if(e=String(e).replace(/=+$/,""),e.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let i=0,c,s,b=0;s=e.charAt(b++);~s&&(c=i%4?c*64+s:s,i++%4)?r+=String.fromCharCode(255&c>>(-2*i&6)):0)s=t.indexOf(s);return r}b64DecodeUnicode(e){return decodeURIComponent(Array.prototype.map.call(this.b64decode(e),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}decodeToken(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._decodeToken(t)):this._decodeToken(e)}_decodeToken(e){if(!e||e==="")return null;let t=e.split(".");if(t.length!==3)throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");let r=this.urlBase64Decode(t[1]);if(!r)throw new Error("Cannot decode the token.");return JSON.parse(r)}getTokenExpirationDate(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._getTokenExpirationDate(t)):this._getTokenExpirationDate(e)}_getTokenExpirationDate(e){let t;if(t=this.decodeToken(e),!t||!t.hasOwnProperty("exp"))return null;let r=new Date(0);return r.setUTCSeconds(t.exp),r}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(r=>this._isTokenExpired(r,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let r=this.getTokenExpirationDate(e);return t=t||0,r===null?!1:!(r.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return o.\u0275fac=function(e){return new(e||o)(a(g))},o.\u0275prov=p({token:o,factory:o.\u0275fac}),o})(),D=o=>o instanceof Promise?v(()=>o):f(o),J=(()=>{class o{constructor(e,t,r){this.jwtHelper=t,this.document=r,this.standardPorts=["80","443"],this.tokenGetter=e.tokenGetter,this.headerName=e.headerName||"Authorization",this.authScheme=e.authScheme||e.authScheme===""?e.authScheme:"Bearer ",this.allowedDomains=e.allowedDomains||[],this.disallowedRoutes=e.disallowedRoutes||[],this.throwNoTokenError=e.throwNoTokenError||!1,this.skipWhenExpired=e.skipWhenExpired}isAllowedDomain(e){let t=new URL(e.url,this.document.location.origin);if(t.host===this.document.location.host)return!0;let r=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(i=>typeof i=="string"?i===r:i instanceof RegExp?i.test(r):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(r=>{if(typeof r=="string"){let i=new URL(r,this.document.location.origin);return i.hostname===t.hostname&&i.pathname===t.pathname}return r instanceof RegExp?r.test(e.url):!1})>-1}handleInterception(e,t,r){let i=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let c=f(!1);return this.skipWhenExpired&&(c=e?D(this.jwtHelper.isTokenExpired(e)):f(!0)),e?c.pipe(T(s=>s&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${i}${e}`}})),w(s=>r.handle(s))):r.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let r=this.tokenGetter(e);return D(r).pipe(w(i=>this.handleInterception(i,e,t)))}}return o.\u0275fac=function(e){return new(e||o)(a(g),a(m),a(I))},o.\u0275prov=p({token:o,factory:o.\u0275fac}),o})(),K=(()=>{class o{constructor(e){if(e)throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.")}static forRoot(e){return{ngModule:o,providers:[{provide:x,useClass:J,multi:!0},e.jwtOptionsProvider||{provide:g,useValue:e.config},m]}}}return o.\u0275fac=function(e){return new(e||o)(a(o,12))},o.\u0275mod=y({type:o}),o.\u0275inj=j({}),o})();var X=(()=>{let n=class n{constructor(t,r,i){l(this,"$api");l(this,"$jwtHelper");l(this,"$settings");l(this,"token");l(this,"user",{});l(this,"logoutTimer");this.$api=t,this.$jwtHelper=r,this.$settings=i,this.loadToken()}login(t){return d(this,null,function*(){let r=yield u(this.$api.post("/auth/login",t));if(!this.validateToken(r.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(h.jwt.tokenKey,r.access_token),yield this.$settings.getAppSettings()})}noauth(){return d(this,null,function*(){let t=yield u(this.$api.post("/auth/noauth",{}));if(this.validateToken(t.access_token))window.localStorage.setItem(h.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,window.localStorage.removeItem(h.jwt.tokenKey),window.location.reload()}loadToken(){return d(this,null,function*(){this.$settings.settingsLoaded||(yield u(this.$settings.onSettingsLoaded));let t=window.localStorage.getItem(h.jwt.tokenKey);t&&this.validateToken(t)})}validateToken(t){try{return this.$jwtHelper.isTokenExpired(t,this.$settings.serverTimeOffset)&&this.logout(),this.user=this.$jwtHelper.decodeToken(t),this.token=t,this.setLogoutTimer(),!0}catch{return window.localStorage.removeItem(h.jwt.tokenKey),this.token=null,!1}}checkToken(){return d(this,null,function*(){try{return yield u(this.$api.get("/auth/check"))}catch(t){t.status===401&&(console.error("Current token is not valid"),this.logout())}})}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let r=(0,k.default)(this.$jwtHelper.getTokenExpirationDate(this.token)).diff((0,k.default)().add(this.$settings.serverTimeOffset,"s"),"millisecond");r<=2147483647&&(this.logoutTimer=setTimeout(()=>d(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),r))}}isLoggedIn(){return this.$settings.env.instanceId!==this.user.instanceId?(console.error("Token does not match instance"),!1):this.user&&this.token&&!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)}};l(n,"\u0275fac",function(r){return new(r||n)(a($),a(m),a(S))}),l(n,"\u0275prov",p({token:n,factory:n.\u0275fac}));let o=n;return o})();export{m as a,K as b,X as c};
@@ -1 +0,0 @@
1
- import{a as ne}from"./chunk-F22FMU37.js";import{$ as Tt,$a as te,Da as it,Db as ft,Ga as st,Ka as nt,La as C,Lb as Mt,M as Ut,Ma as ot,Oa as A,Rb as jt,Ua as F,Va as H,W as N,Wa as rt,X as Wt,Xa as xt,Y as Gt,Ya as It,Z as I,Za as St,_ as G,a as j,aa as Jt,ab as at,b as W,bb as S,da as Kt,e as Zt,g as ge,h as n,ha as wt,hc as ee,i as Yt,ia as Dt,jb as R,l as k,la as pt,lb as Y,nc as ie,oa as Ct,oc as se,sa as Qt,sb as Ot,t as qt,ta as $t,wa as _,xa as Z,za as Xt}from"./chunk-IGUSDGD6.js";var oe=Zt((Ne,ve)=>{ve.exports={name:"homebridge-config-ui-x",displayName:"Homebridge UI",version:"5.0.0-beta.1",description:"A web based management, configuration and control platform for Homebridge.",author:"oznu <dev@oz.nu>",license:"MIT",funding:[{type:"github",url:"https://github.com/sponsors/oznu"},{type:"paypal",url:"https://paypal.me/oznu"}],repository:{type:"git",url:"git+https://github.com/homebridge/homebridge-config-ui-x.git"},bugs:{url:"https://github.com/homebridge/homebridge-config-ui-x/issues"},keywords:["homebridge-plugin","ui","gui","web","homebridge","homebridge-config-ui-x","ui-x","config-ui-x","homebridge-x","homebridge server","homebridge ui","homebridge-ui","homebridge gui","homebridge-gui","web interface","config ui","management","config editor","linux","macOS","osx","windows","raspberry pi","accessory control","smart home","hb-service"],main:"./dist/index.js",bin:{"homebridge-config-ui-x":"dist/bin/standalone.js","hb-service":"dist/bin/hb-service.js"},engines:{node:"^18 || ^20 || ^22",homebridge:"^1.8.0 || ^2.0.0-beta.0"},scripts:{build:"npm run build:server && npm run build:ui","build:server":"rimraf dist && tsc -p tsconfig.build.json","build:ui":"npm run build --prefix ui",check:"npm run check:server && npm run check:ui","check:server":"npm install && npm outdated","check:ui":"npm install --prefix ui && npm outdated --prefix ui","lang-sync":"ts-node scripts/lang-sync.ts",lint:"eslint . --max-warnings=0","lint:fix":"npm run lint -- --fix",prepublishOnly:"npm i --package-lock-only && npm run lint && npm run build",start:"ts-node -r tsconfig-paths/register src/main.ts",test:"vitest run","test-coverage":"npm run test -- --coverage","upgrade-install":"./scripts/upgrade-install.sh",watch:'concurrently "npm run watch:ui" "npm run watch:server"',"watch:server":"nodemon","watch:ui":"npm run start --prefix ui"},dependencies:{"@fastify/helmet":"11.1.1","@fastify/multipart":"8.3.0","@fastify/static":"7.0.4","@homebridge/hap-client":"2.0.4","@homebridge/node-pty-prebuilt-multiarch":"0.12.0-beta.2","@nestjs/axios":"3.1.2","@nestjs/common":"10.4.8","@nestjs/core":"10.4.8","@nestjs/jwt":"10.2.0","@nestjs/passport":"10.0.3","@nestjs/platform-fastify":"10.4.8","@nestjs/platform-socket.io":"10.4.8","@nestjs/swagger":"8.0.7","@nestjs/websockets":"10.4.8",axios:"1.7.7","bash-color":"0.0.4","buffer-shims":"1.0.0","class-transformer":"0.5.1","class-validator":"0.14.1",commander:"12.1.0",dayjs:"1.11.13",fastify:"4.28.1","fs-extra":"11.2.0",jsonwebtoken:"9.0.2",lodash:"4.17.21","node-cache":"5.1.2","node-schedule":"2.1.1",ora:"5.4.1",otplib:"12.0.1","p-limit":"3.1.0",passport:"0.7.0","passport-jwt":"4.0.1","reflect-metadata":"0.2.2",rxjs:"7.8.1",semver:"7.6.3",systeminformation:"5.23.5",tail:"2.2.6",tar:"6.2.1","tcp-port-used":"1.0.2",unzipper:"0.12.3"},devDependencies:{"@antfu/eslint-config":"^3.9.1","@nestjs/testing":"^10.4.8","@types/fs-extra":"^11.0.4","@types/lodash":"^4.17.13","@types/node":"^22.9.0","@types/node-schedule":"^2.1.7","@types/passport-jwt":"^4.0.1","@types/semver":"^7.5.8","@types/tail":"^2.2.3","@types/tar":"^6.1.13","@types/tcp-port-used":"^1.0.4","@types/unzipper":"^0.10.10","@vitest/coverage-v8":"^2.1.5",concurrently:"^9.1.0",eslint:"^9.15.0","eslint-plugin-format":"^0.1.2","form-data":"^4.0.1",nodemon:"^3.1.7",rimraf:"^6.0.1","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0",typescript:"^5.6.3","unplugin-swc":"^1.5.1",vitest:"^2.1.5"},maintainers:[{email:"bwp91@icloud.com",name:"bwp91"},{email:"dev@oz.nu",name:"oznu"},{email:"northern.man1@gmail.com",name:"northernman"},{email:"mail@anderl-bauer.de",name:"supereg"},{email:"khaos.tian@gmail.com",name:"khaost"},{email:"erik.baauw@xs4all.nl",name:"ebaauw"},{email:"donavan.becker@icloud.com",name:"donavanbecker"},{email:"dustin.greif@gmail.com",name:"dustin.greif"},{email:"nfarina@gmail.com",name:"nfarina"}]}});var re=Zt((Ft,Et)=>{(function(s,t){typeof Ft=="object"&&typeof Et<"u"?Et.exports=t():typeof define=="function"&&define.amd?define(t):(s=typeof globalThis<"u"?globalThis:s||self).dayjs=t()})(Ft,function(){"use strict";var s=1e3,t=6e4,r=36e5,i="millisecond",e="second",o="minute",h="hour",y="day",O="week",w="month",Q="quarter",$="year",E="date",ct="Invalid Date",_t=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,yt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ut={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(d){var u=["th","st","nd","rd"],a=d%100;return"["+d+(u[(a-20)%10]||u[a]||u[0])+"]"}},P=function(d,u,a){var l=String(d);return!l||l.length>=u?d:""+Array(u+1-l.length).join(a)+d},me={s:P,z:function(d){var u=-d.utcOffset(),a=Math.abs(u),l=Math.floor(a/60),c=a%60;return(u<=0?"+":"-")+P(l,2,"0")+":"+P(c,2,"0")},m:function d(u,a){if(u.date()<a.date())return-d(a,u);var l=12*(a.year()-u.year())+(a.month()-u.month()),c=u.clone().add(l,w),p=a-c<0,f=u.clone().add(l+(p?-1:1),w);return+(-(l+(a-c)/(p?c-f:f-c))||0)},a:function(d){return d<0?Math.ceil(d)||0:Math.floor(d)},p:function(d){return{M:w,y:$,w:O,d:y,D:E,h,m:o,s:e,ms:i,Q}[d]||String(d||"").toLowerCase().replace(/s$/,"")},u:function(d){return d===void 0}},X="en",B={};B[X]=ut;var Vt="$isDayjsObject",bt=function(d){return d instanceof lt||!(!d||!d[Vt])},ht=function d(u,a,l){var c;if(!u)return X;if(typeof u=="string"){var p=u.toLowerCase();B[p]&&(c=p),a&&(B[p]=a,c=p);var f=u.split("-");if(!c&&f.length>1)return d(f[0])}else{var g=u.name;B[g]=u,c=g}return!l&&c&&(X=c),c||!l&&X},b=function(d,u){if(bt(d))return d.clone();var a=typeof u=="object"?u:{};return a.date=d,a.args=arguments,new lt(a)},m=me;m.l=ht,m.i=bt,m.w=function(d,u){return b(d,{locale:u.$L,utc:u.$u,x:u.$x,$offset:u.$offset})};var lt=function(){function d(a){this.$L=ht(a.locale,null,!0),this.parse(a),this.$x=this.$x||a.x||{},this[Vt]=!0}var u=d.prototype;return u.parse=function(a){this.$d=function(l){var c=l.date,p=l.utc;if(c===null)return new Date(NaN);if(m.u(c))return new Date;if(c instanceof Date)return new Date(c);if(typeof c=="string"&&!/Z$/i.test(c)){var f=c.match(_t);if(f){var g=f[2]-1||0,v=(f[7]||"0").substring(0,3);return p?new Date(Date.UTC(f[1],g,f[3]||1,f[4]||0,f[5]||0,f[6]||0,v)):new Date(f[1],g,f[3]||1,f[4]||0,f[5]||0,f[6]||0,v)}}return new Date(c)}(a),this.init()},u.init=function(){var a=this.$d;this.$y=a.getFullYear(),this.$M=a.getMonth(),this.$D=a.getDate(),this.$W=a.getDay(),this.$H=a.getHours(),this.$m=a.getMinutes(),this.$s=a.getSeconds(),this.$ms=a.getMilliseconds()},u.$utils=function(){return m},u.isValid=function(){return this.$d.toString()!==ct},u.isSame=function(a,l){var c=b(a);return this.startOf(l)<=c&&c<=this.endOf(l)},u.isAfter=function(a,l){return b(a)<this.startOf(l)},u.isBefore=function(a,l){return this.endOf(l)<b(a)},u.$g=function(a,l,c){return m.u(a)?this[l]:this.set(c,a)},u.unix=function(){return Math.floor(this.valueOf()/1e3)},u.valueOf=function(){return this.$d.getTime()},u.startOf=function(a,l){var c=this,p=!!m.u(l)||l,f=m.p(a),g=function(z,x){var L=m.w(c.$u?Date.UTC(c.$y,x,z):new Date(c.$y,x,z),c);return p?L:L.endOf(y)},v=function(z,x){return m.w(c.toDate()[z].apply(c.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(x)),c)},T=this.$W,D=this.$M,M=this.$D,U="set"+(this.$u?"UTC":"");switch(f){case $:return p?g(1,0):g(31,11);case w:return p?g(1,D):g(0,D+1);case O:var V=this.$locale().weekStart||0,tt=(T<V?T+7:T)-V;return g(p?M-tt:M+(6-tt),D);case y:case E:return v(U+"Hours",0);case h:return v(U+"Minutes",1);case o:return v(U+"Seconds",2);case e:return v(U+"Milliseconds",3);default:return this.clone()}},u.endOf=function(a){return this.startOf(a,!1)},u.$set=function(a,l){var c,p=m.p(a),f="set"+(this.$u?"UTC":""),g=(c={},c[y]=f+"Date",c[E]=f+"Date",c[w]=f+"Month",c[$]=f+"FullYear",c[h]=f+"Hours",c[o]=f+"Minutes",c[e]=f+"Seconds",c[i]=f+"Milliseconds",c)[p],v=p===y?this.$D+(l-this.$W):l;if(p===w||p===$){var T=this.clone().set(E,1);T.$d[g](v),T.init(),this.$d=T.set(E,Math.min(this.$D,T.daysInMonth())).$d}else g&&this.$d[g](v);return this.init(),this},u.set=function(a,l){return this.clone().$set(a,l)},u.get=function(a){return this[m.p(a)]()},u.add=function(a,l){var c,p=this;a=Number(a);var f=m.p(l),g=function(D){var M=b(p);return m.w(M.date(M.date()+Math.round(D*a)),p)};if(f===w)return this.set(w,this.$M+a);if(f===$)return this.set($,this.$y+a);if(f===y)return g(1);if(f===O)return g(7);var v=(c={},c[o]=t,c[h]=r,c[e]=s,c)[f]||1,T=this.$d.getTime()+a*v;return m.w(T,this)},u.subtract=function(a,l){return this.add(-1*a,l)},u.format=function(a){var l=this,c=this.$locale();if(!this.isValid())return c.invalidDate||ct;var p=a||"YYYY-MM-DDTHH:mm:ssZ",f=m.z(this),g=this.$H,v=this.$m,T=this.$M,D=c.weekdays,M=c.months,U=c.meridiem,V=function(x,L,et,dt){return x&&(x[L]||x(l,p))||et[L].slice(0,dt)},tt=function(x){return m.s(g%12||12,x,"0")},z=U||function(x,L,et){var dt=x<12?"AM":"PM";return et?dt.toLowerCase():dt};return p.replace(yt,function(x,L){return L||function(et){switch(et){case"YY":return String(l.$y).slice(-2);case"YYYY":return m.s(l.$y,4,"0");case"M":return T+1;case"MM":return m.s(T+1,2,"0");case"MMM":return V(c.monthsShort,T,M,3);case"MMMM":return V(M,T);case"D":return l.$D;case"DD":return m.s(l.$D,2,"0");case"d":return String(l.$W);case"dd":return V(c.weekdaysMin,l.$W,D,2);case"ddd":return V(c.weekdaysShort,l.$W,D,3);case"dddd":return D[l.$W];case"H":return String(g);case"HH":return m.s(g,2,"0");case"h":return tt(1);case"hh":return tt(2);case"a":return z(g,v,!0);case"A":return z(g,v,!1);case"m":return String(v);case"mm":return m.s(v,2,"0");case"s":return String(l.$s);case"ss":return m.s(l.$s,2,"0");case"SSS":return m.s(l.$ms,3,"0");case"Z":return f}return null}(x)||f.replace(":","")})},u.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},u.diff=function(a,l,c){var p,f=this,g=m.p(l),v=b(a),T=(v.utcOffset()-this.utcOffset())*t,D=this-v,M=function(){return m.m(f,v)};switch(g){case $:p=M()/12;break;case w:p=M();break;case Q:p=M()/3;break;case O:p=(D-T)/6048e5;break;case y:p=(D-T)/864e5;break;case h:p=D/r;break;case o:p=D/t;break;case e:p=D/s;break;default:p=D}return c?p:m.a(p)},u.daysInMonth=function(){return this.endOf(w).$D},u.$locale=function(){return B[this.$L]},u.locale=function(a,l){if(!a)return this.$L;var c=this.clone(),p=ht(a,l,!0);return p&&(c.$L=p),c},u.clone=function(){return m.w(this.$d,this)},u.toDate=function(){return new Date(this.valueOf())},u.toJSON=function(){return this.isValid()?this.toISOString():null},u.toISOString=function(){return this.$d.toISOString()},u.toString=function(){return this.$d.toUTCString()},d}(),zt=lt.prototype;return b.prototype=zt,[["$ms",i],["$s",e],["$m",o],["$H",h],["$W",y],["$M",w],["$y",$],["$D",E]].forEach(function(d){zt[d[1]]=function(u){return this.$g(u,d[0],d[1])}}),b.extend=function(d,u){return d.$i||(d(u,lt,b),d.$i=!0),b},b.locale=ht,b.isDayjs=bt,b.unix=function(d){return b(1e3*d)},b.en=B[X],b.Ls=B,b.p={},b})});var J={serverTarget:oe().version,production:!0,socket:"",api:{base:"/api",socket:`${window.location.protocol==="http:"?"ws://":"wss://"}${window.location.host}`,origin:window.location.origin},jwt:{tokenKey:"access_token",allowedDomains:[document.location.host],disallowedRoutes:[`${window.location.protocol}//${document.location.host}/api/auth/login`]},apiHttpOptions:{},owm:{appid:"fec67b55f7f74deaa28df89ba6a60821"}};var ce=(()=>{let t=class t{constructor(i){n(this,"$http");this.$http=i}get(i,e){return this.$http.get(`${J.api.base}${i}`,e)}post(i,e,o){return this.$http.post(`${J.api.base}${i}`,e,o)}put(i,e,o){return this.$http.put(`${J.api.base}${i}`,e,o)}patch(i,e,o){return this.$http.patch(`${J.api.base}${i}`,e,o)}delete(i,e){return this.$http.delete(`${J.api.base}${i}`,e)}};n(t,"\u0275fac",function(e){return new(e||t)(I(ee))}),n(t,"\u0275prov",N({token:t,factory:t.\u0275fac,providedIn:"root"}));let s=t;return s})();var q=function(s){return s[s.State=0]="State",s[s.Transition=1]="Transition",s[s.Sequence=2]="Sequence",s[s.Group=3]="Group",s[s.Animate=4]="Animate",s[s.Keyframes=5]="Keyframes",s[s.Style=6]="Style",s[s.Trigger=7]="Trigger",s[s.Reference=8]="Reference",s[s.AnimateChild=9]="AnimateChild",s[s.AnimateRef=10]="AnimateRef",s[s.Query=11]="Query",s[s.Stagger=12]="Stagger",s}(q||{}),Ze="*";function le(s,t){return{type:q.Trigger,name:s,definitions:t,options:{}}}function kt(s,t=null){return{type:q.Animate,styles:t,timings:s}}function Ye(s,t=null){return{type:q.Sequence,steps:s,options:t}}function mt(s){return{type:q.Style,styles:s,offset:null}}function gt(s,t,r){return{type:q.State,name:s,styles:t,options:r}}function At(s,t,r=null){return{type:q.Transition,expr:s,animation:t,options:r}}var ue=class{constructor(t=0,r=0){this._onDoneFns=[],this._onStartFns=[],this._onDestroyFns=[],this._originalOnDoneFns=[],this._originalOnStartFns=[],this._started=!1,this._destroyed=!1,this._finished=!1,this._position=0,this.parentPlayer=null,this.totalTime=t+r}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(t=>t()),this._onDoneFns=[])}onStart(t){this._originalOnStartFns.push(t),this._onStartFns.push(t)}onDone(t){this._originalOnDoneFns.push(t),this._onDoneFns.push(t)}onDestroy(t){this._onDestroyFns.push(t)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(t=>t()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(t=>t()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(t){this._position=this.totalTime?t*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(t){let r=t=="start"?this._onStartFns:this._onDoneFns;r.forEach(i=>i()),r.length=0}},he=class{constructor(t){this._onDoneFns=[],this._onStartFns=[],this._finished=!1,this._started=!1,this._destroyed=!1,this._onDestroyFns=[],this.parentPlayer=null,this.totalTime=0,this.players=t;let r=0,i=0,e=0,o=this.players.length;o==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(h=>{h.onDone(()=>{++r==o&&this._onFinish()}),h.onDestroy(()=>{++i==o&&this._onDestroy()}),h.onStart(()=>{++e==o&&this._onStart()})}),this.totalTime=this.players.reduce((h,y)=>Math.max(h,y.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(t=>t()),this._onDoneFns=[])}init(){this.players.forEach(t=>t.init())}onStart(t){this._onStartFns.push(t)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(t=>t()),this._onStartFns=[])}onDone(t){this._onDoneFns.push(t)}onDestroy(t){this._onDestroyFns.push(t)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(t=>t.play())}pause(){this.players.forEach(t=>t.pause())}restart(){this.players.forEach(t=>t.restart())}finish(){this._onFinish(),this.players.forEach(t=>t.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(t=>t.destroy()),this._onDestroyFns.forEach(t=>t()),this._onDestroyFns=[])}reset(){this.players.forEach(t=>t.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(t){let r=t*this.totalTime;this.players.forEach(i=>{let e=i.totalTime?Math.min(1,r/i.totalTime):1;i.setPosition(e)})}getPosition(){let t=this.players.reduce((r,i)=>r===null||i.totalTime>r.totalTime?i:r,null);return t!=null?t.getPosition():0}beforeDestroy(){this.players.forEach(t=>{t.beforeDestroy&&t.beforeDestroy()})}triggerCallback(t){let r=t=="start"?this._onStartFns:this._onDoneFns;r.forEach(i=>i()),r.length=0}},qe="!";var de=["toast-component",""];function be(s,t){if(s&1){let r=St();F(0,"button",5),at("click",function(){wt(r);let e=S();return Dt(e.remove())}),F(1,"span",6),R(2,"\xD7"),H()()}}function Te(s,t){if(s&1&&(xt(0),R(1),It()),s&2){let r=S(2);_(),Y("[",r.duplicatesCount+1,"]")}}function we(s,t){if(s&1&&(F(0,"div"),R(1),st(2,Te,2,1,"ng-container",4),H()),s&2){let r=S();A(r.options.titleClass),nt("aria-label",r.title),_(),Y(" ",r.title," "),_(),C("ngIf",r.duplicatesCount)}}function De(s,t){if(s&1&&rt(0,"div",7),s&2){let r=S();A(r.options.messageClass),C("innerHTML",r.message,$t)}}function Ce(s,t){if(s&1&&(F(0,"div",8),R(1),H()),s&2){let r=S();A(r.options.messageClass),nt("aria-label",r.message),_(),Y(" ",r.message," ")}}function $e(s,t){if(s&1&&(F(0,"div"),rt(1,"div",9),H()),s&2){let r=S();_(),ot("width",r.width()+"%")}}function xe(s,t){if(s&1){let r=St();F(0,"button",5),at("click",function(){wt(r);let e=S();return Dt(e.remove())}),F(1,"span",6),R(2,"\xD7"),H()()}}function Ie(s,t){if(s&1&&(xt(0),R(1),It()),s&2){let r=S(2);_(),Y("[",r.duplicatesCount+1,"]")}}function Se(s,t){if(s&1&&(F(0,"div"),R(1),st(2,Ie,2,1,"ng-container",4),H()),s&2){let r=S();A(r.options.titleClass),nt("aria-label",r.title),_(),Y(" ",r.title," "),_(),C("ngIf",r.duplicatesCount)}}function Oe(s,t){if(s&1&&rt(0,"div",7),s&2){let r=S();A(r.options.messageClass),C("innerHTML",r.message,$t)}}function Me(s,t){if(s&1&&(F(0,"div",8),R(1),H()),s&2){let r=S();A(r.options.messageClass),nt("aria-label",r.message),_(),Y(" ",r.message," ")}}function je(s,t){if(s&1&&(F(0,"div"),rt(1,"div",9),H()),s&2){let r=S();_(),ot("width",r.width()+"%")}}var Ht=class{constructor(t,r){n(this,"_attachedHost");n(this,"component");n(this,"viewContainerRef");n(this,"injector");this.component=t,this.injector=r}attach(t,r){return this._attachedHost=t,t.attach(this,r)}detach(){let t=this._attachedHost;if(t)return this._attachedHost=void 0,t.detach()}get isAttached(){return this._attachedHost!=null}setAttachedHost(t){this._attachedHost=t}},Rt=class{constructor(){n(this,"_attachedPortal");n(this,"_disposeFn")}attach(t,r){return this._attachedPortal=t,this.attachComponentPortal(t,r)}detach(){this._attachedPortal&&this._attachedPortal.setAttachedHost(),this._attachedPortal=void 0,this._disposeFn&&(this._disposeFn(),this._disposeFn=void 0)}setDisposeFn(t){this._disposeFn=t}},Lt=class{constructor(t){n(this,"_overlayRef");n(this,"componentInstance");n(this,"duplicatesCount",0);n(this,"_afterClosed",new k);n(this,"_activate",new k);n(this,"_manualClose",new k);n(this,"_resetTimeout",new k);n(this,"_countDuplicate",new k);this._overlayRef=t}manualClose(){this._manualClose.next(),this._manualClose.complete()}manualClosed(){return this._manualClose.asObservable()}timeoutReset(){return this._resetTimeout.asObservable()}countDuplicate(){return this._countDuplicate.asObservable()}close(){this._overlayRef.detach(),this._afterClosed.next(),this._manualClose.next(),this._afterClosed.complete(),this._manualClose.complete(),this._activate.complete(),this._resetTimeout.complete(),this._countDuplicate.complete()}afterClosed(){return this._afterClosed.asObservable()}isInactive(){return this._activate.isStopped}activate(){this._activate.next(),this._activate.complete()}afterActivate(){return this._activate.asObservable()}onDuplicate(t,r){t&&this._resetTimeout.next(),r&&this._countDuplicate.next(++this.duplicatesCount)}},K=class{constructor(t,r,i,e,o,h){n(this,"toastId");n(this,"config");n(this,"message");n(this,"title");n(this,"toastType");n(this,"toastRef");n(this,"_onTap",new k);n(this,"_onAction",new k);this.toastId=t,this.config=r,this.message=i,this.title=e,this.toastType=o,this.toastRef=h,this.toastRef.afterClosed().subscribe(()=>{this._onAction.complete(),this._onTap.complete()})}triggerTap(){this._onTap.next(),this.config.tapToDismiss&&this._onTap.complete()}onTap(){return this._onTap.asObservable()}triggerAction(t){this._onAction.next(t)}onAction(){return this._onAction.asObservable()}},pe={maxOpened:0,autoDismiss:!1,newestOnTop:!0,preventDuplicates:!1,countDuplicates:!1,resetTimeoutOnDuplicate:!1,includeTitleDuplicates:!1,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},closeButton:!1,disableTimeOut:!1,timeOut:5e3,extendedTimeOut:1e3,enableHtml:!1,progressBar:!1,toastClass:"ngx-toastr",positionClass:"toast-top-right",titleClass:"toast-title",messageClass:"toast-message",easing:"ease-in",easeTime:300,tapToDismiss:!0,onActivateTick:!1,progressAnimation:"decreasing"},fe=new Gt("ToastConfig"),Nt=class extends Rt{constructor(r,i,e){super();n(this,"_hostDomElement");n(this,"_componentFactoryResolver");n(this,"_appRef");this._hostDomElement=r,this._componentFactoryResolver=i,this._appRef=e}attachComponentPortal(r,i){let e=this._componentFactoryResolver.resolveComponentFactory(r.component),o;return o=e.create(r.injector),this._appRef.attachView(o.hostView),this.setDisposeFn(()=>{this._appRef.detachView(o.hostView),o.destroy()}),i?this._hostDomElement.insertBefore(this._getComponentRootNode(o),this._hostDomElement.firstChild):this._hostDomElement.appendChild(this._getComponentRootNode(o)),o}_getComponentRootNode(r){return r.hostView.rootNodes[0]}},Fe=(()=>{let t=class t{constructor(){n(this,"_document",G(Mt));n(this,"_containerElement")}ngOnDestroy(){this._containerElement&&this._containerElement.parentNode&&this._containerElement.parentNode.removeChild(this._containerElement)}getContainerElement(){return this._containerElement||this._createContainer(),this._containerElement}_createContainer(){let i=this._document.createElement("div");i.classList.add("overlay-container"),i.setAttribute("aria-live","polite"),this._document.body.appendChild(i),this._containerElement=i}};n(t,"\u0275fac",function(e){return new(e||t)}),n(t,"\u0275prov",N({token:t,factory:t.\u0275fac,providedIn:"root"}));let s=t;return s})(),Pt=class{constructor(t){n(this,"_portalHost");this._portalHost=t}attach(t,r=!0){return this._portalHost.attach(t,r)}detach(){return this._portalHost.detach()}},Ee=(()=>{let t=class t{constructor(){n(this,"_overlayContainer",G(Fe));n(this,"_componentFactoryResolver",G(Xt));n(this,"_appRef",G(ft));n(this,"_document",G(Mt));n(this,"_paneElements",new Map)}create(i,e){return this._createOverlayRef(this.getPaneElement(i,e))}getPaneElement(i="",e){return this._paneElements.get(e)||this._paneElements.set(e,{}),this._paneElements.get(e)[i]||(this._paneElements.get(e)[i]=this._createPaneElement(i,e)),this._paneElements.get(e)[i]}_createPaneElement(i,e){let o=this._document.createElement("div");return o.id="toast-container",o.classList.add(i),o.classList.add("toast-container"),e?e.getContainerElement().appendChild(o):this._overlayContainer.getContainerElement().appendChild(o),o}_createPortalHost(i){return new Nt(i,this._componentFactoryResolver,this._appRef)}_createOverlayRef(i){return new Pt(this._createPortalHost(i))}};n(t,"\u0275fac",function(e){return new(e||t)}),n(t,"\u0275prov",N({token:t,factory:t.\u0275fac,providedIn:"root"}));let s=t;return s})(),vt=(()=>{let t=class t{constructor(i,e,o,h,y){n(this,"overlay");n(this,"_injector");n(this,"sanitizer");n(this,"ngZone");n(this,"toastrConfig");n(this,"currentlyActive",0);n(this,"toasts",[]);n(this,"overlayContainer");n(this,"previousToastMessage");n(this,"index",0);this.overlay=e,this._injector=o,this.sanitizer=h,this.ngZone=y,this.toastrConfig=j(j({},i.default),i.config),i.config.iconClasses&&(this.toastrConfig.iconClasses=j(j({},i.default.iconClasses),i.config.iconClasses))}show(i,e,o={},h=""){return this._preBuildNotification(h,i,e,this.applyConfig(o))}success(i,e,o={}){let h=this.toastrConfig.iconClasses.success||"";return this._preBuildNotification(h,i,e,this.applyConfig(o))}error(i,e,o={}){let h=this.toastrConfig.iconClasses.error||"";return this._preBuildNotification(h,i,e,this.applyConfig(o))}info(i,e,o={}){let h=this.toastrConfig.iconClasses.info||"";return this._preBuildNotification(h,i,e,this.applyConfig(o))}warning(i,e,o={}){let h=this.toastrConfig.iconClasses.warning||"";return this._preBuildNotification(h,i,e,this.applyConfig(o))}clear(i){for(let e of this.toasts)if(i!==void 0){if(e.toastId===i){e.toastRef.manualClose();return}}else e.toastRef.manualClose()}remove(i){let e=this._findToast(i);if(!e||(e.activeToast.toastRef.close(),this.toasts.splice(e.index,1),this.currentlyActive=this.currentlyActive-1,!this.toastrConfig.maxOpened||!this.toasts.length))return!1;if(this.currentlyActive<this.toastrConfig.maxOpened&&this.toasts[this.currentlyActive]){let o=this.toasts[this.currentlyActive].toastRef;o.isInactive()||(this.currentlyActive=this.currentlyActive+1,o.activate())}return!0}findDuplicate(i="",e="",o,h){let{includeTitleDuplicates:y}=this.toastrConfig;for(let O of this.toasts){let w=y&&O.title===i;if((!y||w)&&O.message===e)return O.toastRef.onDuplicate(o,h),O}return null}applyConfig(i={}){return j(j({},this.toastrConfig),i)}_findToast(i){for(let e=0;e<this.toasts.length;e++)if(this.toasts[e].toastId===i)return{index:e,activeToast:this.toasts[e]};return null}_preBuildNotification(i,e,o,h){return h.onActivateTick?this.ngZone.run(()=>this._buildNotification(i,e,o,h)):this._buildNotification(i,e,o,h)}_buildNotification(i,e,o,h){if(!h.toastComponent)throw new Error("toastComponent required");let y=this.findDuplicate(o,e,this.toastrConfig.resetTimeoutOnDuplicate&&h.timeOut>0,this.toastrConfig.countDuplicates);if((this.toastrConfig.includeTitleDuplicates&&o||e)&&this.toastrConfig.preventDuplicates&&y!==null)return y;this.previousToastMessage=e;let O=!1;this.toastrConfig.maxOpened&&this.currentlyActive>=this.toastrConfig.maxOpened&&(O=!0,this.toastrConfig.autoDismiss&&this.clear(this.toasts[0].toastId));let w=this.overlay.create(h.positionClass,this.overlayContainer);this.index=this.index+1;let Q=e;e&&h.enableHtml&&(Q=this.sanitizer.sanitize(Qt.HTML,e));let $=new Lt(w),E=new K(this.index,h,Q,o,i,$),ct=[{provide:K,useValue:E}],_t=pt.create({providers:ct,parent:this._injector}),yt=new Ht(h.toastComponent,_t),ut=w.attach(yt,h.newestOnTop);$.componentInstance=ut.instance;let P={toastId:this.index,title:o||"",message:e||"",toastRef:$,onShown:$.afterActivate(),onHidden:$.afterClosed(),onTap:E.onTap(),onAction:E.onAction(),portal:ut};return O||(this.currentlyActive=this.currentlyActive+1,setTimeout(()=>{P.toastRef.activate()})),this.toasts.push(P),P}};n(t,"\u0275fac",function(e){return new(e||t)(I(fe),I(Ee),I(pt),I(se),I(Ct))}),n(t,"\u0275prov",N({token:t,factory:t.\u0275fac,providedIn:"root"}));let s=t;return s})(),ke=(()=>{let t=class t{constructor(i,e,o){n(this,"toastrService");n(this,"toastPackage");n(this,"ngZone");n(this,"message");n(this,"title");n(this,"options");n(this,"duplicatesCount");n(this,"originalTimeout");n(this,"width",it(-1));n(this,"toastClasses","");n(this,"state");n(this,"timeout");n(this,"intervalId");n(this,"hideTime");n(this,"sub");n(this,"sub1");n(this,"sub2");n(this,"sub3");this.toastrService=i,this.toastPackage=e,this.ngZone=o,this.message=e.message,this.title=e.title,this.options=e.config,this.originalTimeout=e.config.timeOut,this.toastClasses=`${e.toastType} ${e.config.toastClass}`,this.sub=e.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=e.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=e.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=e.toastRef.countDuplicate().subscribe(h=>{this.duplicatesCount=h}),this.state=it({value:"inactive",params:{easeTime:this.toastPackage.config.easeTime,easing:"ease-in"}})}get _state(){return this.state()}get displayStyle(){if(this.state().value==="inactive")return"none"}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state.update(i=>W(j({},i),{value:"active"})),!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.outsideTimeout(()=>this.remove(),this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}updateProgress(){if(this.width()===0||this.width()===100||!this.options.timeOut)return;let i=new Date().getTime(),e=this.hideTime-i;this.width.set(e/this.options.timeOut*100),this.options.progressAnimation==="increasing"&&this.width.update(o=>100-o),this.width()<=0&&this.width.set(0),this.width()>=100&&this.width.set(100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state.update(i=>W(j({},i),{value:"active"})),this.outsideTimeout(()=>this.remove(),this.originalTimeout),this.options.timeOut=this.originalTimeout,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width.set(-1),this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10)}remove(){this.state().value!=="removed"&&(clearTimeout(this.timeout),this.state.update(i=>W(j({},i),{value:"removed"})),this.outsideTimeout(()=>this.toastrService.remove(this.toastPackage.toastId),+this.toastPackage.config.easeTime))}tapToast(){this.state().value!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state().value!=="removed"&&this.options.disableTimeOut!=="extendedTimeOut"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width.set(0))}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state().value==="removed"||(this.outsideTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width.set(-1),this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}outsideTimeout(i,e){this.ngZone?this.ngZone.runOutsideAngular(()=>this.timeout=setTimeout(()=>this.runInsideAngular(i),e)):this.timeout=setTimeout(()=>i(),e)}outsideInterval(i,e){this.ngZone?this.ngZone.runOutsideAngular(()=>this.intervalId=setInterval(()=>this.runInsideAngular(i),e)):this.intervalId=setInterval(()=>i(),e)}runInsideAngular(i){this.ngZone?this.ngZone.run(()=>i()):i()}};n(t,"\u0275fac",function(e){return new(e||t)(Z(vt),Z(K),Z(Ct))}),n(t,"\u0275cmp",Tt({type:t,selectors:[["","toast-component",""]],hostVars:5,hostBindings:function(e,o){e&1&&at("click",function(){return o.tapToast()})("mouseenter",function(){return o.stickAround()})("mouseleave",function(){return o.delayedHideToast()}),e&2&&(te("@flyInOut",o._state),A(o.toastClasses),ot("display",o.displayStyle))},standalone:!0,features:[Ot],attrs:de,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(e,o){e&1&&st(0,be,3,0,"button",0)(1,we,3,5,"div",1)(2,De,1,3,"div",2)(3,Ce,2,4,"div",3)(4,$e,2,2,"div",4),e&2&&(C("ngIf",o.options.closeButton),_(),C("ngIf",o.title),_(),C("ngIf",o.message&&o.options.enableHtml),_(),C("ngIf",o.message&&!o.options.enableHtml),_(),C("ngIf",o.options.progressBar))},dependencies:[jt],encapsulation:2,data:{animation:[le("flyInOut",[gt("inactive",mt({opacity:0})),gt("active",mt({opacity:1})),gt("removed",mt({opacity:0})),At("inactive => active",kt("{{ easeTime }}ms {{ easing }}")),At("active => removed",kt("{{ easeTime }}ms {{ easing }}"))])]},changeDetection:0}));let s=t;return s})(),Ae=W(j({},pe),{toastComponent:ke}),He=(s={})=>Kt([{provide:fe,useValue:{default:Ae,config:s}}]),ci=(()=>{let t=class t{static forRoot(i={}){return{ngModule:t,providers:[He(i)]}}};n(t,"\u0275fac",function(e){return new(e||t)}),n(t,"\u0275mod",Jt({type:t})),n(t,"\u0275inj",Wt({}));let s=t;return s})();var Re=(()=>{let t=class t{constructor(i,e,o){n(this,"toastrService");n(this,"toastPackage");n(this,"appRef");n(this,"message");n(this,"title");n(this,"options");n(this,"duplicatesCount");n(this,"originalTimeout");n(this,"width",it(-1));n(this,"toastClasses","");n(this,"state",it("inactive"));n(this,"timeout");n(this,"intervalId");n(this,"hideTime");n(this,"sub");n(this,"sub1");n(this,"sub2");n(this,"sub3");this.toastrService=i,this.toastPackage=e,this.appRef=o,this.message=e.message,this.title=e.title,this.options=e.config,this.originalTimeout=e.config.timeOut,this.toastClasses=`${e.toastType} ${e.config.toastClass}`,this.sub=e.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=e.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=e.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=e.toastRef.countDuplicate().subscribe(h=>{this.duplicatesCount=h})}get displayStyle(){return this.state()==="inactive"?"none":null}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state.set("active"),!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.timeout=setTimeout(()=>{this.remove()},this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))),this.options.onActivateTick&&this.appRef.tick()}updateProgress(){if(this.width()===0||this.width()===100||!this.options.timeOut)return;let i=new Date().getTime(),e=this.hideTime-i;this.width.set(e/this.options.timeOut*100),this.options.progressAnimation==="increasing"&&this.width.update(o=>100-o),this.width()<=0&&this.width.set(0),this.width()>=100&&this.width.set(100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state.set("active"),this.options.timeOut=this.originalTimeout,this.timeout=setTimeout(()=>this.remove(),this.originalTimeout),this.hideTime=new Date().getTime()+(this.originalTimeout||0),this.width.set(-1),this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))}remove(){this.state()!=="removed"&&(clearTimeout(this.timeout),this.state.set("removed"),this.timeout=setTimeout(()=>this.toastrService.remove(this.toastPackage.toastId)))}tapToast(){this.state()!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state()!=="removed"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width.set(0))}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state()==="removed"||(this.timeout=setTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width.set(-1),this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10)))}};n(t,"\u0275fac",function(e){return new(e||t)(Z(vt),Z(K),Z(ft))}),n(t,"\u0275cmp",Tt({type:t,selectors:[["","toast-component",""]],hostVars:4,hostBindings:function(e,o){e&1&&at("click",function(){return o.tapToast()})("mouseenter",function(){return o.stickAround()})("mouseleave",function(){return o.delayedHideToast()}),e&2&&(A(o.toastClasses),ot("display",o.displayStyle))},standalone:!0,features:[Ot],attrs:de,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(e,o){e&1&&st(0,xe,3,0,"button",0)(1,Se,3,5,"div",1)(2,Oe,1,3,"div",2)(3,Me,2,4,"div",3)(4,je,2,2,"div",4),e&2&&(C("ngIf",o.options.closeButton),_(),C("ngIf",o.title),_(),C("ngIf",o.message&&o.options.enableHtml),_(),C("ngIf",o.message&&!o.options.enableHtml),_(),C("ngIf",o.options.progressBar))},dependencies:[jt],encapsulation:2,changeDetection:0}));let s=t;return s})(),ui=W(j({},pe),{toastComponent:Re});var Bt=ge(re(),1);var fi=(()=>{let t=class t{constructor(i,e,o,h){n(this,"$api");n(this,"$title");n(this,"$toastr");n(this,"$translate");n(this,"env",{});n(this,"formAuth",!0);n(this,"uiVersion");n(this,"theme");n(this,"lightingMode");n(this,"currentLightingMode");n(this,"actualLightingMode");n(this,"browserLightingMode");n(this,"loginWallpaper");n(this,"serverTimeOffset",0);n(this,"themeList",["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"]);n(this,"rtl",!1);n(this,"settingsLoadedSubject",new k);n(this,"onSettingsLoaded",this.settingsLoadedSubject.pipe(Ut()));n(this,"settingsLoaded",!1);this.$api=i,this.$title=e,this.$toastr=o,this.$translate=h,this.getAppSettings()}getAppSettings(){return Yt(this,null,function*(){let i=yield qt(this.$api.get("/auth/settings"));this.formAuth=i.formAuth,this.env=i.env,this.lightingMode=i.lightingMode,this.loginWallpaper=i.loginWallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(i.theme),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(i.serverTimestamp),this.setUiVersion(i.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(i){this.browserLightingMode=i,this.lightingMode==="auto"&&this.setLightingMode(i,"browser")}setLightingMode(i,e){e==="user"&&(this.lightingMode=i),this.currentLightingMode=i,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(i){(!i||!this.themeList.includes(i))&&(i="orange");let e=window.document.querySelector("body");e.classList.remove(`config-ui-x-${this.theme}`),e.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=i,this.actualLightingMode==="dark"?(e.classList.add(`config-ui-x-dark-mode-${this.theme}`),e.classList.contains("dark-mode")||e.classList.add("dark-mode")):(e.classList.add(`config-ui-x-${this.theme}`),e.classList.contains("dark-mode")&&e.classList.remove("dark-mode"))}setTitle(i){this.$title.setTitle(i||"Homebridge")}setUiVersion(i){this.uiVersion||(this.uiVersion=i)}setLang(i){i?this.$translate.use(i):i="auto",this.env.lang=i}setEnvItem(i,e){this.env[i]=e}checkServerTime(i){let o=(0,Bt.default)(i).diff((0,Bt.default)(),"hour");this.serverTimeOffset=o*60*60,(o>=8||o<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}};n(t,"\u0275fac",function(e){return new(e||t)(I(ce),I(ie),I(vt),I(ne))}),n(t,"\u0275prov",N({token:t,factory:t.\u0275fac,providedIn:"root"}));let s=t;return s})();export{re as a,J as b,ce as c,q as d,Ze as e,Ye as f,mt as g,ue as h,he as i,qe as j,vt as k,ci as l,fi as m};
@@ -1,2 +0,0 @@
1
- import{a as R}from"./chunk-WCDFKYP6.js";import{$ as c,$b as D,Ea as f,V as M,Wa as g,X as v,Y as w,_ as a,aa as C,fb as b,gb as E,hb as N,ka as l,na as y,oa as u,rb as O,sb as m,z as h}from"./chunk-IGUSDGD6.js";var F=["editorContainer"],S="[_nghost-%COMP%]{display:block;height:200px}.editor-container[_ngcontent-%COMP%]{width:100%;height:98%}",x=new w("NGX_MONACO_EDITOR_CONFIG"),q=!1,I,z=(()=>{let i=class i{constructor(){this.config=a(x),this.onInit=new y,this._insideNg=!1}set insideNg(e){this._insideNg=e,this._editor&&(this._editor.dispose(),this.initMonaco(this._options,this.insideNg))}get insideNg(){return this._insideNg}ngAfterViewInit(){q?I.then(()=>{this.initMonaco(this._options,this.insideNg)}):(q=!0,I=new Promise(e=>{let t=this.config.baseUrl;if((t==="assets"||!t)&&(t="./assets/monaco/min/vs"),typeof window.monaco=="object"){this.initMonaco(this._options,this.insideNg),e();return}let o=r=>{let p=r||window.require,_={paths:{vs:`${t}`}};Object.assign(_,this.config.requireConfig||{}),p.config(_),p(["vs/editor/editor.main"],()=>{typeof this.config.onMonacoLoad=="function"&&this.config.onMonacoLoad(),this.initMonaco(this._options,this.insideNg),e()})};if(this.config.monacoRequire)o(this.config.monacoRequire);else if(window.require)if(window.require.config)o();else{var s=`${t}/loader.js`,d=new XMLHttpRequest;d.addEventListener("load",()=>{let r=document.createElement("script");r.type="text/javascript",r.text=["var nodeRequire = require;",d.responseText.replace('"use strict";',""),"var monacoAmdRequire = require;","require = nodeRequire;","require.nodeRequire = require;"].join(`
2
- `),document.body.appendChild(r),o(window.monacoAmdRequire)}),d.open("GET",s),d.send()}else{let r=document.createElement("script");r.type="text/javascript",r.src=`${t}/loader.js`,r.addEventListener("load",()=>{o()}),document.body.appendChild(r)}}))}ngOnDestroy(){this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._editor&&(this._editor.dispose(),this._editor=void 0)}};i.\u0275fac=function(t){return new(t||i)},i.\u0275cmp=c({type:i,selectors:[["ng-component"]],viewQuery:function(t,o){if(t&1&&b(F,7),t&2){let s;E(s=N())&&(o._editorContainer=s.first)}},inputs:{insideNg:"insideNg"},outputs:{onInit:"onInit"},decls:0,vars:0,template:function(t,o){},encapsulation:2});let n=i;return n})(),$=(()=>{let i=class i extends z{constructor(){super(...arguments),this.zone=a(u),this._value="",this.propagateChange=e=>{},this.onTouched=()=>{}}set options(e){this._options=Object.assign({},this.config.defaultOptions,e),this._editor&&(this._editor.dispose(),this.initMonaco(e,this.insideNg))}get options(){return this._options}set model(e){this.options.model=e,this._editor&&(this._editor.dispose(),this.initMonaco(this.options,this.insideNg))}writeValue(e){this._value=e||"",setTimeout(()=>{this._editor&&!this.options.model&&this._editor.setValue(this._value)})}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){this.onTouched=e}initMonaco(e,t){let o=!!e.model;if(o){let s=monaco.editor.getModel(e.model.uri||"");s?(e.model=s,e.model.setValue(this._value)):e.model=monaco.editor.createModel(e.model.value,e.model.language,e.model.uri)}t?this._editor=monaco.editor.create(this._editorContainer.nativeElement,e):this.zone.runOutsideAngular(()=>{this._editor=monaco.editor.create(this._editorContainer.nativeElement,e)}),o||this._editor.setValue(this._value),this._editor.onDidChangeModelContent(s=>{let d=this._editor.getValue();this.zone.run(()=>{this.propagateChange(d),this._value=d})}),this._editor.onDidBlurEditorWidget(()=>{this.onTouched()}),this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._windowResizeSubscription=h(window,"resize").subscribe(()=>this._editor.layout()),this.onInit.emit(this._editor)}};i.\u0275fac=(()=>{let e;return function(o){return(e||(e=l(i)))(o||i)}})(),i.\u0275cmp=c({type:i,selectors:[["ngx-monaco-editor"]],inputs:{options:"options",model:"model"},standalone:!0,features:[O([{provide:R,useExisting:M(()=>i),multi:!0}]),f,m],decls:2,vars:0,consts:[["editorContainer",""],[1,"editor-container"]],template:function(t,o){t&1&&g(0,"div",1,0)},styles:["[_nghost-%COMP%]{display:block;height:200px}.editor-container[_ngcontent-%COMP%]{width:100%;height:98%}"],changeDetection:0});let n=i;return n})(),H=(()=>{let i=class i extends z{constructor(){super(...arguments),this.zone=a(u)}set options(e){this._options=Object.assign({},this.config.defaultOptions,e),this._editor&&(this._editor.dispose(),this.initMonaco(e,this.insideNg))}get options(){return this._options}set originalModel(e){this._originalModel=e,this._editor&&(this._editor.dispose(),this.initMonaco(this.options,this.insideNg))}set modifiedModel(e){this._modifiedModel=e,this._editor&&(this._editor.dispose(),this.initMonaco(this.options,this.insideNg))}initMonaco(e,t){if(!this._originalModel||!this._modifiedModel)throw new Error("originalModel or modifiedModel not found for ngx-monaco-diff-editor");this._originalModel.language=this._originalModel.language||e.language,this._modifiedModel.language=this._modifiedModel.language||e.language;let o=monaco.editor.createModel(this._originalModel.code,this._originalModel.language),s=monaco.editor.createModel(this._modifiedModel.code,this._modifiedModel.language);this._editorContainer.nativeElement.innerHTML="";let d=e.theme;t?this._editor=monaco.editor.createDiffEditor(this._editorContainer.nativeElement,e):this.zone.runOutsideAngular(()=>{this._editor=monaco.editor.createDiffEditor(this._editorContainer.nativeElement,e)}),e.theme=d,this._editor.setModel({original:o,modified:s}),this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._windowResizeSubscription=h(window,"resize").subscribe(()=>this._editor.layout()),this.onInit.emit(this._editor)}};i.\u0275fac=(()=>{let e;return function(o){return(e||(e=l(i)))(o||i)}})(),i.\u0275cmp=c({type:i,selectors:[["ngx-monaco-diff-editor"]],inputs:{options:"options",originalModel:"originalModel",modifiedModel:"modifiedModel"},standalone:!0,features:[f,m],decls:2,vars:0,consts:[["editorContainer",""],[1,"editor-container"]],template:function(t,o){t&1&&g(0,"div",1,0)},styles:[S],changeDetection:0});let n=i;return n})(),W=(()=>{let i=class i{static forRoot(e={}){return{ngModule:i,providers:[{provide:x,useValue:e}]}}};i.\u0275fac=function(t){return new(t||i)},i.\u0275mod=C({type:i}),i.\u0275inj=v({imports:[D]});let n=i;return n})();export{$ as a,H as b,W as c};
@@ -1 +0,0 @@
1
- import{a as I}from"./chunk-FPOZAQLC.js";import"./chunk-GNQUXZMN.js";import"./chunk-THFLPY67.js";import"./chunk-7564WJJL.js";import"./chunk-RIWBPQF3.js";import"./chunk-S4SOWUAW.js";import{b as S,c as E}from"./chunk-F22FMU37.js";import{$ as f,$b as M,Ua as l,Va as c,Wa as v,X as m,aa as s,ab as h,fb as w,gb as b,h as t,hb as x,jb as C,kb as T,l as p,va as u,vc as d,wa as y,xa as g,yb as j,zb as z}from"./chunk-IGUSDGD6.js";var Q=["terminaloutput"],B=(()=>{let e=class e{constructor(o){t(this,"$terminal");t(this,"termTarget");t(this,"resizeEvent",new p);this.$terminal=o}onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){window.document.querySelector("body").classList.add("bg-black"),this.$terminal.startTerminal(this.termTarget,{},this.resizeEvent),this.$terminal.term.focus()}ngOnDestroy(){window.document.querySelector("body").classList.remove("bg-black"),this.$terminal.destroyTerminal()}};t(e,"\u0275fac",function(i){return new(i||e)(g(I))}),t(e,"\u0275cmp",f({type:e,selectors:[["ng-component"]],viewQuery:function(i,r){if(i&1&&w(Q,7),i&2){let a;b(a=x())&&(r.termTarget=a.first)}},hostBindings:function(i,r){i&1&&h("resize",function(N){return r.onWindowResize(N)},!1,u)},decls:8,vars:3,consts:[["terminaloutput",""],[1,"row","mb-3"],[1,"col-12"],[1,"primary-text","m-0"],[1,"flex-column","d-flex","align-items-stretch","adjust-for-mobile"],["id","docker-terminal",1,"align-self-end","w-100","h-100","mb-1"]],template:function(i,r){i&1&&(l(0,"div",1)(1,"div",2)(2,"h3",3),C(3),j(4,"translate"),c()()(),l(5,"div",4),v(6,"div",5,0),c()),i&2&&(y(3),T(z(4,1,"menu.linux.label_terminal")))},dependencies:[S],encapsulation:2}));let n=e;return n})();var k=[{path:"",component:B}],H=(()=>{let e=class e{};t(e,"\u0275fac",function(i){return new(i||e)}),t(e,"\u0275mod",s({type:e})),t(e,"\u0275inj",m({imports:[d.forChild(k),d]}));let n=e;return n})();var X=(()=>{let e=class e{};t(e,"\u0275fac",function(i){return new(i||e)}),t(e,"\u0275mod",s({type:e})),t(e,"\u0275inj",m({imports:[M,H,E.forChild()]}));let n=e;return n})();export{X as TerminalModule};
@@ -1 +0,0 @@
1
- import{Q as F,z as C}from"./chunk-WCDFKYP6.js";import{b as y,c as E}from"./chunk-F22FMU37.js";import{$ as B,$b as I,Ga as h,Ka as m,La as b,Pb as _,Rb as k,Ua as t,Va as r,Wa as l,X as g,aa as x,ab as w,h as d,jb as p,kb as c,lb as s,vc as S,wa as e,yb as i,zb as n}from"./chunk-IGUSDGD6.js";function D(o,a){o&1&&(t(0,"ul",9)(1,"li",10)(2,"span",11),p(3),i(4,"translate"),l(5,"br"),t(6,"small",12),p(7),i(8,"translate"),r()(),t(9,"a",13),i(10,"translate"),l(11,"i",14),r()(),t(12,"li",10)(13,"span",11),p(14),i(15,"translate"),l(16,"br"),t(17,"small",12),p(18),i(19,"translate"),r()(),t(20,"a",15),i(21,"translate"),l(22,"i",14),r()(),t(23,"li",10)(24,"span",11),p(25),i(26,"translate"),l(27,"br"),t(28,"small",12),p(29),i(30,"translate"),r()(),t(31,"a",16),i(32,"translate"),l(33,"i",14),r()(),t(34,"li",10)(35,"span",11),p(36),i(37,"translate"),l(38,"br"),t(39,"small",12),p(40),i(41,"translate"),r()(),t(42,"a",17),i(43,"translate"),l(44,"i",14),r()()()),o&2&&(e(3),s(" ",n(4,12,"support.links.documentation"),""),e(4),c(n(8,14,"support.links.documentation_sub")),e(2),m("aria-label",n(10,16,"support.links.documentation")),e(5),s(" ",n(15,18,"support.links.issue"),""),e(4),c(n(19,20,"support.links.issue_sub")),e(2),m("aria-label",n(21,22,"support.links.issue")),e(5),s(" ",n(26,24,"support.links.discord"),""),e(4),c(n(30,26,"support.links.discord_sub")),e(2),m("aria-label",n(32,28,"support.links.discord")),e(5),s(" ",n(37,30,"support.links.reddit"),""),e(4),c(n(41,32,"support.links.reddit_sub")),e(2),m("aria-label",n(43,34,"support.links.reddit")))}function G(o,a){o&1&&(t(0,"ul",18)(1,"li",10)(2,"span",11),p(3),i(4,"translate"),l(5,"br"),t(6,"small",12),p(7),i(8,"translate"),r()(),t(9,"a",19),i(10,"translate"),l(11,"i",14),r()(),t(12,"li",10)(13,"span",11),p(14),i(15,"translate"),l(16,"br"),t(17,"small",12),p(18),i(19,"translate"),r()(),t(20,"a",20),i(21,"translate"),l(22,"i",14),r()(),t(23,"li",10)(24,"span",11),p(25),i(26,"translate"),l(27,"br"),t(28,"small",12),p(29),i(30,"translate"),r()(),t(31,"a",21),i(32,"translate"),l(33,"i",14),r()(),t(34,"li",10)(35,"span",11),p(36),i(37,"translate"),l(38,"br"),t(39,"small",12),p(40),i(41,"translate"),r()(),t(42,"a",22),i(43,"translate"),l(44,"i",14),r()(),t(45,"li",10)(46,"span",11),p(47),i(48,"translate"),l(49,"br"),t(50,"small",12),p(51),i(52,"translate"),r()(),t(53,"a",22),i(54,"translate"),l(55,"i",14),r()()()),o&2&&(e(3),s(" ",n(4,15,"support.dev.item_swagger"),""),e(4),s(" ",n(8,17,"support.dev.item_swagger_sub")," "),e(2),m("aria-label",n(10,19,"support.dev.item_swagger")),e(5),s(" ",n(15,21,"support.dev.api"),""),e(4),c(n(19,23,"support.dev.api_sub")),e(2),m("aria-label",n(21,25,"support.dev.api")),e(5),s(" ",n(26,27,"support.dev.api_hap"),""),e(4),c(n(30,29,"support.dev.api_hap_sub")),e(2),m("aria-label",n(32,31,"support.dev.api_hap")),e(5),s(" ",n(37,33,"support.dev.template"),""),e(4),s(" ",n(41,35,"support.dev.template_sub")," "),e(2),m("aria-label",n(43,37,"support.dev.template")),e(5),s(" ",n(48,39,"support.dev.verified"),""),e(4),c(n(52,41,"support.dev.verified_sub")),e(2),m("aria-label",n(54,43,"support.dev.verified")))}var N=(()=>{let a=class a{constructor(){d(this,"showFields",{general:!0,dev:!0})}toggleSection(v){this.showFields[v]=!this.showFields[v]}};d(a,"\u0275fac",function(u){return new(u||a)}),d(a,"\u0275cmp",B({type:a,selectors:[["ng-component"]],decls:18,vars:17,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"mb-4"],["role","button","tabindex","0",1,"mt-3","hover-pointer",3,"click"],[1,"primary-text"],[1,"fa","fa-fw",3,"ngClass"],["class","list-group list-group-box mt-2 mx-0","id","fieldsGeneral",4,"ngIf"],[1,"pb-3"],["class","list-group list-group-box mt-2 mx-0","id","fieldsDev",4,"ngIf"],["id","fieldsGeneral",1,"list-group","list-group-box","mt-2","mx-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"pr-2"],[1,"grey-text","pr-2"],["href","https://github.com/homebridge/homebridge/wiki","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],[1,"fas","fa-fw","fa-external-link-alt"],["href","https://github.com/homebridge/homebridge-config-ui-x/issues/new/choose","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],["href","https://discord.gg/C87Pvq3","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],["href","https://www.reddit.com/r/homebridge/","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],["id","fieldsDev",1,"list-group","list-group-box","mt-2","mx-0"],["href","/swagger","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],["href","https://developers.homebridge.io/#/","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],["href","https://developers.homebridge.io/HAP-NodeJS/","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"],["href","https://github.com/homebridge/homebridge-plugin-template","target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","waves-effect","m-0",2,"min-width","50px"]],template:function(u,f){u&1&&(t(0,"div",0)(1,"h3",1),p(2),i(3,"translate"),r()(),t(4,"div",2)(5,"div",3),w("click",function(){return f.toggleSection("general")}),t(6,"h5",4),l(7,"i",5),p(8),i(9,"translate"),r()(),h(10,D,45,36,"ul",6),r(),t(11,"div",7)(12,"div",3),w("click",function(){return f.toggleSection("dev")}),t(13,"h5",4),l(14,"i",5),p(15),i(16,"translate"),r()(),h(17,G,56,45,"ul",8),r()),u&2&&(e(2),c(n(3,11,"support.title")),e(3),m("aria-expanded",f.showFields.general?"true":"false")("aria-controls","fieldsGeneral"),e(2),b("ngClass",f.showFields.general?"fa-chevron-down":"fa-chevron-right"),e(),s(" ",n(9,13,"support.links.title")," "),e(2),b("ngIf",f.showFields.general),e(2),m("aria-expanded",f.showFields.dev?"true":"false")("aria-controls","fieldsDev"),e(2),b("ngClass",f.showFields.dev?"fa-chevron-down":"fa-chevron-right"),e(),s(" ",n(16,15,"support.dev.title")," "),e(2),b("ngIf",f.showFields.dev))},dependencies:[_,k,y],encapsulation:2}));let o=a;return o})();var P=[{path:"",component:N}],T=(()=>{let a=class a{};d(a,"\u0275fac",function(u){return new(u||a)}),d(a,"\u0275mod",x({type:a})),d(a,"\u0275inj",g({imports:[S.forChild(P),S]}));let o=a;return o})();var Z=(()=>{let a=class a{};d(a,"\u0275fac",function(u){return new(u||a)}),d(a,"\u0275mod",x({type:a})),d(a,"\u0275inj",g({imports:[I,T,F,C,E]}));let o=a;return o})();export{Z as SupportModule};