homebridge-config-ui-x 5.2.1-beta.1 → 5.2.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/main.js +1 -1
  3. package/dist/main.js.map +1 -1
  4. package/dist/modules/plugins/plugins.controller.js +0 -1
  5. package/dist/modules/plugins/plugins.controller.js.map +1 -1
  6. package/package.json +8 -8
  7. package/public/assets/monaco/min/vs/base/worker/workerMain.js +153 -142
  8. package/public/assets/monaco/min/vs/basic-languages/shell/shell.js +2 -2
  9. package/public/assets/monaco/min/vs/editor/editor.main.css +2 -2
  10. package/public/assets/monaco/min/vs/editor/editor.main.js +2309 -2158
  11. package/public/assets/monaco/min/vs/editor/editor.main.nls.js +32 -25
  12. package/public/assets/monaco/min/vs/language/json/jsonMode.js +2 -2
  13. package/public/assets/monaco/min/vs/language/json/jsonWorker.js +2 -2
  14. package/public/assets/monaco/min/vs/loader.js +32 -32
  15. package/public/{chunk-2C3RWXKQ.js → chunk-257Z3FEX.js} +1 -1
  16. package/public/chunk-2DZLV6J3.js +1 -0
  17. package/public/{chunk-HJ4ICK2R.js → chunk-2YY7HCF4.js} +1 -1
  18. package/public/{chunk-CDCRD6XO.js → chunk-35OEX2R2.js} +1 -1
  19. package/public/{chunk-476RQ3NX.js → chunk-3HR7D3CJ.js} +1 -1
  20. package/public/{chunk-SVAR3FIQ.js → chunk-4ZYGJMXW.js} +1 -1
  21. package/public/{chunk-NP3V73ET.js → chunk-53FPP2IJ.js} +1 -1
  22. package/public/{chunk-WNF5D33J.js → chunk-5ZKOITQZ.js} +1 -1
  23. package/public/{chunk-2J6ZQMG6.js → chunk-6P5CBUSK.js} +1 -1
  24. package/public/chunk-6RB567N4.js +4 -0
  25. package/public/{chunk-BTJTPB64.js → chunk-7622KGTL.js} +1 -1
  26. package/public/{chunk-2HIOHBJY.js → chunk-7HCGM76M.js} +1 -1
  27. package/public/{chunk-UYM3XX25.js → chunk-7ILRTIPC.js} +1 -1
  28. package/public/{chunk-VC34WV7F.js → chunk-A3SWYDYK.js} +1 -1
  29. package/public/{chunk-JHLOMHBB.js → chunk-AUWR5H2A.js} +1 -1
  30. package/public/chunk-BCK7KVRQ.js +1 -0
  31. package/public/{chunk-QKWUY26L.js → chunk-E74SDSOB.js} +1 -1
  32. package/public/{chunk-MHTDGCRA.js → chunk-FAELDM7K.js} +1 -1
  33. package/public/chunk-FM3OFRLV.js +1 -0
  34. package/public/{chunk-2DDZC7QA.js → chunk-GK4OAY7M.js} +1 -1
  35. package/public/{chunk-YEYPP7U2.js → chunk-IOZZWAPL.js} +1 -1
  36. package/public/{chunk-T4LX3SC4.js → chunk-JQTSHXFE.js} +1 -1
  37. package/public/{chunk-HAW5WR2X.js → chunk-L2KN725U.js} +1 -1
  38. package/public/{chunk-5PTHEKSX.js → chunk-LHPZ4GZG.js} +1 -1
  39. package/public/{chunk-COFFIBVI.js → chunk-LMME7DF7.js} +1 -1
  40. package/public/{chunk-7CJ7A4LZ.js → chunk-LWX72DT2.js} +1 -1
  41. package/public/{chunk-4MWWDRFR.js → chunk-MSF5I4U2.js} +1 -1
  42. package/public/{chunk-PEL5FBN3.js → chunk-N5JWFVOK.js} +1 -1
  43. package/public/{chunk-N4CMSHPE.js → chunk-N5XBHM63.js} +1 -1
  44. package/public/{chunk-5DOV2IV3.js → chunk-NGIL2WPB.js} +1 -1
  45. package/public/{chunk-24IPJ4EL.js → chunk-NM63HVCD.js} +1 -1
  46. package/public/{chunk-XRMWGD7S.js → chunk-NO3KHC6W.js} +1 -1
  47. package/public/{chunk-ZWBBHOEC.js → chunk-NXVXHA2V.js} +1 -1
  48. package/public/{chunk-ZRCAXQK4.js → chunk-P7J6OX3V.js} +1 -1
  49. package/public/{chunk-R2YDG3AB.js → chunk-Q4VLAFNC.js} +1 -1
  50. package/public/{chunk-C4VRNIVO.js → chunk-Q5REQXYQ.js} +1 -1
  51. package/public/chunk-QXJKMGDB.js +1 -0
  52. package/public/{chunk-233JOSVL.js → chunk-R6XXAITV.js} +1 -1
  53. package/public/{chunk-E6ZNKUPT.js → chunk-RQRINXWC.js} +1 -1
  54. package/public/chunk-VH7ATYMN.js +1 -0
  55. package/public/{chunk-5HBKNIA2.js → chunk-WK6HLUOP.js} +1 -1
  56. package/public/{chunk-Z2Z26TH3.js → chunk-X2DFA2MY.js} +1 -1
  57. package/public/{chunk-JIF7Z4GX.js → chunk-XP3CHSCB.js} +1 -1
  58. package/public/chunk-XPNLZZEF.js +1 -0
  59. package/public/{chunk-L6VE5AKY.js → chunk-YEHVECR5.js} +1 -1
  60. package/public/{chunk-ICRMBJHC.js → chunk-YGYN2VIN.js} +1 -1
  61. package/public/chunk-ZT56WXIZ.js +2 -0
  62. package/public/index.html +1 -1
  63. package/public/main-AMBVFZVI.js +1 -0
  64. package/public/chunk-2OLK2DSX.js +0 -1
  65. package/public/chunk-DDAEYXAV.js +0 -2
  66. package/public/chunk-KY5Z2K4N.js +0 -1
  67. package/public/chunk-MUVWHC6J.js +0 -1
  68. package/public/chunk-P6IBW5WT.js +0 -4
  69. package/public/chunk-QDYHRXMR.js +0 -1
  70. package/public/chunk-VI75BLF4.js +0 -1
  71. package/public/chunk-YIHGVVVZ.js +0 -1
  72. package/public/main-NCEIFIQX.js +0 -1
