homebridge-config-ui-x 5.0.0-beta.108 → 5.0.0-beta.109

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 (78) hide show
  1. package/dist/modules/plugins/plugins.controller.d.ts +0 -3
  2. package/dist/modules/plugins/plugins.service.d.ts +0 -3
  3. package/dist/modules/plugins/plugins.service.js +18 -12
  4. package/dist/modules/plugins/plugins.service.js.map +1 -1
  5. package/package.json +1 -1
  6. package/public/{chunk-ANF56WI2.js → chunk-2GPRJBZK.js} +1 -1
  7. package/public/{chunk-TO7LPEK2.js → chunk-2NNPFQSV.js} +1 -1
  8. package/public/{chunk-MPLPCXYW.js → chunk-2ZECJ2DO.js} +4 -4
  9. package/public/{chunk-KKDWUX5G.js → chunk-3IVOEORN.js} +1 -1
  10. package/public/chunk-3JX5ASJY.js +1 -0
  11. package/public/{chunk-JVXQYOED.js → chunk-444NZJ32.js} +1 -1
  12. package/public/{chunk-777K5E5F.js → chunk-63C6KVNP.js} +2 -2
  13. package/public/{chunk-4HQPK3XV.js → chunk-66T6GFBZ.js} +1 -1
  14. package/public/chunk-AVLFOHZI.js +1 -0
  15. package/public/{chunk-W4EMJRZC.js → chunk-B6DB2WG3.js} +1 -1
  16. package/public/{chunk-LBKDR2SS.js → chunk-BCCH6VNZ.js} +1 -1
  17. package/public/{chunk-FDQVRFVX.js → chunk-CCNLFQFV.js} +1 -1
  18. package/public/{chunk-DONTWOO5.js → chunk-CHNQKTGM.js} +1 -1
  19. package/public/{chunk-DEB6KHZN.js → chunk-CHUATMG6.js} +1 -1
  20. package/public/{chunk-GEBBOSXZ.js → chunk-CXGBIDKJ.js} +1 -1
  21. package/public/chunk-D6GQVCXN.js +1 -0
  22. package/public/chunk-DAORKIFV.js +1 -0
  23. package/public/{chunk-I5W3MOSN.js → chunk-DIYNI3AR.js} +1 -1
  24. package/public/{chunk-W2ON3QML.js → chunk-DLMCB7T3.js} +1 -1
  25. package/public/{chunk-XBYP3ZGU.js → chunk-DOJEFNWN.js} +1 -1
  26. package/public/{chunk-WMYBQUQ5.js → chunk-E33KIDKB.js} +1 -1
  27. package/public/{chunk-UK36HUJK.js → chunk-E6HXEWNE.js} +1 -1
  28. package/public/chunk-EFQHWCNL.js +1 -0
  29. package/public/{chunk-B4YIJPX7.js → chunk-FESKQ76G.js} +1 -1
  30. package/public/{chunk-ALBES4KB.js → chunk-FGMYYOEF.js} +1 -1
  31. package/public/{chunk-DPV75EPV.js → chunk-GRXECLWT.js} +1 -1
  32. package/public/{chunk-WT5EPL2L.js → chunk-HAEFO6CP.js} +1 -1
  33. package/public/{chunk-SWANJZES.js → chunk-HKVAKRRW.js} +1 -1
  34. package/public/{chunk-BQZV3CQP.js → chunk-IQWHHQGN.js} +1 -1
  35. package/public/chunk-IY3MMPXW.js +1 -0
  36. package/public/{chunk-T3FDH3Z3.js → chunk-JATX7XTF.js} +1 -1
  37. package/public/{chunk-NTN3W7TQ.js → chunk-JEAHR6BR.js} +1 -1
  38. package/public/{chunk-6VVYFBUL.js → chunk-K4KILPYW.js} +1 -1
  39. package/public/{chunk-25RDMF7D.js → chunk-L3PBGNBT.js} +1 -1
  40. package/public/chunk-LCB4GSNV.js +1 -0
  41. package/public/{chunk-WWKMQQI2.js → chunk-LELQ2KQK.js} +1 -1
  42. package/public/chunk-LI4I5553.js +1 -0
  43. package/public/{chunk-GRDIIOJ6.js → chunk-LSEGTS3V.js} +1 -1
  44. package/public/{chunk-JG6T53WP.js → chunk-M2QRJPKP.js} +1 -1
  45. package/public/{chunk-JJ4WQ6NE.js → chunk-OCCLR6IO.js} +1 -1
  46. package/public/chunk-P6TCVLHZ.js +1 -0
  47. package/public/{chunk-2TK5SJVS.js → chunk-Q2VYGYQN.js} +1 -1
  48. package/public/{chunk-6CGMROX6.js → chunk-QHOXPUZT.js} +1 -1
  49. package/public/{chunk-ETJU5IRU.js → chunk-RM4COTJV.js} +1 -1
  50. package/public/{chunk-LAYU6YBF.js → chunk-S7K3KKP2.js} +1 -1
  51. package/public/{chunk-GHOGQOBE.js → chunk-SLIKAKB2.js} +1 -1
  52. package/public/chunk-SVFNYTAU.js +1 -0
  53. package/public/{chunk-ST2JPLMI.js → chunk-TIGWXXF3.js} +1 -1
  54. package/public/{chunk-QC5CHU3Z.js → chunk-UJB4JYYU.js} +1 -1
  55. package/public/{chunk-ITNKDOMR.js → chunk-VOMSD4S7.js} +1 -1
  56. package/public/{chunk-E6DP75ED.js → chunk-W7FVGVGW.js} +1 -1
  57. package/public/chunk-WSTSQ7H2.js +1 -0
  58. package/public/{chunk-YYLB4D7X.js → chunk-Y3EVAO4R.js} +1 -1
  59. package/public/{chunk-X4YOZBUA.js → chunk-Y5PTMFDA.js} +1 -1
  60. package/public/{chunk-UQPEA2L3.js → chunk-Y7U2ZGBX.js} +1 -1
  61. package/public/chunk-YBMB733B.js +1 -0
  62. package/public/chunk-YTLNKHFD.js +1 -0
  63. package/public/{chunk-VNEXZSVV.js → chunk-ZGN5ILO6.js} +1 -1
  64. package/public/index.html +1 -1
  65. package/public/{main-3FD3MI4V.js → main-R5JGFTGJ.js} +1 -1
  66. package/public/chunk-45DGJYU4.js +0 -1
  67. package/public/chunk-ADFN5XBP.js +0 -1
  68. package/public/chunk-AQCMCVCZ.js +0 -1
  69. package/public/chunk-BL6KJQB2.js +0 -1
  70. package/public/chunk-E3LLCX6Y.js +0 -1
  71. package/public/chunk-EWZTKW5G.js +0 -1
  72. package/public/chunk-IOKPSUWJ.js +0 -1
  73. package/public/chunk-JGGBOT6M.js +0 -1
  74. package/public/chunk-MORI4RRK.js +0 -1
  75. package/public/chunk-O3ZBSHXK.js +0 -1
  76. package/public/chunk-OO6DDCX4.js +0 -1
  77. package/public/chunk-TPTDBOC4.js +0 -1
  78. package/public/chunk-WQBSPGB4.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as pu,b as nb}from"./chunk-6XANA56B.js";import{a as M1}from"./chunk-WTTWP6KF.js";import{a as Xr,b as Yr}from"./chunk-QJQSHTGR.js";import{a as N1}from"./chunk-S6UXXPGF.js";import{a as L1}from"./chunk-XBYP3ZGU.js";import{a as ff}from"./chunk-SWUH5RAT.js";import{a as V1,b as R1}from"./chunk-M5VWLNY3.js";import{a as q1}from"./chunk-J764EFYE.js";import{a as Jr}from"./chunk-SCRWY2OT.js";import{a as j1}from"./chunk-IMPGSXGE.js";import{a as zr,b as Ur,c as Hr,d as Wr,e as Kr,f as Gr,g as cu,m as Ae,n as it,o as $1,p as k1,q as T1,r as P1,s as O1,t as en}from"./chunk-2NQ5FYSH.js";import{A as nf,a as y1,b as Xu,c as Zi,e as vt,f as v1,h as B1,i as x1,j as w1,k as S1,l as Yu,m as I1,o as Zu,r as Qi,s as wi,t as Si,y as A1,z as uu}from"./chunk-5NG7YGKN.js";import{d as Ut}from"./chunk-JBQX4JBH.js";import{a as ei}from"./chunk-JJ4WQ6NE.js";import{b as Le}from"./chunk-WMYBQUQ5.js";import{k as _e,m as Qu,n as be}from"./chunk-DPV75EPV.js";import{e as _1}from"./chunk-EM4PY2IW.js";import{a as Ee,b as $e}from"./chunk-555LSHXI.js";import{$a as l,Ac as y,Bc as B,Ca as Uu,Cc as He,D as o1,Da as l1,Fa as Hu,Gb as G,Hb as w,Ib as S,Jc as gt,Kb as nt,Kc as U,Lb as ft,Lc as Ju,M as Gi,Mb as rt,Nb as b,Nc as b1,Ob as c,Pb as p,Qb as x,Rb as m1,Sb as F1,Ub as H,Xa as me,Xb as M,Yb as h,Z as os,_a as d1,a as X,aa as uf,ac as as,b as xe,bc as ss,bd as zt,cc as Ds,cd as xi,dc as Wu,dd as bt,e as F,eb as qr,ec as Ku,fa as a1,fb as vu,fc as C1,g as Re,ga as Ot,gc as eu,h as K,ha as Ji,hb as yi,hc as Gu,ic as Z,ja as s1,jc as E,k as i1,ka as D1,kc as L,kd as Lr,la as I,lb as Y,lc as q,mb as Xi,mc as vi,n as Pt,nb as Bu,nc as Rr,o as rs,ob as c1,q as n1,qc as Pe,ra as j,rb as se,rc as Oe,sa as N,sc as Me,sd as E1,tb as p1,tc as h1,ub as Vr,uc as g1,v as f1,vc as we,w as re,wc as tu,x as r1,xc as Bi,yc as xu,za as Nr,zc as Yi}from"./chunk-W6X46MTW.js";var af=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.regexpCode=ge.getEsmExportName=ge.getProperty=ge.safeStringify=ge.stringify=ge.strConcat=ge.addCodeArg=ge.str=ge._=ge.nil=ge._Code=ge.Name=ge.IDENTIFIER=ge._CodeOrName=void 0;var rf=class{};ge._CodeOrName=rf;ge.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ii=class extends rf{constructor(u){if(super(),!ge.IDENTIFIER.test(u))throw new Error("CodeGen: name must be a valid identifier");this.str=u}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ge.Name=Ii;var Ht=class extends rf{constructor(u){super(),this._items=typeof u=="string"?[u]:u}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let u=this._items[0];return u===""||u==='""'}get str(){var u;return(u=this._str)!==null&&u!==void 0?u:this._str=this._items.reduce((t,i)=>`${t}${i}`,"")}get names(){var u;return(u=this._names)!==null&&u!==void 0?u:this._names=this._items.reduce((t,i)=>(i instanceof Ii&&(t[i.str]=(t[i.str]||0)+1),t),{})}};ge._Code=Ht;ge.nil=new Ht("");function z1(e,...u){let t=[e[0]],i=0;for(;i<u.length;)ds(t,u[i]),t.push(e[++i]);return new Ht(t)}ge._=z1;var ls=new Ht("+");function U1(e,...u){let t=[of(e[0])],i=0;for(;i<u.length;)t.push(ls),ds(t,u[i]),t.push(ls,of(e[++i]));return rb(t),new Ht(t)}ge.str=U1;function ds(e,u){u instanceof Ht?e.push(...u._items):u instanceof Ii?e.push(u):e.push(sb(u))}ge.addCodeArg=ds;function rb(e){let u=1;for(;u<e.length-1;){if(e[u]===ls){let t=ob(e[u-1],e[u+1]);if(t!==void 0){e.splice(u-1,3,t);continue}e[u++]="+"}u++}}function ob(e,u){if(u==='""')return e;if(e==='""')return u;if(typeof e=="string")return u instanceof Ii||e[e.length-1]!=='"'?void 0:typeof u!="string"?`${e.slice(0,-1)}${u}"`:u[0]==='"'?e.slice(0,-1)+u.slice(1):void 0;if(typeof u=="string"&&u[0]==='"'&&!(e instanceof Ii))return`"${e}${u.slice(1)}`}function ab(e,u){return u.emptyStr()?e:e.emptyStr()?u:U1`${e}${u}`}ge.strConcat=ab;function sb(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:of(Array.isArray(e)?e.join(","):e)}function Db(e){return new Ht(of(e))}ge.stringify=Db;function of(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ge.safeStringify=of;function lb(e){return typeof e=="string"&&ge.IDENTIFIER.test(e)?new Ht(`.${e}`):z1`[${e}]`}ge.getProperty=lb;function db(e){if(typeof e=="string"&&ge.IDENTIFIER.test(e))return new Ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ge.getEsmExportName=db;function cb(e){return new Ht(e.toString())}ge.regexpCode=cb});var ms=F(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.ValueScope=xt.ValueScopeName=xt.Scope=xt.varKinds=xt.UsedValueState=void 0;var Bt=af(),cs=class extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}},Zr=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(Zr||(xt.UsedValueState=Zr={}));xt.varKinds={const:new Bt.Name("const"),let:new Bt.Name("let"),var:new Bt.Name("var")};var Qr=class{constructor({prefixes:u,parent:t}={}){this._names={},this._prefixes=u,this._parent=t}toName(u){return u instanceof Bt.Name?u:this.name(u)}name(u){return new Bt.Name(this._newName(u))}_newName(u){let t=this._names[u]||this._nameGroup(u);return`${u}${t.index++}`}_nameGroup(u){var t,i;if(!((i=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||i===void 0)&&i.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}};xt.Scope=Qr;var eo=class extends Bt.Name{constructor(u,t){super(t),this.prefix=u}setValue(u,{property:t,itemIndex:i}){this.value=u,this.scopePath=(0,Bt._)`.${new Bt.Name(t)}[${i}]`}};xt.ValueScopeName=eo;var pb=(0,Bt._)`\n`,ps=class extends Qr{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts=xe(X({},u),{_n:u.lines?pb:Bt.nil})}get(){return this._scope}name(u){return new eo(u,this._newName(u))}value(u,t){var i;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(u),{prefix:f}=n,r=(i=t.key)!==null&&i!==void 0?i:t.ref,o=this._values[f];if(o){let D=o.get(r);if(D)return D}else o=this._values[f]=new Map;o.set(r,n);let a=this._scope[f]||(this._scope[f]=[]),s=a.length;return a[s]=t.ref,n.setValue(t,{property:f,itemIndex:s}),n}getValue(u,t){let i=this._values[u];if(i)return i.get(t)}scopeRefs(u,t=this._values){return this._reduceValues(t,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,Bt._)`${u}${i.scopePath}`})}scopeCode(u=this._values,t,i){return this._reduceValues(u,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,i)}_reduceValues(u,t,i={},n){let f=Bt.nil;for(let r in u){let o=u[r];if(!o)continue;let a=i[r]=i[r]||new Map;o.forEach(s=>{if(a.has(s))return;a.set(s,Zr.Started);let D=t(s);if(D){let d=this.opts.es5?xt.varKinds.var:xt.varKinds.const;f=(0,Bt._)`${f}${d} ${s} = ${D};${this.opts._n}`}else if(D=n?.(s))f=(0,Bt._)`${f}${D}${this.opts._n}`;else throw new cs(s);a.set(s,Zr.Completed)})}return f}};xt.ValueScope=ps});var ee=F(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.or=De.and=De.not=De.CodeGen=De.operators=De.varKinds=De.ValueScopeName=De.ValueScope=De.Scope=De.Name=De.regexpCode=De.stringify=De.getProperty=De.nil=De.strConcat=De.str=De._=void 0;var Fe=af(),iu=ms(),ti=af();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return ti._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return ti.str}});Object.defineProperty(De,"strConcat",{enumerable:!0,get:function(){return ti.strConcat}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return ti.nil}});Object.defineProperty(De,"getProperty",{enumerable:!0,get:function(){return ti.getProperty}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return ti.stringify}});Object.defineProperty(De,"regexpCode",{enumerable:!0,get:function(){return ti.regexpCode}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return ti.Name}});var fo=ms();Object.defineProperty(De,"Scope",{enumerable:!0,get:function(){return fo.Scope}});Object.defineProperty(De,"ValueScope",{enumerable:!0,get:function(){return fo.ValueScope}});Object.defineProperty(De,"ValueScopeName",{enumerable:!0,get:function(){return fo.ValueScopeName}});Object.defineProperty(De,"varKinds",{enumerable:!0,get:function(){return fo.varKinds}});De.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var wu=class{optimizeNodes(){return this}optimizeNames(u,t){return this}},Fs=class extends wu{constructor(u,t,i){super(),this.varKind=u,this.name=t,this.rhs=i}render({es5:u,_n:t}){let i=u?iu.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+t}optimizeNames(u,t){if(u[this.name.str])return this.rhs&&(this.rhs=un(this.rhs,u,t)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},uo=class extends wu{constructor(u,t,i){super(),this.lhs=u,this.rhs=t,this.sideEffects=i}render({_n:u}){return`${this.lhs} = ${this.rhs};`+u}optimizeNames(u,t){if(!(this.lhs instanceof Fe.Name&&!u[this.lhs.str]&&!this.sideEffects))return this.rhs=un(this.rhs,u,t),this}get names(){let u=this.lhs instanceof Fe.Name?{}:X({},this.lhs.names);return no(u,this.rhs)}},Cs=class extends uo{constructor(u,t,i,n){super(u,i,n),this.op=t}render({_n:u}){return`${this.lhs} ${this.op}= ${this.rhs};`+u}},hs=class extends wu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`${this.label}:`+u}},gs=class extends wu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`break${this.label?` ${this.label}`:""};`+u}},bs=class extends wu{constructor(u){super(),this.error=u}render({_n:u}){return`throw ${this.error};`+u}get names(){return this.error.names}},Es=class extends wu{constructor(u){super(),this.code=u}render({_n:u}){return`${this.code};`+u}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(u,t){return this.code=un(this.code,u,t),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},sf=class extends wu{constructor(u=[]){super(),this.nodes=u}render(u){return this.nodes.reduce((t,i)=>t+i.render(u),"")}optimizeNodes(){let{nodes:u}=this,t=u.length;for(;t--;){let i=u[t].optimizeNodes();Array.isArray(i)?u.splice(t,1,...i):i?u[t]=i:u.splice(t,1)}return u.length>0?this:void 0}optimizeNames(u,t){let{nodes:i}=this,n=i.length;for(;n--;){let f=i[n];f.optimizeNames(u,t)||(mb(u,f.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((u,t)=>Ai(u,t.names),{})}},Su=class extends sf{render(u){return"{"+u._n+super.render(u)+"}"+u._n}},_s=class extends sf{},ys=(()=>{class e extends Su{}return e.kind="else",e})(),to=(()=>{class e extends Su{constructor(t,i){super(i),this.condition=t}render(t){let i=`if(${this.condition})`+super.render(t);return this.else&&(i+="else "+this.else.render(t)),i}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let i=this.else;if(i){let n=i.optimizeNodes();i=this.else=Array.isArray(n)?new ys(n):n}if(i)return t===!1?i instanceof e?i:i.nodes:this.nodes.length?this:new e(J1(t),i instanceof e?[i]:i.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,i){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,i),!!(super.optimizeNames(t,i)||this.else))return this.condition=un(this.condition,t,i),this}get names(){let t=super.names;return no(t,this.condition),this.else&&Ai(t,this.else.names),t}}return e.kind="if",e})(),ro=(()=>{class e extends Su{}return e.kind="for",e})(),vs=class extends ro{constructor(u){super(),this.iteration=u}render(u){return`for(${this.iteration})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iteration=un(this.iteration,u,t),this}get names(){return Ai(super.names,this.iteration.names)}},Bs=class extends ro{constructor(u,t,i,n){super(),this.varKind=u,this.name=t,this.from=i,this.to=n}render(u){let t=u.es5?iu.varKinds.var:this.varKind,{name:i,from:n,to:f}=this;return`for(${t} ${i}=${n}; ${i}<${f}; ${i}++)`+super.render(u)}get names(){let u=no(super.names,this.from);return no(u,this.to)}},io=class extends ro{constructor(u,t,i,n){super(),this.loop=u,this.varKind=t,this.name=i,this.iterable=n}render(u){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iterable=un(this.iterable,u,t),this}get names(){return Ai(super.names,this.iterable.names)}},H1=(()=>{class e extends Su{constructor(t,i,n){super(),this.name=t,this.args=i,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),W1=(()=>{class e extends sf{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),xs=class extends Su{render(u){let t="try"+super.render(u);return this.catch&&(t+=this.catch.render(u)),this.finally&&(t+=this.finally.render(u)),t}optimizeNodes(){var u,t;return super.optimizeNodes(),(u=this.catch)===null||u===void 0||u.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(u,t){var i,n;return super.optimizeNames(u,t),(i=this.catch)===null||i===void 0||i.optimizeNames(u,t),(n=this.finally)===null||n===void 0||n.optimizeNames(u,t),this}get names(){let u=super.names;return this.catch&&Ai(u,this.catch.names),this.finally&&Ai(u,this.finally.names),u}},K1=(()=>{class e extends Su{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),G1=(()=>{class e extends Su{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),ws=class{constructor(u,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=xe(X({},t),{_n:t.lines?`
1
+ import{a as pu,b as nb}from"./chunk-6XANA56B.js";import{a as M1}from"./chunk-WTTWP6KF.js";import{a as Xr,b as Yr}from"./chunk-QJQSHTGR.js";import{a as N1}from"./chunk-S6UXXPGF.js";import{a as L1}from"./chunk-DOJEFNWN.js";import{a as ff}from"./chunk-SWUH5RAT.js";import{a as V1,b as R1}from"./chunk-M5VWLNY3.js";import{a as q1}from"./chunk-J764EFYE.js";import{a as Jr}from"./chunk-SCRWY2OT.js";import{a as j1}from"./chunk-IMPGSXGE.js";import{a as zr,b as Ur,c as Hr,d as Wr,e as Kr,f as Gr,g as cu,m as Ae,n as it,o as $1,p as k1,q as T1,r as P1,s as O1,t as en}from"./chunk-2NQ5FYSH.js";import{A as nf,a as y1,b as Xu,c as Zi,e as vt,f as v1,h as B1,i as x1,j as w1,k as S1,l as Yu,m as I1,o as Zu,r as Qi,s as wi,t as Si,y as A1,z as uu}from"./chunk-5NG7YGKN.js";import{d as Ut}from"./chunk-JBQX4JBH.js";import{a as ei}from"./chunk-OCCLR6IO.js";import{b as Le}from"./chunk-E33KIDKB.js";import{k as _e,m as Qu,n as be}from"./chunk-GRXECLWT.js";import{e as _1}from"./chunk-EM4PY2IW.js";import{a as Ee,b as $e}from"./chunk-555LSHXI.js";import{$a as l,Ac as y,Bc as B,Ca as Uu,Cc as He,D as o1,Da as l1,Fa as Hu,Gb as G,Hb as w,Ib as S,Jc as gt,Kb as nt,Kc as U,Lb as ft,Lc as Ju,M as Gi,Mb as rt,Nb as b,Nc as b1,Ob as c,Pb as p,Qb as x,Rb as m1,Sb as F1,Ub as H,Xa as me,Xb as M,Yb as h,Z as os,_a as d1,a as X,aa as uf,ac as as,b as xe,bc as ss,bd as zt,cc as Ds,cd as xi,dc as Wu,dd as bt,e as F,eb as qr,ec as Ku,fa as a1,fb as vu,fc as C1,g as Re,ga as Ot,gc as eu,h as K,ha as Ji,hb as yi,hc as Gu,ic as Z,ja as s1,jc as E,k as i1,ka as D1,kc as L,kd as Lr,la as I,lb as Y,lc as q,mb as Xi,mc as vi,n as Pt,nb as Bu,nc as Rr,o as rs,ob as c1,q as n1,qc as Pe,ra as j,rb as se,rc as Oe,sa as N,sc as Me,sd as E1,tb as p1,tc as h1,ub as Vr,uc as g1,v as f1,vc as we,w as re,wc as tu,x as r1,xc as Bi,yc as xu,za as Nr,zc as Yi}from"./chunk-W6X46MTW.js";var af=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.regexpCode=ge.getEsmExportName=ge.getProperty=ge.safeStringify=ge.stringify=ge.strConcat=ge.addCodeArg=ge.str=ge._=ge.nil=ge._Code=ge.Name=ge.IDENTIFIER=ge._CodeOrName=void 0;var rf=class{};ge._CodeOrName=rf;ge.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ii=class extends rf{constructor(u){if(super(),!ge.IDENTIFIER.test(u))throw new Error("CodeGen: name must be a valid identifier");this.str=u}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ge.Name=Ii;var Ht=class extends rf{constructor(u){super(),this._items=typeof u=="string"?[u]:u}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let u=this._items[0];return u===""||u==='""'}get str(){var u;return(u=this._str)!==null&&u!==void 0?u:this._str=this._items.reduce((t,i)=>`${t}${i}`,"")}get names(){var u;return(u=this._names)!==null&&u!==void 0?u:this._names=this._items.reduce((t,i)=>(i instanceof Ii&&(t[i.str]=(t[i.str]||0)+1),t),{})}};ge._Code=Ht;ge.nil=new Ht("");function z1(e,...u){let t=[e[0]],i=0;for(;i<u.length;)ds(t,u[i]),t.push(e[++i]);return new Ht(t)}ge._=z1;var ls=new Ht("+");function U1(e,...u){let t=[of(e[0])],i=0;for(;i<u.length;)t.push(ls),ds(t,u[i]),t.push(ls,of(e[++i]));return rb(t),new Ht(t)}ge.str=U1;function ds(e,u){u instanceof Ht?e.push(...u._items):u instanceof Ii?e.push(u):e.push(sb(u))}ge.addCodeArg=ds;function rb(e){let u=1;for(;u<e.length-1;){if(e[u]===ls){let t=ob(e[u-1],e[u+1]);if(t!==void 0){e.splice(u-1,3,t);continue}e[u++]="+"}u++}}function ob(e,u){if(u==='""')return e;if(e==='""')return u;if(typeof e=="string")return u instanceof Ii||e[e.length-1]!=='"'?void 0:typeof u!="string"?`${e.slice(0,-1)}${u}"`:u[0]==='"'?e.slice(0,-1)+u.slice(1):void 0;if(typeof u=="string"&&u[0]==='"'&&!(e instanceof Ii))return`"${e}${u.slice(1)}`}function ab(e,u){return u.emptyStr()?e:e.emptyStr()?u:U1`${e}${u}`}ge.strConcat=ab;function sb(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:of(Array.isArray(e)?e.join(","):e)}function Db(e){return new Ht(of(e))}ge.stringify=Db;function of(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ge.safeStringify=of;function lb(e){return typeof e=="string"&&ge.IDENTIFIER.test(e)?new Ht(`.${e}`):z1`[${e}]`}ge.getProperty=lb;function db(e){if(typeof e=="string"&&ge.IDENTIFIER.test(e))return new Ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ge.getEsmExportName=db;function cb(e){return new Ht(e.toString())}ge.regexpCode=cb});var ms=F(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.ValueScope=xt.ValueScopeName=xt.Scope=xt.varKinds=xt.UsedValueState=void 0;var Bt=af(),cs=class extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}},Zr=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(Zr||(xt.UsedValueState=Zr={}));xt.varKinds={const:new Bt.Name("const"),let:new Bt.Name("let"),var:new Bt.Name("var")};var Qr=class{constructor({prefixes:u,parent:t}={}){this._names={},this._prefixes=u,this._parent=t}toName(u){return u instanceof Bt.Name?u:this.name(u)}name(u){return new Bt.Name(this._newName(u))}_newName(u){let t=this._names[u]||this._nameGroup(u);return`${u}${t.index++}`}_nameGroup(u){var t,i;if(!((i=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||i===void 0)&&i.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}};xt.Scope=Qr;var eo=class extends Bt.Name{constructor(u,t){super(t),this.prefix=u}setValue(u,{property:t,itemIndex:i}){this.value=u,this.scopePath=(0,Bt._)`.${new Bt.Name(t)}[${i}]`}};xt.ValueScopeName=eo;var pb=(0,Bt._)`\n`,ps=class extends Qr{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts=xe(X({},u),{_n:u.lines?pb:Bt.nil})}get(){return this._scope}name(u){return new eo(u,this._newName(u))}value(u,t){var i;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(u),{prefix:f}=n,r=(i=t.key)!==null&&i!==void 0?i:t.ref,o=this._values[f];if(o){let D=o.get(r);if(D)return D}else o=this._values[f]=new Map;o.set(r,n);let a=this._scope[f]||(this._scope[f]=[]),s=a.length;return a[s]=t.ref,n.setValue(t,{property:f,itemIndex:s}),n}getValue(u,t){let i=this._values[u];if(i)return i.get(t)}scopeRefs(u,t=this._values){return this._reduceValues(t,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,Bt._)`${u}${i.scopePath}`})}scopeCode(u=this._values,t,i){return this._reduceValues(u,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,i)}_reduceValues(u,t,i={},n){let f=Bt.nil;for(let r in u){let o=u[r];if(!o)continue;let a=i[r]=i[r]||new Map;o.forEach(s=>{if(a.has(s))return;a.set(s,Zr.Started);let D=t(s);if(D){let d=this.opts.es5?xt.varKinds.var:xt.varKinds.const;f=(0,Bt._)`${f}${d} ${s} = ${D};${this.opts._n}`}else if(D=n?.(s))f=(0,Bt._)`${f}${D}${this.opts._n}`;else throw new cs(s);a.set(s,Zr.Completed)})}return f}};xt.ValueScope=ps});var ee=F(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.or=De.and=De.not=De.CodeGen=De.operators=De.varKinds=De.ValueScopeName=De.ValueScope=De.Scope=De.Name=De.regexpCode=De.stringify=De.getProperty=De.nil=De.strConcat=De.str=De._=void 0;var Fe=af(),iu=ms(),ti=af();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return ti._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return ti.str}});Object.defineProperty(De,"strConcat",{enumerable:!0,get:function(){return ti.strConcat}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return ti.nil}});Object.defineProperty(De,"getProperty",{enumerable:!0,get:function(){return ti.getProperty}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return ti.stringify}});Object.defineProperty(De,"regexpCode",{enumerable:!0,get:function(){return ti.regexpCode}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return ti.Name}});var fo=ms();Object.defineProperty(De,"Scope",{enumerable:!0,get:function(){return fo.Scope}});Object.defineProperty(De,"ValueScope",{enumerable:!0,get:function(){return fo.ValueScope}});Object.defineProperty(De,"ValueScopeName",{enumerable:!0,get:function(){return fo.ValueScopeName}});Object.defineProperty(De,"varKinds",{enumerable:!0,get:function(){return fo.varKinds}});De.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var wu=class{optimizeNodes(){return this}optimizeNames(u,t){return this}},Fs=class extends wu{constructor(u,t,i){super(),this.varKind=u,this.name=t,this.rhs=i}render({es5:u,_n:t}){let i=u?iu.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+t}optimizeNames(u,t){if(u[this.name.str])return this.rhs&&(this.rhs=un(this.rhs,u,t)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},uo=class extends wu{constructor(u,t,i){super(),this.lhs=u,this.rhs=t,this.sideEffects=i}render({_n:u}){return`${this.lhs} = ${this.rhs};`+u}optimizeNames(u,t){if(!(this.lhs instanceof Fe.Name&&!u[this.lhs.str]&&!this.sideEffects))return this.rhs=un(this.rhs,u,t),this}get names(){let u=this.lhs instanceof Fe.Name?{}:X({},this.lhs.names);return no(u,this.rhs)}},Cs=class extends uo{constructor(u,t,i,n){super(u,i,n),this.op=t}render({_n:u}){return`${this.lhs} ${this.op}= ${this.rhs};`+u}},hs=class extends wu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`${this.label}:`+u}},gs=class extends wu{constructor(u){super(),this.label=u,this.names={}}render({_n:u}){return`break${this.label?` ${this.label}`:""};`+u}},bs=class extends wu{constructor(u){super(),this.error=u}render({_n:u}){return`throw ${this.error};`+u}get names(){return this.error.names}},Es=class extends wu{constructor(u){super(),this.code=u}render({_n:u}){return`${this.code};`+u}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(u,t){return this.code=un(this.code,u,t),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},sf=class extends wu{constructor(u=[]){super(),this.nodes=u}render(u){return this.nodes.reduce((t,i)=>t+i.render(u),"")}optimizeNodes(){let{nodes:u}=this,t=u.length;for(;t--;){let i=u[t].optimizeNodes();Array.isArray(i)?u.splice(t,1,...i):i?u[t]=i:u.splice(t,1)}return u.length>0?this:void 0}optimizeNames(u,t){let{nodes:i}=this,n=i.length;for(;n--;){let f=i[n];f.optimizeNames(u,t)||(mb(u,f.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((u,t)=>Ai(u,t.names),{})}},Su=class extends sf{render(u){return"{"+u._n+super.render(u)+"}"+u._n}},_s=class extends sf{},ys=(()=>{class e extends Su{}return e.kind="else",e})(),to=(()=>{class e extends Su{constructor(t,i){super(i),this.condition=t}render(t){let i=`if(${this.condition})`+super.render(t);return this.else&&(i+="else "+this.else.render(t)),i}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let i=this.else;if(i){let n=i.optimizeNodes();i=this.else=Array.isArray(n)?new ys(n):n}if(i)return t===!1?i instanceof e?i:i.nodes:this.nodes.length?this:new e(J1(t),i instanceof e?[i]:i.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,i){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,i),!!(super.optimizeNames(t,i)||this.else))return this.condition=un(this.condition,t,i),this}get names(){let t=super.names;return no(t,this.condition),this.else&&Ai(t,this.else.names),t}}return e.kind="if",e})(),ro=(()=>{class e extends Su{}return e.kind="for",e})(),vs=class extends ro{constructor(u){super(),this.iteration=u}render(u){return`for(${this.iteration})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iteration=un(this.iteration,u,t),this}get names(){return Ai(super.names,this.iteration.names)}},Bs=class extends ro{constructor(u,t,i,n){super(),this.varKind=u,this.name=t,this.from=i,this.to=n}render(u){let t=u.es5?iu.varKinds.var:this.varKind,{name:i,from:n,to:f}=this;return`for(${t} ${i}=${n}; ${i}<${f}; ${i}++)`+super.render(u)}get names(){let u=no(super.names,this.from);return no(u,this.to)}},io=class extends ro{constructor(u,t,i,n){super(),this.loop=u,this.varKind=t,this.name=i,this.iterable=n}render(u){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(u)}optimizeNames(u,t){if(super.optimizeNames(u,t))return this.iterable=un(this.iterable,u,t),this}get names(){return Ai(super.names,this.iterable.names)}},H1=(()=>{class e extends Su{constructor(t,i,n){super(),this.name=t,this.args=i,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),W1=(()=>{class e extends sf{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),xs=class extends Su{render(u){let t="try"+super.render(u);return this.catch&&(t+=this.catch.render(u)),this.finally&&(t+=this.finally.render(u)),t}optimizeNodes(){var u,t;return super.optimizeNodes(),(u=this.catch)===null||u===void 0||u.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(u,t){var i,n;return super.optimizeNames(u,t),(i=this.catch)===null||i===void 0||i.optimizeNames(u,t),(n=this.finally)===null||n===void 0||n.optimizeNames(u,t),this}get names(){let u=super.names;return this.catch&&Ai(u,this.catch.names),this.finally&&Ai(u,this.finally.names),u}},K1=(()=>{class e extends Su{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),G1=(()=>{class e extends Su{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),ws=class{constructor(u,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=xe(X({},t),{_n:t.lines?`
2
2
  `:""}),this._extScope=u,this._scope=new iu.Scope({parent:u}),this._nodes=[new _s]}toString(){return this._root.render(this.opts)}name(u){return this._scope.name(u)}scopeName(u){return this._extScope.name(u)}scopeValue(u,t){let i=this._extScope.value(u,t);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(u,t){return this._extScope.getValue(u,t)}scopeRefs(u){return this._extScope.scopeRefs(u,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(u,t,i,n){let f=this._scope.toName(t);return i!==void 0&&n&&(this._constants[f.str]=i),this._leafNode(new Fs(u,f,i)),f}const(u,t,i){return this._def(iu.varKinds.const,u,t,i)}let(u,t,i){return this._def(iu.varKinds.let,u,t,i)}var(u,t,i){return this._def(iu.varKinds.var,u,t,i)}assign(u,t,i){return this._leafNode(new uo(u,t,i))}add(u,t){return this._leafNode(new Cs(u,De.operators.ADD,t))}code(u){return typeof u=="function"?u():u!==Fe.nil&&this._leafNode(new Es(u)),this}object(...u){let t=["{"];for(let[i,n]of u)t.length>1&&t.push(","),t.push(i),(i!==n||this.opts.es5)&&(t.push(":"),(0,Fe.addCodeArg)(t,n));return t.push("}"),new Fe._Code(t)}if(u,t,i){if(this._blockNode(new to(u)),t&&i)this.code(t).else().code(i).endIf();else if(t)this.code(t).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(u){return this._elseNode(new to(u))}else(){return this._elseNode(new ys)}endIf(){return this._endBlockNode(to,ys)}_for(u,t){return this._blockNode(u),t&&this.code(t).endFor(),this}for(u,t){return this._for(new vs(u),t)}forRange(u,t,i,n,f=this.opts.es5?iu.varKinds.var:iu.varKinds.let){let r=this._scope.toName(u);return this._for(new Bs(f,r,t,i),()=>n(r))}forOf(u,t,i,n=iu.varKinds.const){let f=this._scope.toName(u);if(this.opts.es5){let r=t instanceof Fe.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,Fe._)`${r}.length`,o=>{this.var(f,(0,Fe._)`${r}[${o}]`),i(f)})}return this._for(new io("of",n,f,t),()=>i(f))}forIn(u,t,i,n=this.opts.es5?iu.varKinds.var:iu.varKinds.const){if(this.opts.ownProperties)return this.forOf(u,(0,Fe._)`Object.keys(${t})`,i);let f=this._scope.toName(u);return this._for(new io("in",n,f,t),()=>i(f))}endFor(){return this._endBlockNode(ro)}label(u){return this._leafNode(new hs(u))}break(u){return this._leafNode(new gs(u))}return(u){let t=new W1;if(this._blockNode(t),this.code(u),t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(W1)}try(u,t,i){if(!t&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new xs;if(this._blockNode(n),this.code(u),t){let f=this.name("e");this._currNode=n.catch=new K1(f),t(f)}return i&&(this._currNode=n.finally=new G1,this.code(i)),this._endBlockNode(K1,G1)}throw(u){return this._leafNode(new bs(u))}block(u,t){return this._blockStarts.push(this._nodes.length),u&&this.code(u).endBlock(t),this}endBlock(u){let t=this._blockStarts.pop();if(t===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-t;if(i<0||u!==void 0&&i!==u)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${u} expected`);return this._nodes.length=t,this}func(u,t=Fe.nil,i,n){return this._blockNode(new H1(u,t,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(H1)}optimize(u=1){for(;u-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(u){return this._currNode.nodes.push(u),this}_blockNode(u){this._currNode.nodes.push(u),this._nodes.push(u)}_endBlockNode(u,t){let i=this._currNode;if(i instanceof u||t&&i instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${u.kind}/${t.kind}`:u.kind}"`)}_elseNode(u){let t=this._currNode;if(!(t instanceof to))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=u,this}get _root(){return this._nodes[0]}get _currNode(){let u=this._nodes;return u[u.length-1]}set _currNode(u){let t=this._nodes;t[t.length-1]=u}};De.CodeGen=ws;function Ai(e,u){for(let t in u)e[t]=(e[t]||0)+(u[t]||0);return e}function no(e,u){return u instanceof Fe._CodeOrName?Ai(e,u.names):e}function un(e,u,t){if(e instanceof Fe.Name)return i(e);if(!n(e))return e;return new Fe._Code(e._items.reduce((f,r)=>(r instanceof Fe.Name&&(r=i(r)),r instanceof Fe._Code?f.push(...r._items):f.push(r),f),[]));function i(f){let r=t[f.str];return r===void 0||u[f.str]!==1?f:(delete u[f.str],r)}function n(f){return f instanceof Fe._Code&&f._items.some(r=>r instanceof Fe.Name&&u[r.str]===1&&t[r.str]!==void 0)}}function mb(e,u){for(let t in u)e[t]=(e[t]||0)-(u[t]||0)}function J1(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Fe._)`!${Ss(e)}`}De.not=J1;var Fb=X1(De.operators.AND);function Cb(...e){return e.reduce(Fb)}De.and=Cb;var hb=X1(De.operators.OR);function gb(...e){return e.reduce(hb)}De.or=gb;function X1(e){return(u,t)=>u===Fe.nil?t:t===Fe.nil?u:(0,Fe._)`${Ss(u)} ${e} ${Ss(t)}`}function Ss(e){return e instanceof Fe.Name?e:(0,Fe._)`(${e})`}});var de=F(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.checkStrictMode=le.getErrorPath=le.Type=le.useFunc=le.setEvaluated=le.evaluatedPropsToName=le.mergeEvaluated=le.eachItem=le.unescapeJsonPointer=le.escapeJsonPointer=le.escapeFragment=le.unescapeFragment=le.schemaRefOrVal=le.schemaHasRulesButRef=le.schemaHasRules=le.checkUnknownRules=le.alwaysValidSchema=le.toHash=void 0;var Se=ee(),bb=af();function Eb(e){let u={};for(let t of e)u[t]=!0;return u}le.toHash=Eb;function _b(e,u){return typeof u=="boolean"?u:Object.keys(u).length===0?!0:(Q1(e,u),!ed(u,e.self.RULES.all))}le.alwaysValidSchema=_b;function Q1(e,u=e.schema){let{opts:t,self:i}=e;if(!t.strictSchema||typeof u=="boolean")return;let n=i.RULES.keywords;for(let f in u)n[f]||id(e,`unknown keyword: "${f}"`)}le.checkUnknownRules=Q1;function ed(e,u){if(typeof e=="boolean")return!e;for(let t in e)if(u[t])return!0;return!1}le.schemaHasRules=ed;function yb(e,u){if(typeof e=="boolean")return!e;for(let t in e)if(t!=="$ref"&&u.all[t])return!0;return!1}le.schemaHasRulesButRef=yb;function vb({topSchemaRef:e,schemaPath:u},t,i,n){if(!n){if(typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="string")return(0,Se._)`${t}`}return(0,Se._)`${e}${u}${(0,Se.getProperty)(i)}`}le.schemaRefOrVal=vb;function Bb(e){return td(decodeURIComponent(e))}le.unescapeFragment=Bb;function xb(e){return encodeURIComponent(As(e))}le.escapeFragment=xb;function As(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}le.escapeJsonPointer=As;function td(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}le.unescapeJsonPointer=td;function wb(e,u){if(Array.isArray(e))for(let t of e)u(t);else u(e)}le.eachItem=wb;function Y1({mergeNames:e,mergeToName:u,mergeValues:t,resultToName:i}){return(n,f,r,o)=>{let a=r===void 0?f:r instanceof Se.Name?(f instanceof Se.Name?e(n,f,r):u(n,f,r),r):f instanceof Se.Name?(u(n,r,f),f):t(f,r);return o===Se.Name&&!(a instanceof Se.Name)?i(n,a):a}}le.mergeEvaluated={props:Y1({mergeNames:(e,u,t)=>e.if((0,Se._)`${t} !== true && ${u} !== undefined`,()=>{e.if((0,Se._)`${u} === true`,()=>e.assign(t,!0),()=>e.assign(t,(0,Se._)`${t} || {}`).code((0,Se._)`Object.assign(${t}, ${u})`))}),mergeToName:(e,u,t)=>e.if((0,Se._)`${t} !== true`,()=>{u===!0?e.assign(t,!0):(e.assign(t,(0,Se._)`${t} || {}`),$s(e,t,u))}),mergeValues:(e,u)=>e===!0?!0:X(X({},e),u),resultToName:ud}),items:Y1({mergeNames:(e,u,t)=>e.if((0,Se._)`${t} !== true && ${u} !== undefined`,()=>e.assign(t,(0,Se._)`${u} === true ? true : ${t} > ${u} ? ${t} : ${u}`)),mergeToName:(e,u,t)=>e.if((0,Se._)`${t} !== true`,()=>e.assign(t,u===!0?!0:(0,Se._)`${t} > ${u} ? ${t} : ${u}`)),mergeValues:(e,u)=>e===!0?!0:Math.max(e,u),resultToName:(e,u)=>e.var("items",u)})};function ud(e,u){if(u===!0)return e.var("props",!0);let t=e.var("props",(0,Se._)`{}`);return u!==void 0&&$s(e,t,u),t}le.evaluatedPropsToName=ud;function $s(e,u,t){Object.keys(t).forEach(i=>e.assign((0,Se._)`${u}${(0,Se.getProperty)(i)}`,!0))}le.setEvaluated=$s;var Z1={};function Sb(e,u){return e.scopeValue("func",{ref:u,code:Z1[u.code]||(Z1[u.code]=new bb._Code(u.code))})}le.useFunc=Sb;var Is=function(e){return e[e.Num=0]="Num",e[e.Str=1]="Str",e}(Is||(le.Type=Is={}));function Ib(e,u,t){if(e instanceof Se.Name){let i=u===Is.Num;return t?i?(0,Se._)`"[" + ${e} + "]"`:(0,Se._)`"['" + ${e} + "']"`:i?(0,Se._)`"/" + ${e}`:(0,Se._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,Se.getProperty)(e).toString():"/"+As(e)}le.getErrorPath=Ib;function id(e,u,t=e.opts.strictSchema){if(t){if(u=`strict mode: ${u}`,t===!0)throw new Error(u);e.self.logger.warn(u)}}le.checkStrictMode=id});var Wt=F(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});var lt=ee(),Ab={data:new lt.Name("data"),valCxt:new lt.Name("valCxt"),instancePath:new lt.Name("instancePath"),parentData:new lt.Name("parentData"),parentDataProperty:new lt.Name("parentDataProperty"),rootData:new lt.Name("rootData"),dynamicAnchors:new lt.Name("dynamicAnchors"),vErrors:new lt.Name("vErrors"),errors:new lt.Name("errors"),this:new lt.Name("this"),self:new lt.Name("self"),scope:new lt.Name("scope"),json:new lt.Name("json"),jsonPos:new lt.Name("jsonPos"),jsonLen:new lt.Name("jsonLen"),jsonPart:new lt.Name("jsonPart")};ks.default=Ab});var Df=F(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.extendErrors=dt.resetErrorsCount=dt.reportExtraError=dt.reportError=dt.keyword$DataError=dt.keywordError=void 0;var he=ee(),oo=de(),Et=Wt();dt.keywordError={message:({keyword:e})=>(0,he.str)`must pass "${e}" keyword validation`};dt.keyword$DataError={message:({keyword:e,schemaType:u})=>u?(0,he.str)`"${e}" keyword must be ${u} ($data)`:(0,he.str)`"${e}" keyword is invalid ($data)`};function $b(e,u=dt.keywordError,t,i){let{it:n}=e,{gen:f,compositeRule:r,allErrors:o}=n,a=rd(e,u,t);i??(r||o)?nd(f,a):fd(n,(0,he._)`[${a}]`)}dt.reportError=$b;function kb(e,u=dt.keywordError,t){let{it:i}=e,{gen:n,compositeRule:f,allErrors:r}=i,o=rd(e,u,t);nd(n,o),f||r||fd(i,Et.default.vErrors)}dt.reportExtraError=kb;function Tb(e,u){e.assign(Et.default.errors,u),e.if((0,he._)`${Et.default.vErrors} !== null`,()=>e.if(u,()=>e.assign((0,he._)`${Et.default.vErrors}.length`,u),()=>e.assign(Et.default.vErrors,null)))}dt.resetErrorsCount=Tb;function Pb({gen:e,keyword:u,schemaValue:t,data:i,errsCount:n,it:f}){if(n===void 0)throw new Error("ajv implementation error");let r=e.name("err");e.forRange("i",n,Et.default.errors,o=>{e.const(r,(0,he._)`${Et.default.vErrors}[${o}]`),e.if((0,he._)`${r}.instancePath === undefined`,()=>e.assign((0,he._)`${r}.instancePath`,(0,he.strConcat)(Et.default.instancePath,f.errorPath))),e.assign((0,he._)`${r}.schemaPath`,(0,he.str)`${f.errSchemaPath}/${u}`),f.opts.verbose&&(e.assign((0,he._)`${r}.schema`,t),e.assign((0,he._)`${r}.data`,i))})}dt.extendErrors=Pb;function nd(e,u){let t=e.const("err",u);e.if((0,he._)`${Et.default.vErrors} === null`,()=>e.assign(Et.default.vErrors,(0,he._)`[${t}]`),(0,he._)`${Et.default.vErrors}.push(${t})`),e.code((0,he._)`${Et.default.errors}++`)}function fd(e,u){let{gen:t,validateName:i,schemaEnv:n}=e;n.$async?t.throw((0,he._)`new ${e.ValidationError}(${u})`):(t.assign((0,he._)`${i}.errors`,u),t.return(!1))}var $i={keyword:new he.Name("keyword"),schemaPath:new he.Name("schemaPath"),params:new he.Name("params"),propertyName:new he.Name("propertyName"),message:new he.Name("message"),schema:new he.Name("schema"),parentSchema:new he.Name("parentSchema")};function rd(e,u,t){let{createErrors:i}=e.it;return i===!1?(0,he._)`{}`:Ob(e,u,t)}function Ob(e,u,t={}){let{gen:i,it:n}=e,f=[Mb(n,t),jb(e,t)];return Nb(e,u,f),i.object(...f)}function Mb({errorPath:e},{instancePath:u}){let t=u?(0,he.str)`${e}${(0,oo.getErrorPath)(u,oo.Type.Str)}`:e;return[Et.default.instancePath,(0,he.strConcat)(Et.default.instancePath,t)]}function jb({keyword:e,it:{errSchemaPath:u}},{schemaPath:t,parentSchema:i}){let n=i?u:(0,he.str)`${u}/${e}`;return t&&(n=(0,he.str)`${n}${(0,oo.getErrorPath)(t,oo.Type.Str)}`),[$i.schemaPath,n]}function Nb(e,{params:u,message:t},i){let{keyword:n,data:f,schemaValue:r,it:o}=e,{opts:a,propertyName:s,topSchemaRef:D,schemaPath:d}=o;i.push([$i.keyword,n],[$i.params,typeof u=="function"?u(e):u||(0,he._)`{}`]),a.messages&&i.push([$i.message,typeof t=="function"?t(e):t]),a.verbose&&i.push([$i.schema,r],[$i.parentSchema,(0,he._)`${D}${d}`],[Et.default.data,f]),s&&i.push([$i.propertyName,s])}});var ad=F(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.boolOrEmptySchema=nn.topBoolOrEmptySchema=void 0;var qb=Df(),Vb=ee(),Rb=Wt(),Lb={message:"boolean schema is false"};function zb(e){let{gen:u,schema:t,validateName:i}=e;t===!1?od(e,!1):typeof t=="object"&&t.$async===!0?u.return(Rb.default.data):(u.assign((0,Vb._)`${i}.errors`,null),u.return(!0))}nn.topBoolOrEmptySchema=zb;function Ub(e,u){let{gen:t,schema:i}=e;i===!1?(t.var(u,!1),od(e)):t.var(u,!0)}nn.boolOrEmptySchema=Ub;function od(e,u){let{gen:t,data:i}=e,n={gen:t,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,qb.reportError)(n,Lb,void 0,u)}});var Ts=F(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.getRules=fn.isJSONType=void 0;var Hb=["string","number","integer","boolean","null","object","array"],Wb=new Set(Hb);function Kb(e){return typeof e=="string"&&Wb.has(e)}fn.isJSONType=Kb;function Gb(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:xe(X({},e),{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}fn.getRules=Gb});var Ps=F(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.shouldUseRule=ui.shouldUseGroup=ui.schemaHasRulesForType=void 0;function Jb({schema:e,self:u},t){let i=u.RULES.types[t];return i&&i!==!0&&sd(e,i)}ui.schemaHasRulesForType=Jb;function sd(e,u){return u.rules.some(t=>Dd(e,t))}ui.shouldUseGroup=sd;function Dd(e,u){var t;return e[u.keyword]!==void 0||((t=u.definition.implements)===null||t===void 0?void 0:t.some(i=>e[i]!==void 0))}ui.shouldUseRule=Dd});var lf=F(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.reportTypeError=ct.checkDataTypes=ct.checkDataType=ct.coerceAndCheckDataType=ct.getJSONTypes=ct.getSchemaTypes=ct.DataType=void 0;var Xb=Ts(),Yb=Ps(),Zb=Df(),oe=ee(),ld=de(),rn=function(e){return e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong",e}(rn||(ct.DataType=rn={}));function Qb(e){let u=dd(e.type);if(u.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!u.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&u.push("null")}return u}ct.getSchemaTypes=Qb;function dd(e){let u=Array.isArray(e)?e:e?[e]:[];if(u.every(Xb.isJSONType))return u;throw new Error("type must be JSONType or JSONType[]: "+u.join(","))}ct.getJSONTypes=dd;function eE(e,u){let{gen:t,data:i,opts:n}=e,f=tE(u,n.coerceTypes),r=u.length>0&&!(f.length===0&&u.length===1&&(0,Yb.schemaHasRulesForType)(e,u[0]));if(r){let o=Ms(u,i,n.strictNumbers,rn.Wrong);t.if(o,()=>{f.length?uE(e,u,f):js(e)})}return r}ct.coerceAndCheckDataType=eE;var cd=new Set(["string","number","integer","boolean","null"]);function tE(e,u){return u?e.filter(t=>cd.has(t)||u==="array"&&t==="array"):[]}function uE(e,u,t){let{gen:i,data:n,opts:f}=e,r=i.let("dataType",(0,oe._)`typeof ${n}`),o=i.let("coerced",(0,oe._)`undefined`);f.coerceTypes==="array"&&i.if((0,oe._)`${r} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,oe._)`${n}[0]`).assign(r,(0,oe._)`typeof ${n}`).if(Ms(u,n,f.strictNumbers),()=>i.assign(o,n))),i.if((0,oe._)`${o} !== undefined`);for(let s of t)(cd.has(s)||s==="array"&&f.coerceTypes==="array")&&a(s);i.else(),js(e),i.endIf(),i.if((0,oe._)`${o} !== undefined`,()=>{i.assign(n,o),iE(e,o)});function a(s){switch(s){case"string":i.elseIf((0,oe._)`${r} == "number" || ${r} == "boolean"`).assign(o,(0,oe._)`"" + ${n}`).elseIf((0,oe._)`${n} === null`).assign(o,(0,oe._)`""`);return;case"number":i.elseIf((0,oe._)`${r} == "boolean" || ${n} === null
3
3
  || (${r} == "string" && ${n} && ${n} == +${n})`).assign(o,(0,oe._)`+${n}`);return;case"integer":i.elseIf((0,oe._)`${r} === "boolean" || ${n} === null
4
4
  || (${r} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(o,(0,oe._)`+${n}`);return;case"boolean":i.elseIf((0,oe._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(o,!1).elseIf((0,oe._)`${n} === "true" || ${n} === 1`).assign(o,!0);return;case"null":i.elseIf((0,oe._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(o,null);return;case"array":i.elseIf((0,oe._)`${r} === "string" || ${r} === "number"
@@ -17,13 +17,13 @@ Should be: [ [ object1, pointer1 ], [ object 2, pointer2 ], etc... ]`),n}}static
17
17
  `},t.origin)})}getConfigBlocks(){return this.pluginConfig}updateConfigBlocks(t){for(let i of t)i[this.pluginType]=this.pluginAlias;this.pluginConfig=t}schemaFormUpdated(){if(!(!this.iframe||!this.iframe.contentWindow)){if(this.schemaFormRecentlyRefreshed){this.schemaFormRecentlyRefreshed=!1;return}this.schemaFormRecentlyUpdated=!0,this.iframe.contentWindow.postMessage({action:"stream",event:"configChanged",data:this.pluginConfig},Qu.api.origin)}}schemaFormRefresh(){if(this.schemaFormRecentlyUpdated){this.schemaFormRecentlyUpdated=!1;return}this.schemaFormRecentlyRefreshed=!0,this.showSchemaForm&&(this.showSchemaForm=!1,setTimeout(()=>{this.showSchemaForm=!0}))}formCreate(t,i,n,f,r){return K(this,null,function*(){yield this.formEnd(),this.formId=t,this.formSchema=i,this.formData=n,this.formSubmitButtonLabel=f,this.formCancelButtonLabel=r})}formEnd(){return K(this,null,function*(){this.formId&&(this.formId=void 0,this.formSchema=void 0,this.formData=void 0,this.formSubmitButtonLabel=void 0,this.formCancelButtonLabel=void 0,yield new Promise(t=>setTimeout(t)))})}formUpdated(t){this.iframe.contentWindow.postMessage({action:"stream",event:this.formId,data:{formEvent:"change",formData:t}},Qu.api.origin)}formValidEvent(t){this.formValid=t}formActionEvent(t){this.iframe.contentWindow.postMessage({action:"stream",event:this.formId,data:{formEvent:t,formData:this.formData}},Qu.api.origin)}handleGetCachedAccessories(t){return K(this,null,function*(){let i=yield re(this.$api.get("/server/cached-accessories"));return this.requestResponse(t,i.filter(n=>n.plugin===this.plugin.name))})}savePluginConfig(t=!1){return K(this,null,function*(){this.saveInProgress=!0;try{let i=yield re(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,this.pluginConfig));if(this.saveInProgress=!1,t){if(this.isFirstSave&&this.$settings.env.recommendChildBridges&&i[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(this.plugin,!0);return}if(!["homebridge","homebridge-config-ui-x"].includes(this.plugin.name)&&(yield this.getChildBridges(),this.childBridges.length>0)){this.$activeModal.close();let n=this.$modal.open(tn,{size:"lg",backdrop:"static"});n.componentInstance.bridges=this.childBridges.map(f=>({name:f.name,username:f.username}));return}this.$activeModal.close(),this.$modal.open(pu,{size:"lg",backdrop:"static"})}}catch(i){this.saveInProgress=!1,console.error(i),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}})}getChildBridges(){return K(this,null,function*(){try{(yield re(this.$api.get("/status/homebridge/child-bridges"))).forEach(i=>{this.plugin.name===i.plugin&&this.childBridges.push(i)})}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error")),this.childBridges=[]}})}onIsValid(t){this.formIsValid=t}ngOnDestroy(){window.removeEventListener("message",this.handleMessage),this.io.end(),this.schemaFormRefreshSubject.complete(),this.schemaFormUpdatedSubject.complete(),this.formUpdatedSubject.complete()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],viewQuery:function(i,n){i&1&&Wu(n.customPluginUiElementTarget,hU,5),i&2&&Ku()},inputs:{plugin:"plugin",schema:"schema",pluginConfig:"pluginConfig"},decls:24,vars:17,consts:[["custompluginui",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body","pb-0",2,"min-height","110px"],[1,"text-center","primary-text"],["width","100%","height","1px;","sandbox","allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms",2,"border","0"],[1,"card","card-body"],[1,"loading-overlay","text-center","primary-text","d-flex","align-items-center","justify-content-center"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end","d-flex","align-items-center","justify-content-end"],["container","modal","placement","top","openDelay","150","triggers","hover",1,"fa","fa-fw","fa-xl","me-2",3,"ngClass","ngbTooltip"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[3,"dataChange","dataChanged","isValid","configSchema","data"],[1,"text-end","custom-form-action-buttons"],[1,"btn","btn-elegant"],[1,"btn","btn-primary",3,"disabled"],[1,"btn","btn-elegant",3,"click"],[1,"btn","btn-primary",3,"click","disabled"]],template:function(i,n){if(i&1){let f=H();c(0,"div",1)(1,"div",2)(2,"h5",3),E(3),p(),c(4,"button",4),y(5,"translate"),M("click",function(){return j(f),N(n.$activeModal.dismiss("Dismiss"))}),p()(),c(6,"div",5),w(7,gU,2,0,"div",6),x(8,"iframe",7,0),w(10,bU,2,2,"div",8),w(11,yU,5,4,"div",8),w(12,vU,2,0,"div",9),p(),c(13,"div",10)(14,"div",11)(15,"button",12),M("click",function(){return j(f),N(n.$activeModal.dismiss("Dismiss"))}),E(16),y(17,"translate"),p()(),x(18,"div",13),c(19,"div",14),w(20,BU,2,4,"i",15),c(21,"button",16),M("click",function(){return j(f),N(n.savePluginConfig(!0))}),w(22,xU,2,3),w(23,wU,1,0,"i",17),p()()()()}i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),b("disabled",n.saveInProgress),G("aria-label",B(5,13,"form.button_close")),l(3),S(n.loading?7:-1),l(3),S(n.uiLoaded&&n.pluginConfig.length&&n.schema.singular&&n.showSchemaForm?10:-1),l(),S(n.formId?11:-1),l(),S(n.pluginSpinner?12:-1),l(3),b("disabled",n.saveInProgress),l(),q(" ",B(17,15,"form.button_close")," "),l(4),S(n.saveButtonDisabled?-1:20),l(),b("disabled",n.saveInProgress||n.saveButtonDisabled),l(),S(n.saveInProgress?-1:22),l(),S(n.saveInProgress?23:-1))},dependencies:[es,en,zt,$e],styles:[".manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}.loading-overlay[_ngcontent-%COMP%]{position:absolute;inset:16px;background-color:#ffffffb3} body.dark-mode .loading-overlay{background-color:#242424b3}.custom-form-action-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:last-child{margin-right:2px}"]})}return e})();var y6=(()=>{class e{$api=I(be);$modal=I(it);plugins={};constructor(){}openSettings(t,i){return K(this,null,function*(){let n=yield this.loadPluginConfig(t.name),f=this.$modal.open(this.plugins[t.name],{size:"lg",backdrop:"static"});return f.componentInstance.plugin=t,f.componentInstance.schema=i,f.componentInstance.pluginConfig=n,f.result.catch(()=>{})})}openCustomSettingsUi(t,i){return K(this,null,function*(){let n=yield this.loadPluginConfig(t.name),f=this.$modal.open(_6,{size:"lg",backdrop:"static"});return f.componentInstance.plugin=t,f.componentInstance.schema=i,f.componentInstance.pluginConfig=n,f.result.catch(()=>{})})}loadPluginConfig(t){return K(this,null,function*(){return re(this.$api.get(`/config-editor/plugin/${encodeURIComponent(t)}`))})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var A6=Re(ff(),1);var $6=Re(V1(),1),k6=Re(R1(),1);var B6=Re(v6(),1);var is=(()=>{class e{el=I(Hu);constructor(){}ngOnInit(){this.el.nativeElement.querySelectorAll("a").forEach(n=>{n.target="_blank",n.rel="noopener noreferrer"});let i=new B6.EmojiConvertor;this.el.nativeElement.innerHTML=i.replace_colons(this.el.nativeElement.innerHTML)}static \u0275fac=function(i){return new(i||e)};static \u0275dir=Bu({type:e,selectors:[["markdown"]]})}return e})();var x6=Re(ff(),1);var SU=["pluginlogoutput"],w6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$log=I(L1);$modal=I(it);$toastr=I(_e);$translate=I(Ee);plugin;termTarget=Ju("pluginlogoutput");resizeEvent=new Pt;pluginAlias;constructor(){}onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){this.getPluginLog()}getPluginLog(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{this.pluginAlias=this.plugin.name==="homebridge-config-ui-x"?"Homebridge UI":t[0]?.name||this.plugin.name,this.$log.startTerminal(this.termTarget(),{},this.resizeEvent,this.pluginAlias)},error:t=>{console.error(t),this.$toastr.error(t.error.message||t.message,this.$translate.instant("toast.title_error")),this.$activeModal.dismiss()}})}downloadLogFile(){let t=this.$modal.open(j1,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("logs.title_download_log_file"),t.componentInstance.message=this.$translate.instant("logs.download_warning"),t.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_download"),t.componentInstance.faIconClass="fas fa-fw fa-user-secret primary-text",t.result.then(()=>{this.$api.get("/platform-tools/hb-service/log/download?colour=yes",{observe:"response",responseType:"text"}).subscribe({next:i=>{if(!i.body)return;let n=i.body.split(`
18
18
  `),f="",r=!1;n.forEach(o=>{if(o){if(r)if(o.match(/36m\[.*?\]/))r=!1;else{f+=`${o.replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"")}\r
19
19
  `;return}o.includes(`36m[${this.pluginAlias}]`)&&(f+=`${o.replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"")}\r
20
- `,r=!0)}}),(0,x6.saveAs)(new Blob([f],{type:"text/plain;charset=utf-8"}),`${this.plugin.name}.log.txt`)},error:i=>K(this,null,function*(){let n;try{n=JSON.parse(yield i.error.text()).message}catch(f){console.error(f)}this.$toastr.error(n||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error"))})})}).catch(()=>{})}ngOnDestroy(){this.$log.destroyTerminal()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],viewQuery:function(i,n){i&1&&Wu(n.termTarget,SU,5),i&2&&Ku()},hostBindings:function(i,n){i&1&&M("resize",function(r){return n.onWindowResize(r)},d1)},inputs:{plugin:"plugin"},decls:20,vars:13,consts:[["pluginlogoutput",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","d-flex","flex-row","flex-grow-1","w-100","p-0"],[1,"w-100","bg-black","plugin-log-output","terminal","align-self-end","w-100","h-100","mb-0","p-2"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],[1,"btn","btn-primary",3,"click"]],template:function(i,n){if(i&1){let f=H();c(0,"div",1)(1,"div",2)(2,"h5",3),E(3),p(),c(4,"button",4),y(5,"translate"),M("click",function(){return j(f),N(n.$activeModal.dismiss("Dismiss"))}),p()(),c(6,"div",5),x(7,"div",6,0),p(),c(9,"div",7)(10,"div",8)(11,"button",9),y(12,"translate"),M("click",function(){return j(f),N(n.$activeModal.dismiss("Dismiss"))}),E(13),y(14,"translate"),p()(),x(15,"div",10),c(16,"div",11)(17,"button",12),M("click",function(){return j(f),N(n.downloadLogFile())}),E(18),y(19,"translate"),p()()()()}i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),G("aria-label",B(5,5,"form.button_close")),l(7),G("aria-label",B(12,7,"form.button_close")),l(2),q(" ",B(14,9,"form.button_close")," "),l(5),L(B(19,11,"form.button_download")))},dependencies:[$e],encapsulation:2})}return e})();var S6=Re(Jr(),1);var Xl=()=>({app:"Homebridge v2"});function IU(e,u){e&1&&(c(0,"div",5),x(1,"i",12),p())}function AU(e,u){e&1&&(c(0,"p",9),E(1,"All your plugins are marked as compatible with Homebridge v2."),p())}function $U(e,u){e&1&&(c(0,"p",9),E(1,"To ignore this warning and continue with the update, click continue below."),p())}function kU(e,u){if(e&1&&(c(0,"p",9),E(1," Some of your plugins are not explicitly marked as compatible with Homebridge v2. This does "),c(2,"span",17),E(3,"not"),p(),E(4," necessarily mean that they won't work. We just can't guarantee that they will. "),p(),c(5,"p",9),E(6," For more information about this update, please see the "),c(7,"a",18),E(8,"wiki page"),p(),E(9,". "),p(),w(10,$U,2,0,"p",9)),e&2){let t=h(2);l(10),S(t.isUpdating?10:-1)}}function TU(e,u){e&1&&(c(0,"div",19),E(1," Node.js Version"),x(2,"br"),c(3,"span",20),E(4),y(5,"translate"),p()(),c(6,"div",21),x(7,"i",22),p()),e&2&&(l(4),L(He(5,1,"status.readiness.node_yes",we(4,Xl))))}function PU(e,u){e&1&&(c(0,"div",19),E(1," Node.js Version"),x(2,"br"),c(3,"span",20),E(4),y(5,"translate"),p(),x(6,"br"),c(7,"a",23),E(8),y(9,"translate"),x(10,"i",24),p()(),c(11,"div",21),x(12,"i",25),p()),e&2&&(l(4),L(He(5,2,"status.readiness.node_no",we(7,Xl))),l(4),q(" ",B(9,5,"plugins.compat.node_link")," "))}function OU(e,u){e&1&&x(0,"i",26)}function MU(e,u){e&1&&x(0,"i",27)}function jU(e,u){if(e&1&&(c(0,"li",16)(1,"div",19),E(2),p(),c(3,"div",21),w(4,OU,1,0,"i",26),w(5,MU,1,0,"i",27),p()()),e&2){let t=u.$implicit;l(2),L(t.displayName),l(2),S(t.hb2Ready==="supported"?4:-1),l(),S(t.hb2Ready==="unknown"?5:-1)}}function NU(e,u){if(e&1&&(c(0,"div",13),x(1,"img",14),p(),w(2,AU,2,0,"p",9),w(3,kU,11,1),c(4,"ul",15)(5,"li",16),w(6,TU,8,5)(7,PU,13,8),p(),ft(8,jU,6,3,"li",16,nt),p()),e&2){let t=h();l(2),S(t.allPluginsSupported?2:-1),l(),S(t.allPluginsSupported?-1:3),l(3),S(t.nodeReady?6:7),l(2),rt(t.installedPlugins)}}function qU(e,u){if(e&1){let t=H();c(0,"button",28),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function VU(e,u){if(e&1){let t=H();c(0,"button",28),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function RU(e,u){if(e&1){let t=H();c(0,"button",29),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("update"))}),E(1),y(2,"translate"),p()}if(e&2){let t=h();b("disabled",t.loading),l(),q(" ",B(2,2,"form.label_continue")," ")}}var I6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);$ws=I(ei);isUpdating=!1;loading=!0;installedPlugins=[];allPluginsSupported=!0;nodeReady=!1;io;constructor(){}ngOnInit(){return K(this,null,function*(){this.io=this.$ws.getExistingNamespace("status"),this.io.socket.connected&&(yield this.checkHomebridgeUiVersion()),yield this.loadInstalledPlugins(),this.loading=!1})}checkHomebridgeUiVersion(){return K(this,null,function*(){try{let{nodeVersion:t}=yield re(this.io.request("get-homebridge-server-info"));this.nodeReady=(0,S6.satisfies)(t,">=20")}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}loadInstalledPlugins(){return K(this,null,function*(){this.installedPlugins=[],this.loading=!0;let t=this.$settings.env.homebridgeVersion.split(".")[0];try{let i=yield re(this.$api.get("/plugins"));this.installedPlugins=i.filter(n=>n.name!=="homebridge-config-ui-x").map(n=>{let f=n.engines?.homebridge?.split("||").map(o=>o.trim())||[],r=t==="2"?"hide":f.some(o=>o.startsWith("^2")||o.startsWith(">=2"))?"supported":"unknown";return r==="unknown"&&(this.allPluginsSupported=!1),xe(X({},n),{hb2Ready:r})}).sort((n,f)=>n.name.localeCompare(f.name)),this.installedPlugins.length===0&&this.$activeModal.close("update")}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{isUpdating:"isUpdating"},decls:17,vars:13,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"w-100","text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],["ngSrc","assets/hb-icon.png","alt","","height","100","width","100",1,"plugin-icon-card"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"fw-bold"],["href","https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0","target","_blank"],[1,"text-start","flex-grow-1"],[1,"grey-text"],[1,"ms-3"],[1,"fas","fa-check-circle","green-text","fa-xl"],["href","https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js","target","_blank","rel","noopener noreferrer",1,"small"],[1,"fa","fa-fw","fa-external-link-alt"],[1,"fas","fa-exclamation-circle","orange-text","fa-xl"],["aria-label","The developer has specifically marked this plugin as compatible with Homebridge v2.",1,"fas","fa-check-circle","green-text","fa-xl"],["aria-label","The developer has not specifically marked this plugin as compatible with Homebridge v2, but it may still work.",1,"fas","fa-question-circle","orange-text","fa-xl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),y(4,"translate"),p(),c(5,"button",3),y(6,"translate"),M("click",function(){return n.$activeModal.close("Dismiss")}),p()(),c(7,"div",4),w(8,IU,2,0,"div",5),w(9,NU,10,3),p(),c(10,"div",6)(11,"div",7),w(12,qU,4,6,"button",8),p(),c(13,"div",9),w(14,VU,4,6,"button",8),p(),c(15,"div",10),w(16,RU,3,4,"button",11),p()()()),i&2&&(l(3),L(He(4,7,"status.readiness.title",we(12,Xl))),l(2),G("aria-label",B(6,10,"form.button_close")),l(3),S(n.loading?8:-1),l(),S(n.loading?-1:9),l(3),S(n.isUpdating?12:-1),l(2),S(n.isUpdating?-1:14),l(2),S(n.isUpdating?16:-1))},dependencies:[$e,E1],encapsulation:2})}return e})();var zU=(e,u)=>({iconStar:e,iconThumbsUp:u}),T6=(e,u,t,i)=>({"fa-arrow-alt-circle-down":e,"fa-code-compare":u,"fa-arrow-alt-circle-up":t,"fa-trash":i}),UU=()=>["homebridge","homebridge-config-ui-x"],HU=e=>({pluginName:e});function WU(e,u){e&1&&(c(0,"p",13),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.settings.restart_required")))}function KU(e,u){e&1&&(c(0,"p",13),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"restart.child_bridges")))}function GU(e,u){if(e&1&&(x(0,"p",12),y(1,"translate"),w(2,WU,3,3,"p",13),w(3,KU,3,3,"p",13)),e&2){let t=h(3);b("innerHTML",He(1,3,"plugins.manage.github_support",Bi(6,zU,t.iconStar,t.iconThumbsUp)),me),l(2),S(t.childBridges.length===0?2:-1),l(),S(t.childBridges.length>0?3:-1)}}function JU(e,u){if(e&1&&(c(0,"div",9),x(1,"i",10),p(),c(2,"h5",11),E(3),p(),w(4,GU,4,9)),e&2){let t=h(2);l(3),Rr("",t.pastTenseVerb,": ",t.pluginDisplayName," (",t.targetVersionPretty,")"),l(),S(t.isDisabled?-1:4)}}function XU(e,u){if(e&1&&(c(0,"div",6),w(1,JU,5,4),p()),e&2){let t=h();l(),S(t.justUpdatedPlugin?1:-1)}}function YU(e,u){if(e&1&&(c(0,"div",7)(1,"div",9),x(2,"i",14),p(),c(3,"ul",15)(4,"li"),E(5),y(6,"translate"),p(),c(7,"li"),E(8),y(9,"translate"),p()(),c(10,"pre",16),E(11),p()()),e&2){let t=h();l(2),b("ngClass",Yi(9,T6,t.action==="Install",t.action==="Update"&&t.installedVersion,t.action==="Update"&&!t.installedVersion,t.action==="Uninstall")),l(3),L(B(6,5,"plugins.manage.online_updates")),l(3),L(B(9,7,"plugins.manage.manual_update_command")),l(3),vi(`hb-service stop
20
+ `,r=!0)}}),(0,x6.saveAs)(new Blob([f],{type:"text/plain;charset=utf-8"}),`${this.plugin.name}.log.txt`)},error:i=>K(this,null,function*(){let n;try{n=JSON.parse(yield i.error.text()).message}catch(f){console.error(f)}this.$toastr.error(n||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error"))})})}).catch(()=>{})}ngOnDestroy(){this.$log.destroyTerminal()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],viewQuery:function(i,n){i&1&&Wu(n.termTarget,SU,5),i&2&&Ku()},hostBindings:function(i,n){i&1&&M("resize",function(r){return n.onWindowResize(r)},d1)},inputs:{plugin:"plugin"},decls:20,vars:13,consts:[["pluginlogoutput",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","d-flex","flex-row","flex-grow-1","w-100","p-0"],[1,"w-100","bg-black","plugin-log-output","terminal","align-self-end","w-100","h-100","mb-0","p-2"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],[1,"btn","btn-primary",3,"click"]],template:function(i,n){if(i&1){let f=H();c(0,"div",1)(1,"div",2)(2,"h5",3),E(3),p(),c(4,"button",4),y(5,"translate"),M("click",function(){return j(f),N(n.$activeModal.dismiss("Dismiss"))}),p()(),c(6,"div",5),x(7,"div",6,0),p(),c(9,"div",7)(10,"div",8)(11,"button",9),y(12,"translate"),M("click",function(){return j(f),N(n.$activeModal.dismiss("Dismiss"))}),E(13),y(14,"translate"),p()(),x(15,"div",10),c(16,"div",11)(17,"button",12),M("click",function(){return j(f),N(n.downloadLogFile())}),E(18),y(19,"translate"),p()()()()}i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),G("aria-label",B(5,5,"form.button_close")),l(7),G("aria-label",B(12,7,"form.button_close")),l(2),q(" ",B(14,9,"form.button_close")," "),l(5),L(B(19,11,"form.button_download")))},dependencies:[$e],encapsulation:2})}return e})();var S6=Re(Jr(),1);var Xl=()=>({app:"Homebridge v2"});function IU(e,u){e&1&&(c(0,"div",5),x(1,"i",12),p())}function AU(e,u){e&1&&(c(0,"p",9),E(1,"All your plugins are marked as compatible with Homebridge v2."),p())}function $U(e,u){e&1&&(c(0,"p",9),E(1,"To ignore this warning and continue with the update, click continue below."),p())}function kU(e,u){if(e&1&&(c(0,"p",9),E(1," Some of your plugins are not explicitly marked as compatible with Homebridge v2. This does "),c(2,"span",17),E(3,"not"),p(),E(4," necessarily mean that they won't work. We just can't guarantee that they will. "),p(),c(5,"p",9),E(6," For more information about this update, please see the "),c(7,"a",18),E(8,"wiki page"),p(),E(9,". "),p(),w(10,$U,2,0,"p",9)),e&2){let t=h(2);l(10),S(t.isUpdating?10:-1)}}function TU(e,u){e&1&&(c(0,"div",19),E(1," Node.js Version"),x(2,"br"),c(3,"span",20),E(4),y(5,"translate"),p()(),c(6,"div",21),x(7,"i",22),p()),e&2&&(l(4),L(He(5,1,"status.readiness.node_yes",we(4,Xl))))}function PU(e,u){e&1&&(c(0,"div",19),E(1," Node.js Version"),x(2,"br"),c(3,"span",20),E(4),y(5,"translate"),p(),x(6,"br"),c(7,"a",23),E(8),y(9,"translate"),x(10,"i",24),p()(),c(11,"div",21),x(12,"i",25),p()),e&2&&(l(4),L(He(5,2,"status.readiness.node_no",we(7,Xl))),l(4),q(" ",B(9,5,"plugins.compat.node_link")," "))}function OU(e,u){e&1&&x(0,"i",26)}function MU(e,u){e&1&&x(0,"i",27)}function jU(e,u){if(e&1&&(c(0,"li",16)(1,"div",19),E(2),p(),c(3,"div",21),w(4,OU,1,0,"i",26),w(5,MU,1,0,"i",27),p()()),e&2){let t=u.$implicit;l(2),L(t.displayName),l(2),S(t.hb2Ready==="supported"?4:-1),l(),S(t.hb2Ready==="unknown"?5:-1)}}function NU(e,u){if(e&1&&(c(0,"div",13),x(1,"img",14),p(),w(2,AU,2,0,"p",9),w(3,kU,11,1),c(4,"ul",15)(5,"li",16),w(6,TU,8,5)(7,PU,13,8),p(),ft(8,jU,6,3,"li",16,nt),p()),e&2){let t=h();l(2),S(t.allPluginsSupported?2:-1),l(),S(t.allPluginsSupported?-1:3),l(3),S(t.nodeReady?6:7),l(2),rt(t.installedPlugins)}}function qU(e,u){if(e&1){let t=H();c(0,"button",28),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function VU(e,u){if(e&1){let t=H();c(0,"button",28),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function RU(e,u){if(e&1){let t=H();c(0,"button",29),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("update"))}),E(1),y(2,"translate"),p()}if(e&2){let t=h();b("disabled",t.loading),l(),q(" ",B(2,2,"form.label_continue")," ")}}var I6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);$ws=I(ei);isUpdating=!1;skipIfCompatible=!0;loading=!0;installedPlugins=[];allPluginsSupported=!0;nodeReady=!1;io;constructor(){}ngOnInit(){return K(this,null,function*(){this.io=this.$ws.getExistingNamespace("status"),this.io.socket.connected&&(yield this.checkHomebridgeUiVersion()),yield this.loadInstalledPlugins(),this.loading=!1})}checkHomebridgeUiVersion(){return K(this,null,function*(){try{let{nodeVersion:t}=yield re(this.io.request("get-homebridge-server-info"));this.nodeReady=(0,S6.satisfies)(t,">=20")}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}loadInstalledPlugins(){return K(this,null,function*(){this.installedPlugins=[],this.loading=!0;let t=this.$settings.env.homebridgeVersion.split(".")[0];try{let i=yield re(this.$api.get("/plugins"));this.installedPlugins=i.filter(n=>n.name!=="homebridge-config-ui-x").map(n=>{let f=n.engines?.homebridge?.split("||").map(o=>o.trim())||[],r=t==="2"?"hide":f.some(o=>o.startsWith("^2")||o.startsWith(">=2"))?"supported":"unknown";return r==="unknown"&&(this.allPluginsSupported=!1),xe(X({},n),{hb2Ready:r})}).sort((n,f)=>n.name.localeCompare(f.name)),this.skipIfCompatible&&this.installedPlugins.length===0&&this.$activeModal.close("update")}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{isUpdating:"isUpdating",skipIfCompatible:"skipIfCompatible"},decls:17,vars:13,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"w-100","text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],["ngSrc","assets/hb-icon.png","alt","","height","100","width","100",1,"plugin-icon-card"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"fw-bold"],["href","https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0","target","_blank"],[1,"text-start","flex-grow-1"],[1,"grey-text"],[1,"ms-3"],[1,"fas","fa-check-circle","green-text","fa-xl"],["href","https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js","target","_blank","rel","noopener noreferrer",1,"small"],[1,"fa","fa-fw","fa-external-link-alt"],[1,"fas","fa-exclamation-circle","orange-text","fa-xl"],["aria-label","The developer has specifically marked this plugin as compatible with Homebridge v2.",1,"fas","fa-check-circle","green-text","fa-xl"],["aria-label","The developer has not specifically marked this plugin as compatible with Homebridge v2, but it may still work.",1,"fas","fa-question-circle","orange-text","fa-xl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),y(4,"translate"),p(),c(5,"button",3),y(6,"translate"),M("click",function(){return n.$activeModal.close("Dismiss")}),p()(),c(7,"div",4),w(8,IU,2,0,"div",5),w(9,NU,10,3),p(),c(10,"div",6)(11,"div",7),w(12,qU,4,6,"button",8),p(),c(13,"div",9),w(14,VU,4,6,"button",8),p(),c(15,"div",10),w(16,RU,3,4,"button",11),p()()()),i&2&&(l(3),L(He(4,7,"status.readiness.title",we(12,Xl))),l(2),G("aria-label",B(6,10,"form.button_close")),l(3),S(n.loading?8:-1),l(),S(n.loading?-1:9),l(3),S(n.isUpdating?12:-1),l(2),S(n.isUpdating?-1:14),l(2),S(n.isUpdating?16:-1))},dependencies:[$e,E1],encapsulation:2})}return e})();var zU=(e,u)=>({iconStar:e,iconThumbsUp:u}),T6=(e,u,t,i)=>({"fa-arrow-alt-circle-down":e,"fa-code-compare":u,"fa-arrow-alt-circle-up":t,"fa-trash":i}),UU=()=>["homebridge","homebridge-config-ui-x"],HU=e=>({pluginName:e});function WU(e,u){e&1&&(c(0,"p",13),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.settings.restart_required")))}function KU(e,u){e&1&&(c(0,"p",13),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"restart.child_bridges")))}function GU(e,u){if(e&1&&(x(0,"p",12),y(1,"translate"),w(2,WU,3,3,"p",13),w(3,KU,3,3,"p",13)),e&2){let t=h(3);b("innerHTML",He(1,3,"plugins.manage.github_support",Bi(6,zU,t.iconStar,t.iconThumbsUp)),me),l(2),S(t.childBridges.length===0?2:-1),l(),S(t.childBridges.length>0?3:-1)}}function JU(e,u){if(e&1&&(c(0,"div",9),x(1,"i",10),p(),c(2,"h5",11),E(3),p(),w(4,GU,4,9)),e&2){let t=h(2);l(3),Rr("",t.pastTenseVerb,": ",t.pluginDisplayName," (",t.targetVersionPretty,")"),l(),S(t.isDisabled?-1:4)}}function XU(e,u){if(e&1&&(c(0,"div",6),w(1,JU,5,4),p()),e&2){let t=h();l(),S(t.justUpdatedPlugin?1:-1)}}function YU(e,u){if(e&1&&(c(0,"div",7)(1,"div",9),x(2,"i",14),p(),c(3,"ul",15)(4,"li"),E(5),y(6,"translate"),p(),c(7,"li"),E(8),y(9,"translate"),p()(),c(10,"pre",16),E(11),p()()),e&2){let t=h();l(2),b("ngClass",Yi(9,T6,t.action==="Install",t.action==="Update"&&t.installedVersion,t.action==="Update"&&!t.installedVersion,t.action==="Uninstall")),l(3),L(B(6,5,"plugins.manage.online_updates")),l(3),L(B(9,7,"plugins.manage.manual_update_command")),l(3),vi(`hb-service stop
21
21
  npm install -g `,t.pluginName,"@",t.targetVersion,`
22
- hb-service start`)}}function ZU(e,u){if(e&1&&(c(0,"span"),E(1),p()),e&2){let t=h(3);l(),q("v",t.installedVersion," \u2192 ")}}function QU(e,u){e&1&&(c(0,"ngb-alert",23)(1,"p",24),E(2),y(3,"translate"),p()()),e&2&&(b("dismissible",!1),l(2),L(B(3,2,"plugins.manage.hb_restart")))}function eH(e,u){if(e&1&&(c(0,"h5",9),w(1,ZU,2,1,"span"),E(2),p(),w(3,QU,4,4,"ngb-alert",23)),e&2){let t=h(2);l(),S(t.installedVersion?1:-1),l(),q(" ",t.targetVersionPretty," "),l(),S(we(3,UU).includes(t.pluginName)?3:-1)}}function tH(e,u){e&1&&(c(0,"div",26),x(1,"i",27),p())}function uH(e,u){if(e&1&&x(0,"markdown",28),e&2){let t=h(4);b("data",t.versionNotes)}}function iH(e,u){e&1&&(c(0,"div",29),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.manage.notes_none")))}function nH(e,u){if(e&1&&(c(0,"div",29),E(1),y(2,"translate"),x(3,"br"),E(4),y(5,"translate"),x(6,"br"),E(7),y(8,"translate"),x(9,"br"),p()),e&2){let t=h(6);l(),q(" ",He(2,3,"plugins.manage.notes_beta_1",tu(10,HU,t.pluginDisplayName))),l(3),q(" ",B(5,6,"plugins.manage.notes_beta_2")),l(3),q(" ",B(8,8,"plugins.manage.notes_beta_3"))}}function fH(e,u){e&1&&(c(0,"div",29),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.manage.notes_latest")))}function rH(e,u){if(e&1&&w(0,nH,10,12,"div",29)(1,fH,3,3,"div",29),e&2){let t=h(5);S(t.targetVersion.includes("beta")||t.targetVersion.includes("alpha")||t.targetVersion.includes("next")?0:1)}}function oH(e,u){if(e&1&&w(0,iH,3,3,"div",29)(1,rH,2,1),e&2){let t=h(4);S(t.versionNotesShow?0:1)}}function aH(e,u){if(e&1&&w(0,uH,1,1,"markdown",28)(1,oH,2,1),e&2){let t=h(3);S(t.versionNotes?0:1)}}function sH(e,u){if(e&1&&(c(0,"div",25),w(1,tH,2,0,"div",26)(2,aH,2,1),p()),e&2){let t=h(2);l(),S(t.action==="Update"&&!t.versionNotesLoaded?1:2)}}function DH(e,u){e&1&&(c(0,"div",26),x(1,"i",27),p())}function lH(e,u){if(e&1&&x(0,"markdown",28),e&2){let t=h(4);b("data",t.fullChangelog)}}function dH(e,u){e&1&&(x(0,"div",31),y(1,"translate")),e&2&&b("innerHTML",B(1,1,"plugins.manage.changelog_none"),me)}function cH(e,u){if(e&1&&w(0,lH,1,1,"markdown",28)(1,dH,2,3,"div",31),e&2){let t=h(3);S(t.fullChangelog?0:1)}}function pH(e,u){if(e&1&&(c(0,"div",30),w(1,DH,2,0,"div",26)(2,cH,2,1),p()),e&2){let t=h(2);l(),S(t.action==="Update"&&!t.fullChangelogLoaded?1:2)}}function mH(e,u){if(e&1){let t=H();c(0,"div",6)(1,"div",9),x(2,"i",17),p(),w(3,eH,4,4),c(4,"ul",18,0),Me("activeIdChange",function(n){j(t);let f=h();return Oe(f.releaseNotesTab,n)||(f.releaseNotesTab=n),N(n)}),c(6,"li",19)(7,"button",20),E(8),y(9,"translate"),p(),se(10,sH,3,1,"ng-template",21),p(),c(11,"li",19)(12,"button",20),E(13),y(14,"translate"),p(),se(15,pH,3,1,"ng-template",21),p()(),x(16,"div",22),p()}if(e&2){let t=C1(5),i=h();l(2),b("ngClass",Yi(12,T6,i.action==="Install"&&!i.installedVersion,i.action==="Install"&&i.installedVersion,i.action==="Update",i.action==="Uninstall")),l(),S(i.latestVersion?3:-1),l(),Pe("activeId",i.releaseNotesTab),l(2),b("ngbNavItem",1),l(2),L(B(9,8,"plugins.manage.notes")),l(3),b("ngbNavItem",2),l(2),L(B(14,10,"plugins.manage.changelog")),l(3),b("ngbNavOutlet",t)}}function FH(e,u){if(e&1){let t=H();c(0,"button",38),y(1,"translate"),M("click",function(){j(t);let n=h(2);return N(n.$activeModal.dismiss("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function CH(e,u){if(e&1){let t=H();c(0,"button",38),y(1,"translate"),M("click",function(){j(t);let n=h(2);return N(n.$activeModal.dismiss("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function hH(e,u){if(e&1){let t=H();c(0,"button",39),M("click",function(){j(t);let n=h(2);return N(n.update())}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"plugins.button_update")," "))}function gH(e,u){if(e&1){let t=H();c(0,"button",39),M("click",function(){j(t);let n=h(2);return N(n.childBridges.length>0?n.onRestartChildBridgeClick():n.onRestartHomebridgeClick())}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"menu.tooltip_restart")," "))}function bH(e,u){if(e&1){let t=H();c(0,"button",40),M("click",function(){j(t);let n=h(2);return N(n.downloadLogFile())}),E(1),y(2,"translate"),p()}e&2&&(l(),L(B(2,1,"form.button_download")))}function EH(e,u){if(e&1&&(c(0,"div",8)(1,"div",32),w(2,FH,4,6,"button",33),p(),c(3,"div",34),w(4,CH,4,6,"button",33),p(),c(5,"div",35),w(6,hH,3,3,"button",36),w(7,gH,3,3,"button",36),w(8,bH,3,3,"button",37),p()()),e&2){let t=h();l(2),S(!t.justUpdatedPlugin&&t.onlineUpdateOk||t.justUpdatedPlugin&&(!t.isDisabled||t.actionFailed)?2:-1),l(2),S(t.justUpdatedPlugin&&t.isDisabled&&!t.actionFailed||!t.onlineUpdateOk?4:-1),l(2),S(t.onlineUpdateOk&&t.releaseNotesShow?6:-1),l(),S(t.justUpdatedPlugin&&!t.isDisabled?7:-1),l(),S(t.actionFailed?8:-1)}}var Zn=(()=>{class e{$activeModal=I(Ae);$api=I(be);$modal=I(it);$router=I(Ut);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);$ws=I(ei);pluginName;pluginDisplayName;targetVersion="latest";latestVersion;installedVersion;isDisabled;action;targetVersionPretty="";actionComplete=!1;actionFailed=!1;justUpdatedPlugin=!1;updateToBeta=!1;childBridges=[];presentTenseVerb;pastTenseVerb;onlineUpdateOk;iconStar='<i class="fas fa-fw fa-star primary-text"></i>';iconThumbsUp='<i class="fas fa-fw fa-thumbs-up primary-text"></i>';versionNotes;versionNotesLoaded=!1;versionNotesShow=!1;fullChangelog;fullChangelogLoaded=!1;releaseNotesShow=!1;releaseNotesTab=1;io;toastSuccess;term=new $6.Terminal;termTarget;fitAddon=new k6.FitAddon;errorLog="";constructor(){this.term.loadAddon(this.fitAddon)}ngOnInit(){switch(this.targetVersionPretty=this.targetVersion==="latest"?`v${this.latestVersion}`:/^\d/.test(this.targetVersion)?`v${this.targetVersion}`:this.targetVersion,this.io=this.$ws.connectToNamespace("plugins"),this.termTarget=document.getElementById("plugin-log-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",t=>{this.term.write(t);let i=t.toString().replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"").trimEnd();i&&(this.errorLog+=`${i}\r
22
+ hb-service start`)}}function ZU(e,u){if(e&1&&(c(0,"span"),E(1),p()),e&2){let t=h(3);l(),q("v",t.installedVersion," \u2192 ")}}function QU(e,u){e&1&&(c(0,"ngb-alert",23)(1,"p",24),E(2),y(3,"translate"),p()()),e&2&&(b("dismissible",!1),l(2),L(B(3,2,"plugins.manage.hb_restart")))}function eH(e,u){if(e&1&&(c(0,"h5",9),w(1,ZU,2,1,"span"),E(2),p(),w(3,QU,4,4,"ngb-alert",23)),e&2){let t=h(2);l(),S(t.installedVersion?1:-1),l(),q(" ",t.targetVersionPretty," "),l(),S(we(3,UU).includes(t.pluginName)?3:-1)}}function tH(e,u){e&1&&(c(0,"div",26),x(1,"i",27),p())}function uH(e,u){if(e&1&&x(0,"markdown",28),e&2){let t=h(4);b("data",t.versionNotes)}}function iH(e,u){e&1&&(c(0,"div",29),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.manage.notes_none")))}function nH(e,u){if(e&1&&(c(0,"div",29),E(1),y(2,"translate"),x(3,"br"),E(4),y(5,"translate"),x(6,"br"),E(7),y(8,"translate"),x(9,"br"),p()),e&2){let t=h(6);l(),q(" ",He(2,3,"plugins.manage.notes_beta_1",tu(10,HU,t.pluginDisplayName))),l(3),q(" ",B(5,6,"plugins.manage.notes_beta_2")),l(3),q(" ",B(8,8,"plugins.manage.notes_beta_3"))}}function fH(e,u){e&1&&(c(0,"div",29),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.manage.notes_latest")))}function rH(e,u){if(e&1&&w(0,nH,10,12,"div",29)(1,fH,3,3,"div",29),e&2){let t=h(5);S(t.targetVersion.includes("beta")||t.targetVersion.includes("alpha")||t.targetVersion.includes("next")?0:1)}}function oH(e,u){if(e&1&&w(0,iH,3,3,"div",29)(1,rH,2,1),e&2){let t=h(4);S(t.versionNotesShow?0:1)}}function aH(e,u){if(e&1&&w(0,uH,1,1,"markdown",28)(1,oH,2,1),e&2){let t=h(3);S(t.versionNotes?0:1)}}function sH(e,u){if(e&1&&(c(0,"div",25),w(1,tH,2,0,"div",26)(2,aH,2,1),p()),e&2){let t=h(2);l(),S(t.action==="Update"&&!t.versionNotesLoaded?1:2)}}function DH(e,u){e&1&&(c(0,"div",26),x(1,"i",27),p())}function lH(e,u){if(e&1&&x(0,"markdown",28),e&2){let t=h(4);b("data",t.fullChangelog)}}function dH(e,u){e&1&&(x(0,"div",31),y(1,"translate")),e&2&&b("innerHTML",B(1,1,"plugins.manage.changelog_none"),me)}function cH(e,u){if(e&1&&w(0,lH,1,1,"markdown",28)(1,dH,2,3,"div",31),e&2){let t=h(3);S(t.fullChangelog?0:1)}}function pH(e,u){if(e&1&&(c(0,"div",30),w(1,DH,2,0,"div",26)(2,cH,2,1),p()),e&2){let t=h(2);l(),S(t.action==="Update"&&!t.fullChangelogLoaded?1:2)}}function mH(e,u){if(e&1){let t=H();c(0,"div",6)(1,"div",9),x(2,"i",17),p(),w(3,eH,4,4),c(4,"ul",18,0),Me("activeIdChange",function(n){j(t);let f=h();return Oe(f.releaseNotesTab,n)||(f.releaseNotesTab=n),N(n)}),c(6,"li",19)(7,"button",20),E(8),y(9,"translate"),p(),se(10,sH,3,1,"ng-template",21),p(),c(11,"li",19)(12,"button",20),E(13),y(14,"translate"),p(),se(15,pH,3,1,"ng-template",21),p()(),x(16,"div",22),p()}if(e&2){let t=C1(5),i=h();l(2),b("ngClass",Yi(12,T6,i.action==="Install"&&!i.installedVersion,i.action==="Install"&&i.installedVersion,i.action==="Update",i.action==="Uninstall")),l(),S(i.latestVersion?3:-1),l(),Pe("activeId",i.releaseNotesTab),l(2),b("ngbNavItem",1),l(2),L(B(9,8,"plugins.manage.notes")),l(3),b("ngbNavItem",2),l(2),L(B(14,10,"plugins.manage.changelog")),l(3),b("ngbNavOutlet",t)}}function FH(e,u){if(e&1){let t=H();c(0,"button",38),y(1,"translate"),M("click",function(){j(t);let n=h(2);return N(n.$activeModal.dismiss("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function CH(e,u){if(e&1){let t=H();c(0,"button",38),y(1,"translate"),M("click",function(){j(t);let n=h(2);return N(n.$activeModal.dismiss("Dismiss"))}),E(2),y(3,"translate"),p()}e&2&&(G("aria-label",B(1,2,"form.button_close")),l(2),q(" ",B(3,4,"form.button_close")," "))}function hH(e,u){if(e&1){let t=H();c(0,"button",39),M("click",function(){j(t);let n=h(2);return N(n.update())}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"form.label_continue")," "))}function gH(e,u){if(e&1){let t=H();c(0,"button",39),M("click",function(){j(t);let n=h(2);return N(n.childBridges.length>0?n.onRestartChildBridgeClick():n.onRestartHomebridgeClick())}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"menu.tooltip_restart")," "))}function bH(e,u){if(e&1){let t=H();c(0,"button",40),M("click",function(){j(t);let n=h(2);return N(n.downloadLogFile())}),E(1),y(2,"translate"),p()}e&2&&(l(),L(B(2,1,"form.button_download")))}function EH(e,u){if(e&1&&(c(0,"div",8)(1,"div",32),w(2,FH,4,6,"button",33),p(),c(3,"div",34),w(4,CH,4,6,"button",33),p(),c(5,"div",35),w(6,hH,3,3,"button",36),w(7,gH,3,3,"button",36),w(8,bH,3,3,"button",37),p()()),e&2){let t=h();l(2),S(!t.justUpdatedPlugin&&t.onlineUpdateOk||t.justUpdatedPlugin&&(!t.isDisabled||t.actionFailed)?2:-1),l(2),S(t.justUpdatedPlugin&&t.isDisabled&&!t.actionFailed||!t.onlineUpdateOk?4:-1),l(2),S(t.onlineUpdateOk&&t.releaseNotesShow?6:-1),l(),S(t.justUpdatedPlugin&&!t.isDisabled?7:-1),l(),S(t.actionFailed?8:-1)}}var Zn=(()=>{class e{$activeModal=I(Ae);$api=I(be);$modal=I(it);$router=I(Ut);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);$ws=I(ei);pluginName;pluginDisplayName;targetVersion;latestVersion;installedVersion;isDisabled;action;targetVersionPretty="";actionComplete=!1;actionFailed=!1;justUpdatedPlugin=!1;updateToBeta=!1;childBridges=[];presentTenseVerb;pastTenseVerb;onlineUpdateOk;iconStar='<i class="fas fa-fw fa-star primary-text"></i>';iconThumbsUp='<i class="fas fa-fw fa-thumbs-up primary-text"></i>';versionNotes;versionNotesLoaded=!1;versionNotesShow=!1;fullChangelog;fullChangelogLoaded=!1;releaseNotesShow=!1;releaseNotesTab=1;io;toastSuccess;term=new $6.Terminal;termTarget;fitAddon=new k6.FitAddon;errorLog="";constructor(){this.term.loadAddon(this.fitAddon)}ngOnInit(){switch(this.targetVersionPretty=this.targetVersion==="latest"?`v${this.latestVersion}`:/^\d/.test(this.targetVersion)?`v${this.targetVersion}`:this.targetVersion,this.io=this.$ws.connectToNamespace("plugins"),this.termTarget=document.getElementById("plugin-log-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",t=>{this.term.write(t);let i=t.toString().replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"").trimEnd();i&&(this.errorLog+=`${i}\r
23
23
  `)}),this.toastSuccess=this.$translate.instant("toast.title_success"),this.onlineUpdateOk=!(["homebridge","homebridge-config-ui-x"].includes(this.pluginName)&&this.$settings.env.platform==="win32"),this.action){case"Install":this.install(),this.presentTenseVerb=this.$translate.instant("plugins.manage.install"),this.pastTenseVerb=this.$translate.instant("plugins.manage.installed");break;case"Uninstall":this.uninstall(),this.presentTenseVerb=this.$translate.instant("plugins.manage.uninstall"),this.pastTenseVerb=this.$translate.instant("plugins.manage.uninstalled");break;case"Update":switch(this.targetVersion){case"latest":this.updateToBeta=!1;break;case"alpha":case"beta":case"test":this.updateToBeta=!0;break}this.presentTenseVerb=this.$translate.instant("plugins.manage.update"),this.pastTenseVerb=this.$translate.instant("plugins.manage.updated"),this.getVersionNotes();break}}install(){if(this.onlineUpdateOk){if(this.pluginName==="homebridge")return this.upgradeHomebridge();this.io.request("install",{name:this.pluginName,version:this.targetVersion,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(`${this.pastTenseVerb} ${this.pluginName}`,this.toastSuccess),window.location.href=`/plugins?action=just-installed&plugin=${this.pluginName}`},error:t=>{this.actionFailed=!0,console.error(t),this.$router.navigate(["/plugins"]),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}}uninstall(){this.io.request("uninstall",{name:this.pluginName,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.$activeModal.close(),this.$router.navigate(["/plugins"]),this.$modal.open(pu,{size:"lg",backdrop:"static"})},error:t=>{this.actionFailed=!0,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}update(){if(this.releaseNotesShow=!1,this.versionNotes="",this.fullChangelog="",!!this.onlineUpdateOk){if(this.pluginName==="homebridge")return this.upgradeHomebridge();this.io.request("update",{name:this.pluginName,version:this.targetVersion,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>K(this,null,function*(){if(this.pluginName==="homebridge-config-ui-x"){this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{window.location.href="/restart"},error:t=>{console.error(t),window.location.href="/restart"}});return}try{yield this.getChildBridges()}catch(t){console.error(t)}this.actionComplete=!0,this.justUpdatedPlugin=!0,this.$router.navigate(["/plugins"])}),error:t=>{this.actionFailed=!0,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}}upgradeHomebridge(){return K(this,null,function*(){let t="update";if(Number(this.installedVersion.split(".")[0])<2&&["2","alpha","beta"].includes(this.targetVersion.split(".")[0])){let i=this.$modal.open(I6,{size:"lg",backdrop:"static"});i.componentInstance.isUpdating=!0,t=yield i.result}t==="update"?this.io.request("homebridge-update",{version:this.targetVersion,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.$activeModal.close(),this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$router.navigate(["/restart"])},error:i=>{console.error(i),this.$router.navigate(["/restart"])}})},error:i=>{this.actionFailed=!0,console.error(i),this.$toastr.error(i.message,this.$translate.instant("toast.title_error")),this.$activeModal.close()}}):this.$activeModal.close()})}getVersionNotes(){return K(this,null,function*(){this.releaseNotesShow=!0;try{let t=yield re(this.$api.get(`/plugins/changelog/${encodeURIComponent(this.pluginName)}`));this.fullChangelog=t.changelog,t.latestVersion&&(this.latestVersion=t.latestVersion)}catch(t){console.error("Error loading changelog:",t),this.fullChangelog=""}if(this.targetVersion==="latest"||this.targetVersion===this.latestVersion?this.versionNotesShow=!0:(this.versionNotesShow=!1,this.versionNotesLoaded=!0),this.versionNotesShow)try{let t=yield re(this.$api.get(`/plugins/release/${encodeURIComponent(this.pluginName)}`));this.latestVersion.replace(/[^0-9.]/g,"").includes(t.name.replace(/[^0-9.]/g,""))&&(this.versionNotes=t.changelog)}catch(t){console.error("Error loading release notes:",t),this.versionNotes=""}this.fullChangelogLoaded=!0,this.versionNotesLoaded=!0})}getChildBridges(){return K(this,null,function*(){(yield re(this.$api.get("/status/homebridge/child-bridges"))).forEach(i=>{this.pluginName===i.plugin&&this.childBridges.push(i)})})}onRestartHomebridgeClick(){this.$router.navigate(["/restart"]),this.$activeModal.close()}onRestartChildBridgeClick(){return K(this,null,function*(){try{for(let i of this.childBridges)yield re(this.$api.put(`/server/restart/${i.username}`,{}));let t=this.$modal.open(w6,{size:"xl",backdrop:"static"});t.componentInstance.plugin={name:this.pluginName}}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("plugins.manage.child_bridge_restart_failed"),this.$translate.instant("toast.title_error"))}finally{this.$activeModal.close()}})}downloadLogFile(){let t=new Blob([this.errorLog],{type:"text/plain;charset=utf-8"});(0,A6.saveAs)(t,`${this.pluginName}-error.log`)}ngOnDestroy(){this.io.end()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{pluginName:"pluginName",pluginDisplayName:"pluginDisplayName",targetVersion:"targetVersion",latestVersion:"latestVersion",installedVersion:"installedVersion",isDisabled:"isDisabled",action:"action"},decls:11,vars:9,consts:[["nav","ngbNav"],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],["id","plugin-log-output",1,"modal-body",3,"hidden"],[1,"modal-body","plugin-modal-body"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"mb-3","text-center"],[1,"far","fa-fw","fa-check-circle","primary-text",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"mb-3","text-center","grey-text",3,"innerHTML"],[1,"text-center","mb-0"],[1,"fas","fa-fw","primary-text",2,"font-size","75px",3,"ngClass"],[1,"mb-3"],[1,"p-2","mb-0"],[1,"far","fa-fw","primary-text",2,"font-size","75px",3,"ngClass"],["ngbNav","",1,"nav-tabs","px-0",3,"activeIdChange","activeId"],[1,"w-50","m-0",3,"ngbNavItem"],["ngbNavLink","",1,"w-100","release-tab"],["ngbNavContent",""],[1,"mt-2",3,"ngbNavOutlet"],["type","warning",1,"mb-3",3,"dismissible"],[1,"w-100","text-center","mb-0"],[1,"alert","release-notes","p-3","pb-1","my-0"],[1,"w-100","text-center","primary-text","mt-3","mb-4"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"plugin-md",3,"data"],[1,"w-100","text-center","grey-text","mt-3","mb-4"],[1,"alert","release-notes","p-3","pb-1","my-0",2,"border-top-left-radius","0","border-top-right-radius","0"],[1,"w-100","text-center","grey-text","mt-3","mb-4",3,"innerHTML"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-primary"],[1,"btn","btn-primary"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button",1,"btn","btn-primary",3,"click"],[1,"btn","btn-primary",3,"click"]],template:function(i,n){i&1&&(c(0,"div",1)(1,"div",2)(2,"h5",3),E(3),p(),c(4,"button",4),y(5,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),x(6,"div",5),w(7,XU,2,1,"div",6),w(8,YU,12,14,"div",7),w(9,mH,17,17,"div",6),w(10,EH,9,5,"div",8),p()),i&2&&(l(3),L(n.pluginDisplayName),l(),G("aria-label",B(5,7,"form.button_close")),l(2),b("hidden",!n.onlineUpdateOk||n.actionComplete||n.releaseNotesShow),l(),S(n.actionComplete?7:-1),l(),S(n.onlineUpdateOk?-1:8),l(),S(n.releaseNotesShow&&!n.actionComplete&&n.onlineUpdateOk?9:-1),l(),S(!n.onlineUpdateOk||n.actionComplete||n.releaseNotesShow||n.actionFailed?10:-1))},dependencies:[Yr,Xr,is,$e,zt,cu,O1,T1,k1,$1,P1],styles:[".plugin-modal-body[_ngcontent-%COMP%] .release-notes[_ngcontent-%COMP%]{box-shadow:none;max-height:39vh;overflow:auto;border:0;border-top-left-radius:0;border-top-right-radius:0}.plugin-modal-body[_ngcontent-%COMP%] .release-tab[_ngcontent-%COMP%]{font-size:1rem;color:#d3d3d3}.plugin-modal-body[_ngcontent-%COMP%] .tab-content[_ngcontent-%COMP%]{border-radius:0 0 20px 20px} .nav-tabs{--bs-nav-tabs-border-width: 0} .plugin-md{text-align:left;font-size:.85rem;word-wrap:break-word} .plugin-md img{max-width:100%} .plugin-md h1{font-size:1.3rem;font-weight:300} .plugin-md h2{font-size:1.2rem;font-weight:300} .plugin-md h3{font-size:1.1rem;font-weight:300} .plugin-md h4{font-size:1rem;font-weight:300} .plugin-md h5{font-size:.9rem;font-weight:300} .plugin-md pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px}"]})}return e})();var O6=Re(Jr(),1);var P6=()=>["homebridge","homebridge-config-ui-x"];function _H(e,u){e&1&&(c(0,"div",5),x(1,"i",12),p())}function yH(e,u){if(e&1&&(x(0,"i",21),c(1,"h6",22),E(2),y(3,"translate"),p(),c(4,"p",22),E(5),y(6,"translate"),c(7,"span",23),E(8),p()()),e&2){let t=h(2);l(2),L(B(3,3,"plugins.manage.select_version")),l(3),q(" ",B(6,5,"plugins.status_installed"),": "),l(3),q("v",t.plugin.installedVersion)}}function vH(e,u){e&1&&(x(0,"i",24),c(1,"h6",22),E(2),y(3,"translate"),p()),e&2&&(l(2),L(B(3,1,"plugins.manage.select_version")))}function BH(e,u){e&1&&(c(0,"ngb-alert",13)(1,"p",25),E(2),y(3,"translate"),p()()),e&2&&(b("dismissible",!1),l(2),L(B(3,2,"plugins.manage.hb_restart")))}function xH(e,u){if(e&1){let t=H();c(0,"button",29),M("click",function(){j(t);let n=h().$implicit,f=h(2);return N(f.doInstall(n.version))}),x(1,"i",30),p()}}function wH(e,u){e&1&&(c(0,"button",28),x(1,"i",31),p())}function SH(e,u){if(e&1&&(c(0,"li",15)(1,"span",8),E(2),x(3,"br"),c(4,"small",26),E(5),p()(),w(6,xH,2,0,"button",27)(7,wH,2,0,"button",28),p()),e&2){let t=u.$implicit,i=h(2);l(2),q(" ",t.tag," "),l(3),q("v",t.version),l(),S(i.plugin.installedVersion!==t.version?6:7)}}function IH(e,u){e&1&&E(0," \u2713 ")}function AH(e,u){if(e&1&&(c(0,"option",18),E(1),w(2,IH,1,0),p()),e&2){let t=u.$implicit,i=h(2);b("value",t.version)("selected",i.versionSelect==t.version),l(),q(" v",t.version," "),l(),S(t.version==i.plugin.installedVersion?2:-1)}}function $H(e,u){e&1&&x(0,"i",31)}function kH(e,u){e&1&&x(0,"i",30)}function TH(e,u){if(e&1){let t=H();c(0,"button",32),M("click",function(){j(t);let n=h(2);return N(n.doInstall(n.versionSelect))}),w(1,$H,1,0,"i",31)(2,kH,1,0,"i",30),p()}if(e&2){let t=h(2);b("disabled",t.versionSelect===t.plugin.installedVersion),l(),S(t.versionSelect===t.plugin.installedVersion?1:2)}}function PH(e,u){if(e&1&&(c(0,"ul",20)(1,"li",33)(2,"div",8),E(3),y(4,"translate"),x(5,"br"),c(6,"span",34),E(7),y(8,"translate"),p()(),c(9,"div",35),x(10,"input",36),y(11,"translate"),x(12,"label",37),p()()()),e&2){let t=h(2);l(3),q(" ",B(4,4,"plugins.manage.hide_updates")),l(4),L(B(8,6,"plugins.manage.hide_updates_desc")),l(3),b("formControl",t.hideUpdatesFormControl),G("aria-label",B(11,8,"plugins.manage.hide_updates"))}}function OH(e,u){if(e&1){let t=H();c(0,"div",6),w(1,yH,9,7)(2,vH,4,3),w(3,BH,4,4,"ngb-alert",13),c(4,"ul",14),ft(5,SH,8,3,"li",15,nt),c(7,"li",15)(8,"div",16),E(9),y(10,"translate"),x(11,"br"),c(12,"select",17),Me("ngModelChange",function(n){j(t);let f=h();return Oe(f.versionSelect,n)||(f.versionSelect=n),N(n)}),ft(13,AH,3,4,"option",18,nt),p()(),w(15,TH,3,2,"button",19),p()(),w(16,PH,13,10,"ul",20),p()}if(e&2){let t=h();l(),S(t.plugin.installedVersion?1:2),l(2),S(we(8,P6).includes(t.plugin.name)?3:-1),l(2),rt(t.versionsWithTags),l(4),q(" ",B(10,6,"plugins.manage.all_versions")," "),l(3),Pe("ngModel",t.versionSelect),l(),rt(t.versions),l(2),S(t.versionSelect?15:-1),l(),S(t.plugin.installedVersion&&!we(9,P6).includes(t.plugin.name)?16:-1)}}var M6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$router=I(Ut);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);plugin;isUpdateHidden=!1;hideUpdatesFormControl=new w1(!1);loading=!0;versions=[];versionsWithTags=[];versionSelect;constructor(){}ngOnInit(){this.versionSelect=this.plugin.installedVersion||this.plugin.latestVersion,this.lookupVersions(),this.isUpdateHidden=this.$settings.env.plugins.hideUpdatesFor&&this.$settings.env.plugins.hideUpdatesFor.includes(this.plugin.name),this.hideUpdatesFormControl.patchValue(this.isUpdateHidden),this.hideUpdatesFormControl.valueChanges.pipe(Gi(750)).subscribe(t=>this.toggleHideUpdates(t))}lookupVersions(){this.$api.get(`/plugins/lookup/${encodeURIComponent(this.plugin.name)}/versions`).subscribe({next:t=>{let i=new Set;for(let[n,f]of Object.entries(t.versions)){this.versions.push({version:n,engines:f.engines||null});let r=Object.keys(t.tags).find(o=>t.tags[o]===n);r&&(this.versionsWithTags.push({version:n,tag:r}),i.add(n))}this.versions.sort((n,f)=>(0,O6.rcompare)(n.version,f.version)),this.versionsWithTags.sort((n,f)=>{let r=["latest","next","beta","alpha"],o=r.includes(n.tag)?r.indexOf(n.tag):999,a=r.includes(f.tag)?r.indexOf(f.tag):999;return o-a}),!this.versions.find(n=>n.version===this.versionSelect)&&t.tags.latest&&(this.versionSelect=t.tags.latest),this.loading=!1},error:t=>{console.error(t),this.$toastr.error(t.error.message||t.message,this.$translate.instant("toast.title_error")),this.$activeModal.dismiss()}})}doInstall(t){this.$activeModal.close({name:this.plugin.name,version:t,engines:this.versions.find(i=>i.version===t).engines,action:this.plugin.installedVersion?"alternate":"install"})}toggleHideUpdates(t){return K(this,null,function*(){let i=this.$settings.env.plugins?.hideUpdatesFor||[];t?i.includes(this.plugin.name)||(i=[...i,this.plugin.name].sort((n,f)=>n.localeCompare(f))):i=i.filter(n=>n!==this.plugin.name);try{yield re(this.$api.put("/config-editor/ui/plugins/hide-updates-for",{body:i})),this.$settings.setEnvItem("plugins.hideUpdatesFor",i),window.location.href=`/plugins?action=open-manage-version&plugin=${this.plugin.name}`}catch(n){this.hideUpdatesFormControl.patchValue(this.isUpdateHidden,{emitEvent:!1}),console.error(n),this.$toastr.error(n.message,this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:17,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","d-flex","flex-row","flex-grow-1","w-100"],[1,"w-100","text-center","primary-text"],[1,"w-100","text-center"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],["type","warning",1,"mb-3",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"text-start",2,"min-width","50%"],[1,"custom-select","w-100",2,"font-size","0.875rem",3,"ngModelChange","ngModel"],[3,"value","selected"],[1,"btn","btn-primary","m-0","ms-3",3,"disabled"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"fas","fa-fw","fa-code-compare","primary-text","mb-3",2,"font-size","75px"],[1,"mb-3"],[1,"font-monospace"],[1,"far","fa-fw","fa-arrow-alt-circle-down","primary-text","mb-3",2,"font-size","75px"],[1,"w-100","text-center","mb-0"],[1,"grey-text","font-monospace"],[1,"btn","btn-primary","m-0","ms-3"],["disabled","",1,"btn","btn-primary","m-0","ms-3"],[1,"btn","btn-primary","m-0","ms-3",3,"click"],[1,"fas","fa-fw","fa-arrow-alt-circle-down"],[1,"fas","fa-fw","fa-check-circle"],[1,"btn","btn-primary","m-0","ms-3",3,"click","disabled"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"grey-text","small"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","hidePluginUpdates",1,"rendux-input",3,"formControl"],["for","hidePluginUpdates",1,"rendux-label","ms-3"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),p(),c(4,"button",3),y(5,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(6,"div",4),w(7,_H,2,0,"div",5)(8,OH,17,10,"div",6),p(),c(9,"div",7),x(10,"div",8),c(11,"div",9)(12,"button",10),y(13,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),E(14),y(15,"translate"),p()(),x(16,"div",11),p()()),i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),G("aria-label",B(5,5,"form.button_close")),l(3),S(n.loading?7:8),l(5),G("aria-label",B(13,7,"form.button_close")),l(2),q(" ",B(15,9,"form.button_close")," "))},dependencies:[uu,wi,Si,Xu,Qi,vt,Yu,$e,cu,nf,Zu],encapsulation:2})}return e})();var j6=Re(nb(),1);function MH(e,u){e&1&&(c(0,"div",5),x(1,"i",14),p())}function jH(e,u){e&1&&(c(0,"div",6),E(1),y(2,"translate"),y(3,"translate"),p()),e&2&&(l(),vi(" ",B(2,2,"plugins.settings.message_manual_config_required")," ",B(3,4,"plugins.settings.message_consult_documentation")," "))}function NH(e,u){if(e&1){let t=H();c(0,"button",25),y(1,"translate"),M("click",function(){j(t);let n=h(2).$index,f=h(2);return N(f.removeBlock(n))}),x(2,"i",26),p()}e&2&&b("ngbTooltip",B(1,1,"form.button_delete"))}function qH(e,u){if(e&1&&w(0,NH,3,3,"button",24),e&2){let t=h(3);S(!(t.schema!=null&&t.schema.singular)||t.pluginConfig.length>1?0:-1)}}function VH(e,u){if(e&1){let t=H();c(0,"div",15)(1,"div",16)(2,"div",17)(3,"h5",18),E(4),p(),c(5,"div"),w(6,qH,1,1),c(7,"button",19),y(8,"translate"),M("click",function(){let n=j(t).$index,f=h(2);return N(f.editBlock(n))}),x(9,"i",20),p()()()(),c(10,"div",21)(11,"div",22)(12,"ngx-monaco-editor",23),Me("ngModelChange",function(n){j(t);let f=h(2);return Oe(f.currentBlock,n)||(f.currentBlock=n),N(n)}),M("onInit",function(n){j(t);let f=h(2);return N(f.onEditorInit(n))}),p()()()()}if(e&2){let t=u.$implicit,i=u.$index,n=h(2);b("ngbAccordionItem","configBlock."+i)("collapsed",n.show!=="configBlock."+i)("id","configBlock."+i),l(4),L(t.name||n.pluginAlias),l(2),S(n.show==="configBlock."+i?6:-1),l(),b("ngbTooltip",B(8,8,"form.button_edit")),l(5),b("options",n.editorOptions),Pe("ngModel",n.currentBlock)}}function RH(e,u){if(e&1&&(c(0,"div",7),ft(1,VH,13,10,"div",15,nt),p()),e&2){let t=h();b("closeOthers",!0),l(),rt(t.pluginConfig)}}function LH(e,u){if(e&1){let t=H();c(0,"button",30),M("click",function(){j(t);let n=h(2);return N(n.addBlock())}),x(1,"i",31),p()}}function zH(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"form.button_save")," ")}function UH(e,u){e&1&&x(0,"i",29)}function HH(e,u){if(e&1){let t=H();w(0,LH,2,0,"button",27),c(1,"button",28),M("click",function(){j(t);let n=h();return N(n.save())}),w(2,zH,2,3),w(3,UH,1,0,"i",29),p()}if(e&2){let t=h();S(t.schema!=null&&t.schema.singular?-1:0),l(),b("disabled",t.saveInProgress),l(),S(t.saveInProgress?-1:2),l(),S(t.saveInProgress?3:-1)}}function WH(e,u){if(e&1){let t=H();c(0,"button",32),M("click",function(){j(t);let n=h();return N(n.openFullConfigEditor())}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"plugins.settings.label_open_config_editor")," "))}var Yl=(()=>{class e{$activeModal=I(Ae);$api=I(be);$md=I(N1);$modal=I(it);$plugin=I(_i);$router=I(Ut);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);plugin;schema;pluginAlias;pluginType;loading=!0;canConfigure=!1;show="";pluginConfig;currentBlock;currentBlockIndex=null;saveInProgress=!1;childBridges=[];isFirstSave=!1;monacoEditor;editorOptions;constructor(){}get arrayKey(){return this.pluginType==="accessory"?"accessories":"platforms"}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0},this.$md.detect.mobile()?(this.loading=!1,this.canConfigure=!1):this.loadPluginAlias()}onEditorInit(t){return K(this,null,function*(){window.editor=t,this.monacoEditor=t,yield this.monacoEditor.getModel().setValue(this.currentBlock),yield this.monacoEditor.getAction("editor.action.formatDocument").run()})}loadPluginAlias(){this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{t.pluginAlias&&t.pluginType?(this.pluginAlias=t.pluginAlias,this.pluginType=t.pluginType,this.loadHomebridgeConfig()):this.loading=!1},error:()=>{this.loading=!1}})}loadHomebridgeConfig(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe(t=>{this.pluginConfig=t,this.canConfigure=!0,this.loading=!1,this.pluginConfig.length?this.editBlock(0):(this.isFirstSave=!0,this.addBlock())})}addBlock(){if(!this.saveCurrentBlock()){this.$toastr.error(this.$translate.instant("plugins.config.please_fix"),this.$translate.instant("toast.title_error"));return}this.pluginConfig.push({[this.pluginType]:this.pluginAlias,name:this.pluginAlias}),this.editBlock(this.pluginConfig.length-1)}saveCurrentBlock(){if(this.currentBlockIndex!==null&&this.monacoEditor){let t=this.monacoEditor.getModel().getValue().trim(),i;t.charAt(0)==='"'&&t.charAt(t.length-1)==="]"&&(t=`{${t}}`);try{i=j6.default.parse(t)}catch(f){return console.error(f),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error")),!1}if(Array.isArray(i)||typeof i!="object")return this.$toastr.error(this.$translate.instant("plugins.config.must_be_object"),this.$translate.instant("toast.title_error")),!1;if(!i[this.pluginType]&&Array.isArray(i[this.arrayKey])&&i[this.arrayKey].length&&Object.keys(i).length===1&&(i=i[this.arrayKey][0]),this.pluginType==="accessory"&&(!i.name||typeof i.name!="string"))return this.$toastr.error(this.$translate.instant("plugins.config.name_property"),this.$translate.instant("toast.title_error")),i.name="",this.monacoEditor.getModel().setValue(JSON.stringify(i,null,4)),!1;let n=this.pluginConfig[this.currentBlockIndex];Object.keys(n).forEach(f=>delete n[f]),Object.assign(n,i),n[this.pluginType]=this.pluginAlias}return!0}editBlock(t){this.saveCurrentBlock()&&(this.show=`configBlock.${t}`,this.currentBlockIndex=t,this.currentBlock=JSON.stringify(this.pluginConfig[this.currentBlockIndex],null,4))}removeBlock(t){let i=this.pluginConfig[t],n=this.pluginConfig.findIndex(f=>f===i);n>-1&&this.pluginConfig.splice(n,1),this.currentBlockIndex=null,this.currentBlock=void 0,this.show=""}save(){return K(this,null,function*(){if(this.saveInProgress=!0,!this.saveCurrentBlock()){this.saveInProgress=!1;return}try{let t=yield re(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,this.pluginConfig));if(this.$activeModal.close(),this.isFirstSave&&this.$settings.env.recommendChildBridges&&t[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(this.plugin,!0);return}if(!["homebridge","homebridge-config-ui-x"].includes(this.plugin.name)&&(yield this.getChildBridges(),this.childBridges.length>0)){this.$activeModal.close();let i=this.$modal.open(tn,{size:"lg",backdrop:"static"});i.componentInstance.bridges=this.childBridges.map(n=>({name:n.name,username:n.username}));return}this.$activeModal.close(),this.$modal.open(pu,{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")),this.saveInProgress=!1}})}openFullConfigEditor(){this.$router.navigate(["/config"]),this.$activeModal.close()}getChildBridges(){return K(this,null,function*(){try{(yield re(this.$api.get("/status/homebridge/child-bridges"))).forEach(i=>{this.plugin.name===i.plugin&&this.childBridges.push(i)})}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error")),this.childBridges=[]}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",schema:"schema"},decls:19,vars:14,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body","pb-0"],[1,"text-center","primary-text"],[1,"alert","alert-warning","mb-0"],["ngbAccordion","",3,"closeOthers"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],[1,"btn","btn-primary"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"card",3,"ngbAccordionItem","collapsed","id"],["ngbAccordionHeader","",1,"card-header"],[1,"d-flex","align-items-center","justify-content-between"],[1,"m-0"],["ngbAccordionToggle","","container","modal","openDelay","150","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","ngbTooltip"],[1,"fa","fa-fw","fa-edit"],["ngbAccordionCollapse",""],["ngbAccordionBody","",1,"card-body","p-0",2,"height","400px"],[1,"flex-grow-1","h-100","w-100","mb-0","pb-0",3,"ngModelChange","onInit","options","ngModel"],["container","modal","openDelay","150","triggers","hover",1,"btn","btn-danger","m-0","ms-3",3,"ngbTooltip"],["container","modal","openDelay","150","triggers","hover",1,"btn","btn-danger","m-0","ms-3",3,"click","ngbTooltip"],[1,"fa","fa-fw","fa-trash"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","me-2"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","me-2",3,"click"],[1,"fa","fa-fw","fa-plus"],[1,"btn","btn-primary",3,"click"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),p(),c(4,"button",3),y(5,"translate"),M("click",function(){return n.$activeModal.close()}),p()(),c(6,"div",4),w(7,MH,2,0,"div",5),w(8,jH,4,6,"div",6),w(9,RH,3,1,"div",7),p(),c(10,"div",8)(11,"div",9)(12,"button",10),M("click",function(){return n.$activeModal.close()}),E(13),y(14,"translate"),p()(),x(15,"div",11),c(16,"div",12),w(17,HH,4,4),w(18,WH,3,3,"button",13),p()()()),i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),b("disabled",n.saveInProgress),G("aria-label",B(5,10,"form.button_close")),l(3),S(n.loading?7:-1),l(),S(!n.loading&&!n.canConfigure?8:-1),l(),S(!n.loading&&n.canConfigure?9:-1),l(3),b("disabled",n.saveInProgress),l(),q(" ",B(14,12,"form.button_close")," "),l(4),S(n.canConfigure?17:-1),l(),S(n.canConfigure?-1:18))},dependencies:[Gr,Kr,Wr,en,Ur,zr,M1,uu,vt,Yu,$e,Hr],styles:[".no-padding-card-body .card-body{padding:0!important} body.dark-mode .no-padding-card-body .card-body{background-color:#1e1e1e}.manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}"]})}return e})();var N6=e=>({link:e}),KH=(e,u)=>({"green-text":e,"grey-text":u});function GH(e,u){if(e&1){let t=H();c(0,"button",13),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),p()}if(e&2){let t=h();b("disabled",t.saveInProgress),G("aria-label",B(1,2,"form.button_close"))}}function JH(e,u){e&1&&(c(0,"div",5),x(1,"i",14),p())}function XH(e,u){e&1&&(c(0,"li"),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"child_bridge.bridges_paired_2")))}function YH(e,u){e&1&&(c(0,"li"),E(1),y(2,"translate"),p()),e&2&&(l(),q("",B(2,1,"child_bridge.select_type"),":"))}function ZH(e,u){if(e&1&&(c(0,"li"),E(1),y(2,"translate"),p(),w(3,XH,3,3,"li"),w(4,YH,3,3,"li")),e&2){let t=h(2);l(),L(B(2,3,"child_bridge.bridges_paired")),l(2),S(t.configBlocks.length===1&&!t.deviceInfo[t.configBlocks[0]._bridge==null?null:t.configBlocks[0]._bridge.username]&&t.originalBridges.length===0?3:-1),l(),S(t.canConfigure?4:-1)}}function QH(e,u){if(e&1&&(c(0,"option",29),E(1),p()),e&2){let t=u.$implicit,i=u.$index;b("value",i),l(),L(t.name||t.platform||t.accessory)}}function eW(e,u){if(e&1){let t=H();c(0,"li",25),E(1),y(2,"translate"),p(),c(3,"li",23)(4,"label",26),E(5),y(6,"translate"),p(),c(7,"div",27)(8,"select",28),Me("ngModelChange",function(n){j(t);let f=h(3);return Oe(f.selectedBlock,n)||(f.selectedBlock=n),N(n)}),M("change",function(n){j(t);let f=h(3);return N(f.onBlockChange(n.target.value))}),ft(9,QH,2,2,"option",29,nt),p()()()}if(e&2){let t=h(3);l(),L(B(2,3,"form.label.changes_kept")),l(4),q(" ",B(6,5,t.isPlatform?"child_bridge.config.platform":"child_bridge.config.accessory")," "),l(3),Pe("ngModel",t.selectedBlock),l(),rt(t.configBlocks)}}function tW(e,u){if(e&1&&(c(0,"li",23)(1,"label",30),E(2),y(3,"translate"),p(),c(4,"div",31),E(5),p()()),e&2){let t=h(3);l(2),q(" ",B(3,2,t.isPlatform?"child_bridge.config.platform":"child_bridge.config.accessory")," "),l(3),q(" ",t.configBlocks[t.selectedBlock].name||t.configBlocks[t.selectedBlock].platform||t.configBlocks[t.selectedBlock].accessory," ")}}function uW(e,u){e&1&&(c(0,"li",23)(1,"label",30),E(2),y(3,"translate"),p(),c(4,"div",32),E(5),y(6,"translate"),p()()),e&2&&(l(2),L(B(3,2,"child_bridge.config.use")),l(3),q(" ",B(6,4,"child_bridge.config.prevent")," "))}function iW(e,u){if(e&1&&(c(0,"option",29),E(1),p()),e&2){let t=u.$implicit;b("value",t.username),l(),vi("",t.name," (",t.username,")")}}function nW(e,u){if(e&1){let t=H();c(0,"li",23)(1,"label",37),E(2),y(3,"translate"),p(),c(4,"div",27)(5,"select",38),M("change",function(n){j(t);let f=h(4);return N(f.onLinkBridgeChange(n.target.value))}),c(6,"option",29),E(7),y(8,"translate"),p(),ft(9,iW,2,3,"option",29,nt),p()()()}if(e&2){let t=h(4);l(2),L(B(3,2,"child_bridge.config.or_link")),l(5),L(B(8,4,"child_bridge.config.select_existing")),l(2),rt(t.bridgesAvailableForLink)}}function fW(e,u){if(e&1){let t=H();c(0,"li",33)(1,"span",7),E(2),y(3,"translate"),p(),c(4,"div",34)(5,"input",35),M("change",function(){j(t);let n=h(3);return N(n.toggleExternalBridge(n.configBlocks[n.selectedBlock],n.enabledBlocks[n.selectedBlock],n.selectedBlock))}),Me("ngModelChange",function(n){j(t);let f=h(3);return Oe(f.enabledBlocks[f.selectedBlock],n)||(f.enabledBlocks[f.selectedBlock]=n),N(n)}),p(),x(6,"label",36),p()(),w(7,nW,11,6,"li",23)}if(e&2){let t=h(3);l(2),L(B(3,5,"child_bridge.config.use")),l(3),b("id","toggleExternalBridgeInput_"+t.selectedBlock),Pe("ngModel",t.enabledBlocks[t.selectedBlock]),l(),b("for","toggleExternalBridgeInput_"+t.selectedBlock),l(),S(!(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username)&&t.bridgesAvailableForLink.length?7:-1)}}function rW(e,u){if(e&1&&(c(0,"li",23)(1,"label",30),E(2),y(3,"translate"),p(),c(4,"div",31),E(5),p()(),c(6,"li",23)(7,"label",30),E(8),y(9,"translate"),p(),c(10,"div",31),E(11),p()(),c(12,"li",23)(13,"label",30),E(14),y(15,"translate"),p(),c(16,"div",31),E(17),p()()),e&2){let t=h(3);l(2),L(B(3,6,"accessories.bridge_link_username")),l(3),q(" ",t.currentlySelectedLink.username," "),l(3),L(B(9,8,"accessories.bridge_link_port")),l(3),q(" ",t.currentlySelectedLink.port," "),l(3),L(B(15,10,"accessories.bridge_link_name")),l(3),q(" ",t.currentlySelectedLink.name," ")}}function oW(e,u){e&1&&(c(0,"span"),E(1),y(2,"translate"),p()),e&2&&(l(),q(" \xB7 ",B(2,1,"status.code_scan")," "))}function aW(e,u){if(e&1){let t=H();c(0,"li",33)(1,"span",7),E(2),y(3,"translate"),c(4,"code"),E(5,"-D"),p()(),c(6,"div",34)(7,"input",51),y(8,"translate"),Me("ngModelChange",function(n){j(t);let f=h(5);return Oe(f.configBlocks[f.selectedBlock]._bridge.debugModeEnabled,n)||(f.configBlocks[f.selectedBlock]._bridge.debugModeEnabled=n),N(n)}),p(),x(9,"label",36),p()()}if(e&2){let t=h(5);l(2),q("",B(3,5,"child_bridge.config.debug")," "),l(5),b("id","homebridgeDebugMode_"+t.selectedBlock),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.debugModeEnabled),G("aria-label",B(8,7,"settings.startup.debug")),l(2),b("for","homebridgeDebugMode_"+t.selectedBlock)}}function sW(e,u){if(e&1){let t=H();c(0,"li",39)(1,"div",40),x(2,"app-qrcode",41),c(3,"p",42),E(4),p(),c(5,"p",43),x(6,"i",44),E(7),y(8,"translate"),w(9,oW,3,3,"span"),p()()(),c(10,"li",23)(11,"label",30),E(12),y(13,"translate"),p(),c(14,"div",31),E(15),p()(),c(16,"li",23)(17,"label",30),E(18),y(19,"translate"),p(),c(20,"div",31),E(21),p()(),c(22,"li",23)(23,"label",30),E(24),y(25,"translate"),p(),c(26,"div",27)(27,"input",45),Me("ngModelChange",function(n){j(t);let f=h(4);return Oe(f.configBlocks[f.selectedBlock]._bridge.name,n)||(f.configBlocks[f.selectedBlock]._bridge.name=n),N(n)}),p()()(),c(28,"li",23)(29,"label",30),E(30),y(31,"translate"),p(),c(32,"div",27)(33,"input",45),Me("ngModelChange",function(n){j(t);let f=h(4);return Oe(f.configBlocks[f.selectedBlock]._bridge.manufacturer,n)||(f.configBlocks[f.selectedBlock]._bridge.manufacturer=n),N(n)}),p()()(),c(34,"li",23)(35,"label",30),E(36),y(37,"translate"),p(),c(38,"div",27)(39,"input",45),Me("ngModelChange",function(n){j(t);let f=h(4);return Oe(f.configBlocks[f.selectedBlock]._bridge.model,n)||(f.configBlocks[f.selectedBlock]._bridge.model=n),N(n)}),p()()(),c(40,"li",23)(41,"label",30),E(42),y(43,"translate"),p(),c(44,"div",27)(45,"input",45),Me("ngModelChange",function(n){j(t);let f=h(4);return Oe(f.configBlocks[f.selectedBlock]._bridge.firmwareRevision,n)||(f.configBlocks[f.selectedBlock]._bridge.firmwareRevision=n),N(n)}),p()()(),w(46,aW,10,9,"li",33),c(47,"li",23)(48,"label",30)(49,"span",46),E(50,"DEBUG"),p(),x(51,"br")(52,"small",47),y(53,"translate"),p(),c(54,"div",27)(55,"input",48),Me("ngModelChange",function(n){j(t);let f=h(4);return Oe(f.configBlocks[f.selectedBlock]._bridge.env.DEBUG,n)||(f.configBlocks[f.selectedBlock]._bridge.env.DEBUG=n),N(n)}),p()()(),c(56,"li",23)(57,"label",30)(58,"span",46),E(59,"NODE_OPTIONS"),p(),x(60,"br"),c(61,"small",49),E(62),y(63,"translate"),p()(),c(64,"div",27)(65,"input",50),Me("ngModelChange",function(n){j(t);let f=h(4);return Oe(f.configBlocks[f.selectedBlock]._bridge.env.NODE_OPTIONS,n)||(f.configBlocks[f.selectedBlock]._bridge.env.NODE_OPTIONS=n),N(n)}),p()()()}if(e&2){let t=h(4);l(2),b("data",t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]._setupCode),l(2),L(t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username].pincode),l(2),b("ngClass",Bi(41,KH,t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]._isPaired,!t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]._isPaired)),l(),q(" ",B(8,22,t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," "),l(2),S(t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]._isPaired?-1:9),l(3),L(B(13,24,"accessories.bridge_username")),l(3),q(" ",t.configBlocks[t.selectedBlock]._bridge.username," "),l(3),L(B(19,26,"accessories.bridge_port")),l(3),q(" ",t.configBlocks[t.selectedBlock]._bridge.port," "),l(3),L(B(25,28,"child_bridge.config.name")),l(3),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.name),l(3),L(B(31,30,"child_bridge.config.manufacturer")),l(3),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.manufacturer),l(3),L(B(37,32,"child_bridge.config.model")),l(3),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.model),l(3),L(B(43,34,"child_bridge.config.firmware")),l(3),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.firmwareRevision),l(),S(t.canShowBridgeDebug?46:-1),l(6),b("innerHTML",He(53,36,"settings.service.debug_tooltip",tu(44,N6,t.linkDebug)),me),l(3),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.env.DEBUG),l(7),L(B(63,39,"settings.service.node_tooltip")),l(3),Pe("ngModel",t.configBlocks[t.selectedBlock]._bridge.env.NODE_OPTIONS)}}function DW(e,u){if(e&1&&w(0,sW,66,46),e&2){let t=h(3);S(t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]?0:-1)}}function lW(e,u){e&1&&(c(0,"ngb-alert",24),E(1),y(2,"translate"),x(3,"br"),E(4),y(5,"translate"),p()),e&2&&(b("dismissible",!1),l(),q(" ",B(2,3,"child_bridge.restart_homebridge")," "),l(3),q("",B(5,5,"child_bridge.return_to_pair")," "))}function dW(e,u){if(e&1&&(c(0,"ul",22),w(1,eW,11,7),w(2,tW,6,4,"li",23),w(3,uW,7,6,"li",23),w(4,fW,8,7),w(5,rW,18,12),w(6,DW,1,1),p(),w(7,lW,6,7,"ngb-alert",24)),e&2){let t=h(2);l(),S(t.configBlocks.length>1?1:-1),l(),S(t.configBlocks.length===1?2:-1),l(),S(t.currentBridgeHasLinks?3:-1),l(),S(t.currentBridgeHasLinks?-1:4),l(),S(t.currentlySelectedLink?5:-1),l(),S(!t.currentlySelectedLink&&(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username)?6:-1),l(),S(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username&&t.deviceInfo[t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username]===!1?7:-1)}}function cW(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"child_bridge.confirm_delete_2")," ")}function pW(e,u){if(e&1&&(c(0,"li"),E(1),c(2,"span",46),E(3),p(),E(4,") "),p()),e&2){let t=u.$implicit,i=h(3);l(),q(" ",t.bridgeName||(i.deviceInfo[t.id]==null?null:i.deviceInfo[t.id].displayName)," ("),l(2),L(t.id)}}function mW(e,u){if(e&1&&(c(0,"ngb-alert",19)(1,"p"),E(2),y(3,"translate"),w(4,cW,2,3),p(),c(5,"div",9)(6,"ul",52),ft(7,pW,5,2,"li",null,nt),p()()()),e&2){let t=h(2);b("dismissible",!1),l(2),q(" ",B(3,3,"child_bridge.confirm_delete_1")," "),l(2),S(t.deletingPairedBridge?4:-1),l(3),rt(t.deleteBridges)}}function FW(e,u){e&1&&(c(0,"ngb-alert",20),E(1),y(2,"translate"),p()),e&2&&(b("dismissible",!1),l(),q(" ",B(2,2,"child_bridge.must_configure_plugin")," "))}function CW(e,u){if(e&1){let t=H();c(0,"ngb-alert",21)(1,"div",17),E(2),y(3,"translate"),y(4,"translate"),p(),c(5,"button",53),M("click",function(){j(t);let n=h(2);return N(n.openFullConfigEditor())}),E(6),y(7,"translate"),p()()}e&2&&(b("dismissible",!1),l(2),vi(" ",B(3,4,"plugins.settings.message_manual_config_required")," ",B(4,6,"plugins.settings.message_consult_documentation")," "),l(4),q(" ",B(7,8,"plugins.settings.label_open_config_editor")," "))}function hW(e,u){if(e&1&&(c(0,"div",15),x(1,"i",16),p(),c(2,"ul",17),x(3,"li",18),y(4,"translate"),w(5,ZH,5,5),p(),w(6,dW,8,7),w(7,mW,9,5,"ngb-alert",19),w(8,FW,3,4,"ngb-alert",20),w(9,CW,8,10,"ngb-alert",21)),e&2){let t=h();l(3),b("innerHTML",He(4,6,"child_bridge.about",tu(9,N6,t.linkChildBridges)),me),l(2),S(t.configBlocks.length?5:-1),l(),S(t.canConfigure&&t.configBlocks.length?6:-1),l(),S(t.deleteBridges.length?7:-1),l(),S(!t.configBlocks.length&&t.canConfigure?8:-1),l(),S(t.canConfigure?-1:9)}}function gW(e,u){if(e&1){let t=H();c(0,"button",54),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),E(1),y(2,"translate"),p()}if(e&2){let t=h();b("disabled",t.saveInProgress),l(),q(" ",B(2,2,"form.button_close")," ")}}function bW(e,u){e&1&&x(0,"i",56)}function EW(e,u){if(e&1){let t=H();c(0,"button",55),M("click",function(){j(t);let n=h();return N(n.save())}),E(1),y(2,"translate"),w(3,bW,1,0,"i",56),p()}if(e&2){let t=h();b("disabled",t.saveInProgress),l(),q(" ",B(2,3,"form.button_save")," "),l(2),S(t.saveInProgress?3:-1)}}function _W(e,u){if(e&1){let t=H();c(0,"button",57),M("click",function(){j(t);let n=h();return N(n.$activeModal.close("Dismiss"))}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"form.button_close")," "))}function yW(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"form.button_save")," ")}function vW(e,u){e&1&&x(0,"i",56)}function BW(e,u){if(e&1){let t=H();c(0,"button",55),M("click",function(){j(t);let n=h(2);return N(n.save())}),w(1,yW,2,3),w(2,vW,1,0,"i",56),p()}if(e&2){let t=h(2);b("disabled",t.saveInProgress||t.loading),l(),S(t.saveInProgress?-1:1),l(),S(t.saveInProgress?2:-1)}}function xW(e,u){if(e&1){let t=H();c(0,"button",59),M("click",function(){j(t);let n=h(2);return N(n.openPluginConfig())}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"plugins.button_settings")," "))}function wW(e,u){if(e&1&&(w(0,BW,3,3,"button",10),w(1,xW,3,3,"button",58)),e&2){let t=h();S(t.configBlocks.length?0:-1),l(),S(t.configBlocks.length?-1:1)}}var q6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$modal=I(it);$plugins=I(_i);$router=I(Ut);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);plugin;schema;justInstalled=!1;loading=!0;canConfigure=!0;configBlocks=[];selectedBlock="0";isPlatform;enabledBlocks={};bridgeCache=new Map;originalBridges=[];deviceInfo=new Map;saveInProgress=!1;canShowBridgeDebug=!1;deleteBridges=[];deletingPairedBridge=!1;accessoryBridgeLinks=[];bridgesAvailableForLink=[];currentlySelectedLink=null;currentBridgeHasLinks=!1;linkChildBridges='<a href="https://github.com/homebridge/homebridge/wiki/Child-Bridges" target="_blank"><i class="fas fa-fw fa-external-link-alt primary-text"></i></a>';linkDebug='<a href="https://github.com/homebridge/homebridge-config-ui-x/wiki/Debug-Common-Values" target="_blank"><i class="fa fa-fw fa-external-link-alt primary-text"></i></a>';constructor(){}ngOnInit(){return K(this,null,function*(){yield Promise.all([this.getPluginType(),this.loadPluginConfig()]),this.canShowBridgeDebug=this.$settings.env.homebridgeVersion.startsWith("2"),this.loading=!1})}onBlockChange(t){if(this.selectedBlock=t,this.currentlySelectedLink=this.accessoryBridgeLinks.find(i=>i.index===t)||null,this.currentBridgeHasLinks=this.accessoryBridgeLinks.some(i=>i.usesIndex===t),this.bridgesAvailableForLink=[],this.configBlocks[Number(t)].accessory)for(let[i,n]of Array.from(this.bridgeCache.entries()))this.deleteBridges.some(f=>f.id===n.username)||i<Number(t)&&this.bridgesAvailableForLink.push({index:i.toString(),usesIndex:t,name:n.name,port:n.port,username:n.username})}onLinkBridgeChange(t){if(t){let i=this.configBlocks.findIndex(f=>f._bridge?.username===t);this.accessoryBridgeLinks.push({index:this.selectedBlock,usesIndex:i.toString(),name:this.bridgeCache.get(i)?.name,port:this.bridgeCache.get(i)?.port,username:t}),this.currentlySelectedLink=this.accessoryBridgeLinks.find(f=>f.index===this.selectedBlock)||null,this.enabledBlocks[Number(this.selectedBlock)]=!0;let n=this.configBlocks[Number(this.selectedBlock)];n._bridge={username:t}}}getPluginType(){return K(this,null,function*(){try{let t=yield re(this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`));this.isPlatform=t.pluginType==="platform"}catch(t){this.$toastr.error(this.$translate.instant("plugins.config.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close(),console.error(t)}})}loadPluginConfig(){return K(this,null,function*(){try{this.configBlocks=yield re(this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`));for(let[i,n]of this.configBlocks.entries())if(n._bridge&&n._bridge.username){this.enabledBlocks[i]=!0;let f=Array.from(this.bridgeCache.values()).findIndex(o=>o.username===n._bridge.username),r=f!==-1?Array.from(this.bridgeCache.values())[f]:void 0;r?(n._bridge.env={},this.accessoryBridgeLinks.push({index:i.toString(),usesIndex:f.toString(),name:r.name,port:r.port,username:n._bridge.username})):(n._bridge.env=n._bridge.env||{},this.bridgeCache.set(i,n._bridge),yield this.getDeviceInfo(n._bridge.username),n._bridge.name||(n._bridge.name=this.deviceInfo[n._bridge.username]?.displayName),this.originalBridges.push(n._bridge))}this.justInstalled&&this.bridgeCache.size===0&&this.configBlocks.forEach((i,n)=>{this.enabledBlocks[n]=!0,this.toggleExternalBridge(i,!0,n.toString())}),this.accessoryBridgeLinks.find(i=>i.username===this.bridgeCache.get(Number(this.selectedBlock))?.username)&&(this.currentBridgeHasLinks=!0)}catch(t){this.canConfigure=!1,console.error(t)}})}toggleExternalBridge(t,i,n){return K(this,null,function*(){if(i){let f=this.bridgeCache.get(Number(n));t._bridge={username:f?f.username:this.generateUsername(),port:yield this.getUnusedPort(),name:f?.name,model:f?.model,manufacturer:f?.manufacturer,firmwareRevision:f?.firmwareRevision,debugModeEnabled:f?.debugModeEnabled,env:f?.env},this.deleteBridges.some(r=>r.id===t._bridge.username)&&(this.deleteBridges=this.deleteBridges.filter(r=>r.id!==t._bridge.username)),this.bridgeCache.set(Number(n),t._bridge),yield this.getDeviceInfo(t._bridge.username)}else{if(this.accessoryBridgeLinks.some(f=>f.index===n))this.accessoryBridgeLinks=this.accessoryBridgeLinks.filter(f=>f.index!==n),this.currentlySelectedLink=null;else{let f=this.originalBridges.find(r=>r.username===t._bridge.username);f&&this.deleteBridges.push({id:t._bridge.username,bridgeName:t._bridge.name||f.displayName,paired:this.deviceInfo[t._bridge.username]?._isPaired})}delete t._bridge}this.deletingPairedBridge=this.deleteBridges.some(f=>f.paired)})}getUnusedPort(){return K(this,null,function*(){this.saveInProgress=!0;try{return(yield re(this.$api.get("/server/port/new"))).port}catch{return Math.floor(Math.random()*30001+3e4)}finally{this.saveInProgress=!1}})}getDeviceInfo(t){return K(this,null,function*(){try{this.deviceInfo[t]=yield re(this.$api.get(`/server/pairings/${t.replace(/:/g,"")}`))}catch(i){console.error(i),this.deviceInfo[t]=!1}})}save(){return K(this,null,function*(){this.saveInProgress=!0;try{yield re(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,this.configBlocks));for(let t of this.deleteBridges)try{yield re(this.$api.delete(`/server/pairings/${t.id.replace(/:/g,"")}`))}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("settings.reset_bridge.error"),this.$translate.instant("toast.title_error"))}this.$activeModal.close(),this.$modal.open(pu,{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"))}finally{this.saveInProgress=!1}})}openPluginConfig(){this.$activeModal.close(),this.$plugins.settings({name:this.plugin.name,settingsSchema:!0,links:{}})}generateUsername(){let t="0123456789ABCDEF",i="0E:";for(let n=0;n<5;n++)i+=t.charAt(Math.round(Math.random()*15)),i+=t.charAt(Math.round(Math.random()*15)),n!==4&&(i+=":");return i}openFullConfigEditor(){this.$router.navigate(["/config"]),this.$activeModal.close()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",schema:"schema",justInstalled:"justInstalled"},decls:16,vars:8,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"disabled"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button",1,"btn","btn-primary",3,"disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"mb-3","text-center"],[1,"fas","fa-fw","fa-bridge","primary-text",2,"font-size","75px"],[1,"mb-3"],[3,"innerHTML"],["type","error",1,"mt-3","mb-0",3,"dismissible"],["type","info",3,"dismissible"],["type","info",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["type","info",1,"mt-3","mb-0",3,"dismissible"],[1,"list-group-item","text-center","grey-text","small"],["for","bridgeSelect",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["id","bridgeSelect",1,"custom-select",3,"ngModelChange","change","ngModel"],[3,"value"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50","grey-text","font-monospace"],[1,"text-start","text-md-end","w-100","w-md-50","grey-text"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox",1,"rendux-input",3,"change","ngModelChange","id","ngModel"],[1,"rendux-label",3,"for"],["for","bridgeLink",1,"mb-2","mb-md-0","w-100","w-md-50"],["id","bridgeLink",1,"custom-select",3,"change"],[1,"list-group-item","text-center"],[1,"w-100","d-flex","flex-column","text-center"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"mx-auto","mt-3","mb-1"],[1,"grey-text","mx-auto","small","mb-1",2,"max-width","400px"],[1,"fas","fa-fw","fa-link",3,"ngClass"],["type","text",1,"form-control","custom-input",3,"ngModelChange","ngModel"],[1,"font-monospace"],[1,"grey-text",3,"innerHTML"],["type","text","placeholder","HAP-NodeJS:Advertiser,HAP-NodeJS:Service",1,"form-control","custom-input",3,"ngModelChange","ngModel"],[1,"grey-text"],["type","text","placeholder","--max-old-space-size=512 --max-http-header-size=8192",1,"form-control","custom-input",3,"ngModelChange","ngModel"],["type","checkbox",1,"rendux-input",3,"ngModelChange","id","ngModel"],[1,"d-inline-block","text-start","mb-0"],[1,"btn","btn-primary","mb-0",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),p(),w(4,GH,2,4,"button",3),p(),c(5,"div",4),w(6,JH,2,0,"div",5),w(7,hW,10,11),p(),c(8,"div",6)(9,"div",7),w(10,gW,3,4,"button",8),p(),c(11,"div",9),w(12,EW,4,5,"button",10),w(13,_W,3,3,"button",11),p(),c(14,"div",12),w(15,wW,2,2),p()()()),i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),S(n.justInstalled?-1:4),l(2),S(n.loading?6:-1),l(),S(n.loading?-1:7),l(3),S(n.canConfigure&&!n.justInstalled?10:-1),l(2),S(n.justInstalled?12:-1),l(),S(n.canConfigure?-1:13),l(2),S(n.canConfigure&&!n.justInstalled?15:-1))},dependencies:[uu,wi,Si,Zi,Xu,Qi,vt,Yu,cu,q1,zt,$e],styles:[".manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}"]})}return e})();var Zl=Re(Jr(),1);var ns=()=>["homebridge","homebridge-config-ui-x"],V6=(e,u,t)=>({pluginName:e,minVersion:u,installedVersion:t}),SW=(e,u,t)=>({minVersion:e,installedVersion:u,latestVersion:t,packageName:"Homebridge"}),IW=()=>({packageName:"Homebridge"}),AW=(e,u,t)=>({minVersion:e,installedVersion:u,latestVersion:t,packageName:"Homebridge UI"}),$W=()=>({packageName:"Homebridge UI"});function kW(e,u){if(e&1&&(c(0,"li",14)(1,"div",17),x(2,"i",18),p(),c(3,"div",19),E(4),y(5,"translate"),p()()),e&2){let t=h(2);l(4),q(" ",He(5,1,"plugins.compat.node_too_low",xu(4,V6,t.plugin.displayName,t.nodeMinVersion,t.nodeInstalledVersion))," ")}}function TW(e,u){if(e&1&&(c(0,"li",14)(1,"div",17),x(2,"i",18),p(),c(3,"div",19),E(4),y(5,"translate"),p()()),e&2){let t=h(2);l(4),q(" ",He(5,1,"plugins.compat.hb_too_low",xu(4,V6,t.plugin.displayName,t.hbMinVersion,t.hbInstalledVersion))," ")}}function PW(e,u){if(e&1&&(c(0,"div",11),x(1,"i",12),p(),c(2,"ul",13),w(3,kW,6,8,"li",14),w(4,TW,6,8,"li",14),p(),c(5,"ngb-alert",15)(6,"p",16),E(7),y(8,"translate"),p()()),e&2){let t=h();l(),Z(h1("",t.action==="install"?"far fa-fw fa-arrow-alt-circle-down":t.action==="update"?"far fa-fw fa-arrow-alt-circle-up":"fas fa-fw fa-code-compare"," primary-text")),l(2),S(t.isValidNode?-1:3),l(),S(t.isValidHb?-1:4),l(),b("dismissible",!1),l(2),L(B(8,7,"plugins.compat.are_you_sure"))}}function OW(e,u){if(e&1&&(c(0,"div",11),x(1,"i",20),p(),c(2,"ul",13)(3,"li",14)(4,"div",17),x(5,"i",18),p(),c(6,"div",19),E(7),y(8,"translate"),p()()(),c(9,"ngb-alert",15)(10,"p",21),E(11),y(12,"translate"),p(),c(13,"p",16)(14,"a",22),E(15),y(16,"translate"),x(17,"i",23),p()()()),e&2){let t=h();l(7),q(" ",He(8,4,"plugins.compat.hb_node_too_low",xu(12,SW,t.nodeMinVersion,t.nodeInstalledVersion,t.plugin.latestVersion))," "),l(2),b("dismissible",!1),l(2),L(He(12,7,"plugins.compat.node_first",we(16,IW))),l(4),q(" ",B(16,10,"plugins.compat.node_link")," ")}}function MW(e,u){if(e&1&&(c(0,"div",11),x(1,"i",20),p(),c(2,"ul",13)(3,"li",14)(4,"div",17),x(5,"i",18),p(),c(6,"div",19),E(7),y(8,"translate"),p()()(),c(9,"ngb-alert",15)(10,"p",21),E(11),y(12,"translate"),p(),c(13,"p",16)(14,"a",22),E(15),y(16,"translate"),x(17,"i",23),p()()()),e&2){let t=h();l(7),q(" ",He(8,4,"plugins.compat.hb_node_too_low",xu(12,AW,t.nodeMinVersion,t.nodeInstalledVersion,t.plugin.latestVersion))," "),l(2),b("dismissible",!1),l(2),L(He(12,7,"plugins.compat.node_first",we(16,$W))),l(4),q(" ",B(16,10,"plugins.compat.node_link")," ")}}function jW(e,u){if(e&1){let t=H();c(0,"button",24),M("click",function(){j(t);let n=h();return N(n.$activeModal.dismiss("Dismiss"))}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"form.button_close")," "))}function NW(e,u){if(e&1){let t=H();c(0,"button",24),M("click",function(){j(t);let n=h();return N(n.$activeModal.dismiss("Dismiss"))}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"form.button_close")," "))}function qW(e,u){if(e&1){let t=H();c(0,"button",25),M("click",function(){j(t);let n=h();return N(n.$activeModal.close(!0))}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"form.label_continue")," "))}var R6=(()=>{class e{$activeModal=I(Ae);$settings=I(Le);plugin;isValidNode;isValidHb;action;nodeMinVersion;nodeInstalledVersion;hbMinVersion;hbInstalledVersion;constructor(){}ngOnInit(){this.nodeMinVersion=(0,Zl.minVersion)(this.plugin.updateEngines?.node),this.nodeInstalledVersion=this.$settings.env.nodeVersion,this.hbMinVersion=(0,Zl.minVersion)(this.plugin.updateEngines?.homebridge),this.hbInstalledVersion=this.$settings.env.homebridgeVersion}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",isValidNode:"isValidNode",isValidHb:"isValidHb",action:"action"},decls:18,vars:16,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger"],[1,"text-center","mb-3"],[2,"font-size","75px"],[1,"list-group","list-group-box","mb-3","text-start"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],["type","warning",1,"mb-0",3,"dismissible"],[1,"text-center","mb-0"],[1,"me-3"],[1,"fas","fa-exclamation-circle","orange-text","fa-xl"],[1,"text-start","flex-grow-1"],[1,"fab","fa-fw","fa-node-js","primary-text",2,"font-size","75px"],[1,"text-center","mb-1"],["href","https://homebridge.io/w/JTKEF","target","_blank","rel","noopener noreferrer"],[1,"fa","fa-fw","fa-external-link-alt"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),y(4,"translate"),p(),c(5,"button",3),y(6,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(7,"div",4),w(8,PW,9,9),w(9,OW,18,17),w(10,MW,18,17),p(),c(11,"div",5)(12,"div",6),w(13,jW,3,3,"button",7),p(),c(14,"div",8),w(15,NW,3,3,"button",7),p(),c(16,"div",9),w(17,qW,3,3,"button",10),p()()()),i&2&&(l(3),L(B(4,8,"plugins.compat.title")),l(2),G("aria-label",B(6,10,"form.button_close")),l(3),S(we(12,ns).includes(n.plugin.name)?-1:8),l(),S(n.plugin.name==="homebridge"?9:-1),l(),S(n.plugin.name==="homebridge-config-ui-x"?10:-1),l(3),S(we(13,ns).includes(n.plugin.name)?-1:13),l(2),S(we(14,ns).includes(n.plugin.name)?15:-1),l(2),S(we(15,ns).includes(n.plugin.name)?-1:17))},dependencies:[$e,cu],encapsulation:2})}return e})();var Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function L6(e,u=0){return(Dt[e[u+0]]+Dt[e[u+1]]+Dt[e[u+2]]+Dt[e[u+3]]+"-"+Dt[e[u+4]]+Dt[e[u+5]]+"-"+Dt[e[u+6]]+Dt[e[u+7]]+"-"+Dt[e[u+8]]+Dt[e[u+9]]+"-"+Dt[e[u+10]]+Dt[e[u+11]]+Dt[e[u+12]]+Dt[e[u+13]]+Dt[e[u+14]]+Dt[e[u+15]]).toLowerCase()}var Ql,VW=new Uint8Array(16);function e1(){if(!Ql){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ql=crypto.getRandomValues.bind(crypto)}return Ql(VW)}var RW=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),t1={randomUUID:RW};function LW(e,u,t){if(t1.randomUUID&&!u&&!e)return t1.randomUUID();e=e||{};let i=e.random??e.rng?.()??e1();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,u){if(t=t||0,t<0||t+16>u.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let n=0;n<16;++n)u[t+n]=i[n];return u}return L6(i)}var fs=LW;var z6=Re(ff(),1);var U6=(()=>{class e{$api=I(be);$toastr=I(_e);$translate=I(Ee);constructor(){}downloadDumpFile(){this.$api.get("/plugins/custom-plugins/homebridge-deconz/dump-file",{observe:"response",responseType:"blob"}).subscribe({next:t=>{(0,z6.saveAs)(t.body,"homebridge-deconz.json.gz")},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("plugins.settings.deconz.dump_no_exist"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["app-homebridge-deconz"]],decls:3,vars:0,consts:[["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-download"]],template:function(i,n){i&1&&(c(0,"button",0),M("click",function(){return n.downloadDumpFile()}),x(1,"i",1),E(2,` Download Dump File
