homebridge-config-ui-x 4.78.2-beta.10 → 4.78.2-beta.12

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 (55) hide show
  1. package/CHANGELOG.md +9 -6
  2. package/package.json +3 -3
  3. package/public/assets/hap-icons/speaker.svg +27 -12
  4. package/public/{chunk-ASKYLUSK.js → chunk-274JKR5U.js} +1 -1
  5. package/public/{chunk-7ATQ5EBC.js → chunk-2BFZ7NLM.js} +1 -1
  6. package/public/{chunk-QH4OYVQX.js → chunk-2KCAUEF6.js} +1 -1
  7. package/public/{chunk-HSWLFIAJ.js → chunk-3FXURM4G.js} +1 -1
  8. package/public/{chunk-63UHV4TV.js → chunk-3SIBQXGZ.js} +1 -1
  9. package/public/chunk-4LM57I4F.js +12 -0
  10. package/public/{chunk-3JARG26K.js → chunk-4RQTRD6D.js} +1 -1
  11. package/public/{chunk-5SZ5GQYS.js → chunk-54RPO3UK.js} +1 -1
  12. package/public/{chunk-FR5YDBCN.js → chunk-55XYME2N.js} +1 -1
  13. package/public/{chunk-RN7GNGXO.js → chunk-5VL3QGSU.js} +1 -1
  14. package/public/{chunk-3LKZCKCF.js → chunk-6RWCWAZF.js} +1 -1
  15. package/public/{chunk-Z73Q5KI4.js → chunk-76OGBFRK.js} +1 -1
  16. package/public/{chunk-4T2GN6EO.js → chunk-7CXC32MR.js} +1 -1
  17. package/public/{chunk-VV5VPBPJ.js → chunk-A6UABYXW.js} +1 -1
  18. package/public/chunk-AC3YB6DH.js +4 -0
  19. package/public/{chunk-HYGTZ767.js → chunk-ACMSRWHW.js} +1 -1
  20. package/public/{chunk-KC3UX7RJ.js → chunk-AJJHNQE2.js} +1 -1
  21. package/public/{chunk-TKQG3CQ6.js → chunk-BNG5PCKJ.js} +1 -1
  22. package/public/{chunk-PSCHGWYB.js → chunk-BTQGDQ6T.js} +1 -1
  23. package/public/{chunk-Z565CB6Q.js → chunk-CI2YYTXZ.js} +1 -1
  24. package/public/{chunk-BU6UAZVK.js → chunk-EB6QQWZX.js} +1 -1
  25. package/public/{chunk-KUQKJUX5.js → chunk-FCTNNF3P.js} +1 -1
  26. package/public/{chunk-P2OFHVSW.js → chunk-FDLSZZMN.js} +1 -1
  27. package/public/{chunk-4YRWQX3W.js → chunk-FEOY56WE.js} +1 -1
  28. package/public/{chunk-ROYACDP2.js → chunk-FJRFEXDR.js} +1 -1
  29. package/public/{chunk-HZUGXGIE.js → chunk-FVUUWFZH.js} +1 -1
  30. package/public/{chunk-FHY3NHWQ.js → chunk-FWH72XTL.js} +1 -1
  31. package/public/{chunk-O3KBZXCW.js → chunk-GJOSQXU7.js} +1 -1
  32. package/public/{chunk-UJZFMBAF.js → chunk-H427B4OC.js} +1 -1
  33. package/public/{chunk-HELQ6C4L.js → chunk-H4CGP7QA.js} +1 -1
  34. package/public/{chunk-IDT6WBAB.js → chunk-JGP7TCXI.js} +1 -1
  35. package/public/{chunk-C5RHCAUK.js → chunk-K5ZUWYPN.js} +1 -1
  36. package/public/{chunk-SNKJBIOP.js → chunk-KCWKSDY4.js} +1 -1
  37. package/public/{chunk-EV45AMNT.js → chunk-KSFXQ5ZF.js} +1 -1
  38. package/public/{chunk-OWY3J4XU.js → chunk-MJJQCP6V.js} +1 -1
  39. package/public/{chunk-22QTGFTJ.js → chunk-N4TWOISZ.js} +1 -1
  40. package/public/{chunk-KBSONIC6.js → chunk-P27BJJFG.js} +1 -1
  41. package/public/chunk-RLOI75RN.js +1 -0
  42. package/public/chunk-RY7Y3F6O.js +1 -0
  43. package/public/{chunk-V7XUKJMZ.js → chunk-X5FX5YC3.js} +1 -1
  44. package/public/{chunk-PVP6IVZQ.js → chunk-XB2M7ZIX.js} +1 -1
  45. package/public/{chunk-LVSOME36.js → chunk-XQGWRXMW.js} +1 -1
  46. package/public/{chunk-JFXQKHPO.js → chunk-XXBGB4UE.js} +1 -1
  47. package/public/{chunk-EITS7TXC.js → chunk-ZQ5HFK5X.js} +1 -1
  48. package/public/index.html +2 -2
  49. package/public/main-BDXF5GZF.js +1 -0
  50. package/public/{styles-YDIK2EDN.css → styles-ZKWHTEN5.css} +1 -1
  51. package/public/chunk-45AWUQUI.js +0 -1
  52. package/public/chunk-N4XOTXZL.js +0 -12
  53. package/public/chunk-PY6XYKE2.js +0 -1
  54. package/public/chunk-QTPIIYXJ.js +0 -4
  55. package/public/main-PSKITXQI.js +0 -1
