homebridge-config-ui-x 5.0.0-beta.2 → 5.0.0-beta.4

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 (138) hide show
  1. package/CHANGELOG.md +7 -4
  2. package/README.md +6 -8
  3. package/package.json +3 -4
  4. package/public/3rdpartylicenses.txt +551 -551
  5. package/public/assets/plugin-ui-utils/ui.js +38 -19
  6. package/public/assets/plugin-ui-utils/ui.js.map +1 -1
  7. package/public/chunk-2FJGS2P4.js +1 -0
  8. package/public/chunk-2PVYUZMG.js +1 -0
  9. package/public/chunk-2VTFU3NZ.js +6 -0
  10. package/public/chunk-3FUV2YFB.js +1 -0
  11. package/public/chunk-3IX3CLER.js +1 -0
  12. package/public/chunk-43QJK3CH.js +1 -0
  13. package/public/chunk-4AYTHKYE.js +1 -0
  14. package/public/chunk-4JQFZGIU.js +1 -0
  15. package/public/chunk-5L7KCDO7.js +1 -0
  16. package/public/chunk-5SGGTYVP.js +1 -0
  17. package/public/chunk-64I555F6.js +1 -0
  18. package/public/chunk-6F552PS2.js +14 -0
  19. package/public/chunk-6GDRRHLT.js +1 -0
  20. package/public/chunk-6TCHCTXZ.js +1 -0
  21. package/public/chunk-76SU4XMO.js +1 -0
  22. package/public/chunk-7C3EOONK.js +1 -0
  23. package/public/chunk-7EUQWCP5.js +2 -0
  24. package/public/chunk-7I2U653A.js +1 -0
  25. package/public/chunk-A6RDT6EE.js +32 -0
  26. package/public/chunk-ACHJ26XR.js +1 -0
  27. package/public/chunk-AMGSXBKP.js +1 -0
  28. package/public/chunk-AX2NKG76.js +1 -0
  29. package/public/{chunk-THFLPY67.js → chunk-BKUGARB4.js} +1 -1
  30. package/public/chunk-BPMSJ2VF.js +1 -0
  31. package/public/{chunk-GNQUXZMN.js → chunk-CCUID66K.js} +1 -1
  32. package/public/chunk-CDC5JJGR.js +5 -0
  33. package/public/chunk-CGQI6VDR.js +1 -0
  34. package/public/chunk-CNIFYHFS.js +1 -0
  35. package/public/chunk-DPHWZNEL.js +1 -0
  36. package/public/chunk-DXCU4YH5.js +1 -0
  37. package/public/chunk-EA5J2VEJ.js +1 -0
  38. package/public/chunk-ENTRCZRC.js +1 -0
  39. package/public/chunk-F3LCRXOB.js +1 -0
  40. package/public/chunk-FUOZMXIE.js +1 -0
  41. package/public/chunk-GNMMNSKZ.js +1 -0
  42. package/public/chunk-GONTC5RL.js +1 -0
  43. package/public/chunk-HC4ULUF5.js +1 -0
  44. package/public/chunk-HSJSWZHD.js +1 -0
  45. package/public/chunk-JAM2DL6O.js +1 -0
  46. package/public/chunk-JLUPHWBK.js +1 -0
  47. package/public/chunk-JZZQRLNW.js +1 -0
  48. package/public/chunk-KQJ7ONUG.js +1 -0
  49. package/public/chunk-LAAC3HKW.js +1 -0
  50. package/public/chunk-MK5BZOUV.js +4 -0
  51. package/public/chunk-MOTRKWPN.js +1 -0
  52. package/public/chunk-N3JMUDBI.js +1 -0
  53. package/public/chunk-NW6AFAD7.js +1 -0
  54. package/public/chunk-NZNNTHFQ.js +1 -0
  55. package/public/chunk-ODPNK7TG.js +1 -0
  56. package/public/chunk-OE6MK722.js +1 -0
  57. package/public/chunk-ORPWYWCL.js +5 -0
  58. package/public/chunk-OURFK6JB.js +1 -0
  59. package/public/chunk-PEPJOU6R.js +1 -0
  60. package/public/chunk-PWJLSQWP.js +8 -0
  61. package/public/chunk-QE7DO6J3.js +8 -0
  62. package/public/chunk-QHPDGSZ6.js +1 -0
  63. package/public/chunk-RFBKWUOP.js +20 -0
  64. package/public/chunk-S22XAG5G.js +1 -0
  65. package/public/chunk-S23B67SO.js +1 -0
  66. package/public/chunk-S3ABXPGO.js +1 -0
  67. package/public/chunk-SUCUQYZ3.js +1 -0
  68. package/public/chunk-TCSXGQNF.js +1 -0
  69. package/public/chunk-TXOB7R5K.js +7 -0
  70. package/public/chunk-U4TY4QYN.js +1 -0
  71. package/public/chunk-UG5DK2RQ.js +2 -0
  72. package/public/chunk-UNXETFMR.js +1 -0
  73. package/public/chunk-VAW3X7MD.js +23 -0
  74. package/public/chunk-VF4E7Q42.js +1 -0
  75. package/public/chunk-VOPS522V.js +1 -0
  76. package/public/chunk-VVFRD7PI.js +1 -0
  77. package/public/chunk-WHJOLAED.js +1 -0
  78. package/public/chunk-WHJSVGC7.js +1 -0
  79. package/public/{chunk-6QEO3BTW.js → chunk-WNWWUCCZ.js} +14 -14
  80. package/public/chunk-WWTMEHKF.js +1 -0
  81. package/public/chunk-X6HR3FKR.js +1 -0
  82. package/public/chunk-Y6NAMXTD.js +1 -0
  83. package/public/chunk-YAOIYDRH.js +1 -0
  84. package/public/chunk-ZOOTYXXF.js +1 -0
  85. package/public/chunk-ZT23DWNL.js +1 -0
  86. package/public/chunk-ZTCVXHR7.js +1 -0
  87. package/public/chunk-ZUBSOVIF.js +1 -0
  88. package/public/index.html +2 -2
  89. package/public/main-XXZ7MAPQ.js +1 -0
  90. package/public/media/fa-brands-400-6PJPV6JM.woff2 +0 -0
  91. package/public/media/{fa-brands-400-CNBICIQT.ttf → fa-brands-400-KOKGDU7E.ttf} +0 -0
  92. package/public/media/{fa-regular-400-2FI4ICQD.ttf → fa-regular-400-IPMAEX5Y.ttf} +0 -0
  93. package/public/media/fa-regular-400-OHB6J4OK.woff2 +0 -0
  94. package/public/media/fa-solid-900-ABTK6BNK.woff2 +0 -0
  95. package/public/media/{fa-solid-900-XVWCCN5V.ttf → fa-solid-900-SRFFQLRM.ttf} +0 -0
  96. package/public/{polyfills-CE2SNIQF.js → polyfills-C6JHVXJJ.js} +2 -2
  97. package/public/prerendered-routes.json +3 -0
  98. package/public/styles-EG5MFQEM.css +1 -0
  99. package/public/chunk-2ZL77L5V.js +0 -5
  100. package/public/chunk-36QI2JZZ.js +0 -1
  101. package/public/chunk-4R6MSI5I.js +0 -14
  102. package/public/chunk-54RIF7BL.js +0 -1
  103. package/public/chunk-6PFEOQAC.js +0 -1
  104. package/public/chunk-AA4ALV5Q.js +0 -23
  105. package/public/chunk-B6C32ZRK.js +0 -1
  106. package/public/chunk-BROUJ7PT.js +0 -1
  107. package/public/chunk-C4DMFK2F.js +0 -1
  108. package/public/chunk-CMASH2I6.js +0 -20
  109. package/public/chunk-D63P2BMG.js +0 -4
  110. package/public/chunk-E6TKCZQK.js +0 -1
  111. package/public/chunk-EEAGROCO.js +0 -8
  112. package/public/chunk-EXLYVJ3I.js +0 -1
  113. package/public/chunk-F22FMU37.js +0 -1
  114. package/public/chunk-H7H7YVXE.js +0 -1
  115. package/public/chunk-IGUSDGD6.js +0 -8
  116. package/public/chunk-JM7QCDMZ.js +0 -1
  117. package/public/chunk-LL4U2S7T.js +0 -20
  118. package/public/chunk-MMU5EB5I.js +0 -1
  119. package/public/chunk-MQHO5ODL.js +0 -1
  120. package/public/chunk-MQOC5AAT.js +0 -1
  121. package/public/chunk-NJRXPLIM.js +0 -1
  122. package/public/chunk-NLHSKWUN.js +0 -1
  123. package/public/chunk-PCHM6ESV.js +0 -1
  124. package/public/chunk-PREOLVG7.js +0 -1
  125. package/public/chunk-RYWTZYEC.js +0 -1
  126. package/public/chunk-SJTXTMYT.js +0 -2
  127. package/public/chunk-TBJQ2Y3M.js +0 -1
  128. package/public/chunk-TCMARCBB.js +0 -1
  129. package/public/chunk-UBGLUD5C.js +0 -20
  130. package/public/chunk-V7NUKNPP.js +0 -1
  131. package/public/chunk-W5QNZH4U.js +0 -1
  132. package/public/chunk-WCDFKYP6.js +0 -5
  133. package/public/chunk-YXVNS6GA.js +0 -1
  134. package/public/main-EIMWK4RL.js +0 -6
  135. package/public/media/fa-brands-400-MDS4TU4L.woff2 +0 -0
  136. package/public/media/fa-regular-400-N56QV3DR.woff2 +0 -0
  137. package/public/media/fa-solid-900-Z3HFQTXF.woff2 +0 -0
  138. package/public/styles-7ETWN6DQ.css +0 -1