24
24
  `),p())},encapsulation:2})}return e})();var H6=Re(ff(),1);var W6=(()=>{class e{$api=I(be);$translate=I(Ee);$toastr=I(_e);constructor(){}downloadDumpFile(){this.$api.get("/plugins/custom-plugins/homebridge-hue/dump-file",{observe:"response",responseType:"blob"}).subscribe({next:t=>{(0,H6.saveAs)(t.body,"homebridge-hue.json.gz")},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("plugins.settings.hue.dump_no_exist"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["app-homebridge-hue"]],decls:3,vars:0,consts:[["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-download"]],template:function(i,n){i&1&&(c(0,"button",0),M("click",function(){return n.downloadDumpFile()}),x(1,"i",1),E(2,` Download Dump File
25
25
  `),p())},encapsulation:2})}return e})();var K6=(()=>{class e{transform(t){return t.replace(/\$\{\{HOSTNAME\}\}/g,location.hostname)}static \u0275fac=function(i){return new(i||e)};static \u0275pipe=c1({name:"interpolateMd",type:e,pure:!0})}return e})();function zW(e,u){if(e&1&&(x(0,"markdown",5),y(1,"interpolateMd")),e&2){let t=h();b("data",B(1,1,t.schema.headerDisplay))}}function UW(e,u){if(e&1){let t=H();c(0,"button",31),y(1,"translate"),M("click",function(){j(t);let n=h().$implicit,f=h(2);return N(f.removeBlock(n.__uuid__))}),x(2,"i",32),p()}e&2&&b("ngbTooltip",B(1,1,"form.button_delete"))}function HW(e,u){if(e&1){let t=H();c(0,"div",19)(1,"div",20)(2,"div",21)(3,"h5",22),E(4),p(),c(5,"div",23),w(6,UW,3,3,"button",24),c(7,"button",25),y(8,"translate"),x(9,"i",26),p(),x(10,"i",27),y(11,"translate"),p()()(),c(12,"div",28)(13,"div",29)(14,"app-schema-form",30),Me("dataChange",function(n){let f=j(t).$implicit;return Oe(f.config,n)||(f.config=n),N(n)}),M("isValid",function(n){let f=j(t).$index,r=h(2);return N(r.onIsValid(n,f))}),p()()()()}if(e&2){let t=u.$implicit,i=u.$index,n=h(2);b("ngbAccordionItem",t.__uuid__)("collapsed",n.show!==t.__uuid__)("id",t.__uuid__),l(4),L(t.name),l(2),S(n.plugin.name!=="homebridge-config-ui-x"&&n.show===t.__uuid__?6:-1),l(),b("ngbTooltip",B(8,10,"form.button_edit")),l(3),b("ngClass",n.formBlocksValid[i]?"fa-circle-check green-text":n.strictValidation?"fa-circle-exclamation red-text":"fa-circle-exclamation orange-text")("ngbTooltip",B(11,12,n.formBlocksValid[i]?"form.label_valid":n.strictValidation?"form.label_invalid_strict":"form.label_invalid")),l(4),b("configSchema",n.schema),Pe("data",t.config)}}function WW(e,u){if(e&1){let t=H();c(0,"div",18),M("show",function(n){j(t);let f=h();return N(f.blockShown(n))})("hide",function(n){j(t);let f=h();return N(f.blockHidden(n))}),ft(1,HW,15,14,"div",19,nt),p()}if(e&2){let t=h();b("closeOthers",!0),l(),rt(t.pluginConfig)}}function KW(e,u){e&1&&x(0,"app-homebridge-deconz")}function GW(e,u){e&1&&x(0,"app-homebridge-hue")}function JW(e,u){if(e&1){let t=H();c(0,"div",7)(1,"app-schema-form",30),Me("dataChange",function(n){j(t);let f=h();return Oe(f.pluginConfig[0].config,n)||(f.pluginConfig[0].config=n),N(n)}),M("isValid",function(n){j(t);let f=h();return N(f.onIsValid(n,0))}),p(),w(2,KW,1,0,"app-homebridge-deconz"),w(3,GW,1,0,"app-homebridge-hue"),p()}if(e&2){let t=h();l(),b("configSchema",t.schema),Pe("data",t.pluginConfig[0].config),l(),S(t.plugin.name==="homebridge-deconz"?2:-1),l(),S(t.plugin.name==="homebridge-hue"?3:-1)}}function XW(e,u){if(e&1&&(x(0,"markdown",5),y(1,"interpolateMd")),e&2){let t=h();b("data",B(1,1,t.schema.footerDisplay))}}function YW(e,u){if(e&1&&(x(0,"i",14),y(1,"translate")),e&2){let t=h();b("ngClass",t.formIsValid?"fa-circle-check green-text":t.strictValidation?"fa-circle-exclamation red-text":"fa-circle-exclamation orange-text")("ngbTooltip",B(1,2,t.formIsValid?"form.label_valid":t.strictValidation?"form.label_invalid_strict":"form.label_invalid"))}}function ZW(e,u){if(e&1){let t=H();c(0,"button",33),M("click",function(){j(t);let n=h();return N(n.addBlock())}),x(1,"i",34),p()}}function QW(e,u){e&1&&(c(0,"span"),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"form.button_save")))}function eK(e,u){e&1&&x(0,"i",17)}var G6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$plugin=I(_i);$modal=I(it);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);plugin;schema;pluginAlias;pluginType;pluginConfig=[];form={};show="";saveInProgress;childBridges=[];isFirstSave=!1;formBlocksValid={};formIsValid=!0;strictValidation=!1;constructor(){}ngOnInit(){this.pluginAlias=this.schema.pluginAlias,this.pluginType=this.schema.pluginType,this.strictValidation=this.schema.strictValidation,this.loadPluginConfig()}loadPluginConfig(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{for(let i of t){let n={__uuid__:fs(),name:i.name||this.schema.pluginAlias,config:i};this.pluginConfig.push(n)}this.pluginConfig.length?this.show=this.pluginConfig[0].__uuid__:(this.isFirstSave=!0,this.addBlock()),this.plugin.name==="homebridge-hue"&&this.pluginConfig.length&&this.homebridgeHueFix(this.pluginConfig[0].config)},error:t=>{console.error(t),this.$toastr.error(t.error?.message||this.$translate.instant("plugins.config.load_error"),this.$translate.instant("toast.title_error"))}})}save(){return K(this,null,function*(){this.saveInProgress=!0;let t=this.pluginConfig.map(i=>i.config);try{let i=yield re(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,t));if(this.saveInProgress=!1,this.plugin.name==="homebridge-config-ui-x")this.$settings.getAppSettings().catch(()=>{});else if(this.isFirstSave&&this.$settings.env.recommendChildBridges&&i[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(this.plugin,!0);return}if(!["homebridge","homebridge-config-ui-x"].includes(this.plugin.name)&&(yield this.getChildBridges(),this.childBridges.length>0)){this.$activeModal.close();let n=this.$modal.open(tn,{size:"lg",backdrop:"static"});n.componentInstance.bridges=this.childBridges.map(f=>({name:f.name,username:f.username}));return}this.$activeModal.close(),this.$modal.open(pu,{size:"lg",backdrop:"static"})}catch(i){this.saveInProgress=!1,console.error(i),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}})}blockShown(t){this.show=t;for(let i of this.pluginConfig)i.name=i.config.name||i.name}blockHidden(t){this.show===t&&(this.show="")}addBlock(){let t=fs();this.pluginConfig.push({__uuid__:t,name:this.schema.pluginAlias,config:{[this.pluginType]:this.schema.pluginAlias}}),this.formBlocksValid[this.pluginConfig.length-1]=!1,this.blockShown(t)}removeBlock(t){let i=this.pluginConfig.findIndex(n=>n.__uuid__===t);this.pluginConfig.splice(i,1),delete this.formBlocksValid[i],Object.keys(this.formBlocksValid).length||(this.formIsValid=!0)}getChildBridges(){return K(this,null,function*(){try{(yield re(this.$api.get("/status/homebridge/child-bridges"))).forEach(i=>{this.plugin.name===i.plugin&&this.childBridges.push(i)})}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error")),this.childBridges=[]}})}homebridgeHueFix(t){if(this.schema.schema.properties.users={type:"object",properties:{}},!(!t.users||typeof t.users!="object"))for(let i of Object.keys(t.users))this.schema.schema.properties.users.properties[i]={type:"string"}}onIsValid(t,i){this.formBlocksValid[i]=t,this.formIsValid=Object.values(this.formBlocksValid).every(n=>n)}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",schema:"schema"},decls:24,vars:18,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body","pb-0"],[1,"plugin-md",3,"data"],["ngbAccordion","",3,"closeOthers"],[1,"card","card-body"],[1,"mt-3"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end","d-flex","align-items-center","justify-content-end"],["container","modal","placement","top","openDelay","150","triggers","hover",1,"fa","fa-fw","fa-xl","me-2",3,"ngClass","ngbTooltip"],["type","button","data-dismiss","modal",1,"btn","btn-elegant","me-2"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],["ngbAccordion","",3,"show","hide","closeOthers"],[1,"card",3,"ngbAccordionItem","collapsed","id"],["ngbAccordionHeader","",1,"card-header"],[1,"d-flex","align-items-center","justify-content-between"],[1,"m-0"],[1,"d-flex","align-items-center"],["container","modal","placement","left","openDelay","150","triggers","hover",1,"btn","btn-danger","ms-2",3,"ngbTooltip"],["ngbAccordionToggle","","container","modal","placement","left","openDelay","150","triggers","hover",1,"btn","btn-primary","ms-2","me-2",3,"ngbTooltip"],[1,"fa","fa-fw","fa-edit"],["container","modal","placement","left","openDelay","150","triggers","hover",1,"fa","fa-fw","fa-xl",3,"ngClass","ngbTooltip"],["ngbAccordionCollapse",""],["ngbAccordionBody","",1,"card-body"],[3,"dataChange","isValid","configSchema","data"],["container","modal","placement","left","openDelay","150","triggers","hover",1,"btn","btn-danger","ms-2",3,"click","ngbTooltip"],[1,"fa","fa-fw","fa-trash"],["type","button","data-dismiss","modal",1,"btn","btn-elegant","me-2",3,"click"],[1,"fa","fa-fw","fa-plus"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),p(),c(4,"button",3),y(5,"translate"),M("click",function(){return n.$activeModal.close("Dismiss")}),p()(),c(6,"div",4),w(7,zW,2,3,"markdown",5),w(8,WW,3,1,"div",6),w(9,JW,4,4,"div",7),c(10,"div",8),w(11,XW,2,3,"markdown",5),p()(),c(12,"div",9)(13,"div",10)(14,"button",11),M("click",function(){return n.$activeModal.close()}),E(15),y(16,"translate"),p()(),x(17,"div",12),c(18,"div",13),w(19,YW,2,4,"i",14),w(20,ZW,2,0,"button",15),c(21,"button",16),M("click",function(){return n.save()}),w(22,QW,3,3,"span"),w(23,eK,1,0,"i",17),p()()()()),i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),b("disabled",n.saveInProgress),G("aria-label",B(5,14,"form.button_close")),l(3),S(n.schema.headerDisplay?7:-1),l(),S(n.pluginConfig.length&&!n.schema.singular?8:-1),l(),S(n.pluginConfig.length&&n.schema.singular?9:-1),l(2),S(n.schema.footerDisplay?11:-1),l(3),b("disabled",n.saveInProgress),l(),q(" ",B(16,16,"form.button_close")," "),l(4),S(n.schema.singular?19:-1),l(),S(n.schema.singular?-1:20),l(),b("disabled",n.saveInProgress||!n.formIsValid&&n.strictValidation),l(),S(n.saveInProgress?-1:22),l(),S(n.saveInProgress?23:-1))},dependencies:[Yr,Xr,is,Gr,Kr,Wr,en,Ur,zr,zt,es,U6,W6,$e,K6,Hr],styles:[".manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}"]})}return e})();var tK=(e,u)=>({"green-text":e,"grey-text":u}),uK=(e,u)=>({"btn-danger":e,"btn-elegant":u}),iK=(e,u,t)=>({"fa-broom":e,"fa-undo":u,"fa-spinner fa-pulse":t});function nK(e,u){e&1&&(c(0,"div",12),x(1,"i",13),p(),c(2,"p",14),E(3),y(4,"translate"),p()),e&2&&(l(3),L(B(4,1,"reset.bridge_accessories.empty")))}function fK(e,u){if(e&1){let t=H();c(0,"li",18)(1,"span"),E(2),x(3,"br"),c(4,"small",19),x(5,"i",20),E(6),y(7,"translate"),c(8,"span",21),E(9),p()()(),c(10,"button",22),y(11,"translate"),M("click",function(){let n=j(t).$implicit,f=h(2);return N(f.toggleList(n._id))}),x(12,"i",23),p()()}if(e&2){let t=u.$implicit,i=h(2);l(2),q(" ",t.name," "),l(3),b("ngClass",Bi(12,tK,t._isPaired,!t._isPaired)),l(),q(" ",B(7,8,t._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),l(3),L(t._username),l(),b("disabled",i.clicked)("ngClass",Bi(15,uK,!i.toDelete.includes(t._id),i.toDelete.includes(t._id))),G("aria-label",B(11,10,"form.button_delete")),l(2),b("ngClass",xu(18,iK,!i.toDelete.includes(t._id),i.toDelete.includes(t._id)&&!i.clicked,i.toDelete.includes(t._id)&&i.clicked))}}function rK(e,u){if(e&1&&(c(0,"div",12),x(1,"i",15),p(),c(2,"ul",16)(3,"li"),E(4),y(5,"translate"),p(),c(6,"li"),E(7),y(8,"translate"),p()(),c(9,"ul",17),ft(10,fK,13,22,"li",18,nt),p()),e&2){let t=h();l(4),L(B(5,2,"reset.bridge_accessories.list_1")),l(3),L(B(8,4,"reset.clear_cache_single.list_3")),l(3),rt(t.pairings)}}function oK(e,u){if(e&1){let t=H();c(0,"button",24),M("click",function(){j(t);let n=h();return N(n.$activeModal.dismiss("Dismiss"))}),E(1),y(2,"translate"),p()}if(e&2){let t=h();b("disabled",t.clicked),l(),q(" ",B(2,2,"form.button_close")," ")}}function aK(e,u){if(e&1){let t=H();c(0,"button",25),M("click",function(){j(t);let n=h();return N(n.$activeModal.dismiss("Dismiss"))}),E(1),y(2,"translate"),p()}e&2&&(l(),q(" ",B(2,1,"form.button_close")," "))}function sK(e,u){if(e&1&&E(0),e&2){let t=h(3);q(" (",t.toDelete.length,") ")}}function DK(e,u){if(e&1&&(E(0),y(1,"translate"),w(2,sK,1,1)),e&2){let t=h(2);q(" ",B(1,2,"form.button_remove")," "),l(2),S(t.toDelete.length>0?2:-1)}}function lK(e,u){e&1&&x(0,"i",27)}function dK(e,u){if(e&1){let t=H();c(0,"button",26),M("click",function(){j(t);let n=h();return N(n.cleanBridges())}),w(1,DK,3,4),w(2,lK,1,0,"i",27),p()}if(e&2){let t=h();b("disabled",!t.toDelete.length||t.clicked),l(),S(t.clicked?-1:1),l(),S(t.clicked?2:-1)}}var J6=(()=>{class e{$activeModal=I(Ae);$api=I(be);$router=I(Ut);$toastr=I(_e);$translate=I(Ee);childBridges=[];clicked=!1;pairings=[];toDelete=[];constructor(){}ngOnInit(){this.loadPairings()}loadPairings(){return K(this,null,function*(){try{this.pairings=(yield re(this.$api.get("/server/pairings"))).filter(t=>t._category==="bridge"&&!t._main&&this.childBridges.find(i=>i.username===t._username)).sort((t,i)=>t.name.localeCompare(i.name))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("settings.unpair_bridge.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}toggleList(t){this.toDelete.includes(t)?this.toDelete=this.toDelete.filter(i=>i!==t):this.toDelete.push(t)}cleanBridges(){return this.clicked=!0,this.$api.delete("/server/pairings/accessories",{body:this.toDelete.map(t=>({id:t}))}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.accessory_ind.done"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:t=>{this.clicked=!1,console.error(t),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{childBridges:"childBridges"},decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-fw","fa-broom","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"fas","fa-fw","fa-link",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas","fa-fw",3,"ngClass"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),y(4,"translate"),p(),c(5,"button",3),y(6,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(7,"div",4),w(8,nK,5,3),w(9,rK,12,6),p(),c(10,"div",5)(11,"div",6),w(12,oK,3,4,"button",7),p(),c(13,"div",8),w(14,aK,3,3,"button",9),p(),c(15,"div",10),w(16,dK,3,3,"button",11),p()()()),i&2&&(l(3),L(B(4,8,"child_bridge.reset_accessories")),l(2),b("disabled",n.clicked),G("aria-label",B(6,10,"form.button_close")),l(3),S(n.pairings.length===0?8:-1),l(),S(n.pairings.length>0?9:-1),l(3),S(n.pairings.length>0?12:-1),l(2),S(n.pairings.length===0?14:-1),l(2),S(n.pairings.length>0?16:-1))},dependencies:[zt,$e],encapsulation:2})}return e})();var Y6=Re(ff(),1);var Z6=Re(V1(),1),Q6=Re(R1(),1);var cK=e=>({prefix:e}),pK=e=>({link:e}),X6=(e,u,t,i)=>({"fa-circle-o":e,"fa-spinner fa-pulse":u,"fa-check-circle green-text":t,"fa-times-circle red-text":i}),mK=(e,u,t)=>({"fa-circle-o":e,"fa-spinner fa-pulse":u,"fa-times-circle red-text":t});function FK(e,u){e&1&&(c(0,"li"),E(1),y(2,"translate"),p()),e&2&&(l(),L(B(2,1,"plugins.manage.scoped.process")))}function CK(e,u){e&1&&(x(0,"li",8),y(1,"translate"),c(2,"li"),E(3),y(4,"translate"),p()),e&2&&(b("innerHTML",B(1,2,"plugins.manage.scoped.windows"),me),l(3),L(B(4,4,"plugins.manage.manual_update_command")))}function hK(e,u){if(e&1&&(c(0,"pre",9),E(1),p()),e&2){let t=h();l(),Rr(`hb-service stop