@@ -1 +1 @@
1
- import{a as _,b as D}from"./chunk-MHTDGCRA.js";import{m as c,n as S}from"./chunk-SVAR3FIQ.js";import{f as x}from"./chunk-K7QEGT3E.js";import{C as v,g as O,ga as h,h as a,ha as E,ja as y,ka as l,la as f,nb as I,r as p,va as j,w as d,x as T,z as w}from"./chunk-V7SOQAC5.js";var g=new y("JWT_OPTIONS"),m=(()=>{class r{constructor(e=null){this.tokenGetter=e&&e.tokenGetter||function(){}}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:{t+="==";break}case 3:{t+="=";break}default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(t)}b64decode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="";if(e=String(e).replace(/=+$/,""),e.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let i=0,s,n,b=0;n=e.charAt(b++);~n&&(s=i%4?s*64+n:n,i++%4)?o+=String.fromCharCode(255&s>>(-2*i&6)):0)n=t.indexOf(n);return o}b64DecodeUnicode(e){return decodeURIComponent(Array.prototype.map.call(this.b64decode(e),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}decodeToken(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._decodeToken(t)):this._decodeToken(e)}_decodeToken(e){if(!e||e==="")return null;let t=e.split(".");if(t.length!==3)throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");let o=this.urlBase64Decode(t[1]);if(!o)throw new Error("Cannot decode the token.");return JSON.parse(o)}getTokenExpirationDate(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._getTokenExpirationDate(t)):this._getTokenExpirationDate(e)}_getTokenExpirationDate(e){let t;if(t=this.decodeToken(e),!t||!t.hasOwnProperty("exp"))return null;let o=new Date(0);return o.setUTCSeconds(t.exp),o}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(o=>this._isTokenExpired(o,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let o=this.getTokenExpirationDate(e);return t=t||0,o===null?!1:!(o.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return r.\u0275fac=function(e){return new(e||r)(l(g))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),$=r=>r instanceof Promise?v(()=>r):p(r),R=(()=>{class r{constructor(e,t,o){this.jwtHelper=t,this.document=o,this.standardPorts=["80","443"],this.tokenGetter=e.tokenGetter,this.headerName=e.headerName||"Authorization",this.authScheme=e.authScheme||e.authScheme===""?e.authScheme:"Bearer ",this.allowedDomains=e.allowedDomains||[],this.disallowedRoutes=e.disallowedRoutes||[],this.throwNoTokenError=e.throwNoTokenError||!1,this.skipWhenExpired=e.skipWhenExpired}isAllowedDomain(e){let t=new URL(e.url,this.document.location.origin);if(t.host===this.document.location.host)return!0;let o=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(i=>typeof i=="string"?i===o:i instanceof RegExp?i.test(o):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(o=>{if(typeof o=="string"){let i=new URL(o,this.document.location.origin);return i.hostname===t.hostname&&i.pathname===t.pathname}return o instanceof RegExp?o.test(e.url):!1})>-1}handleInterception(e,t,o){let i=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let s=p(!1);return this.skipWhenExpired&&(s=e?$(this.jwtHelper.isTokenExpired(e)):p(!0)),e?s.pipe(T(n=>n&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${i}${e}`}})),w(n=>o.handle(n))):o.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let o=this.tokenGetter(e);return $(o).pipe(w(i=>this.handleInterception(i,e,t)))}}return r.\u0275fac=function(e){return new(e||r)(l(g),l(m),l(j))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),F=(()=>{class r{constructor(e){if(e)throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.")}static forRoot(e){return{ngModule:r,providers:[{provide:x,useClass:R,multi:!0},e.jwtOptionsProvider||{provide:g,useValue:e.config},m]}}}return r.\u0275fac=function(e){return new(e||r)(l(r,12))},r.\u0275mod=I({type:r}),r.\u0275inj=E({}),r})();var k=O(_(),1);var q=(()=>{class r{$api=f(S);$jwtHelper=f(m);$settings=f(D);token;user={};logoutTimer;constructor(){this.loadToken()}login(e){return a(this,null,function*(){let t=yield d(this.$api.post("/auth/login",e));if(!this.validateToken(t.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(c.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings()})}noauth(){return a(this,null,function*(){let e=yield d(this.$api.post("/auth/noauth",{}));if(this.validateToken(e.access_token))window.localStorage.setItem(c.jwt.tokenKey,e.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,window.localStorage.removeItem(c.jwt.tokenKey),window.location.reload()}loadToken(){return a(this,null,function*(){this.$settings.settingsLoaded||(yield d(this.$settings.onSettingsLoaded));let e=window.localStorage.getItem(c.jwt.tokenKey);e&&this.validateToken(e)})}checkToken(){return a(this,null,function*(){try{return yield d(this.$api.get("/auth/check"))}catch(e){e.status===401&&(console.error("Current token is not valid"),this.logout())}})}isLoggedIn(){return this.$settings.env.instanceId!==this.user.instanceId?(console.error("Token does not match instance"),!1):this.user&&this.token&&!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)}validateToken(e){try{return this.$jwtHelper.isTokenExpired(e,this.$settings.serverTimeOffset)&&this.logout(),this.user=this.$jwtHelper.decodeToken(e),this.token=e,this.setLogoutTimer(),!0}catch{return window.localStorage.removeItem(c.jwt.tokenKey),this.token=null,!1}}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let t=(0,k.default)(this.$jwtHelper.getTokenExpirationDate(this.token)).diff((0,k.default)().add(this.$settings.serverTimeOffset,"s"),"millisecond");t<=2147483647&&(this.logoutTimer=setTimeout(()=>a(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),t))}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=h({token:r,factory:r.\u0275fac})}return r})();export{F as a,q as b};
1
+ import{a as _,b as D}from"./chunk-FAELDM7K.js";import{m as c,n as S}from"./chunk-4ZYGJMXW.js";import{f as x}from"./chunk-K7QEGT3E.js";import{C as v,g as O,ga as h,h as a,ha as E,ja as y,ka as l,la as f,nb as I,r as p,va as j,w as d,x as T,z as w}from"./chunk-V7SOQAC5.js";var g=new y("JWT_OPTIONS"),m=(()=>{class r{constructor(e=null){this.tokenGetter=e&&e.tokenGetter||function(){}}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:{t+="==";break}case 3:{t+="=";break}default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(t)}b64decode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="";if(e=String(e).replace(/=+$/,""),e.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let i=0,s,n,b=0;n=e.charAt(b++);~n&&(s=i%4?s*64+n:n,i++%4)?o+=String.fromCharCode(255&s>>(-2*i&6)):0)n=t.indexOf(n);return o}b64DecodeUnicode(e){return decodeURIComponent(Array.prototype.map.call(this.b64decode(e),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}decodeToken(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._decodeToken(t)):this._decodeToken(e)}_decodeToken(e){if(!e||e==="")return null;let t=e.split(".");if(t.length!==3)throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");let o=this.urlBase64Decode(t[1]);if(!o)throw new Error("Cannot decode the token.");return JSON.parse(o)}getTokenExpirationDate(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._getTokenExpirationDate(t)):this._getTokenExpirationDate(e)}_getTokenExpirationDate(e){let t;if(t=this.decodeToken(e),!t||!t.hasOwnProperty("exp"))return null;let o=new Date(0);return o.setUTCSeconds(t.exp),o}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(o=>this._isTokenExpired(o,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let o=this.getTokenExpirationDate(e);return t=t||0,o===null?!1:!(o.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return r.\u0275fac=function(e){return new(e||r)(l(g))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),$=r=>r instanceof Promise?v(()=>r):p(r),R=(()=>{class r{constructor(e,t,o){this.jwtHelper=t,this.document=o,this.standardPorts=["80","443"],this.tokenGetter=e.tokenGetter,this.headerName=e.headerName||"Authorization",this.authScheme=e.authScheme||e.authScheme===""?e.authScheme:"Bearer ",this.allowedDomains=e.allowedDomains||[],this.disallowedRoutes=e.disallowedRoutes||[],this.throwNoTokenError=e.throwNoTokenError||!1,this.skipWhenExpired=e.skipWhenExpired}isAllowedDomain(e){let t=new URL(e.url,this.document.location.origin);if(t.host===this.document.location.host)return!0;let o=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(i=>typeof i=="string"?i===o:i instanceof RegExp?i.test(o):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(o=>{if(typeof o=="string"){let i=new URL(o,this.document.location.origin);return i.hostname===t.hostname&&i.pathname===t.pathname}return o instanceof RegExp?o.test(e.url):!1})>-1}handleInterception(e,t,o){let i=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let s=p(!1);return this.skipWhenExpired&&(s=e?$(this.jwtHelper.isTokenExpired(e)):p(!0)),e?s.pipe(T(n=>n&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${i}${e}`}})),w(n=>o.handle(n))):o.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let o=this.tokenGetter(e);return $(o).pipe(w(i=>this.handleInterception(i,e,t)))}}return r.\u0275fac=function(e){return new(e||r)(l(g),l(m),l(j))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),F=(()=>{class r{constructor(e){if(e)throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.")}static forRoot(e){return{ngModule:r,providers:[{provide:x,useClass:R,multi:!0},e.jwtOptionsProvider||{provide:g,useValue:e.config},m]}}}return r.\u0275fac=function(e){return new(e||r)(l(r,12))},r.\u0275mod=I({type:r}),r.\u0275inj=E({}),r})();var k=O(_(),1);var q=(()=>{class r{$api=f(S);$jwtHelper=f(m);$settings=f(D);token;user={};logoutTimer;constructor(){this.loadToken()}login(e){return a(this,null,function*(){let t=yield d(this.$api.post("/auth/login",e));if(!this.validateToken(t.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(c.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings()})}noauth(){return a(this,null,function*(){let e=yield d(this.$api.post("/auth/noauth",{}));if(this.validateToken(e.access_token))window.localStorage.setItem(c.jwt.tokenKey,e.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,window.localStorage.removeItem(c.jwt.tokenKey),window.location.reload()}loadToken(){return a(this,null,function*(){this.$settings.settingsLoaded||(yield d(this.$settings.onSettingsLoaded));let e=window.localStorage.getItem(c.jwt.tokenKey);e&&this.validateToken(e)})}checkToken(){return a(this,null,function*(){try{return yield d(this.$api.get("/auth/check"))}catch(e){e.status===401&&(console.error("Current token is not valid"),this.logout())}})}isLoggedIn(){return this.$settings.env.instanceId!==this.user.instanceId?(console.error("Token does not match instance"),!1):this.user&&this.token&&!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)}validateToken(e){try{return this.$jwtHelper.isTokenExpired(e,this.$settings.serverTimeOffset)&&this.logout(),this.user=this.$jwtHelper.decodeToken(e),this.token=e,this.setLogoutTimer(),!0}catch{return window.localStorage.removeItem(c.jwt.tokenKey),this.token=null,!1}}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let t=(0,k.default)(this.$jwtHelper.getTokenExpirationDate(this.token)).diff((0,k.default)().add(this.$settings.serverTimeOffset,"s"),"millisecond");t<=2147483647&&(this.logoutTimer=setTimeout(()=>a(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),t))}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=h({token:r,factory:r.\u0275fac})}return r})();export{F as a,q as b};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-5HBKNIA2.js";import"./chunk-N4CMSHPE.js";import"./chunk-COFFIBVI.js";import"./chunk-2KOR6LRK.js";import"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import"./chunk-NP3V73ET.js";import"./chunk-2HIOHBJY.js";import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-MHTDGCRA.js";import"./chunk-SVAR3FIQ.js";import"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{ha as e,nb as t}from"./chunk-V7SOQAC5.js";var u=[{path:"",loadComponent:()=>import("./chunk-2DDZC7QA.js").then(o=>o.AccessoriesComponent)}],c=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=t({type:o});static \u0275inj=e({imports:[i.forChild(u),i]})}return o})();var l=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=t({type:o});static \u0275inj=e({imports:[s,c]})}return o})();export{l as AccessoriesModule};
1
+ import{a as s}from"./chunk-WK6HLUOP.js";import"./chunk-N5XBHM63.js";import"./chunk-LMME7DF7.js";import"./chunk-2KOR6LRK.js";import"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import"./chunk-53FPP2IJ.js";import"./chunk-7HCGM76M.js";import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-FAELDM7K.js";import"./chunk-4ZYGJMXW.js";import"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{ha as e,nb as t}from"./chunk-V7SOQAC5.js";var u=[{path:"",loadComponent:()=>import("./chunk-GK4OAY7M.js").then(o=>o.AccessoriesComponent)}],c=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=t({type:o});static \u0275inj=e({imports:[i.forChild(u),i]})}return o})();var l=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=t({type:o});static \u0275inj=e({imports:[s,c]})}return o})();export{l as AccessoriesModule};
@@ -1 +1 @@
1
- import{a as E}from"./chunk-5DOV2IV3.js";import{a as S}from"./chunk-ZRCAXQK4.js";import"./chunk-BSZ6MHFZ.js";import"./chunk-K46AA6SH.js";import"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import"./chunk-NP3V73ET.js";import"./chunk-2HIOHBJY.js";import{b as C}from"./chunk-MHTDGCRA.js";import"./chunk-SVAR3FIQ.js";import{b as w}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{$a as a,Hc as $,Ic as y,Sb as m,Sc as b,Tb as l,Ub as h,ab as c,bc as v,kc as f,la as s,lc as g,mb as u,n as d,qc as p,rc as T}from"./chunk-V7SOQAC5.js";var _=["terminaloutput"],L=(()=>{class r{$terminal=s(S);$settings=s(C);$navigationGuard=s(E);resizeEvent=new d;termTarget=b("terminaloutput");onWindowResize(){this.resizeEvent.next(void 0)}onBeforeUnload(n){return this.$navigationGuard.handleBeforeUnload(n)}onWindowFocus(){this.activateTerminal()}onClick(){this.activateTerminal()}activateTerminal(){this.$terminal.isTerminalReady()&&this.$terminal.term&&this.$terminal.term.focus()}ngOnInit(){if(window.document.querySelector("body").classList.add("bg-black"),this.$terminal.isTerminalReady()){!this.$settings.terminalPersistence&&this.$terminal.hasActiveSession()?(this.$terminal.destroyPersistentSession(),this.$terminal.startTerminal(this.termTarget(),{},this.resizeEvent)):this.$terminal.reconnectTerminal(this.termTarget(),{},this.resizeEvent),setTimeout(()=>{this.activateTerminal()},100);return}this.$settings.terminalPersistence&&this.$terminal.hasActiveSession()?this.$terminal.reconnectTerminal(this.termTarget(),{},this.resizeEvent):(!this.$settings.terminalPersistence&&this.$terminal.hasActiveSession()&&this.$terminal.destroyPersistentSession(),this.$terminal.startTerminal(this.termTarget(),{},this.resizeEvent)),setTimeout(()=>{this.activateTerminal()},100)}ngAfterViewInit(){document.addEventListener("visibilitychange",this.onVisibilityChange.bind(this))}onVisibilityChange(){!document.hidden&&this.$terminal.isTerminalReady()&&setTimeout(()=>{this.activateTerminal()},100)}canDeactivate(){return this.$navigationGuard.canDeactivate()}ngOnDestroy(){document.removeEventListener("visibilitychange",this.onVisibilityChange.bind(this)),window.document.querySelector("body").classList.remove("bg-black"),this.$settings.terminalPersistence?this.$terminal.detachTerminal():this.$terminal.destroyPersistentSession()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=u({type:r,selectors:[["ng-component"]],viewQuery:function(e,i){e&1&&f(i.termTarget,_,5),e&2&&g()},hostBindings:function(e,i){e&1&&v("resize",function(t){return i.onWindowResize(t)},a)("beforeunload",function(t){return i.onBeforeUnload(t)},a)("focus",function(t){return i.onWindowFocus(t)},a)("click",function(t){return i.onClick(t)})},decls:8,vars:3,consts:[["terminaloutput",""],[1,"row","mb-3"],[1,"col-12"],[1,"primary-text","m-0"],[1,"flex-column","d-flex","align-items-stretch","adjust-for-mobile"],["id","docker-terminal",1,"align-self-end","w-100","h-100","mb-1"]],template:function(e,i){e&1&&(m(0,"div",1)(1,"div",2)(2,"h3",3),p(3),$(4,"translate"),l()()(),m(5,"div",4),h(6,"div",5,0),l()),e&2&&(c(3),T(y(4,1,"menu.linux.label_terminal")))},dependencies:[w],encapsulation:2})}return r})();export{L as TerminalComponent};
1
+ import{a as E}from"./chunk-NGIL2WPB.js";import{a as S}from"./chunk-P7J6OX3V.js";import"./chunk-BSZ6MHFZ.js";import"./chunk-K46AA6SH.js";import"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import"./chunk-53FPP2IJ.js";import"./chunk-7HCGM76M.js";import{b as C}from"./chunk-FAELDM7K.js";import"./chunk-4ZYGJMXW.js";import{b as w}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{$a as a,Hc as $,Ic as y,Sb as m,Sc as b,Tb as l,Ub as h,ab as c,bc as v,kc as f,la as s,lc as g,mb as u,n as d,qc as p,rc as T}from"./chunk-V7SOQAC5.js";var _=["terminaloutput"],L=(()=>{class r{$terminal=s(S);$settings=s(C);$navigationGuard=s(E);resizeEvent=new d;termTarget=b("terminaloutput");onWindowResize(){this.resizeEvent.next(void 0)}onBeforeUnload(n){return this.$navigationGuard.handleBeforeUnload(n)}onWindowFocus(){this.activateTerminal()}onClick(){this.activateTerminal()}activateTerminal(){this.$terminal.isTerminalReady()&&this.$terminal.term&&this.$terminal.term.focus()}ngOnInit(){if(window.document.querySelector("body").classList.add("bg-black"),this.$terminal.isTerminalReady()){!this.$settings.terminalPersistence&&this.$terminal.hasActiveSession()?(this.$terminal.destroyPersistentSession(),this.$terminal.startTerminal(this.termTarget(),{},this.resizeEvent)):this.$terminal.reconnectTerminal(this.termTarget(),{},this.resizeEvent),setTimeout(()=>{this.activateTerminal()},100);return}this.$settings.terminalPersistence&&this.$terminal.hasActiveSession()?this.$terminal.reconnectTerminal(this.termTarget(),{},this.resizeEvent):(!this.$settings.terminalPersistence&&this.$terminal.hasActiveSession()&&this.$terminal.destroyPersistentSession(),this.$terminal.startTerminal(this.termTarget(),{},this.resizeEvent)),setTimeout(()=>{this.activateTerminal()},100)}ngAfterViewInit(){document.addEventListener("visibilitychange",this.onVisibilityChange.bind(this))}onVisibilityChange(){!document.hidden&&this.$terminal.isTerminalReady()&&setTimeout(()=>{this.activateTerminal()},100)}canDeactivate(){return this.$navigationGuard.canDeactivate()}ngOnDestroy(){document.removeEventListener("visibilitychange",this.onVisibilityChange.bind(this)),window.document.querySelector("body").classList.remove("bg-black"),this.$settings.terminalPersistence?this.$terminal.detachTerminal():this.$terminal.destroyPersistentSession()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=u({type:r,selectors:[["ng-component"]],viewQuery:function(e,i){e&1&&f(i.termTarget,_,5),e&2&&g()},hostBindings:function(e,i){e&1&&v("resize",function(t){return i.onWindowResize(t)},a)("beforeunload",function(t){return i.onBeforeUnload(t)},a)("focus",function(t){return i.onWindowFocus(t)},a)("click",function(t){return i.onClick(t)})},decls:8,vars:3,consts:[["terminaloutput",""],[1,"row","mb-3"],[1,"col-12"],[1,"primary-text","m-0"],[1,"flex-column","d-flex","align-items-stretch","adjust-for-mobile"],["id","docker-terminal",1,"align-self-end","w-100","h-100","mb-1"]],template:function(e,i){e&1&&(m(0,"div",1)(1,"div",2)(2,"h3",3),p(3),$(4,"translate"),l()()(),m(5,"div",4),h(6,"div",5,0),l()),e&2&&(c(3),T(y(4,1,"menu.linux.label_terminal")))},dependencies:[w],encapsulation:2})}return r})();export{L as TerminalComponent};
@@ -1 +1 @@
1
- import{d as u,g as s}from"./chunk-QRQBCPWO.js";import{k as l,n as d}from"./chunk-SVAR3FIQ.js";import{a as p}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{ga as c,h as f,ha as i,la as e,nb as n,w as m}from"./chunk-V7SOQAC5.js";var a=(()=>{class t{$api=e(d);$router=e(u);$toastr=e(l);$translate=e(p);resolve(){return f(this,null,function*(){try{let o=yield m(this.$api.get("/config-editor"));return JSON.stringify(o,null,4)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var y=[{path:"",loadComponent:()=>import("./chunk-XRMWGD7S.js").then(t=>t.ConfigEditorComponent),resolve:{config:a}}],v=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=n({type:t});static \u0275inj=i({imports:[s.forChild(y),s]})}return t})();var T=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=n({type:t});static \u0275inj=i({providers:[a],imports:[v]})}return t})();export{T as ConfigEditorModule};
1
+ import{d as u,g as s}from"./chunk-QRQBCPWO.js";import{k as l,n as d}from"./chunk-4ZYGJMXW.js";import{a as p}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{ga as c,h as f,ha as i,la as e,nb as n,w as m}from"./chunk-V7SOQAC5.js";var a=(()=>{class t{$api=e(d);$router=e(u);$toastr=e(l);$translate=e(p);resolve(){return f(this,null,function*(){try{let o=yield m(this.$api.get("/config-editor"));return JSON.stringify(o,null,4)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var y=[{path:"",loadComponent:()=>import("./chunk-NO3KHC6W.js").then(t=>t.ConfigEditorComponent),resolve:{config:a}}],v=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=n({type:t});static \u0275inj=i({imports:[s.forChild(y),s]})}return t})();var T=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=n({type:t});static \u0275inj=i({providers:[a],imports:[v]})}return t})();export{T as ConfigEditorModule};
@@ -0,0 +1 @@
1
+ import{a as M}from"./chunk-E74SDSOB.js";import{a as O}from"./chunk-YFQVSUDS.js";import"./chunk-BSZ6MHFZ.js";import{a as _}from"./chunk-K46AA6SH.js";import{n as z,t as E}from"./chunk-PSSVCFFV.js";import"./chunk-K2NEWUWG.js";import"./chunk-53FPP2IJ.js";import{b as H}from"./chunk-7HCGM76M.js";import"./chunk-FAELDM7K.js";import{k as F,n as V}from"./chunk-4ZYGJMXW.js";import{a as A,b as D}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{$a as $,Hb as u,Hc as a,Ib as x,Ic as s,Jb as C,Ob as f,Pb as c,Qb as r,Rb as m,Sc as k,_b as T,ab as l,bc as p,dc as b,g as q,h as w,kc as L,la as i,lc as S,mb as y,n as v,qc as I,ra as d,rc as B,sa as g}from"./chunk-V7SOQAC5.js";var N=q(O(),1);var Q=["logoutput"];function W(o,R){if(o&1){let t=T();c(0,"div",4)(1,"button",7),a(2,"translate"),a(3,"translate"),p("click",function(){d(t);let n=b();return g(n.downloadLogFile())}),m(4,"i",8),r(),c(5,"button",9),a(6,"translate"),a(7,"translate"),p("click",function(){d(t);let n=b();return g(n.truncateLogFile())}),m(8,"i",10),r()()}o&2&&(l(),f("ngbTooltip",s(2,4,"form.button_download")),u("aria-label",s(3,6,"form.button_download")),l(4),f("ngbTooltip",s(6,8,"form.button_delete")),u("aria-label",s(7,10,"form.button_delete")))}var it=(()=>{class o{$api=i(V);$auth=i(H);$log=i(M);$modal=i(z);$toastr=i(F);$translate=i(A);termTarget=k("logoutput");resizeEvent=new v;isAdmin=this.$auth.user.admin;onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){window.document.querySelector("body").classList.add("bg-black"),this.$log.startTerminal(this.termTarget(),{},this.resizeEvent)}ngOnDestroy(){window.document.querySelector("body").classList.remove("bg-black"),this.$log.destroyTerminal()}downloadLogFile(){let t=this.$modal.open(_,{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",{observe:"response",responseType:"blob"}).subscribe({next:e=>{(0,N.saveAs)(e.body,"homebridge.log.txt")},error:e=>w(this,null,function*(){let n;try{n=JSON.parse(yield e.error.text()).message}catch(h){console.error(h)}this.$toastr.error(n||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error"))})})}).catch(()=>{})}truncateLogFile(){let t=this.$modal.open(_,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("logs.title_truncate_log_file"),t.componentInstance.message=this.$translate.instant("logs.truncate_log_warning"),t.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_delete"),t.componentInstance.confirmButtonClass="btn-danger",t.componentInstance.faIconClass="fas fa-fw fa-circle-exclamation primary-text",t.result.then(()=>{this.$api.put("/platform-tools/hb-service/log/truncate",{}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("logs.log_file_truncated"),this.$translate.instant("toast.title_success")),this.$log.term.clear()},error:e=>{console.error(e),this.$toastr.error(e.error.message||this.$translate.instant("logs.truncate.error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=y({type:o,selectors:[["ng-component"]],viewQuery:function(e,n){e&1&&L(n.termTarget,Q,5),e&2&&S()},hostBindings:function(e,n){e&1&&p("resize",function(j){return n.onWindowResize(j)},$)},decls:9,vars:4,consts:[["logoutput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],[1,"flex-column","d-flex","align-items-stretch","adjust-for-mobile"],["id","log-output",1,"align-self-end","w-100","h-100","mb-1"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","ngbTooltip"],[1,"fas","fa-fw","fa-download"],["container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-0",3,"click","ngbTooltip"],[1,"fas","fa-fw","fa-trash-alt"]],template:function(e,n){e&1&&(c(0,"div",1)(1,"div",2)(2,"h3",3),I(3),a(4,"translate"),r()(),x(5,W,9,12,"div",4),r(),c(6,"div",5),m(7,"div",6,0),r()),e&2&&(l(3),B(s(4,2,"menu.linux.label_logs")),l(2),C(n.isAdmin?5:-1))},dependencies:[E,D],encapsulation:2})}return o})();export{it as LogsComponent};
@@ -1,4 +1,4 @@
1
- import{a as z,b as A,c as k}from"./chunk-BSZ6MHFZ.js";import{a as l}from"./chunk-NP3V73ET.js";import{M as n,g as r,ga as c,la as d,n as h}from"./chunk-V7SOQAC5.js";var f=r(z(),1),a=r(A(),1),p=r(k(),1);var $=(()=>{class t{$ws=d(l);io;fitAddon;webLinksAddon;resize;elementResize;pluginName;term;startTerminal(m,s={},u,w){this.pluginName=w,this.elementResize=u,this.io=this.$ws.connectToNamespace("log"),this.term=new p.Terminal(s),setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.fitAddon=new f.FitAddon,this.webLinksAddon=new a.WebLinksAddon,this.resize=new h,this.term.open(m.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),this.io.connected.subscribe(()=>{this.term.reset(),this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows})}),this.io.socket.on("disconnect",()=>{this.term.write(`
1
+ import{a as z,b as A,c as k}from"./chunk-BSZ6MHFZ.js";import{a as l}from"./chunk-53FPP2IJ.js";import{M as n,g as r,ga as c,la as d,n as h}from"./chunk-V7SOQAC5.js";var f=r(z(),1),a=r(A(),1),p=r(k(),1);var $=(()=>{class t{$ws=d(l);io;fitAddon;webLinksAddon;resize;elementResize;pluginName;term;startTerminal(m,s={},u,w){this.pluginName=w,this.elementResize=u,this.io=this.$ws.connectToNamespace("log"),this.term=new p.Terminal(s),setTimeout(()=>{this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}),this.fitAddon=new f.FitAddon,this.webLinksAddon=new a.WebLinksAddon,this.resize=new h,this.term.open(m.nativeElement),setTimeout(()=>{this.fitAddon.activate(this.term),this.fitAddon.fit()}),this.io.connected.subscribe(()=>{this.term.reset(),this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows})}),this.io.socket.on("disconnect",()=>{this.term.write(`
2
2
  \r
3
3
  \rWebsocket failed to connect. Is the server running?
4
4
  \r
@@ -1 +1 @@
1
- import{k as et,n as it}from"./chunk-SVAR3FIQ.js";import{a as tt}from"./chunk-ZG3HINDJ.js";import{m as X}from"./chunk-K7QEGT3E.js";import{T as G,e as ut,g as ct,ga as R,h as K,la as W,n as Q,w as U}from"./chunk-V7SOQAC5.js";var st=ut((B,N)=>{(function(S,T){typeof B=="object"&&typeof N<"u"?N.exports=T():typeof define=="function"&&define.amd?define(T):(S=typeof globalThis<"u"?globalThis:S||self).dayjs=T()})(B,function(){"use strict";var S=1e3,T=6e4,n=36e5,h="millisecond",d="second",l="minute",p="hour",v="day",y="week",b="month",q="quarter",L="year",x="date",E="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,at={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var i=["th","st","nd","rd"],t=r%100;return"["+r+(i[(t-20)%10]||i[t]||i[0])+"]"}},C=function(r,i,t){var s=String(r);return!s||s.length>=i?r:""+Array(i+1-s.length).join(t)+r},ot={s:C,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),s=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+C(s,2,"0")+":"+C(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var s=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(s,b),a=t-e<0,o=i.clone().add(s+(a?-1:1),b);return+(-(s+(t-e)/(a?e-o:o-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:b,y:L,w:y,d:v,D:x,h:p,m:l,s:d,ms:h,Q:q}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},A="en",k={};k[A]=at;var P="$isDayjsObject",F=function(r){return r instanceof V||!(!r||!r[P])},Y=function r(i,t,s){var e;if(!i)return A;if(typeof i=="string"){var a=i.toLowerCase();k[a]&&(e=a),t&&(k[a]=t,e=a);var o=i.split("-");if(!e&&o.length>1)return r(o[0])}else{var c=i.name;k[c]=i,e=c}return!s&&e&&(A=e),e||!s&&A},m=function(r,i){if(F(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new V(t)},u=ot;u.l=Y,u.i=F,u.w=function(r,i){return m(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var V=function(){function r(t){this.$L=Y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[P]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(s){var e=s.date,a=s.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var o=e.match(nt);if(o){var c=o[2]-1||0,f=(o[7]||"0").substring(0,3);return a?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)}}return new Date(e)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==E},i.isSame=function(t,s){var e=m(t);return this.startOf(s)<=e&&e<=this.endOf(s)},i.isAfter=function(t,s){return m(t)<this.startOf(s)},i.isBefore=function(t,s){return this.endOf(s)<m(t)},i.$g=function(t,s,e){return u.u(t)?this[s]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,s){var e=this,a=!!u.u(s)||s,o=u.p(t),c=function(_,M){var D=u.w(e.$u?Date.UTC(e.$y,M,_):new Date(e.$y,M,_),e);return a?D:D.endOf(v)},f=function(_,M){return u.w(e.toDate()[_].apply(e.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice(M)),e)},g=this.$W,$=this.$M,w=this.$D,j="set"+(this.$u?"UTC":"");switch(o){case L:return a?c(1,0):c(31,11);case b:return a?c(1,$):c(0,$+1);case y:var O=this.$locale().weekStart||0,H=(g<O?g+7:g)-O;return c(a?w-H:w+(6-H),$);case v:case x:return f(j+"Hours",0);case p:return f(j+"Minutes",1);case l:return f(j+"Seconds",2);case d:return f(j+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,s){var e,a=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[v]=o+"Date",e[x]=o+"Date",e[b]=o+"Month",e[L]=o+"FullYear",e[p]=o+"Hours",e[l]=o+"Minutes",e[d]=o+"Seconds",e[h]=o+"Milliseconds",e)[a],f=a===v?this.$D+(s-this.$W):s;if(a===b||a===L){var g=this.clone().set(x,1);g.$d[c](f),g.init(),this.$d=g.set(x,Math.min(this.$D,g.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},i.set=function(t,s){return this.clone().$set(t,s)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,s){var e,a=this;t=Number(t);var o=u.p(s),c=function($){var w=m(a);return u.w(w.date(w.date()+Math.round($*t)),a)};if(o===b)return this.set(b,this.$M+t);if(o===L)return this.set(L,this.$y+t);if(o===v)return c(1);if(o===y)return c(7);var f=(e={},e[l]=T,e[p]=n,e[d]=S,e)[o]||1,g=this.$d.getTime()+t*f;return u.w(g,this)},i.subtract=function(t,s){return this.add(-1*t,s)},i.format=function(t){var s=this,e=this.$locale();if(!this.isValid())return e.invalidDate||E;var a=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,f=this.$m,g=this.$M,$=e.weekdays,w=e.months,j=e.meridiem,O=function(M,D,I,z){return M&&(M[D]||M(s,a))||I[D].slice(0,z)},H=function(M){return u.s(c%12||12,M,"0")},_=j||function(M,D,I){var z=M<12?"AM":"PM";return I?z.toLowerCase():z};return a.replace(rt,function(M,D){return D||function(I){switch(I){case"YY":return String(s.$y).slice(-2);case"YYYY":return u.s(s.$y,4,"0");case"M":return g+1;case"MM":return u.s(g+1,2,"0");case"MMM":return O(e.monthsShort,g,w,3);case"MMMM":return O(w,g);case"D":return s.$D;case"DD":return u.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return O(e.weekdaysMin,s.$W,$,2);case"ddd":return O(e.weekdaysShort,s.$W,$,3);case"dddd":return $[s.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return _(c,f,!0);case"A":return _(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(s.$s);case"ss":return u.s(s.$s,2,"0");case"SSS":return u.s(s.$ms,3,"0");case"Z":return o}return null}(M)||o.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,s,e){var a,o=this,c=u.p(s),f=m(t),g=(f.utcOffset()-this.utcOffset())*T,$=this-f,w=function(){return u.m(o,f)};switch(c){case L:a=w()/12;break;case b:a=w();break;case q:a=w()/3;break;case y:a=($-g)/6048e5;break;case v:a=($-g)/864e5;break;case p:a=$/n;break;case l:a=$/T;break;case d:a=$/S;break;default:a=$}return e?a:u.a(a)},i.daysInMonth=function(){return this.endOf(b).$D},i.$locale=function(){return k[this.$L]},i.locale=function(t,s){if(!t)return this.$L;var e=this.clone(),a=Y(t,s,!0);return a&&(e.$L=a),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r}(),Z=V.prototype;return m.prototype=Z,[["$ms",h],["$s",d],["$m",l],["$H",p],["$W",v],["$M",b],["$y",L],["$D",x]].forEach(function(r){Z[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),m.extend=function(r,i){return r.$i||(r(i,V,m),r.$i=!0),m},m.locale=Y,m.isDayjs=F,m.unix=function(r){return m(1e3*r)},m.en=k[A],m.Ls=k,m.p={},m})});var J=ct(st(),1);var vt=(()=>{class S{$api=W(it);$title=W(X);$toastr=W(et);$translate=W(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;wallpaper;terminalPersistence=!1;terminalShowWarning=!1;terminalBufferSize=globalThis.terminal.bufferSize;serverTimeOffset=0;rtl=!1;onSettingsLoaded=this.settingsLoadedSubject.pipe(G());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return K(this,null,function*(){let n=yield U(this.$api.get("/auth/settings"));this.formAuth=n.formAuth,this.sessionTimeout=n.sessionTimeout,this.env=n.env,this.lightingMode=n.lightingMode,this.wallpaper=n.wallpaper,this.terminalPersistence=n.terminalPersistence===!0,this.terminalShowWarning=n.terminalShowWarning===!0,this.terminalBufferSize=n.terminalBufferSize||globalThis.terminal.bufferSize,this.setLightingMode(this.lightingMode,"user"),this.setTheme(n.theme),this.setMenuMode(n.menuMode),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(n.serverTimestamp),this.setUiVersion(n.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(n){this.browserLightingMode=n,this.lightingMode==="auto"&&this.setLightingMode(n,"browser")}setLightingMode(n,h){h==="user"&&(this.lightingMode=n),this.currentLightingMode=n,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(n){(!n||!this.themeList.includes(n))&&(n=this.defaultTheme,U(this.$api.put("/config-editor/ui",{key:"theme",value:n})).catch(l=>console.error("Error saving setTheme:",l)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=n,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((l,p)=>{try{let v=l.contentDocument;if(v){let y=v.body;y.classList.remove(`config-ui-x-${this.theme}`),y.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.actualLightingMode==="dark"?(y.classList.add(`config-ui-x-dark-mode-${this.theme}`),y.classList.contains("dark-mode")||y.classList.add("dark-mode")):(y.classList.add(`config-ui-x-${this.theme}`),y.classList.contains("dark-mode")&&y.classList.remove("dark-mode")),l.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:n},window.location.origin)}}catch(v){console.warn(`Iframe ${p}: Access denied (cross-origin?)`,{error:v,src:l.src})}})}setMenuMode(n){this.menuMode=n}setLang(n){n?this.$translate.use(n):n="auto",this.env.lang=n}setItem(n,h){this[n]=h}setEnvItem(n,h){if(n.includes(".")){let d=n.split("."),l=this.env;for(let p=0;p<d.length-1;p++){if(this.forbiddenKeys.includes(d[p]))return;l[d[p]]||(l[d[p]]={}),l=l[d[p]]}this.forbiddenKeys.includes(d[d.length-1])||(l[d[d.length-1]]=h)}else this.env[n]=h}checkServerTime(n){let d=(0,J.default)(n).diff((0,J.default)(),"hour");this.serverTimeOffset=d*60*60,(d>=8||d<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}setUiVersion(n){this.uiVersion||(this.uiVersion=n)}setTitle(n){this.$title.setTitle(n||"Homebridge")}static \u0275fac=function(h){return new(h||S)};static \u0275prov=R({token:S,factory:S.\u0275fac,providedIn:"root"})}return S})();export{st as a,vt as b};
1
+ import{k as et,n as it}from"./chunk-4ZYGJMXW.js";import{a as tt}from"./chunk-ZG3HINDJ.js";import{m as X}from"./chunk-K7QEGT3E.js";import{T as G,e as ut,g as ct,ga as R,h as K,la as W,n as Q,w as U}from"./chunk-V7SOQAC5.js";var st=ut((B,N)=>{(function(S,T){typeof B=="object"&&typeof N<"u"?N.exports=T():typeof define=="function"&&define.amd?define(T):(S=typeof globalThis<"u"?globalThis:S||self).dayjs=T()})(B,function(){"use strict";var S=1e3,T=6e4,n=36e5,h="millisecond",d="second",l="minute",p="hour",v="day",y="week",b="month",q="quarter",L="year",x="date",E="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,at={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var i=["th","st","nd","rd"],t=r%100;return"["+r+(i[(t-20)%10]||i[t]||i[0])+"]"}},C=function(r,i,t){var s=String(r);return!s||s.length>=i?r:""+Array(i+1-s.length).join(t)+r},ot={s:C,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),s=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+C(s,2,"0")+":"+C(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var s=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(s,b),a=t-e<0,o=i.clone().add(s+(a?-1:1),b);return+(-(s+(t-e)/(a?e-o:o-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:b,y:L,w:y,d:v,D:x,h:p,m:l,s:d,ms:h,Q:q}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},A="en",k={};k[A]=at;var P="$isDayjsObject",F=function(r){return r instanceof V||!(!r||!r[P])},Y=function r(i,t,s){var e;if(!i)return A;if(typeof i=="string"){var a=i.toLowerCase();k[a]&&(e=a),t&&(k[a]=t,e=a);var o=i.split("-");if(!e&&o.length>1)return r(o[0])}else{var c=i.name;k[c]=i,e=c}return!s&&e&&(A=e),e||!s&&A},m=function(r,i){if(F(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new V(t)},u=ot;u.l=Y,u.i=F,u.w=function(r,i){return m(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var V=function(){function r(t){this.$L=Y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[P]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(s){var e=s.date,a=s.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var o=e.match(nt);if(o){var c=o[2]-1||0,f=(o[7]||"0").substring(0,3);return a?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)}}return new Date(e)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==E},i.isSame=function(t,s){var e=m(t);return this.startOf(s)<=e&&e<=this.endOf(s)},i.isAfter=function(t,s){return m(t)<this.startOf(s)},i.isBefore=function(t,s){return this.endOf(s)<m(t)},i.$g=function(t,s,e){return u.u(t)?this[s]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,s){var e=this,a=!!u.u(s)||s,o=u.p(t),c=function(_,M){var D=u.w(e.$u?Date.UTC(e.$y,M,_):new Date(e.$y,M,_),e);return a?D:D.endOf(v)},f=function(_,M){return u.w(e.toDate()[_].apply(e.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice(M)),e)},g=this.$W,$=this.$M,w=this.$D,j="set"+(this.$u?"UTC":"");switch(o){case L:return a?c(1,0):c(31,11);case b:return a?c(1,$):c(0,$+1);case y:var O=this.$locale().weekStart||0,H=(g<O?g+7:g)-O;return c(a?w-H:w+(6-H),$);case v:case x:return f(j+"Hours",0);case p:return f(j+"Minutes",1);case l:return f(j+"Seconds",2);case d:return f(j+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,s){var e,a=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[v]=o+"Date",e[x]=o+"Date",e[b]=o+"Month",e[L]=o+"FullYear",e[p]=o+"Hours",e[l]=o+"Minutes",e[d]=o+"Seconds",e[h]=o+"Milliseconds",e)[a],f=a===v?this.$D+(s-this.$W):s;if(a===b||a===L){var g=this.clone().set(x,1);g.$d[c](f),g.init(),this.$d=g.set(x,Math.min(this.$D,g.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},i.set=function(t,s){return this.clone().$set(t,s)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,s){var e,a=this;t=Number(t);var o=u.p(s),c=function($){var w=m(a);return u.w(w.date(w.date()+Math.round($*t)),a)};if(o===b)return this.set(b,this.$M+t);if(o===L)return this.set(L,this.$y+t);if(o===v)return c(1);if(o===y)return c(7);var f=(e={},e[l]=T,e[p]=n,e[d]=S,e)[o]||1,g=this.$d.getTime()+t*f;return u.w(g,this)},i.subtract=function(t,s){return this.add(-1*t,s)},i.format=function(t){var s=this,e=this.$locale();if(!this.isValid())return e.invalidDate||E;var a=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,f=this.$m,g=this.$M,$=e.weekdays,w=e.months,j=e.meridiem,O=function(M,D,I,z){return M&&(M[D]||M(s,a))||I[D].slice(0,z)},H=function(M){return u.s(c%12||12,M,"0")},_=j||function(M,D,I){var z=M<12?"AM":"PM";return I?z.toLowerCase():z};return a.replace(rt,function(M,D){return D||function(I){switch(I){case"YY":return String(s.$y).slice(-2);case"YYYY":return u.s(s.$y,4,"0");case"M":return g+1;case"MM":return u.s(g+1,2,"0");case"MMM":return O(e.monthsShort,g,w,3);case"MMMM":return O(w,g);case"D":return s.$D;case"DD":return u.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return O(e.weekdaysMin,s.$W,$,2);case"ddd":return O(e.weekdaysShort,s.$W,$,3);case"dddd":return $[s.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return _(c,f,!0);case"A":return _(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(s.$s);case"ss":return u.s(s.$s,2,"0");case"SSS":return u.s(s.$ms,3,"0");case"Z":return o}return null}(M)||o.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,s,e){var a,o=this,c=u.p(s),f=m(t),g=(f.utcOffset()-this.utcOffset())*T,$=this-f,w=function(){return u.m(o,f)};switch(c){case L:a=w()/12;break;case b:a=w();break;case q:a=w()/3;break;case y:a=($-g)/6048e5;break;case v:a=($-g)/864e5;break;case p:a=$/n;break;case l:a=$/T;break;case d:a=$/S;break;default:a=$}return e?a:u.a(a)},i.daysInMonth=function(){return this.endOf(b).$D},i.$locale=function(){return k[this.$L]},i.locale=function(t,s){if(!t)return this.$L;var e=this.clone(),a=Y(t,s,!0);return a&&(e.$L=a),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r}(),Z=V.prototype;return m.prototype=Z,[["$ms",h],["$s",d],["$m",l],["$H",p],["$W",v],["$M",b],["$y",L],["$D",x]].forEach(function(r){Z[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),m.extend=function(r,i){return r.$i||(r(i,V,m),r.$i=!0),m},m.locale=Y,m.isDayjs=F,m.unix=function(r){return m(1e3*r)},m.en=k[A],m.Ls=k,m.p={},m})});var J=ct(st(),1);var vt=(()=>{class S{$api=W(it);$title=W(X);$toastr=W(et);$translate=W(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;wallpaper;terminalPersistence=!1;terminalShowWarning=!1;terminalBufferSize=globalThis.terminal.bufferSize;serverTimeOffset=0;rtl=!1;onSettingsLoaded=this.settingsLoadedSubject.pipe(G());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return K(this,null,function*(){let n=yield U(this.$api.get("/auth/settings"));this.formAuth=n.formAuth,this.sessionTimeout=n.sessionTimeout,this.env=n.env,this.lightingMode=n.lightingMode,this.wallpaper=n.wallpaper,this.terminalPersistence=n.terminalPersistence===!0,this.terminalShowWarning=n.terminalShowWarning===!0,this.terminalBufferSize=n.terminalBufferSize||globalThis.terminal.bufferSize,this.setLightingMode(this.lightingMode,"user"),this.setTheme(n.theme),this.setMenuMode(n.menuMode),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(n.serverTimestamp),this.setUiVersion(n.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(n){this.browserLightingMode=n,this.lightingMode==="auto"&&this.setLightingMode(n,"browser")}setLightingMode(n,h){h==="user"&&(this.lightingMode=n),this.currentLightingMode=n,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(n){(!n||!this.themeList.includes(n))&&(n=this.defaultTheme,U(this.$api.put("/config-editor/ui",{key:"theme",value:n})).catch(l=>console.error("Error saving setTheme:",l)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=n,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((l,p)=>{try{let v=l.contentDocument;if(v){let y=v.body;y.classList.remove(`config-ui-x-${this.theme}`),y.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.actualLightingMode==="dark"?(y.classList.add(`config-ui-x-dark-mode-${this.theme}`),y.classList.contains("dark-mode")||y.classList.add("dark-mode")):(y.classList.add(`config-ui-x-${this.theme}`),y.classList.contains("dark-mode")&&y.classList.remove("dark-mode")),l.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:n},window.location.origin)}}catch(v){console.warn(`Iframe ${p}: Access denied (cross-origin?)`,{error:v,src:l.src})}})}setMenuMode(n){this.menuMode=n}setLang(n){n?this.$translate.use(n):n="auto",this.env.lang=n}setItem(n,h){this[n]=h}setEnvItem(n,h){if(n.includes(".")){let d=n.split("."),l=this.env;for(let p=0;p<d.length-1;p++){if(this.forbiddenKeys.includes(d[p]))return;l[d[p]]||(l[d[p]]={}),l=l[d[p]]}this.forbiddenKeys.includes(d[d.length-1])||(l[d[d.length-1]]=h)}else this.env[n]=h}checkServerTime(n){let d=(0,J.default)(n).diff((0,J.default)(),"hour");this.serverTimeOffset=d*60*60,(d>=8||d<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}setUiVersion(n){this.uiVersion||(this.uiVersion=n)}setTitle(n){this.$title.setTitle(n||"Homebridge")}static \u0275fac=function(h){return new(h||S)};static \u0275prov=R({token:S,factory:S.\u0275fac,providedIn:"root"})}return S})();export{st as a,vt as b};
@@ -0,0 +1 @@
1
+ import{a as ae}from"./chunk-ADNBR4EK.js";import{g as J,m as G,n as ne}from"./chunk-PSSVCFFV.js";import{A,b as P,c as D,d as C,e as I,f as z,g as V,j as w,m as q,o as R,p as O,q as L,x as ie,z as N}from"./chunk-K2NEWUWG.js";import{b as Q}from"./chunk-7HCGM76M.js";import{b as re}from"./chunk-QRQBCPWO.js";import{a as fe}from"./chunk-FAELDM7K.js";import{k as U,n as k}from"./chunk-4ZYGJMXW.js";import{a as E,b as $}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Dc as F,Ec as Z,Hb as u,Hc as o,Ib as g,Ic as s,Jb as y,Jc as ee,Lb as W,Mb as X,Nb as Y,Ob as f,Pb as n,Qb as i,Rb as d,Uc as te,_b as M,ab as e,bc as b,dc as v,g as ue,id as j,la as p,mb as S,qc as m,ra as B,rc as c,sa as T,sc as x}from"./chunk-V7SOQAC5.js";function be(r,h){r&1&&(n(0,"ngb-alert",13)(1,"p",20),m(2),o(3,"translate"),i()()),r&2&&(f("dismissible",!1),e(2),c(s(3,2,"login.invalid_password")))}var oe=(()=>{class r{$activeModal=p(G);$api=p(k);$toastr=p(U);$translate=p(E);invalidCredentials=!1;formGroup=new V({password:new w("",[C.required])});disable2fa(){this.invalidCredentials=!1,this.$api.post("/users/otp/deactivate",this.formGroup.value).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))},error:()=>{this.formGroup.setValue({password:""}),this.invalidCredentials=!0}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(a){return new(a||r)};static \u0275cmp=S({type:r,selectors:[["ng-component"]],decls:34,vars:27,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,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","password","autocomplete","current-password",1,"form-control","custom-input",3,"formControl","placeholder"],["type","error",1,"mt-3","mb-0",3,"dismissible"],[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"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"mb-0"]],template:function(a,l){a&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),i(),n(5,"button",3),o(6,"translate"),b("click",function(){return l.dismissModal()}),i()(),n(7,"div",4)(8,"div",5),d(9,"i",6),i(),n(10,"ul",7)(11,"li"),m(12),o(13,"translate"),i()(),n(14,"ul",8)(15,"li",9)(16,"label",10),m(17),o(18,"translate"),i(),n(19,"div",11),d(20,"input",12),o(21,"translate"),i()()(),g(22,be,4,4,"ngb-alert",13),i(),n(23,"div",14)(24,"div",15)(25,"button",16),o(26,"translate"),b("click",function(){return l.dismissModal()}),m(27),o(28,"translate"),i()(),d(29,"div",17),n(30,"div",18)(31,"button",19),b("click",function(){return l.disable2fa()}),m(32),o(33,"translate"),i()()()()),a&2&&(e(3),c(s(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",s(6,13,"form.button_close")),e(7),c(s(13,15,"users.setup_2fa_disable_current_password")),e(5),c(s(18,17,"users.label_password")),e(3),f("formControl",l.formGroup.controls.password)("placeholder",s(21,19,"users.label_password")),e(2),y(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",s(26,21,"form.button_close")),e(2),x(" ",s(28,23,"form.button_close")," "),e(4),f("disabled",l.formGroup.invalid),e(),x(" ",s(33,25,"form.button_disable")," "))},dependencies:[N,D,I,A,R,J,$],encapsulation:2})}return r})();var se=ue(fe(),1);var _e=r=>({timeDiffError:r});function ve(r,h){r&1&&(n(0,"li"),m(1),o(2,"translate"),i()),r&2&&(e(),c(s(2,1,"users.setup_2fa_scan_qr_code")))}function xe(r,h){if(r&1&&(n(0,"ngb-alert",8)(1,"p",16),m(2),o(3,"translate"),i(),n(4,"p",17),m(5),o(6,"translate"),i()()),r&2){let t=v();f("dismissible",!1),e(2),c(s(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),c(ee(6,5,"users.setup_2fa_server_time_out",F(8,_e,t.timeDiffError)))}}function Ce(r,h){if(r&1&&(n(0,"ul",9)(1,"li",18)(2,"div",19),d(3,"app-qrcode",20),i()(),n(4,"li",21)(5,"label",22),m(6),o(7,"translate"),i(),n(8,"div",23),d(9,"input",24),i()()()),r&2){let t=v();e(3),f("data",t.otpString),e(3),c(s(7,3,"users.setup_2fa_enter_code")),e(3),f("formControl",t.formGroup.controls.code)}}function we(r,h){if(r&1){let t=M();n(0,"button",25),o(1,"translate"),b("click",function(){B(t);let l=v();return T(l.dismissModal())}),m(2),o(3,"translate"),i()}r&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),x(" ",s(3,4,"form.button_close")," "))}function he(r,h){if(r&1){let t=M();n(0,"button",25),o(1,"translate"),b("click",function(){B(t);let l=v();return T(l.dismissModal())}),m(2),o(3,"translate"),i()}r&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),x(" ",s(3,4,"form.button_close")," "))}function ge(r,h){if(r&1){let t=M();n(0,"button",26),b("click",function(){B(t);let l=v();return T(l.enable2fa())}),m(1),o(2,"translate"),i()}if(r&2){let t=v();f("disabled",t.formGroup.invalid),e(),x(" ",s(2,2,"form.button_enable")," ")}}var le=(()=>{class r{$activeModal=p(G);$api=p(k);$toastr=p(U);$translate=p(E);user;timeDiffError=null;otpString;formGroup=new V({code:new w("",[C.required,C.minLength(6),C.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:t=>{this.checkTimeDiff(t.timestamp),this.timeDiffError||(this.otpString=t.otpauth)},error:t=>{this.$activeModal.dismiss(),console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}enable2fa(){this.$api.post("/users/otp/activate",this.formGroup.value).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(t){let a=(0,se.default)(t).diff(new Date,"millisecond");a<-5e3||a>5e3?this.timeDiffError=a:this.timeDiffError=null}static \u0275fac=function(a){return new(a||r)};static \u0275cmp=S({type:r,selectors:[["ng-component"]],inputs:{user:"user"},decls:24,vars:15,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[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,"fw-bold","mb-1"],[1,"mb-0"],[1,"list-group-item","text-center"],[1,"text-center","w-100","d-flex","justify-content-center"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control","custom-input",3,"formControl"],["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(a,l){a&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),i(),n(5,"button",3),o(6,"translate"),b("click",function(){return l.dismissModal()}),i()(),n(7,"div",4)(8,"div",5),d(9,"i",6),i(),n(10,"ul",7)(11,"li"),m(12),o(13,"translate"),i(),g(14,ve,3,3,"li"),i(),g(15,xe,7,10,"ngb-alert",8),g(16,Ce,10,5,"ul",9),i(),n(17,"div",10)(18,"div",11),g(19,we,4,6,"button",12),i(),n(20,"div",13),g(21,he,4,6,"button",12),i(),n(22,"div",14),g(23,ge,3,4,"button",15),i()()()),a&2&&(e(3),c(s(4,9,"users.setup_2fa")),e(2),u("aria-label",s(6,11,"form.button_close")),e(7),c(s(13,13,"users.setup_2fa_warning")),e(2),y(l.timeDiffError?-1:14),e(),y(l.timeDiffError?15:-1),e(),y(l.timeDiffError?-1:16),e(3),y(l.timeDiffError?-1:19),e(2),y(l.timeDiffError?21:-1),e(2),y(l.timeDiffError?-1:23))},dependencies:[J,ae,N,D,I,ie,A,R,$],encapsulation:2})}return r})();var me=r=>({"is-invalid":r}),de=(()=>{class r{$activeModal=p(G);$api=p(k);$toastr=p(U);$translate=p(E);form=new V({username:new w("",[C.required]),name:new w("",[C.required]),password:new w("",[C.compose([C.required,C.minLength(4)])]),passwordConfirm:new w("",[C.required]),admin:new w(!0)},this.matchPassword);onSubmit({value:t}){this.$api.post("/users",t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:a=>{this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||r)};static \u0275cmp=S({type:r,selectors:[["ng-component"]],decls:58,vars:50,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["formControlName","admin","type","checkbox","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(a,l){a&1&&(n(0,"div",0)(1,"form",1),b("ngSubmit",function(){return l.onSubmit(l.form)}),n(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),i(),n(6,"button",4),o(7,"translate"),b("click",function(){return l.dismissModal()}),i()(),n(8,"div",5)(9,"div",6),d(10,"i",7),i(),n(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),i(),n(16,"div",11),d(17,"input",12),o(18,"translate"),i()(),n(19,"li",9)(20,"label",13),m(21),o(22,"translate"),i(),n(23,"div",11),d(24,"input",14),o(25,"translate"),i()(),n(26,"li",9)(27,"label",15),m(28),o(29,"translate"),i(),n(30,"div",11),d(31,"input",16),o(32,"translate"),i()(),n(33,"li",9)(34,"label",17),m(35),o(36,"translate"),i(),n(37,"div",11),d(38,"input",18),o(39,"translate"),i()(),n(40,"li",19)(41,"span",20),m(42),o(43,"translate"),i(),n(44,"div",21),d(45,"input",22),o(46,"translate"),d(47,"label",23),i()()()(),n(48,"div",24)(49,"div",20)(50,"button",25),b("click",function(){return l.dismissModal()}),m(51),o(52,"translate"),i()(),d(53,"div",26),n(54,"div",27)(55,"button",28),m(56),o(57,"translate"),i()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),c(s(5,18,"users.title_add_user")),e(2),u("aria-label",s(7,20,"form.button_close")),e(8),c(s(15,22,"users.label_username")),e(3),u("aria-label",s(18,24,"users.label_username")),e(4),c(s(22,26,"users.label_full_name")),e(3),u("aria-label",s(25,28,"users.label_full_name")),e(4),c(s(29,30,"users.label_password")),e(3),f("ngClass",F(46,me,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,32,"users.label_password")),e(4),c(s(36,34,"users.label_confirm_password")),e(3),f("ngClass",F(48,me,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",s(39,36,"users.label_confirm_password")),e(4),c(s(43,38,"users.label_admin_user")),e(3),u("aria-label",s(46,40,"users.label_admin_user")),e(6),x(" ",s(52,42,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),x(" ",s(57,44,"form.button_save")," "))},dependencies:[N,q,D,P,I,z,A,O,L,j,$],encapsulation:2})}return r})();var pe=r=>({"is-invalid":r});function ye(r,h){if(r&1&&(n(0,"li",9)(1,"label",27),m(2),o(3,"translate"),i(),n(4,"div",11),d(5,"input",28),o(6,"translate"),i()()),r&2){let t=v();e(2),c(s(3,3,"users.label_confirm_password")),e(3),f("ngClass",F(7,pe,t.form.controls.passwordConfirm.dirty&&t.form.controls.passwordConfirm.errors)),u("aria-label",s(6,5,"users.label_confirm_password"))}}var ce=(()=>{class r{$activeModal=p(G);$api=p(k);$auth=p(Q);$cdr=p(te);$toastr=p(U);$translate=p(E);initialFormValue={};user;isCurrentUser=!1;form=new V({username:new w("",[C.required]),name:new w("",[C.required]),password:new w(""),passwordConfirm:new w(""),admin:new w(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user),this.initialFormValue=this.form.getRawValue(),this.form.valueChanges.subscribe(()=>this.$cdr.detectChanges())}onSubmit({value:t}){this.$api.patch(`/users/${this.user.id}`,t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&t.username!==this.$auth.user.username&&this.$auth.logout()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}isFormUnchanged(){return this.form.controls.password.value?!1:JSON.stringify(this.form.getRawValue())===JSON.stringify(this.initialFormValue)}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||r)};static \u0275cmp=S({type:r,selectors:[["ng-component"]],inputs:{user:"user"},decls:52,vars:42,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-pen","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"]],template:function(a,l){a&1&&(n(0,"div",0)(1,"form",1),b("ngSubmit",function(){return l.onSubmit(l.form)}),n(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),i(),n(6,"button",4),o(7,"translate"),b("click",function(){return l.dismissModal()}),i()(),n(8,"div",5)(9,"div",6),d(10,"i",7),i(),n(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),i(),n(16,"div",11),d(17,"input",12),o(18,"translate"),i()(),n(19,"li",9)(20,"label",13),m(21),o(22,"translate"),i(),n(23,"div",11),d(24,"input",14),o(25,"translate"),i()(),n(26,"li",9)(27,"label",15),m(28),o(29,"translate"),i(),n(30,"div",11),d(31,"input",16),o(32,"translate"),i()(),g(33,ye,7,9,"li",9),n(34,"li",17)(35,"span",18),m(36),o(37,"translate"),i(),n(38,"div",19),d(39,"input",20),o(40,"translate"),d(41,"label",21),i()()()(),n(42,"div",22)(43,"div",18)(44,"button",23),b("click",function(){return l.dismissModal()}),m(45),o(46,"translate"),i()(),d(47,"div",24),n(48,"div",25)(49,"button",26),m(50),o(51,"translate"),i()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),c(s(5,16,"users.title_edit_user")),e(2),u("aria-label",s(7,18,"form.button_close")),e(8),c(s(15,20,"users.label_username")),e(3),u("aria-label",s(18,22,"users.label_username")),e(4),c(s(22,24,"users.label_full_name")),e(3),u("aria-label",s(25,26,"users.label_full_name")),e(4),c(s(29,28,"users.label_new_password")),e(3),f("ngClass",F(40,pe,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,30,"users.label_new_password")),e(2),y(l.form.controls.password.value?33:-1),e(3),c(s(37,32,"users.label_admin_user")),e(3),u("aria-label",s(40,34,"users.label_admin_user")),e(6),x(" ",s(46,36,"form.button_close")," "),e(4),f("disabled",!l.form.valid||l.isFormUnchanged()),e(),x(" ",s(51,38,"form.button_save")," "))},dependencies:[N,q,D,P,I,z,A,O,L,j,$],encapsulation:2})}return r})();var Se=(r,h)=>({"fa-user-secret":r,"fa-user":h});function Ee(r,h){if(r&1){let t=M();n(0,"button",15),b("click",function(){B(t);let l=v(2).$implicit,_=v();return T(_.disable2fa(l))}),m(1),o(2,"translate"),i()}r&2&&(e(),x(" ",s(2,1,"users.setup_2fa_disable")," "))}function $e(r,h){if(r&1){let t=M();n(0,"button",21),b("click",function(){B(t);let l=v(2).$implicit,_=v();return T(_.setup2fa(l))}),m(1),o(2,"translate"),i()}r&2&&(e(),c(s(2,1,"users.setup_2fa")))}function Ue(r,h){if(r&1&&g(0,Ee,3,3,"button",19)(1,$e,3,3,"button",20),r&2){let t=v().$implicit;y(t.otpActive?0:1)}}function ke(r,h){r&1&&d(0,"div")}function Be(r,h){if(r&1){let t=M();n(0,"div",7)(1,"div",8)(2,"div",9)(3,"div",10)(4,"span",11)(5,"h4"),d(6,"i",12),m(7),i(),d(8,"h5",13),i()(),n(9,"div",14),g(10,Ue,2,1)(11,ke,1,0,"div"),n(12,"div")(13,"button",15),o(14,"translate"),b("click",function(){let l=B(t).$implicit,_=v();return T(_.openEditUser(l))}),d(15,"i",16),i(),n(16,"button",17),o(17,"translate"),b("click",function(){let l=B(t).$implicit,_=v();return T(_.deleteUser(l.id))}),d(18,"i",18),i()()()()()()}if(r&2){let t=h.$implicit,a=v();e(6),f("ngClass",Z(11,Se,t.admin,!t.admin)),e(),x(" ",t.name," "),e(),f("innerText",t.username),e(2),y(a.username===t.username&&a.isAdmin?10:11),e(3),u("aria-label",s(14,7,"form.button_edit")),e(3),f("disabled",a.username===t.username),u("aria-label",s(17,9,"form.button_delete"))}}var Ut=(()=>{class r{$api=p(k);$auth=p(Q);$modal=p(ne);$route=p(re);$toastr=p(U);$translate=p(E);homebridgeUsers=[];username=this.$auth.user.username;isAdmin=this.$auth.user.admin;ngOnInit(){this.$route.data.subscribe(t=>{this.homebridgeUsers=t.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(t=>{this.homebridgeUsers=t})}openAddNewUser(){this.$modal.open(de,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(t){let a=this.$modal.open(ce,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}deleteUser(t){this.$api.delete(`/users/${t}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(t){let a=this.$modal.open(le,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}disable2fa(t){let a=this.$modal.open(oe,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}static \u0275fac=function(a){return new(a||r)};static \u0275cmp=S({type:r,selectors:[["app-users"]],decls:12,vars:6,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"primary-text","m-0"],[1,"col-3","text-end"],[1,"btn","btn-elegant","waves-effect","m-0",3,"click"],[1,"fas","fa-fw","fa-user-plus"],[1,"row"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[1,"fas","fa-fw","grey-text",3,"ngClass"],[1,"small","text-truncate","primary-text",3,"innerText"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-fw","fa-trash"],[1,"btn","btn-elegant","m-0"],[1,"btn","btn-primary","m-0"],[1,"btn","btn-primary","m-0",3,"click"]],template:function(a,l){a&1&&(n(0,"div",0)(1,"div",1)(2,"h3",2),m(3),o(4,"translate"),i()(),n(5,"div",3)(6,"button",4),o(7,"translate"),b("click",function(){return l.openAddNewUser()}),d(8,"i",5),i()()(),n(9,"div",6),X(10,Be,19,14,"div",7,W),i()),a&2&&(e(3),c(s(4,2,"users.title_users")),e(3),u("aria-label",s(7,4,"users.button_add_user")),e(4),Y(l.homebridgeUsers))},dependencies:[j,$],encapsulation:2})}return r})();export{Ut as UsersComponent};
@@ -1 +1 @@
1
- import{a as se}from"./chunk-2C3RWXKQ.js";import{a as te,b as ie,c as ne}from"./chunk-BYJZ4WBV.js";import{c as re}from"./chunk-N4CMSHPE.js";import"./chunk-COFFIBVI.js";import{a as le}from"./chunk-P3TP4J62.js";import{m as V,n as Z,t as ee}from"./chunk-PSSVCFFV.js";import{c as G,e as J,f as K,i as Q,l as U,m as X,z as Y}from"./chunk-K2NEWUWG.js";import"./chunk-NP3V73ET.js";import{b as ae}from"./chunk-2HIOHBJY.js";import"./chunk-QRQBCPWO.js";import{b as oe}from"./chunk-MHTDGCRA.js";import"./chunk-SVAR3FIQ.js";import{b as E}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Cc as R,Dc as $,Ec as j,Hb as C,Hc as a,Ib as w,Ic as r,Jb as S,Jc as z,Lb as P,Mb as L,Nb as N,Ob as _,Pb as s,Qb as l,Rb as f,Sb as u,Tb as b,Ub as A,Xa as W,_b as D,ab as o,bc as v,cc as H,dc as m,id as q,la as x,mb as M,qc as c,ra as y,rc as p,sa as h,sc as k,xc as T,yc as B,zc as I}from"./chunk-V7SOQAC5.js";var ce=(()=>{class t{$activeModal=x(V);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["ng-component"]],decls:41,vars:30,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,"text-center","mb-3"],[1,"fa","fa-fw","fa-question-circle-o","primary-text",2,"font-size","75px"],[1,"ms-2"],[1,"mb-0"],[1,"ms-2","mt-2"],[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"]],template:function(i,n){i&1&&(u(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),c(4),a(5,"translate"),b(),u(6,"button",3),a(7,"translate"),H("click",function(){return n.dismissModal()}),b()(),u(8,"div",4)(9,"div",5),A(10,"i",6),b(),u(11,"h5",7),c(12),a(13,"translate"),b(),u(14,"ul",8)(15,"li"),c(16),a(17,"translate"),b(),u(18,"li"),c(19),a(20,"translate"),b()(),u(21,"h5",9),c(22),a(23,"translate"),b(),u(24,"ul",8)(25,"li"),c(26),a(27,"translate"),b(),u(28,"li"),c(29),a(30,"translate"),b(),u(31,"li"),c(32),a(33,"translate"),b()()(),u(34,"div",10),A(35,"div",11),u(36,"div",12)(37,"button",13),H("click",function(){return n.dismissModal()}),c(38),a(39,"translate"),b()(),A(40,"div",14),b()()()),i&2&&(o(4),p(r(5,10,"support.title")),o(2),C("aria-label",r(7,12,"form.button_close")),o(6),p(r(13,14,"accessories.title_accessories")),o(4),p(r(17,16,"accessories.support.acc_1")),o(3),p(r(20,18,"accessories.support.acc_2")),o(3),p(r(23,20,"accessories.title_rooms")),o(4),p(r(27,22,"accessories.support.rooms_1")),o(3),p(r(30,24,"accessories.support.rooms_2")),o(3),p(r(33,26,"accessories.support.rooms_3")),o(6),k(" ",r(39,28,"form.button_close")," "))},dependencies:[E],encapsulation:2})}return t})();var pe=()=>({standalone:!0}),de=(()=>{class t{$activeModal=x(V);roomName;dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(e){this.$activeModal.close(e)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["ng-component"]],inputs:{roomName:"roomName"},decls:28,vars:19,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,"text-center","mb-3"],[1,"fas","fa-fw","fa-folder-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["autocomplete","off","type","text","id","form-name","autofocus","",1,"form-control","custom-input",3,"ngModelChange","keyup.enter","ngModel","ngModelOptions"],[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"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(i,n){i&1&&(s(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),c(4),a(5,"translate"),l(),s(6,"button",3),a(7,"translate"),v("click",function(){return n.dismissModal()}),l()(),s(8,"div",4)(9,"div",5),f(10,"i",6),l(),s(11,"ul",7)(12,"li",8)(13,"label",9),c(14),a(15,"translate"),l(),s(16,"div",10)(17,"input",11),I("ngModelChange",function(F){return B(n.roomName,F)||(n.roomName=F),F}),v("keyup.enter",function(){return n.closeModal(n.roomName)}),l()()()()(),s(18,"div",12)(19,"div",13)(20,"button",14),v("click",function(){return n.dismissModal()}),c(21),a(22,"translate"),l()(),f(23,"div",15),s(24,"div",16)(25,"button",17),v("click",function(){return n.closeModal(n.roomName)}),c(26),a(27,"translate"),l()()()()()),i&2&&(o(4),p(r(5,8,"accessories.button_add_room")),o(2),C("aria-label",r(7,10,"form.button_close")),o(8),p(r(15,12,"accessories.room_name")),o(3),T("ngModel",n.roomName),_("ngModelOptions",R(18,pe)),o(4),k(" ",r(22,14,"form.button_close")," "),o(4),_("disabled",!n.roomName),o(),k(" ",r(27,16,"form.button_save")," "))},dependencies:[Y,X,G,J,K,U,Q,E],encapsulation:2})}return t})();var me=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["app-drag-here-placeholder"]],decls:5,vars:3,consts:[[1,"accessory-box"],[1,"fas","fa-fw","fa-arrow-alt-circle-down","accessory-icon"],[1,"accessory-label"]],template:function(i,n){i&1&&(u(0,"div",0),A(1,"i",1),u(2,"div",2),c(3),a(4,"translate"),b()()),i&2&&(o(3),p(r(4,1,"accessories.control.drag_here")))},dependencies:[E],styles:[".accessory-box[_ngcontent-%COMP%]{opacity:.2}"]})}return t})();var ue=(t,g)=>({"fa-eye":t,"fa-eye-slash":g}),_e=t=>({"cursor-move":t}),be=t=>({"justify-content-between":t}),fe=t=>({link:t});function ge(t,g){if(t&1&&(s(0,"div",0)(1,"div",19)(2,"h5",20),c(3),a(4,"translate"),l()()()),t&2){let e=m().$implicit,i=m(2);o(2),_("ngClass",$(4,_e,!i.isMobile)),o(),k(" ",e.name==="Default Room"?r(4,2,"accessories.control.default_room"):e.name," ")}}function ve(t,g){if(t&1&&(s(0,"div",23),f(1,"app-accessory-tile",24),l()),t&2){let e=m().$implicit;o(),_("service",e)}}function xe(t,g){if(t&1&&w(0,ve,2,1,"div",23),t&2){let e=g.$implicit,i=m(4);S(!i.hideHidden||!e.hidden?0:-1)}}function Ce(t,g){if(t&1){let e=D();s(0,"div",21),I("dragulaModelChange",function(n){y(e);let d=m().$implicit;return B(d.services,n)||(d.services=n),h(n)}),L(1,xe,1,1,null,null,P),f(3,"div",22)(4,"div",22)(5,"div",22)(6,"div",22)(7,"div",22)(8,"div",22)(9,"div",22)(10,"div",22)(11,"div",22)(12,"div",22),l()}if(t&2){let e=m().$implicit,i=m(2);_("ngClass",$(3,be,i.isMobile))("dragula","services-bag"),T("dragulaModel",e.services),o(),N(e.services)}}function ye(t,g){if(t&1){let e=D();s(0,"div",25),I("dragulaModelChange",function(n){y(e);let d=m().$implicit;return B(d.services,n)||(d.services=n),h(n)}),f(1,"app-drag-here-placeholder",26),l()}if(t&2){let e=m().$implicit;_("dragula","services-bag"),T("dragulaModel",e.services)}}function he(t,g){if(t&1&&(s(0,"div"),w(1,ge,5,6,"div",0),s(2,"div",16),w(3,Ce,13,5,"div",17),w(4,ye,2,2,"div",18),l()()),t&2){let e=g.$implicit,i=m(2);o(),S(!i.isMobile||e.services.length?1:-1),o(2),S(e.services.length?3:-1),o(),S(!e.services.length&&!i.isMobile?4:-1)}}function Me(t,g){if(t&1){let e=D();s(0,"div",1)(1,"div",2)(2,"h3",3),c(3),a(4,"translate"),l()(),s(5,"div",4)(6,"button",5),a(7,"translate"),v("click",function(){y(e);let n=m();return h(n.openSupport())}),f(8,"i",6),l()(),s(9,"div",7)(10,"button",8),a(11,"translate"),a(12,"translate"),v("click",function(){y(e);let n=m();return h(n.addRoom())}),f(13,"i",9),l(),s(14,"button",8),a(15,"translate"),a(16,"translate"),a(17,"translate"),a(18,"translate"),v("click",function(){y(e);let n=m();return h(n.hideHidden=!n.hideHidden)}),f(19,"i",10),l(),s(20,"div",11)(21,"button",12),a(22,"translate"),a(23,"translate"),v("click",function(){y(e);let n=m();return h(n.toggleLayoutLock())}),f(24,"i",13),l(),s(25,"button",12),a(26,"translate"),a(27,"translate"),v("click",function(){y(e);let n=m();return h(n.toggleLayoutLock())}),f(28,"i",14),l()(),s(29,"button",5),a(30,"translate"),v("click",function(){y(e);let n=m();return h(n.openSupport())}),f(31,"i",6),l()()(),s(32,"div",15),I("dragulaModelChange",function(n){y(e);let d=m();return B(d.$accessories.rooms,n)||(d.$accessories.rooms=n),h(n)}),L(33,he,5,3,"div",null,P),l()}if(t&2){let e=m();o(3),p(r(4,18,"accessories.title_accessories")),o(3),C("aria-label",r(7,20,"support.title")),o(4),_("hidden",e.isMobile)("ngbTooltip",r(11,22,"accessories.button_add_room")),C("aria-label",r(12,24,"accessories.button_add_room")),o(4),_("hidden",e.isMobile)("ngbTooltip",e.hideHidden?r(15,26,"accessories.button_hidden_show"):r(16,28,"accessories.button_hidden_hide")),C("aria-label",e.hideHidden?r(17,30,"accessories.button_hidden_show"):r(18,32,"accessories.button_hidden_hide")),o(5),_("ngClass",j(44,ue,!e.hideHidden,e.hideHidden)),o(2),_("disabled",!e.isMobile)("ngbTooltip",r(22,34,"form.button_unlock")),C("aria-label",r(23,36,"form.button_unlock")),o(4),_("disabled",e.isMobile)("ngbTooltip",r(26,38,"form.button_lock")),C("aria-label",r(27,40,"form.button_lock")),o(4),C("aria-label",r(30,42,"support.title")),o(3),_("dragula","rooms-bag"),T("dragulaModel",e.$accessories.rooms),o(),N(e.$accessories.rooms)}}function Ee(t,g){t&1&&(s(0,"p",33),c(1),a(2,"translate"),l()),t&2&&(o(),p(r(2,1,"accessories.settings_link")))}function we(t,g){if(t&1&&(s(0,"div",0)(1,"div",27)(2,"h3",28),c(3),a(4,"translate"),l()(),s(5,"div",29)(6,"div",30)(7,"h5",31),c(8),a(9,"translate"),l(),f(10,"p",32),a(11,"translate"),w(12,Ee,3,3,"p",33),l()()()),t&2){let e=m();o(3),p(r(4,4,"accessories.title_accessories")),o(5),p(r(9,6,"accessories.control_disabled")),o(2),_("innerHTML",z(11,8,"accessories.message_must_use_insecure_mode",$(11,fe,e.linkInsecure)),W),o(2),S(e.isAdmin?12:-1)}}var it=(()=>{class t{$accessories=x(re);$auth=x(ae);dragulaService=x(te);$modal=x(Z);$settings=x(oe);$md=x(le);orderSubscription;isAdmin=this.$auth.user.admin;enableAccessories=this.$settings.env.enableAccessories;isMobile=!1;hideHidden=!0;linkInsecure='<a href="https://github.com/homebridge/homebridge-config-ui-x/wiki/Enabling-Accessory-Control" target="_blank"><i class="fa fa-fw fa-external-link-alt primary-text"></i></a>';constructor(){let e=this.dragulaService;this.isMobile=this.$md.detect.mobile(),e.createGroup("rooms-bag",{moves:(i,n,d)=>!this.isMobile&&d.classList.contains("drag-handle")}),e.createGroup("services-bag",{moves:i=>!this.isMobile&&!i.classList.contains("no-drag")}),this.orderSubscription=e.drop().subscribe(()=>{setTimeout(()=>{this.$accessories.saveLayout()})}),this.isMobile=!0}ngOnInit(){this.$accessories.start()}addRoom(){this.$modal.open(de,{size:"lg",backdrop:"static"}).result.then(e=>{!e||!e.length||this.$accessories.rooms.find(i=>i.name===e)||(this.$accessories.rooms.push({name:e,services:[]}),this.isMobile&&this.toggleLayoutLock())}).catch(()=>{})}toggleLayoutLock(){this.isMobile=!this.isMobile,this.isMobile?document.querySelectorAll(".services-bag").forEach(i=>{for(let n=0;n<10;n++){let d=document.createElement("div");d.className="accessory-box invisible py-0 my-0",d.style.height="0",i.appendChild(d)}}):document.querySelectorAll(".invisible").forEach(i=>i.remove())}openSupport(){this.$modal.open(ce,{size:"lg",backdrop:"static"})}ngOnDestroy(){this.$accessories.stop(),this.orderSubscription.unsubscribe(),this.dragulaService.destroy("rooms-bag"),this.dragulaService.destroy("services-bag")}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["app-accessories"]],decls:2,vars:1,consts:[[1,"row"],[1,"row","mb-3"],[1,"col-9","col-sm-6"],[1,"primary-text","m-0"],[1,"col-3","col-sm-6","text-end","d-inline-block","d-sm-none"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-fw","fa-question-circle-o"],[1,"col-3","col-sm-6","text-end","d-none","d-sm-inline-block"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","hidden","ngbTooltip"],[1,"fas","fa-fw","fa-folder-plus"],[1,"fas","fa-fw",3,"ngClass"],["role","group",1,"btn-group","me-2"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-unlock"],[1,"fas","fa-fw","fa-lock"],[3,"dragulaModelChange","dragula","dragulaModel"],[1,"row","mb-4"],[1,"col-md-12","d-flex","flex-wrap","noselect","services-bag",3,"ngClass","dragula","dragulaModel"],[1,"col-md-12","d-flex","flex-wrap","noselect",3,"dragula","dragulaModel"],[1,"col-md-12"],[1,"primary-text","drag-handle","room-title","m-0","mb-1","mb-sm-0",3,"ngClass"],[1,"col-md-12","d-flex","flex-wrap","noselect","services-bag",3,"dragulaModelChange","ngClass","dragula","dragulaModel"],[1,"accessory-box","invisible","py-0","my-0",2,"height","0"],[1,"accessory-item","accessory-tab"],[3,"service"],[1,"col-md-12","d-flex","flex-wrap","noselect",3,"dragulaModelChange","dragula","dragulaModel"],[1,"no-drag"],[1,"col-12"],[1,"primary-text","m-0","mb-3"],[1,"col-12","text-center"],["role","alert",1,"alert","alert-warning","p-4"],[1,"mb-3","mt-0"],[1,"mb-0",3,"innerHTML"],[1,"mt-3","mb-0"]],template:function(i,n){i&1&&w(0,Me,35,47)(1,we,13,13,"div",0),i&2&&S(n.enableAccessories?0:1)},dependencies:[ee,q,ne,ie,se,me,E],styles:[".room-title[_ngcontent-%COMP%]{margin-left:10px}@media (max-width: 575px){.room-title[_ngcontent-%COMP%]{margin-left:7px}}.services-bag[_ngcontent-%COMP%]{min-height:170px}@media (max-width: 575px){.services-bag[_ngcontent-%COMP%]{min-height:initial}}.cursor-move[_ngcontent-%COMP%]{cursor:move}.gu-transit[_ngcontent-%COMP%] .manage-accessory-button[_ngcontent-%COMP%]{display:none}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return t})();export{it as AccessoriesComponent};
1
+ import{a as se}from"./chunk-257Z3FEX.js";import{a as te,b as ie,c as ne}from"./chunk-BYJZ4WBV.js";import{c as re}from"./chunk-N5XBHM63.js";import"./chunk-LMME7DF7.js";import{a as le}from"./chunk-P3TP4J62.js";import{m as V,n as Z,t as ee}from"./chunk-PSSVCFFV.js";import{c as G,e as J,f as K,i as Q,l as U,m as X,z as Y}from"./chunk-K2NEWUWG.js";import"./chunk-53FPP2IJ.js";import{b as ae}from"./chunk-7HCGM76M.js";import"./chunk-QRQBCPWO.js";import{b as oe}from"./chunk-FAELDM7K.js";import"./chunk-4ZYGJMXW.js";import{b as E}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{Cc as R,Dc as $,Ec as j,Hb as C,Hc as a,Ib as w,Ic as r,Jb as S,Jc as z,Lb as P,Mb as L,Nb as N,Ob as _,Pb as s,Qb as l,Rb as f,Sb as u,Tb as b,Ub as A,Xa as W,_b as D,ab as o,bc as v,cc as H,dc as m,id as q,la as x,mb as M,qc as c,ra as y,rc as p,sa as h,sc as k,xc as T,yc as B,zc as I}from"./chunk-V7SOQAC5.js";var ce=(()=>{class t{$activeModal=x(V);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["ng-component"]],decls:41,vars:30,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,"text-center","mb-3"],[1,"fa","fa-fw","fa-question-circle-o","primary-text",2,"font-size","75px"],[1,"ms-2"],[1,"mb-0"],[1,"ms-2","mt-2"],[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"]],template:function(i,n){i&1&&(u(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),c(4),a(5,"translate"),b(),u(6,"button",3),a(7,"translate"),H("click",function(){return n.dismissModal()}),b()(),u(8,"div",4)(9,"div",5),A(10,"i",6),b(),u(11,"h5",7),c(12),a(13,"translate"),b(),u(14,"ul",8)(15,"li"),c(16),a(17,"translate"),b(),u(18,"li"),c(19),a(20,"translate"),b()(),u(21,"h5",9),c(22),a(23,"translate"),b(),u(24,"ul",8)(25,"li"),c(26),a(27,"translate"),b(),u(28,"li"),c(29),a(30,"translate"),b(),u(31,"li"),c(32),a(33,"translate"),b()()(),u(34,"div",10),A(35,"div",11),u(36,"div",12)(37,"button",13),H("click",function(){return n.dismissModal()}),c(38),a(39,"translate"),b()(),A(40,"div",14),b()()()),i&2&&(o(4),p(r(5,10,"support.title")),o(2),C("aria-label",r(7,12,"form.button_close")),o(6),p(r(13,14,"accessories.title_accessories")),o(4),p(r(17,16,"accessories.support.acc_1")),o(3),p(r(20,18,"accessories.support.acc_2")),o(3),p(r(23,20,"accessories.title_rooms")),o(4),p(r(27,22,"accessories.support.rooms_1")),o(3),p(r(30,24,"accessories.support.rooms_2")),o(3),p(r(33,26,"accessories.support.rooms_3")),o(6),k(" ",r(39,28,"form.button_close")," "))},dependencies:[E],encapsulation:2})}return t})();var pe=()=>({standalone:!0}),de=(()=>{class t{$activeModal=x(V);roomName;dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(e){this.$activeModal.close(e)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["ng-component"]],inputs:{roomName:"roomName"},decls:28,vars:19,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,"text-center","mb-3"],[1,"fas","fa-fw","fa-folder-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["autocomplete","off","type","text","id","form-name","autofocus","",1,"form-control","custom-input",3,"ngModelChange","keyup.enter","ngModel","ngModelOptions"],[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"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(i,n){i&1&&(s(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),c(4),a(5,"translate"),l(),s(6,"button",3),a(7,"translate"),v("click",function(){return n.dismissModal()}),l()(),s(8,"div",4)(9,"div",5),f(10,"i",6),l(),s(11,"ul",7)(12,"li",8)(13,"label",9),c(14),a(15,"translate"),l(),s(16,"div",10)(17,"input",11),I("ngModelChange",function(F){return B(n.roomName,F)||(n.roomName=F),F}),v("keyup.enter",function(){return n.closeModal(n.roomName)}),l()()()()(),s(18,"div",12)(19,"div",13)(20,"button",14),v("click",function(){return n.dismissModal()}),c(21),a(22,"translate"),l()(),f(23,"div",15),s(24,"div",16)(25,"button",17),v("click",function(){return n.closeModal(n.roomName)}),c(26),a(27,"translate"),l()()()()()),i&2&&(o(4),p(r(5,8,"accessories.button_add_room")),o(2),C("aria-label",r(7,10,"form.button_close")),o(8),p(r(15,12,"accessories.room_name")),o(3),T("ngModel",n.roomName),_("ngModelOptions",R(18,pe)),o(4),k(" ",r(22,14,"form.button_close")," "),o(4),_("disabled",!n.roomName),o(),k(" ",r(27,16,"form.button_save")," "))},dependencies:[Y,X,G,J,K,U,Q,E],encapsulation:2})}return t})();var me=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["app-drag-here-placeholder"]],decls:5,vars:3,consts:[[1,"accessory-box"],[1,"fas","fa-fw","fa-arrow-alt-circle-down","accessory-icon"],[1,"accessory-label"]],template:function(i,n){i&1&&(u(0,"div",0),A(1,"i",1),u(2,"div",2),c(3),a(4,"translate"),b()()),i&2&&(o(3),p(r(4,1,"accessories.control.drag_here")))},dependencies:[E],styles:[".accessory-box[_ngcontent-%COMP%]{opacity:.2}"]})}return t})();var ue=(t,g)=>({"fa-eye":t,"fa-eye-slash":g}),_e=t=>({"cursor-move":t}),be=t=>({"justify-content-between":t}),fe=t=>({link:t});function ge(t,g){if(t&1&&(s(0,"div",0)(1,"div",19)(2,"h5",20),c(3),a(4,"translate"),l()()()),t&2){let e=m().$implicit,i=m(2);o(2),_("ngClass",$(4,_e,!i.isMobile)),o(),k(" ",e.name==="Default Room"?r(4,2,"accessories.control.default_room"):e.name," ")}}function ve(t,g){if(t&1&&(s(0,"div",23),f(1,"app-accessory-tile",24),l()),t&2){let e=m().$implicit;o(),_("service",e)}}function xe(t,g){if(t&1&&w(0,ve,2,1,"div",23),t&2){let e=g.$implicit,i=m(4);S(!i.hideHidden||!e.hidden?0:-1)}}function Ce(t,g){if(t&1){let e=D();s(0,"div",21),I("dragulaModelChange",function(n){y(e);let d=m().$implicit;return B(d.services,n)||(d.services=n),h(n)}),L(1,xe,1,1,null,null,P),f(3,"div",22)(4,"div",22)(5,"div",22)(6,"div",22)(7,"div",22)(8,"div",22)(9,"div",22)(10,"div",22)(11,"div",22)(12,"div",22),l()}if(t&2){let e=m().$implicit,i=m(2);_("ngClass",$(3,be,i.isMobile))("dragula","services-bag"),T("dragulaModel",e.services),o(),N(e.services)}}function ye(t,g){if(t&1){let e=D();s(0,"div",25),I("dragulaModelChange",function(n){y(e);let d=m().$implicit;return B(d.services,n)||(d.services=n),h(n)}),f(1,"app-drag-here-placeholder",26),l()}if(t&2){let e=m().$implicit;_("dragula","services-bag"),T("dragulaModel",e.services)}}function he(t,g){if(t&1&&(s(0,"div"),w(1,ge,5,6,"div",0),s(2,"div",16),w(3,Ce,13,5,"div",17),w(4,ye,2,2,"div",18),l()()),t&2){let e=g.$implicit,i=m(2);o(),S(!i.isMobile||e.services.length?1:-1),o(2),S(e.services.length?3:-1),o(),S(!e.services.length&&!i.isMobile?4:-1)}}function Me(t,g){if(t&1){let e=D();s(0,"div",1)(1,"div",2)(2,"h3",3),c(3),a(4,"translate"),l()(),s(5,"div",4)(6,"button",5),a(7,"translate"),v("click",function(){y(e);let n=m();return h(n.openSupport())}),f(8,"i",6),l()(),s(9,"div",7)(10,"button",8),a(11,"translate"),a(12,"translate"),v("click",function(){y(e);let n=m();return h(n.addRoom())}),f(13,"i",9),l(),s(14,"button",8),a(15,"translate"),a(16,"translate"),a(17,"translate"),a(18,"translate"),v("click",function(){y(e);let n=m();return h(n.hideHidden=!n.hideHidden)}),f(19,"i",10),l(),s(20,"div",11)(21,"button",12),a(22,"translate"),a(23,"translate"),v("click",function(){y(e);let n=m();return h(n.toggleLayoutLock())}),f(24,"i",13),l(),s(25,"button",12),a(26,"translate"),a(27,"translate"),v("click",function(){y(e);let n=m();return h(n.toggleLayoutLock())}),f(28,"i",14),l()(),s(29,"button",5),a(30,"translate"),v("click",function(){y(e);let n=m();return h(n.openSupport())}),f(31,"i",6),l()()(),s(32,"div",15),I("dragulaModelChange",function(n){y(e);let d=m();return B(d.$accessories.rooms,n)||(d.$accessories.rooms=n),h(n)}),L(33,he,5,3,"div",null,P),l()}if(t&2){let e=m();o(3),p(r(4,18,"accessories.title_accessories")),o(3),C("aria-label",r(7,20,"support.title")),o(4),_("hidden",e.isMobile)("ngbTooltip",r(11,22,"accessories.button_add_room")),C("aria-label",r(12,24,"accessories.button_add_room")),o(4),_("hidden",e.isMobile)("ngbTooltip",e.hideHidden?r(15,26,"accessories.button_hidden_show"):r(16,28,"accessories.button_hidden_hide")),C("aria-label",e.hideHidden?r(17,30,"accessories.button_hidden_show"):r(18,32,"accessories.button_hidden_hide")),o(5),_("ngClass",j(44,ue,!e.hideHidden,e.hideHidden)),o(2),_("disabled",!e.isMobile)("ngbTooltip",r(22,34,"form.button_unlock")),C("aria-label",r(23,36,"form.button_unlock")),o(4),_("disabled",e.isMobile)("ngbTooltip",r(26,38,"form.button_lock")),C("aria-label",r(27,40,"form.button_lock")),o(4),C("aria-label",r(30,42,"support.title")),o(3),_("dragula","rooms-bag"),T("dragulaModel",e.$accessories.rooms),o(),N(e.$accessories.rooms)}}function Ee(t,g){t&1&&(s(0,"p",33),c(1),a(2,"translate"),l()),t&2&&(o(),p(r(2,1,"accessories.settings_link")))}function we(t,g){if(t&1&&(s(0,"div",0)(1,"div",27)(2,"h3",28),c(3),a(4,"translate"),l()(),s(5,"div",29)(6,"div",30)(7,"h5",31),c(8),a(9,"translate"),l(),f(10,"p",32),a(11,"translate"),w(12,Ee,3,3,"p",33),l()()()),t&2){let e=m();o(3),p(r(4,4,"accessories.title_accessories")),o(5),p(r(9,6,"accessories.control_disabled")),o(2),_("innerHTML",z(11,8,"accessories.message_must_use_insecure_mode",$(11,fe,e.linkInsecure)),W),o(2),S(e.isAdmin?12:-1)}}var it=(()=>{class t{$accessories=x(re);$auth=x(ae);dragulaService=x(te);$modal=x(Z);$settings=x(oe);$md=x(le);orderSubscription;isAdmin=this.$auth.user.admin;enableAccessories=this.$settings.env.enableAccessories;isMobile=!1;hideHidden=!0;linkInsecure='<a href="https://github.com/homebridge/homebridge-config-ui-x/wiki/Enabling-Accessory-Control" target="_blank"><i class="fa fa-fw fa-external-link-alt primary-text"></i></a>';constructor(){let e=this.dragulaService;this.isMobile=this.$md.detect.mobile(),e.createGroup("rooms-bag",{moves:(i,n,d)=>!this.isMobile&&d.classList.contains("drag-handle")}),e.createGroup("services-bag",{moves:i=>!this.isMobile&&!i.classList.contains("no-drag")}),this.orderSubscription=e.drop().subscribe(()=>{setTimeout(()=>{this.$accessories.saveLayout()})}),this.isMobile=!0}ngOnInit(){this.$accessories.start()}addRoom(){this.$modal.open(de,{size:"lg",backdrop:"static"}).result.then(e=>{!e||!e.length||this.$accessories.rooms.find(i=>i.name===e)||(this.$accessories.rooms.push({name:e,services:[]}),this.isMobile&&this.toggleLayoutLock())}).catch(()=>{})}toggleLayoutLock(){this.isMobile=!this.isMobile,this.isMobile?document.querySelectorAll(".services-bag").forEach(i=>{for(let n=0;n<10;n++){let d=document.createElement("div");d.className="accessory-box invisible py-0 my-0",d.style.height="0",i.appendChild(d)}}):document.querySelectorAll(".invisible").forEach(i=>i.remove())}openSupport(){this.$modal.open(ce,{size:"lg",backdrop:"static"})}ngOnDestroy(){this.$accessories.stop(),this.orderSubscription.unsubscribe(),this.dragulaService.destroy("rooms-bag"),this.dragulaService.destroy("services-bag")}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=M({type:t,selectors:[["app-accessories"]],decls:2,vars:1,consts:[[1,"row"],[1,"row","mb-3"],[1,"col-9","col-sm-6"],[1,"primary-text","m-0"],[1,"col-3","col-sm-6","text-end","d-inline-block","d-sm-none"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-fw","fa-question-circle-o"],[1,"col-3","col-sm-6","text-end","d-none","d-sm-inline-block"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","hidden","ngbTooltip"],[1,"fas","fa-fw","fa-folder-plus"],[1,"fas","fa-fw",3,"ngClass"],["role","group",1,"btn-group","me-2"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-unlock"],[1,"fas","fa-fw","fa-lock"],[3,"dragulaModelChange","dragula","dragulaModel"],[1,"row","mb-4"],[1,"col-md-12","d-flex","flex-wrap","noselect","services-bag",3,"ngClass","dragula","dragulaModel"],[1,"col-md-12","d-flex","flex-wrap","noselect",3,"dragula","dragulaModel"],[1,"col-md-12"],[1,"primary-text","drag-handle","room-title","m-0","mb-1","mb-sm-0",3,"ngClass"],[1,"col-md-12","d-flex","flex-wrap","noselect","services-bag",3,"dragulaModelChange","ngClass","dragula","dragulaModel"],[1,"accessory-box","invisible","py-0","my-0",2,"height","0"],[1,"accessory-item","accessory-tab"],[3,"service"],[1,"col-md-12","d-flex","flex-wrap","noselect",3,"dragulaModelChange","dragula","dragulaModel"],[1,"no-drag"],[1,"col-12"],[1,"primary-text","m-0","mb-3"],[1,"col-12","text-center"],["role","alert",1,"alert","alert-warning","p-4"],[1,"mb-3","mt-0"],[1,"mb-0",3,"innerHTML"],[1,"mt-3","mb-0"]],template:function(i,n){i&1&&w(0,Me,35,47)(1,we,13,13,"div",0),i&2&&S(n.enableAccessories?0:1)},dependencies:[ee,q,ne,ie,se,me,E],styles:[".room-title[_ngcontent-%COMP%]{margin-left:10px}@media (max-width: 575px){.room-title[_ngcontent-%COMP%]{margin-left:7px}}.services-bag[_ngcontent-%COMP%]{min-height:170px}@media (max-width: 575px){.services-bag[_ngcontent-%COMP%]{min-height:initial}}.cursor-move[_ngcontent-%COMP%]{cursor:move}.gu-transit[_ngcontent-%COMP%] .manage-accessory-button[_ngcontent-%COMP%]{display:none}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return t})();export{it as AccessoriesComponent};
@@ -1 +1 @@
1
- import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-K7QEGT3E.js";import{ha as o,nb as e}from"./chunk-V7SOQAC5.js";var m=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"restart-server",loadComponent:()=>import("./chunk-C4VRNIVO.js").then(t=>t.RestartLinuxComponent)},{path:"shutdown-server",loadComponent:()=>import("./chunk-ICRMBJHC.js").then(t=>t.ShutdownLinuxComponent)}],n=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=e({type:t});static \u0275inj=o({imports:[i.forChild(m),i]})}return t})();var c=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=e({type:t});static \u0275inj=o({imports:[n]})}return t})();export{c as LinuxModule};
1
+ import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-K7QEGT3E.js";import{ha as o,nb as e}from"./chunk-V7SOQAC5.js";var m=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"restart-server",loadComponent:()=>import("./chunk-Q5REQXYQ.js").then(t=>t.RestartLinuxComponent)},{path:"shutdown-server",loadComponent:()=>import("./chunk-YGYN2VIN.js").then(t=>t.ShutdownLinuxComponent)}],n=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=e({type:t});static \u0275inj=o({imports:[i.forChild(m),i]})}return t})();var c=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=e({type:t});static \u0275inj=o({imports:[n]})}return t})();export{c as LinuxModule};
@@ -1 +1 @@
1
- import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-K7QEGT3E.js";import{ha as t,nb as e}from"./chunk-V7SOQAC5.js";var d=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"docker",loadChildren:()=>import("./chunk-233JOSVL.js").then(o=>o.DockerModule)},{path:"linux",loadChildren:()=>import("./chunk-YEYPP7U2.js").then(o=>o.LinuxModule)},{path:"terminal",loadChildren:()=>import("./chunk-Z2Z26TH3.js").then(o=>o.TerminalModule)}],l=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[i.forChild(d),i]})}return o})();var p=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[l]})}return o})();export{p as PlatformToolsModule};
1
+ import{g as i}from"./chunk-QRQBCPWO.js";import"./chunk-K7QEGT3E.js";import{ha as t,nb as e}from"./chunk-V7SOQAC5.js";var d=[{path:"",redirectTo:"/",pathMatch:"full"},{path:"docker",loadChildren:()=>import("./chunk-R6XXAITV.js").then(o=>o.DockerModule)},{path:"linux",loadChildren:()=>import("./chunk-IOZZWAPL.js").then(o=>o.LinuxModule)},{path:"terminal",loadChildren:()=>import("./chunk-X2DFA2MY.js").then(o=>o.TerminalModule)}],l=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[i.forChild(d),i]})}return o})();var p=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[l]})}return o})();export{p as PlatformToolsModule};
@@ -1 +1 @@
1
- import{a as u}from"./chunk-YFQVSUDS.js";import{k as p,n as m}from"./chunk-SVAR3FIQ.js";import{a as c}from"./chunk-ZG3HINDJ.js";import{g as f,ga as n,h as r,la as a,w as s}from"./chunk-V7SOQAC5.js";var l=f(u(),1);var $=(()=>{class e{$api=a(m);$toastr=a(p);$translate=a(c);downloadBackup(){return r(this,null,function*(){let t=yield s(this.$api.get("/backup/download",{observe:"response",responseType:"blob"})),i=t.headers.get("File-Name")||"homebridge-backup.tar.gz",o=t.body.size;if(o>globalThis.backup.maxBackupSize){let b=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(o/1048576).toFixed(1)}MB`});this.$toastr.warning(b,this.$translate.instant("toast.title_warning"))}(0,l.saveAs)(t.body,i)})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=n({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{$ as a};
1
+ import{a as u}from"./chunk-YFQVSUDS.js";import{k as p,n as m}from"./chunk-4ZYGJMXW.js";import{a as c}from"./chunk-ZG3HINDJ.js";import{g as f,ga as n,h as r,la as a,w as s}from"./chunk-V7SOQAC5.js";var l=f(u(),1);var $=(()=>{class e{$api=a(m);$toastr=a(p);$translate=a(c);downloadBackup(){return r(this,null,function*(){let t=yield s(this.$api.get("/backup/download",{observe:"response",responseType:"blob"})),i=t.headers.get("File-Name")||"homebridge-backup.tar.gz",o=t.body.size;if(o>globalThis.backup.maxBackupSize){let b=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(o/1048576).toFixed(1)}MB`});this.$toastr.warning(b,this.$translate.instant("toast.title_warning"))}(0,l.saveAs)(t.body,i)})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=n({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{$ as a};
@@ -1 +1 @@
1
- import{a as b}from"./chunk-NP3V73ET.js";import"./chunk-2HIOHBJY.js";import{d as k}from"./chunk-QRQBCPWO.js";import{b as S}from"./chunk-MHTDGCRA.js";import{k as T,n as w}from"./chunk-SVAR3FIQ.js";import{a as C,b as $}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{$b as E,Dc as g,Hc as m,Ib as d,Ic as c,Jb as f,Jc as y,Sb as r,Tb as i,Ub as l,Xa as x,ab as n,dc as h,la as o,mb as _,qc as a,rc as s}from"./chunk-V7SOQAC5.js";var I=t=>({command:t});function D(t,u){if(t&1&&(r(0,"div",7),a(1),i()),t&2){let e=h();n(),s(e.error)}}function R(t,u){t&1&&(r(0,"p",9),a(1),m(2,"translate"),i(),r(3,"div",10)(4,"div",11),l(5,"i",12),i()()),t&2&&(n(),s(c(2,1,"restart.please_wait_while_server_restarts")))}function B(t,u){if(t&1&&(r(0,"div",8)(1,"p"),a(2),m(3,"translate"),i(),l(4,"p",13),m(5,"translate"),i()),t&2){let e=h();n(2),s(c(3,2,"platform.docker.server_long_time")),n(2),E("innerHTML",y(5,4,"platform.docker.run_with_restart",g(7,I,e.command)),x)}}var U=(()=>{class t{$api=o(w);$router=o(k);$settings=o(S);$toastr=o(T);$translate=o(C);$ws=o(b);checkTimeout;checkDelay;io;resp={};timeout=!1;error=!1;command='<span class="font-monospace">--restart=always</span>';ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$api.put("/platform-tools/docker/restart-container",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{this.error=this.$translate.instant("restart.toast_server_restart_error"),console.error(e),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}})}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.docker.container_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},1e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},6e4)}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=_({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fab","fa-fw","fa-docker",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"alert","alert-warning","my-4"],[1,"grey-text"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"],[1,"grey-text","mb-0",3,"innerHTML"]],template:function(p,v){p&1&&(r(0,"div",0)(1,"h3",1),a(2),m(3,"translate"),i()(),r(4,"div",2)(5,"div",3),l(6,"i",4),i(),r(7,"div",5)(8,"h4",6),a(9),m(10,"translate"),i(),d(11,D,2,1,"div",7)(12,R,6,3),d(13,B,6,9,"div",8),i()()),p&2&&(n(2),s(c(3,4,"menu.restart.title")),n(7),s(c(10,6,"platform.docker.title_restarting")),n(2),f(v.error?11:12),n(2),f(v.timeout?13:-1))},dependencies:[$],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{U as ContainerRestartComponent};
1
+ import{a as b}from"./chunk-53FPP2IJ.js";import"./chunk-7HCGM76M.js";import{d as k}from"./chunk-QRQBCPWO.js";import{b as S}from"./chunk-FAELDM7K.js";import{k as T,n as w}from"./chunk-4ZYGJMXW.js";import{a as C,b as $}from"./chunk-ZG3HINDJ.js";import"./chunk-K7QEGT3E.js";import{$b as E,Dc as g,Hc as m,Ib as d,Ic as c,Jb as f,Jc as y,Sb as r,Tb as i,Ub as l,Xa as x,ab as n,dc as h,la as o,mb as _,qc as a,rc as s}from"./chunk-V7SOQAC5.js";var I=t=>({command:t});function D(t,u){if(t&1&&(r(0,"div",7),a(1),i()),t&2){let e=h();n(),s(e.error)}}function R(t,u){t&1&&(r(0,"p",9),a(1),m(2,"translate"),i(),r(3,"div",10)(4,"div",11),l(5,"i",12),i()()),t&2&&(n(),s(c(2,1,"restart.please_wait_while_server_restarts")))}function B(t,u){if(t&1&&(r(0,"div",8)(1,"p"),a(2),m(3,"translate"),i(),l(4,"p",13),m(5,"translate"),i()),t&2){let e=h();n(2),s(c(3,2,"platform.docker.server_long_time")),n(2),E("innerHTML",y(5,4,"platform.docker.run_with_restart",g(7,I,e.command)),x)}}var U=(()=>{class t{$api=o(w);$router=o(k);$settings=o(S);$toastr=o(T);$translate=o(C);$ws=o(b);checkTimeout;checkDelay;io;resp={};timeout=!1;error=!1;command='<span class="font-monospace">--restart=always</span>';ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$api.put("/platform-tools/docker/restart-container",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{this.error=this.$translate.instant("restart.toast_server_restart_error"),console.error(e),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}})}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.docker.container_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},1e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},6e4)}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=_({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fab","fa-fw","fa-docker",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"alert","alert-warning","my-4"],[1,"grey-text"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"],[1,"grey-text","mb-0",3,"innerHTML"]],template:function(p,v){p&1&&(r(0,"div",0)(1,"h3",1),a(2),m(3,"translate"),i()(),r(4,"div",2)(5,"div",3),l(6,"i",4),i(),r(7,"div",5)(8,"h4",6),a(9),m(10,"translate"),i(),d(11,D,2,1,"div",7)(12,R,6,3),d(13,B,6,9,"div",8),i()()),p&2&&(n(2),s(c(3,4,"menu.restart.title")),n(7),s(c(10,6,"platform.docker.title_restarting")),n(2),f(v.error?11:12),n(2),f(v.timeout?13:-1))},dependencies:[$],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{U as ContainerRestartComponent};
@@ -1 +1 @@
1
- import{m as J}from"./chunk-PSSVCFFV.js";import{e as O,l as W,r as z,s as q,t as G,z as H}from"./chunk-K2NEWUWG.js";import{d as Y}from"./chunk-QRQBCPWO.js";import{k as X,n as Z}from"./chunk-SVAR3FIQ.js";import{a as K,b as Q}from"./chunk-ZG3HINDJ.js";import{Ec as N,Fc as P,Hb as A,Hc as m,Ib as _,Ic as p,Jb as u,Lb as k,Mb as E,Nb as $,Ob as C,Pb as o,Qb as a,Rb as w,_b as B,a as T,ab as s,b as R,bc as b,dc as d,h as M,id as j,la as y,mb as D,qc as c,ra as f,rc as g,sa as v,sc as h,tc as V,w as S,xc as F,yc as U,zc as L}from"./chunk-V7SOQAC5.js";var te=(t,l)=>({"btn-danger":t,"btn-elegant":l}),ie=(t,l,e)=>({"fa-trash":t,"fa-undo":l,"fa-spinner fa-pulse":e});function ne(t,l){t&1&&(o(0,"div",12),w(1,"i",13),a(),o(2,"p",14),c(3),m(4,"translate"),a()),t&2&&(s(3),g(p(4,1,"reset.no_accessories")))}function se(t,l){if(t&1&&(o(0,"option",24),c(1),a()),t&2){let e=l.$implicit;C("value",e._id),s(),V("",e.name," (",e._username,")")}}function oe(t,l){if(t&1){let e=B();o(0,"li",20),c(1),m(2,"translate"),a(),o(3,"li",18)(4,"label",21),c(5),m(6,"translate"),a(),o(7,"div",22)(8,"select",23),L("ngModelChange",function(i){f(e);let r=d(2);return U(r.selectedBridge,i)||(r.selectedBridge=i),v(i)}),b("change",function(i){f(e);let r=d(2);return v(r.onBridgeChange(i.target.value))}),E(9,se,2,3,"option",24,k),a()()()}if(t&2){let e=d(2);s(),g(p(2,3,"form.label.changes_kept")),s(4),g(p(6,5,"reset.accessory_ind.bridge")),s(3),F("ngModel",e.selectedBridge),s(),$(e.pairings)}}function ae(t,l){if(t&1&&(o(0,"li",18)(1,"label",25),c(2),m(3,"translate"),a(),o(4,"div",26),c(5),a()()),t&2){let e=d(2);s(2),g(p(3,2,"reset.accessory_ind.bridge")),s(3),h(" ",e.getCurrentlySelectedBridge()," ")}}function re(t,l){if(t&1){let e=B();o(0,"li",19)(1,"span"),c(2),w(3,"br"),o(4,"small")(5,"span",27),c(6),a()()(),o(7,"button",28),m(8,"translate"),b("click",function(){let i=f(e).$implicit,r=d(2);return v(r.toggleList(i.UUID,i.$cacheFile))}),w(9,"i",29),a()()}if(t&2){let e=l.$implicit,n=d(2);s(2),h(" ",e.displayName),s(4),g(e.UUID),s(),C("disabled",n.clicked)("ngClass",N(8,te,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile))),A("aria-label",p(8,6,"form.button_delete")),s(2),C("ngClass",P(11,ie,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile)&&!n.clicked,n.isInList(e.UUID,e.$cacheFile)&&n.clicked))}}function le(t,l){if(t&1&&(o(0,"div",12),w(1,"i",15),a(),o(2,"ul",16)(3,"li"),c(4),m(5,"translate"),a(),o(6,"li"),c(7),m(8,"translate"),a(),o(9,"li"),c(10),m(11,"translate"),a()(),o(12,"ul",17),_(13,oe,11,7),_(14,ae,6,4,"li",18),E(15,re,10,15,"li",19,k),a()),t&2){let e=d();s(4),g(p(5,5,"reset.accessory_ind.list_1")),s(3),g(p(8,7,"reset.accessory_ind.list_2")),s(3),g(p(11,9,"reset.accessory_ind.list_3")),s(3),u(e.pairings.length>1?13:-1),s(),u(e.pairings.length===1?14:-1),s(),$(e.selectedBridgeAccessories)}}function ce(t,l){if(t&1){let e=B();o(0,"button",30),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}if(t&2){let e=d();C("disabled",e.clicked),s(),h(" ",p(2,2,"form.button_close")," ")}}function de(t,l){if(t&1){let e=B();o(0,"button",31),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}t&2&&(s(),h(" ",p(2,1,"form.button_close")," "))}function me(t,l){if(t&1&&c(0),t&2){let e=d(3);h(" (",e.toDelete.length,") ")}}function pe(t,l){if(t&1&&(c(0),m(1,"translate"),_(2,me,1,1)),t&2){let e=d(2);h(" ",p(1,2,"form.button_remove")," "),s(2),u(e.toDelete.length>0?2:-1)}}function _e(t,l){t&1&&w(0,"i",33)}function ue(t,l){if(t&1){let e=B();o(0,"button",32),b("click",function(){f(e);let i=d();return v(i.removeAccessories())}),_(1,pe,3,4),_(2,_e,1,0,"i",33),a()}if(t&2){let e=d();C("disabled",!e.toDelete.length||e.clicked),s(),u(e.clicked?-1:1),s(),u(e.clicked?2:-1)}}var ke=(()=>{class t{$activeModal=y(J);$api=y(Z);$router=y(Y);$toastr=y(X);$translate=y(K);selectedBridge="";pairings=[];clicked=!1;selectedBridgeAccessories=[];accessoriesExist=!1;toDelete=[];ngOnInit(){this.loadCachedAccessories()}onBridgeChange(e){this.selectedBridge=e,this.selectedBridgeAccessories=this.pairings.find(n=>n._id===this.selectedBridge)?.accessories}getCurrentlySelectedBridge(){let e=this.pairings.find(n=>n._id===this.selectedBridge);return`${e.name} - ${e._username}`}toggleList(e,n){this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)?this.toDelete=this.toDelete.filter(i=>i.uuid!==e||i.cacheFile!==n):this.toDelete.push({cacheFile:n,uuid:e})}isInList(e,n){return this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)}removeAccessories(){return this.clicked=!0,this.$api.delete("/server/cached-accessories",{body:this.toDelete}).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:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}loadCachedAccessories(){return M(this,null,function*(){try{let[e,n]=yield Promise.all([S(this.$api.get("/server/cached-accessories")),S(this.$api.get("/server/pairings"))]),i=new Map(n.map(r=>[r._id,R(T({},r),{accessories:[]})]));e.sort((r,x)=>r.displayName.localeCompare(x.displayName)).forEach(r=>{let x=n.find(ee=>ee._main),I=r.$cacheFile?.split(".")?.[1]||x._id;(!this.selectedBridge||this.selectedBridge===I)&&(i.has(I)||i.set(I,{_id:I,_username:I.match(/.{1,2}/g).join(":"),name:this.$translate.instant("reset.accessory_ind.unknown"),accessories:[]}),i.get(I).accessories.push(r))}),this.pairings=Array.from(i.values()).filter(r=>r.accessories.length>0).sort((r,x)=>r._main&&!x._main?-1:!r._main&&x._main?1:r.name.localeCompare(x.name)),this.selectedBridge=this.selectedBridge||this.pairings[0]?._id,this.selectedBridge&&(this.accessoriesExist=!0,this.selectedBridgeAccessories=this.pairings[0].accessories)}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("reset.error_message"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=D({type:t,selectors:[["ng-component"]],inputs:{selectedBridge:"selectedBridge"},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-network-wired","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[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,"font-monospace","grey-text"],[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(n,i){n&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),c(3),m(4,"translate"),a(),o(5,"button",3),m(6,"translate"),b("click",function(){return i.dismissModal()}),a()(),o(7,"div",4),_(8,ne,5,3),_(9,le,17,11),a(),o(10,"div",5)(11,"div",6),_(12,ce,3,4,"button",7),a(),o(13,"div",8),_(14,de,3,3,"button",9),a(),o(15,"div",10),_(16,ue,3,3,"button",11),a()()()),n&2&&(s(3),g(p(4,8,"reset.accessory_ind.title")),s(2),C("disabled",i.clicked),A("aria-label",p(6,10,"form.button_close")),s(3),u(i.accessoriesExist?-1:8),s(),u(i.accessoriesExist?9:-1),s(3),u(i.accessoriesExist?12:-1),s(2),u(i.accessoriesExist?-1:14),s(2),u(i.accessoriesExist?16:-1))},dependencies:[j,H,q,G,z,O,W,Q],encapsulation:2})}return t})();export{ke as a};
1
+ import{m as J}from"./chunk-PSSVCFFV.js";import{e as O,l as W,r as z,s as q,t as G,z as H}from"./chunk-K2NEWUWG.js";import{d as Y}from"./chunk-QRQBCPWO.js";import{k as X,n as Z}from"./chunk-4ZYGJMXW.js";import{a as K,b as Q}from"./chunk-ZG3HINDJ.js";import{Ec as N,Fc as P,Hb as A,Hc as m,Ib as _,Ic as p,Jb as u,Lb as k,Mb as E,Nb as $,Ob as C,Pb as o,Qb as a,Rb as w,_b as B,a as T,ab as s,b as R,bc as b,dc as d,h as M,id as j,la as y,mb as D,qc as c,ra as f,rc as g,sa as v,sc as h,tc as V,w as S,xc as F,yc as U,zc as L}from"./chunk-V7SOQAC5.js";var te=(t,l)=>({"btn-danger":t,"btn-elegant":l}),ie=(t,l,e)=>({"fa-trash":t,"fa-undo":l,"fa-spinner fa-pulse":e});function ne(t,l){t&1&&(o(0,"div",12),w(1,"i",13),a(),o(2,"p",14),c(3),m(4,"translate"),a()),t&2&&(s(3),g(p(4,1,"reset.no_accessories")))}function se(t,l){if(t&1&&(o(0,"option",24),c(1),a()),t&2){let e=l.$implicit;C("value",e._id),s(),V("",e.name," (",e._username,")")}}function oe(t,l){if(t&1){let e=B();o(0,"li",20),c(1),m(2,"translate"),a(),o(3,"li",18)(4,"label",21),c(5),m(6,"translate"),a(),o(7,"div",22)(8,"select",23),L("ngModelChange",function(i){f(e);let r=d(2);return U(r.selectedBridge,i)||(r.selectedBridge=i),v(i)}),b("change",function(i){f(e);let r=d(2);return v(r.onBridgeChange(i.target.value))}),E(9,se,2,3,"option",24,k),a()()()}if(t&2){let e=d(2);s(),g(p(2,3,"form.label.changes_kept")),s(4),g(p(6,5,"reset.accessory_ind.bridge")),s(3),F("ngModel",e.selectedBridge),s(),$(e.pairings)}}function ae(t,l){if(t&1&&(o(0,"li",18)(1,"label",25),c(2),m(3,"translate"),a(),o(4,"div",26),c(5),a()()),t&2){let e=d(2);s(2),g(p(3,2,"reset.accessory_ind.bridge")),s(3),h(" ",e.getCurrentlySelectedBridge()," ")}}function re(t,l){if(t&1){let e=B();o(0,"li",19)(1,"span"),c(2),w(3,"br"),o(4,"small")(5,"span",27),c(6),a()()(),o(7,"button",28),m(8,"translate"),b("click",function(){let i=f(e).$implicit,r=d(2);return v(r.toggleList(i.UUID,i.$cacheFile))}),w(9,"i",29),a()()}if(t&2){let e=l.$implicit,n=d(2);s(2),h(" ",e.displayName),s(4),g(e.UUID),s(),C("disabled",n.clicked)("ngClass",N(8,te,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile))),A("aria-label",p(8,6,"form.button_delete")),s(2),C("ngClass",P(11,ie,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile)&&!n.clicked,n.isInList(e.UUID,e.$cacheFile)&&n.clicked))}}function le(t,l){if(t&1&&(o(0,"div",12),w(1,"i",15),a(),o(2,"ul",16)(3,"li"),c(4),m(5,"translate"),a(),o(6,"li"),c(7),m(8,"translate"),a(),o(9,"li"),c(10),m(11,"translate"),a()(),o(12,"ul",17),_(13,oe,11,7),_(14,ae,6,4,"li",18),E(15,re,10,15,"li",19,k),a()),t&2){let e=d();s(4),g(p(5,5,"reset.accessory_ind.list_1")),s(3),g(p(8,7,"reset.accessory_ind.list_2")),s(3),g(p(11,9,"reset.accessory_ind.list_3")),s(3),u(e.pairings.length>1?13:-1),s(),u(e.pairings.length===1?14:-1),s(),$(e.selectedBridgeAccessories)}}function ce(t,l){if(t&1){let e=B();o(0,"button",30),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}if(t&2){let e=d();C("disabled",e.clicked),s(),h(" ",p(2,2,"form.button_close")," ")}}function de(t,l){if(t&1){let e=B();o(0,"button",31),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}t&2&&(s(),h(" ",p(2,1,"form.button_close")," "))}function me(t,l){if(t&1&&c(0),t&2){let e=d(3);h(" (",e.toDelete.length,") ")}}function pe(t,l){if(t&1&&(c(0),m(1,"translate"),_(2,me,1,1)),t&2){let e=d(2);h(" ",p(1,2,"form.button_remove")," "),s(2),u(e.toDelete.length>0?2:-1)}}function _e(t,l){t&1&&w(0,"i",33)}function ue(t,l){if(t&1){let e=B();o(0,"button",32),b("click",function(){f(e);let i=d();return v(i.removeAccessories())}),_(1,pe,3,4),_(2,_e,1,0,"i",33),a()}if(t&2){let e=d();C("disabled",!e.toDelete.length||e.clicked),s(),u(e.clicked?-1:1),s(),u(e.clicked?2:-1)}}var ke=(()=>{class t{$activeModal=y(J);$api=y(Z);$router=y(Y);$toastr=y(X);$translate=y(K);selectedBridge="";pairings=[];clicked=!1;selectedBridgeAccessories=[];accessoriesExist=!1;toDelete=[];ngOnInit(){this.loadCachedAccessories()}onBridgeChange(e){this.selectedBridge=e,this.selectedBridgeAccessories=this.pairings.find(n=>n._id===this.selectedBridge)?.accessories}getCurrentlySelectedBridge(){let e=this.pairings.find(n=>n._id===this.selectedBridge);return`${e.name} - ${e._username}`}toggleList(e,n){this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)?this.toDelete=this.toDelete.filter(i=>i.uuid!==e||i.cacheFile!==n):this.toDelete.push({cacheFile:n,uuid:e})}isInList(e,n){return this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)}removeAccessories(){return this.clicked=!0,this.$api.delete("/server/cached-accessories",{body:this.toDelete}).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:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}loadCachedAccessories(){return M(this,null,function*(){try{let[e,n]=yield Promise.all([S(this.$api.get("/server/cached-accessories")),S(this.$api.get("/server/pairings"))]),i=new Map(n.map(r=>[r._id,R(T({},r),{accessories:[]})]));e.sort((r,x)=>r.displayName.localeCompare(x.displayName)).forEach(r=>{let x=n.find(ee=>ee._main),I=r.$cacheFile?.split(".")?.[1]||x._id;(!this.selectedBridge||this.selectedBridge===I)&&(i.has(I)||i.set(I,{_id:I,_username:I.match(/.{1,2}/g).join(":"),name:this.$translate.instant("reset.accessory_ind.unknown"),accessories:[]}),i.get(I).accessories.push(r))}),this.pairings=Array.from(i.values()).filter(r=>r.accessories.length>0).sort((r,x)=>r._main&&!x._main?-1:!r._main&&x._main?1:r.name.localeCompare(x.name)),this.selectedBridge=this.selectedBridge||this.pairings[0]?._id,this.selectedBridge&&(this.accessoriesExist=!0,this.selectedBridgeAccessories=this.pairings[0].accessories)}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("reset.error_message"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=D({type:t,selectors:[["ng-component"]],inputs:{selectedBridge:"selectedBridge"},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-network-wired","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[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,"font-monospace","grey-text"],[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(n,i){n&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),c(3),m(4,"translate"),a(),o(5,"button",3),m(6,"translate"),b("click",function(){return i.dismissModal()}),a()(),o(7,"div",4),_(8,ne,5,3),_(9,le,17,11),a(),o(10,"div",5)(11,"div",6),_(12,ce,3,4,"button",7),a(),o(13,"div",8),_(14,de,3,3,"button",9),a(),o(15,"div",10),_(16,ue,3,3,"button",11),a()()()),n&2&&(s(3),g(p(4,8,"reset.accessory_ind.title")),s(2),C("disabled",i.clicked),A("aria-label",p(6,10,"form.button_close")),s(3),u(i.accessoriesExist?-1:8),s(),u(i.accessoriesExist?9:-1),s(3),u(i.accessoriesExist?12:-1),s(2),u(i.accessoriesExist?-1:14),s(2),u(i.accessoriesExist?16:-1))},dependencies:[j,H,q,G,z,O,W,Q],encapsulation:2})}return t})();export{ke as a};
@@ -1,4 +1,4 @@
1
- import{a as Hf}from"./chunk-HAW5WR2X.js";import{a as _i,b as o2}from"./chunk-PJDX7TKL.js";import{a as qf}from"./chunk-DDAEYXAV.js";import{a as Lf}from"./chunk-P3TP4J62.js";import{a as zf}from"./chunk-QKWUY26L.js";import{a as lo}from"./chunk-YFQVSUDS.js";import{a as Bf,c as Rf}from"./chunk-BSZ6MHFZ.js";import{a as Uf}from"./chunk-ADNBR4EK.js";import{a as Qa,b as is}from"./chunk-7FO4RGTF.js";import{a as es,b as ts}from"./chunk-2KOR6LRK.js";import{a as Vf}from"./chunk-K46AA6SH.js";import{a as Ka,b as Ga,c as Ja,d as Xa,e as Ya,f as Za,g as rr,m as Oe,n as ot,o as Df,p as Af,q as Nf,r as jf,s as Ff,t as or}from"./chunk-PSSVCFFV.js";import{A as so,a as If,b as Yi,c as ir,e as $t,f as $f,h as Ef,i as Tf,j as Pf,k as Of,l as Zi,m as kf,o as Qi,r as nr,s as On,t as kn,y as Mf,z as oi}from"./chunk-K2NEWUWG.js";import{a as tn}from"./chunk-NP3V73ET.js";import{d as yi}from"./chunk-QRQBCPWO.js";import{b as Re}from"./chunk-MHTDGCRA.js";import{k as Ce,m as en,n as ve}from"./chunk-SVAR3FIQ.js";import{a as xe,b as ke}from"./chunk-ZG3HINDJ.js";import{e as Sf}from"./chunk-K7QEGT3E.js";import{$a as mf,Ac as vf,Bc as xf,Ca as Wi,Cc as Pe,D as uf,Da as ff,Dc as ri,Ec as Tn,Fa as Qn,Fc as Wt,Gc as tr,Hb as G,Hc as w,Ib as E,Ic as I,Jb as T,Jc as He,Lb as at,M as Yn,Mb as st,Nb as lt,Ob as b,Pb as f,Qb as m,Qc as xt,Rb as $,Rc as z,Sb as Qe,Sc as Xi,Tb as rt,Ub as gi,Uc as Cf,Vb as yf,Wb as _f,Xa as he,Z as lu,_b as H,a as X,aa as ao,ab as d,b as $e,bc as q,cc as Ht,dc as y,e as g,fa as cf,fb as Ua,g as ze,ga as Ft,gb as Ti,h as K,ha as Zn,hc as uu,ib as In,ic as cu,id as Kt,ja as df,jc as du,jd as Pn,k as of,ka as pf,kc as Ki,kd as Ct,la as P,lc as Gi,mb as Y,mc as bf,n as jt,nb as er,nc as ni,o as su,ob as $n,oc as Ji,pb as hf,pc as Z,q as af,qc as x,ra as j,rc as R,rd as Wa,sa as F,sb as ue,sc as V,tc as En,ub as gf,uc as Ha,v as sf,vb as za,w as le,x as lf,xc as Ae,yc as Ne,za as La,zc as je,zd as wf}from"./chunk-V7SOQAC5.js";var po=g(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.regexpCode=be.getEsmExportName=be.getProperty=be.safeStringify=be.stringify=be.strConcat=be.addCodeArg=be.str=be._=be.nil=be._Code=be.Name=be.IDENTIFIER=be._CodeOrName=void 0;var uo=class{};be._CodeOrName=uo;be.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Mn=class extends uo{constructor(t){if(super(),!be.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};be.Name=Mn;var Gt=class extends uo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((i,n)=>`${i}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((i,n)=>(n instanceof Mn&&(i[n.str]=(i[n.str]||0)+1),i),{})}};be._Code=Gt;be.nil=new Gt("");function Wf(e,...t){let i=[e[0]],n=0;for(;n<t.length;)fu(i,t[n]),i.push(e[++n]);return new Gt(i)}be._=Wf;var pu=new Gt("+");function Kf(e,...t){let i=[co(e[0])],n=0;for(;n<t.length;)i.push(pu),fu(i,t[n]),i.push(pu,co(e[++n]));return s2(i),new Gt(i)}be.str=Kf;function fu(e,t){t instanceof Gt?e.push(...t._items):t instanceof Mn?e.push(t):e.push(c2(t))}be.addCodeArg=fu;function s2(e){let t=1;for(;t<e.length-1;){if(e[t]===pu){let i=l2(e[t-1],e[t+1]);if(i!==void 0){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}function l2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Mn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Mn))return`"${e}${t.slice(1)}`}function u2(e,t){return t.emptyStr()?e:e.emptyStr()?t:Kf`${e}${t}`}be.strConcat=u2;function c2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:co(Array.isArray(e)?e.join(","):e)}function d2(e){return new Gt(co(e))}be.stringify=d2;function co(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}be.safeStringify=co;function p2(e){return typeof e=="string"&&be.IDENTIFIER.test(e)?new Gt(`.${e}`):Wf`[${e}]`}be.getProperty=p2;function f2(e){if(typeof e=="string"&&be.IDENTIFIER.test(e))return new Gt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}be.getEsmExportName=f2;function m2(e){return new Gt(e.toString())}be.regexpCode=m2});var gu=g(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.ValueScope=Tt.ValueScopeName=Tt.Scope=Tt.varKinds=Tt.UsedValueState=void 0;var Et=po(),mu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ns=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(ns||(Tt.UsedValueState=ns={}));Tt.varKinds={const:new Et.Name("const"),let:new Et.Name("let"),var:new Et.Name("var")};var rs=class{constructor({prefixes:t,parent:i}={}){this._names={},this._prefixes=t,this._parent=i}toName(t){return t instanceof Et.Name?t:this.name(t)}name(t){return new Et.Name(this._newName(t))}_newName(t){let i=this._names[t]||this._nameGroup(t);return`${t}${i.index++}`}_nameGroup(t){var i,n;if(!((n=(i=this._parent)===null||i===void 0?void 0:i._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Tt.Scope=rs;var os=class extends Et.Name{constructor(t,i){super(i),this.prefix=t}setValue(t,{property:i,itemIndex:n}){this.value=t,this.scopePath=(0,Et._)`.${new Et.Name(i)}[${n}]`}};Tt.ValueScopeName=os;var h2=(0,Et._)`\n`,hu=class extends rs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts=$e(X({},t),{_n:t.lines?h2:Et.nil})}get(){return this._scope}name(t){return new os(t,this._newName(t))}value(t,i){var n;if(i.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(t),{prefix:o}=r,a=(n=i.key)!==null&&n!==void 0?n:i.ref,s=this._values[o];if(s){let c=s.get(a);if(c)return c}else s=this._values[o]=new Map;s.set(a,r);let l=this._scope[o]||(this._scope[o]=[]),u=l.length;return l[u]=i.ref,r.setValue(i,{property:o,itemIndex:u}),r}getValue(t,i){let n=this._values[t];if(n)return n.get(i)}scopeRefs(t,i=this._values){return this._reduceValues(i,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Et._)`${t}${n.scopePath}`})}scopeCode(t=this._values,i,n){return this._reduceValues(t,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},i,n)}_reduceValues(t,i,n={},r){let o=Et.nil;for(let a in t){let s=t[a];if(!s)continue;let l=n[a]=n[a]||new Map;s.forEach(u=>{if(l.has(u))return;l.set(u,ns.Started);let c=i(u);if(c){let p=this.opts.es5?Tt.varKinds.var:Tt.varKinds.const;o=(0,Et._)`${o}${p} ${u} = ${c};${this.opts._n}`}else if(c=r?.(u))o=(0,Et._)`${o}${c}${this.opts._n}`;else throw new mu(u);l.set(u,ns.Completed)})}return o}};Tt.ValueScope=hu});var ee=g(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.or=ce.and=ce.not=ce.CodeGen=ce.operators=ce.varKinds=ce.ValueScopeName=ce.ValueScope=ce.Scope=ce.Name=ce.regexpCode=ce.stringify=ce.getProperty=ce.nil=ce.strConcat=ce.str=ce._=void 0;var ge=po(),ai=gu(),nn=po();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return nn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return nn.str}});Object.defineProperty(ce,"strConcat",{enumerable:!0,get:function(){return nn.strConcat}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return nn.nil}});Object.defineProperty(ce,"getProperty",{enumerable:!0,get:function(){return nn.getProperty}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return nn.stringify}});Object.defineProperty(ce,"regexpCode",{enumerable:!0,get:function(){return nn.regexpCode}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return nn.Name}});var cs=gu();Object.defineProperty(ce,"Scope",{enumerable:!0,get:function(){return cs.Scope}});Object.defineProperty(ce,"ValueScope",{enumerable:!0,get:function(){return cs.ValueScope}});Object.defineProperty(ce,"ValueScopeName",{enumerable:!0,get:function(){return cs.ValueScopeName}});Object.defineProperty(ce,"varKinds",{enumerable:!0,get:function(){return cs.varKinds}});ce.operators={GT:new ge._Code(">"),GTE:new ge._Code(">="),LT:new ge._Code("<"),LTE:new ge._Code("<="),EQ:new ge._Code("==="),NEQ:new ge._Code("!=="),NOT:new ge._Code("!"),OR:new ge._Code("||"),AND:new ge._Code("&&"),ADD:new ge._Code("+")};var Pi=class{optimizeNodes(){return this}optimizeNames(t,i){return this}},yu=class extends Pi{constructor(t,i,n){super(),this.varKind=t,this.name=i,this.rhs=n}render({es5:t,_n:i}){let n=t?ai.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+i}optimizeNames(t,i){if(t[this.name.str])return this.rhs&&(this.rhs=sr(this.rhs,t,i)),this}get names(){return this.rhs instanceof ge._CodeOrName?this.rhs.names:{}}},ss=class extends Pi{constructor(t,i,n){super(),this.lhs=t,this.rhs=i,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,i){if(!(this.lhs instanceof ge.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sr(this.rhs,t,i),this}get names(){let t=this.lhs instanceof ge.Name?{}:X({},this.lhs.names);return us(t,this.rhs)}},_u=class extends ss{constructor(t,i,n,r){super(t,n,r),this.op=i}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},vu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xu=class extends Pi{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Cu=class extends Pi{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,i){return this.code=sr(this.code,t,i),this}get names(){return this.code instanceof ge._CodeOrName?this.code.names:{}}},fo=class extends Pi{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((i,n)=>i+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,i=t.length;for(;i--;){let n=t[i].optimizeNodes();Array.isArray(n)?t.splice(i,1,...n):n?t[i]=n:t.splice(i,1)}return t.length>0?this:void 0}optimizeNames(t,i){let{nodes:n}=this,r=n.length;for(;r--;){let o=n[r];o.optimizeNames(t,i)||(g2(t,o.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,i)=>Dn(t,i.names),{})}},Oi=class extends fo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},wu=class extends fo{},Su=(()=>{class e extends Oi{}return e.kind="else",e})(),as=(()=>{class e extends Oi{constructor(i,n){super(n),this.condition=i}render(i){let n=`if(${this.condition})`+super.render(i);return this.else&&(n+="else "+this.else.render(i)),n}optimizeNodes(){super.optimizeNodes();let i=this.condition;if(i===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new Su(r):r}if(n)return i===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(Zf(i),n instanceof e?[n]:n.nodes);if(!(i===!1||!this.nodes.length))return this}optimizeNames(i,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(i,n),!!(super.optimizeNames(i,n)||this.else))return this.condition=sr(this.condition,i,n),this}get names(){let i=super.names;return us(i,this.condition),this.else&&Dn(i,this.else.names),i}}return e.kind="if",e})(),ds=(()=>{class e extends Oi{}return e.kind="for",e})(),Iu=class extends ds{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iteration=sr(this.iteration,t,i),this}get names(){return Dn(super.names,this.iteration.names)}},$u=class extends ds{constructor(t,i,n,r){super(),this.varKind=t,this.name=i,this.from=n,this.to=r}render(t){let i=t.es5?ai.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${i} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=us(super.names,this.from);return us(t,this.to)}},ls=class extends ds{constructor(t,i,n,r){super(),this.loop=t,this.varKind=i,this.name=n,this.iterable=r}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iterable=sr(this.iterable,t,i),this}get names(){return Dn(super.names,this.iterable.names)}},Gf=(()=>{class e extends Oi{constructor(i,n,r){super(),this.name=i,this.args=n,this.async=r}render(i){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(i)}}return e.kind="func",e})(),Jf=(()=>{class e extends fo{render(i){return"return "+super.render(i)}}return e.kind="return",e})(),Eu=class extends Oi{render(t){let i="try"+super.render(t);return this.catch&&(i+=this.catch.render(t)),this.finally&&(i+=this.finally.render(t)),i}optimizeNodes(){var t,i;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(i=this.finally)===null||i===void 0||i.optimizeNodes(),this}optimizeNames(t,i){var n,r;return super.optimizeNames(t,i),(n=this.catch)===null||n===void 0||n.optimizeNames(t,i),(r=this.finally)===null||r===void 0||r.optimizeNames(t,i),this}get names(){let t=super.names;return this.catch&&Dn(t,this.catch.names),this.finally&&Dn(t,this.finally.names),t}},Xf=(()=>{class e extends Oi{constructor(i){super(),this.error=i}render(i){return`catch(${this.error})`+super.render(i)}}return e.kind="catch",e})(),Yf=(()=>{class e extends Oi{render(i){return"finally"+super.render(i)}}return e.kind="finally",e})(),Tu=class{constructor(t,i={}){this._values={},this._blockStarts=[],this._constants={},this.opts=$e(X({},i),{_n:i.lines?`
1
+ import{a as Hf}from"./chunk-L2KN725U.js";import{a as _i,b as o2}from"./chunk-PJDX7TKL.js";import{a as qf}from"./chunk-ZT56WXIZ.js";import{a as Lf}from"./chunk-P3TP4J62.js";import{a as zf}from"./chunk-E74SDSOB.js";import{a as lo}from"./chunk-YFQVSUDS.js";import{a as Bf,c as Rf}from"./chunk-BSZ6MHFZ.js";import{a as Uf}from"./chunk-ADNBR4EK.js";import{a as Qa,b as is}from"./chunk-7FO4RGTF.js";import{a as es,b as ts}from"./chunk-2KOR6LRK.js";import{a as Vf}from"./chunk-K46AA6SH.js";import{a as Ka,b as Ga,c as Ja,d as Xa,e as Ya,f as Za,g as rr,m as Oe,n as ot,o as Df,p as Af,q as Nf,r as jf,s as Ff,t as or}from"./chunk-PSSVCFFV.js";import{A as so,a as If,b as Yi,c as ir,e as $t,f as $f,h as Ef,i as Tf,j as Pf,k as Of,l as Zi,m as kf,o as Qi,r as nr,s as On,t as kn,y as Mf,z as oi}from"./chunk-K2NEWUWG.js";import{a as tn}from"./chunk-53FPP2IJ.js";import{d as yi}from"./chunk-QRQBCPWO.js";import{b as Re}from"./chunk-FAELDM7K.js";import{k as Ce,m as en,n as ve}from"./chunk-4ZYGJMXW.js";import{a as xe,b as ke}from"./chunk-ZG3HINDJ.js";import{e as Sf}from"./chunk-K7QEGT3E.js";import{$a as mf,Ac as vf,Bc as xf,Ca as Wi,Cc as Pe,D as uf,Da as ff,Dc as ri,Ec as Tn,Fa as Qn,Fc as Wt,Gc as tr,Hb as G,Hc as w,Ib as E,Ic as I,Jb as T,Jc as He,Lb as at,M as Yn,Mb as st,Nb as lt,Ob as b,Pb as f,Qb as m,Qc as xt,Rb as $,Rc as z,Sb as Qe,Sc as Xi,Tb as rt,Ub as gi,Uc as Cf,Vb as yf,Wb as _f,Xa as he,Z as lu,_b as H,a as X,aa as ao,ab as d,b as $e,bc as q,cc as Ht,dc as y,e as g,fa as cf,fb as Ua,g as ze,ga as Ft,gb as Ti,h as K,ha as Zn,hc as uu,ib as In,ic as cu,id as Kt,ja as df,jc as du,jd as Pn,k as of,ka as pf,kc as Ki,kd as Ct,la as P,lc as Gi,mb as Y,mc as bf,n as jt,nb as er,nc as ni,o as su,ob as $n,oc as Ji,pb as hf,pc as Z,q as af,qc as x,ra as j,rc as R,rd as Wa,sa as F,sb as ue,sc as V,tc as En,ub as gf,uc as Ha,v as sf,vb as za,w as le,x as lf,xc as Ae,yc as Ne,za as La,zc as je,zd as wf}from"./chunk-V7SOQAC5.js";var po=g(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.regexpCode=be.getEsmExportName=be.getProperty=be.safeStringify=be.stringify=be.strConcat=be.addCodeArg=be.str=be._=be.nil=be._Code=be.Name=be.IDENTIFIER=be._CodeOrName=void 0;var uo=class{};be._CodeOrName=uo;be.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Mn=class extends uo{constructor(t){if(super(),!be.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};be.Name=Mn;var Gt=class extends uo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((i,n)=>`${i}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((i,n)=>(n instanceof Mn&&(i[n.str]=(i[n.str]||0)+1),i),{})}};be._Code=Gt;be.nil=new Gt("");function Wf(e,...t){let i=[e[0]],n=0;for(;n<t.length;)fu(i,t[n]),i.push(e[++n]);return new Gt(i)}be._=Wf;var pu=new Gt("+");function Kf(e,...t){let i=[co(e[0])],n=0;for(;n<t.length;)i.push(pu),fu(i,t[n]),i.push(pu,co(e[++n]));return s2(i),new Gt(i)}be.str=Kf;function fu(e,t){t instanceof Gt?e.push(...t._items):t instanceof Mn?e.push(t):e.push(c2(t))}be.addCodeArg=fu;function s2(e){let t=1;for(;t<e.length-1;){if(e[t]===pu){let i=l2(e[t-1],e[t+1]);if(i!==void 0){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}function l2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Mn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Mn))return`"${e}${t.slice(1)}`}function u2(e,t){return t.emptyStr()?e:e.emptyStr()?t:Kf`${e}${t}`}be.strConcat=u2;function c2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:co(Array.isArray(e)?e.join(","):e)}function d2(e){return new Gt(co(e))}be.stringify=d2;function co(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}be.safeStringify=co;function p2(e){return typeof e=="string"&&be.IDENTIFIER.test(e)?new Gt(`.${e}`):Wf`[${e}]`}be.getProperty=p2;function f2(e){if(typeof e=="string"&&be.IDENTIFIER.test(e))return new Gt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}be.getEsmExportName=f2;function m2(e){return new Gt(e.toString())}be.regexpCode=m2});var gu=g(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.ValueScope=Tt.ValueScopeName=Tt.Scope=Tt.varKinds=Tt.UsedValueState=void 0;var Et=po(),mu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ns=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(ns||(Tt.UsedValueState=ns={}));Tt.varKinds={const:new Et.Name("const"),let:new Et.Name("let"),var:new Et.Name("var")};var rs=class{constructor({prefixes:t,parent:i}={}){this._names={},this._prefixes=t,this._parent=i}toName(t){return t instanceof Et.Name?t:this.name(t)}name(t){return new Et.Name(this._newName(t))}_newName(t){let i=this._names[t]||this._nameGroup(t);return`${t}${i.index++}`}_nameGroup(t){var i,n;if(!((n=(i=this._parent)===null||i===void 0?void 0:i._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Tt.Scope=rs;var os=class extends Et.Name{constructor(t,i){super(i),this.prefix=t}setValue(t,{property:i,itemIndex:n}){this.value=t,this.scopePath=(0,Et._)`.${new Et.Name(i)}[${n}]`}};Tt.ValueScopeName=os;var h2=(0,Et._)`\n`,hu=class extends rs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts=$e(X({},t),{_n:t.lines?h2:Et.nil})}get(){return this._scope}name(t){return new os(t,this._newName(t))}value(t,i){var n;if(i.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(t),{prefix:o}=r,a=(n=i.key)!==null&&n!==void 0?n:i.ref,s=this._values[o];if(s){let c=s.get(a);if(c)return c}else s=this._values[o]=new Map;s.set(a,r);let l=this._scope[o]||(this._scope[o]=[]),u=l.length;return l[u]=i.ref,r.setValue(i,{property:o,itemIndex:u}),r}getValue(t,i){let n=this._values[t];if(n)return n.get(i)}scopeRefs(t,i=this._values){return this._reduceValues(i,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Et._)`${t}${n.scopePath}`})}scopeCode(t=this._values,i,n){return this._reduceValues(t,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},i,n)}_reduceValues(t,i,n={},r){let o=Et.nil;for(let a in t){let s=t[a];if(!s)continue;let l=n[a]=n[a]||new Map;s.forEach(u=>{if(l.has(u))return;l.set(u,ns.Started);let c=i(u);if(c){let p=this.opts.es5?Tt.varKinds.var:Tt.varKinds.const;o=(0,Et._)`${o}${p} ${u} = ${c};${this.opts._n}`}else if(c=r?.(u))o=(0,Et._)`${o}${c}${this.opts._n}`;else throw new mu(u);l.set(u,ns.Completed)})}return o}};Tt.ValueScope=hu});var ee=g(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.or=ce.and=ce.not=ce.CodeGen=ce.operators=ce.varKinds=ce.ValueScopeName=ce.ValueScope=ce.Scope=ce.Name=ce.regexpCode=ce.stringify=ce.getProperty=ce.nil=ce.strConcat=ce.str=ce._=void 0;var ge=po(),ai=gu(),nn=po();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return nn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return nn.str}});Object.defineProperty(ce,"strConcat",{enumerable:!0,get:function(){return nn.strConcat}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return nn.nil}});Object.defineProperty(ce,"getProperty",{enumerable:!0,get:function(){return nn.getProperty}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return nn.stringify}});Object.defineProperty(ce,"regexpCode",{enumerable:!0,get:function(){return nn.regexpCode}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return nn.Name}});var cs=gu();Object.defineProperty(ce,"Scope",{enumerable:!0,get:function(){return cs.Scope}});Object.defineProperty(ce,"ValueScope",{enumerable:!0,get:function(){return cs.ValueScope}});Object.defineProperty(ce,"ValueScopeName",{enumerable:!0,get:function(){return cs.ValueScopeName}});Object.defineProperty(ce,"varKinds",{enumerable:!0,get:function(){return cs.varKinds}});ce.operators={GT:new ge._Code(">"),GTE:new ge._Code(">="),LT:new ge._Code("<"),LTE:new ge._Code("<="),EQ:new ge._Code("==="),NEQ:new ge._Code("!=="),NOT:new ge._Code("!"),OR:new ge._Code("||"),AND:new ge._Code("&&"),ADD:new ge._Code("+")};var Pi=class{optimizeNodes(){return this}optimizeNames(t,i){return this}},yu=class extends Pi{constructor(t,i,n){super(),this.varKind=t,this.name=i,this.rhs=n}render({es5:t,_n:i}){let n=t?ai.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+i}optimizeNames(t,i){if(t[this.name.str])return this.rhs&&(this.rhs=sr(this.rhs,t,i)),this}get names(){return this.rhs instanceof ge._CodeOrName?this.rhs.names:{}}},ss=class extends Pi{constructor(t,i,n){super(),this.lhs=t,this.rhs=i,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,i){if(!(this.lhs instanceof ge.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sr(this.rhs,t,i),this}get names(){let t=this.lhs instanceof ge.Name?{}:X({},this.lhs.names);return us(t,this.rhs)}},_u=class extends ss{constructor(t,i,n,r){super(t,n,r),this.op=i}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},vu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xu=class extends Pi{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Cu=class extends Pi{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,i){return this.code=sr(this.code,t,i),this}get names(){return this.code instanceof ge._CodeOrName?this.code.names:{}}},fo=class extends Pi{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((i,n)=>i+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,i=t.length;for(;i--;){let n=t[i].optimizeNodes();Array.isArray(n)?t.splice(i,1,...n):n?t[i]=n:t.splice(i,1)}return t.length>0?this:void 0}optimizeNames(t,i){let{nodes:n}=this,r=n.length;for(;r--;){let o=n[r];o.optimizeNames(t,i)||(g2(t,o.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,i)=>Dn(t,i.names),{})}},Oi=class extends fo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},wu=class extends fo{},Su=(()=>{class e extends Oi{}return e.kind="else",e})(),as=(()=>{class e extends Oi{constructor(i,n){super(n),this.condition=i}render(i){let n=`if(${this.condition})`+super.render(i);return this.else&&(n+="else "+this.else.render(i)),n}optimizeNodes(){super.optimizeNodes();let i=this.condition;if(i===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new Su(r):r}if(n)return i===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(Zf(i),n instanceof e?[n]:n.nodes);if(!(i===!1||!this.nodes.length))return this}optimizeNames(i,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(i,n),!!(super.optimizeNames(i,n)||this.else))return this.condition=sr(this.condition,i,n),this}get names(){let i=super.names;return us(i,this.condition),this.else&&Dn(i,this.else.names),i}}return e.kind="if",e})(),ds=(()=>{class e extends Oi{}return e.kind="for",e})(),Iu=class extends ds{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iteration=sr(this.iteration,t,i),this}get names(){return Dn(super.names,this.iteration.names)}},$u=class extends ds{constructor(t,i,n,r){super(),this.varKind=t,this.name=i,this.from=n,this.to=r}render(t){let i=t.es5?ai.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${i} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=us(super.names,this.from);return us(t,this.to)}},ls=class extends ds{constructor(t,i,n,r){super(),this.loop=t,this.varKind=i,this.name=n,this.iterable=r}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iterable=sr(this.iterable,t,i),this}get names(){return Dn(super.names,this.iterable.names)}},Gf=(()=>{class e extends Oi{constructor(i,n,r){super(),this.name=i,this.args=n,this.async=r}render(i){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(i)}}return e.kind="func",e})(),Jf=(()=>{class e extends fo{render(i){return"return "+super.render(i)}}return e.kind="return",e})(),Eu=class extends Oi{render(t){let i="try"+super.render(t);return this.catch&&(i+=this.catch.render(t)),this.finally&&(i+=this.finally.render(t)),i}optimizeNodes(){var t,i;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(i=this.finally)===null||i===void 0||i.optimizeNodes(),this}optimizeNames(t,i){var n,r;return super.optimizeNames(t,i),(n=this.catch)===null||n===void 0||n.optimizeNames(t,i),(r=this.finally)===null||r===void 0||r.optimizeNames(t,i),this}get names(){let t=super.names;return this.catch&&Dn(t,this.catch.names),this.finally&&Dn(t,this.finally.names),t}},Xf=(()=>{class e extends Oi{constructor(i){super(),this.error=i}render(i){return`catch(${this.error})`+super.render(i)}}return e.kind="catch",e})(),Yf=(()=>{class e extends Oi{render(i){return"finally"+super.render(i)}}return e.kind="finally",e})(),Tu=class{constructor(t,i={}){this._values={},this._blockStarts=[],this._constants={},this.opts=$e(X({},i),{_n:i.lines?`
2
2
  `:""}),this._extScope=t,this._scope=new ai.Scope({parent:t}),this._nodes=[new wu]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,i){let n=this._extScope.value(t,i);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,i){return this._extScope.getValue(t,i)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,i,n,r){let o=this._scope.toName(i);return n!==void 0&&r&&(this._constants[o.str]=n),this._leafNode(new yu(t,o,n)),o}const(t,i,n){return this._def(ai.varKinds.const,t,i,n)}let(t,i,n){return this._def(ai.varKinds.let,t,i,n)}var(t,i,n){return this._def(ai.varKinds.var,t,i,n)}assign(t,i,n){return this._leafNode(new ss(t,i,n))}add(t,i){return this._leafNode(new _u(t,ce.operators.ADD,i))}code(t){return typeof t=="function"?t():t!==ge.nil&&this._leafNode(new Cu(t)),this}object(...t){let i=["{"];for(let[n,r]of t)i.length>1&&i.push(","),i.push(n),(n!==r||this.opts.es5)&&(i.push(":"),(0,ge.addCodeArg)(i,r));return i.push("}"),new ge._Code(i)}if(t,i,n){if(this._blockNode(new as(t)),i&&n)this.code(i).else().code(n).endIf();else if(i)this.code(i).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new as(t))}else(){return this._elseNode(new Su)}endIf(){return this._endBlockNode(as,Su)}_for(t,i){return this._blockNode(t),i&&this.code(i).endFor(),this}for(t,i){return this._for(new Iu(t),i)}forRange(t,i,n,r,o=this.opts.es5?ai.varKinds.var:ai.varKinds.let){let a=this._scope.toName(t);return this._for(new $u(o,a,i,n),()=>r(a))}forOf(t,i,n,r=ai.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=i instanceof ge.Name?i:this.var("_arr",i);return this.forRange("_i",0,(0,ge._)`${a}.length`,s=>{this.var(o,(0,ge._)`${a}[${s}]`),n(o)})}return this._for(new ls("of",r,o,i),()=>n(o))}forIn(t,i,n,r=this.opts.es5?ai.varKinds.var:ai.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,ge._)`Object.keys(${i})`,n);let o=this._scope.toName(t);return this._for(new ls("in",r,o,i),()=>n(o))}endFor(){return this._endBlockNode(ds)}label(t){return this._leafNode(new bu(t))}break(t){return this._leafNode(new vu(t))}return(t){let i=new Jf;if(this._blockNode(i),this.code(t),i.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jf)}try(t,i,n){if(!i&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let r=new Eu;if(this._blockNode(r),this.code(t),i){let o=this.name("e");this._currNode=r.catch=new Xf(o),i(o)}return n&&(this._currNode=r.finally=new Yf,this.code(n)),this._endBlockNode(Xf,Yf)}throw(t){return this._leafNode(new xu(t))}block(t,i){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(i),this}endBlock(t){let i=this._blockStarts.pop();if(i===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-i;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=i,this}func(t,i=ge.nil,n,r){return this._blockNode(new Gf(t,i,n)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(Gf)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,i){let n=this._currNode;if(n instanceof t||i&&n instanceof i)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${i?`${t.kind}/${i.kind}`:t.kind}"`)}_elseNode(t){let i=this._currNode;if(!(i instanceof as))throw new Error('CodeGen: "else" without "if"');return this._currNode=i.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let i=this._nodes;i[i.length-1]=t}};ce.CodeGen=Tu;function Dn(e,t){for(let i in t)e[i]=(e[i]||0)+(t[i]||0);return e}function us(e,t){return t instanceof ge._CodeOrName?Dn(e,t.names):e}function sr(e,t,i){if(e instanceof ge.Name)return n(e);if(!r(e))return e;return new ge._Code(e._items.reduce((o,a)=>(a instanceof ge.Name&&(a=n(a)),a instanceof ge._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=i[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function r(o){return o instanceof ge._Code&&o._items.some(a=>a instanceof ge.Name&&t[a.str]===1&&i[a.str]!==void 0)}}function g2(e,t){for(let i in t)e[i]=(e[i]||0)-(t[i]||0)}function Zf(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,ge._)`!${Pu(e)}`}ce.not=Zf;var y2=Qf(ce.operators.AND);function _2(...e){return e.reduce(y2)}ce.and=_2;var b2=Qf(ce.operators.OR);function v2(...e){return e.reduce(b2)}ce.or=v2;function Qf(e){return(t,i)=>t===ge.nil?i:i===ge.nil?t:(0,ge._)`${Pu(t)} ${e} ${Pu(i)}`}function Pu(e){return e instanceof ge.Name?e:(0,ge._)`(${e})`}});var pe=g(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.checkStrictMode=de.getErrorPath=de.Type=de.useFunc=de.setEvaluated=de.evaluatedPropsToName=de.mergeEvaluated=de.eachItem=de.unescapeJsonPointer=de.escapeJsonPointer=de.escapeFragment=de.unescapeFragment=de.schemaRefOrVal=de.schemaHasRulesButRef=de.schemaHasRules=de.checkUnknownRules=de.alwaysValidSchema=de.toHash=void 0;var Ee=ee(),x2=po();function C2(e){let t={};for(let i of e)t[i]=!0;return t}de.toHash=C2;function w2(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(im(e,t),!nm(t,e.self.RULES.all))}de.alwaysValidSchema=w2;function im(e,t=e.schema){let{opts:i,self:n}=e;if(!i.strictSchema||typeof t=="boolean")return;let r=n.RULES.keywords;for(let o in t)r[o]||am(e,`unknown keyword: "${o}"`)}de.checkUnknownRules=im;function nm(e,t){if(typeof e=="boolean")return!e;for(let i in e)if(t[i])return!0;return!1}de.schemaHasRules=nm;function S2(e,t){if(typeof e=="boolean")return!e;for(let i in e)if(i!=="$ref"&&t.all[i])return!0;return!1}de.schemaHasRulesButRef=S2;function I2({topSchemaRef:e,schemaPath:t},i,n,r){if(!r){if(typeof i=="number"||typeof i=="boolean")return i;if(typeof i=="string")return(0,Ee._)`${i}`}return(0,Ee._)`${e}${t}${(0,Ee.getProperty)(n)}`}de.schemaRefOrVal=I2;function $2(e){return rm(decodeURIComponent(e))}de.unescapeFragment=$2;function E2(e){return encodeURIComponent(ku(e))}de.escapeFragment=E2;function ku(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}de.escapeJsonPointer=ku;function rm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}de.unescapeJsonPointer=rm;function T2(e,t){if(Array.isArray(e))for(let i of e)t(i);else t(e)}de.eachItem=T2;function em({mergeNames:e,mergeToName:t,mergeValues:i,resultToName:n}){return(r,o,a,s)=>{let l=a===void 0?o:a instanceof Ee.Name?(o instanceof Ee.Name?e(r,o,a):t(r,o,a),a):o instanceof Ee.Name?(t(r,a,o),o):i(o,a);return s===Ee.Name&&!(l instanceof Ee.Name)?n(r,l):l}}de.mergeEvaluated={props:em({mergeNames:(e,t,i)=>e.if((0,Ee._)`${i} !== true && ${t} !== undefined`,()=>{e.if((0,Ee._)`${t} === true`,()=>e.assign(i,!0),()=>e.assign(i,(0,Ee._)`${i} || {}`).code((0,Ee._)`Object.assign(${i}, ${t})`))}),mergeToName:(e,t,i)=>e.if((0,Ee._)`${i} !== true`,()=>{t===!0?e.assign(i,!0):(e.assign(i,(0,Ee._)`${i} || {}`),Mu(e,i,t))}),mergeValues:(e,t)=>e===!0?!0:X(X({},e),t),resultToName:om}),items:em({mergeNames:(e,t,i)=>e.if((0,Ee._)`${i} !== true && ${t} !== undefined`,()=>e.assign(i,(0,Ee._)`${t} === true ? true : ${i} > ${t} ? ${i} : ${t}`)),mergeToName:(e,t,i)=>e.if((0,Ee._)`${i} !== true`,()=>e.assign(i,t===!0?!0:(0,Ee._)`${i} > ${t} ? ${i} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function om(e,t){if(t===!0)return e.var("props",!0);let i=e.var("props",(0,Ee._)`{}`);return t!==void 0&&Mu(e,i,t),i}de.evaluatedPropsToName=om;function Mu(e,t,i){Object.keys(i).forEach(n=>e.assign((0,Ee._)`${t}${(0,Ee.getProperty)(n)}`,!0))}de.setEvaluated=Mu;var tm={};function P2(e,t){return e.scopeValue("func",{ref:t,code:tm[t.code]||(tm[t.code]=new x2._Code(t.code))})}de.useFunc=P2;var Ou=function(e){return e[e.Num=0]="Num",e[e.Str=1]="Str",e}(Ou||(de.Type=Ou={}));function O2(e,t,i){if(e instanceof Ee.Name){let n=t===Ou.Num;return i?n?(0,Ee._)`"[" + ${e} + "]"`:(0,Ee._)`"['" + ${e} + "']"`:n?(0,Ee._)`"/" + ${e}`:(0,Ee._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,Ee.getProperty)(e).toString():"/"+ku(e)}de.getErrorPath=O2;function am(e,t,i=e.opts.strictSchema){if(i){if(t=`strict mode: ${t}`,i===!0)throw new Error(t);e.self.logger.warn(t)}}de.checkStrictMode=am});var Jt=g(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});var ft=ee(),k2={data:new ft.Name("data"),valCxt:new ft.Name("valCxt"),instancePath:new ft.Name("instancePath"),parentData:new ft.Name("parentData"),parentDataProperty:new ft.Name("parentDataProperty"),rootData:new ft.Name("rootData"),dynamicAnchors:new ft.Name("dynamicAnchors"),vErrors:new ft.Name("vErrors"),errors:new ft.Name("errors"),this:new ft.Name("this"),self:new ft.Name("self"),scope:new ft.Name("scope"),json:new ft.Name("json"),jsonPos:new ft.Name("jsonPos"),jsonLen:new ft.Name("jsonLen"),jsonPart:new ft.Name("jsonPart")};Du.default=k2});var mo=g(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.extendErrors=mt.resetErrorsCount=mt.reportExtraError=mt.reportError=mt.keyword$DataError=mt.keywordError=void 0;var _e=ee(),ps=pe(),wt=Jt();mt.keywordError={message:({keyword:e})=>(0,_e.str)`must pass "${e}" keyword validation`};mt.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,_e.str)`"${e}" keyword must be ${t} ($data)`:(0,_e.str)`"${e}" keyword is invalid ($data)`};function M2(e,t=mt.keywordError,i,n){let{it:r}=e,{gen:o,compositeRule:a,allErrors:s}=r,l=um(e,t,i);n??(a||s)?sm(o,l):lm(r,(0,_e._)`[${l}]`)}mt.reportError=M2;function D2(e,t=mt.keywordError,i){let{it:n}=e,{gen:r,compositeRule:o,allErrors:a}=n,s=um(e,t,i);sm(r,s),o||a||lm(n,wt.default.vErrors)}mt.reportExtraError=D2;function A2(e,t){e.assign(wt.default.errors,t),e.if((0,_e._)`${wt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,_e._)`${wt.default.vErrors}.length`,t),()=>e.assign(wt.default.vErrors,null)))}mt.resetErrorsCount=A2;function N2({gen:e,keyword:t,schemaValue:i,data:n,errsCount:r,it:o}){if(r===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",r,wt.default.errors,s=>{e.const(a,(0,_e._)`${wt.default.vErrors}[${s}]`),e.if((0,_e._)`${a}.instancePath === undefined`,()=>e.assign((0,_e._)`${a}.instancePath`,(0,_e.strConcat)(wt.default.instancePath,o.errorPath))),e.assign((0,_e._)`${a}.schemaPath`,(0,_e.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,_e._)`${a}.schema`,i),e.assign((0,_e._)`${a}.data`,n))})}mt.extendErrors=N2;function sm(e,t){let i=e.const("err",t);e.if((0,_e._)`${wt.default.vErrors} === null`,()=>e.assign(wt.default.vErrors,(0,_e._)`[${i}]`),(0,_e._)`${wt.default.vErrors}.push(${i})`),e.code((0,_e._)`${wt.default.errors}++`)}function lm(e,t){let{gen:i,validateName:n,schemaEnv:r}=e;r.$async?i.throw((0,_e._)`new ${e.ValidationError}(${t})`):(i.assign((0,_e._)`${n}.errors`,t),i.return(!1))}var An={keyword:new _e.Name("keyword"),schemaPath:new _e.Name("schemaPath"),params:new _e.Name("params"),propertyName:new _e.Name("propertyName"),message:new _e.Name("message"),schema:new _e.Name("schema"),parentSchema:new _e.Name("parentSchema")};function um(e,t,i){let{createErrors:n}=e.it;return n===!1?(0,_e._)`{}`:j2(e,t,i)}function j2(e,t,i={}){let{gen:n,it:r}=e,o=[F2(r,i),q2(e,i)];return V2(e,t,o),n.object(...o)}function F2({errorPath:e},{instancePath:t}){let i=t?(0,_e.str)`${e}${(0,ps.getErrorPath)(t,ps.Type.Str)}`:e;return[wt.default.instancePath,(0,_e.strConcat)(wt.default.instancePath,i)]}function q2({keyword:e,it:{errSchemaPath:t}},{schemaPath:i,parentSchema:n}){let r=n?t:(0,_e.str)`${t}/${e}`;return i&&(r=(0,_e.str)`${r}${(0,ps.getErrorPath)(i,ps.Type.Str)}`),[An.schemaPath,r]}function V2(e,{params:t,message:i},n){let{keyword:r,data:o,schemaValue:a,it:s}=e,{opts:l,propertyName:u,topSchemaRef:c,schemaPath:p}=s;n.push([An.keyword,r],[An.params,typeof t=="function"?t(e):t||(0,_e._)`{}`]),l.messages&&n.push([An.message,typeof i=="function"?i(e):i]),l.verbose&&n.push([An.schema,a],[An.parentSchema,(0,_e._)`${c}${p}`],[wt.default.data,o]),u&&n.push([An.propertyName,u])}});var dm=g(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.boolOrEmptySchema=lr.topBoolOrEmptySchema=void 0;var B2=mo(),R2=ee(),L2=Jt(),U2={message:"boolean schema is false"};function z2(e){let{gen:t,schema:i,validateName:n}=e;i===!1?cm(e,!1):typeof i=="object"&&i.$async===!0?t.return(L2.default.data):(t.assign((0,R2._)`${n}.errors`,null),t.return(!0))}lr.topBoolOrEmptySchema=z2;function H2(e,t){let{gen:i,schema:n}=e;n===!1?(i.var(t,!1),cm(e)):i.var(t,!0)}lr.boolOrEmptySchema=H2;function cm(e,t){let{gen:i,data:n}=e,r={gen:i,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,B2.reportError)(r,U2,void 0,t)}});var Au=g(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.getRules=ur.isJSONType=void 0;var W2=["string","number","integer","boolean","null","object","array"],K2=new Set(W2);function G2(e){return typeof e=="string"&&K2.has(e)}ur.isJSONType=G2;function J2(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:$e(X({},e),{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ur.getRules=J2});var Nu=g(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.shouldUseRule=rn.shouldUseGroup=rn.schemaHasRulesForType=void 0;function X2({schema:e,self:t},i){let n=t.RULES.types[i];return n&&n!==!0&&pm(e,n)}rn.schemaHasRulesForType=X2;function pm(e,t){return t.rules.some(i=>fm(e,i))}rn.shouldUseGroup=pm;function fm(e,t){var i;return e[t.keyword]!==void 0||((i=t.definition.implements)===null||i===void 0?void 0:i.some(n=>e[n]!==void 0))}rn.shouldUseRule=fm});var ho=g(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.reportTypeError=ht.checkDataTypes=ht.checkDataType=ht.coerceAndCheckDataType=ht.getJSONTypes=ht.getSchemaTypes=ht.DataType=void 0;var Y2=Au(),Z2=Nu(),Q2=mo(),ae=ee(),mm=pe(),cr=function(e){return e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong",e}(cr||(ht.DataType=cr={}));function e$(e){let t=hm(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}ht.getSchemaTypes=e$;function hm(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Y2.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ht.getJSONTypes=hm;function t$(e,t){let{gen:i,data:n,opts:r}=e,o=i$(t,r.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,Z2.schemaHasRulesForType)(e,t[0]));if(a){let s=Fu(t,n,r.strictNumbers,cr.Wrong);i.if(s,()=>{o.length?n$(e,t,o):qu(e)})}return a}ht.coerceAndCheckDataType=t$;var gm=new Set(["string","number","integer","boolean","null"]);function i$(e,t){return t?e.filter(i=>gm.has(i)||t==="array"&&i==="array"):[]}function n$(e,t,i){let{gen:n,data:r,opts:o}=e,a=n.let("dataType",(0,ae._)`typeof ${r}`),s=n.let("coerced",(0,ae._)`undefined`);o.coerceTypes==="array"&&n.if((0,ae._)`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>n.assign(r,(0,ae._)`${r}[0]`).assign(a,(0,ae._)`typeof ${r}`).if(Fu(t,r,o.strictNumbers),()=>n.assign(s,r))),n.if((0,ae._)`${s} !== undefined`);for(let u of i)(gm.has(u)||u==="array"&&o.coerceTypes==="array")&&l(u);n.else(),qu(e),n.endIf(),n.if((0,ae._)`${s} !== undefined`,()=>{n.assign(r,s),r$(e,s)});function l(u){switch(u){case"string":n.elseIf((0,ae._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,ae._)`"" + ${r}`).elseIf((0,ae._)`${r} === null`).assign(s,(0,ae._)`""`);return;case"number":n.elseIf((0,ae._)`${a} == "boolean" || ${r} === null
3
3
  || (${a} == "string" && ${r} && ${r} == +${r})`).assign(s,(0,ae._)`+${r}`);return;case"integer":n.elseIf((0,ae._)`${a} === "boolean" || ${r} === null
4
4
  || (${a} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(s,(0,ae._)`+${r}`);return;case"boolean":n.elseIf((0,ae._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(s,!1).elseIf((0,ae._)`${r} === "true" || ${r} === 1`).assign(s,!0);return;case"null":n.elseIf((0,ae._)`${r} === "" || ${r} === 0 || ${r} === false`),n.assign(s,null);return;case"array":n.elseIf((0,ae._)`${a} === "string" || ${a} === "number"