@@ -1 +0,0 @@
1
- import{a as Ve,b as Te,c as $e}from"./chunk-36QI2JZZ.js";import{a as ye,d as L,f as Be}from"./chunk-AA4ALV5Q.js";import{a as Se,d as q}from"./chunk-LL4U2S7T.js";import"./chunk-4R6MSI5I.js";import"./chunk-SJTXTMYT.js";import"./chunk-6QEO3BTW.js";import{a as Pe}from"./chunk-B6C32ZRK.js";import"./chunk-EEAGROCO.js";import"./chunk-GNQUXZMN.js";import"./chunk-THFLPY67.js";import{a as F}from"./chunk-NJRXPLIM.js";import"./chunk-CMASH2I6.js";import{a as G}from"./chunk-W5QNZH4U.js";import{a as ke}from"./chunk-JM7QCDMZ.js";import"./chunk-V7NUKNPP.js";import{H as fe,I as _e,J as he,K as be,L as Ce,M as ve,N as xe,O as we,Q as Ie,c as ae,d as re,e as le,f as oe,g as se,j as pe,m as de,p as ce,q as ge,y as ue,z as me}from"./chunk-WCDFKYP6.js";import{c as A,k as R,m as U}from"./chunk-54RIF7BL.js";import{a as H,b as M,c as ne}from"./chunk-F22FMU37.js";import{$ as T,$b as ee,Ab as Q,Ga as I,Ka as B,La as s,Pb as X,Qb as Y,Rb as E,Ua as o,Va as p,Wa as c,X as D,Xa as W,Ya as J,Za as v,Zb as Z,aa as N,ab as h,bb as g,h as d,ha as b,i as k,ia as C,jb as _,kb as P,lb as x,pc as ie,sc as te,t as V,ua as $,vb as K,vc as O,wa as r,xa as y,yb as u,zb as m}from"./chunk-IGUSDGD6.js";function Ue(e,l){if(e&1){let a=v();o(0,"button",15),h("click",function(){b(a);let t=g();return C(t.$activeModal.dismiss("Dismiss"))}),_(1),u(2,"translate"),p()}e&2&&(r(),x(" ",m(2,1,"form.button_close")," "))}function Fe(e,l){if(e&1){let a=v();o(0,"button",15),h("click",function(){b(a);let t=g();return C(t.$activeModal.dismiss("Dismiss"))}),_(1),u(2,"translate"),p()}e&2&&(r(),x(" ",m(2,1,"form.button_close")," "))}function qe(e,l){if(e&1&&(o(0,"a",16),_(1),u(2,"translate"),c(3,"i",17),p()),e&2){let a=g();s("href",a.plugin.links.homepage||a.plugin.links.npm,$),r(),x(" ",m(2,2,"plugins.button_homepage")," ")}}var je=(()=>{let l=class l{constructor(i){d(this,"$activeModal");d(this,"plugin");d(this,"defaultIcon","assets/hb-icon.png");this.$activeModal=i}ngOnInit(){this.plugin.icon||(this.plugin.icon=this.defaultIcon)}handleIconError(){this.plugin.icon=this.defaultIcon}};d(l,"\u0275fac",function(t){return new(t||l)(y(ve))}),d(l,"\u0275cmp",T({type:l,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:26,vars:14,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"],["alt","Plugin Icon",1,"mb-3","plugin-icon",3,"error","src"],[1,"my-3"],[1,"m-0","grey-text"],[1,"modal-footer","justify-content-between"],[1,"text-left"],["type","button","class","btn btn-elegant","data-dismiss","modal",3,"click",4,"ngIf"],[1,"text-center"],[1,"text-right"],["class","btn btn-primary text-decoration-none","target","_blank","rel","noopener noreferrer",3,"href",4,"ngIf"],["type","button","data-dismiss","modal",1,"btn","btn-elegant",3,"click"],["target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","text-decoration-none",3,"href"],[1,"fas","fa-fw","fa-external-link-alt"]],template:function(t,n){t&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),_(3),u(4,"translate"),p(),o(5,"button",3),u(6,"translate"),h("click",function(){return n.$activeModal.dismiss("Dismiss")}),o(7,"span",4),_(8,"\xD7"),p()()(),o(9,"div",5)(10,"img",6),h("error",function(){return n.handleIconError()}),p(),o(11,"h4"),_(12),p(),o(13,"p",7),_(14),p(),o(15,"p",8),_(16),p(),o(17,"p",8),_(18),p()(),o(19,"div",9)(20,"div",10),I(21,Ue,3,3,"button",11),p(),o(22,"div",12),I(23,Fe,3,3,"button",11),p(),o(24,"div",13),I(25,qe,4,4,"a",14),p()()()),t&2&&(r(3),P(m(4,10,"plugins.manage.information")),r(2),B("aria-label",m(6,12,"form.button_close")),r(5),s("src",n.plugin.icon,$),r(2),P(n.plugin.displayName||n.plugin.name),r(2),P(n.plugin.description),r(2),P(n.plugin.name),r(2),x("@",n.plugin.author,""),r(3),s("ngIf",n.plugin.links.homepage||n.plugin.links.npm),r(2),s("ngIf",!n.plugin.links.homepage&&!n.plugin.links.npm),r(2),s("ngIf",n.plugin.links.homepage||n.plugin.links.npm))},dependencies:[E,M],styles:[".plugin-icon[_ngcontent-%COMP%]{height:75px;width:75px;border-radius:15px;border:1px solid #222222}"]}));let e=l;return e})();var Je=(e,l)=>({"fa-bridge-circle-exclamation orange-text":e,"fa-bridge-circle-xmark red-text":l});function Ke(e,l){e&1&&c(0,"i",30)}function Qe(e,l){e&1&&c(0,"i",31)}function Xe(e,l){if(e&1){let a=v();o(0,"a",27),h("click",function(){b(a);let t=g();return C(t.openHb2InfoModal())}),I(1,Ke,1,0,"i",28)(2,Qe,1,0,"i",29),p()}if(e&2){let a=g();s("ngbTooltip","Homebridge v2.0 Readiness")("placement","right"),r(),s("ngIf",a.hb2Status==="supported"),r(),s("ngIf",a.hb2Status==="unknown")}}function Ye(e,l){if(e&1){let a=v();o(0,"a",32),u(1,"translate"),u(2,"translate"),h("click",function(){b(a);let t=g();return C(t.$plugin.checkAndUpdatePlugin(t.plugin,t.plugin.updateTag||"latest"))}),c(3,"i",33),p()}e&2&&(s("ngbTooltip",m(1,2,"plugins.button_update")),B("aria-label",m(2,4,"plugins.button_update")))}function Ze(e,l){if(e&1){let a=v();o(0,"a",32),u(1,"translate"),u(2,"translate"),h("click",function(){b(a);let t=g();return C(t.$plugin.switchToScoped(t.plugin))}),c(3,"i",34),p()}e&2&&(s("ngbTooltip",m(1,2,"plugins.manage.scoped.switch")),B("aria-label",m(2,4,"plugins.manage.scoped.switch")))}function ei(e,l){if(e&1){let a=v();o(0,"a",32),u(1,"translate"),u(2,"translate"),h("click",function(){b(a);let t=g();return C(t.$plugin.settings(t.plugin))}),c(3,"i",35),p()}e&2&&(s("ngbTooltip",m(1,2,"plugins.button_set_up")),B("aria-label",m(2,4,"plugins.button_set_up")))}function ii(e,l){if(e&1){let a=v();o(0,"a",32),u(1,"translate"),u(2,"translate"),h("click",function(){b(a);let t=g();return C(t.$plugin.bridgeSettings(t.plugin))}),c(3,"i",36),p()}e&2&&(s("ngbTooltip",m(1,2,"child_bridge.setup")),B("aria-label",m(2,4,"child_bridge.setup")))}function ti(e,l){if(e&1){let a=v();o(0,"a",32),u(1,"translate"),u(2,"translate"),h("click",function(){b(a);let t=g();return C(t.$plugin.bridgeSettings(t.plugin))}),c(3,"i",37),p()}e&2&&(s("ngbTooltip",m(1,2,"child_bridge.bridge_connect")),B("aria-label",m(2,4,"child_bridge.bridge_connect")))}function ni(e,l){if(e&1&&c(0,"i",38),e&2){let a=g();s("ngClass",K(1,Je,a.childBridgeStatus==="pending",a.childBridgeStatus==="down"))}}function ai(e,l){if(e&1){let a=v();o(0,"p",19)(1,"a",39),h("click",function(){b(a);let t=g();return C(t.openVerifiedModal())}),c(2,"i",40),o(3,"span",17),_(4),u(5,"translate"),p()()()}e&2&&(r(4),P(m(5,1,"plugins.donate.button_verified")))}function ri(e,l){if(e&1){let a=v();o(0,"p",19)(1,"a",41),h("click",function(){b(a);let t=g();return C(t.openVerifiedModal())}),c(2,"i",42),o(3,"span",17),_(4),u(5,"translate"),p()()()}e&2&&(r(4),P(m(5,1,"plugins.donate.button_not_verified")))}function li(e,l){if(e&1){let a=v();o(0,"a",43),h("click",function(){b(a);let t=g();return C(t.openFundingModal(t.plugin))}),c(1,"i",44),o(2,"span",17),_(3),p()()}if(e&2){let a=g();r(3),x("@",a.plugin.author,"")}}function oi(e,l){if(e&1&&(o(0,"span",17),c(1,"i",45),_(2),p()),e&2){let a=g();r(2),x("@",a.plugin.author," ")}}function si(e,l){if(e&1&&(o(0,"span"),_(1),u(2,"date"),p()),e&2){let a=g(2);r(),x("(",Q(2,1,a.plugin.lastUpdated,"yyyy-MM-dd"),")")}}function pi(e,l){if(e&1&&(o(0,"span"),c(1,"i",46),o(2,"span",17),_(3),I(4,si,3,4,"span",23),p()()),e&2){let a=g();r(3),x("v",a.plugin.latestVersion," "),r(),s("ngIf",a.plugin.lastUpdated)}}function di(e,l){if(e&1&&(o(0,"span"),c(1,"i",47),_(2),p()),e&2){let a=g();r(2),x("v",a.plugin.installedVersion," ")}}function ci(e,l){if(e&1){let a=v();o(0,"a",32),u(1,"translate"),h("click",function(){b(a);let t=g();return C(t.doChildBridgeAction("restart"))}),c(2,"i",48),p()}if(e&2){let a=g();s("ngbTooltip",m(1,1,a.setChildBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart"))}}function gi(e,l){if(e&1){let a=v();o(0,"a",49),h("click",function(){b(a);let t=g();return C(t.enablePlugin(t.plugin))}),c(1,"i",50),u(2,"translate"),p()}e&2&&(r(),s("ngbTooltip",m(2,1,"plugins.status_disabled")))}function ui(e,l){if(e&1){let a=v();o(0,"a",51),h("click",function(){b(a);let t=g();return C(t.$plugin.installAlternateVersion(t.plugin))}),c(1,"i",52),p()}}function mi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.viewPluginLog(t.plugin))}),c(1,"i",62),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"plugins.manage.plugin_logs")," "))}function fi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.$plugin.installAlternateVersion(t.plugin))}),c(1,"i",63),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"plugins.manage.manage_version")," "))}function _i(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.$plugin.jsonEditor(t.plugin))}),c(1,"i",64),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"plugins.manage.json_config")," "))}function hi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.disablePlugin(t.plugin))}),c(1,"i",65),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"plugins.manage.disable")," "))}function bi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.enablePlugin(t.plugin))}),c(1,"i",66),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"plugins.manage.enable")," "))}function Ci(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.$plugin.uninstallPlugin(t.plugin,t.setChildBridges))}),c(1,"i",67),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"plugins.button_uninstall")," "))}function vi(e,l){e&1&&c(0,"div",68)}function xi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(3);return C(t.doChildBridgeAction("restart"))}),c(1,"i",70),_(2),u(3,"translate"),p()}if(e&2){let a=g(3);r(2),x(" ",m(3,1,a.setChildBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart")," ")}}function wi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(3);return C(t.doChildBridgeAction("stop"))}),c(1,"i",71),_(2),u(3,"translate"),p()}if(e&2){let a=g(3);r(2),x(" ",m(3,1,a.setChildBridges.length>1?"child_bridge.stop_plural":"child_bridge.stop")," ")}}function Ii(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(3);return C(t.doChildBridgeAction("start"))}),c(1,"i",72),_(2),u(3,"translate"),p()}if(e&2){let a=g(3);r(2),x(" ",m(3,1,a.setChildBridges.length>1?"child_bridge.start_plural":"child_bridge.start")," ")}}function yi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(3);return C(t.$plugin.resetChildBridges(t.setChildBridges))}),c(1,"i",73),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"child_bridge.reset_accessories")," "))}function Pi(e,l){if(e&1){let a=v();W(0),o(1,"button",57),h("click",function(){b(a);let t=g(2);return C(t.$plugin.bridgeSettings(t.plugin))}),c(2,"i",69),_(3),u(4,"translate"),p(),I(5,xi,4,3,"button",59)(6,wi,4,3,"button",59)(7,Ii,4,3,"button",59)(8,yi,4,3,"button",59),J()}if(e&2){let a=g(2);r(3),x(" ",m(4,5,"child_bridge.bridge_settings")," "),r(2),s("ngIf",!a.childBridgeRestartInProgress),r(),s("ngIf",!a.allChildBridgesStopped),r(),s("ngIf",a.allChildBridgesStopped),r(),s("ngIf",a.$settings.env.serviceMode)}}function ki(e,l){e&1&&c(0,"div",68)}function Si(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.$plugin.bridgeSettings(t.plugin))}),c(1,"i",74),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"child_bridge.setup")," "))}function Bi(e,l){e&1&&c(0,"div",68)}function Vi(e,l){if(e&1){let a=v();o(0,"button",57),h("click",function(){b(a);let t=g(2);return C(t.$plugin.bridgeSettings(t.plugin))}),c(1,"i",74),_(2),u(3,"translate"),p()}e&2&&(r(2),x(" ",m(3,1,"child_bridge.setup")," "))}function Ti(e,l){e&1&&c(0,"div",68)}function $i(e,l){if(e&1&&(o(0,"a",75),c(1,"i",76),_(2),u(3,"translate"),p()),e&2){let a=g(2);s("href",a.plugin.links.bugs,$),r(2),x(" ",m(3,2,"support.links.issue")," ")}}function Ei(e,l){if(e&1){let a=v();o(0,"span",53)(1,"a",54),c(2,"i",55),p(),o(3,"div",56)(4,"button",57),h("click",function(){b(a);let t=g();return C(t.$plugin.settings(t.plugin))}),c(5,"i",58),_(6),u(7,"translate"),p(),I(8,mi,4,3,"button",59)(9,fi,4,3,"button",59)(10,_i,4,3,"button",59)(11,hi,4,3,"button",59)(12,bi,4,3,"button",59)(13,Ci,4,3,"button",59)(14,vi,1,0,"div",60)(15,Pi,9,7,"ng-container",23)(16,ki,1,0,"div",60)(17,Si,4,3,"button",59)(18,Bi,1,0,"div",60)(19,Vi,4,3,"button",59)(20,Ti,1,0,"div",60)(21,$i,4,4,"a",61),p()()}if(e&2){let a=g();r(),B("aria-label","Plugin Actions Dropdown"),r(5),x(" ",m(7,16,"plugins.button_settings")," "),r(2),s("ngIf",a.plugin.isConfigured&&!a.plugin.disabled),r(),s("ngIf",a.plugin.publicPackage),r(),s("ngIf",!a.isMobile&&a.plugin.name!=="homebridge-config-ui-x"),r(),s("ngIf",a.plugin.name!=="homebridge-config-ui-x"&&!a.plugin.disabled),r(),s("ngIf",a.plugin.name!=="homebridge-config-ui-x"&&a.plugin.disabled),r(),s("ngIf",a.plugin.name!=="homebridge-config-ui-x"),r(),s("ngIf",!a.plugin.disabled&&a.plugin.isConfigured&&a.plugin.hasChildBridges&&a.plugin.installedVersion&&a.plugin.name!=="homebridge-config-ui-x"),r(),s("ngIf",a.plugin.hasChildBridges&&!a.plugin.disabled),r(),s("ngIf",a.plugin.isConfigured&&!a.plugin.hasChildBridges&&!a.plugin.disabled&&!a.plugin.recommendChildBridge),r(),s("ngIf",a.plugin.isConfigured&&!a.plugin.hasChildBridges&&!a.plugin.disabled&&!a.plugin.recommendChildBridge),r(),s("ngIf",a.plugin.isConfigured&&!a.plugin.hasChildBridges&&!a.plugin.disabled&&a.plugin.recommendChildBridge&&a.plugin.updateAvailable),r(),s("ngIf",a.plugin.isConfigured&&!a.plugin.hasChildBridges&&!a.plugin.disabled&&a.plugin.recommendChildBridge&&a.plugin.updateAvailable),r(),s("ngIf",a.plugin.links==null?null:a.plugin.links.bugs),r(),s("ngIf",a.plugin.links==null?null:a.plugin.links.bugs)}}var De=(()=>{let l=class l{constructor(i,t,n,f,S,w,j,Ae){d(this,"$api");d(this,"$md");d(this,"$modal");d(this,"$plugin");d(this,"$settings");d(this,"$toastr");d(this,"$translate");d(this,"$ws");d(this,"plugin");d(this,"hasChildBridges",!1);d(this,"hasUnpairedChildBridges",!1);d(this,"allChildBridgesStopped",!1);d(this,"childBridgeStatus","pending");d(this,"childBridgeRestartInProgress",!1);d(this,"defaultIcon","assets/hb-icon.png");d(this,"isMobile");d(this,"setChildBridges",[]);d(this,"prettyDisplayName","");d(this,"hb2Status","unknown");d(this,"io");this.$api=i,this.$md=t,this.$modal=n,this.$plugin=f,this.$settings=S,this.$toastr=w,this.$translate=j,this.$ws=Ae}set childBridges(i){var f,S;this.hasChildBridges=i.length>0,this.hasUnpairedChildBridges=i.filter(w=>w.paired===!1).length>0,this.allChildBridgesStopped=i.filter(w=>w.manuallyStopped===!0).length===i.length,this.hasChildBridges&&(i.some(w=>w.status==="down")?this.childBridgeStatus="down":i.some(w=>w.status==="pending")?this.childBridgeStatus="pending":i.some(w=>w.status==="ok")&&(this.childBridgeStatus="ok")),this.setChildBridges=i;let t=this.$settings.env.homebridgeVersion.split(".")[0],n=((S=(f=this.plugin.engines)==null?void 0:f.homebridge)==null?void 0:S.split("||").map(w=>w.trim()))||[];this.hb2Status=t==="2"?"hide":n.some(w=>w.startsWith("^2")||w.startsWith(">=2"))?"supported":this.hb2Status}ngOnInit(){this.isMobile=this.$md.detect.mobile(),this.prettyDisplayName=this.prettifyName(),this.io=this.$ws.getExistingNamespace("child-bridges"),this.plugin.icon||(this.plugin.icon=this.defaultIcon)}openFundingModal(i){let t=this.$modal.open(Te,{size:"lg",backdrop:"static"});t.componentInstance.plugin=i}openVerifiedModal(){let i=this.$modal.open(L,{size:"lg",backdrop:"static"});this.plugin.verifiedPlugin||this.plugin.verifiedPlusPlugin?(i.componentInstance.title=this.$translate.instant("plugins.manage.verified_title"),i.componentInstance.subtitle=this.$translate.instant("plugins.manage.verified_subtitle",{pluginName:this.plugin.displayName||this.plugin.name}),i.componentInstance.message=this.$translate.instant("plugins.manage.verified_message"),i.componentInstance.faIconClass="fa-shield-alt green-text"):(i.componentInstance.title=this.$translate.instant("plugins.manage.unverified_title"),i.componentInstance.subtitle=this.$translate.instant("plugins.manage.unverified_subtitle",{pluginName:this.plugin.displayName||this.plugin.name}),i.componentInstance.message=this.$translate.instant("plugins.manage.unverified_message"),i.componentInstance.faIconClass="fa-shield-alt grey-text"),i.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),i.componentInstance.ctaButtonLink="https://github.com/homebridge/homebridge/wiki/verified-Plugins"}pluginInfoModal(i){let t=this.$modal.open(je,{size:"lg",backdrop:"static"});t.componentInstance.plugin=i}disablePlugin(i){let t=this.$modal.open(Ve,{size:"lg",backdrop:"static"});t.componentInstance.pluginName=i.name,t.componentInstance.isConfigured=i.isConfigured,t.componentInstance.isConfiguredDynamicPlatform=i.isConfiguredDynamicPlatform,t.result.then(()=>k(this,null,function*(){try{yield V(this.$api.put(`/config-editor/plugin/${encodeURIComponent(i.name)}/disable`,{})),i.disabled=!0,this.hasChildBridges&&this.doChildBridgeAction("stop"),this.$modal.open(G,{size:"lg",backdrop:"static"})}catch(n){console.error(n),this.$toastr.error(this.$translate.instant("plugins.disable.error"),this.$translate.instant("toast.title_error"))}}))}enablePlugin(i){let t=this.$modal.open(ke,{size:"lg",backdrop:"static"});t.componentInstance.title=`${this.$translate.instant("plugins.manage.enable")}: ${i.name}`,t.componentInstance.message=this.$translate.instant("plugins.manage.confirm_enable",{pluginName:i.name}),t.componentInstance.confirmButtonLabel=this.$translate.instant("plugins.manage.enable"),t.componentInstance.faIconClass="fa-circle-play primary-text",t.result.then(()=>k(this,null,function*(){try{yield V(this.$api.put(`/config-editor/plugin/${encodeURIComponent(i.name)}/enable`,{})),i.disabled=!1,this.hasChildBridges&&(yield this.doChildBridgeAction("start")),this.$modal.open(G,{size:"lg",backdrop:"static"})}catch(n){console.error(n),this.$toastr.error(this.$translate.instant("plugins.enable.error"),this.$translate.instant("toast.title_error"))}}))}viewPluginLog(i){let t=this.$modal.open(Se,{size:"xl",backdrop:"static"});t.componentInstance.plugin=i}doChildBridgeAction(i){return k(this,null,function*(){this.childBridgeRestartInProgress=!0;try{for(let t of this.setChildBridges)yield V(this.io.request(`${i}-child-bridge`,t.username))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("plugins.bridge.action_error",{action:i}),this.$translate.instant("toast.title_error")),this.childBridgeRestartInProgress=!1}finally{setTimeout(()=>{this.childBridgeRestartInProgress=!1},i==="restart"?12e3:i==="stop"?6e3:1e3)}})}handleIconError(){this.plugin.icon=this.defaultIcon}prettifyName(){let i=this.plugin.displayName||(this.plugin.name.charAt(0)==="@"?this.plugin.name.split("/")[1]:this.plugin.name);return i=i.replace(/-/g," "),this.isMobile&&i.toLowerCase().startsWith("homebridge ")&&(i=i.replace(/^homebridge /i,"")),this.plugin.displayName||(i=i.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())),i}openHb2InfoModal(){let i=this.$modal.open(L,{size:"lg",backdrop:"static"});i.componentInstance.title="Plugin Readiness",this.hb2Status==="supported"?(i.componentInstance.subtitle=`${this.plugin.displayName||this.plugin.name} is ready for Homebridge v2.0`,i.componentInstance.message="The developer has specifically marked your installed version of the plugin as compatible with Homebridge v2.0.",i.componentInstance.faIconClass="fa-check-circle green-text"):(i.componentInstance.subtitle=`${this.plugin.displayName||this.plugin.name} might not be ready for Homebridge v2.0`,i.componentInstance.message="The developer has not specifically marked your installed version of the plugin as compatible with Homebridge v2.0, but it may still work.",i.componentInstance.faIconClass="fa-question-circle orange-text"),i.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),i.componentInstance.ctaButtonLink="https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0"}};d(l,"\u0275fac",function(t){return new(t||l)(y(A),y(Pe),y(xe),y(q),y(U),y(R),y(H),y(F))}),d(l,"\u0275cmp",T({type:l,selectors:[["app-plugin-card"]],inputs:{plugin:"plugin",childBridges:"childBridges"},decls:38,vars:21,consts:[[1,"card","card-body","mb-3"],[1,"d-flex","flex-row","justify-content-between"],[1,"d-flex","flex-column","mr-3","align-items-center","justify-content-between"],["alt","Plugin Icon",1,"plugin-icon-card","mb-3",3,"error","src"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover","aria-label","Homebridge v2.0 Readiness",3,"ngbTooltip","placement","click",4,"ngIf"],[1,"d-flex","flex-column","justify-content-between",2,"min-width","calc(100% - 80px)"],[1,"d-flex","flex-row","align-items-end"],[1,"d-flex","flex-column","w-100"],[1,"d-flex","flex-row"],[1,"card-title","mb-2","text-truncate"],[1,"ml-auto"],["href","javascript:void(0)","class","card-link","container","body","openDelay","150","triggers","hover",3,"ngbTooltip","click",4,"ngIf"],[1,"fas","fa-fw","fa-spinner","fa-pulse","fa-lg","grey-text","ml-3",3,"hidden"],["class","fas fa-fw fa-lg ml-3",3,"ngClass",4,"ngIf"],[1,"card-text","mb-2","text-truncate"],["href","javascript:void(0)",1,"card-link","grey-text",3,"click"],[1,"fas","fa-fw","fa-info-circle","fa-lg","mr-1"],[1,"grey-text"],["class","card-text mb-2",4,"ngIf"],[1,"card-text","mb-2"],["href","javascript:void(0)","class","card-link pink-text",3,"click",4,"ngIf"],["class","grey-text",4,"ngIf"],[1,"card-text","mb-0","grey-text"],[4,"ngIf"],["href","javascript:void(0)","class","card-link red-text",3,"click",4,"ngIf"],["href","javascript:void(0)",3,"click",4,"ngIf"],["ngbDropdown","","placement","left","class","d-inline-block ml-3 mt-auto",4,"ngIf"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover","aria-label","Homebridge v2.0 Readiness",3,"click","ngbTooltip","placement"],["class","fas fa-check-circle green-text fa-xl","aria-label","The developer has specifically marked this plugin as compatible with Homebridge v2.0",4,"ngIf"],["class","fas fa-question-circle orange-text fa-xl","aria-label","The developer has not specifically marked this plugin as compatible with Homebridge v2.0, but it may still work.",4,"ngIf"],["aria-label","The developer has specifically marked this plugin as compatible with Homebridge v2.0",1,"fas","fa-check-circle","green-text","fa-xl"],["aria-label","The developer has not specifically marked this plugin as compatible with Homebridge v2.0, but it may still work.",1,"fas","fa-question-circle","orange-text","fa-xl"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover",1,"card-link",3,"click","ngbTooltip"],[1,"far","fa-fw","fa-arrow-alt-circle-up","primary-text","fa-lg","fa-fade","ml-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-arrow-right-arrow-left","primary-text","fa-lg","fa-fade","ml-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-sliders","primary-text","fa-lg","fa-fade","ml-3",2,"--fa-animation-duration","2s"],[1,"icon-button","fas","fa-fw","fa-bridge","primary-text","fa-lg","fa-fade","ml-3",2,"--fa-animation-duration","2s"],[1,"icon-button","fas","fa-fw","fa-qrcode","primary-text","fa-lg","fa-fade","ml-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-lg","ml-3",3,"ngClass"],["href","javascript:void(0)",1,"card-link","green-text",3,"click"],[1,"fas","fa-fw","fa-shield-alt","fa-lg","mr-1"],["href","javascript:void(0)",1,"card-link",3,"click"],[1,"fas","fa-fw","fa-shield-alt","fa-lg","mr-1",2,"opacity","0.25"],["href","javascript:void(0)",1,"card-link","pink-text",3,"click"],[1,"fas","fa-fw","fa-heart","fa-lg","mr-1"],[1,"fas","fa-fw","fa-heart","fa-lg","mr-1",2,"opacity","0.5"],[1,"far","fa-fw","fa-circle-dot","fa-lg","mr-1"],[1,"far","fa-fw","fa-circle-check","fa-lg","mr-1"],[1,"fas","fa-fw","fa-lg","fa-power-off","ml-3"],["href","javascript:void(0)",1,"card-link","red-text",3,"click"],["container","body","openDelay","150","triggers","hover",1,"far","fa-fw","fa-pause-circle","fa-lg",3,"ngbTooltip"],["href","javascript:void(0)",3,"click"],[1,"far","fa-fw","fa-arrow-alt-circle-down","fa-lg"],["ngbDropdown","","placement","left",1,"d-inline-block","ml-3","mt-auto"],["href","javascript:void(0)","ngbDropdownToggle","",1,"card-link","text-decoration-none","mt-auto",2,"outline","none"],[1,"fa-solid","fa-fw","fa-ellipsis-v","fa-lg"],["ngbDropdownMenu","","aria-labelledby","Plugin Actions Dropdown"],["ngbDropdownItem","",3,"click"],[1,"fas","fa-fw","fa-sliders"],["ngbDropdownItem","",3,"click",4,"ngIf"],["class","dropdown-divider",4,"ngIf"],["ngbDropdownItem","","rel","noopener noreferrer","target","_blank",3,"href",4,"ngIf"],[1,"fas","fa-fw","fa-wave-square"],[1,"fas","fa-fw","fa-code-compare"],[1,"fas","fa-fw","fa-code"],[1,"far","fa-fw","fa-circle-pause"],[1,"far","fa-fw","fa-circle-play"],[1,"fas","fa-fw","fa-trash"],[1,"dropdown-divider"],[1,"fas","fa-fw","fa-bridge"],[1,"fa-fw","icon-button","fas","fa-fw","fa-power-off"],[1,"fas","fa-fw","fa-stop"],[1,"fas","fa-fw","fa-play"],[1,"fas","fa-fw","fa-broom"],[1,"icon-button","fas","fa-fw","fa-bridge"],["ngbDropdownItem","","rel","noopener noreferrer","target","_blank",3,"href"],[1,"icon-button","fa","fa-fw","fa-question-circle-o"]],template:function(t,n){t&1&&(o(0,"div",0)(1,"div",1)(2,"div",2)(3,"img",3),h("error",function(){return n.handleIconError()}),p(),I(4,Xe,3,4,"a",4),p(),o(5,"div",5)(6,"div",6)(7,"div",7)(8,"div",8)(9,"h5",9),_(10),p(),o(11,"div",10),I(12,Ye,4,6,"a",11)(13,Ze,4,6,"a",11)(14,ei,4,6,"a",11)(15,ii,4,6,"a",11)(16,ti,4,6,"a",11),c(17,"i",12),I(18,ni,1,4,"i",13),p()(),o(19,"p",14)(20,"a",15),h("click",function(){return n.pluginInfoModal(n.plugin)}),c(21,"i",16),o(22,"span",17),_(23),p()()(),I(24,ai,6,3,"p",18)(25,ri,6,3,"p",18),o(26,"p",19),I(27,li,4,1,"a",20)(28,oi,3,1,"span",21),p(),o(29,"div",8)(30,"p",22),I(31,pi,5,2,"span",23)(32,di,3,1,"span",23),p(),o(33,"div",10),I(34,ci,3,3,"a",11)(35,gi,3,3,"a",24)(36,ui,2,0,"a",25)(37,Ei,22,18,"span",26),p()()()()()()()),t&2&&(r(3),s("src",n.plugin.icon,$),r(),s("ngIf",n.plugin.installedVersion&&n.hb2Status!=="hide"),r(6),P(n.prettyDisplayName),r(2),s("ngIf",n.plugin.installedVersion&&n.plugin.updateAvailable&&!n.childBridgeRestartInProgress),r(),s("ngIf",n.plugin.installedVersion&&(n.plugin.newHbScope==null?null:n.plugin.newHbScope.switch)===n.plugin.installedVersion&&!n.childBridgeRestartInProgress),r(),s("ngIf",n.plugin.installedVersion&&(!n.plugin.newHbScope||n.plugin.newHbScope.switch!==n.plugin.installedVersion)&&!n.plugin.updateAvailable&&!n.plugin.isConfigured&&!n.childBridgeRestartInProgress),r(),s("ngIf",n.plugin.installedVersion&&(!n.plugin.newHbScope||n.plugin.newHbScope.switch!==n.plugin.installedVersion)&&!n.plugin.updateAvailable&&n.plugin.isConfigured&&!n.plugin.hasChildBridges&&!n.plugin.disabled&&n.plugin.recommendChildBridge&&!n.childBridgeRestartInProgress),r(),s("ngIf",n.plugin.installedVersion&&(!n.plugin.newHbScope||n.plugin.newHbScope.switch!==n.plugin.installedVersion)&&!n.plugin.updateAvailable&&n.plugin.isConfigured&&n.plugin.hasChildBridges&&!n.childBridgeRestartInProgress&&n.hasUnpairedChildBridges&&n.childBridgeStatus==="ok"&&!n.plugin.disabled),r(),s("hidden",!n.childBridgeRestartInProgress),r(),s("ngIf",n.plugin.installedVersion&&(!n.plugin.newHbScope||n.plugin.newHbScope.switch!==n.plugin.installedVersion)&&!n.plugin.updateAvailable&&n.plugin.isConfigured&&n.plugin.hasChildBridges&&!n.childBridgeRestartInProgress&&!n.hasUnpairedChildBridges&&n.childBridgeStatus!=="ok"&&!n.plugin.disabled),r(5),P(n.plugin.name),r(),s("ngIf",n.plugin.verifiedPlugin||n.plugin.verifiedPlusPlugin),r(),s("ngIf",!n.plugin.verifiedPlugin&&!n.plugin.verifiedPlusPlugin),r(2),s("ngIf",(n.plugin.verifiedPlugin||n.plugin.verifiedPlusPlugin)&&n.plugin.funding),r(),s("ngIf",!((n.plugin.verifiedPlugin||n.plugin.verifiedPlusPlugin)&&n.plugin.funding)),r(3),s("ngIf",n.plugin.publicPackage&&!n.plugin.installedVersion),r(),s("ngIf",n.plugin.installedVersion),r(2),s("ngIf",!n.plugin.disabled&&n.plugin.hasChildBridges&&n.childBridgeStatus==="ok"),r(),s("ngIf",n.plugin.installedVersion&&n.plugin.disabled),r(),s("ngIf",n.plugin.publicPackage&&!n.plugin.installedVersion),r(),s("ngIf",n.plugin.installedVersion))},dependencies:[X,E,Ce,be,he,fe,_e,we,Z,M],encapsulation:2}));let e=l;return e})();function ji(e,l){e&1&&c(0,"app-spinner")}function Di(e,l){e&1&&c(0,"i",13)}function Ni(e,l){if(e&1&&(o(0,"div",14),c(1,"app-plugin-card",15),p()),e&2){let a=l.$implicit,i=g();r(),s("plugin",a)("childBridges",i.getPluginChildBridges(a))}}function Hi(e,l){e&1&&(o(0,"div",16),c(1,"i",17),o(2,"p"),_(3),u(4,"translate"),p()()),e&2&&(r(3),P(m(4,1,"plugins.placeholder_search_first")))}var Ne=(()=>{let l=class l{constructor(i,t,n,f,S,w,j){d(this,"$api");d(this,"$plugin");d(this,"$router");d(this,"$settings");d(this,"$toastr");d(this,"$translate");d(this,"$ws");d(this,"loading",!0);d(this,"installedPlugins",[]);d(this,"childBridges",[]);d(this,"form",new se({query:new pe("",[re.required])}));d(this,"io");d(this,"navigationSubscription");this.$api=i,this.$plugin=t,this.$router=n,this.$settings=f,this.$toastr=S,this.$translate=w,this.$ws=j}ngOnInit(){return k(this,null,function*(){this.io=this.$ws.connectToNamespace("child-bridges"),this.io.connected.subscribe(()=>k(this,null,function*(){this.getChildBridgeMetadata(),this.io.socket.emit("monitor-child-bridge-status"),yield this.loadInstalledPlugins();let i=this.$router.parseUrl(this.$router.url).queryParams.installed;if(i){let t=this.installedPlugins.find(n=>n.name===i);t&&!t.isConfigured&&this.$plugin.settings(t),this.$router.navigate(["/plugins"])}})),this.io.socket.on("child-bridge-status-update",i=>{let t=this.childBridges.find(n=>n.username===i.username);t?Object.assign(t,i):this.childBridges.push(i)}),this.navigationSubscription=this.$router.events.subscribe(i=>{i instanceof ie&&this.loadInstalledPlugins()})})}loadInstalledPlugins(){return k(this,null,function*(){this.form.setValue({query:""}),this.installedPlugins=[],this.loading=!0;try{let i=yield V(this.$api.get("/plugins"));this.installedPlugins=i.filter(n=>n.name!=="homebridge-config-ui-x"),yield this.appendMetaInfo();let t=this.installedPlugins.sort((n,f)=>n.updateAvailable!==f.updateAvailable?n.updateAvailable?-1:1:n.newHbScope&&!f.newHbScope?-1:n.disabled!==f.disabled?n.disabled?1:-1:n.isConfigured!==f.isConfigured?n.isConfigured?1:-1:n.hasChildBridgesUnpaired!==f.hasChildBridgesUnpaired?n.hasChildBridgesUnpaired?-1:1:n.hasChildBridges!==f.hasChildBridges&&this.$settings.env.recommendChildBridges?n.hasChildBridges?1:-1:n.name.localeCompare(f.name));return this.loading=!1,t}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}appendMetaInfo(){return k(this,null,function*(){yield Promise.all(this.installedPlugins.filter(i=>i.installedVersion).map(i=>k(this,null,function*(){try{let t=yield V(this.$api.get(`/config-editor/plugin/${encodeURIComponent(i.name)}`));i.isConfigured=t.length>0,i.isConfiguredDynamicPlatform=i.isConfigured&&Object.prototype.hasOwnProperty.call(t[0],"platform"),i.recommendChildBridge=i.isConfiguredDynamicPlatform&&this.$settings.env.recommendChildBridges&&this.$settings.env.serviceMode&&!["homebridge","homebridge-config-ui-x"].includes(i.name),i.hasChildBridges=i.isConfigured&&t.some(f=>f._bridge&&f._bridge.username);let n=this.getPluginChildBridges(i);i.hasChildBridgesUnpaired=n.some(f=>!f.paired)}catch{i.isConfigured=!0,i.hasChildBridges=!0}})))})}search(){this.installedPlugins=[],this.loading=!0,this.$api.get(`/plugins/search/${encodeURIComponent(this.form.value.query)}`).subscribe({next:i=>{let t=new Set;this.installedPlugins=i.sort((n,f)=>n.newHbScope&&!f.newHbScope?-1:!n.newHbScope&&f.newHbScope?1:0).reduce((n,f)=>{if(f.name==="homebridge-config-ui-x"||t.has(f.name))return n;if(f.newHbScope){let S=f.newHbScope.to,w=i.some(j=>j.name===S);(f.installedVersion||!w)&&(t.add(S),n.push(f))}else n.push(f);return n},[]).sort((n,f)=>n.installedVersion!==f.installedVersion?n.installedVersion?-1:1:0),this.appendMetaInfo(),this.loading=!1},error:i=>{this.loading=!1,console.error(i),this.$toastr.error(i.error.message||i.message,this.$translate.instant("toast.title_error")),this.loadInstalledPlugins()}})}onClearSearch(){this.form.setValue({query:""}),this.loadInstalledPlugins()}onSubmit({value:i}){i.query.length?this.search():this.loadInstalledPlugins()}getChildBridgeMetadata(){this.io.request("get-homebridge-child-bridge-status").subscribe(i=>{this.childBridges=i})}getPluginChildBridges(i){return this.childBridges.filter(t=>t.plugin===i.name)}ngOnDestroy(){this.navigationSubscription&&this.navigationSubscription.unsubscribe(),this.io.end()}};d(l,"\u0275fac",function(t){return new(t||l)(y(A),y(q),y(te),y(U),y(R),y(H),y(F))}),d(l,"\u0275cmp",T({type:l,selectors:[["ng-component"]],decls:16,vars:11,consts:[[4,"ngIf"],[1,"row","mb-3"],[1,"col-12"],[1,"primary-text","m-0"],[1,"row"],[1,"col-md-12"],["novalidate","",3,"ngSubmit","formGroup"],["type","text","formControlName","query",1,"hb-npm-search",3,"placeholder"],["href","javascript:void(0)",1,"hb-npm-search-clear",3,"click"],["class","far fa-fw fa-times-circle",4,"ngIf"],[1,"d-flex","flex-wrap","justify-content-between"],["class","hb-plugin-space-between",4,"ngFor","ngForOf"],["class","alert alert-info mt-4 text-center w-100",4,"ngIf"],[1,"far","fa-fw","fa-times-circle"],[1,"hb-plugin-space-between"],[3,"plugin","childBridges"],[1,"alert","alert-info","mt-4","text-center","w-100"],[1,"fas","fa-fw","fa-magnifying-glass","primary-text","my-3",2,"font-size","75px"]],template:function(t,n){t&1&&(I(0,ji,1,0,"app-spinner",0),o(1,"div",1)(2,"div",2)(3,"h3",3),_(4),u(5,"translate"),p()()(),o(6,"div",4)(7,"div",5)(8,"form",6),h("ngSubmit",function(){return n.onSubmit(n.form)}),c(9,"input",7),u(10,"translate"),o(11,"a",8),h("click",function(){return n.onClearSearch()}),I(12,Di,1,0,"i",9),p()()()(),o(13,"div",10),I(14,Ni,2,2,"div",11)(15,Hi,5,3,"div",12),p()),t&2&&(s("ngIf",n.loading),r(4),P(m(5,7,"menu.label_plugins")),r(4),s("formGroup",n.form),r(),s("placeholder",m(10,9,"plugins.placeholder_search_plugin")),r(3),s("ngIf",n.form.controls.query.value),r(2),s("ngForOf",n.installedPlugins),r(),s("ngIf",n.installedPlugins.length===0&&!n.loading))},dependencies:[Y,E,de,ae,le,oe,ce,ge,ye,De,M],styles:[".hb-npm-search[_ngcontent-%COMP%]{outline:none;box-sizing:inherit!important;background-color:inherit;height:50px!important;width:100%;border-width:.5px;padding:10px;margin-bottom:15px}@media (hover: hover){.hb-npm-search[_ngcontent-%COMP%]:hover{border:1px solid #000000}}.hb-npm-search[_ngcontent-%COMP%]:focus{border:1px solid #000000;box-shadow:0 1px #000}.hb-npm-search-clear[_ngcontent-%COMP%]{position:absolute;right:25px;font-size:35px;color:#d0d0d0;line-height:50px;cursor:pointer}.hb-plugin-space-between[_ngcontent-%COMP%]{box-sizing:border-box;width:calc(50% - 6.6666666667px)}@media only screen and (max-width: 991px){.hb-plugin-space-between[_ngcontent-%COMP%]{width:100%}}"]}));let e=l;return e})();var Ai=[{path:"",component:Ne}],He=(()=>{let l=class l{};d(l,"\u0275fac",function(t){return new(t||l)}),d(l,"\u0275mod",N({type:l})),d(l,"\u0275inj",D({imports:[O.forChild(Ai),O]}));let e=l;return e})();var wt=(()=>{let l=class l{};d(l,"\u0275fac",function(t){return new(t||l)}),d(l,"\u0275mod",N({type:l})),d(l,"\u0275inj",D({imports:[ee,ue,me,ne.forChild(),Ie,Be,$e,He]}));let e=l;return e})();export{wt as PluginsModule};
@@ -1 +0,0 @@
1
- import{c as de}from"./chunk-V7NUKNPP.js";import{b as pe}from"./chunk-54RIF7BL.js";import{W as ue,Z as le,f as Ke,h as S,k as fe,l as X}from"./chunk-IGUSDGD6.js";var m=Object.create(null);m.open="0";m.close="1";m.ping="2";m.pong="3";m.message="4";m.upgrade="5";m.noop="6";var O=Object.create(null);Object.keys(m).forEach(r=>{O[m[r]]=r});var B={type:"error",data:"parser error"};var ge=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_e=typeof ArrayBuffer=="function",be=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,N=({type:r,data:e},t,s)=>ge&&e instanceof Blob?t?s(e):me(e,s):_e&&(e instanceof ArrayBuffer||be(e))?t?s(e):me(new Blob([e]),s):s(m[r]+(e||"")),me=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function ye(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var Q;function we(r,e){if(ge&&r.data instanceof Blob)return r.data.arrayBuffer().then(ye).then(e);if(_e&&(r.data instanceof ArrayBuffer||be(r.data)))return e(ye(r.data));N(r,!1,t=>{Q||(Q=new TextEncoder),e(Q.encode(t))})}var ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<ke.length;r++)L[ke.charCodeAt(r)]=r;var Ee=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,a,h;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let l=new ArrayBuffer(e),d=new Uint8Array(l);for(s=0;s<t;s+=4)n=L[r.charCodeAt(s)],o=L[r.charCodeAt(s+1)],a=L[r.charCodeAt(s+2)],h=L[r.charCodeAt(s+3)],d[i++]=n<<2|o>>4,d[i++]=(o&15)<<4|a>>2,d[i++]=(a&3)<<6|h&63;return l};var Ye=typeof ArrayBuffer=="function",P=(r,e)=>{if(typeof r!="string")return{type:"message",data:ve(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Je(r.substring(1),e)}:O[t]?r.length>1?{type:O[t],data:r.substring(1)}:{type:O[t]}:B},Je=(r,e)=>{if(Ye){let t=Ee(r);return ve(t,e)}else return{base64:!0,data:r}},ve=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var xe="",Te=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{N(n,!1,a=>{s[o]=a,++i===t&&e(s.join(xe))})})},Ae=(r,e)=>{let t=r.split(xe),s=[];for(let i=0;i<t.length;i++){let n=P(t[i],e);if(s.push(n),n.type==="error")break}return s};function Re(){return new TransformStream({transform(r,e){we(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var j;function V(r){return r.reduce((e,t)=>e+t.length,0)}function M(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Ce(r,e){j||(j=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(V(t)<1)break;let h=M(t,1);n=(h[0]&128)===128,i=h[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(V(t)<2)break;let h=M(t,2);i=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(V(t)<8)break;let h=M(t,8),l=new DataView(h.buffer,h.byteOffset,h.length),d=l.getUint32(0);if(d>Math.pow(2,21)-1){a.enqueue(B);break}i=d*Math.pow(2,32)+l.getUint32(4),s=3}else{if(V(t)<i)break;let h=M(t,i);a.enqueue(P(n?h:j.decode(h),e)),s=0}if(i===0||i>r){a.enqueue(B);break}}}})}var G=4;function f(r){if(r)return $e(r)}function $e(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Se="arraybuffer";function H(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var Qe=1.33;function Oe(r){return typeof r=="string"?je(r):Math.ceil((r.byteLength||r.size)*Qe)}function je(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function W(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Be(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Ne(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var K=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new K(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=P(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Be(e);return t.length?"?"+t:""}};var q=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Ae(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Te(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=W()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Le=!1;try{Le=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Pe=Le;function Ge(){}var Z=class extends q{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},Y=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=H(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ge,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",qe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,qe,!1)}}function qe(){for(let r in Y.requests)Y.requests.hasOwnProperty(r)&&Y.requests[r].abort()}var Ze=function(){let r=De({xdomain:!1});return r&&r.responseType!==null}(),w=class extends Z{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ze&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Y(De,this.uri(),e)}};function De(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Pe))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Fe=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",te=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=Fe?{}:H(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;N(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=W()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},ee=u.WebSocket||u.MozWebSocket,k=class extends te{createSocket(e,t,s){return Fe?new ee(e,t,s):t?new ee(e,t):new ee(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Ce(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Re();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:a,value:h})=>{a||(this.onPacket(h),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var se={websocket:k,webtransport:v,polling:w};var et=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=et.exec(r||""),n={},o=14;for(;o--;)n[tt[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=st(n,n.path),n.queryKey=rt(n,n.query),n}function st(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function rt(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var re=typeof addEventListener=="function"&&typeof removeEventListener=="function",J=[];re&&addEventListener("offline",()=>{J.forEach(r=>r())},!1);var $=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Se,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Ne(this.opts.query)),re&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},J.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=G,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Oe(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),re&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=J.indexOf(this._offlineEventListener);i!==-1&&J.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=G,r})(),z=class extends ${constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;$.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;$.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,d(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function a(){o("transport closed")}function h(){o("socket closed")}function l(b){t&&b.name!==t.name&&n()}let d=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",a),this.off("close",h),this.off("upgrading",l)};t.once("open",i),t.once("error",o),t.once("close",a),this.once("close",h),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>se[i]).filter(i=>!!i)),super(e,s)}};var ms=T.protocol;function Ie(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var he={};Ke(he,{Decoder:()=>ae,Encoder:()=>oe,PacketType:()=>c,protocol:()=>We});var nt=typeof ArrayBuffer=="function",ot=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ue=Object.prototype.toString,at=typeof Blob=="function"||typeof Blob<"u"&&Ue.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ue.call(File)==="[object FileConstructor]";function F(r){return nt&&(r instanceof ArrayBuffer||ot(r))||at&&r instanceof Blob||ct&&r instanceof File}function D(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(D(r[t]))return!0;return!1}if(F(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return D(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&D(r[t]))return!0;return!1}function Ve(r){let e=[],t=r.data,s=r;return s.data=ie(t,e),s.attachments=e.length,{packet:s,buffers:e}}function ie(r,e){if(!r)return r;if(F(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=ie(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=ie(r[s],e));return t}return r}function Me(r,e){return r.data=ne(r.data,e),delete r.attachments,r}function ne(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ne(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ne(r[t],e));return r}var ht=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],We=5,c=function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r}(c||{}),oe=class{constructor(e){this.replacer=e}encode(e){return(e.type===c.EVENT||e.type===c.ACK)&&D(e)?this.encodeAsBinary({type:e.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===c.BINARY_EVENT||e.type===c.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ve(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function He(r){return Object.prototype.toString.call(r)==="[object Object]"}var ae=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===c.BINARY_EVENT;s||t.type===c.BINARY_ACK?(t.type=s?c.EVENT:c.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(F(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(c[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===c.BINARY_EVENT||s.type===c.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case c.CONNECT:return He(t);case c.DISCONNECT:return t===void 0;case c.CONNECT_ERROR:return typeof t=="string"||He(t);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&ht.indexOf(t[0])===-1);case c.ACK:case c.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Me(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function p(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ft=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[p(e,"open",this.onopen.bind(this)),p(e,"packet",this.onpacket.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ft.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:c.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let d=this.ids++,b=t.pop();this._registerAckCallback(d,b),o.id=d}let a=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,h=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},i),o=(...a)=>{this.io.clearTimeoutFn(n),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,a)=>o?i(o):s(a);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:c.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case c.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case c.EVENT:case c.BINARY_EVENT:this.onevent(e);break;case c.ACK:case c.BINARY_ACK:this.onack(e);break;case c.DISCONNECT:this.ondisconnect();break;case c.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:c.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:c.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=Math.floor(e*10)&1?r+t:r-t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||he;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=p(t,"open",function(){s.onopen(),e&&e()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=p(t,"error",n);if(this._timeout!==!1){let a=this._timeout,h=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},a);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(p(e,"ping",this.onping.bind(this)),p(e,"data",this.ondata.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this)),p(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var I={};function U(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Ie(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=I[i]&&n in I[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,h;return a?h=new R(s,e):(I[i]||(I[i]=new R(s,e)),h=I[i]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(U,{Manager:R,Socket:A,io:U,connect:U});var or=(()=>{let e=class e{constructor(s){S(this,"$auth");S(this,"namespaceConnectionCache",{});this.$auth=s}connectToNamespace(s){if(this.namespaceConnectionCache[s]){let i=this.namespaceConnectionCache[s];return i.connected=new X,setTimeout(()=>{i.socket.connected&&i.connected.next(void 0)}),i.socket.on("connect",()=>{i.connected.next(void 0)}),i.end=()=>{i.socket.emit("end"),i.socket.removeAllListeners(),i.connected.complete()},this.namespaceConnectionCache[s]}else{let i=this.establishConnectionToNamespace(s);return i.connected=new X,i.socket.on("connect",()=>{i.connected.next(void 0)}),i.end=()=>{i.socket.emit("end"),i.socket.removeAllListeners(),i.connected.complete()},this.namespaceConnectionCache[s]=i,i}}getExistingNamespace(s){return this.namespaceConnectionCache[s]}establishConnectionToNamespace(s){let i=U(`${pe.api.socket}/${s}`,{query:{token:this.$auth.token}});return{socket:i,request:(o,a)=>new fe(h=>{i.emit(o,a,l=>{typeof l=="object"&&l.error?h.error(l):h.next(l),h.complete()})})}}};S(e,"\u0275fac",function(i){return new(i||e)(le(de))}),S(e,"\u0275prov",ue({token:e,factory:e.\u0275fac,providedIn:"root"}));let r=e;return r})();export{or as a};
@@ -1 +0,0 @@
1
- import{a as I}from"./chunk-2ZL77L5V.js";import"./chunk-GNQUXZMN.js";import"./chunk-THFLPY67.js";import"./chunk-NJRXPLIM.js";import"./chunk-V7NUKNPP.js";import"./chunk-54RIF7BL.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{f as L}from"./chunk-AA4ALV5Q.js";import{a as B}from"./chunk-NJRXPLIM.js";import"./chunk-CMASH2I6.js";import"./chunk-W5QNZH4U.js";import"./chunk-JM7QCDMZ.js";import"./chunk-V7NUKNPP.js";import"./chunk-WCDFKYP6.js";import{c as S,k as T,m as D}from"./chunk-54RIF7BL.js";import{a as _,b as w,c as M}from"./chunk-F22FMU37.js";import{$ as h,$b as E,Ga as y,La as u,Rb as $,Ua as s,Va as a,Wa as v,X as x,aa as g,bb as I,h as i,jb as l,kb as c,sc as k,vc as j,wa as o,xa as m,yb as f,zb as d}from"./chunk-IGUSDGD6.js";function G(e,t){e&1&&(s(0,"p",11),l(1),f(2,"translate"),a()),e&2&&(o(),c(d(2,1,"restart.please_wait_while_server_restarts")))}function H(e,t){if(e&1&&(s(0,"div",12),l(1),a()),e&2){let C=I();o(),c(C.error)}}function J(e,t){e&1&&(s(0,"div",13)(1,"div",14),v(2,"i",15),a()())}function K(e,t){e&1&&(s(0,"div")(1,"div",16),l(2),f(3,"translate"),a()()),e&2&&(o(2),c(d(3,1,"platform.linux.long_time")))}var N=(()=>{let t=class t{constructor(r,n,p,F,z,A){i(this,"$api");i(this,"$router");i(this,"$settings");i(this,"$toastr");i(this,"$translate");i(this,"$ws");i(this,"checkTimeout");i(this,"checkDelay");i(this,"resp",{});i(this,"timeout",!1);i(this,"error",!1);i(this,"io");this.$api=r,this.$router=n,this.$settings=p,this.$toastr=F,this.$translate=z,this.$ws=A}ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch()}),this.$api.put("/platform-tools/linux/restart-host",{}).subscribe({next:r=>{this.resp=r,this.checkIfServerUp()},error:r=>{console.error(r),this.error=this.$translate.instant("platform.linux.server_restart_error"),this.$toastr.error(this.$translate.instant("platform.linux.server_restart_error"),this.$translate.instant("toast.title_error"))}})}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",r=>{(r.status==="up"||r.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.linux.server_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},3e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("platform.linux.server_taking_long_time"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},12e4)}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}};i(t,"\u0275fac",function(n){return new(n||t)(m(S),m(k),m(D),m(T),m(_),m(B))}),i(t,"\u0275cmp",h({type:t,selectors:[["ng-component"]],decls:15,vars:10,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],["class","grey-text",4,"ngIf"],["class","alert alert-error my-4",4,"ngIf"],["class","justify-content-center my-4",4,"ngIf"],[4,"ngIf"],[1,"grey-text"],[1,"alert","alert-error","my-4"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"],[1,"alert","alert-warning","my-4"]],template:function(n,p){n&1&&(s(0,"div",0)(1,"h3",1),l(2),f(3,"translate"),a()(),s(4,"div",2)(5,"div",3),v(6,"i",4),a(),s(7,"div",5)(8,"h4",6),l(9),f(10,"translate"),a(),y(11,G,3,3,"p",7)(12,H,2,1,"div",8)(13,J,3,0,"div",9)(14,K,4,3,"div",10),a()()),n&2&&(o(2),c(d(3,6,"menu.restart.title")),o(7),c(d(10,8,"platform.linux.restarting_server")),o(2),u("ngIf",!p.error),o(),u("ngIf",p.error),o(),u("ngIf",!p.error),o(),u("ngIf",p.timeout))},dependencies:[$,w],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;margin-top:15px}"]}));let e=t;return e})();function Q(e,t){e&1&&(s(0,"p",9),l(1),f(2,"translate"),a()),e&2&&(o(),c(d(2,1,"platform.linux.server_will_power_down")))}function V(e,t){if(e&1&&(s(0,"div",10),l(1),a()),e&2){let C=I();o(),c(C.error)}}var R=(()=>{let t=class t{constructor(r,n,p){i(this,"$api");i(this,"$toastr");i(this,"$translate");i(this,"error",!1);this.$api=r,this.$toastr=n,this.$translate=p}ngOnInit(){this.$api.put("/platform-tools/linux/shutdown-host",{}).subscribe({error:r=>{console.error(r),this.error=this.$translate.instant("platform.linux.server_restart_error"),this.$toastr.error(this.$translate.instant("platform.linux.server_restart_error"),this.$translate.instant("toast.title_error"))}})}};i(t,"\u0275fac",function(n){return new(n||t)(m(S),m(T),m(_))}),i(t,"\u0275cmp",h({type:t,selectors:[["ng-component"]],decls:13,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],["class","grey-text",4,"ngIf"],["class","alert alert-error my-4",4,"ngIf"],[1,"grey-text"],[1,"alert","alert-error","my-4"]],template:function(n,p){n&1&&(s(0,"div",0)(1,"h3",1),l(2),f(3,"translate"),a()(),s(4,"div",2)(5,"div",3),v(6,"i",4),a(),s(7,"div",5)(8,"h4",6),l(9),f(10,"translate"),a(),y(11,Q,3,3,"p",7)(12,V,2,1,"div",8),a()()),n&2&&(o(2),c(d(3,4,"menu.restart.title")),o(7),c(d(10,6,"platform.linux.shutting_down_server")),o(2),u("ngIf",!p.error),o(),u("ngIf",p.error))},dependencies:[$,w],encapsulation:2}));let e=t;return e})();var X=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"restart-server",component:N},{path:"shutdown-server",component:R}],O=(()=>{let t=class t{};i(t,"\u0275fac",function(n){return new(n||t)}),i(t,"\u0275mod",g({type:t})),i(t,"\u0275inj",x({imports:[j.forChild(X),j]}));let e=t;return e})();var gt=(()=>{let t=class t{};i(t,"\u0275fac",function(n){return new(n||t)}),i(t,"\u0275mod",g({type:t})),i(t,"\u0275inj",x({imports:[E,M.forChild(),L,O]}));let e=t;return e})();export{gt as LinuxModule};
@@ -1 +0,0 @@
1
- import{c as h}from"./chunk-V7NUKNPP.js";import{k as u}from"./chunk-54RIF7BL.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{f as Se}from"./chunk-AA4ALV5Q.js";import{b as ye}from"./chunk-CMASH2I6.js";import"./chunk-W5QNZH4U.js";import"./chunk-JM7QCDMZ.js";import{c as H}from"./chunk-V7NUKNPP.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-54RIF7BL.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,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{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};
@@ -1 +0,0 @@
1
- import{a as R,b as K}from"./chunk-EEAGROCO.js";import"./chunk-GNQUXZMN.js";import"./chunk-THFLPY67.js";import"./chunk-NJRXPLIM.js";import{a as I}from"./chunk-JM7QCDMZ.js";import"./chunk-V7NUKNPP.js";import{N as Q,O as q,Q as O}from"./chunk-WCDFKYP6.js";import{c as D,k as H}from"./chunk-54RIF7BL.js";import{a as E,b as F,c as V}from"./chunk-F22FMU37.js";import{$ as x,$b as N,Ka as y,La as $,Ua as p,Va as d,Wa as b,X as f,Za as S,aa as u,ab as h,fb as j,g as G,gb as B,h as i,ha as w,hb as k,i as C,ia as v,jb as z,kb as M,l as T,va as L,vc as _,wa as g,xa as a,yb as l,zb as c}from"./chunk-IGUSDGD6.js";var A=G(K(),1);var U=["logoutput"],J=(()=>{let t=class t{constructor(o,e,r,s,m){i(this,"$api");i(this,"$log");i(this,"$modal");i(this,"$toastr");i(this,"$translate");i(this,"termTarget");i(this,"resizeEvent",new T);this.$api=o,this.$log=e,this.$modal=r,this.$toastr=s,this.$translate=m}onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){window.document.querySelector("body").classList.add("bg-black"),this.$log.startTerminal(this.termTarget,{},this.resizeEvent)}ngOnDestroy(){window.document.querySelector("body").classList.remove("bg-black"),this.$log.destroyTerminal()}downloadLogFile(){let o=this.$modal.open(I,{size:"lg",backdrop:"static"});o.componentInstance.title=this.$translate.instant("logs.title_download_log_file"),o.componentInstance.message=this.$translate.instant("logs.download_warning"),o.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_download"),o.componentInstance.faIconClass="fas fa-fw fa-user-secret primary-text",o.result.then(()=>{this.$api.get("/platform-tools/hb-service/log/download",{observe:"response",responseType:"blob"}).subscribe({next:e=>{(0,A.saveAs)(e.body,"homebridge.log.txt")},error:e=>C(this,null,function*(){let r;try{r=JSON.parse(yield e.error.text()).message}catch(s){console.error(s)}this.$toastr.error(r||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error"))})})}).catch(()=>{})}truncateLogFile(){let o=this.$modal.open(I,{size:"lg",backdrop:"static"});o.componentInstance.title=this.$translate.instant("logs.title_truncate_log_file"),o.componentInstance.message=this.$translate.instant("logs.truncate_log_warning"),o.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_delete"),o.componentInstance.confirmButtonClass="btn-danger",o.componentInstance.faIconClass="fas fa-fw fa-circle-exclamation primary-text",o.result.then(()=>{this.$api.put("/platform-tools/hb-service/log/truncate",{}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("logs.log_file_truncated"),this.$translate.instant("toast.title_success")),this.$log.term.clear()},error:e=>{console.error(e),this.$toastr.error(e.error.message||this.$translate.instant("logs.truncate.error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}};i(t,"\u0275fac",function(e){return new(e||t)(a(D),a(R),a(Q),a(H),a(E))}),i(t,"\u0275cmp",x({type:t,selectors:[["ng-component"]],viewQuery:function(e,r){if(e&1&&j(U,7),e&2){let s;B(s=k())&&(r.termTarget=s.first)}},hostBindings:function(e,r){e&1&&h("resize",function(m){return r.onWindowResize(m)},!1,L)},decls:17,vars:15,consts:[["logoutput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-right"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0",3,"click","ngbTooltip"],[1,"fas","fa-fw","fa-download"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","mr-0",3,"click","ngbTooltip"],[1,"fas","fa-fw","fa-trash-alt"],[1,"flex-column","d-flex","align-items-stretch","adjust-for-mobile"],["id","log-output",1,"align-self-end","w-100","h-100","mb-1"]],template:function(e,r){if(e&1){let s=S();p(0,"div",1)(1,"div",2)(2,"h3",3),z(3),l(4,"translate"),d()(),p(5,"div",4)(6,"button",5),l(7,"translate"),l(8,"translate"),h("click",function(){return w(s),v(r.downloadLogFile())}),b(9,"i",6),d(),p(10,"button",7),l(11,"translate"),l(12,"translate"),h("click",function(){return w(s),v(r.truncateLogFile())}),b(13,"i",8),d()()(),p(14,"div",9),b(15,"div",10,0),d()}e&2&&(g(3),M(c(4,5,"menu.linux.label_logs")),g(3),$("ngbTooltip",c(7,7,"form.button_download")),y("aria-label",c(8,9,"form.button_download")),g(4),$("ngbTooltip",c(11,11,"form.button_delete")),y("aria-label",c(12,13,"form.button_delete")))},dependencies:[q,F],encapsulation:2}));let n=t;return n})();var X=[{path:"",component:J}],P=(()=>{let t=class t{};i(t,"\u0275fac",function(e){return new(e||t)}),i(t,"\u0275mod",u({type:t})),i(t,"\u0275inj",f({imports:[_.forChild(X),_]}));let n=t;return n})();var ht=(()=>{let t=class t{};i(t,"\u0275fac",function(e){return new(e||t)}),i(t,"\u0275mod",u({type:t})),i(t,"\u0275inj",f({imports:[N,P,O,V.forChild()]}));let n=t;return n})();export{ht as LogsModule};
@@ -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-W5QNZH4U.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-54RIF7BL.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{a as H,b as h,c as $,m as S}from"./chunk-54RIF7BL.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{M as R}from"./chunk-WCDFKYP6.js";import{c as y,k as I}from"./chunk-54RIF7BL.js";import{a as x,b as k}from"./chunk-F22FMU37.js";import{$,Ka as v,Ua as e,Va as c,Wa as b,ab as u,h as t,jb as p,kb as _,lb as h,sc as g,wa as i,xa as l,yb as r,zb as a}from"./chunk-IGUSDGD6.js";var D=(()=>{let n=class n{constructor(o,s,d,m,S){t(this,"$activeModal");t(this,"$api");t(this,"$router");t(this,"$toastr");t(this,"$translate");t(this,"fullRestart",!1);this.$activeModal=o,this.$api=s,this.$router=d,this.$toastr=m,this.$translate=S}onRestartHomebridgeClick(){if(!this.fullRestart){this.$router.navigate(["/restart"]),this.$activeModal.close();return}this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$router.navigate(["/restart"]),this.$activeModal.close()},error:o=>{console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}})}};t(n,"\u0275fac",function(s){return new(s||n)(l(R),l(y),l(g),l(I),l(x))}),t(n,"\u0275cmp",$({type:n,selectors:[["ng-component"]],inputs:{fullRestart:"fullRestart"},decls:25,vars:18,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"],[1,"fas","fa-fw","fa-power-off","primary-text","mb-4",2,"font-size","75px"],[1,"w-100"],[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",1,"btn","btn-primary",3,"click"]],template:function(s,d){s&1&&(e(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),c(),e(5,"button",3),r(6,"translate"),u("click",function(){return d.$activeModal.dismiss("Dismiss")}),e(7,"span",4),p(8,"\xD7"),c()()(),e(9,"div",5),b(10,"i",6),e(11,"p",7),p(12),r(13,"translate"),c()(),e(14,"div",8)(15,"div",9)(16,"button",10),r(17,"translate"),u("click",function(){return d.$activeModal.dismiss("Dismiss")}),p(18),r(19,"translate"),c()(),b(20,"div",11),e(21,"div",12)(22,"button",13),u("click",function(){return d.onRestartHomebridgeClick()}),p(23),r(24,"translate"),c()()()()),s&2&&(i(3),_(a(4,6,"platform.version.service_restart_required")),i(2),v("aria-label",a(6,8,"form.button_close")),i(7),_(a(13,10,"restart.homebridge")),i(4),v("aria-label",a(17,12,"form.button_close")),i(2),h(" ",a(19,14,"form.button_close")," "),i(5),h(" ",a(24,16,"menu.tooltip_restart")," "))},dependencies:[k],encapsulation:2}));let f=n;return f})();export{D as a};