26
26
  npm install -g `,t.plugin.newHbScope.to,"@",t.plugin.newHbScope.switch,`
27
27
  npm uninstall -g `,t.plugin.newHbScope.from,`
28
28
  hb-service start`)}}function gK(e,u){if(e&1&&(c(0,"div",10)(1,"ul",18)(2,"li"),x(3,"i",19),E(4),y(5,"translate"),c(6,"span",20),E(7),p()(),c(8,"li"),x(9,"i",19),E(10),y(11,"translate"),c(12,"span",20),E(13),p()(),c(14,"li"),x(15,"i",19),E(16),y(17,"translate"),p()()()),e&2){let t=h();l(3),b("ngClass",Yi(14,X6,!t.installing&&!t.installed&&!t.failure,t.installing,t.installed&&!t.failure,!t.installed&&t.failure)),l(),q(" ",B(5,8,"plugins.manage.install")," "),l(3),L(t.plugin.newHbScope.to),l(2),b("ngClass",Yi(19,X6,!t.uninstalling&&!t.uninstalled&&!t.failure,t.uninstalling,t.uninstalled&&!t.failure,!t.uninstalled&&t.failure)),l(),q(" ",B(11,10,"plugins.manage.uninstall")," "),l(3),L(t.plugin.newHbScope.from),l(2),b("ngClass",xu(24,mK,!t.restarting&&!t.failure,t.restarting,t.failure)),l(),q(" ",B(17,12,"menu.hbrestart.title")," ")}}function bK(e,u){if(e&1){let t=H();c(0,"div",11)(1,"p"),E(2),y(3,"translate"),p(),c(4,"p",20),E(5),p(),c(6,"button",21),M("click",function(){j(t);let n=h();return N(n.downloadLogFile())}),E(7),y(8,"translate"),p()()}if(e&2){let t=h();l(2),L(B(3,3,"plugins.manage.scoped.error")),l(3),L(t.failure),l(2),L(B(8,5,"form.button_download"))}}function EK(e,u){if(e&1){let t=H();c(0,"button",22),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.dismiss("Dismiss"))}),E(2),y(3,"translate"),p()}if(e&2){let t=h();b("disabled",t.installing||t.uninstalling||t.restarting),G("aria-label",B(1,3,"form.button_close")),l(2),q(" ",B(3,5,"form.button_close")," ")}}function _K(e,u){if(e&1){let t=H();c(0,"button",22),y(1,"translate"),M("click",function(){j(t);let n=h();return N(n.$activeModal.dismiss("Dismiss"))}),E(2),y(3,"translate"),p()}if(e&2){let t=h();b("disabled",t.installing||t.uninstalling||t.restarting),G("aria-label",B(1,3,"form.button_close")),l(2),q(" ",B(3,5,"form.button_close")," ")}}function yK(e,u){e&1&&(c(0,"span"),E(1),y(2,"translate"),p()),e&2&&(l(),q(" ",B(2,1,"form.label_continue")," "))}function vK(e,u){e&1&&x(0,"i",24)}function BK(e,u){if(e&1){let t=H();c(0,"button",23),M("click",function(){j(t);let n=h();return N(n.doSwitch())}),w(1,yK,3,3,"span"),w(2,vK,1,0,"i",24),p()}if(e&2){let t=h();b("disabled",t.installing||t.uninstalling||t.restarting||!t.onlineUpdateOk||t.failure),l(),S(!t.installing&&!t.uninstalling&&!t.restarting?1:-1),l(),S((t.installing||t.uninstalling||t.restarting)&&!t.failure?2:-1)}}var eb=(()=>{class e{$activeModal=I(Ae);$api=I(be);$router=I(Ut);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);$ws=I(ei);plugin;installing=!1;installed=!1;uninstalling=!1;uninstalled=!1;restarting=!1;failure="";onlineUpdateOk;moreInfo='<a href="https://github.com/homebridge/plugins/wiki/Scoped-Plugins" target="_blank"><i class="fa fa-fw fa-external-link-alt primary-text"></i></a>';prefix='<span class="font-monospace">@homebridge-plugins/</span>';io;term;termTarget;fitAddon=new Q6.FitAddon;errorLog="";constructor(){this.term=new Z6.Terminal({theme:{background:"#00000000",foreground:this.$settings.actualLightingMode==="light"?"#333333":"#eeeeee",cursor:"#d2d2d2",selection:"#d2d2d2"},allowTransparency:!0}),this.term.loadAddon(this.fitAddon)}ngOnInit(){this.onlineUpdateOk=this.$settings.env.platform!=="win32",this.io=this.$ws.connectToNamespace("plugins"),this.termTarget=document.getElementById("plugin-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",t=>{this.term.write(t);let i=t.toString().replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"").trimEnd();i&&(this.errorLog+=`${i}\r