@@ -1 +1 @@
1
- import{b as s}from"./chunk-ASKYLUSK.js";import{d as i}from"./chunk-X7PVYZAE.js";import{k as o}from"./chunk-HZUGXGIE.js";import{a}from"./chunk-LXXELGX4.js";import{ga as e,la as r}from"./chunk-SKZUTSHE.js";var v=(()=>{class t{$auth=r(s);$router=r(i);$translate=r(a);$toastr=r(o);canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=e({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{v as a};
1
+ import{b as s}from"./chunk-274JKR5U.js";import{d as i}from"./chunk-X7PVYZAE.js";import{k as o}from"./chunk-FVUUWFZH.js";import{a}from"./chunk-LXXELGX4.js";import{ga as e,la as r}from"./chunk-SKZUTSHE.js";var v=(()=>{class t{$auth=r(s);$router=r(i);$translate=r(a);$toastr=r(o);canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=e({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{v as a};
@@ -1 +1 @@
1
- import{k as et,n as it}from"./chunk-HZUGXGIE.js";import{a as tt}from"./chunk-LXXELGX4.js";import{l as X}from"./chunk-SRP6QX5M.js";import{T as G,e as ut,g as ct,ga as R,h as P,la as Y,n as Q,w as N}from"./chunk-SKZUTSHE.js";var nt=ut((J,Z)=>{(function(y,D){typeof J=="object"&&typeof Z<"u"?Z.exports=D():typeof define=="function"&&define.amd?define(D):(y=typeof globalThis<"u"?globalThis:y||self).dayjs=D()})(J,function(){"use strict";var y=1e3,D=6e4,s=36e5,h="millisecond",d="second",p="minute",M="hour",S="day",I="week",w="month",z="quarter",b="year",_="date",K="Invalid Date",st=/^(\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])+"]"}},F=function(r,i,t){var n=String(r);return!n||n.length>=i?r:""+Array(i+1-n.length).join(t)+r},ot={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),n=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(n,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var n=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(n,w),a=t-e<0,o=i.clone().add(n+(a?-1:1),w);return+(-(n+(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:w,y:b,w:I,d:S,D:_,h:M,m:p,s:d,ms:h,Q:z}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},x="en",T={};T[x]=at;var B="$isDayjsObject",U=function(r){return r instanceof W||!(!r||!r[B])},V=function r(i,t,n){var e;if(!i)return x;if(typeof i=="string"){var a=i.toLowerCase();T[a]&&(e=a),t&&(T[a]=t,e=a);var o=i.split("-");if(!e&&o.length>1)return r(o[0])}else{var c=i.name;T[c]=i,e=c}return!n&&e&&(x=e),e||!n&&x},l=function(r,i){if(U(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new W(t)},u=ot;u.l=V,u.i=U,u.w=function(r,i){return l(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var W=function(){function r(t){this.$L=V(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[B]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(n){var e=n.date,a=n.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(st);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()!==K},i.isSame=function(t,n){var e=l(t);return this.startOf(n)<=e&&e<=this.endOf(n)},i.isAfter=function(t,n){return l(t)<this.startOf(n)},i.isBefore=function(t,n){return this.endOf(n)<l(t)},i.$g=function(t,n,e){return u.u(t)?this[n]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,n){var e=this,a=!!u.u(n)||n,o=u.p(t),c=function(O,$){var L=u.w(e.$u?Date.UTC(e.$y,$,O):new Date(e.$y,$,O),e);return a?L:L.endOf(S)},f=function(O,$){return u.w(e.toDate()[O].apply(e.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice($)),e)},m=this.$W,g=this.$M,v=this.$D,j="set"+(this.$u?"UTC":"");switch(o){case b:return a?c(1,0):c(31,11);case w:return a?c(1,g):c(0,g+1);case I:var k=this.$locale().weekStart||0,A=(m<k?m+7:m)-k;return c(a?v-A:v+(6-A),g);case S:case _:return f(j+"Hours",0);case M:return f(j+"Minutes",1);case p: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,n){var e,a=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[S]=o+"Date",e[_]=o+"Date",e[w]=o+"Month",e[b]=o+"FullYear",e[M]=o+"Hours",e[p]=o+"Minutes",e[d]=o+"Seconds",e[h]=o+"Milliseconds",e)[a],f=a===S?this.$D+(n-this.$W):n;if(a===w||a===b){var m=this.clone().set(_,1);m.$d[c](f),m.init(),this.$d=m.set(_,Math.min(this.$D,m.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},i.set=function(t,n){return this.clone().$set(t,n)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,n){var e,a=this;t=Number(t);var o=u.p(n),c=function(g){var v=l(a);return u.w(v.date(v.date()+Math.round(g*t)),a)};if(o===w)return this.set(w,this.$M+t);if(o===b)return this.set(b,this.$y+t);if(o===S)return c(1);if(o===I)return c(7);var f=(e={},e[p]=D,e[M]=s,e[d]=y,e)[o]||1,m=this.$d.getTime()+t*f;return u.w(m,this)},i.subtract=function(t,n){return this.add(-1*t,n)},i.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||K;var a=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,f=this.$m,m=this.$M,g=e.weekdays,v=e.months,j=e.meridiem,k=function($,L,H,C){return $&&($[L]||$(n,a))||H[L].slice(0,C)},A=function($){return u.s(c%12||12,$,"0")},O=j||function($,L,H){var C=$<12?"AM":"PM";return H?C.toLowerCase():C};return a.replace(rt,function($,L){return L||function(H){switch(H){case"YY":return String(n.$y).slice(-2);case"YYYY":return u.s(n.$y,4,"0");case"M":return m+1;case"MM":return u.s(m+1,2,"0");case"MMM":return k(e.monthsShort,m,v,3);case"MMMM":return k(v,m);case"D":return n.$D;case"DD":return u.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return k(e.weekdaysMin,n.$W,g,2);case"ddd":return k(e.weekdaysShort,n.$W,g,3);case"dddd":return g[n.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return A(1);case"hh":return A(2);case"a":return O(c,f,!0);case"A":return O(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(n.$s);case"ss":return u.s(n.$s,2,"0");case"SSS":return u.s(n.$ms,3,"0");case"Z":return o}return null}($)||o.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,n,e){var a,o=this,c=u.p(n),f=l(t),m=(f.utcOffset()-this.utcOffset())*D,g=this-f,v=function(){return u.m(o,f)};switch(c){case b:a=v()/12;break;case w:a=v();break;case z:a=v()/3;break;case I:a=(g-m)/6048e5;break;case S:a=(g-m)/864e5;break;case M:a=g/s;break;case p:a=g/D;break;case d:a=g/y;break;default:a=g}return e?a:u.a(a)},i.daysInMonth=function(){return this.endOf(w).$D},i.$locale=function(){return T[this.$L]},i.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),a=V(t,n,!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}(),E=W.prototype;return l.prototype=E,[["$ms",h],["$s",d],["$m",p],["$H",M],["$W",S],["$M",w],["$y",b],["$D",_]].forEach(function(r){E[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),l.extend=function(r,i){return r.$i||(r(i,W,l),r.$i=!0),l},l.locale=V,l.isDayjs=U,l.unix=function(r){return l(1e3*r)},l.en=T[x],l.Ls=T,l.p={},l})});var q=ct(nt(),1);var vt=(()=>{class y{$api=Y(it);$title=Y(X);$toastr=Y(et);$translate=Y(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;wallpaper;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 P(this,null,function*(){let s=yield N(this.$api.get("/auth/settings"));this.formAuth=s.formAuth,this.sessionTimeout=s.sessionTimeout,this.env=s.env,this.lightingMode=s.lightingMode,this.wallpaper=s.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(s.theme),this.setMenuMode(s.menuMode),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(s.serverTimestamp),this.setUiVersion(s.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(s){this.browserLightingMode=s,this.lightingMode==="auto"&&this.setLightingMode(s,"browser")}setLightingMode(s,h){h==="user"&&(this.lightingMode=s),this.currentLightingMode=s,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(s){(!s||!this.themeList.includes(s))&&(s=this.defaultTheme,N(this.$api.put("/config-editor/ui",{key:"theme",value:s})).catch(d=>console.error(d)));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=s,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"))}setMenuMode(s){this.menuMode=s}setLang(s){s?this.$translate.use(s):s="auto",this.env.lang=s}setItem(s,h){this[s]=h}setEnvItem(s,h){if(s.includes(".")){let d=s.split("."),p=this.env;for(let M=0;M<d.length-1;M++){if(this.forbiddenKeys.includes(d[M]))return;p[d[M]]||(p[d[M]]={}),p=p[d[M]]}this.forbiddenKeys.includes(d[d.length-1])||(p[d[d.length-1]]=h)}else this.env[s]=h}checkServerTime(s){let d=(0,q.default)(s).diff((0,q.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(s){this.uiVersion||(this.uiVersion=s)}setTitle(s){this.$title.setTitle(s||"Homebridge")}static \u0275fac=function(h){return new(h||y)};static \u0275prov=R({token:y,factory:y.\u0275fac,providedIn:"root"})}return y})();export{nt as a,vt as b};
1
+ import{k as et,n as it}from"./chunk-FVUUWFZH.js";import{a as tt}from"./chunk-LXXELGX4.js";import{l as X}from"./chunk-SRP6QX5M.js";import{T as G,e as ut,g as ct,ga as R,h as P,la as Y,n as Q,w as N}from"./chunk-SKZUTSHE.js";var nt=ut((J,Z)=>{(function(y,D){typeof J=="object"&&typeof Z<"u"?Z.exports=D():typeof define=="function"&&define.amd?define(D):(y=typeof globalThis<"u"?globalThis:y||self).dayjs=D()})(J,function(){"use strict";var y=1e3,D=6e4,s=36e5,h="millisecond",d="second",p="minute",M="hour",S="day",I="week",w="month",z="quarter",b="year",_="date",K="Invalid Date",st=/^(\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])+"]"}},F=function(r,i,t){var n=String(r);return!n||n.length>=i?r:""+Array(i+1-n.length).join(t)+r},ot={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),n=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(n,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var n=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(n,w),a=t-e<0,o=i.clone().add(n+(a?-1:1),w);return+(-(n+(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:w,y:b,w:I,d:S,D:_,h:M,m:p,s:d,ms:h,Q:z}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},x="en",T={};T[x]=at;var B="$isDayjsObject",U=function(r){return r instanceof W||!(!r||!r[B])},V=function r(i,t,n){var e;if(!i)return x;if(typeof i=="string"){var a=i.toLowerCase();T[a]&&(e=a),t&&(T[a]=t,e=a);var o=i.split("-");if(!e&&o.length>1)return r(o[0])}else{var c=i.name;T[c]=i,e=c}return!n&&e&&(x=e),e||!n&&x},l=function(r,i){if(U(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new W(t)},u=ot;u.l=V,u.i=U,u.w=function(r,i){return l(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var W=function(){function r(t){this.$L=V(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[B]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(n){var e=n.date,a=n.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(st);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()!==K},i.isSame=function(t,n){var e=l(t);return this.startOf(n)<=e&&e<=this.endOf(n)},i.isAfter=function(t,n){return l(t)<this.startOf(n)},i.isBefore=function(t,n){return this.endOf(n)<l(t)},i.$g=function(t,n,e){return u.u(t)?this[n]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,n){var e=this,a=!!u.u(n)||n,o=u.p(t),c=function(O,$){var L=u.w(e.$u?Date.UTC(e.$y,$,O):new Date(e.$y,$,O),e);return a?L:L.endOf(S)},f=function(O,$){return u.w(e.toDate()[O].apply(e.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice($)),e)},m=this.$W,g=this.$M,v=this.$D,j="set"+(this.$u?"UTC":"");switch(o){case b:return a?c(1,0):c(31,11);case w:return a?c(1,g):c(0,g+1);case I:var k=this.$locale().weekStart||0,A=(m<k?m+7:m)-k;return c(a?v-A:v+(6-A),g);case S:case _:return f(j+"Hours",0);case M:return f(j+"Minutes",1);case p: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,n){var e,a=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[S]=o+"Date",e[_]=o+"Date",e[w]=o+"Month",e[b]=o+"FullYear",e[M]=o+"Hours",e[p]=o+"Minutes",e[d]=o+"Seconds",e[h]=o+"Milliseconds",e)[a],f=a===S?this.$D+(n-this.$W):n;if(a===w||a===b){var m=this.clone().set(_,1);m.$d[c](f),m.init(),this.$d=m.set(_,Math.min(this.$D,m.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},i.set=function(t,n){return this.clone().$set(t,n)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,n){var e,a=this;t=Number(t);var o=u.p(n),c=function(g){var v=l(a);return u.w(v.date(v.date()+Math.round(g*t)),a)};if(o===w)return this.set(w,this.$M+t);if(o===b)return this.set(b,this.$y+t);if(o===S)return c(1);if(o===I)return c(7);var f=(e={},e[p]=D,e[M]=s,e[d]=y,e)[o]||1,m=this.$d.getTime()+t*f;return u.w(m,this)},i.subtract=function(t,n){return this.add(-1*t,n)},i.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||K;var a=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,f=this.$m,m=this.$M,g=e.weekdays,v=e.months,j=e.meridiem,k=function($,L,H,C){return $&&($[L]||$(n,a))||H[L].slice(0,C)},A=function($){return u.s(c%12||12,$,"0")},O=j||function($,L,H){var C=$<12?"AM":"PM";return H?C.toLowerCase():C};return a.replace(rt,function($,L){return L||function(H){switch(H){case"YY":return String(n.$y).slice(-2);case"YYYY":return u.s(n.$y,4,"0");case"M":return m+1;case"MM":return u.s(m+1,2,"0");case"MMM":return k(e.monthsShort,m,v,3);case"MMMM":return k(v,m);case"D":return n.$D;case"DD":return u.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return k(e.weekdaysMin,n.$W,g,2);case"ddd":return k(e.weekdaysShort,n.$W,g,3);case"dddd":return g[n.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return A(1);case"hh":return A(2);case"a":return O(c,f,!0);case"A":return O(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(n.$s);case"ss":return u.s(n.$s,2,"0");case"SSS":return u.s(n.$ms,3,"0");case"Z":return o}return null}($)||o.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,n,e){var a,o=this,c=u.p(n),f=l(t),m=(f.utcOffset()-this.utcOffset())*D,g=this-f,v=function(){return u.m(o,f)};switch(c){case b:a=v()/12;break;case w:a=v();break;case z:a=v()/3;break;case I:a=(g-m)/6048e5;break;case S:a=(g-m)/864e5;break;case M:a=g/s;break;case p:a=g/D;break;case d:a=g/y;break;default:a=g}return e?a:u.a(a)},i.daysInMonth=function(){return this.endOf(w).$D},i.$locale=function(){return T[this.$L]},i.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),a=V(t,n,!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}(),E=W.prototype;return l.prototype=E,[["$ms",h],["$s",d],["$m",p],["$H",M],["$W",S],["$M",w],["$y",b],["$D",_]].forEach(function(r){E[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),l.extend=function(r,i){return r.$i||(r(i,W,l),r.$i=!0),l},l.locale=V,l.isDayjs=U,l.unix=function(r){return l(1e3*r)},l.en=T[x],l.Ls=T,l.p={},l})});var q=ct(nt(),1);var vt=(()=>{class y{$api=Y(it);$title=Y(X);$toastr=Y(et);$translate=Y(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;wallpaper;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 P(this,null,function*(){let s=yield N(this.$api.get("/auth/settings"));this.formAuth=s.formAuth,this.sessionTimeout=s.sessionTimeout,this.env=s.env,this.lightingMode=s.lightingMode,this.wallpaper=s.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(s.theme),this.setMenuMode(s.menuMode),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(s.serverTimestamp),this.setUiVersion(s.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(s){this.browserLightingMode=s,this.lightingMode==="auto"&&this.setLightingMode(s,"browser")}setLightingMode(s,h){h==="user"&&(this.lightingMode=s),this.currentLightingMode=s,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(s){(!s||!this.themeList.includes(s))&&(s=this.defaultTheme,N(this.$api.put("/config-editor/ui",{key:"theme",value:s})).catch(d=>console.error(d)));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=s,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"))}setMenuMode(s){this.menuMode=s}setLang(s){s?this.$translate.use(s):s="auto",this.env.lang=s}setItem(s,h){this[s]=h}setEnvItem(s,h){if(s.includes(".")){let d=s.split("."),p=this.env;for(let M=0;M<d.length-1;M++){if(this.forbiddenKeys.includes(d[M]))return;p[d[M]]||(p[d[M]]={}),p=p[d[M]]}this.forbiddenKeys.includes(d[d.length-1])||(p[d[d.length-1]]=h)}else this.env[s]=h}checkServerTime(s){let d=(0,q.default)(s).diff((0,q.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(s){this.uiVersion||(this.uiVersion=s)}setTitle(s){this.$title.setTitle(s||"Homebridge")}static \u0275fac=function(h){return new(h||y)};static \u0275prov=R({token:y,factory:y.\u0275fac,providedIn:"root"})}return y})();export{nt as a,vt as b};
@@ -1 +1 @@
1
- import{k as h,n as w}from"./chunk-HZUGXGIE.js";import{a as v,b as _}from"./chunk-LXXELGX4.js";import"./chunk-SRP6QX5M.js";import{Bc as s,Cc as m,Ib as c,Jb as x,Pb as i,Qb as e,Rb as f,Zb as u,ab as n,kc as o,la as p,lc as a,mb as d}from"./chunk-SKZUTSHE.js";function C(t,S){if(t&1&&(i(0,"div",7),o(1),e()),t&2){let r=u();n(),a(r.error)}}function g(t,S){t&1&&(i(0,"p",8),o(1),s(2,"translate"),e()),t&2&&(n(),a(m(2,1,"platform.linux.server_will_power_down")))}var B=(()=>{class t{$api=p(w);$toastr=p(h);$translate=p(v);error=!1;ngOnInit(){this.$api.put("/platform-tools/linux/shutdown-host",{}).subscribe({error:r=>{console.error(r),this.error=this.$translate.instant("platform.linux.server_restart_error"),this.$toastr.error(this.$translate.instant("platform.linux.server_restart_error"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(l){return new(l||t)};static \u0275cmp=d({type:t,selectors:[["ng-component"]],decls:13,vars:7,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"grey-text"]],template:function(l,y){l&1&&(i(0,"div",0)(1,"h3",1),o(2),s(3,"translate"),e()(),i(4,"div",2)(5,"div",3),f(6,"i",4),e(),i(7,"div",5)(8,"h4",6),o(9),s(10,"translate"),e(),c(11,C,2,1,"div",7)(12,g,3,3,"p",8),e()()),l&2&&(n(2),a(m(3,3,"menu.restart.title")),n(7),a(m(10,5,"platform.linux.shutting_down_server")),n(2),x(y.error?11:12))},dependencies:[_],encapsulation:2})}return t})();export{B as ShutdownLinuxComponent};
1
+ import{k as h,n as w}from"./chunk-FVUUWFZH.js";import{a as v,b as _}from"./chunk-LXXELGX4.js";import"./chunk-SRP6QX5M.js";import{Bc as s,Cc as m,Ib as c,Jb as x,Pb as i,Qb as e,Rb as f,Zb as u,ab as n,kc as o,la as p,lc as a,mb as d}from"./chunk-SKZUTSHE.js";function C(t,S){if(t&1&&(i(0,"div",7),o(1),e()),t&2){let r=u();n(),a(r.error)}}function g(t,S){t&1&&(i(0,"p",8),o(1),s(2,"translate"),e()),t&2&&(n(),a(m(2,1,"platform.linux.server_will_power_down")))}var B=(()=>{class t{$api=p(w);$toastr=p(h);$translate=p(v);error=!1;ngOnInit(){this.$api.put("/platform-tools/linux/shutdown-host",{}).subscribe({error:r=>{console.error(r),this.error=this.$translate.instant("platform.linux.server_restart_error"),this.$toastr.error(this.$translate.instant("platform.linux.server_restart_error"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(l){return new(l||t)};static \u0275cmp=d({type:t,selectors:[["ng-component"]],decls:13,vars:7,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"grey-text"]],template:function(l,y){l&1&&(i(0,"div",0)(1,"h3",1),o(2),s(3,"translate"),e()(),i(4,"div",2)(5,"div",3),f(6,"i",4),e(),i(7,"div",5)(8,"h4",6),o(9),s(10,"translate"),e(),c(11,C,2,1,"div",7)(12,g,3,3,"p",8),e()()),l&2&&(n(2),a(m(3,3,"menu.restart.title")),n(7),a(m(10,5,"platform.linux.shutting_down_server")),n(2),x(y.error?11:12))},dependencies:[_],encapsulation:2})}return t})();export{B as ShutdownLinuxComponent};
@@ -1 +1 @@
1
- import{a as Se}from"./chunk-F3ERQJVG.js";import{l as ke,n as Q}from"./chunk-IDT6WBAB.js";import{a as H}from"./chunk-UQYCFN3T.js";import"./chunk-GDFV4BMO.js";import{a as Be}from"./chunk-NGNQPAAK.js";import"./chunk-QDCKP2LU.js";import"./chunk-63UHV4TV.js";import"./chunk-UD6SVFW2.js";import"./chunk-7EQ4BJZB.js";import"./chunk-EGCUYKRH.js";import{a as ye}from"./chunk-TQNKRJOX.js";import{g as _e,h as Ce,i as he,j as be,k as ve,l as xe,m as $,n as O,t as U}from"./chunk-CF2ZN7LY.js";import{A as fe,c as le,e as re,f as se,g as de,j as pe,m as ce,p as ue,q as me,z as ge}from"./chunk-T252YJXA.js";import{a as W}from"./chunk-ROYACDP2.js";import"./chunk-ASKYLUSK.js";import{a as we,d as Pe}from"./chunk-X7PVYZAE.js";import{b as G}from"./chunk-BU6UAZVK.js";import{k as R,n as L}from"./chunk-HZUGXGIE.js";import{a as q,b as B}from"./chunk-LXXELGX4.js";import"./chunk-SRP6QX5M.js";import{Bc as r,Cc as s,Dc as E,Hb as y,Ib as m,Jb as g,Lb as j,Mb as F,Nb as z,Ob as C,Pb as a,Qb as l,Rb as d,Vb as w,Xa as N,Ya as T,Yb as _,Za as Z,Zb as f,ab as n,bc as ee,cc as ie,cd as M,dc as te,fd as ae,h as k,jc as J,jd as oe,kc as c,la as P,lc as h,mb as S,mc as b,ra as v,sa as x,uc as K,w as D,xc as V,yc as I,zc as ne}from"./chunk-SKZUTSHE.js";var Ne=t=>({pluginName:t});function He(t,p){t&1&&(a(0,"ul",7)(1,"li"),c(2),r(3,"translate"),l(),a(4,"li"),c(5),r(6,"translate"),l()()),t&2&&(n(2),h(s(3,2,"plugins.manage.confirm_disable_accessory_1")),n(3),h(s(6,4,"plugins.manage.confirm_disable_accessory_2")))}function Ae(t,p){t&1&&(a(0,"ul",7)(1,"li"),c(2),r(3,"translate"),l(),a(4,"li"),c(5),r(6,"translate"),l()()),t&2&&(n(2),h(s(3,2,"plugins.manage.confirm_disable_platform_1")),n(3),h(s(6,4,"plugins.manage.confirm_disable_platform_2")))}var Ie=(()=>{class t{$activeModal=P($);pluginName;isConfigured=!1;isConfiguredDynamicPlatform=!1;dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close()}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],inputs:{pluginName:"pluginName",isConfigured:"isConfigured",isConfiguredDynamicPlatform:"isConfiguredDynamicPlatform"},decls:26,vars:22,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,"mb-3","text-center"],[1,"fas","fa-fw","fa-circle-pause","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","warning",1,"mb-0",3,"dismissible"],[1,"w-100","text-center","mb-0"],[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"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),c(3),l(),a(4,"button",3),r(5,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(6,"div",4)(7,"div",5),d(8,"i",6),l(),m(9,He,7,6,"ul",7),m(10,Ae,7,6,"ul",7),a(11,"ngb-alert",8)(12,"p",9),c(13),r(14,"translate"),l()()(),a(15,"div",10)(16,"div",11)(17,"button",12),r(18,"translate"),_("click",function(){return i.dismissModal()}),c(19),r(20,"translate"),l()(),d(21,"div",13),a(22,"div",14)(23,"button",15),_("click",function(){return i.closeModal()}),c(24),r(25,"translate"),l()()()()),o&2&&(n(3),h(i.pluginName),n(),y("aria-label",s(5,9,"form.button_close")),n(5),g(i.isConfigured&&!i.isConfiguredDynamicPlatform?9:-1),n(),g(i.isConfigured&&i.isConfiguredDynamicPlatform?10:-1),n(),C("dismissible",!1),n(2),h(E(14,11,"plugins.manage.confirm_disable",V(20,Ne,i.pluginName))),n(4),y("aria-label",s(18,14,"form.button_close")),n(2),b(" ",s(20,16,"form.button_close")," "),n(5),b(" ",s(25,18,"plugins.manage.disable")," "))},dependencies:[_e,B],encapsulation:2})}return t})();var je=t=>({author:t});function Fe(t,p){if(t&1&&(a(0,"li",9),d(1,"i",15),a(2,"a",16),c(3),l()()),t&2){let e=p.$implicit,o=f();n(),C("ngClass",o.getIconClass(e.type)),n(),C("href",e.url,T),n(),h(e.url)}}var Te=(()=>{class t{$activeModal=P($);plugin;fundingOptions;ngOnInit(){this.plugin.funding||this.$activeModal.close(),this.plugin.name==="homebridge-config-ui-x"&&(this.plugin.author="oznu"),Array.isArray(this.plugin.funding)?this.fundingOptions=this.plugin.funding.map(e=>{if(typeof e=="string")return{type:"other",url:e};if(typeof e=="object")return{type:e.type||"other",url:e.url}}):typeof this.plugin.funding=="string"?this.fundingOptions=[{type:"other",url:this.plugin.funding}]:typeof this.plugin.funding=="object"&&(this.fundingOptions=[{type:this.plugin.funding.type||"other",url:this.plugin.funding.url}])}getIconClass(e){switch(e.toLowerCase()){case"paypal":return"fab fa-fw fa-paypal";case"github":return"fab fa-fw fa-github";case"patreon":return"fab fa-fw fa-patreon";case"kofi":case"ko-fi":return"fas fa-fw fa-coffee";default:return"fas fa-fw fa-link"}}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:28,vars:21,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","pink-text","mb-3"],[1,"fas","fa-fw","fa-heart",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box"],[1,"list-group-item"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"],[1,"me-2","primary-text","fa-fw","fa-xl",3,"ngClass"],["target","_blank","rel","noopener noreferrer",1,"text-break-all",3,"href"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),c(3),r(4,"translate"),l(),a(5,"button",3),r(6,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(7,"div",4)(8,"div",5),d(9,"i",6),l(),a(10,"ul",7)(11,"li"),c(12),r(13,"translate"),l(),a(14,"li"),c(15),r(16,"translate"),l()(),a(17,"ul",8),F(18,Fe,4,3,"li",9,j),l()(),a(20,"div",10),d(21,"div",11),a(22,"div",12)(23,"button",13),r(24,"translate"),_("click",function(){return i.dismissModal()}),c(25),r(26,"translate"),l()(),d(27,"div",14),l()()),o&2&&(n(3),h(E(4,6,"plugins.donate.tile_donate_to",V(19,je,"@"+i.plugin.author))),n(2),y("aria-label",s(6,9,"form.button_close")),n(7),h(s(13,11,"plugins.donate.message_1")),n(3),h(s(16,13,"plugins.donate.message_2")),n(3),z(i.fundingOptions),n(5),y("aria-label",s(24,15,"form.button_close")),n(2),b(" ",s(26,17,"form.button_close")," "))},dependencies:[M,B],styles:[".text-break-all[_ngcontent-%COMP%]{word-break:break-all}"]})}return t})();var ze=(t,p)=>({"orange-text":t,"grey-text":p}),X=t=>({opacity:t}),Oe=(t,p)=>({"green-text":t,"grey-text":p}),Ue=(t,p)=>({"purple-text":t,"grey-text":p}),qe=(t,p)=>({scopedLink:t,verifiedLink:p});function Re(t,p){t&1&&(a(0,"h6",18),c(1),r(2,"translate"),l(),a(3,"p",19),c(4),r(5,"translate"),l(),a(6,"p",19),c(7),r(8,"translate"),l()),t&2&&(n(),h(s(2,3,"plugins.manage.scoped_subtitle")),n(3),h(s(5,5,"plugins.manage.scoped_message")),n(3),h(s(8,7,"plugins.manage.verified_message")))}function Le(t,p){t&1&&(a(0,"h6",18),c(1),r(2,"translate"),l(),a(3,"p",19),c(4),r(5,"translate"),l()),t&2&&(n(),h(s(2,2,"plugins.manage.verified_subtitle")),n(3),h(s(5,4,"plugins.manage.verified_message")))}function Ge(t,p){t&1&&(a(0,"h6",18),c(1),r(2,"translate"),l(),a(3,"p",19),c(4),r(5,"translate"),l()),t&2&&(n(),h(s(2,2,"plugins.manage.unverified_subtitle")),n(3),h(s(5,4,"plugins.manage.unverified_message")))}function We(t,p){if(t&1){let e=w();a(0,"button",20),_("click",function(){v(e);let i=f();return x(i.dismissModal())}),c(1),r(2,"translate"),l()}t&2&&(n(),b(" ",s(2,1,"form.button_close")," "))}function Qe(t,p){if(t&1){let e=w();a(0,"button",20),_("click",function(){v(e);let i=f();return x(i.dismissModal())}),c(1),r(2,"translate"),l()}t&2&&(n(),b(" ",s(2,1,"form.button_close")," "))}function Je(t,p){if(t&1&&(a(0,"a",17),c(1),r(2,"translate"),d(3,"i",21),l()),t&2){let e=f();C("href",e.plugin.links.homepage||e.plugin.links.npm,T),n(),b(" ",s(2,2,"plugins.button_homepage")," ")}}var Ve=(()=>{class t{$activeModal=P($);plugin;defaultIcon="assets/hb-icon.png";linkScoped='<a href="https://github.com/homebridge/plugins/wiki/Scoped-Plugins" target="_blank"><i class="fas fa-fw fa-external-link-alt primary-text"></i></a>';linkVerified='<a href="https://github.com/homebridge/plugins/wiki/Verified-Plugins" target="_blank"><i class="fas fa-fw fa-external-link-alt primary-text"></i></a>';ngOnInit(){this.plugin.icon||(this.plugin.icon=this.defaultIcon)}handleIconError(){this.plugin.icon=this.defaultIcon}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:32,vars:45,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","text-center"],["alt","Plugin Icon",1,"mb-3","plugin-icon-card",3,"error","src"],[1,"mb-1"],[1,"grey-text","mb-0","font-monospace"],[1,"grey-text","mb-1","font-monospace"],[1,"mb-3"],[1,"fas","fa-fw","fa-shield-alt","mb-3",2,"font-size","48px",3,"ngClass","ngStyle"],[1,"mb-0","grey-text",3,"innerHTML"],[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"],["target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","text-decoration-none",3,"href"],[1,"mb-2"],[1,"mb-1","grey-text"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"fas","fa-fw","fa-external-link-alt"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),c(3),r(4,"translate"),l(),a(5,"button",3),r(6,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(7,"div",4)(8,"img",5),_("error",function(){return i.handleIconError()}),l(),a(9,"h4",6),c(10),l(),a(11,"p",7),c(12),l(),a(13,"p",8),c(14),l(),a(15,"p",9),c(16),l(),d(17,"i",10)(18,"i",10)(19,"i",10),m(20,Re,9,9),m(21,Le,6,6),m(22,Ge,6,6),d(23,"p",11),r(24,"translate"),l(),a(25,"div",12)(26,"div",13),m(27,We,3,3,"button",14),l(),a(28,"div",15),m(29,Qe,3,3,"button",14),l(),a(30,"div",16),m(31,Je,4,4,"a",17),l()()()),o&2&&(n(3),h(s(4,20,"plugins.manage.information")),n(2),y("aria-label",s(6,22,"form.button_close")),n(3),C("src",i.plugin.icon,T),n(2),h(i.plugin.displayName),n(2),h(i.plugin.name),n(2),b("@",i.plugin.author),n(2),h(i.plugin.description),n(),C("ngClass",I(27,ze,!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin,i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin))("ngStyle",V(30,X,!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin?1:.25)),n(),C("ngClass",I(32,Oe,!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin),i.plugin.isHbScoped||!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin))("ngStyle",V(35,X,!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)?1:.25)),n(),C("ngClass",I(37,Ue,i.plugin.isHbScoped,!i.plugin.isHbScoped))("ngStyle",V(40,X,i.plugin.isHbScoped?1:.25)),n(),g(i.plugin.isHbScoped?20:-1),n(),g(!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)?21:-1),n(),g(!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin?22:-1),n(),C("innerHTML",E(24,24,"plugins.manage.more_info",I(42,qe,i.linkScoped,i.linkVerified)),N),n(4),g(i.plugin.links.homepage||i.plugin.links.npm?27:-1),n(2),g(!i.plugin.links.homepage&&!i.plugin.links.npm?29:-1),n(2),g(i.plugin.links.homepage||i.plugin.links.npm?31:-1))},dependencies:[B,M,ae],styles:[".plugin-icon[_ngcontent-%COMP%]{height:75px;width:75px;border-radius:15px;border:1px solid #222222}"]})}return t})();var Ke=(t,p,e)=>({"purple-text":t,"green-text":p,"orange-text":e}),Xe=(t,p)=>({"fa-bridge-circle-exclamation orange-text":t,"fa-bridge-circle-xmark red-text":p});function Ye(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.checkAndUpdatePlugin())}),d(3,"i",24),l()}t&2&&(C("ngbTooltip",s(1,2,"plugins.button_update")),y("aria-label",s(2,4,"plugins.button_update")))}function Ze(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.switchToScoped())}),d(3,"i",25),l()}t&2&&(C("ngbTooltip",s(1,2,"plugins.manage.scoped.switch")),y("aria-label",s(2,4,"plugins.manage.scoped.switch")))}function ei(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.openSettings())}),d(3,"i",26),l()}t&2&&(C("ngbTooltip",s(1,2,"plugins.button_set_up")),y("aria-label",s(2,4,"plugins.button_set_up")))}function ii(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.openBridgeSettings())}),d(3,"i",27),l()}t&2&&(C("ngbTooltip",s(1,2,"child_bridge.setup")),y("aria-label",s(2,4,"child_bridge.setup")))}function ti(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.openBridgeSettings())}),d(3,"i",28),l()}t&2&&(C("ngbTooltip",s(1,2,"child_bridge.bridge_connect")),y("aria-label",s(2,4,"child_bridge.bridge_connect")))}function ni(t,p){if(t&1&&d(0,"i",12),t&2){let e=f();C("ngClass",I(1,Xe,e.childBridgeStatus==="pending",e.childBridgeStatus==="down"))}}function ai(t,p){if(t&1){let e=w();a(0,"a",14),_("click",function(){v(e);let i=f();return x(i.openFundingModal(i.plugin))}),d(1,"i",29),a(2,"span",16),c(3),l()()}if(t&2){let e=f();n(3),b("@",e.plugin.author)}}function oi(t,p){if(t&1&&(a(0,"span",16),d(1,"i",30),c(2),l()),t&2){let e=f();n(2),b("@",e.plugin.author," ")}}function li(t,p){if(t&1&&(a(0,"span"),c(1),r(2,"date"),l()),t&2){let e=f(2);n(),b("(",E(2,1,e.plugin.lastUpdated,"yyyy-MM-dd"),")")}}function ri(t,p){if(t&1&&(a(0,"span"),d(1,"i",31),a(2,"span",16),c(3),m(4,li,3,4,"span"),l()()),t&2){let e=f();n(3),b("v",e.plugin.latestVersion," "),n(),g(e.plugin.lastUpdated?4:-1)}}function si(t,p){if(t&1&&(d(0,"i",32),c(1)),t&2){let e=f();n(),b("v",e.plugin.installedVersion," ")}}function di(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),_("click",function(){v(e);let i=f();return x(i.doChildBridgeAction("restart"))}),d(2,"i",33),l()}if(t&2){let e=f();C("ngbTooltip",s(1,1,e.setChildBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart"))}}function pi(t,p){if(t&1){let e=w();a(0,"a",34),_("click",function(){v(e);let i=f();return x(i.enablePlugin(i.plugin))}),d(1,"i",35),r(2,"translate"),l()}t&2&&(n(),C("ngbTooltip",s(2,1,"plugins.status_disabled")))}function ci(t,p){if(t&1){let e=w();a(0,"a",36),_("click",function(){v(e);let i=f();return x(i.installAlternateVersion())}),d(1,"i",37),l()}}function ui(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.viewPluginLog())}),d(1,"i",46),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.plugin_logs")," "))}function mi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.installAlternateVersion())}),d(1,"i",47),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.manage_version")," "))}function gi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openJsonEditor())}),d(1,"i",48),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.json_config")," "))}function fi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.disablePlugin(i.plugin))}),d(1,"i",49),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.disable")," "))}function _i(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.enablePlugin(i.plugin))}),d(1,"i",50),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.enable")," "))}function Ci(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.uninstallPlugin())}),d(1,"i",51),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.button_uninstall")," "))}function hi(t,p){t&1&&d(0,"div",44)}function bi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.doChildBridgeAction("restart"))}),d(1,"i",53),c(2),r(3,"translate"),l()}if(t&2){let e=f(3);n(2),b(" ",s(3,1,e.setChildBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart")," ")}}function vi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.doChildBridgeAction("stop"))}),d(1,"i",54),c(2),r(3,"translate"),l()}if(t&2){let e=f(3);n(2),b(" ",s(3,1,e.setChildBridges.length>1?"child_bridge.stop_plural":"child_bridge.stop")," ")}}function xi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.doChildBridgeAction("start"))}),d(1,"i",55),c(2),r(3,"translate"),l()}if(t&2){let e=f(3);n(2),b(" ",s(3,1,e.setChildBridges.length>1?"child_bridge.start_plural":"child_bridge.start")," ")}}function wi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.resetChildBridges())}),d(1,"i",56),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"child_bridge.reset_accessories")," "))}function Pi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openBridgeSettings())}),d(1,"i",52),c(2),r(3,"translate"),l(),m(4,bi,4,3,"button",43),m(5,vi,4,3,"button",43),m(6,xi,4,3,"button",43),m(7,wi,4,3,"button",43)}if(t&2){let e=f(2);n(2),b(" ",s(3,5,"child_bridge.bridge_settings")," "),n(2),g(e.childBridgeRestartInProgress?-1:4),n(),g(e.allChildBridgesStopped?-1:5),n(),g(e.allChildBridgesStopped?6:-1),n(),g(e.serviceMode?7:-1)}}function yi(t,p){t&1&&d(0,"div",44)}function Si(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openBridgeSettings())}),d(1,"i",57),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"child_bridge.setup")," "))}function Bi(t,p){t&1&&d(0,"div",44)}function ki(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openBridgeSettings())}),d(1,"i",57),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"child_bridge.setup")," "))}function Ii(t,p){t&1&&d(0,"div",44)}function Ti(t,p){if(t&1&&(a(0,"a",45),d(1,"i",58),c(2),r(3,"translate"),l()),t&2){let e=f(2);C("href",e.plugin.links.bugs,T),n(2),b(" ",s(3,2,"support.links.issue")," ")}}function Vi(t,p){if(t&1){let e=w();a(0,"span",22)(1,"a",38),d(2,"i",39),l(),a(3,"div",40)(4,"button",41),_("click",function(){v(e);let i=f();return x(i.openSettings())}),d(5,"i",42),c(6),r(7,"translate"),l(),m(8,ui,4,3,"button",43),m(9,mi,4,3,"button",43),m(10,gi,4,3,"button",43),m(11,fi,4,3,"button",43),m(12,_i,4,3,"button",43),m(13,Ci,4,3,"button",43),m(14,hi,1,0,"div",44),m(15,Pi,8,7),m(16,yi,1,0,"div",44),m(17,Si,4,3,"button",43),m(18,Bi,1,0,"div",44),m(19,ki,4,3,"button",43),m(20,Ii,1,0,"div",44),m(21,Ti,4,4,"a",45),l()()}if(t&2){let e=f();n(),y("aria-label","Plugin Actions Dropdown"),n(5),b(" ",s(7,16,"plugins.button_settings")," "),n(2),g(e.plugin.isConfigured&&!e.plugin.disabled?8:-1),n(),g(e.plugin.publicPackage?9:-1),n(),g(!e.isMobile&&e.plugin.name!=="homebridge-config-ui-x"?10:-1),n(),g(e.plugin.name!=="homebridge-config-ui-x"&&!e.plugin.disabled?11:-1),n(),g(e.plugin.name!=="homebridge-config-ui-x"&&e.plugin.disabled?12:-1),n(),g(e.plugin.name!=="homebridge-config-ui-x"?13:-1),n(),g(!e.plugin.disabled&&e.plugin.isConfigured&&e.plugin.hasChildBridges&&e.plugin.installedVersion&&e.plugin.name!=="homebridge-config-ui-x"?14:-1),n(),g(e.plugin.hasChildBridges&&!e.plugin.disabled?15:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&!e.plugin.recommendChildBridge?16:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&!e.plugin.recommendChildBridge?17:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&e.plugin.recommendChildBridge&&e.plugin.updateAvailable?18:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&e.plugin.recommendChildBridge&&e.plugin.updateAvailable?19:-1),n(),g(e.plugin.links!=null&&e.plugin.links.bugs?20:-1),n(),g(e.plugin.links!=null&&e.plugin.links.bugs?21:-1)}}var Ee=(()=>{class t{$api=P(L);$md=P(Be);$modal=P(O);$plugin=P(Q);$settings=P(G);$toastr=P(R);$translate=P(q);$ws=P(W);io;plugin;hasChildBridges=!1;hasUnpairedChildBridges=!1;allChildBridgesStopped=!1;childBridgeStatus="pending";childBridgeRestartInProgress=!1;defaultIcon="assets/hb-icon.png";isMobile;setChildBridges=[];hb2Status="unknown";serviceMode=this.$settings.env.serviceMode;set childBridges(e){this.hasChildBridges=e.length>0,this.hasUnpairedChildBridges=e.filter(u=>u.paired===!1).length>0,this.allChildBridgesStopped=e.filter(u=>u.manuallyStopped===!0).length===e.length,this.hasChildBridges&&(e.some(u=>u.status==="down")?this.childBridgeStatus="down":e.some(u=>u.status==="pending")?this.childBridgeStatus="pending":e.some(u=>u.status==="ok")&&(this.childBridgeStatus="ok")),this.setChildBridges=e;let o=this.$settings.env.homebridgeVersion.split(".")[0],i=this.plugin.engines?.homebridge?.split("||").map(u=>u.trim())||[];this.hb2Status=o==="2"?"hide":i.some(u=>u.startsWith("^2")||u.startsWith(">=2"))?"supported":this.hb2Status}ngOnInit(){this.isMobile=this.$md.detect.mobile(),this.io=this.$ws.getExistingNamespace("child-bridges"),this.isMobile&&this.plugin.displayName.toLowerCase().startsWith("homebridge ")&&(this.plugin.displayName=this.plugin.displayName.replace(/^homebridge /i,"")),this.plugin.icon||(this.plugin.icon=this.defaultIcon)}openFundingModal(e){let o=this.$modal.open(Te,{size:"lg",backdrop:"static"});o.componentInstance.plugin=e}pluginInfoModal(e){let o=this.$modal.open(Ve,{size:"lg",backdrop:"static"});o.componentInstance.plugin=e}disablePlugin(e){let o=this.$modal.open(Ie,{size:"lg",backdrop:"static"});o.componentInstance.pluginName=e.displayName,o.componentInstance.isConfigured=e.isConfigured,o.componentInstance.isConfiguredDynamicPlatform=e.isConfiguredDynamicPlatform,o.result.then(()=>k(this,null,function*(){try{yield D(this.$api.put(`/config-editor/plugin/${encodeURIComponent(e.name)}/disable`,{})),e.disabled=!0,this.hasChildBridges&&this.doChildBridgeAction("stop"),this.$modal.open(H,{size:"lg",backdrop:"static"})}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.disable.error"),this.$translate.instant("toast.title_error"))}}))}enablePlugin(e){let o=this.$modal.open(ye,{size:"lg",backdrop:"static"});o.componentInstance.title=e.name,o.componentInstance.message=this.$translate.instant("plugins.manage.confirm_enable",{pluginName:e.displayName}),o.componentInstance.confirmButtonLabel=this.$translate.instant("plugins.manage.enable"),o.componentInstance.faIconClass="fa-circle-play primary-text",o.result.then(()=>k(this,null,function*(){try{yield D(this.$api.put(`/config-editor/plugin/${encodeURIComponent(e.name)}/enable`,{})),e.disabled=!1,this.hasChildBridges&&(yield this.doChildBridgeAction("start")),this.$modal.open(H,{size:"lg",backdrop:"static"})}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.enable.error"),this.$translate.instant("toast.title_error"))}}))}viewPluginLog(){let e=this.$modal.open(ke,{size:"xl",backdrop:"static"});e.componentInstance.plugin=this.plugin}doChildBridgeAction(e){return k(this,null,function*(){this.childBridgeRestartInProgress=!0;try{for(let o of this.setChildBridges)yield D(this.io.request(`${e}-child-bridge`,o.username))}catch(o){console.error(o),this.$toastr.error(this.$translate.instant("plugins.bridge.action_error",{action:e}),this.$translate.instant("toast.title_error")),this.childBridgeRestartInProgress=!1}finally{setTimeout(()=>{this.childBridgeRestartInProgress=!1},e==="restart"?12e3:e==="stop"?6e3:1e3)}})}handleIconError(){this.plugin.icon=this.defaultIcon}checkAndUpdatePlugin(){this.$plugin.checkAndUpdatePlugin(this.plugin,this.plugin.latestVersion)}openSettings(){this.$plugin.settings(this.plugin)}openBridgeSettings(){this.$plugin.bridgeSettings(this.plugin)}switchToScoped(){this.$plugin.switchToScoped(this.plugin)}installAlternateVersion(){this.$plugin.installAlternateVersion(this.plugin)}openJsonEditor(){this.$plugin.jsonEditor(this.plugin)}uninstallPlugin(){this.$plugin.uninstallPlugin(this.plugin,this.setChildBridges)}resetChildBridges(){this.$plugin.resetChildBridges(this.setChildBridges)}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["app-plugin-card"]],inputs:{plugin:"plugin",childBridges:"childBridges"},decls:35,vars:23,consts:[[1,"card","card-body","mb-3"],[1,"d-flex","flex-row","justify-content-between"],[1,"d-flex","flex-column","me-3","align-items-center","justify-content-between"],["alt","Plugin Icon",1,"plugin-icon-card","mb-3",3,"error","src"],[1,"d-flex","flex-column","justify-content-between",2,"min-width","calc(100% - 80px)"],[1,"d-flex","flex-row","align-items-end"],[1,"d-flex","flex-column","w-100"],[1,"d-flex","flex-row"],[1,"card-title","mb-2","text-truncate"],[1,"ms-auto"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover",1,"card-link",3,"ngbTooltip"],[1,"fas","fa-fw","fa-spinner","fa-pulse","fa-lg","grey-text","ms-3",3,"hidden"],[1,"fas","fa-fw","fa-lg","ms-3",3,"ngClass"],[1,"card-text","mb-2","text-truncate"],["href","javascript:void(0)",1,"card-link",3,"click"],[1,"fas","fa-fw","fa-shield-alt","fa-lg","me-1",3,"ngClass"],[1,"grey-text"],[1,"card-text","mb-2"],["href","javascript:void(0)",1,"card-link"],[1,"card-text","mb-0","grey-text"],["href","javascript:void(0)",1,"card-link","red-text"],["href","javascript:void(0)"],["ngbDropdown","","placement","left",1,"d-inline-block","ms-3","mt-auto"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover",1,"card-link",3,"click","ngbTooltip"],[1,"far","fa-fw","fa-arrow-alt-circle-up","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-arrow-right-arrow-left","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-sliders","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"icon-button","fas","fa-fw","fa-bridge","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"icon-button","fas","fa-fw","fa-qrcode","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-heart","fa-lg","me-1","pink-text"],[1,"fas","fa-fw","fa-heart","fa-lg","me-1",2,"opacity","0.5"],[1,"far","fa-fw","fa-circle-dot","fa-lg","me-1"],[1,"far","fa-fw","fa-circle-check","fa-lg","me-1"],[1,"fas","fa-fw","fa-lg","fa-power-off","ms-3"],["href","javascript:void(0)",1,"card-link","red-text",3,"click"],["container","body","openDelay","150","triggers","hover",1,"far","fa-fw","fa-pause-circle","fa-lg",3,"ngbTooltip"],["href","javascript:void(0)",3,"click"],[1,"far","fa-fw","fa-arrow-alt-circle-down","fa-lg"],["href","javascript:void(0)","ngbDropdownToggle","",1,"card-link","text-decoration-none","mt-auto",2,"outline","none"],[1,"fa-solid","fa-fw","fa-ellipsis-v","fa-lg"],["ngbDropdownMenu","","aria-labelledby","Plugin Actions Dropdown"],["ngbDropdownItem","",3,"click"],[1,"fas","fa-fw","fa-sliders"],["ngbDropdownItem",""],[1,"dropdown-divider"],["ngbDropdownItem","","rel","noopener noreferrer","target","_blank",3,"href"],[1,"fas","fa-fw","fa-wave-square"],[1,"fas","fa-fw","fa-code-compare"],[1,"fas","fa-fw","fa-code"],[1,"far","fa-fw","fa-circle-pause"],[1,"far","fa-fw","fa-circle-play"],[1,"fas","fa-fw","fa-trash"],[1,"fas","fa-fw","fa-bridge"],[1,"fa-fw","icon-button","fas","fa-fw","fa-power-off"],[1,"fas","fa-fw","fa-stop"],[1,"fas","fa-fw","fa-play"],[1,"fas","fa-fw","fa-broom"],[1,"icon-button","fas","fa-fw","fa-bridge"],[1,"icon-button","fa","fa-fw","fa-question-circle-o"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"img",3),_("error",function(){return i.handleIconError()}),l()(),a(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7)(8,"h5",8),c(9),l(),a(10,"div",9),m(11,Ye,4,6,"a",10),m(12,Ze,4,6,"a",10),m(13,ei,4,6,"a",10),m(14,ii,4,6,"a",10),m(15,ti,4,6,"a",10),d(16,"i",11),m(17,ni,1,4,"i",12),l()(),a(18,"p",13)(19,"a",14),_("click",function(){return i.pluginInfoModal(i.plugin)}),d(20,"i",15),a(21,"span",16),c(22),l()()(),a(23,"p",17),m(24,ai,4,1,"a",18),m(25,oi,3,1,"span",16),l(),a(26,"div",7)(27,"p",19),m(28,ri,5,2,"span"),m(29,si,2,1),l(),a(30,"div",9),m(31,di,3,3,"a",10),m(32,pi,3,3,"a",20),m(33,ci,2,0,"a",21),m(34,Vi,22,18,"span",22),l()()()()()()()),o&2&&(n(3),C("src",i.plugin.icon,T),n(6),h(i.plugin.displayName),n(2),g(i.plugin.installedVersion&&i.plugin.updateAvailable&&!i.childBridgeRestartInProgress?11:-1),n(),g(i.plugin.installedVersion&&(i.plugin.newHbScope==null?null:i.plugin.newHbScope.switch)===i.plugin.installedVersion&&!i.childBridgeRestartInProgress?12:-1),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&!i.plugin.isConfigured&&!i.childBridgeRestartInProgress&&!i.plugin.disabled?13:-1),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&i.plugin.isConfigured&&!i.plugin.hasChildBridges&&!i.plugin.disabled&&i.plugin.recommendChildBridge&&!i.childBridgeRestartInProgress?14:-1),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&i.plugin.isConfigured&&i.plugin.hasChildBridges&&!i.childBridgeRestartInProgress&&i.hasUnpairedChildBridges&&i.childBridgeStatus==="ok"&&!i.plugin.disabled?15:-1),n(),C("hidden",!i.childBridgeRestartInProgress),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&i.plugin.isConfigured&&i.plugin.hasChildBridges&&!i.childBridgeRestartInProgress&&!i.hasUnpairedChildBridges&&i.childBridgeStatus!=="ok"&&!i.plugin.disabled?17:-1),n(3),C("ngClass",ne(19,Ke,i.plugin.isHbScoped,!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin),!i.plugin.isHbScoped&&!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin)),n(2),h(i.plugin.name),n(2),g((i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)&&i.plugin.funding?24:-1),n(),g((i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)&&i.plugin.funding?-1:25),n(3),g(i.plugin.publicPackage&&!i.plugin.installedVersion?28:-1),n(),g(i.plugin.installedVersion?29:-1),n(2),g(!i.plugin.disabled&&i.plugin.hasChildBridges&&i.childBridgeStatus==="ok"?31:-1),n(),g(i.plugin.installedVersion&&i.plugin.disabled?32:-1),n(),g(i.plugin.publicPackage&&!i.plugin.installedVersion?33:-1),n(),g(i.plugin.installedVersion?34:-1))},dependencies:[U,M,xe,ve,be,he,Ce,oe,B],encapsulation:2})}return t})();var Me=(()=>{class t{$activeModal=P($);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],decls:27,vars:21,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,"mb-0"],[3,"innerHTML"],[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(o,i){o&1&&(a(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),c(4),r(5,"translate"),l(),a(6,"button",3),r(7,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(8,"div",4)(9,"div",5),d(10,"i",6),l(),a(11,"ul",7),d(12,"li",8),r(13,"translate"),d(14,"li",8),r(15,"translate"),d(16,"li",8),r(17,"translate"),d(18,"li",8),r(19,"translate"),l()(),a(20,"div",9),d(21,"div",10),a(22,"div",11)(23,"button",12),_("click",function(){return i.dismissModal()}),c(24),r(25,"translate"),l()(),d(26,"div",13),l()()()),o&2&&(n(4),h(s(5,7,"support.title")),n(2),y("aria-label",s(7,9,"form.button_close")),n(6),C("innerHTML",s(13,11,"plugins.support.list_1"),N),n(2),C("innerHTML",s(15,13,"plugins.support.list_2"),N),n(2),C("innerHTML",s(17,15,"plugins.support.list_3"),N),n(2),C("innerHTML",s(19,17,"plugins.support.list_4"),N),n(6),b(" ",s(25,19,"form.button_close")," "))},dependencies:[B],encapsulation:2})}return t})();var Ei=["searchInput"],Mi=(t,p)=>({"fa-magnifying-glass":t,"fa-exclamation-circle":p});function $i(t,p){t&1&&d(0,"app-spinner")}function Di(t,p){if(t&1){let e=w();a(0,"a",15),_("click",function(){v(e);let i=f(3);return x(i.onClearSearch())}),d(1,"i",16),l()}}function Ni(t,p){if(t&1){let e=w();a(0,"div",9)(1,"div",11)(2,"form",12),_("ngSubmit",function(){v(e);let i=f(2);return x(i.onSubmit(i.form))}),d(3,"input",13,0),r(5,"translate"),m(6,Di,2,0,"a",14),l()()()}if(t&2){let e=f(2);n(2),C("formGroup",e.form),n(),C("placeholder",s(5,3,"plugins.placeholder_search_plugin")),n(3),g(e.showExitButton?6:-1)}}function Hi(t,p){if(t&1&&(a(0,"div",17),d(1,"app-plugin-card",19),l()),t&2){let e=p.$implicit,o=f(3);n(),C("plugin",e)("childBridges",o.getPluginChildBridges(e))}}function Ai(t,p){if(t&1&&(a(0,"div",18),d(1,"i",20),a(2,"p"),c(3),r(4,"translate"),l()()),t&2){let e=f(3);n(),C("ngClass",I(4,Mi,!e.showExitButton,e.showExitButton)),n(2),h(s(4,2,e.showExitButton?"plugins.placeholder_search_none":"plugins.placeholder_search_first"))}}function ji(t,p){if(t&1&&(a(0,"div",10),F(1,Hi,2,2,"div",17,j),m(3,Ai,5,7,"div",18),l()),t&2){let e=f(2);n(),z(e.installedPlugins),n(2),g(e.installedPlugins.length===0&&!e.loading&&!e.mainError?3:-1)}}function Fi(t,p){if(t&1&&(m(0,Ni,7,5,"div",9),m(1,ji,4,1,"div",10)),t&2){let e=f();g(e.showSearchBar?0:-1),n(),g(e.loading?-1:1)}}function zi(t,p){t&1&&(a(0,"div",21)(1,"div",22)(2,"code"),c(3,"https://developers.homebridge.io/analytics "),a(4,"a",23),d(5,"i",24),l()()(),a(6,"div",25),c(7),r(8,"translate"),l()(),d(9,"iframe",26)),t&2&&(n(7),h(s(8,1,"plugins.stats_note")))}var Yt=(()=>{class t{searchInput;$api=P(L);$modal=P(O);$plugin=P(Q);$router=P(Pe);$settings=P(G);$toastr=P(R);$translate=P(q);$ws=P(W);isSearchMode=!1;io;navigationSubscription;mainError=!1;loading=!0;tab="main";installedPlugins=[];childBridges=[];showSearchBar=!1;showExitButton=!1;form=new de({query:new pe("")});ngOnInit(){return k(this,null,function*(){this.io=this.$ws.connectToNamespace("child-bridges"),this.io.connected.subscribe(()=>k(this,null,function*(){this.getChildBridgeMetadata(),this.io.socket.emit("monitor-child-bridge-status"),yield this.loadInstalledPlugins(),this.installedPlugins.length||this.showSearch();let{action:e,plugin:o}=this.$router.parseUrl(this.$router.url).queryParams;if(e){let i=this.installedPlugins.find(u=>u.name===o);switch(e){case"just-installed":{i&&(i.isConfigured?this.$modal.open(H,{size:"lg",backdrop:"static"}):this.$plugin.settings(i));break}case"open-manage-version":{i&&this.$plugin.installAlternateVersion(i);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}})),this.io.socket.on("child-bridge-status-update",e=>{let o=this.childBridges.find(i=>i.username===e.username);o?Object.assign(o,e):this.childBridges.push(e)}),this.navigationSubscription=this.$router.events.subscribe(e=>{e instanceof we&&this.loadInstalledPlugins()})})}search(){this.installedPlugins=[],this.loading=!0,this.showExitButton=!0,this.$api.get(`/plugins/search/${encodeURIComponent(this.form.value.query)}`).subscribe({next:e=>{let o=new Set;this.installedPlugins=e.reduce((i,u)=>{if(u.name==="homebridge-config-ui-x"||o.has(u.name))return i;if(u.newHbScope){let Y=u.newHbScope.to,$e=e.some(De=>De.name===Y);(u.installedVersion||!$e)&&(o.add(Y),i.push(u))}else i.push(u);return i},[]),this.appendMetaInfo(),this.loading=!1},error:e=>{this.loading=!1,this.isSearchMode=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error")),this.loadInstalledPlugins()}})}onClearSearch(){this.loadInstalledPlugins()}onSubmit({value:e}){e.query.length?(this.isSearchMode=!0,this.search()):this.isSearchMode&&(this.isSearchMode=!1,this.loadInstalledPlugins())}showSearch(){this.showSearchBar?(this.showSearchBar=!1,this.isSearchMode&&(this.isSearchMode=!1,this.form.setValue({query:""}),this.loadInstalledPlugins())):(window.document.querySelector("body").classList.remove("bg-black"),this.tab="main",this.showSearchBar=!0,setTimeout(()=>this.searchInput.nativeElement.focus(),0))}showStats(){this.tab==="stats"?(window.document.querySelector("body").classList.remove("bg-black"),this.tab="main"):(window.document.querySelector("body").classList.add("bg-black"),this.tab="stats",this.showSearchBar=!1)}openSupport(){this.$modal.open(Me,{size:"lg",backdrop:"static"})}ngOnDestroy(){window.document.querySelector("body").classList.remove("bg-black"),this.navigationSubscription&&this.navigationSubscription.unsubscribe(),this.io.end()}getPluginChildBridges(e){return this.childBridges.filter(o=>o.plugin===e.name)}loadInstalledPlugins(){return k(this,null,function*(){this.form.setValue({query:""}),this.showExitButton=!1,this.installedPlugins=[],this.loading=!0,this.mainError=!1;try{let e=yield D(this.$api.get("/plugins"));this.installedPlugins=e.filter(i=>i.name!=="homebridge-config-ui-x"),yield this.appendMetaInfo();let o=this.installedPlugins.sort((i,u)=>i.updateAvailable!==u.updateAvailable?i.updateAvailable?-1:1:i.newHbScope&&!u.newHbScope?-1:i.disabled!==u.disabled?i.disabled?1:-1:i.isConfigured!==u.isConfigured?i.isConfigured?1:-1:i.hasChildBridgesUnpaired!==u.hasChildBridgesUnpaired?i.hasChildBridgesUnpaired?-1:1:i.hasChildBridges!==u.hasChildBridges&&this.$settings.env.recommendChildBridges?i.hasChildBridges?1:-1:i.name.localeCompare(u.name));return this.loading=!1,o}catch(e){console.error(e),this.loading=!1,this.mainError=!0,this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}appendMetaInfo(){return k(this,null,function*(){yield Promise.all(this.installedPlugins.filter(e=>e.installedVersion).map(e=>k(this,null,function*(){try{let o=yield D(this.$api.get(`/config-editor/plugin/${encodeURIComponent(e.name)}`));e.isConfigured=o.length>0,e.isConfiguredDynamicPlatform=e.isConfigured&&Object.prototype.hasOwnProperty.call(o[0],"platform"),e.recommendChildBridge=e.isConfiguredDynamicPlatform&&this.$settings.env.recommendChildBridges&&this.$settings.env.serviceMode&&!["homebridge","homebridge-config-ui-x"].includes(e.name),e.hasChildBridges=e.isConfigured&&o.some(u=>u._bridge&&u._bridge.username);let i=this.getPluginChildBridges(e);e.hasChildBridgesUnpaired=i.some(u=>!u.paired),this.$settings.env.plugins?.hideUpdatesFor?.includes(e.name)&&(e.updateAvailable=!1)}catch{e.isConfigured=!0,e.hasChildBridges=!0}})))})}getChildBridgeMetadata(){this.io.request("get-homebridge-child-bridge-status").subscribe(e=>{this.childBridges=e})}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],viewQuery:function(o,i){if(o&1&&ee(Ei,5),o&2){let u;ie(u=te())&&(i.searchInput=u.first)}},decls:20,vars:26,consts:[["searchInput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","ngbTooltip"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2","d-none","d-md-inline-block",3,"click","ngbTooltip"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-fw","fa-question-circle-o"],[1,"row"],[1,"d-flex","flex-wrap","justify-content-between"],[1,"col-md-12"],["novalidate","",3,"ngSubmit","formGroup"],["type","text","formControlName","query",1,"hb-npm-search",3,"placeholder"],["href","javascript:void(0)",1,"hb-npm-search-clear"],["href","javascript:void(0)",1,"hb-npm-search-clear",3,"click"],[1,"far","fa-fw","fa-times-circle"],[1,"hb-plugin-space-between"],[1,"alert","alert-info","mt-4","text-center","w-100"],[3,"plugin","childBridges"],[1,"fas","fa-fw","primary-text","my-3",2,"font-size","75px",3,"ngClass"],[1,"w-100","py-3","hb-stats-header","text-white","text-center"],[1,"mb-2"],["href","https://developers.homebridge.io/analytics","target","_blank"],[1,"fa","fa-fw","fa-external-link"],[1,"small","grey-text"],["src",Z`https://developers.homebridge.io/analytics/`,"sandbox","allow-scripts allow-same-origin allow-popups","referrerpolicy","no-referrer",1,"hb-stats"]],template:function(o,i){o&1&&(m(0,$i,1,0,"app-spinner"),a(1,"div",1)(2,"div",2)(3,"h3",3),c(4),r(5,"translate"),l()(),a(6,"div",4)(7,"button",5),r(8,"translate"),r(9,"translate"),_("click",function(){return i.showSearch()}),d(10,"i"),l(),a(11,"button",6),r(12,"translate"),r(13,"translate"),_("click",function(){return i.showStats()}),d(14,"i"),l(),a(15,"button",7),r(16,"translate"),_("click",function(){return i.openSupport()}),d(17,"i",8),l()()(),m(18,Fi,2,2)(19,zi,10,3)),o&2&&(g(i.loading?0:-1),n(4),h(s(5,14,"menu.label_plugins")),n(3),C("ngbTooltip",s(8,16,"plugins.search")),y("aria-label",s(9,18,"plugins.search")),n(3),J(K("fas fa-fw",i.showSearchBar?" primary-text":""," fa-search")),n(),C("ngbTooltip",s(12,20,"plugins.stats")),y("aria-label",s(13,22,"plugins.stats")),n(3),J(K("fas fa-fw",i.tab==="stats"?" primary-text":""," fa-sliders")),n(),y("aria-label",s(16,24,"support.title")),n(3),g(i.tab==="main"?18:i.tab==="stats"?19:-1))},dependencies:[Se,ge,ce,le,re,se,fe,ue,me,Ee,B,M,U],styles:[".hb-npm-search[_ngcontent-%COMP%]{outline:none;box-sizing:inherit!important;background-color:inherit;height:50px!important;width:100%;border-width:.5px;padding:10px;margin-bottom:15px}@media (hover: hover){.hb-npm-search[_ngcontent-%COMP%]:hover{border:1px solid #000000}}.hb-npm-search[_ngcontent-%COMP%]:focus{border:1px solid #000000;box-shadow:0 1px #000}.hb-npm-search-clear[_ngcontent-%COMP%]{position:absolute;right:25px;font-size:35px;color:#d0d0d0;line-height:50px;cursor:pointer}.hb-plugin-space-between[_ngcontent-%COMP%]{box-sizing:border-box;width:calc(50% - 6.6666666667px)}@media only screen and (max-width: 991px){.hb-plugin-space-between[_ngcontent-%COMP%]{width:100%}}.hb-stats-header[_ngcontent-%COMP%]{background:#242424;border-top-left-radius:.5rem;border-top-right-radius:.5rem}.hb-stats-header[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{border:1px solid grey;border-radius:5px;padding:5px;font-size:.8rem;color:#d3d3d3}.hb-stats[_ngcontent-%COMP%]{height:calc(100% - 121px);width:100%;overflow:hidden;border-bottom-left-radius:.5rem;border-bottom-right-radius:.5rem}@media (max-width: 767px){.hb-stats[_ngcontent-%COMP%]{height:calc(100% - 60px)}}"]})}return t})();export{Yt as PluginsComponent};
1
+ import{a as Se}from"./chunk-F3ERQJVG.js";import{l as ke,n as Q}from"./chunk-JGP7TCXI.js";import{a as H}from"./chunk-UQYCFN3T.js";import"./chunk-GDFV4BMO.js";import{a as Be}from"./chunk-NGNQPAAK.js";import"./chunk-QDCKP2LU.js";import"./chunk-3SIBQXGZ.js";import"./chunk-UD6SVFW2.js";import"./chunk-7EQ4BJZB.js";import"./chunk-EGCUYKRH.js";import{a as ye}from"./chunk-TQNKRJOX.js";import{g as _e,h as Ce,i as he,j as be,k as ve,l as xe,m as $,n as O,t as U}from"./chunk-CF2ZN7LY.js";import{A as fe,c as le,e as re,f as se,g as de,j as pe,m as ce,p as ue,q as me,z as ge}from"./chunk-T252YJXA.js";import{a as W}from"./chunk-FJRFEXDR.js";import"./chunk-274JKR5U.js";import{a as we,d as Pe}from"./chunk-X7PVYZAE.js";import{b as G}from"./chunk-EB6QQWZX.js";import{k as R,n as L}from"./chunk-FVUUWFZH.js";import{a as q,b as B}from"./chunk-LXXELGX4.js";import"./chunk-SRP6QX5M.js";import{Bc as r,Cc as s,Dc as E,Hb as y,Ib as m,Jb as g,Lb as j,Mb as F,Nb as z,Ob as C,Pb as a,Qb as l,Rb as d,Vb as w,Xa as N,Ya as T,Yb as _,Za as Z,Zb as f,ab as n,bc as ee,cc as ie,cd as M,dc as te,fd as ae,h as k,jc as J,jd as oe,kc as c,la as P,lc as h,mb as S,mc as b,ra as v,sa as x,uc as K,w as D,xc as V,yc as I,zc as ne}from"./chunk-SKZUTSHE.js";var Ne=t=>({pluginName:t});function He(t,p){t&1&&(a(0,"ul",7)(1,"li"),c(2),r(3,"translate"),l(),a(4,"li"),c(5),r(6,"translate"),l()()),t&2&&(n(2),h(s(3,2,"plugins.manage.confirm_disable_accessory_1")),n(3),h(s(6,4,"plugins.manage.confirm_disable_accessory_2")))}function Ae(t,p){t&1&&(a(0,"ul",7)(1,"li"),c(2),r(3,"translate"),l(),a(4,"li"),c(5),r(6,"translate"),l()()),t&2&&(n(2),h(s(3,2,"plugins.manage.confirm_disable_platform_1")),n(3),h(s(6,4,"plugins.manage.confirm_disable_platform_2")))}var Ie=(()=>{class t{$activeModal=P($);pluginName;isConfigured=!1;isConfiguredDynamicPlatform=!1;dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close()}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],inputs:{pluginName:"pluginName",isConfigured:"isConfigured",isConfiguredDynamicPlatform:"isConfiguredDynamicPlatform"},decls:26,vars:22,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,"mb-3","text-center"],[1,"fas","fa-fw","fa-circle-pause","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","warning",1,"mb-0",3,"dismissible"],[1,"w-100","text-center","mb-0"],[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"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),c(3),l(),a(4,"button",3),r(5,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(6,"div",4)(7,"div",5),d(8,"i",6),l(),m(9,He,7,6,"ul",7),m(10,Ae,7,6,"ul",7),a(11,"ngb-alert",8)(12,"p",9),c(13),r(14,"translate"),l()()(),a(15,"div",10)(16,"div",11)(17,"button",12),r(18,"translate"),_("click",function(){return i.dismissModal()}),c(19),r(20,"translate"),l()(),d(21,"div",13),a(22,"div",14)(23,"button",15),_("click",function(){return i.closeModal()}),c(24),r(25,"translate"),l()()()()),o&2&&(n(3),h(i.pluginName),n(),y("aria-label",s(5,9,"form.button_close")),n(5),g(i.isConfigured&&!i.isConfiguredDynamicPlatform?9:-1),n(),g(i.isConfigured&&i.isConfiguredDynamicPlatform?10:-1),n(),C("dismissible",!1),n(2),h(E(14,11,"plugins.manage.confirm_disable",V(20,Ne,i.pluginName))),n(4),y("aria-label",s(18,14,"form.button_close")),n(2),b(" ",s(20,16,"form.button_close")," "),n(5),b(" ",s(25,18,"plugins.manage.disable")," "))},dependencies:[_e,B],encapsulation:2})}return t})();var je=t=>({author:t});function Fe(t,p){if(t&1&&(a(0,"li",9),d(1,"i",15),a(2,"a",16),c(3),l()()),t&2){let e=p.$implicit,o=f();n(),C("ngClass",o.getIconClass(e.type)),n(),C("href",e.url,T),n(),h(e.url)}}var Te=(()=>{class t{$activeModal=P($);plugin;fundingOptions;ngOnInit(){this.plugin.funding||this.$activeModal.close(),this.plugin.name==="homebridge-config-ui-x"&&(this.plugin.author="oznu"),Array.isArray(this.plugin.funding)?this.fundingOptions=this.plugin.funding.map(e=>{if(typeof e=="string")return{type:"other",url:e};if(typeof e=="object")return{type:e.type||"other",url:e.url}}):typeof this.plugin.funding=="string"?this.fundingOptions=[{type:"other",url:this.plugin.funding}]:typeof this.plugin.funding=="object"&&(this.fundingOptions=[{type:this.plugin.funding.type||"other",url:this.plugin.funding.url}])}getIconClass(e){switch(e.toLowerCase()){case"paypal":return"fab fa-fw fa-paypal";case"github":return"fab fa-fw fa-github";case"patreon":return"fab fa-fw fa-patreon";case"kofi":case"ko-fi":return"fas fa-fw fa-coffee";default:return"fas fa-fw fa-link"}}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:28,vars:21,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","pink-text","mb-3"],[1,"fas","fa-fw","fa-heart",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box"],[1,"list-group-item"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"],[1,"me-2","primary-text","fa-fw","fa-xl",3,"ngClass"],["target","_blank","rel","noopener noreferrer",1,"text-break-all",3,"href"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),c(3),r(4,"translate"),l(),a(5,"button",3),r(6,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(7,"div",4)(8,"div",5),d(9,"i",6),l(),a(10,"ul",7)(11,"li"),c(12),r(13,"translate"),l(),a(14,"li"),c(15),r(16,"translate"),l()(),a(17,"ul",8),F(18,Fe,4,3,"li",9,j),l()(),a(20,"div",10),d(21,"div",11),a(22,"div",12)(23,"button",13),r(24,"translate"),_("click",function(){return i.dismissModal()}),c(25),r(26,"translate"),l()(),d(27,"div",14),l()()),o&2&&(n(3),h(E(4,6,"plugins.donate.tile_donate_to",V(19,je,"@"+i.plugin.author))),n(2),y("aria-label",s(6,9,"form.button_close")),n(7),h(s(13,11,"plugins.donate.message_1")),n(3),h(s(16,13,"plugins.donate.message_2")),n(3),z(i.fundingOptions),n(5),y("aria-label",s(24,15,"form.button_close")),n(2),b(" ",s(26,17,"form.button_close")," "))},dependencies:[M,B],styles:[".text-break-all[_ngcontent-%COMP%]{word-break:break-all}"]})}return t})();var ze=(t,p)=>({"orange-text":t,"grey-text":p}),X=t=>({opacity:t}),Oe=(t,p)=>({"green-text":t,"grey-text":p}),Ue=(t,p)=>({"purple-text":t,"grey-text":p}),qe=(t,p)=>({scopedLink:t,verifiedLink:p});function Re(t,p){t&1&&(a(0,"h6",18),c(1),r(2,"translate"),l(),a(3,"p",19),c(4),r(5,"translate"),l(),a(6,"p",19),c(7),r(8,"translate"),l()),t&2&&(n(),h(s(2,3,"plugins.manage.scoped_subtitle")),n(3),h(s(5,5,"plugins.manage.scoped_message")),n(3),h(s(8,7,"plugins.manage.verified_message")))}function Le(t,p){t&1&&(a(0,"h6",18),c(1),r(2,"translate"),l(),a(3,"p",19),c(4),r(5,"translate"),l()),t&2&&(n(),h(s(2,2,"plugins.manage.verified_subtitle")),n(3),h(s(5,4,"plugins.manage.verified_message")))}function Ge(t,p){t&1&&(a(0,"h6",18),c(1),r(2,"translate"),l(),a(3,"p",19),c(4),r(5,"translate"),l()),t&2&&(n(),h(s(2,2,"plugins.manage.unverified_subtitle")),n(3),h(s(5,4,"plugins.manage.unverified_message")))}function We(t,p){if(t&1){let e=w();a(0,"button",20),_("click",function(){v(e);let i=f();return x(i.dismissModal())}),c(1),r(2,"translate"),l()}t&2&&(n(),b(" ",s(2,1,"form.button_close")," "))}function Qe(t,p){if(t&1){let e=w();a(0,"button",20),_("click",function(){v(e);let i=f();return x(i.dismissModal())}),c(1),r(2,"translate"),l()}t&2&&(n(),b(" ",s(2,1,"form.button_close")," "))}function Je(t,p){if(t&1&&(a(0,"a",17),c(1),r(2,"translate"),d(3,"i",21),l()),t&2){let e=f();C("href",e.plugin.links.homepage||e.plugin.links.npm,T),n(),b(" ",s(2,2,"plugins.button_homepage")," ")}}var Ve=(()=>{class t{$activeModal=P($);plugin;defaultIcon="assets/hb-icon.png";linkScoped='<a href="https://github.com/homebridge/plugins/wiki/Scoped-Plugins" target="_blank"><i class="fas fa-fw fa-external-link-alt primary-text"></i></a>';linkVerified='<a href="https://github.com/homebridge/plugins/wiki/Verified-Plugins" target="_blank"><i class="fas fa-fw fa-external-link-alt primary-text"></i></a>';ngOnInit(){this.plugin.icon||(this.plugin.icon=this.defaultIcon)}handleIconError(){this.plugin.icon=this.defaultIcon}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:32,vars:45,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","text-center"],["alt","Plugin Icon",1,"mb-3","plugin-icon-card",3,"error","src"],[1,"mb-1"],[1,"grey-text","mb-0","font-monospace"],[1,"grey-text","mb-1","font-monospace"],[1,"mb-3"],[1,"fas","fa-fw","fa-shield-alt","mb-3",2,"font-size","48px",3,"ngClass","ngStyle"],[1,"mb-0","grey-text",3,"innerHTML"],[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"],["target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","text-decoration-none",3,"href"],[1,"mb-2"],[1,"mb-1","grey-text"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"fas","fa-fw","fa-external-link-alt"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),c(3),r(4,"translate"),l(),a(5,"button",3),r(6,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(7,"div",4)(8,"img",5),_("error",function(){return i.handleIconError()}),l(),a(9,"h4",6),c(10),l(),a(11,"p",7),c(12),l(),a(13,"p",8),c(14),l(),a(15,"p",9),c(16),l(),d(17,"i",10)(18,"i",10)(19,"i",10),m(20,Re,9,9),m(21,Le,6,6),m(22,Ge,6,6),d(23,"p",11),r(24,"translate"),l(),a(25,"div",12)(26,"div",13),m(27,We,3,3,"button",14),l(),a(28,"div",15),m(29,Qe,3,3,"button",14),l(),a(30,"div",16),m(31,Je,4,4,"a",17),l()()()),o&2&&(n(3),h(s(4,20,"plugins.manage.information")),n(2),y("aria-label",s(6,22,"form.button_close")),n(3),C("src",i.plugin.icon,T),n(2),h(i.plugin.displayName),n(2),h(i.plugin.name),n(2),b("@",i.plugin.author),n(2),h(i.plugin.description),n(),C("ngClass",I(27,ze,!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin,i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin))("ngStyle",V(30,X,!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin?1:.25)),n(),C("ngClass",I(32,Oe,!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin),i.plugin.isHbScoped||!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin))("ngStyle",V(35,X,!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)?1:.25)),n(),C("ngClass",I(37,Ue,i.plugin.isHbScoped,!i.plugin.isHbScoped))("ngStyle",V(40,X,i.plugin.isHbScoped?1:.25)),n(),g(i.plugin.isHbScoped?20:-1),n(),g(!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)?21:-1),n(),g(!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin?22:-1),n(),C("innerHTML",E(24,24,"plugins.manage.more_info",I(42,qe,i.linkScoped,i.linkVerified)),N),n(4),g(i.plugin.links.homepage||i.plugin.links.npm?27:-1),n(2),g(!i.plugin.links.homepage&&!i.plugin.links.npm?29:-1),n(2),g(i.plugin.links.homepage||i.plugin.links.npm?31:-1))},dependencies:[B,M,ae],styles:[".plugin-icon[_ngcontent-%COMP%]{height:75px;width:75px;border-radius:15px;border:1px solid #222222}"]})}return t})();var Ke=(t,p,e)=>({"purple-text":t,"green-text":p,"orange-text":e}),Xe=(t,p)=>({"fa-bridge-circle-exclamation orange-text":t,"fa-bridge-circle-xmark red-text":p});function Ye(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.checkAndUpdatePlugin())}),d(3,"i",24),l()}t&2&&(C("ngbTooltip",s(1,2,"plugins.button_update")),y("aria-label",s(2,4,"plugins.button_update")))}function Ze(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.switchToScoped())}),d(3,"i",25),l()}t&2&&(C("ngbTooltip",s(1,2,"plugins.manage.scoped.switch")),y("aria-label",s(2,4,"plugins.manage.scoped.switch")))}function ei(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.openSettings())}),d(3,"i",26),l()}t&2&&(C("ngbTooltip",s(1,2,"plugins.button_set_up")),y("aria-label",s(2,4,"plugins.button_set_up")))}function ii(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.openBridgeSettings())}),d(3,"i",27),l()}t&2&&(C("ngbTooltip",s(1,2,"child_bridge.setup")),y("aria-label",s(2,4,"child_bridge.setup")))}function ti(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),r(2,"translate"),_("click",function(){v(e);let i=f();return x(i.openBridgeSettings())}),d(3,"i",28),l()}t&2&&(C("ngbTooltip",s(1,2,"child_bridge.bridge_connect")),y("aria-label",s(2,4,"child_bridge.bridge_connect")))}function ni(t,p){if(t&1&&d(0,"i",12),t&2){let e=f();C("ngClass",I(1,Xe,e.childBridgeStatus==="pending",e.childBridgeStatus==="down"))}}function ai(t,p){if(t&1){let e=w();a(0,"a",14),_("click",function(){v(e);let i=f();return x(i.openFundingModal(i.plugin))}),d(1,"i",29),a(2,"span",16),c(3),l()()}if(t&2){let e=f();n(3),b("@",e.plugin.author)}}function oi(t,p){if(t&1&&(a(0,"span",16),d(1,"i",30),c(2),l()),t&2){let e=f();n(2),b("@",e.plugin.author," ")}}function li(t,p){if(t&1&&(a(0,"span"),c(1),r(2,"date"),l()),t&2){let e=f(2);n(),b("(",E(2,1,e.plugin.lastUpdated,"yyyy-MM-dd"),")")}}function ri(t,p){if(t&1&&(a(0,"span"),d(1,"i",31),a(2,"span",16),c(3),m(4,li,3,4,"span"),l()()),t&2){let e=f();n(3),b("v",e.plugin.latestVersion," "),n(),g(e.plugin.lastUpdated?4:-1)}}function si(t,p){if(t&1&&(d(0,"i",32),c(1)),t&2){let e=f();n(),b("v",e.plugin.installedVersion," ")}}function di(t,p){if(t&1){let e=w();a(0,"a",23),r(1,"translate"),_("click",function(){v(e);let i=f();return x(i.doChildBridgeAction("restart"))}),d(2,"i",33),l()}if(t&2){let e=f();C("ngbTooltip",s(1,1,e.setChildBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart"))}}function pi(t,p){if(t&1){let e=w();a(0,"a",34),_("click",function(){v(e);let i=f();return x(i.enablePlugin(i.plugin))}),d(1,"i",35),r(2,"translate"),l()}t&2&&(n(),C("ngbTooltip",s(2,1,"plugins.status_disabled")))}function ci(t,p){if(t&1){let e=w();a(0,"a",36),_("click",function(){v(e);let i=f();return x(i.installAlternateVersion())}),d(1,"i",37),l()}}function ui(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.viewPluginLog())}),d(1,"i",46),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.plugin_logs")," "))}function mi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.installAlternateVersion())}),d(1,"i",47),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.manage_version")," "))}function gi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openJsonEditor())}),d(1,"i",48),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.json_config")," "))}function fi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.disablePlugin(i.plugin))}),d(1,"i",49),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.disable")," "))}function _i(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.enablePlugin(i.plugin))}),d(1,"i",50),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.manage.enable")," "))}function Ci(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.uninstallPlugin())}),d(1,"i",51),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"plugins.button_uninstall")," "))}function hi(t,p){t&1&&d(0,"div",44)}function bi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.doChildBridgeAction("restart"))}),d(1,"i",53),c(2),r(3,"translate"),l()}if(t&2){let e=f(3);n(2),b(" ",s(3,1,e.setChildBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart")," ")}}function vi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.doChildBridgeAction("stop"))}),d(1,"i",54),c(2),r(3,"translate"),l()}if(t&2){let e=f(3);n(2),b(" ",s(3,1,e.setChildBridges.length>1?"child_bridge.stop_plural":"child_bridge.stop")," ")}}function xi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.doChildBridgeAction("start"))}),d(1,"i",55),c(2),r(3,"translate"),l()}if(t&2){let e=f(3);n(2),b(" ",s(3,1,e.setChildBridges.length>1?"child_bridge.start_plural":"child_bridge.start")," ")}}function wi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(3);return x(i.resetChildBridges())}),d(1,"i",56),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"child_bridge.reset_accessories")," "))}function Pi(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openBridgeSettings())}),d(1,"i",52),c(2),r(3,"translate"),l(),m(4,bi,4,3,"button",43),m(5,vi,4,3,"button",43),m(6,xi,4,3,"button",43),m(7,wi,4,3,"button",43)}if(t&2){let e=f(2);n(2),b(" ",s(3,5,"child_bridge.bridge_settings")," "),n(2),g(e.childBridgeRestartInProgress?-1:4),n(),g(e.allChildBridgesStopped?-1:5),n(),g(e.allChildBridgesStopped?6:-1),n(),g(e.serviceMode?7:-1)}}function yi(t,p){t&1&&d(0,"div",44)}function Si(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openBridgeSettings())}),d(1,"i",57),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"child_bridge.setup")," "))}function Bi(t,p){t&1&&d(0,"div",44)}function ki(t,p){if(t&1){let e=w();a(0,"button",41),_("click",function(){v(e);let i=f(2);return x(i.openBridgeSettings())}),d(1,"i",57),c(2),r(3,"translate"),l()}t&2&&(n(2),b(" ",s(3,1,"child_bridge.setup")," "))}function Ii(t,p){t&1&&d(0,"div",44)}function Ti(t,p){if(t&1&&(a(0,"a",45),d(1,"i",58),c(2),r(3,"translate"),l()),t&2){let e=f(2);C("href",e.plugin.links.bugs,T),n(2),b(" ",s(3,2,"support.links.issue")," ")}}function Vi(t,p){if(t&1){let e=w();a(0,"span",22)(1,"a",38),d(2,"i",39),l(),a(3,"div",40)(4,"button",41),_("click",function(){v(e);let i=f();return x(i.openSettings())}),d(5,"i",42),c(6),r(7,"translate"),l(),m(8,ui,4,3,"button",43),m(9,mi,4,3,"button",43),m(10,gi,4,3,"button",43),m(11,fi,4,3,"button",43),m(12,_i,4,3,"button",43),m(13,Ci,4,3,"button",43),m(14,hi,1,0,"div",44),m(15,Pi,8,7),m(16,yi,1,0,"div",44),m(17,Si,4,3,"button",43),m(18,Bi,1,0,"div",44),m(19,ki,4,3,"button",43),m(20,Ii,1,0,"div",44),m(21,Ti,4,4,"a",45),l()()}if(t&2){let e=f();n(),y("aria-label","Plugin Actions Dropdown"),n(5),b(" ",s(7,16,"plugins.button_settings")," "),n(2),g(e.plugin.isConfigured&&!e.plugin.disabled?8:-1),n(),g(e.plugin.publicPackage?9:-1),n(),g(!e.isMobile&&e.plugin.name!=="homebridge-config-ui-x"?10:-1),n(),g(e.plugin.name!=="homebridge-config-ui-x"&&!e.plugin.disabled?11:-1),n(),g(e.plugin.name!=="homebridge-config-ui-x"&&e.plugin.disabled?12:-1),n(),g(e.plugin.name!=="homebridge-config-ui-x"?13:-1),n(),g(!e.plugin.disabled&&e.plugin.isConfigured&&e.plugin.hasChildBridges&&e.plugin.installedVersion&&e.plugin.name!=="homebridge-config-ui-x"?14:-1),n(),g(e.plugin.hasChildBridges&&!e.plugin.disabled?15:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&!e.plugin.recommendChildBridge?16:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&!e.plugin.recommendChildBridge?17:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&e.plugin.recommendChildBridge&&e.plugin.updateAvailable?18:-1),n(),g(e.plugin.isConfigured&&!e.plugin.hasChildBridges&&!e.plugin.disabled&&e.plugin.recommendChildBridge&&e.plugin.updateAvailable?19:-1),n(),g(e.plugin.links!=null&&e.plugin.links.bugs?20:-1),n(),g(e.plugin.links!=null&&e.plugin.links.bugs?21:-1)}}var Ee=(()=>{class t{$api=P(L);$md=P(Be);$modal=P(O);$plugin=P(Q);$settings=P(G);$toastr=P(R);$translate=P(q);$ws=P(W);io;plugin;hasChildBridges=!1;hasUnpairedChildBridges=!1;allChildBridgesStopped=!1;childBridgeStatus="pending";childBridgeRestartInProgress=!1;defaultIcon="assets/hb-icon.png";isMobile;setChildBridges=[];hb2Status="unknown";serviceMode=this.$settings.env.serviceMode;set childBridges(e){this.hasChildBridges=e.length>0,this.hasUnpairedChildBridges=e.filter(u=>u.paired===!1).length>0,this.allChildBridgesStopped=e.filter(u=>u.manuallyStopped===!0).length===e.length,this.hasChildBridges&&(e.some(u=>u.status==="down")?this.childBridgeStatus="down":e.some(u=>u.status==="pending")?this.childBridgeStatus="pending":e.some(u=>u.status==="ok")&&(this.childBridgeStatus="ok")),this.setChildBridges=e;let o=this.$settings.env.homebridgeVersion.split(".")[0],i=this.plugin.engines?.homebridge?.split("||").map(u=>u.trim())||[];this.hb2Status=o==="2"?"hide":i.some(u=>u.startsWith("^2")||u.startsWith(">=2"))?"supported":this.hb2Status}ngOnInit(){this.isMobile=this.$md.detect.mobile(),this.io=this.$ws.getExistingNamespace("child-bridges"),this.isMobile&&this.plugin.displayName.toLowerCase().startsWith("homebridge ")&&(this.plugin.displayName=this.plugin.displayName.replace(/^homebridge /i,"")),this.plugin.icon||(this.plugin.icon=this.defaultIcon)}openFundingModal(e){let o=this.$modal.open(Te,{size:"lg",backdrop:"static"});o.componentInstance.plugin=e}pluginInfoModal(e){let o=this.$modal.open(Ve,{size:"lg",backdrop:"static"});o.componentInstance.plugin=e}disablePlugin(e){let o=this.$modal.open(Ie,{size:"lg",backdrop:"static"});o.componentInstance.pluginName=e.displayName,o.componentInstance.isConfigured=e.isConfigured,o.componentInstance.isConfiguredDynamicPlatform=e.isConfiguredDynamicPlatform,o.result.then(()=>k(this,null,function*(){try{yield D(this.$api.put(`/config-editor/plugin/${encodeURIComponent(e.name)}/disable`,{})),e.disabled=!0,this.hasChildBridges&&this.doChildBridgeAction("stop"),this.$modal.open(H,{size:"lg",backdrop:"static"})}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.disable.error"),this.$translate.instant("toast.title_error"))}}))}enablePlugin(e){let o=this.$modal.open(ye,{size:"lg",backdrop:"static"});o.componentInstance.title=e.name,o.componentInstance.message=this.$translate.instant("plugins.manage.confirm_enable",{pluginName:e.displayName}),o.componentInstance.confirmButtonLabel=this.$translate.instant("plugins.manage.enable"),o.componentInstance.faIconClass="fa-circle-play primary-text",o.result.then(()=>k(this,null,function*(){try{yield D(this.$api.put(`/config-editor/plugin/${encodeURIComponent(e.name)}/enable`,{})),e.disabled=!1,this.hasChildBridges&&(yield this.doChildBridgeAction("start")),this.$modal.open(H,{size:"lg",backdrop:"static"})}catch(i){console.error(i),this.$toastr.error(this.$translate.instant("plugins.enable.error"),this.$translate.instant("toast.title_error"))}}))}viewPluginLog(){let e=this.$modal.open(ke,{size:"xl",backdrop:"static"});e.componentInstance.plugin=this.plugin}doChildBridgeAction(e){return k(this,null,function*(){this.childBridgeRestartInProgress=!0;try{for(let o of this.setChildBridges)yield D(this.io.request(`${e}-child-bridge`,o.username))}catch(o){console.error(o),this.$toastr.error(this.$translate.instant("plugins.bridge.action_error",{action:e}),this.$translate.instant("toast.title_error")),this.childBridgeRestartInProgress=!1}finally{setTimeout(()=>{this.childBridgeRestartInProgress=!1},e==="restart"?12e3:e==="stop"?6e3:1e3)}})}handleIconError(){this.plugin.icon=this.defaultIcon}checkAndUpdatePlugin(){this.$plugin.checkAndUpdatePlugin(this.plugin,this.plugin.latestVersion)}openSettings(){this.$plugin.settings(this.plugin)}openBridgeSettings(){this.$plugin.bridgeSettings(this.plugin)}switchToScoped(){this.$plugin.switchToScoped(this.plugin)}installAlternateVersion(){this.$plugin.installAlternateVersion(this.plugin)}openJsonEditor(){this.$plugin.jsonEditor(this.plugin)}uninstallPlugin(){this.$plugin.uninstallPlugin(this.plugin,this.setChildBridges)}resetChildBridges(){this.$plugin.resetChildBridges(this.setChildBridges)}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["app-plugin-card"]],inputs:{plugin:"plugin",childBridges:"childBridges"},decls:35,vars:23,consts:[[1,"card","card-body","mb-3"],[1,"d-flex","flex-row","justify-content-between"],[1,"d-flex","flex-column","me-3","align-items-center","justify-content-between"],["alt","Plugin Icon",1,"plugin-icon-card","mb-3",3,"error","src"],[1,"d-flex","flex-column","justify-content-between",2,"min-width","calc(100% - 80px)"],[1,"d-flex","flex-row","align-items-end"],[1,"d-flex","flex-column","w-100"],[1,"d-flex","flex-row"],[1,"card-title","mb-2","text-truncate"],[1,"ms-auto"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover",1,"card-link",3,"ngbTooltip"],[1,"fas","fa-fw","fa-spinner","fa-pulse","fa-lg","grey-text","ms-3",3,"hidden"],[1,"fas","fa-fw","fa-lg","ms-3",3,"ngClass"],[1,"card-text","mb-2","text-truncate"],["href","javascript:void(0)",1,"card-link",3,"click"],[1,"fas","fa-fw","fa-shield-alt","fa-lg","me-1",3,"ngClass"],[1,"grey-text"],[1,"card-text","mb-2"],["href","javascript:void(0)",1,"card-link"],[1,"card-text","mb-0","grey-text"],["href","javascript:void(0)",1,"card-link","red-text"],["href","javascript:void(0)"],["ngbDropdown","","placement","left",1,"d-inline-block","ms-3","mt-auto"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover",1,"card-link",3,"click","ngbTooltip"],[1,"far","fa-fw","fa-arrow-alt-circle-up","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-arrow-right-arrow-left","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-sliders","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"icon-button","fas","fa-fw","fa-bridge","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"icon-button","fas","fa-fw","fa-qrcode","primary-text","fa-lg","fa-fade","ms-3",2,"--fa-animation-duration","2s"],[1,"fas","fa-fw","fa-heart","fa-lg","me-1","pink-text"],[1,"fas","fa-fw","fa-heart","fa-lg","me-1",2,"opacity","0.5"],[1,"far","fa-fw","fa-circle-dot","fa-lg","me-1"],[1,"far","fa-fw","fa-circle-check","fa-lg","me-1"],[1,"fas","fa-fw","fa-lg","fa-power-off","ms-3"],["href","javascript:void(0)",1,"card-link","red-text",3,"click"],["container","body","openDelay","150","triggers","hover",1,"far","fa-fw","fa-pause-circle","fa-lg",3,"ngbTooltip"],["href","javascript:void(0)",3,"click"],[1,"far","fa-fw","fa-arrow-alt-circle-down","fa-lg"],["href","javascript:void(0)","ngbDropdownToggle","",1,"card-link","text-decoration-none","mt-auto",2,"outline","none"],[1,"fa-solid","fa-fw","fa-ellipsis-v","fa-lg"],["ngbDropdownMenu","","aria-labelledby","Plugin Actions Dropdown"],["ngbDropdownItem","",3,"click"],[1,"fas","fa-fw","fa-sliders"],["ngbDropdownItem",""],[1,"dropdown-divider"],["ngbDropdownItem","","rel","noopener noreferrer","target","_blank",3,"href"],[1,"fas","fa-fw","fa-wave-square"],[1,"fas","fa-fw","fa-code-compare"],[1,"fas","fa-fw","fa-code"],[1,"far","fa-fw","fa-circle-pause"],[1,"far","fa-fw","fa-circle-play"],[1,"fas","fa-fw","fa-trash"],[1,"fas","fa-fw","fa-bridge"],[1,"fa-fw","icon-button","fas","fa-fw","fa-power-off"],[1,"fas","fa-fw","fa-stop"],[1,"fas","fa-fw","fa-play"],[1,"fas","fa-fw","fa-broom"],[1,"icon-button","fas","fa-fw","fa-bridge"],[1,"icon-button","fa","fa-fw","fa-question-circle-o"]],template:function(o,i){o&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"img",3),_("error",function(){return i.handleIconError()}),l()(),a(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7)(8,"h5",8),c(9),l(),a(10,"div",9),m(11,Ye,4,6,"a",10),m(12,Ze,4,6,"a",10),m(13,ei,4,6,"a",10),m(14,ii,4,6,"a",10),m(15,ti,4,6,"a",10),d(16,"i",11),m(17,ni,1,4,"i",12),l()(),a(18,"p",13)(19,"a",14),_("click",function(){return i.pluginInfoModal(i.plugin)}),d(20,"i",15),a(21,"span",16),c(22),l()()(),a(23,"p",17),m(24,ai,4,1,"a",18),m(25,oi,3,1,"span",16),l(),a(26,"div",7)(27,"p",19),m(28,ri,5,2,"span"),m(29,si,2,1),l(),a(30,"div",9),m(31,di,3,3,"a",10),m(32,pi,3,3,"a",20),m(33,ci,2,0,"a",21),m(34,Vi,22,18,"span",22),l()()()()()()()),o&2&&(n(3),C("src",i.plugin.icon,T),n(6),h(i.plugin.displayName),n(2),g(i.plugin.installedVersion&&i.plugin.updateAvailable&&!i.childBridgeRestartInProgress?11:-1),n(),g(i.plugin.installedVersion&&(i.plugin.newHbScope==null?null:i.plugin.newHbScope.switch)===i.plugin.installedVersion&&!i.childBridgeRestartInProgress?12:-1),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&!i.plugin.isConfigured&&!i.childBridgeRestartInProgress&&!i.plugin.disabled?13:-1),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&i.plugin.isConfigured&&!i.plugin.hasChildBridges&&!i.plugin.disabled&&i.plugin.recommendChildBridge&&!i.childBridgeRestartInProgress?14:-1),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&i.plugin.isConfigured&&i.plugin.hasChildBridges&&!i.childBridgeRestartInProgress&&i.hasUnpairedChildBridges&&i.childBridgeStatus==="ok"&&!i.plugin.disabled?15:-1),n(),C("hidden",!i.childBridgeRestartInProgress),n(),g(i.plugin.installedVersion&&(!i.plugin.newHbScope||i.plugin.newHbScope.switch!==i.plugin.installedVersion)&&!i.plugin.updateAvailable&&i.plugin.isConfigured&&i.plugin.hasChildBridges&&!i.childBridgeRestartInProgress&&!i.hasUnpairedChildBridges&&i.childBridgeStatus!=="ok"&&!i.plugin.disabled?17:-1),n(3),C("ngClass",ne(19,Ke,i.plugin.isHbScoped,!i.plugin.isHbScoped&&(i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin),!i.plugin.isHbScoped&&!i.plugin.verifiedPlugin&&!i.plugin.verifiedPlusPlugin)),n(2),h(i.plugin.name),n(2),g((i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)&&i.plugin.funding?24:-1),n(),g((i.plugin.verifiedPlugin||i.plugin.verifiedPlusPlugin)&&i.plugin.funding?-1:25),n(3),g(i.plugin.publicPackage&&!i.plugin.installedVersion?28:-1),n(),g(i.plugin.installedVersion?29:-1),n(2),g(!i.plugin.disabled&&i.plugin.hasChildBridges&&i.childBridgeStatus==="ok"?31:-1),n(),g(i.plugin.installedVersion&&i.plugin.disabled?32:-1),n(),g(i.plugin.publicPackage&&!i.plugin.installedVersion?33:-1),n(),g(i.plugin.installedVersion?34:-1))},dependencies:[U,M,xe,ve,be,he,Ce,oe,B],encapsulation:2})}return t})();var Me=(()=>{class t{$activeModal=P($);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],decls:27,vars:21,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,"mb-0"],[3,"innerHTML"],[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(o,i){o&1&&(a(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),c(4),r(5,"translate"),l(),a(6,"button",3),r(7,"translate"),_("click",function(){return i.dismissModal()}),l()(),a(8,"div",4)(9,"div",5),d(10,"i",6),l(),a(11,"ul",7),d(12,"li",8),r(13,"translate"),d(14,"li",8),r(15,"translate"),d(16,"li",8),r(17,"translate"),d(18,"li",8),r(19,"translate"),l()(),a(20,"div",9),d(21,"div",10),a(22,"div",11)(23,"button",12),_("click",function(){return i.dismissModal()}),c(24),r(25,"translate"),l()(),d(26,"div",13),l()()()),o&2&&(n(4),h(s(5,7,"support.title")),n(2),y("aria-label",s(7,9,"form.button_close")),n(6),C("innerHTML",s(13,11,"plugins.support.list_1"),N),n(2),C("innerHTML",s(15,13,"plugins.support.list_2"),N),n(2),C("innerHTML",s(17,15,"plugins.support.list_3"),N),n(2),C("innerHTML",s(19,17,"plugins.support.list_4"),N),n(6),b(" ",s(25,19,"form.button_close")," "))},dependencies:[B],encapsulation:2})}return t})();var Ei=["searchInput"],Mi=(t,p)=>({"fa-magnifying-glass":t,"fa-exclamation-circle":p});function $i(t,p){t&1&&d(0,"app-spinner")}function Di(t,p){if(t&1){let e=w();a(0,"a",15),_("click",function(){v(e);let i=f(3);return x(i.onClearSearch())}),d(1,"i",16),l()}}function Ni(t,p){if(t&1){let e=w();a(0,"div",9)(1,"div",11)(2,"form",12),_("ngSubmit",function(){v(e);let i=f(2);return x(i.onSubmit(i.form))}),d(3,"input",13,0),r(5,"translate"),m(6,Di,2,0,"a",14),l()()()}if(t&2){let e=f(2);n(2),C("formGroup",e.form),n(),C("placeholder",s(5,3,"plugins.placeholder_search_plugin")),n(3),g(e.showExitButton?6:-1)}}function Hi(t,p){if(t&1&&(a(0,"div",17),d(1,"app-plugin-card",19),l()),t&2){let e=p.$implicit,o=f(3);n(),C("plugin",e)("childBridges",o.getPluginChildBridges(e))}}function Ai(t,p){if(t&1&&(a(0,"div",18),d(1,"i",20),a(2,"p"),c(3),r(4,"translate"),l()()),t&2){let e=f(3);n(),C("ngClass",I(4,Mi,!e.showExitButton,e.showExitButton)),n(2),h(s(4,2,e.showExitButton?"plugins.placeholder_search_none":"plugins.placeholder_search_first"))}}function ji(t,p){if(t&1&&(a(0,"div",10),F(1,Hi,2,2,"div",17,j),m(3,Ai,5,7,"div",18),l()),t&2){let e=f(2);n(),z(e.installedPlugins),n(2),g(e.installedPlugins.length===0&&!e.loading&&!e.mainError?3:-1)}}function Fi(t,p){if(t&1&&(m(0,Ni,7,5,"div",9),m(1,ji,4,1,"div",10)),t&2){let e=f();g(e.showSearchBar?0:-1),n(),g(e.loading?-1:1)}}function zi(t,p){t&1&&(a(0,"div",21)(1,"div",22)(2,"code"),c(3,"https://developers.homebridge.io/analytics "),a(4,"a",23),d(5,"i",24),l()()(),a(6,"div",25),c(7),r(8,"translate"),l()(),d(9,"iframe",26)),t&2&&(n(7),h(s(8,1,"plugins.stats_note")))}var Yt=(()=>{class t{searchInput;$api=P(L);$modal=P(O);$plugin=P(Q);$router=P(Pe);$settings=P(G);$toastr=P(R);$translate=P(q);$ws=P(W);isSearchMode=!1;io;navigationSubscription;mainError=!1;loading=!0;tab="main";installedPlugins=[];childBridges=[];showSearchBar=!1;showExitButton=!1;form=new de({query:new pe("")});ngOnInit(){return k(this,null,function*(){this.io=this.$ws.connectToNamespace("child-bridges"),this.io.connected.subscribe(()=>k(this,null,function*(){this.getChildBridgeMetadata(),this.io.socket.emit("monitor-child-bridge-status"),yield this.loadInstalledPlugins(),this.installedPlugins.length||this.showSearch();let{action:e,plugin:o}=this.$router.parseUrl(this.$router.url).queryParams;if(e){let i=this.installedPlugins.find(u=>u.name===o);switch(e){case"just-installed":{i&&(i.isConfigured?this.$modal.open(H,{size:"lg",backdrop:"static"}):this.$plugin.settings(i));break}case"open-manage-version":{i&&this.$plugin.installAlternateVersion(i);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}})),this.io.socket.on("child-bridge-status-update",e=>{let o=this.childBridges.find(i=>i.username===e.username);o?Object.assign(o,e):this.childBridges.push(e)}),this.navigationSubscription=this.$router.events.subscribe(e=>{e instanceof we&&this.loadInstalledPlugins()})})}search(){this.installedPlugins=[],this.loading=!0,this.showExitButton=!0,this.$api.get(`/plugins/search/${encodeURIComponent(this.form.value.query)}`).subscribe({next:e=>{let o=new Set;this.installedPlugins=e.reduce((i,u)=>{if(u.name==="homebridge-config-ui-x"||o.has(u.name))return i;if(u.newHbScope){let Y=u.newHbScope.to,$e=e.some(De=>De.name===Y);(u.installedVersion||!$e)&&(o.add(Y),i.push(u))}else i.push(u);return i},[]),this.appendMetaInfo(),this.loading=!1},error:e=>{this.loading=!1,this.isSearchMode=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error")),this.loadInstalledPlugins()}})}onClearSearch(){this.loadInstalledPlugins()}onSubmit({value:e}){e.query.length?(this.isSearchMode=!0,this.search()):this.isSearchMode&&(this.isSearchMode=!1,this.loadInstalledPlugins())}showSearch(){this.showSearchBar?(this.showSearchBar=!1,this.isSearchMode&&(this.isSearchMode=!1,this.form.setValue({query:""}),this.loadInstalledPlugins())):(window.document.querySelector("body").classList.remove("bg-black"),this.tab="main",this.showSearchBar=!0,setTimeout(()=>this.searchInput.nativeElement.focus(),0))}showStats(){this.tab==="stats"?(window.document.querySelector("body").classList.remove("bg-black"),this.tab="main"):(window.document.querySelector("body").classList.add("bg-black"),this.tab="stats",this.showSearchBar=!1)}openSupport(){this.$modal.open(Me,{size:"lg",backdrop:"static"})}ngOnDestroy(){window.document.querySelector("body").classList.remove("bg-black"),this.navigationSubscription&&this.navigationSubscription.unsubscribe(),this.io.end()}getPluginChildBridges(e){return this.childBridges.filter(o=>o.plugin===e.name)}loadInstalledPlugins(){return k(this,null,function*(){this.form.setValue({query:""}),this.showExitButton=!1,this.installedPlugins=[],this.loading=!0,this.mainError=!1;try{let e=yield D(this.$api.get("/plugins"));this.installedPlugins=e.filter(i=>i.name!=="homebridge-config-ui-x"),yield this.appendMetaInfo();let o=this.installedPlugins.sort((i,u)=>i.updateAvailable!==u.updateAvailable?i.updateAvailable?-1:1:i.newHbScope&&!u.newHbScope?-1:i.disabled!==u.disabled?i.disabled?1:-1:i.isConfigured!==u.isConfigured?i.isConfigured?1:-1:i.hasChildBridgesUnpaired!==u.hasChildBridgesUnpaired?i.hasChildBridgesUnpaired?-1:1:i.hasChildBridges!==u.hasChildBridges&&this.$settings.env.recommendChildBridges?i.hasChildBridges?1:-1:i.name.localeCompare(u.name));return this.loading=!1,o}catch(e){console.error(e),this.loading=!1,this.mainError=!0,this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}appendMetaInfo(){return k(this,null,function*(){yield Promise.all(this.installedPlugins.filter(e=>e.installedVersion).map(e=>k(this,null,function*(){try{let o=yield D(this.$api.get(`/config-editor/plugin/${encodeURIComponent(e.name)}`));e.isConfigured=o.length>0,e.isConfiguredDynamicPlatform=e.isConfigured&&Object.prototype.hasOwnProperty.call(o[0],"platform"),e.recommendChildBridge=e.isConfiguredDynamicPlatform&&this.$settings.env.recommendChildBridges&&this.$settings.env.serviceMode&&!["homebridge","homebridge-config-ui-x"].includes(e.name),e.hasChildBridges=e.isConfigured&&o.some(u=>u._bridge&&u._bridge.username);let i=this.getPluginChildBridges(e);e.hasChildBridgesUnpaired=i.some(u=>!u.paired),this.$settings.env.plugins?.hideUpdatesFor?.includes(e.name)&&(e.updateAvailable=!1)}catch{e.isConfigured=!0,e.hasChildBridges=!0}})))})}getChildBridgeMetadata(){this.io.request("get-homebridge-child-bridge-status").subscribe(e=>{this.childBridges=e})}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=S({type:t,selectors:[["ng-component"]],viewQuery:function(o,i){if(o&1&&ee(Ei,5),o&2){let u;ie(u=te())&&(i.searchInput=u.first)}},decls:20,vars:26,consts:[["searchInput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","ngbTooltip"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2","d-none","d-md-inline-block",3,"click","ngbTooltip"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-fw","fa-question-circle-o"],[1,"row"],[1,"d-flex","flex-wrap","justify-content-between"],[1,"col-md-12"],["novalidate","",3,"ngSubmit","formGroup"],["type","text","formControlName","query",1,"hb-npm-search",3,"placeholder"],["href","javascript:void(0)",1,"hb-npm-search-clear"],["href","javascript:void(0)",1,"hb-npm-search-clear",3,"click"],[1,"far","fa-fw","fa-times-circle"],[1,"hb-plugin-space-between"],[1,"alert","alert-info","mt-4","text-center","w-100"],[3,"plugin","childBridges"],[1,"fas","fa-fw","primary-text","my-3",2,"font-size","75px",3,"ngClass"],[1,"w-100","py-3","hb-stats-header","text-white","text-center"],[1,"mb-2"],["href","https://developers.homebridge.io/analytics","target","_blank"],[1,"fa","fa-fw","fa-external-link"],[1,"small","grey-text"],["src",Z`https://developers.homebridge.io/analytics/`,"sandbox","allow-scripts allow-same-origin allow-popups","referrerpolicy","no-referrer",1,"hb-stats"]],template:function(o,i){o&1&&(m(0,$i,1,0,"app-spinner"),a(1,"div",1)(2,"div",2)(3,"h3",3),c(4),r(5,"translate"),l()(),a(6,"div",4)(7,"button",5),r(8,"translate"),r(9,"translate"),_("click",function(){return i.showSearch()}),d(10,"i"),l(),a(11,"button",6),r(12,"translate"),r(13,"translate"),_("click",function(){return i.showStats()}),d(14,"i"),l(),a(15,"button",7),r(16,"translate"),_("click",function(){return i.openSupport()}),d(17,"i",8),l()()(),m(18,Fi,2,2)(19,zi,10,3)),o&2&&(g(i.loading?0:-1),n(4),h(s(5,14,"menu.label_plugins")),n(3),C("ngbTooltip",s(8,16,"plugins.search")),y("aria-label",s(9,18,"plugins.search")),n(3),J(K("fas fa-fw",i.showSearchBar?" primary-text":""," fa-search")),n(),C("ngbTooltip",s(12,20,"plugins.stats")),y("aria-label",s(13,22,"plugins.stats")),n(3),J(K("fas fa-fw",i.tab==="stats"?" primary-text":""," fa-sliders")),n(),y("aria-label",s(16,24,"support.title")),n(3),g(i.tab==="main"?18:i.tab==="stats"?19:-1))},dependencies:[Se,ge,ce,le,re,se,fe,ue,me,Ee,B,M,U],styles:[".hb-npm-search[_ngcontent-%COMP%]{outline:none;box-sizing:inherit!important;background-color:inherit;height:50px!important;width:100%;border-width:.5px;padding:10px;margin-bottom:15px}@media (hover: hover){.hb-npm-search[_ngcontent-%COMP%]:hover{border:1px solid #000000}}.hb-npm-search[_ngcontent-%COMP%]:focus{border:1px solid #000000;box-shadow:0 1px #000}.hb-npm-search-clear[_ngcontent-%COMP%]{position:absolute;right:25px;font-size:35px;color:#d0d0d0;line-height:50px;cursor:pointer}.hb-plugin-space-between[_ngcontent-%COMP%]{box-sizing:border-box;width:calc(50% - 6.6666666667px)}@media only screen and (max-width: 991px){.hb-plugin-space-between[_ngcontent-%COMP%]{width:100%}}.hb-stats-header[_ngcontent-%COMP%]{background:#242424;border-top-left-radius:.5rem;border-top-right-radius:.5rem}.hb-stats-header[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{border:1px solid grey;border-radius:5px;padding:5px;font-size:.8rem;color:#d3d3d3}.hb-stats[_ngcontent-%COMP%]{height:calc(100% - 121px);width:100%;overflow:hidden;border-bottom-left-radius:.5rem;border-bottom-right-radius:.5rem}@media (max-width: 767px){.hb-stats[_ngcontent-%COMP%]{height:calc(100% - 60px)}}"]})}return t})();export{Yt as PluginsComponent};
@@ -1 +1 @@
1
- import{c as i}from"./chunk-45AWUQUI.js";import{b as t}from"./chunk-QDCKP2LU.js";import{ha as o,nb as r}from"./chunk-SKZUTSHE.js";var f=(()=>{class e{static \u0275fac=function(s){return new(s||e)};static \u0275mod=r({type:e});static \u0275inj=o({providers:[i],imports:[t]})}return e})();export{f as a};
1
+ import{c as i}from"./chunk-RLOI75RN.js";import{b as t}from"./chunk-QDCKP2LU.js";import{ha as o,nb as r}from"./chunk-SKZUTSHE.js";var f=(()=>{class e{static \u0275fac=function(s){return new(s||e)};static \u0275mod=r({type:e});static \u0275inj=o({providers:[i],imports:[t]})}return e})();export{f as a};
@@ -1 +1 @@
1
- import{b as pe}from"./chunk-ASKYLUSK.js";import{m as le}from"./chunk-HZUGXGIE.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-SKZUTSHE.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=function(){let r=qe({xdomain:!1});return r&&r.responseType!==null}(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(this.opts.query)),se&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=5,h=function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r}(h||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,setTimeout(()=>{s.socket.connected&&s.connected.next(void 0)}),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};
1
+ import{b as pe}from"./chunk-274JKR5U.js";import{m as le}from"./chunk-FVUUWFZH.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-SKZUTSHE.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=function(){let r=qe({xdomain:!1});return r&&r.responseType!==null}(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(this.opts.query)),se&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=5,h=function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r}(h||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,setTimeout(()=>{s.socket.connected&&s.connected.next(void 0)}),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};