29
- `)})}doSwitch(){this.installing=!0,this.io.request("install",{name:this.plugin.newHbScope.to,version:this.plugin.newHbScope.switch,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.installing=!1,this.installed=!0,this.uninstalling=!0,this.io.request("uninstall",{name:this.plugin.newHbScope.from,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.uninstalling=!1,this.uninstalled=!0,this.restarting=!0,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$activeModal.close(),this.$router.navigate(["/restart"])},error:t=>{this.restarting=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})},error:t=>{this.uninstalling=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})},error:t=>{this.installing=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}downloadLogFile(){let t=new Blob([this.errorLog],{type:"text/plain;charset=utf-8"});(0,Y6.saveAs)(t,`${this.plugin.name}-error.log`)}ngOnDestroy(){this.io.end(),this.term.dispose()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:31,vars:31,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"mb-3","text-center"],[1,"fas","fa-fw","fa-arrow-right-arrow-left","primary-text",2,"font-size","75px"],[1,"mb-0"],[3,"innerHTML"],[1,"mt-3","mb-0"],[1,"text-center"],[1,"alert","alert-error","mb-0"],["id","plugin-output",1,"mb-0",3,"hidden"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"d-inline-block","text-start","mt-3","mb-3",2,"list-style-type","none"],[1,"fa","fa-fw",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-primary","mb-0",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),y(4,"translate"),p(),c(5,"button",3),y(6,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(7,"div",4)(8,"div",5),x(9,"i",6),p(),c(10,"ul",7),x(11,"li",8),y(12,"translate"),c(13,"li"),E(14),y(15,"translate"),p(),x(16,"li",8),y(17,"translate"),w(18,FK,3,3,"li"),w(19,CK,5,6),p(),w(20,hK,2,3,"pre",9),w(21,gK,18,28,"div",10),w(22,bK,9,7,"div",11),x(23,"div",12),p(),c(24,"div",13)(25,"div",14),w(26,EK,4,7,"button",15),p(),c(27,"div",10),w(28,_K,4,7,"button",15),p(),c(29,"div",16),w(30,BK,3,3,"button",17),p()()()),i&2&&(l(3),L(B(4,15,"plugins.manage.scoped.switch")),l(2),b("disabled",n.installing||n.uninstalling||n.restarting),G("aria-label",B(6,17,"form.button_close")),l(6),b("innerHTML",He(12,19,"plugins.manage.scoped.info_1",tu(27,cK,n.prefix)),me),l(3),L(B(15,22,"plugins.manage.scoped_message")),l(2),b("innerHTML",He(17,24,"plugins.manage.scoped.info_2",tu(29,pK,n.moreInfo)),me),l(2),S(n.onlineUpdateOk?18:-1),l(),S(n.onlineUpdateOk?-1:19),l(),S(n.onlineUpdateOk?-1:20),l(),S(n.onlineUpdateOk?21:-1),l(),S(n.failure?22:-1),l(),b("hidden",!n.onlineUpdateOk||n.failure),l(3),S(n.onlineUpdateOk?26:-1),l(2),S(n.onlineUpdateOk?-1:28),l(2),S(n.onlineUpdateOk?30:-1))},dependencies:[zt,$e],styles:["#plugin-output[_ngcontent-%COMP%]{height:150px;overflow-y:auto;overflow-x:hidden}"]})}return e})();var xK=e=>({pluginName:e}),wK=e=>({count:e});function SK(e,u){e&1&&(c(0,"div",5),x(1,"i",13),p())}function IK(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"plugins.uninstall_remove_child_bridge")," ")}function AK(e,u){if(e&1&&(E(0),y(1,"translate")),e&2){let t=h(4);q(" ",He(1,1,"plugins.uninstall_remove_child_bridges",tu(4,wK,t.childBridges.length))," ")}}function $K(e,u){if(e&1){let t=H();c(0,"label",24)(1,"input",25),Me("ngModelChange",function(n){j(t);let f=h(3);return Oe(f.removeChildBridges,n)||(f.removeChildBridges=n),N(n)}),p(),w(2,IK,2,3),w(3,AK,2,6),x(4,"span",23),p()}if(e&2){let t=h(3);l(),Pe("ngModel",t.removeChildBridges),l(),S(t.childBridges.length===1?2:-1),l(),S(t.childBridges.length>1?3:-1)}}function kK(e,u){if(e&1){let t=H();c(0,"p",16)(1,"label",21)(2,"input",22),Me("ngModelChange",function(n){j(t);let f=h(2);return Oe(f.removeConfig,n)||(f.removeConfig=n),N(n)}),p(),E(3),y(4,"translate"),x(5,"span",23),p(),w(6,$K,5,3,"label",24),p()}if(e&2){let t=h(2);l(2),Pe("ngModel",t.removeConfig),l(),q(" ",B(4,3,"plugins.uninstall_remove_plugin_config")," "),l(3),S(t.hasChildBridges?6:-1)}}function TK(e,u){e&1&&(c(0,"ul",17)(1,"li"),E(2),y(3,"translate"),p(),c(4,"li"),E(5),y(6,"translate"),p()()),e&2&&(l(2),L(B(3,2,"plugins.uninstall_warn_1")),l(3),L(B(6,4,"plugins.uninstall_warn_2")))}function PK(e,u){e&1&&(c(0,"ngb-alert",18),E(1),y(2,"translate"),p()),e&2&&(b("dismissible",!1),l(),q(" ",B(2,2,"plugins.uninstall_remove_config_required")," "))}function OK(e,u){if(e&1&&(c(0,"div",14),x(1,"i",15),p(),c(2,"div",9),w(3,kK,7,5,"p",16),p(),w(4,TK,7,6,"ul",17),w(5,PK,3,4,"ngb-alert",18),c(6,"ngb-alert",19)(7,"p",20),E(8),y(9,"translate"),p()()),e&2){let t=h();l(3),S(t.isConfigured?3:-1),l(),S(t.hasChildBridges&&t.removeChildBridges?4:-1),l(),S(t.isConfigured&&(!t.pluginAlias||!t.pluginType)?5:-1),l(),b("dismissible",!1),l(2),L(He(9,5,"plugins.uninstall_remove_confirmation",tu(8,xK,t.plugin.displayName)))}}function MK(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"plugins.manage.uninstall")," ")}function jK(e,u){e&1&&x(0,"i",12)}var tb=(()=>{class e{$activeModal=I(Ae);$api=I(be);$modal=I(it);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);plugin;childBridges;action;loading=!0;uninstalling=!1;removeConfig=!0;removeChildBridges=!0;hasChildBridges=!1;isConfigured=!1;pluginType;pluginAlias;constructor(){}ngOnInit(){return K(this,null,function*(){try{this.childBridges.length&&(this.hasChildBridges=!0);let t=yield this.getAlias();this.pluginType=t.pluginType,this.pluginAlias=t.pluginAlias,(yield re(this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`))).length&&(this.isConfigured=!0)}finally{this.loading=!1}})}doUninstall(){return K(this,null,function*(){if(this.uninstalling=!0,this.removeConfig&&this.isConfigured)try{yield this.removePluginConfig()}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.config.remove_error"),this.$translate.instant("toast.title_error"))}if(this.hasChildBridges&&this.removeChildBridges)try{yield Promise.all(this.childBridges.map(i=>this.removeChildBridge(i.username.replace(/:/g,""))))}catch(i){console.error(i)}this.$activeModal.dismiss();let t=this.$modal.open(Zn,{size:"lg",backdrop:"static"});t.componentInstance.action="Uninstall",t.componentInstance.pluginName=this.plugin.name,t.componentInstance.pluginDisplayName=this.plugin.displayName})}getAlias(){return K(this,null,function*(){return re(this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`))})}removePluginConfig(){return K(this,null,function*(){yield re(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,[])),yield re(this.$api.put(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}/enable`,{})),this.$toastr.success(this.$translate.instant("plugins.settings.plugin_config_saved"),this.$translate.instant("toast.title_success"))})}removeChildBridge(t){return K(this,null,function*(){try{yield re(this.$api.delete(`/server/pairings/${t}`))}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.uninstall_bridge_error"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",childBridges:"childBridges",action:"action"},decls:20,vars:17,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-trash","primary-text",2,"font-size","75px"],[1,"d-inline-block","text-start","mb-1"],[1,"mb-3","text-start"],["type","info",1,"mb-3",3,"dismissible"],["type","warning",1,"mb-0",3,"dismissible"],[1,"mb-0"],["for","remove-plugin-config",1,"hb-uix-switch","d-block"],["id","remove-plugin-config","type","checkbox",3,"ngModelChange","ngModel"],[1,"hb-uix-slider","hb-uix-round"],["for","remove-plugin-child-bridges",1,"hb-uix-switch","d-block"],["id","remove-plugin-child-bridges","type","checkbox",3,"ngModelChange","ngModel"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),p(),c(4,"button",3),y(5,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(6,"div",4),w(7,SK,2,0,"div",5),w(8,OK,10,10),p(),c(9,"div",6)(10,"div",7)(11,"button",8),y(12,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),E(13),y(14,"translate"),p()(),x(15,"div",9),c(16,"div",10)(17,"button",11),M("click",function(){return n.doUninstall()}),w(18,MK,2,3),w(19,jK,1,0,"i",12),p()()()()),i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),b("disabled",n.uninstalling),G("aria-label",B(5,11,"form.button_close")),l(3),S(n.loading?7:-1),l(),S(n.loading?-1:8),l(3),b("disabled",n.uninstalling),G("aria-label",B(12,13,"form.button_close")),l(2),q(" ",B(14,15,"form.button_close")," "),l(4),b("disabled",n.loading||n.uninstalling),l(),S(n.uninstalling?-1:18),l(),S(n.uninstalling?19:-1))},dependencies:[uu,Xu,vt,Yu,cu,$e],encapsulation:2})}return e})();var _i=(()=>{class e{$api=I(be);$modal=I(it);$customPluginsService=I(y6);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);constructor(){}installPlugin(t,i="latest"){let n=this.$modal.open(Zn,{size:"lg",backdrop:"static"});n.componentInstance.action="Install",n.componentInstance.pluginName=t.name,n.componentInstance.pluginDisplayName=t.displayName,n.componentInstance.targetVersion=i}uninstallPlugin(t,i){let n=this.$modal.open(tb,{size:"lg",backdrop:"static"});n.componentInstance.action="Uninstall",n.componentInstance.plugin=t,n.componentInstance.childBridges=i}checkAndUpdatePlugin(t,i="latest"){return K(this,null,function*(){(yield this.checkHbAndNodeVersion(t,"update"))&&(yield this.updatePlugin(t,i))})}updatePlugin(t,i){return K(this,null,function*(){let n=this.$modal.open(Zn,{size:"lg",backdrop:"static"});n.componentInstance.action="Update",n.componentInstance.pluginName=t.name,n.componentInstance.pluginDisplayName=t.displayName,n.componentInstance.targetVersion=i,n.componentInstance.latestVersion=t.latestVersion,n.componentInstance.installedVersion=t.installedVersion,n.componentInstance.isDisabled=t.disabled})}upgradeHomebridge(t,i="latest"){return K(this,null,function*(){if(!(yield this.checkHbAndNodeVersion(t,"update")))return;let n=this.$modal.open(Zn,{size:"lg",backdrop:"static"});n.componentInstance.action="Update",n.componentInstance.pluginName=t.name,n.componentInstance.pluginDisplayName=t.displayName,n.componentInstance.targetVersion=i,n.componentInstance.latestVersion=t.latestVersion,n.componentInstance.installedVersion=t.installedVersion})}installAlternateVersion(t){return K(this,null,function*(){let i=this.$modal.open(M6,{size:"lg",backdrop:"static"});i.componentInstance.plugin=t;try{let{action:n,version:f,engines:r}=yield i.result;return(yield this.checkHbAndNodeVersion(xe(X({},t),{updateEngines:r}),n))?t.name==="homebridge"?yield this.upgradeHomebridge(t,f):t.installedVersion?yield this.updatePlugin(t,f):this.installPlugin(t,f):void 0}catch{}})}bridgeSettings(t,i=!1){return K(this,null,function*(){let n;if(t.settingsSchema)try{n=yield this.loadConfigSchema(t.name)}catch(r){console.error(r),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugin_schema"),this.$translate.instant("toast.title_error"));return}let f=this.$modal.open(q6,{size:"lg",backdrop:"static"});f.componentInstance.schema=n,f.componentInstance.plugin=t,f.componentInstance.justInstalled=i})}settings(t){return K(this,null,function*(){let i;if(t.settingsSchema)try{i=yield this.loadConfigSchema(t.name)}catch(f){console.error(f),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugin_schema"),this.$translate.instant("toast.title_error"));return}if(i&&i.customUi)return this.$customPluginsService.openCustomSettingsUi(t,i);if(this.$customPluginsService.plugins[t.name])return this.$customPluginsService.openSettings(t,i);let n=this.$modal.open(t.settingsSchema?G6:Yl,{size:"lg",backdrop:"static"});return n.componentInstance.schema=i,n.componentInstance.plugin=t,n.result.catch(()=>{})})}jsonEditor(t){return K(this,null,function*(){let i;if(t.settingsSchema)try{i=yield this.loadConfigSchema(t.name)}catch(f){console.error(f)}let n=this.$modal.open(Yl,{size:"lg",backdrop:"static"});return n.componentInstance.schema=i,n.componentInstance.plugin=t,n.result.catch(f=>console.error(f))})}checkHbAndNodeVersion(t,i){return K(this,null,function*(){let n=!0,f=!0;try{t.updateEngines?.node&&(0,Qn.lt)(this.$settings.env.nodeVersion,(0,Qn.minVersion)(t.updateEngines.node))&&(n=!1),t.updateEngines?.homebridge&&(0,Qn.lt)(this.$settings.env.homebridgeVersion,(0,Qn.minVersion)(t.updateEngines.homebridge))&&(f=!1)}catch(r){return console.error(r),this.$toastr.error(r.message,this.$translate.instant("toast.title_error")),!1}if(!n||!f)try{let r=this.$modal.open(R6,{size:"lg",backdrop:"static"});return r.componentInstance.plugin=t,r.componentInstance.isValidNode=n,r.componentInstance.isValidHb=f,r.componentInstance.action=i,yield r.result}catch{return!1}return!0})}loadConfigSchema(t){return K(this,null,function*(){return re(this.$api.get(`/plugins/config-schema/${encodeURIComponent(t)}`))})}resetChildBridges(t){return K(this,null,function*(){let i=this.$modal.open(J6,{size:"lg",backdrop:"static"});i.componentInstance.childBridges=t})}switchToScoped(t){return K(this,null,function*(){let i=this.$modal.open(eb,{size:"lg",backdrop:"static"});i.componentInstance.plugin=t})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{Gl as a,Vl as b,tt as c,sQ as d,Xe as e,g4 as f,E4 as g,Nl as h,mq as i,_4 as j,_6 as k,y6 as l,w6 as m,I6 as n,Zn as o,M6 as p,Yl as q,q6 as r,R6 as s,G6 as t,tb as u,_i as v};
29
+ `)})}doSwitch(){this.installing=!0,this.io.request("install",{name:this.plugin.newHbScope.to,version:this.plugin.newHbScope.switch,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.installing=!1,this.installed=!0,this.uninstalling=!0,this.io.request("uninstall",{name:this.plugin.newHbScope.from,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.uninstalling=!1,this.uninstalled=!0,this.restarting=!0,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$activeModal.close(),this.$router.navigate(["/restart"])},error:t=>{this.restarting=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})},error:t=>{this.uninstalling=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})},error:t=>{this.installing=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}downloadLogFile(){let t=new Blob([this.errorLog],{type:"text/plain;charset=utf-8"});(0,Y6.saveAs)(t,`${this.plugin.name}-error.log`)}ngOnDestroy(){this.io.end(),this.term.dispose()}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:31,vars:31,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"mb-3","text-center"],[1,"fas","fa-fw","fa-arrow-right-arrow-left","primary-text",2,"font-size","75px"],[1,"mb-0"],[3,"innerHTML"],[1,"mt-3","mb-0"],[1,"text-center"],[1,"alert","alert-error","mb-0"],["id","plugin-output",1,"mb-0",3,"hidden"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"d-inline-block","text-start","mt-3","mb-3",2,"list-style-type","none"],[1,"fa","fa-fw",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-primary","mb-0",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),y(4,"translate"),p(),c(5,"button",3),y(6,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(7,"div",4)(8,"div",5),x(9,"i",6),p(),c(10,"ul",7),x(11,"li",8),y(12,"translate"),c(13,"li"),E(14),y(15,"translate"),p(),x(16,"li",8),y(17,"translate"),w(18,FK,3,3,"li"),w(19,CK,5,6),p(),w(20,hK,2,3,"pre",9),w(21,gK,18,28,"div",10),w(22,bK,9,7,"div",11),x(23,"div",12),p(),c(24,"div",13)(25,"div",14),w(26,EK,4,7,"button",15),p(),c(27,"div",10),w(28,_K,4,7,"button",15),p(),c(29,"div",16),w(30,BK,3,3,"button",17),p()()()),i&2&&(l(3),L(B(4,15,"plugins.manage.scoped.switch")),l(2),b("disabled",n.installing||n.uninstalling||n.restarting),G("aria-label",B(6,17,"form.button_close")),l(6),b("innerHTML",He(12,19,"plugins.manage.scoped.info_1",tu(27,cK,n.prefix)),me),l(3),L(B(15,22,"plugins.manage.scoped_message")),l(2),b("innerHTML",He(17,24,"plugins.manage.scoped.info_2",tu(29,pK,n.moreInfo)),me),l(2),S(n.onlineUpdateOk?18:-1),l(),S(n.onlineUpdateOk?-1:19),l(),S(n.onlineUpdateOk?-1:20),l(),S(n.onlineUpdateOk?21:-1),l(),S(n.failure?22:-1),l(),b("hidden",!n.onlineUpdateOk||n.failure),l(3),S(n.onlineUpdateOk?26:-1),l(2),S(n.onlineUpdateOk?-1:28),l(2),S(n.onlineUpdateOk?30:-1))},dependencies:[zt,$e],styles:["#plugin-output[_ngcontent-%COMP%]{height:150px;overflow-y:auto;overflow-x:hidden}"]})}return e})();var xK=e=>({pluginName:e}),wK=e=>({count:e});function SK(e,u){e&1&&(c(0,"div",5),x(1,"i",13),p())}function IK(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"plugins.uninstall_remove_child_bridge")," ")}function AK(e,u){if(e&1&&(E(0),y(1,"translate")),e&2){let t=h(4);q(" ",He(1,1,"plugins.uninstall_remove_child_bridges",tu(4,wK,t.childBridges.length))," ")}}function $K(e,u){if(e&1){let t=H();c(0,"label",24)(1,"input",25),Me("ngModelChange",function(n){j(t);let f=h(3);return Oe(f.removeChildBridges,n)||(f.removeChildBridges=n),N(n)}),p(),w(2,IK,2,3),w(3,AK,2,6),x(4,"span",23),p()}if(e&2){let t=h(3);l(),Pe("ngModel",t.removeChildBridges),l(),S(t.childBridges.length===1?2:-1),l(),S(t.childBridges.length>1?3:-1)}}function kK(e,u){if(e&1){let t=H();c(0,"p",16)(1,"label",21)(2,"input",22),Me("ngModelChange",function(n){j(t);let f=h(2);return Oe(f.removeConfig,n)||(f.removeConfig=n),N(n)}),p(),E(3),y(4,"translate"),x(5,"span",23),p(),w(6,$K,5,3,"label",24),p()}if(e&2){let t=h(2);l(2),Pe("ngModel",t.removeConfig),l(),q(" ",B(4,3,"plugins.uninstall_remove_plugin_config")," "),l(3),S(t.hasChildBridges?6:-1)}}function TK(e,u){e&1&&(c(0,"ul",17)(1,"li"),E(2),y(3,"translate"),p(),c(4,"li"),E(5),y(6,"translate"),p()()),e&2&&(l(2),L(B(3,2,"plugins.uninstall_warn_1")),l(3),L(B(6,4,"plugins.uninstall_warn_2")))}function PK(e,u){e&1&&(c(0,"ngb-alert",18),E(1),y(2,"translate"),p()),e&2&&(b("dismissible",!1),l(),q(" ",B(2,2,"plugins.uninstall_remove_config_required")," "))}function OK(e,u){if(e&1&&(c(0,"div",14),x(1,"i",15),p(),c(2,"div",9),w(3,kK,7,5,"p",16),p(),w(4,TK,7,6,"ul",17),w(5,PK,3,4,"ngb-alert",18),c(6,"ngb-alert",19)(7,"p",20),E(8),y(9,"translate"),p()()),e&2){let t=h();l(3),S(t.isConfigured?3:-1),l(),S(t.hasChildBridges&&t.removeChildBridges?4:-1),l(),S(t.isConfigured&&(!t.pluginAlias||!t.pluginType)?5:-1),l(),b("dismissible",!1),l(2),L(He(9,5,"plugins.uninstall_remove_confirmation",tu(8,xK,t.plugin.displayName)))}}function MK(e,u){e&1&&(E(0),y(1,"translate")),e&2&&q(" ",B(1,1,"plugins.manage.uninstall")," ")}function jK(e,u){e&1&&x(0,"i",12)}var tb=(()=>{class e{$activeModal=I(Ae);$api=I(be);$modal=I(it);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);plugin;childBridges;action;loading=!0;uninstalling=!1;removeConfig=!0;removeChildBridges=!0;hasChildBridges=!1;isConfigured=!1;pluginType;pluginAlias;constructor(){}ngOnInit(){return K(this,null,function*(){try{this.childBridges.length&&(this.hasChildBridges=!0);let t=yield this.getAlias();this.pluginType=t.pluginType,this.pluginAlias=t.pluginAlias,(yield re(this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`))).length&&(this.isConfigured=!0)}finally{this.loading=!1}})}doUninstall(){return K(this,null,function*(){if(this.uninstalling=!0,this.removeConfig&&this.isConfigured)try{yield this.removePluginConfig()}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.config.remove_error"),this.$translate.instant("toast.title_error"))}if(this.hasChildBridges&&this.removeChildBridges)try{yield Promise.all(this.childBridges.map(i=>this.removeChildBridge(i.username.replace(/:/g,""))))}catch(i){console.error(i)}this.$activeModal.dismiss();let t=this.$modal.open(Zn,{size:"lg",backdrop:"static"});t.componentInstance.action="Uninstall",t.componentInstance.pluginName=this.plugin.name,t.componentInstance.pluginDisplayName=this.plugin.displayName})}getAlias(){return K(this,null,function*(){return re(this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`))})}removePluginConfig(){return K(this,null,function*(){yield re(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,[])),yield re(this.$api.put(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}/enable`,{})),this.$toastr.success(this.$translate.instant("plugins.settings.plugin_config_saved"),this.$translate.instant("toast.title_success"))})}removeChildBridge(t){return K(this,null,function*(){try{yield re(this.$api.delete(`/server/pairings/${t}`))}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.uninstall_bridge_error"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=Y({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",childBridges:"childBridges",action:"action"},decls:20,vars:17,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-trash","primary-text",2,"font-size","75px"],[1,"d-inline-block","text-start","mb-1"],[1,"mb-3","text-start"],["type","info",1,"mb-3",3,"dismissible"],["type","warning",1,"mb-0",3,"dismissible"],[1,"mb-0"],["for","remove-plugin-config",1,"hb-uix-switch","d-block"],["id","remove-plugin-config","type","checkbox",3,"ngModelChange","ngModel"],[1,"hb-uix-slider","hb-uix-round"],["for","remove-plugin-child-bridges",1,"hb-uix-switch","d-block"],["id","remove-plugin-child-bridges","type","checkbox",3,"ngModelChange","ngModel"]],template:function(i,n){i&1&&(c(0,"div",0)(1,"div",1)(2,"h5",2),E(3),p(),c(4,"button",3),y(5,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),p()(),c(6,"div",4),w(7,SK,2,0,"div",5),w(8,OK,10,10),p(),c(9,"div",6)(10,"div",7)(11,"button",8),y(12,"translate"),M("click",function(){return n.$activeModal.dismiss("Dismiss")}),E(13),y(14,"translate"),p()(),x(15,"div",9),c(16,"div",10)(17,"button",11),M("click",function(){return n.doUninstall()}),w(18,MK,2,3),w(19,jK,1,0,"i",12),p()()()()),i&2&&(l(3),L(n.plugin.displayName||n.plugin.name),l(),b("disabled",n.uninstalling),G("aria-label",B(5,11,"form.button_close")),l(3),S(n.loading?7:-1),l(),S(n.loading?-1:8),l(3),b("disabled",n.uninstalling),G("aria-label",B(12,13,"form.button_close")),l(2),q(" ",B(14,15,"form.button_close")," "),l(4),b("disabled",n.loading||n.uninstalling),l(),S(n.uninstalling?-1:18),l(),S(n.uninstalling?19:-1))},dependencies:[uu,Xu,vt,Yu,cu,$e],encapsulation:2})}return e})();var _i=(()=>{class e{$api=I(be);$modal=I(it);$customPluginsService=I(y6);$settings=I(Le);$toastr=I(_e);$translate=I(Ee);constructor(){}installPlugin(t,i){let n=this.$modal.open(Zn,{size:"lg",backdrop:"static"});n.componentInstance.action="Install",n.componentInstance.pluginName=t.name,n.componentInstance.pluginDisplayName=t.displayName,n.componentInstance.targetVersion=i}uninstallPlugin(t,i){let n=this.$modal.open(tb,{size:"lg",backdrop:"static"});n.componentInstance.action="Uninstall",n.componentInstance.plugin=t,n.componentInstance.childBridges=i}checkAndUpdatePlugin(t,i){return K(this,null,function*(){(yield this.checkHbAndNodeVersion(t,"update"))&&(yield this.updatePlugin(t,i))})}updatePlugin(t,i){return K(this,null,function*(){let n=this.$modal.open(Zn,{size:"lg",backdrop:"static"});n.componentInstance.action="Update",n.componentInstance.pluginName=t.name,n.componentInstance.pluginDisplayName=t.displayName,n.componentInstance.targetVersion=i,n.componentInstance.latestVersion=t.latestVersion,n.componentInstance.installedVersion=t.installedVersion,n.componentInstance.isDisabled=t.disabled})}upgradeHomebridge(t,i){return K(this,null,function*(){if(!(yield this.checkHbAndNodeVersion(t,"update")))return;let n=this.$modal.open(Zn,{size:"lg",backdrop:"static"});n.componentInstance.action="Update",n.componentInstance.pluginName=t.name,n.componentInstance.pluginDisplayName=t.displayName,n.componentInstance.targetVersion=i,n.componentInstance.latestVersion=t.latestVersion,n.componentInstance.installedVersion=t.installedVersion})}installAlternateVersion(t){return K(this,null,function*(){let i=this.$modal.open(M6,{size:"lg",backdrop:"static"});i.componentInstance.plugin=t;try{let{action:n,version:f,engines:r}=yield i.result;return(yield this.checkHbAndNodeVersion(xe(X({},t),{updateEngines:r}),n))?t.name==="homebridge"?yield this.upgradeHomebridge(t,f):t.installedVersion?yield this.updatePlugin(t,f):this.installPlugin(t,f):void 0}catch{}})}bridgeSettings(t,i=!1){return K(this,null,function*(){let n;if(t.settingsSchema)try{n=yield this.loadConfigSchema(t.name)}catch(r){console.error(r),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugin_schema"),this.$translate.instant("toast.title_error"));return}let f=this.$modal.open(q6,{size:"lg",backdrop:"static"});f.componentInstance.schema=n,f.componentInstance.plugin=t,f.componentInstance.justInstalled=i})}settings(t){return K(this,null,function*(){let i;if(t.settingsSchema)try{i=yield this.loadConfigSchema(t.name)}catch(f){console.error(f),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugin_schema"),this.$translate.instant("toast.title_error"));return}if(i&&i.customUi)return this.$customPluginsService.openCustomSettingsUi(t,i);if(this.$customPluginsService.plugins[t.name])return this.$customPluginsService.openSettings(t,i);let n=this.$modal.open(t.settingsSchema?G6:Yl,{size:"lg",backdrop:"static"});return n.componentInstance.schema=i,n.componentInstance.plugin=t,n.result.catch(()=>{})})}jsonEditor(t){return K(this,null,function*(){let i;if(t.settingsSchema)try{i=yield this.loadConfigSchema(t.name)}catch(f){console.error(f)}let n=this.$modal.open(Yl,{size:"lg",backdrop:"static"});return n.componentInstance.schema=i,n.componentInstance.plugin=t,n.result.catch(f=>console.error(f))})}checkHbAndNodeVersion(t,i){return K(this,null,function*(){let n=!0,f=!0;try{t.updateEngines?.node&&(0,Qn.lt)(this.$settings.env.nodeVersion,(0,Qn.minVersion)(t.updateEngines.node))&&(n=!1),t.updateEngines?.homebridge&&(0,Qn.lt)(this.$settings.env.homebridgeVersion,(0,Qn.minVersion)(t.updateEngines.homebridge))&&(f=!1)}catch(r){return console.error(r),this.$toastr.error(r.message,this.$translate.instant("toast.title_error")),!1}if(!n||!f)try{let r=this.$modal.open(R6,{size:"lg",backdrop:"static"});return r.componentInstance.plugin=t,r.componentInstance.isValidNode=n,r.componentInstance.isValidHb=f,r.componentInstance.action=i,yield r.result}catch{return!1}return!0})}loadConfigSchema(t){return K(this,null,function*(){return re(this.$api.get(`/plugins/config-schema/${encodeURIComponent(t)}`))})}resetChildBridges(t){return K(this,null,function*(){let i=this.$modal.open(J6,{size:"lg",backdrop:"static"});i.componentInstance.childBridges=t})}switchToScoped(t){return K(this,null,function*(){let i=this.$modal.open(eb,{size:"lg",backdrop:"static"});i.componentInstance.plugin=t})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{Gl as a,Vl as b,tt as c,sQ as d,Xe as e,g4 as f,E4 as g,Nl as h,mq as i,_4 as j,_6 as k,y6 as l,w6 as m,I6 as n,Zn as o,M6 as p,Yl as q,q6 as r,R6 as s,G6 as t,tb as u,_i as v};