homebridge-config-ui-x 5.0.0-beta.86 → 5.0.0-beta.87
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.
- package/CHANGELOG.md +1 -2
- package/config.schema.json +0 -12
- package/dist/core/auth/auth.controller.d.ts +6 -0
- package/dist/core/config/config.service.d.ts +6 -0
- package/dist/core/config/config.service.js +6 -0
- package/dist/core/config/config.service.js.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/public/{chunk-F3P3PZQR.js → chunk-27LWKA5O.js} +1 -1
- package/public/chunk-2PUN6OXU.js +1 -0
- package/public/chunk-36XAMCOW.js +1 -0
- package/public/{chunk-7AZ4UU6X.js → chunk-4EPSNG66.js} +1 -1
- package/public/{chunk-TMMFITOH.js → chunk-4P3YKW2O.js} +1 -1
- package/public/{chunk-SX4HEBEE.js → chunk-4URM6URV.js} +1 -1
- package/public/{chunk-2PUMXV54.js → chunk-5CFJ4DV6.js} +1 -1
- package/public/{chunk-OE5UHUN3.js → chunk-5K7D2D6A.js} +1 -1
- package/public/{chunk-OTS6PS3Z.js → chunk-67F2Y7DS.js} +1 -1
- package/public/{chunk-QUACBYEX.js → chunk-6PYKTBHO.js} +1 -1
- package/public/{chunk-FXR7CTH7.js → chunk-6XMFLNU7.js} +1 -1
- package/public/{chunk-NF4IEKEP.js → chunk-73PJIGAV.js} +1 -1
- package/public/chunk-AARVIYA5.js +1 -0
- package/public/{chunk-6B2RZNXN.js → chunk-ADE5INQ2.js} +1 -1
- package/public/{chunk-IWA3TOG2.js → chunk-AJKHBFNR.js} +1 -1
- package/public/{chunk-VJBLBCZM.js → chunk-ARI67CJA.js} +1 -1
- package/public/{chunk-F22JGE7A.js → chunk-B5LZFPRU.js} +1 -1
- package/public/{chunk-NGOJKCBK.js → chunk-C7SK7L5N.js} +1 -1
- package/public/chunk-DF62MBO5.js +1 -0
- package/public/{chunk-3BS4LV54.js → chunk-DJPZLBO3.js} +1 -1
- package/public/{chunk-IFICSVUO.js → chunk-EOAYXYQ4.js} +1 -1
- package/public/{chunk-A7NP35TI.js → chunk-FKGZPNJ4.js} +1 -1
- package/public/chunk-FNL2AMXL.js +1 -0
- package/public/{chunk-MHCIZSEW.js → chunk-FVSPQU2F.js} +1 -1
- package/public/{chunk-USP3JGJG.js → chunk-GVCMBJAF.js} +1 -1
- package/public/{chunk-T4ATDPUM.js → chunk-HANCTG3M.js} +1 -1
- package/public/{chunk-NTUIMSK6.js → chunk-HTJGZYE4.js} +1 -1
- package/public/{chunk-UDDEGACW.js → chunk-KD5JTXWT.js} +1 -1
- package/public/chunk-KFX3POZB.js +1 -0
- package/public/{chunk-OB3DRFUW.js → chunk-KWODTKXR.js} +1 -1
- package/public/{chunk-MH5ZUPB5.js → chunk-MDK4724K.js} +1 -1
- package/public/{chunk-BG2WSSJ4.js → chunk-MJA6JPIO.js} +1 -1
- package/public/chunk-MS3P7X5X.js +1 -0
- package/public/{chunk-BF4EH34O.js → chunk-N4KFGJXF.js} +1 -1
- package/public/chunk-NALK3C3T.js +1 -0
- package/public/{chunk-B454JU5N.js → chunk-NCDPP754.js} +1 -1
- package/public/{chunk-XY3PFHZ6.js → chunk-O5M4Y3EW.js} +1 -1
- package/public/{chunk-JBSOG3K2.js → chunk-PGU6ZPDG.js} +1 -1
- package/public/chunk-PHNCE4TO.js +1 -0
- package/public/{chunk-QDQR3ZJF.js → chunk-PXQNRPCJ.js} +1 -1
- package/public/{chunk-UVLB2ENM.js → chunk-RJL37MU5.js} +1 -1
- package/public/chunk-RKLEHQ2B.js +1 -0
- package/public/chunk-SFYKSRBS.js +1 -0
- package/public/{chunk-RJGZEV2W.js → chunk-TMPLMSHL.js} +1 -1
- package/public/chunk-TOQUDHZB.js +1 -0
- package/public/{chunk-4OFN5X2Y.js → chunk-TVFCWMGX.js} +1 -1
- package/public/{chunk-XWCZPT6A.js → chunk-UNQXYIYI.js} +1 -1
- package/public/{chunk-YHWBUU7X.js → chunk-VCRQ4UF3.js} +1 -1
- package/public/{chunk-WGMA3BLJ.js → chunk-VFLSRHMQ.js} +1 -1
- package/public/{chunk-IWVLVUZD.js → chunk-VKQVVM6L.js} +1 -1
- package/public/chunk-WNFURZ5P.js +1 -0
- package/public/{chunk-XNFNTTCN.js → chunk-XJGLANFN.js} +1 -1
- package/public/{chunk-G6RNKKPJ.js → chunk-XNVL6RGY.js} +1 -1
- package/public/{chunk-RVS3XXFW.js → chunk-Z5M44QAO.js} +1 -1
- package/public/{chunk-DZVDMMEY.js → chunk-ZC67UZ4Z.js} +1 -1
- package/public/{chunk-5JP4FXOB.js → chunk-ZLERUR4A.js} +1 -1
- package/public/{chunk-6XORWM6U.js → chunk-ZMQDMKMK.js} +1 -1
- package/public/{chunk-LAPG6TY4.js → chunk-ZOWDIZX6.js} +1 -1
- package/public/index.html +1 -1
- package/public/main-C46726NO.js +1 -0
- package/public/chunk-3ZJC6SVJ.js +0 -1
- package/public/chunk-AS2LLEEB.js +0 -1
- package/public/chunk-DTUCS6ZI.js +0 -1
- package/public/chunk-HZ4AZCZF.js +0 -1
- package/public/chunk-LSDTC764.js +0 -1
- package/public/chunk-NSB5ON2L.js +0 -1
- package/public/chunk-O36YZXBO.js +0 -1
- package/public/chunk-PDFRV7MA.js +0 -1
- package/public/chunk-RHO55I2P.js +0 -1
- package/public/chunk-RUCXK46A.js +0 -1
- package/public/chunk-W6FEQP6L.js +0 -1
- package/public/chunk-W6OMHBCB.js +0 -1
- package/public/chunk-WM2MFS26.js +0 -1
- package/public/main-5OJMP6YW.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as w}from"./chunk-QY7HUYL5.js";import{a as E}from"./chunk-
|
|
1
|
+
import{d as w}from"./chunk-QY7HUYL5.js";import{a as E}from"./chunk-ADE5INQ2.js";import{b}from"./chunk-AJKHBFNR.js";import{h as k,k as S}from"./chunk-ARI67CJA.js";import{a as $,b as T}from"./chunk-KPKQNEWS.js";import{$a as i,Ac as c,Bc as l,Cc as y,Hb as m,Ib as p,Nb as g,Ob as r,Pb as n,Qb as u,Xa as _,Yb as v,jc as o,kc as s,la as a,lb as x,wc as C}from"./chunk-QSPBB6EE.js";var I=t=>({command:t});function R(t,h){t&1&&(r(0,"p",7),o(1),c(2,"translate"),n()),t&2&&(i(),s(l(2,1,"restart.please_wait_while_server_restarts")))}function D(t,h){if(t&1&&(r(0,"div",8),o(1),n()),t&2){let e=v();i(),s(e.error)}}function B(t,h){t&1&&(r(0,"div",9)(1,"div",11),u(2,"i",12),n()())}function M(t,h){if(t&1&&(r(0,"div",10)(1,"p"),o(2),c(3,"translate"),n(),u(4,"p",13),c(5,"translate"),n()),t&2){let e=v();i(2),s(l(3,2,"platform.docker.server_long_time")),i(2),g("innerHTML",y(5,4,"platform.docker.run_with_restart",C(7,I,e.command)),_)}}var N=(()=>{class t{$api=a(S);$router=a(w);$settings=a(b);$toastr=a(k);$translate=a($);$ws=a(E);checkTimeout;checkDelay;resp={};timeout=!1;error=!1;command='<span class="font-monospace">--restart=always</span>';io;constructor(){}ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$api.put("/platform-tools/docker/restart-container",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{this.error=this.$translate.instant("restart.toast_server_restart_error"),console.error(e),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}})}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.docker.container_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},1e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},6e4)}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}static \u0275fac=function(d){return new(d||t)};static \u0275cmp=x({type:t,selectors:[["ng-component"]],decls:15,vars:10,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fab","fa-fw","fa-docker",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"grey-text"],[1,"alert","alert-error","my-4"],[1,"justify-content-center","my-4"],[1,"alert","alert-warning","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"],[1,"grey-text","mb-0",3,"innerHTML"]],template:function(d,f){d&1&&(r(0,"div",0)(1,"h3",1),o(2),c(3,"translate"),n()(),r(4,"div",2)(5,"div",3),u(6,"i",4),n(),r(7,"div",5)(8,"h4",6),o(9),c(10,"translate"),n(),m(11,R,3,3,"p",7),m(12,D,2,1,"div",8),m(13,B,3,0,"div",9),m(14,M,6,9,"div",10),n()()),d&2&&(i(2),s(l(3,6,"menu.restart.title")),i(7),s(l(10,8,"platform.docker.title_restarting")),i(2),p(f.error?-1:11),i(),p(f.error?12:-1),i(),p(f.error?-1:13),i(),p(f.timeout?14:-1))},dependencies:[T],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{N as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,b as a,c as u,d as g,e as C,f as M}from"./chunk-
|
|
1
|
+
import{a as l,b as a,c as u,d as g,e as C,f as M}from"./chunk-AARVIYA5.js";import{a as d}from"./chunk-4P3YKW2O.js";import{a as c}from"./chunk-EOAYXYQ4.js";import"./chunk-RJL37MU5.js";import"./chunk-SHW4IV7S.js";import"./chunk-XJY7A24W.js";import"./chunk-TIE2WSHM.js";import"./chunk-6SEBWKRM.js";import"./chunk-ZC67UZ4Z.js";import"./chunk-DSBAEBB7.js";import"./chunk-ZCCLGLMW.js";import"./chunk-HHPGR3HF.js";import"./chunk-6M524CF7.js";import{q as s}from"./chunk-OHFVMRCL.js";import{A as p,z as n}from"./chunk-MMYB2ZMV.js";import{g as m}from"./chunk-QY7HUYL5.js";import"./chunk-ADE5INQ2.js";import"./chunk-4EPSNG66.js";import"./chunk-AJKHBFNR.js";import"./chunk-ARI67CJA.js";import"./chunk-R3JWGCC5.js";import{c as f}from"./chunk-KPKQNEWS.js";import{ha as t,kd as i,mb as e}from"./chunk-QSPBB6EE.js";var N=[{path:"",loadComponent:()=>import("./chunk-WNFURZ5P.js").then(o=>o.SettingsComponent),canActivate:[d]}],R=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[m.forChild(N),m]})}return o})();var L=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[i,n,p,f,s,R,M,u,a,c,g,l,C]})}return o})();export{L as SettingsModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as w,k as S}from"./chunk-
|
|
1
|
+
import{h as w,k as S}from"./chunk-ARI67CJA.js";import{a as _,b as h}from"./chunk-KPKQNEWS.js";import{$a as e,Ac as s,Bc as m,Hb as d,Ib as c,Ob as n,Pb as i,Qb as u,Yb as v,jc as o,kc as a,la as p,lb as f}from"./chunk-QSPBB6EE.js";function y(t,C){t&1&&(n(0,"p",7),o(1),s(2,"translate"),i()),t&2&&(e(),a(m(2,1,"platform.linux.server_will_power_down")))}function g(t,C){if(t&1&&(n(0,"div",8),o(1),i()),t&2){let r=v();e(),a(r.error)}}var B=(()=>{class t{$api=p(S);$toastr=p(w);$translate=p(_);error=!1;constructor(){}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=f({type:t,selectors:[["ng-component"]],decls:13,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"grey-text"],[1,"alert","alert-error","my-4"]],template:function(l,x){l&1&&(n(0,"div",0)(1,"h3",1),o(2),s(3,"translate"),i()(),n(4,"div",2)(5,"div",3),u(6,"i",4),i(),n(7,"div",5)(8,"h4",6),o(9),s(10,"translate"),i(),d(11,y,3,3,"p",7),d(12,g,2,1,"div",8),i()()),l&2&&(e(2),a(m(3,4,"menu.restart.title")),e(7),a(m(10,6,"platform.linux.shutting_down_server")),e(2),c(x.error?-1:11),e(),c(x.error?12:-1))},dependencies:[h],encapsulation:2})}return t})();export{B as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-VCRQ4UF3.js";import{a as f}from"./chunk-PXQNRPCJ.js";import{q as u}from"./chunk-OHFVMRCL.js";import{A as p,z as n}from"./chunk-MMYB2ZMV.js";import{g as i}from"./chunk-QY7HUYL5.js";import"./chunk-ADE5INQ2.js";import"./chunk-4EPSNG66.js";import"./chunk-AJKHBFNR.js";import"./chunk-ARI67CJA.js";import"./chunk-R3JWGCC5.js";import{c as d}from"./chunk-KPKQNEWS.js";import{ha as t,kd as m,mb as r}from"./chunk-QSPBB6EE.js";var M=[{path:"",loadComponent:()=>import("./chunk-NALK3C3T.js").then(o=>o.SetupWizardComponent)}],l=(()=>{class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=r({type:o});static \u0275inj=t({imports:[i.forChild(M),i]})}return o})();var R=(()=>{class o{static \u0275fac=function(e){return new(e||o)};static \u0275mod=r({type:o});static \u0275inj=t({providers:[a],imports:[m,n,p,d,u,l,f]})}return o})();export{R as SetupWizardModule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as De}from"./chunk-EOAYXYQ4.js";import{w as ze}from"./chunk-RJL37MU5.js";import{b as et}from"./chunk-ZC67UZ4Z.js";import{a as Ye,b as Ze}from"./chunk-DSBAEBB7.js";import{g as oe,m as T,n as O,o as Ve}from"./chunk-OHFVMRCL.js";import{A as J,b as K,c as ie,e as q,f as ke,g as pe,i as ye,j as B,k as de,l as ne,m as we,n as Be,o as ae,p as Ee,q as Ie,r as $e,s as Te,t as Fe,u as Me,v as Ae,z as re}from"./chunk-MMYB2ZMV.js";import{d as H,e as Ne}from"./chunk-QY7HUYL5.js";import{a as Pe}from"./chunk-ADE5INQ2.js";import{b as Q}from"./chunk-AJKHBFNR.js";import{h as M,j as Re,k as A}from"./chunk-ARI67CJA.js";import{c as Ce,d as Se}from"./chunk-R3JWGCC5.js";import{a as F,b as I}from"./chunk-KPKQNEWS.js";import{$a as t,Ac as r,Bc as s,Cc as z,Gb as f,Hb as b,Ib as h,Kb as R,Lb as P,M as j,Mb as D,Nb as u,Ob as i,Pb as n,Qb as d,Ub as y,Xa as _e,Xb as x,Ya as ge,Yb as g,ac as be,bc as he,bd as L,cc as fe,g as le,gd as te,h as w,id as ve,jc as p,kc as c,la as C,lb as E,lc as _,qc as Y,ra as S,rc as Z,sa as k,sc as ee,vc as xe,w as N,wc as V,xc as $,yc as G}from"./chunk-QSPBB6EE.js";var ce=le(et(),1);var Ue=le(Ye(),1),He=le(Ze(),1);var tt=a=>({maxBackupSizeText:a});function it(a,m){if(a&1&&d(0,"input",10),a&2){let e=g(2);u("value",e.selectedBackup.fileName)}}function nt(a,m){if(a&1){let e=y();i(0,"input",12),x("change",function(l){S(e);let v=g(2);return k(v.handleRestoreFileInput(l.target.files))}),n()}}function at(a,m){if(a&1&&(i(0,"div",4)(1,"div",7),d(2,"i",8),n(),i(3,"ul",9)(4,"li"),p(5),r(6,"translate"),n(),i(7,"li"),p(8),r(9,"translate"),n(),i(10,"li"),p(11),r(12,"translate"),n(),i(13,"li"),p(14),r(15,"translate"),n()(),b(16,it,1,1,"input",10),b(17,nt,1,0,"input",11),n()),a&2){let e=g();t(5),c(s(6,6,"backup.restore_help_one")),t(3),c(s(9,8,"backup.restore_help_two")),t(3),c(z(12,10,"backup.restore_max_size",V(15,tt,e.maxFileSizeText))),t(3),c(s(15,13,"backup.restore_warning")),t(2),h(e.selectedBackup?16:-1),t(),h(e.selectedBackup?-1:17)}}function rt(a,m){if(a&1){let e=y();i(0,"button",18),r(1,"translate"),x("click",function(){S(e);let l=g(2);return k(l.$activeModal.dismiss("Dismiss"))}),p(2),r(3,"translate"),n()}if(a&2){let e=g(2);u("disabled",e.clicked),f("aria-label",s(1,3,"form.button_close")),t(2),_(" ",s(3,5,"form.button_close")," ")}}function ot(a,m){if(a&1){let e=y();i(0,"button",18),r(1,"translate"),x("click",function(){S(e);let l=g(2);return k(l.reopenBackupModal())}),p(2),r(3,"translate"),n()}if(a&2){let e=g(2);u("disabled",e.clicked),f("aria-label",s(1,3,"form.button_back")),t(2),_(" ",s(3,5,"form.button_back")," ")}}function st(a,m){a&1&&d(0,"i",19)}function lt(a,m){if(a&1&&(i(0,"span"),p(1),n()),a&2){let e=g(3);t(),_("",e.uploadPercent,"% - ")}}function pt(a,m){a&1&&(i(0,"span"),p(1," Extracting Archive"),n())}function dt(a,m){a&1&&(i(0,"span"),p(1),r(2,"translate"),n()),a&2&&(t(),_(" ",s(2,1,"backup.label_uploading")))}function ct(a,m){if(a&1&&(i(0,"span"),b(1,st,1,0,"i",19),b(2,lt,2,1,"span"),b(3,pt,2,0,"span"),b(4,dt,3,3,"span"),n()),a&2){let e=g(2);t(),h(!e.uploadPercent||e.uploadPercent===100?1:-1),t(),h(e.uploadPercent&&e.uploadPercent!==100?2:-1),t(),h(e.uploadPercent===100?3:-1),t(),h(e.uploadPercent!==100?4:-1)}}function mt(a,m){a&1&&(p(0),r(1,"translate")),a&2&&_(" ",s(1,1,"form.button_restore")," ")}function ut(a,m){if(a&1){let e=y();i(0,"div",6)(1,"div",13),b(2,rt,4,7,"button",14),b(3,ot,4,7,"button",14),n(),d(4,"div",15),i(5,"div",16)(6,"button",17),x("click",function(){S(e);let l=g();return k(l.onRestoreBackupClick())}),b(7,ct,5,4,"span"),b(8,mt,2,3),n()()()}if(a&2){let e=g();t(2),h(e.setupWizardRestore?2:-1),t(),h(e.setupWizardRestore?-1:3),t(3),u("disabled",!e.selectedBackup&&!e.selectedFile||e.clicked),t(),h(e.clicked?7:-1),t(),h(e.clicked?-1:8)}}function _t(a,m){if(a&1){let e=y();i(0,"div",6),d(1,"div",13),i(2,"div",15)(3,"button",20),x("click",function(){S(e);let l=g();return k(l.postBackupRestart())}),p(4),r(5,"translate"),n()(),d(6,"div",16),n()}a&2&&(t(4),_(" ",s(5,1,"menu.hbrestart.title")," "))}var Le=(()=>{class a{$activeModal=C(T);$api=C(A);$modal=C(O);$route=C(H);$toastr=C(M);$translate=C(F);$ws=C(Pe);setupWizardRestore=!1;selectedBackup=null;clicked=!1;maxFileSizeText=globalThis.backup.maxBackupSizeText;selectedFile;restoreInProgress=!1;restoreStarted=!1;restoreFailed=!1;restoreArchiveType="homebridge";uploadPercent=0;term=new Ue.Terminal;termTarget;fitAddon=new He.FitAddon;io;constructor(){}ngOnInit(){return w(this,null,function*(){this.io=this.$ws.connectToNamespace("backup"),this.termTarget=document.getElementById("plugin-log-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",e=>{this.term.write(e)}),this.setupWizardRestore&&(this.restoreStarted=!0,this.restoreInProgress=!0,this.startRestore())})}onRestoreBackupClick(){this.selectedBackup?this.restoreScheduledBackup():this.restoreArchiveType==="homebridge"?this.uploadHomebridgeArchive():this.restoreArchiveType==="hbfx"&&this.uploadHbfxArchive()}uploadHomebridgeArchive(){this.term.reset(),this.clicked=!0;let e=new FormData;e.append("restoreArchive",this.selectedFile,this.selectedFile.name),this.$api.post("/backup/restore",e).subscribe({next:()=>{this.restoreStarted=!0,this.restoreInProgress=!0,setTimeout(()=>{this.startRestore()},500),this.clicked=!1},error:o=>{console.error(o),this.$toastr.error(o.error?.message||this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error")),this.clicked=!1}})}restoreScheduledBackup(){return w(this,null,function*(){this.term.reset(),this.clicked=!0,this.$api.post(`/backup/scheduled-backups/${this.selectedBackup.id}/restore`,{}).subscribe({next:()=>{this.restoreStarted=!0,this.restoreInProgress=!0,setTimeout(()=>{this.startRestore()},500),this.clicked=!1},error:e=>{console.error(e),this.$toastr.error(e.error?.message||this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error")),this.clicked=!1}})})}startRestore(){return w(this,null,function*(){this.io.request("do-restore").subscribe({next:()=>{this.restoreInProgress=!1,this.$toastr.success(this.$translate.instant("backup.backup_restored"),this.$translate.instant("toast.title_success")),this.setupWizardRestore&&this.postBackupRestart()},error:e=>{this.restoreFailed=!0,console.error(e),this.$toastr.error(this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error"))}})})}uploadHbfxArchive(){this.term.reset(),this.clicked=!0;let e=new FormData;e.append("restoreArchive",this.selectedFile,this.selectedFile.name),this.$api.post("/backup/restore/hbfx",e,{reportProgress:!0,observe:"events"}).subscribe({next:o=>{o.type===Ce.UploadProgress?this.uploadPercent=Math.round(100*o.loaded/o.total):o instanceof Se&&(this.restoreStarted=!0,this.restoreInProgress=!0,setTimeout(()=>{this.startHbfxRestore()},500),this.clicked=!1)},error:o=>{this.clicked=!1,console.error(o),this.$toastr.error(o.error?.message||this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error"))}})}startHbfxRestore(){return w(this,null,function*(){this.io.request("do-restore-hbfx").subscribe({next:()=>{this.restoreInProgress=!1,this.$toastr.success(this.$translate.instant("backup.backup_restored"),this.$translate.instant("toast.title_success"))},error:e=>{this.restoreFailed=!0,console.error(e),this.$toastr.error(this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error"))}})})}handleRestoreFileInput(e){e.length?(this.selectedFile=e[0],this.selectedFile.name.endsWith(".hbfx")?this.restoreArchiveType="hbfx":this.restoreArchiveType="homebridge"):delete this.selectedFile}postBackupRestart(){this.$api.put("/backup/restart",{}).subscribe({next:()=>{this.$activeModal.close(!0),this.$route.navigate(["/"])},error:()=>{}})}reopenBackupModal(){this.$activeModal.dismiss(),this.$modal.open(se,{size:"lg",backdrop:"static"})}ngOnDestroy(){this.io.end()}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],inputs:{setupWizardRestore:"setupWizardRestore",selectedBackup:"selectedBackup"},decls:11,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],["id","plugin-log-output",1,"modal-body",3,"hidden"],[1,"modal-footer","justify-content-between"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-hard-drive","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","text","disabled","",1,"form-control","custom-input",3,"value"],["type","file","id","restoreFileUpload","accept","application/gzip, .gz, .hbfx",1,"form-control"],["type","file","id","restoreFileUpload","accept","application/gzip, .gz, .hbfx",1,"form-control",3,"change"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"fa","fa-fw","fa-circle-notch","fa-spin"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),b(7,at,18,17,"div",4),d(8,"div",5),b(9,ut,9,5,"div",6),b(10,_t,7,3,"div",6),n()),o&2&&(t(3),c(s(4,7,"backup.title_backup")),t(2),u("disabled",l.restoreInProgress),f("aria-label",s(6,9,"form.button_close")),t(2),h(!l.restoreStarted&&!l.setupWizardRestore?7:-1),t(),u("hidden",!l.restoreStarted),t(),h(!l.restoreStarted||l.restoreFailed===!0?9:-1),t(),h(!l.restoreInProgress&&l.restoreStarted?10:-1))},dependencies:[I],encapsulation:2})}return a})();var gt=(a,m)=>({"fa-arrow-right":a,"fa-cog fa-spin":m}),bt=a=>({backupTime:a,dayCount:7}),ht=(a,m)=>({"fa-trash":a,"fa-cog fa-spin":m}),ft=(a,m)=>({backupSize:a,maxBackupSizeText:m});function xt(a,m){if(a&1&&(i(0,"li",23)(1,"label",28),p(2),r(3,"translate"),n(),i(4,"div",29),d(5,"input",30),r(6,"translate"),n()()),a&2){let e=g();t(2),c(s(3,3,"backup.settings_path")),t(3),u("formControl",e.pathFormControl),f("aria-label",s(6,5,"backup.settings_path"))}}function vt(a,m){if(a&1&&(p(0),r(1,"date"),r(2,"translate")),a&2){let e=g(2);_(" ",z(2,4,"backup.scheduled_backup_time",V(7,bt,z(1,1,e.backupTime,"shortTime")))," ")}}function Ct(a,m){a&1&&(p(0),r(1,"translate")),a&2&&_(" ",s(1,1,"backup.scheduled_backup_disabled")," ")}function St(a,m){if(a&1&&(i(0,"span",33),r(1,"translate"),d(2,"i",40),p(3),n()),a&2){let e=g().$implicit;u("ngbTooltip",z(1,2,"backup.backup_exceeds_max_size",$(5,ft,e.size+"MB",e.maxBackupSizeText))),t(3),_(" ",e.size,"MB ")}}function kt(a,m){if(a&1&&(i(0,"span"),p(1),n()),a&2){let e=g().$implicit;t(),_(" ",e.size,"MB ")}}function yt(a,m){if(a&1){let e=y();i(0,"li",9)(1,"span")(2,"span",32),p(3),r(4,"date"),n(),d(5,"br"),i(6,"small",10),p(7),r(8,"date"),b(9,St,4,8,"span",33),b(10,kt,2,1,"span"),n()(),i(11,"span",34)(12,"button",35),r(13,"translate"),r(14,"translate"),x("click",function(){let l=S(e).$implicit,v=g(2);return k(v.restore(l))}),d(15,"i",36),n(),i(16,"button",37),r(17,"translate"),r(18,"translate"),x("click",function(){let l=S(e).$implicit,v=g(2);return k(v.download(l))}),d(19,"i",38),n(),i(20,"button",39),r(21,"translate"),r(22,"translate"),x("click",function(){let l=S(e).$implicit,v=g(2);return k(v.delete(l))}),d(23,"i",12),n()()()}if(a&2){let e=m.$implicit,o=g(2);t(2),u("ngbTooltip",e.fileName),t(),_(" ",z(4,15,e.timestamp,"mediumDate")," "),t(4),_(" ",z(8,18,e.timestamp,"shortTime")," \xB7 "),t(2),h(e.size>e.maxBackupSize?9:-1),t(),h(e.size<=e.maxBackupSize?10:-1),t(2),u("disabled",o.clicked||o.deleting||e.size>e.maxBackupSize)("ngbTooltip",s(13,21,"form.button_restore")),f("aria-label",s(14,23,"form.button_restore")),t(4),u("disabled",o.clicked||o.deleting)("ngbTooltip",s(17,25,"form.button_download")),f("aria-label",s(18,27,"form.button_download")),t(4),u("disabled",o.clicked||o.deleting)("ngbTooltip",s(21,29,"form.button_delete")),f("aria-label",s(22,31,"form.button_delete")),t(3),u("ngClass",$(33,ht,e.id!==o.deleting,e.id===o.deleting))}}function wt(a,m){if(a&1&&(i(0,"ul",14)(1,"li",15)(2,"h6",16),p(3),r(4,"translate"),n(),i(5,"p",31),b(6,vt,3,9),b(7,Ct,2,3),n()(),P(8,yt,24,36,"li",9,R),n()),a&2){let e=g();t(3),c(s(4,3,"backup.files_auto")),t(3),h(e.currentSettingEnabled&&e.backupTime?6:-1),t(),h(!e.currentSettingEnabled||!e.backupTime?7:-1),t(),D(e.scheduledBackups)}}var se=(()=>{class a{$activeModal=C(T);$api=C(A);$modal=C(O);$settings=C(Q);$toastr=C(M);$translate=C(F);clicked=!1;scheduledBackups=[];backupTime;deleting=null;currentSettingEnabled=!1;currentSettingPath="";enabledFormControl=new B(!1);pathFormControl=new B("");constructor(){}ngOnInit(){this.getScheduledBackups(),this.getNextBackup(),this.currentSettingEnabled=!this.$settings.env.scheduledBackupDisable,this.currentSettingPath=this.$settings.env.scheduledBackupPath,this.enabledFormControl.patchValue(this.currentSettingEnabled),this.pathFormControl.patchValue(this.currentSettingPath),this.enabledFormControl.valueChanges.pipe(j(400)).subscribe(e=>w(this,null,function*(){this.currentSettingEnabled=e,yield this.saveUiSettingChange("scheduledBackupDisable",!this.currentSettingEnabled)})),this.pathFormControl.valueChanges.pipe(j(400)).subscribe(e=>w(this,null,function*(){this.currentSettingPath=e,yield this.saveUiSettingChange("scheduledBackupPath",this.currentSettingPath)}))}saveUiSettingChange(e,o){return w(this,null,function*(){try{yield N(this.$api.put("/config-editor/ui",{key:e,value:o}))}catch(l){console.error(l),this.$toastr.error(l.message,this.$translate.instant("toast.title_error"))}})}getScheduledBackups(){this.$api.get("/backup/scheduled-backups").subscribe({next:e=>{this.scheduledBackups=e},error:e=>console.error(e)})}getNextBackup(){this.$api.get("/backup/scheduled-backups/next").subscribe({next:e=>{this.backupTime=e.next},error:e=>{console.error(e)}})}download(e){this.$api.get(`/backup/scheduled-backups/${e.id}`,{observe:"response",responseType:"blob"}).subscribe({next:o=>{let l=e.fileName||"homebridge-backup.tar.gz",v=o.body.size;if(v>globalThis.backup.maxBackupSize){let U=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(v/1048576).toFixed(1)}MB`});this.$toastr.warning(U,this.$translate.instant("toast.title_warning"))}(0,ce.saveAs)(o.body,l)},error:o=>{console.error(o),this.$toastr.error(this.$translate.instant("backup.backup_download_failed"),this.$translate.instant("toast.title_error"))}})}restore(e){this.$activeModal.close();let o=this.$modal.open(Le,{size:"lg",backdrop:"static"});o.componentInstance.selectedBackup=e}delete(e){this.deleting=e.id,this.$api.delete(`/backup/scheduled-backups/${e.id}`).subscribe({next:()=>{this.getScheduledBackups(),this.deleting=null},error:o=>{this.deleting=null,console.error(o),this.$toastr.error(this.$translate.instant("backup.backup_delete_failed"),this.$translate.instant("toast.title_error"))}})}onDownloadBackupClick(){return w(this,null,function*(){this.clicked=!0,this.$api.get("/backup/download",{observe:"response",responseType:"blob"}).subscribe({next:e=>{let o=e.headers.get("File-Name")||"homebridge-backup.tar.gz";this.clicked=!1;let l=e.body.size;if(l>globalThis.backup.maxBackupSize){let v=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(l/1048576).toFixed(1)}MB`});this.$toastr.warning(v,this.$translate.instant("toast.title_warning"))}(0,ce.saveAs)(e.body,o)},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("backup.backup_download_failed"),this.$translate.instant("toast.title_error"))}})})}Date=Date;static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],decls:70,vars:59,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-hard-drive","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"btn","btn-primary","m-0","ms-3",3,"click","disabled"],[1,"fas","fa-fw",3,"ngClass"],[1,"fas","fa-fw","fa-arrow-right"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"list-group-item"],[1,"mb-1","text-center"],[1,"mb-0","small","grey-text","text-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","disableScheduledBackups",1,"rendux-input",3,"formControl"],["for","disableScheduledBackups",1,"rendux-label"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"modal-footer","justify-content-between"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-end"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","/home/pi/homebridge-backups",1,"form-control","custom-input",3,"formControl"],[1,"small","grey-text","mb-0","text-center"],["container","modal","openDelay","150","triggers","hover",3,"ngbTooltip"],["container","modal","openDelay","150","triggers","hover",1,"red-text",3,"ngbTooltip"],[2,"display","flex","flex-wrap","nowrap"],["placement","bottom","container","modal","openDelay","150","triggers","hover",1,"btn","btn-primary","m-0","ms-3",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-history"],["placement","bottom","container","modal","openDelay","150","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-download"],["placement","bottom","container","modal","openDelay","150","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-exclamation-circle"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),i(7,"div",4)(8,"div",5),d(9,"i",6),n(),i(10,"ul",7)(11,"li"),p(12),r(13,"translate"),n(),i(14,"li"),p(15),r(16,"translate"),n(),i(17,"li"),p(18),r(19,"translate"),n()(),i(20,"ul",8)(21,"li",9)(22,"div")(23,"span"),p(24),r(25,"translate"),n(),d(26,"br"),i(27,"small",10),p(28),r(29,"translate"),n()(),i(30,"button",11),r(31,"translate"),x("click",function(){return l.onDownloadBackupClick()}),d(32,"i",12),n()(),i(33,"li",9)(34,"div")(35,"span"),p(36),r(37,"translate"),n(),d(38,"br"),i(39,"small",10),p(40),r(41,"translate"),n()(),i(42,"button",11),r(43,"translate"),x("click",function(){return l.restore(null)}),d(44,"i",13),n()()(),i(45,"ul",14)(46,"li",15)(47,"h6",16),p(48),r(49,"translate"),n(),i(50,"p",17),p(51),r(52,"translate"),n()(),i(53,"li",18)(54,"span",19),p(55),r(56,"translate"),n(),i(57,"div",20),d(58,"input",21),r(59,"translate"),d(60,"label",22),n()(),b(61,xt,7,7,"li",23),n(),b(62,wt,10,5,"ul",14),n(),i(63,"div",24),d(64,"div",19),i(65,"div",25)(66,"button",26),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),p(67),r(68,"translate"),n()(),d(69,"div",27),n()()),o&2&&(t(3),c(s(4,24,"backup.title_backup")),t(2),u("disabled",l.clicked||l.deleting),f("aria-label",s(6,26,"form.button_close")),t(7),c(s(13,28,"backup.backup_help_one")),t(3),c(s(16,30,"backup.backup_help_two")),t(3),c(s(19,32,"backup.backup_warning")),t(6),c(s(25,34,"backup.backup_now")),t(4),c(s(29,36,"backup.backup_now_desc")),t(2),u("disabled",l.clicked),f("aria-label",s(31,38,"backup.backup_now")),t(2),u("ngClass",$(56,gt,!l.clicked,l.clicked)),t(4),c(s(37,40,"backup.restore_now")),t(4),c(s(41,42,"backup.restore_now_desc")),t(2),u("disabled",l.clicked),f("aria-label",s(43,44,"backup.restore_now")),t(6),c(s(49,46,"backup.settings_title")),t(3),c(s(52,48,"form.auto_save")),t(4),c(s(56,50,"backup.settings_enable")),t(3),u("formControl",l.enabledFormControl),f("aria-label",s(59,52,"backup.settings_enable")),t(3),h(l.currentSettingEnabled?61:-1),t(),h(l.scheduledBackups.length?62:-1),t(4),u("disabled",l.clicked||l.deleting),t(),_(" ",s(68,54,"form.button_close")," "))},dependencies:[Ve,L,ve,I,J,ie,K,q,ae],encapsulation:2})}return a})();function Bt(a,m){a&1&&(i(0,"div",12),d(1,"i",13),n(),i(2,"p",14),p(3),r(4,"translate"),n()),a&2&&(t(3),c(s(4,1,"reset.no_accessories")))}function Et(a,m){a&1&&(i(0,"div",12),d(1,"i",15),n(),i(2,"ul",16)(3,"li"),p(4),r(5,"translate"),n(),i(6,"li"),p(7),r(8,"translate"),n(),i(9,"li"),p(10),r(11,"translate"),n()(),i(12,"ngb-alert",17)(13,"p",18),p(14),r(15,"translate"),n()()),a&2&&(t(4),c(s(5,5,"reset.accessory_all.list_1")),t(3),c(s(8,7,"reset.accessory_all.list_2")),t(3),c(s(11,9,"reset.accessory_all.list_3")),t(2),u("dismissible",!1),t(2),c(s(15,11,"reset.action_is_irreversible")))}function It(a,m){if(a&1){let e=y();i(0,"button",19),r(1,"translate"),x("click",function(){S(e);let l=g();return k(l.$activeModal.dismiss("Dismiss"))}),p(2),r(3,"translate"),n()}if(a&2){let e=g();u("disabled",e.clicked),f("aria-label",s(1,3,"form.button_close")),t(2),_(" ",s(3,5,"form.button_close")," ")}}function $t(a,m){if(a&1){let e=y();i(0,"button",20),r(1,"translate"),x("click",function(){S(e);let l=g();return k(l.$activeModal.dismiss("Dismiss"))}),p(2),r(3,"translate"),n()}a&2&&(f("aria-label",s(1,2,"form.button_close")),t(2),_(" ",s(3,4,"form.button_close")," "))}function Tt(a,m){a&1&&(p(0),r(1,"translate")),a&2&&_(" ",s(1,1,"form.button_remove")," ")}function Ft(a,m){a&1&&d(0,"i",22)}function Mt(a,m){if(a&1){let e=y();i(0,"button",21),x("click",function(){S(e);let l=g();return k(l.onResetCachedAccessoriesClick())}),b(1,Tt,2,3),b(2,Ft,1,0,"i",22),n()}if(a&2){let e=g();u("disabled",e.clicked),t(),h(e.clicked?-1:1),t(),h(e.clicked?2:-1)}}var We=(()=>{class a{$activeModal=C(T);$api=C(A);$router=C(H);$toastr=C(M);$translate=C(F);clicked=!1;cachedAccessories=[];constructor(){}ngOnInit(){this.loadCachedAccessories()}loadCachedAccessories(){return w(this,null,function*(){try{this.cachedAccessories=yield N(this.$api.get("/server/cached-accessories"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("reset.error_message"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}onResetCachedAccessoriesClick(){return this.clicked=!0,this.$api.put("/server/reset-cached-accessories",{}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.delete_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.failed_to_reset"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-fw","fa-network-wired","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"text-center","mb-0"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),i(7,"div",4),b(8,Bt,5,3),b(9,Et,16,13),n(),i(10,"div",5)(11,"div",6),b(12,It,4,7,"button",7),n(),i(13,"div",8),b(14,$t,4,6,"button",9),n(),i(15,"div",10),b(16,Mt,3,3,"button",11),n()()()),o&2&&(t(3),c(s(4,8,"reset.accessory_all.title")),t(2),u("disabled",l.clicked),f("aria-label",s(6,10,"form.button_close")),t(3),h(l.cachedAccessories.length===0?8:-1),t(),h(l.cachedAccessories.length>0?9:-1),t(3),h(l.cachedAccessories.length>0?12:-1),t(2),h(l.cachedAccessories.length===0?14:-1),t(2),h(l.cachedAccessories.length>0?16:-1))},dependencies:[oe,I],encapsulation:2})}return a})();var At=(a,m)=>({"green-text":a,"grey-text":m}),Vt=(a,m)=>({"btn-danger":a,"btn-elegant":m}),Nt=(a,m,e)=>({"fa-broom":a,"fa-undo":m,"fa-spinner fa-pulse":e});function Rt(a,m){a&1&&(i(0,"div",12),d(1,"i",13),n(),i(2,"p",14),p(3),r(4,"translate"),n()),a&2&&(t(3),c(s(4,1,"reset.bridge_accessories.empty")))}function Pt(a,m){if(a&1){let e=y();i(0,"li",18)(1,"span"),p(2),d(3,"br"),i(4,"small",19),d(5,"i",20),p(6),r(7,"translate"),i(8,"span",21),p(9),n()()(),i(10,"button",22),r(11,"translate"),x("click",function(){let l=S(e).$implicit,v=g(2);return k(v.toggleList(l._id))}),d(12,"i",23),n()()}if(a&2){let e=m.$implicit,o=g(2);t(2),_(" ",e.name," "),t(3),u("ngClass",$(12,At,e._isPaired,!e._isPaired)),t(),_(" ",s(7,8,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),c(e._username),t(),u("disabled",o.clicked)("ngClass",$(15,Vt,!o.toDelete.includes(e._id),o.toDelete.includes(e._id))),f("aria-label",s(11,10,"form.button_delete")),t(2),u("ngClass",G(18,Nt,!o.toDelete.includes(e._id),o.toDelete.includes(e._id)&&!o.clicked,o.toDelete.includes(e._id)&&o.clicked))}}function Dt(a,m){if(a&1&&(i(0,"div",12),d(1,"i",15),n(),i(2,"ul",16)(3,"li"),p(4),r(5,"translate"),n(),i(6,"li"),p(7),r(8,"translate"),n(),i(9,"li"),p(10),r(11,"translate"),n()(),i(12,"ul",17),P(13,Pt,13,22,"li",18,R),n()),a&2){let e=g();t(4),c(s(5,3,"reset.bridge_accessories.list_1")),t(3),c(s(8,5,"reset.clear_cache_single.list_3")),t(3),c(s(11,7,"reset.bridge_accessories.list_2")),t(3),D(e.pairings)}}function zt(a,m){if(a&1){let e=y();i(0,"button",24),x("click",function(){S(e);let l=g();return k(l.$activeModal.dismiss("Dismiss"))}),p(1),r(2,"translate"),n()}if(a&2){let e=g();u("disabled",e.clicked),t(),_(" ",s(2,2,"form.button_close")," ")}}function Ut(a,m){if(a&1){let e=y();i(0,"button",25),x("click",function(){S(e);let l=g();return k(l.$activeModal.dismiss("Dismiss"))}),p(1),r(2,"translate"),n()}a&2&&(t(),_(" ",s(2,1,"form.button_close")," "))}function Ht(a,m){if(a&1&&p(0),a&2){let e=g(3);_(" (",e.toDelete.length,") ")}}function Lt(a,m){if(a&1&&(p(0),r(1,"translate"),b(2,Ht,1,1)),a&2){let e=g(2);_(" ",s(1,2,"form.button_remove")," "),t(2),h(e.toDelete.length>0?2:-1)}}function Ot(a,m){a&1&&d(0,"i",27)}function Wt(a,m){if(a&1){let e=y();i(0,"button",26),x("click",function(){S(e);let l=g();return k(l.cleanBridges())}),b(1,Lt,3,4),b(2,Ot,1,0,"i",27),n()}if(a&2){let e=g();u("disabled",!e.toDelete.length||e.clicked),t(),h(e.clicked?-1:1),t(),h(e.clicked?2:-1)}}var je=(()=>{class a{$activeModal=C(T);$api=C(A);$router=C(H);$toastr=C(M);$translate=C(F);clicked=!1;pairings=[];toDelete=[];constructor(){}ngOnInit(){this.loadPairings()}loadPairings(){return w(this,null,function*(){try{this.pairings=(yield N(this.$api.get("/server/pairings"))).filter(e=>e._category==="bridge"&&!e._main).sort((e,o)=>e.name.localeCompare(o.name))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("settings.unpair_bridge.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}toggleList(e){this.toDelete.includes(e)?this.toDelete=this.toDelete.filter(o=>o!==e):this.toDelete.push(e)}cleanBridges(){return this.clicked=!0,this.$api.delete("/server/pairings/accessories",{body:this.toDelete.map(e=>({id:e}))}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.accessory_ind.done"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-fw","fa-broom","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"fas","fa-fw","fa-link",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas","fa-fw",3,"ngClass"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),i(7,"div",4),b(8,Rt,5,3),b(9,Dt,15,9),n(),i(10,"div",5)(11,"div",6),b(12,zt,3,4,"button",7),n(),i(13,"div",8),b(14,Ut,3,3,"button",9),n(),i(15,"div",10),b(16,Wt,3,3,"button",11),n()()()),o&2&&(t(3),c(s(4,8,"reset.bridge_accessories.title")),t(2),u("disabled",l.clicked),f("aria-label",s(6,10,"form.button_close")),t(3),h(l.pairings.length===0?8:-1),t(),h(l.pairings.length>0?9:-1),t(3),h(l.pairings.length>0?12:-1),t(2),h(l.pairings.length===0?14:-1),t(2),h(l.pairings.length>0?16:-1))},dependencies:[L,I],encapsulation:2})}return a})();function jt(a,m){a&1&&(p(0),r(1,"translate")),a&2&&_(" ",s(1,1,"form.button_reset")," ")}function Gt(a,m){a&1&&d(0,"i",16)}var Ge=(()=>{class a{$activeModal=C(T);$api=C(A);$route=C(H);$toastr=C(M);$translate=C(F);clicked;constructor(){}onResetHomebridgeAccessoryClick(){return this.clicked=!0,this.$api.put("/server/reset-homebridge-accessory",{}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.accessory_reset"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$route.navigate(["/restart"])},error:e=>{console.error(e),this.$toastr.error(this.$translate.instant("reset.failed_to_reset"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],decls:38,vars:33,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-bridge","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"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","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),i(7,"div",4)(8,"div",5),d(9,"i",6),n(),i(10,"ul",7)(11,"li"),p(12),r(13,"translate"),n(),i(14,"li"),p(15),r(16,"translate"),n(),i(17,"li"),p(18),r(19,"translate"),n(),i(20,"li"),p(21),r(22,"translate"),n()(),i(23,"ngb-alert",8)(24,"p",9),p(25),r(26,"translate"),n()()(),i(27,"div",10)(28,"div",11)(29,"button",12),r(30,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),p(31),r(32,"translate"),n()(),d(33,"div",13),i(34,"div",14)(35,"button",15),x("click",function(){return l.onResetHomebridgeAccessoryClick()}),b(36,jt,2,3),b(37,Gt,1,0,"i",16),n()()()()),o&2&&(t(3),c(s(4,15,"reset.bridge_all.title")),t(2),u("disabled",l.clicked),f("aria-label",s(6,17,"form.button_close")),t(7),c(s(13,19,"reset.bridge_all.list_1")),t(3),c(s(16,21,"reset.bridge_all.list_2")),t(3),c(s(19,23,"reset.bridge_all.list_3")),t(3),c(s(22,25,"reset.bridge_all.list_4")),t(2),u("dismissible",!1),t(2),c(s(26,27,"reset.action_is_irreversible")),t(4),u("disabled",l.clicked),f("aria-label",s(30,29,"form.button_close")),t(2),_(" ",s(32,31,"form.button_close")," "),t(4),u("disabled",l.clicked),t(),h(l.clicked?-1:36),t(),h(l.clicked?37:-1))},dependencies:[oe,I],encapsulation:2})}return a})();var me=(a,m)=>({"green-text":a,"grey-text":m}),ue=(a,m)=>({"btn-danger":a,"btn-elegant":m}),Ke=(a,m,e)=>({"fa-refresh":a,"fa-undo":m,"fa-spinner fa-pulse":e}),Kt=(a,m,e)=>({"fa-trash":a,"fa-undo":m,"fa-spinner fa-pulse":e});function qt(a,m){a&1&&(i(0,"div",12),d(1,"i",13),n(),i(2,"p",14),p(3),r(4,"translate"),n()),a&2&&(t(3),c(s(4,1,"reset.bridges.empty")))}function Jt(a,m){if(a&1){let e=y();i(0,"li",20)(1,"span"),p(2),d(3,"br"),i(4,"small",21),d(5,"i",22),p(6),r(7,"translate"),i(8,"span",23),p(9),n(),p(10),r(11,"titlecase"),n()(),i(12,"button",24),r(13,"translate"),x("click",function(){let l=S(e).$implicit,v=g(3);return k(v.toggleList(l._id,!1))}),d(14,"i",25),n()()}if(a&2){let e=m.$implicit,o=g(3);t(2),_(" ",e.name," "),t(3),u("ngClass",$(15,me,e._isPaired,!e._isPaired)),t(),_(" ",s(7,9,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),c(e._username),t(),_(" \xB7 ",e._main?"Homebridge":s(11,11,e._category)," "),t(2),u("disabled",o.clicked)("ngClass",$(18,ue,!o.isInList(e._id),o.isInList(e._id))),f("aria-label",s(13,13,"form.button_unpair")),t(2),u("ngClass",G(21,Ke,!o.isInList(e._id),o.isInList(e._id)&&!o.clicked,o.isInList(e._id)&&o.clicked))}}function Qt(a,m){if(a&1&&(i(0,"ul",16)(1,"li",17)(2,"h6",18),p(3),r(4,"translate"),n(),i(5,"p",19),p(6),r(7,"translate"),n()(),P(8,Jt,15,25,"li",20,R),n()),a&2){let e=g(2);t(3),c(s(4,2,"reset.bridge_ind.head_non_child")),t(3),c(s(7,4,"reset.bridge_ind.desc_non_child")),t(2),D(e.pairingsNonChild)}}function Xt(a,m){if(a&1){let e=y();i(0,"li",20)(1,"span"),p(2),d(3,"br"),i(4,"small",21),d(5,"i",22),p(6),r(7,"translate"),i(8,"span",23),p(9),n()()(),i(10,"button",24),r(11,"translate"),x("click",function(){let l=S(e).$implicit,v=g(3);return k(v.toggleList(l._id,!0))}),d(12,"i",25),n()()}if(a&2){let e=m.$implicit,o=g(3);t(2),_(" ",e.name," "),t(3),u("ngClass",$(12,me,e._isPaired,!e._isPaired)),t(),_(" ",s(7,8,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),c(e._username),t(),u("disabled",o.clicked)("ngClass",$(15,ue,!o.isInList(e._id),o.isInList(e._id))),f("aria-label",s(11,10,"form.button_unpair")),t(2),u("ngClass",G(18,Ke,!o.isInList(e._id),o.isInList(e._id)&&!o.clicked,o.isInList(e._id)&&o.clicked))}}function Yt(a,m){if(a&1&&(i(0,"ul",16)(1,"li",17)(2,"h6",18),p(3),r(4,"translate"),n(),i(5,"p",19),p(6),r(7,"translate"),n()(),P(8,Xt,13,22,"li",20,R),n()),a&2){let e=g(2);t(3),c(s(4,2,"reset.bridge_ind.head_child_active")),t(3),c(s(7,4,"reset.bridge_ind.desc_child_active")),t(2),D(e.pairingsChildActive)}}function Zt(a,m){if(a&1){let e=y();i(0,"li",20)(1,"span"),p(2),d(3,"br"),i(4,"small",21),d(5,"i",22),p(6),r(7,"translate"),i(8,"span",23),p(9),n()()(),i(10,"button",24),r(11,"translate"),x("click",function(){let l=S(e).$implicit,v=g(3);return k(v.toggleList(l._id,!1))}),d(12,"i",25),n()()}if(a&2){let e=m.$implicit,o=g(3);t(2),_(" ",e.name," "),t(3),u("ngClass",$(12,me,e._isPaired,!e._isPaired)),t(),_(" ",s(7,8,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),c(e._username),t(),u("disabled",o.clicked)("ngClass",$(15,ue,!o.isInList(e._id),o.isInList(e._id))),f("aria-label",s(11,10,"form.button_unpair")),t(2),u("ngClass",G(18,Kt,!o.isInList(e._id),o.isInList(e._id)&&!o.clicked,o.isInList(e._id)&&o.clicked))}}function ei(a,m){if(a&1&&(i(0,"ul",16)(1,"li",17)(2,"h6",18),p(3),r(4,"translate"),n(),i(5,"p",19),p(6),r(7,"translate"),n()(),P(8,Zt,13,22,"li",20,R),n()),a&2){let e=g(2);t(3),c(s(4,2,"reset.bridge_ind.head_child_stale")),t(3),c(s(7,4,"reset.bridge_ind.desc_child_stale")),t(2),D(e.pairingsChildStale)}}function ti(a,m){if(a&1&&(i(0,"div",12),d(1,"i",15),n(),b(2,Qt,10,6,"ul",16),b(3,Yt,10,6,"ul",16),b(4,ei,10,6,"ul",16)),a&2){let e=g();t(2),h(e.pairingsNonChild.length>0?2:-1),t(),h(e.pairingsChildActive.length>0?3:-1),t(),h(e.pairingsChildStale.length>0?4:-1)}}function ii(a,m){if(a&1){let e=y();i(0,"button",26),x("click",function(){S(e);let l=g();return k(l.$activeModal.dismiss("Dismiss"))}),p(1),r(2,"translate"),n()}if(a&2){let e=g();u("disabled",e.clicked),t(),_(" ",s(2,2,"form.button_close")," ")}}function ni(a,m){if(a&1){let e=y();i(0,"button",27),x("click",function(){S(e);let l=g();return k(l.$activeModal.dismiss("Dismiss"))}),p(1),r(2,"translate"),n()}a&2&&(t(),_(" ",s(2,1,"form.button_close")," "))}function ai(a,m){if(a&1&&p(0),a&2){let e=g(3);_(" (",e.toDelete.length,") ")}}function ri(a,m){if(a&1&&(p(0),r(1,"translate"),b(2,ai,1,1)),a&2){let e=g(2);_(" ",s(1,2,"form.button_reset")," "),t(2),h(e.toDelete.length>0?2:-1)}}function oi(a,m){a&1&&d(0,"i",29)}function si(a,m){if(a&1){let e=y();i(0,"button",28),x("click",function(){S(e);let l=g();return k(l.removeBridges())}),b(1,ri,3,4),b(2,oi,1,0,"i",29),n()}if(a&2){let e=g();u("disabled",!e.toDelete.length||e.clicked),t(),h(e.clicked?-1:1),t(),h(e.clicked?2:-1)}}var qe=(()=>{class a{$activeModal=C(T);$api=C(A);$router=C(H);$toastr=C(M);$translate=C(F);clicked=!1;pairingsNonChild=[];pairingsChildActive=[];pairingsChildStale=[];toDelete=[];constructor(){}ngOnInit(){this.loadPairings()}loadPairings(){return w(this,null,function*(){try{let e=(yield N(this.$api.get("/server/pairings"))).filter(o=>!o._main).sort((o,l)=>o.name.localeCompare(l.name));this.pairingsChildActive=e.filter(o=>o._category==="bridge"&&!o._couldBeStale),this.pairingsNonChild=e.filter(o=>o._category!=="bridge"),this.pairingsChildStale=e.filter(o=>o._category==="bridge"&&o._couldBeStale)}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("settings.unpair_bridge.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}toggleList(e,o=!1){this.toDelete.some(l=>l.id===e)?this.toDelete=this.toDelete.filter(l=>l.id!==e):this.toDelete.push({id:e,resetPairingInfo:o})}isInList(e){return this.toDelete.some(o=>o.id===e)}removeBridges(){return this.clicked=!0,this.$api.delete("/server/pairings",{body:this.toDelete}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.bridge_ind.done"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.bridge_ind.fail"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"text-center","mb-0"],[1,"fas","fa-fw","fa-bridge","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"list-group-item"],[1,"mb-1","text-center"],[1,"mb-0","small","grey-text","text-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"fas","fa-fw","fa-link",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas","fa-fw",3,"ngClass"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),i(7,"div",4),b(8,qt,5,3),b(9,ti,5,3),n(),i(10,"div",5)(11,"div",6),b(12,ii,3,4,"button",7),n(),i(13,"div",8),b(14,ni,3,3,"button",9),n(),i(15,"div",10),b(16,si,3,3,"button",11),n()()()),o&2&&(t(3),c(s(4,8,"reset.bridge_ind.title")),t(2),u("disabled",l.clicked),f("aria-label",s(6,10,"form.button_close")),t(3),h(l.pairingsChildActive.length===0&&l.pairingsChildStale.length===0&&l.pairingsNonChild.length===0?8:-1),t(),h(l.pairingsChildActive.length>0||l.pairingsChildStale.length>0||l.pairingsNonChild.length>0?9:-1),t(3),h(l.pairingsChildActive.length>0||l.pairingsChildStale.length>0||l.pairingsNonChild.length>0?12:-1),t(2),h(l.pairingsChildActive.length===0&&l.pairingsChildStale.length===0&&l.pairingsNonChild.length===0?14:-1),t(2),h(l.pairingsChildActive.length>0||l.pairingsChildStale.length>0||l.pairingsNonChild.length>0?16:-1))},dependencies:[L,te,I],encapsulation:2})}return a})();function li(a,m){if(a&1){let e=y();i(0,"li",10)(1,"span")(2,"label",17)(3,"input",18),ee("ngModelChange",function(l){let v=S(e).$implicit;return Z(v.selected,l)||(v.selected=l),k(l)}),n(),i(4,"span"),p(5),n(),d(6,"span",19),n()(),i(7,"span",20),p(8),n()()}if(a&2){let e=m.$implicit;t(2),u("for","adapter"+e.iface),t(),u("id","adapter"+e.iface),Y("ngModel",e.selected),t(2),c(e.iface),t(3),c(e.ip4||e.ip6)}}var Je=(()=>{class a{$activeModal=C(T);availableNetworkAdapters=[];bridgeNetworkAdapters=[];constructor(){}submit(){this.$activeModal.close(this.availableNetworkAdapters.filter(e=>e.selected).map(e=>e.iface))}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],inputs:{availableNetworkAdapters:"availableNetworkAdapters",bridgeNetworkAdapters:"bridgeNetworkAdapters"},decls:35,vars:24,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-ethernet","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box"],[1,"list-group-item","d-flex","flex-row","justify-content-between"],[1,"list-group-item","d-flex","flex-row","flex-wrap","justify-content-between"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click"],[1,"hb-uix-switch","d-inline","pe-3",3,"for"],["type","checkbox",3,"ngModelChange","id","ngModel"],[1,"hb-uix-slider","hb-uix-round"],[1,"font-monospace"]],template:function(o,l){o&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),p(3),r(4,"translate"),n(),i(5,"button",3),r(6,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),n()(),i(7,"div",4)(8,"div",5),d(9,"i",6),n(),i(10,"ul",7)(11,"li"),p(12),r(13,"translate"),n()(),i(14,"ul",8)(15,"li",9)(16,"strong"),p(17),r(18,"translate"),n(),i(19,"strong"),p(20),r(21,"translate"),n()(),P(22,li,9,5,"li",10,R),n()(),i(24,"div",11)(25,"div",12)(26,"button",13),r(27,"translate"),x("click",function(){return l.$activeModal.dismiss("Dismiss")}),p(28),r(29,"translate"),n()(),d(30,"div",14),i(31,"div",15)(32,"button",16),x("click",function(){return l.submit()}),p(33),r(34,"translate"),n()()()()),o&2&&(t(3),c(s(4,8,"settings.network.title_network_interfaces")),t(2),f("aria-label",s(6,10,"form.button_close")),t(7),c(s(13,12,"settings.network.message_network_interface")),t(5),c(s(18,14,"settings.network.label_interface_name")),t(3),c(s(21,16,"settings.network.label_ip_address")),t(2),D(l.availableNetworkAdapters),t(4),f("aria-label",s(27,18,"form.button_close")),t(2),_(" ",s(29,20,"form.button_close")," "),t(5),_(" ",s(34,22,"form.button_save")," "))},dependencies:[re,K,q,ne,I],encapsulation:2})}return a})();var pi=["wallpaperInput"],di=a=>({maxFileSizeText:a});function ci(a,m){if(a&1){let e=y();i(0,"div",10),d(1,"img",20),i(2,"button",21),r(3,"translate"),x("click",function(){S(e);let l=g();return k(l.clearWallpaper())}),d(4,"i",22),n()()}if(a&2){let e=g();t(),u("src",e.wallpaperUrl,ge),t(),f("aria-label",s(3,2,"form.button_delete"))}}function mi(a,m){a&1&&d(0,"div",11)}var Qe=(()=>{class a{$activeModal=C(T);$api=C(A);$modal=C(O);$settings=C(Q);$toastr=C(M);$translate=C(F);clicked=!1;maxFileSizeText=globalThis.backup.maxBackupSizeText;selectedFile;wallpaperUrl=null;originalWallpaperUrl=null;wallpaperInput;constructor(){}ngOnInit(){this.$settings.env.customWallpaperHash&&(this.wallpaperUrl=`${Re.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`,this.originalWallpaperUrl=this.wallpaperUrl)}onFileChange(e){if(e.length){this.selectedFile=e[0];let o=new FileReader;o.onload=l=>{this.wallpaperUrl=l.target.result},o.readAsDataURL(this.selectedFile)}else delete this.selectedFile,this.wallpaperUrl=this.originalWallpaperUrl}saveWallpaper(){if(this.clicked=!0,this.selectedFile){let e=new FormData;e.append("wallpaper",this.selectedFile,this.selectedFile.name),this.$api.post("/server/wallpaper",e).subscribe({next:()=>{this.$settings.setItem("wallpaper",`ui-wallpaper.${this.selectedFile.name.split(".").pop()}`),this.$activeModal.close(),this.$toastr.success(this.$translate.instant("settings.display.wallpaper_success"),this.$translate.instant("toast.title_success"))},error:o=>{console.error(o),this.$toastr.error(o.error?.message,this.$translate.instant("toast.title_error")),this.clicked=!1}})}else this.$api.delete("/server/wallpaper").subscribe({next:()=>{this.$activeModal.close()},error:e=>{console.error(e),this.$toastr.error(e.error?.message,this.$translate.instant("toast.title_error")),this.clicked=!1}})}clearWallpaper(){this.selectedFile=null,this.wallpaperUrl=this.wallpaperUrl===this.originalWallpaperUrl?null:this.originalWallpaperUrl,this.wallpaperInput.nativeElement.value=""}cancel(){this.$activeModal.dismiss()}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],viewQuery:function(o,l){if(o&1&&be(pi,5),o&2){let v;he(v=fe())&&(l.wallpaperInput=v.first)}},decls:36,vars:28,consts:[["wallpaperInput",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-image","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"mb-3","text-center"],[1,"position-relative","d-inline-block"],[1,"gradient","anim","rounded",2,"height","200px","width","350px","margin","0 auto"],[1,"mb-0"],["type","file","id","wallpaper","accept","image/*",1,"form-control",3,"change"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],["alt","Current Wallpaper",1,"img-fluid","rounded","mx-auto","d-block",2,"height","200px",3,"src"],[1,"btn","btn-danger","position-absolute",2,"top","10px","right","10px",3,"click"],[1,"fas","fa-fw","fa-trash"]],template:function(o,l){if(o&1){let v=y();i(0,"div",1)(1,"div",2)(2,"h5",3),p(3),r(4,"translate"),n(),i(5,"button",4),r(6,"translate"),x("click",function(){return S(v),k(l.$activeModal.dismiss("Dismiss"))}),n()(),i(7,"div",5)(8,"div",6),d(9,"i",7),n(),i(10,"ul",8)(11,"li"),p(12),r(13,"translate"),n(),i(14,"li"),p(15),r(16,"translate"),n(),i(17,"li"),p(18),r(19,"translate"),n()(),i(20,"div",9),b(21,ci,5,4,"div",10)(22,mi,1,0,"div",11),n(),i(23,"div",12)(24,"input",13,0),x("change",function(Xe){return S(v),k(l.onFileChange(Xe.target.files))}),n()()(),i(26,"div",14)(27,"div",15)(28,"button",16),x("click",function(){return S(v),k(l.cancel())}),p(29),r(30,"translate"),n()(),d(31,"div",17),i(32,"div",18)(33,"button",19),x("click",function(){return S(v),k(l.saveWallpaper())}),p(34),r(35,"translate"),n()()()()}o&2&&(t(3),c(s(4,11,"settings.display.wallpaper")),t(2),u("disabled",l.clicked),f("aria-label",s(6,13,"form.button_close")),t(7),c(s(13,15,"settings.display.wallpaper_intro")),t(3),c(z(16,17,"settings.display.wallpaper_rule",V(26,di,l.maxFileSizeText))),t(3),c(s(19,20,"settings.display.wallpaper_rule2")),t(3),h(l.wallpaperUrl?21:22),t(7),u("disabled",l.clicked),t(),_(" ",s(30,22,"form.button_close")," "),t(4),u("disabled",l.wallpaperUrl===l.originalWallpaperUrl||l.clicked),t(),_(" ",s(35,24,"form.button_save")," "))},dependencies:[J,I],styles:[".anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}"]})}return a})();var X=a=>({"is-invalid":a}),ui=a=>({link:a}),_i=a=>({"fa-pulse":a}),gi=(a,m)=>({"badge-danger":a,"badge-info":m}),bi=()=>({standalone:!0});function hi(a,m){a&1&&(i(0,"li",24)(1,"small",25),p(2),r(3,"translate"),n(),i(4,"button",26),r(5,"translate"),p(6),r(7,"translate"),n()()),a&2&&(t(2),c(s(3,3,"settings.changes.saved")),t(2),f("aria-label",s(5,5,"menu.tooltip_restart")),t(2),_(" ",s(7,7,"menu.tooltip_restart")," "))}function fi(a,m){if(a&1){let e=y();i(0,"ul",5)(1,"li",16)(2,"span"),p(3,"Homebridge Name"),n(),i(4,"div",17),d(5,"input",18),r(6,"translate"),n()(),i(7,"li",19)(8,"span",20),p(9),r(10,"translate"),n(),i(11,"button",21),r(12,"translate"),x("click",function(){S(e);let l=g();return k(l.openUiSettings())}),d(13,"i",22),n()(),i(14,"li",19)(15,"span",20),p(16),r(17,"translate"),n(),i(18,"button",21),r(19,"translate"),x("click",function(){S(e);let l=g();return k(l.openBackupModal())}),d(20,"i",22),n()(),i(21,"li",19)(22,"span",20),p(23),r(24,"translate"),n(),i(25,"a",23),r(26,"translate"),d(27,"i",22),n()(),b(28,hi,8,9,"li",24),n()}if(a&2){let e=g();t(5),u("formControl",e.hbNameFormControl)("ngClass",V(24,X,e.isInvalidHbName)),f("aria-label",s(6,10,"settings.network.port_ui")),t(4),c(s(10,12,"menu.label_settings_advanced")),t(2),f("aria-label",s(12,14,"menu.label_settings_advanced")),t(5),_(" ",s(17,16,"backup.title_backup")," "),t(2),f("aria-label",s(19,18,"backup.title_backup")),t(5),_(" ",s(24,20,"menu.tooltip_user_accounts")," "),t(2),f("aria-label",s(26,22,"menu.tooltip_user_accounts")),t(3),h(e.hasChangedHbName&&!e.isInvalidHbName?28:-1)}}function xi(a,m){if(a&1){let e=y();i(0,"ul",6)(1,"li",16),p(2),r(3,"translate"),i(4,"div",27)(5,"select",28),x("ngModelChange",function(l){S(e);let v=g();return k(v.saveUiSettingChange("lang",l))}),i(6,"option",29),p(7),r(8,"translate"),n(),i(9,"option",30),p(10,"Bulgarian (bg)"),n(),i(11,"option",31),p(12,"Catalan (ca)"),n(),i(13,"option",32),p(14,"Chinese - Simplified (zh-CN)"),n(),i(15,"option",33),p(16,"Chinese - Traditional (zh-TW)"),n(),i(17,"option",34),p(18,"Czech (cs)"),n(),i(19,"option",35),p(20,"Dutch (nl)"),n(),i(21,"option",36),p(22,"English (en)"),n(),i(23,"option",37),p(24,"Finnish (fi)"),n(),i(25,"option",38),p(26,"French (fr)"),n(),i(27,"option",39),p(28,"German (de)"),n(),i(29,"option",40),p(30,"Hebrew (he)"),n(),i(31,"option",41),p(32,"Hungarian (hu)"),n(),i(33,"option",42),p(34,"Indonesian (id)"),n(),i(35,"option",43),p(36,"Italian (it)"),n(),i(37,"option",44),p(38,"Japanese (ja)"),n(),i(39,"option",45),p(40,"Korean (ko)"),n(),i(41,"option",46),p(42,"Macedonian (mk)"),n(),i(43,"option",47),p(44,"Norwegian (no)"),n(),i(45,"option",48),p(46,"Polish (pl)"),n(),i(47,"option",49),p(48,"Portuguese (Brazil)"),n(),i(49,"option",50),p(50,"Portuguese (Portugal)"),n(),i(51,"option",51),p(52,"Russian (ru)"),n(),i(53,"option",52),p(54,"Slovenian (sl)"),n(),i(55,"option",53),p(56,"Spanish (es)"),n(),i(57,"option",54),p(58,"Swedish (sv)"),n(),i(59,"option",55),p(60,"Thai (th)"),n(),i(61,"option",56),p(62,"Turkish (tr)"),n(),i(63,"option",57),p(64,"Ukrainian (uk)"),n()()()(),i(65,"li",16),p(66),r(67,"translate"),i(68,"div",27)(69,"select",28),x("ngModelChange",function(l){S(e);let v=g();return k(v.saveUiSettingChange("theme",l))}),i(70,"option",58),p(71),r(72,"translate"),n(),i(73,"option",59),p(74),r(75,"translate"),n(),i(76,"option",60),p(77),r(78,"translate"),n(),i(79,"option",61),p(80),r(81,"translate"),n(),i(82,"option",62),p(83),r(84,"translate"),n(),i(85,"option",63),p(86),r(87,"translate"),n(),i(88,"option",64),p(89),r(90,"translate"),n(),i(91,"option",65),p(92),r(93,"translate"),n(),i(94,"option",66),p(95),r(96,"translate"),n(),i(97,"option",67),p(98),r(99,"translate"),n(),i(100,"option",68),p(101),r(102,"translate"),n(),i(103,"option",69),p(104),r(105,"translate"),n(),i(106,"option",70),p(107),r(108,"translate"),n()()()(),i(109,"li",16),p(110),r(111,"translate"),i(112,"div",27)(113,"select",28),x("ngModelChange",function(l){S(e);let v=g();return k(v.saveUiSettingChange("lightingMode",l))}),i(114,"option",29),p(115),r(116,"translate"),n(),i(117,"option",71),p(118),r(119,"translate"),n(),i(120,"option",72),p(121),r(122,"translate"),n()()()(),i(123,"li",16),p(124),r(125,"translate"),i(126,"div",27)(127,"select",28),x("ngModelChange",function(l){S(e);let v=g();return k(v.saveUiSettingChange("menuMode",l))}),i(128,"option",73),p(129),r(130,"translate"),n(),i(131,"option",74),p(132),r(133,"translate"),n()()()(),i(134,"li",16),p(135),r(136,"translate"),i(137,"div",27)(138,"select",28),x("ngModelChange",function(l){S(e);let v=g();return k(v.saveUiSettingChange("tempUnits",l))}),i(139,"option",75),p(140),r(141,"translate"),n(),i(142,"option",76),p(143),r(144,"translate"),n()()()(),i(145,"li",19)(146,"span",20),p(147),r(148,"translate"),n(),i(149,"button",21),r(150,"translate"),x("click",function(){S(e);let l=g();return k(l.openWallpaperModal())}),d(151,"i",22),n()()()}if(a&2){let e=g();t(2),_(" ",s(3,33,"settings.display.lang")," "),t(3),u("ngModel",e.$settings.env.lang),t(2),c(s(8,35,"form.select.auto")),t(59),_(" ",s(67,37,"settings.display.theme")," "),t(3),u("ngModel",e.$settings.theme),t(2),c(s(72,39,"settings.display.orange")),t(3),c(s(75,41,"settings.display.red")),t(3),c(s(78,43,"settings.display.pink")),t(3),c(s(81,45,"settings.display.purple")),t(3),c(s(84,47,"settings.display.deep_purple")),t(3),c(s(87,49,"settings.display.indigo")),t(3),c(s(90,51,"settings.display.blue")),t(3),c(s(93,53,"settings.display.bluegrey")),t(3),c(s(96,55,"settings.display.cyan")),t(3),c(s(99,57,"settings.display.green")),t(3),c(s(102,59,"settings.display.teal")),t(3),c(s(105,61,"settings.display.grey")),t(3),c(s(108,63,"settings.display.brown")),t(3),_(" ",s(111,65,"settings.display.lighting_mode")," "),t(3),u("ngModel",e.$settings.lightingMode),t(2),c(s(116,67,"form.select.auto")),t(3),c(s(119,69,"settings.display.light")),t(3),c(s(122,71,"settings.display.dark")),t(3),_(" ",s(125,73,"settings.display.menu_mode")," "),t(3),u("ngModel",e.$settings.menuMode),t(2),c(s(130,75,"settings.display.menu_default")),t(3),c(s(133,77,"settings.display.menu_freeze")),t(3),_(" ",s(136,79,"settings.display.temp_units")," "),t(3),u("ngModel",e.$settings.env.temperatureUnits),t(2),c(s(141,81,"settings.display.temp_units.c")),t(3),c(s(144,83,"settings.display.temp_units.f")),t(4),c(s(148,85,"settings.display.wallpaper")),t(2),f("aria-label",s(150,87,"settings.display.wallpaper"))}}function vi(a,m){a&1&&(i(0,"li",19)(1,"span"),p(2),r(3,"translate"),d(4,"br"),i(5,"small",77),p(6),r(7,"translate"),n()(),i(8,"a",89),r(9,"translate"),d(10,"i",22),n()()),a&2&&(t(2),_(" ",s(3,3,"menu.docker.startup_script")),t(4),c(s(7,5,"platform.docker.script_help")),t(2),f("aria-label",s(9,7,"menu.docker.startup_script")))}function Ci(a,m){if(a&1&&(i(0,"li",16)(1,"span"),p(2),r(3,"translate"),d(4,"br"),i(5,"small",77),p(6),r(7,"translate"),n()(),i(8,"div",27),d(9,"input",90),r(10,"translate"),n()()),a&2){let e=g(2);t(2),_(" ",s(3,5,"settings.startup.log_truncate")),t(4),c(s(7,7,"settings.startup.log_truncate_desc")),t(3),u("formControl",e.uiLogTruncateSizeFormControl)("ngClass",V(11,X,e.isInvalidUiLogTruncateSize)),f("aria-label",s(10,9,"settings.startup.log_truncate"))}}function Si(a,m){a&1&&(i(0,"li",24)(1,"small",25),p(2),r(3,"translate"),n(),i(4,"button",26),r(5,"translate"),p(6),r(7,"translate"),n()()),a&2&&(t(2),c(s(3,3,"settings.changes.saved")),t(2),f("aria-label",s(5,5,"menu.tooltip_restart")),t(2),_(" ",s(7,7,"menu.tooltip_restart")," "))}function ki(a,m){if(a&1&&(i(0,"ul",8)(1,"li",19)(2,"span"),p(3),r(4,"translate"),i(5,"code"),p(6,"-D"),n(),d(7,"br"),i(8,"small",77),p(9),r(10,"translate"),n()(),d(11,"input",78),r(12,"translate"),d(13,"label",79),n(),i(14,"li",19)(15,"span"),p(16),r(17,"translate"),i(18,"code"),p(19,"-I"),n(),d(20,"br"),i(21,"small",77),p(22),r(23,"translate"),n()(),d(24,"input",80),r(25,"translate"),d(26,"label",81),n(),i(27,"li",19)(28,"span"),p(29),r(30,"translate"),i(31,"code"),p(32,"-K"),n(),d(33,"br"),i(34,"small",77),p(35),r(36,"translate"),n()(),d(37,"input",82),r(38,"translate"),d(39,"label",83),n(),i(40,"li",16)(41,"span")(42,"span",84),p(43,"DEBUG"),n(),d(44,"br")(45,"small",85),r(46,"translate"),n(),i(47,"div",27),d(48,"input",86),n()(),i(49,"li",16)(50,"span")(51,"span",84),p(52,"NODE_OPTIONS"),n(),d(53,"br"),i(54,"small",77),p(55),r(56,"translate"),n()(),i(57,"div",27),d(58,"input",87),n()(),b(59,vi,11,9,"li",19),i(60,"li",16)(61,"span"),p(62),r(63,"translate"),d(64,"br"),i(65,"small",77),p(66),r(67,"translate"),n()(),i(68,"div",27),d(69,"input",88),r(70,"translate"),n()(),b(71,Ci,11,13,"li",16),b(72,Si,8,9,"li",24),n()),a&2){let e=g();t(3),_(" ",s(4,19,"settings.startup.debug")," "),t(6),_(" ",s(10,21,e.isHbV2?"settings.startup.debug_desc_v2":"settings.startup.debug_desc_v1")," "),t(2),f("aria-label",s(12,23,"settings.startup.debug")),t(5),_(" ",s(17,25,"settings.startup.insecure")," "),t(6),c(s(23,27,"settings.startup.insecure_desc")),t(2),f("aria-label",s(25,29,"settings.startup.insecure")),t(5),_(" ",s(30,31,"settings.startup.keep_accessories")," "),t(6),c(s(36,33,"settings.startup.keep_accessories_desc")),t(2),f("aria-label",s(38,35,"settings.startup.keep_accessories")),t(8),u("innerHTML",z(46,37,"settings.service.debug_tooltip",V(48,ui,e.linkDebug)),_e),t(10),c(s(56,40,"settings.service.node_tooltip")),t(4),h(e.$settings.env.runningInDocker?59:-1),t(3),_(" ",s(63,42,"settings.startup.log_max")),t(4),c(s(67,44,"settings.startup.log_max_desc")),t(3),u("formControl",e.uiLogMaxSizeFormControl)("ngClass",V(50,X,e.isInvalidUiLogMaxSize)),f("aria-label",s(70,46,"settings.startup.log_max")),t(2),h(e.uiLogMaxSizeFormControl.value>0?71:-1),t(),h(e.hasChangedService?72:-1)}}function yi(a,m){a&1&&d(0,"i",102)}function wi(a,m){if(a&1&&(i(0,"span",92),b(1,yi,1,0,"i",102),p(2),i(3,"span",103),p(4),r(5,"translate"),n()()),a&2){let e=m.$implicit;u("ngClass",$(6,gi,e.missing,!e.missing)),t(),h(e.missing?1:-1),t(),_(" ",e.iface,": "),t(2),c(e.missing?s(5,4,"settings.mdns_advertiser_not_connected"):e.ip4||e.ip6)}}function Bi(a,m){a&1&&(i(0,"option",96),p(1),r(2,"translate"),n()),a&2&&(t(),_("Avahi (",s(2,1,"settings.mdns_advertiser_rec"),")"))}function Ei(a,m){a&1&&(i(0,"option",99),p(1),r(2,"translate"),n()),a&2&&(t(),_("systemd-resolved (",s(2,1,"settings.mdns_advertiser_exp"),")"))}function Ii(a,m){a&1&&(i(0,"li",24)(1,"small",25),p(2),r(3,"translate"),n(),i(4,"button",26),r(5,"translate"),p(6),r(7,"translate"),n()()),a&2&&(t(2),c(s(3,3,"settings.changes.saved")),t(2),f("aria-label",s(5,5,"menu.tooltip_restart")),t(2),_(" ",s(7,7,"menu.tooltip_restart")," "))}function $i(a,m){if(a&1){let e=y();i(0,"ul",9)(1,"li",19)(2,"span",20),p(3),r(4,"translate"),d(5,"br"),i(6,"div",91),p(7),r(8,"translate"),n(),P(9,wi,6,9,"span",92,R),n(),i(11,"button",93),r(12,"translate"),x("click",function(){S(e);let l=g();return k(l.selectNetworkInterfaces())}),d(13,"i",94),n()(),i(14,"li",16)(15,"span"),p(16),r(17,"translate"),d(18,"br"),i(19,"small",77),p(20),r(21,"translate"),n()(),i(22,"div",27)(23,"select",95),r(24,"translate"),b(25,Bi,3,3,"option",96),i(26,"option",97),p(27),r(28,"translate"),n(),i(29,"option",98),p(30,"Bonjour HAP"),n(),b(31,Ei,3,3,"option",99),n()()(),i(32,"li",16)(33,"span"),p(34),r(35,"translate"),d(36,"br"),i(37,"small",77),p(38),r(39,"translate"),n()(),i(40,"div",27),d(41,"input",100),r(42,"translate"),n()(),i(43,"li",16)(44,"span"),p(45),r(46,"translate"),d(47,"br"),i(48,"small",77),p(49),r(50,"translate"),n()(),i(51,"div",27),d(52,"input",101),r(53,"translate"),n()(),b(54,Ii,8,9,"li",24),n()}if(a&2){let e=g();t(3),_(" ",s(4,22,"settings.network.title_network_interfaces")),t(4),c(s(8,24,"settings.network.message_network_interface")),t(2),D(e.bridgeNetworkAdapters),t(2),u("disabled",!e.availableNetworkAdapters.length),f("aria-label",s(12,26,"settings.network.title_network_interfaces")),t(2),u("ngClass",V(48,_i,!e.availableNetworkAdapters.length)),t(3),_(" ",s(17,28,"settings.mdns_advertiser")),t(4),c(s(21,30,"settings.mdns_advertiser_help")),t(3),u("formControl",e.legacyMdnsFormControl),f("aria-label",s(24,32,"settings.mdns_advertiser")),t(2),h(e.showAvahiMdnsOption?25:-1),t(2),_(" Ciao ",e.showAvahiMdnsOption?"":"("+s(28,34,"settings.mdns_advertiser_rec")+")"," "),t(4),h(e.showResolvedMdnsOption?31:-1),t(3),_(" ",s(35,36,"settings.network.port_hb")),t(4),c(s(39,38,"settings.network.port_hb_desc")),t(3),u("formControl",e.hbPortFormControl)("ngClass",V(50,X,e.isInvalidHbPort)),f("aria-label",s(42,40,"settings.network.port_ui")),t(4),_(" ",s(46,42,"settings.network.port_ui")),t(4),c(s(50,44,"settings.network.port_ui_desc")),t(3),u("ngClass",V(52,X,e.isInvalidHbUiPort)),f("aria-label",s(53,46,"settings.network.port_ui")),t(2),h(e.hasChangedHbPort&&!e.isInvalidHbPort||e.hasChangedUiSettings||e.hasChangedMdns||e.hasChangedBridgeNetworkAdapters?54:-1)}}function Ti(a,m){if(a&1&&(i(0,"li",16)(1,"span"),p(2),r(3,"translate"),d(4,"br"),i(5,"small",77),p(6),r(7,"translate"),n()(),i(8,"div",27),d(9,"input",108),r(10,"translate"),n()()),a&2){let e=g(2);t(2),_(" ",s(3,5,"settings.startup.session")),t(4),c(s(7,7,"settings.startup.session_desc")),t(3),u("formControl",e.uiSessionTimeoutFormControl)("ngClass",V(11,X,e.isInvalidUiSessionTimeout)),f("aria-label",s(10,9,"settings.startup.session"))}}function Fi(a,m){if(a&1){let e=y();i(0,"li",16)(1,"span"),p(2),r(3,"translate"),n(),i(4,"div",27),d(5,"input",109),r(6,"translate"),n()(),i(7,"li",16)(8,"span"),p(9),r(10,"translate"),n(),i(11,"div",27),d(12,"input",110),r(13,"translate"),n()(),i(14,"li",16)(15,"span"),p(16),r(17,"translate"),n(),i(18,"div",27),d(19,"input",111),r(20,"translate"),n()(),i(21,"li",16)(22,"span"),p(23),r(24,"translate"),n(),i(25,"div",27)(26,"input",112),r(27,"translate"),x("focus",function(){S(e);let l=g(2);return k(l.showPfxPassphrase=!0)})("blur",function(){S(e);let l=g(2);return k(l.showPfxPassphrase=!1)}),n()()()}if(a&2){let e=g(2);t(2),c(s(3,13,"settings.security.key")),t(3),u("formControl",e.uiSslKeyFormControl),f("aria-label",s(6,15,"settings.security.key")),t(4),c(s(10,17,"settings.security.cert")),t(3),u("formControl",e.uiSslCertFormControl),f("aria-label",s(13,19,"settings.security.cert")),t(4),c(s(17,21,"settings.security.pfx")),t(3),u("formControl",e.uiSslPfxFormControl),f("aria-label",s(20,23,"settings.security.pfx")),t(4),c(s(24,25,"settings.security.pass")),t(3),u("type",e.showPfxPassphrase?"text":"password")("formControl",e.uiSslPassphraseFormControl),f("aria-label",s(27,27,"settings.security.pass"))}}function Mi(a,m){a&1&&(i(0,"li",24)(1,"small",25),p(2),r(3,"translate"),n(),i(4,"button",26),r(5,"translate"),p(6),r(7,"translate"),n()()),a&2&&(t(2),c(s(3,3,"settings.changes.saved")),t(2),f("aria-label",s(5,5,"menu.tooltip_restart")),t(2),_(" ",s(7,7,"menu.tooltip_restart")," "))}function Ai(a,m){if(a&1){let e=y();i(0,"ul",11)(1,"li",19)(2,"span"),p(3),r(4,"translate"),d(5,"br"),i(6,"small",77),p(7),r(8,"translate"),n()(),d(9,"input",104),r(10,"translate"),d(11,"label",105),n(),b(12,Ti,11,13,"li",16),i(13,"li",19)(14,"span"),p(15),r(16,"translate"),d(17,"br"),i(18,"small",77),p(19),r(20,"translate"),n()(),i(21,"input",106),r(22,"translate"),ee("ngModelChange",function(l){S(e);let v=g();return Z(v.dummyEnableHttps,l)||(v.dummyEnableHttps=l),k(l)}),x("change",function(){S(e);let l=g();return k(l.onToggleHttps())}),n(),d(23,"label",107),n(),b(24,Fi,28,29),b(25,Mi,8,9,"li",24),n()}if(a&2){let e=g();t(3),_(" ",s(4,12,"settings.security.auth")),t(4),_(" ",s(8,14,"settings.security.auth_desc")," "),t(2),u("formControl",e.uiAuthFormControl),f("aria-label",s(10,16,"settings.security.auth")),t(3),h(e.uiAuthFormControl.value?12:-1),t(3),_(" ",s(16,18,"settings.security.https")),t(4),c(s(20,20,"settings.security.https_desc")),t(2),Y("ngModel",e.dummyEnableHttps),u("ngModelOptions",xe(24,bi)),f("aria-label",s(22,22,"settings.security.https")),t(3),h(e.dummyEnableHttps?24:-1),t(),h(e.originalSslKey!==e.uiSslKeyFormControl.value||e.originalSslCert!==e.uiSslCertFormControl.value||e.originalSslPfx!==e.uiSslPfxFormControl.value||e.originalSslPassphrase!==e.uiSslPassphraseFormControl.value?25:-1)}}function Vi(a,m){a&1&&(i(0,"p",12),p(1),r(2,"translate"),n()),a&2&&(t(),c(s(2,1,"settings.cache.desc")))}function Ni(a,m){if(a&1){let e=y();i(0,"ul",13)(1,"li",19)(2,"span",20),p(3),r(4,"translate"),d(5,"br"),i(6,"small",77),p(7),r(8,"translate"),n()(),i(9,"button",21),r(10,"translate"),x("click",function(){S(e);let l=g();return k(l.removeSingleCachedAccessories())}),d(11,"i",22),n()(),i(12,"li",19)(13,"span",20),p(14),r(15,"translate"),d(16,"br"),i(17,"small",77),p(18),r(19,"translate"),n()(),i(20,"button",21),r(21,"translate"),x("click",function(){S(e);let l=g();return k(l.removeBridgeAccessories())}),d(22,"i",22),n()(),i(23,"li",19)(24,"span",20),p(25),r(26,"translate"),d(27,"br"),i(28,"small",77),p(29),r(30,"translate"),n()(),i(31,"button",21),r(32,"translate"),x("click",function(){S(e);let l=g();return k(l.removeAllCachedAccessories())}),d(33,"i",22),n()()()}a&2&&(t(3),_(" ",s(4,9,"reset.accessory_ind.title")),t(4),c(s(8,11,"reset.accessory_ind.desc")),t(2),f("aria-label",s(10,13,"reset.accessory_ind.title")),t(5),_(" ",s(15,15,"reset.bridge_accessories.title")),t(4),c(s(19,17,"reset.bridge_accessories.desc")),t(2),f("aria-label",s(21,19,"reset.accessory_all.title")),t(5),_(" ",s(26,21,"reset.accessory_all.title")),t(4),c(s(30,23,"reset.accessory_all.desc")),t(2),f("aria-label",s(32,25,"reset.accessory_all.title")))}function Ri(a,m){a&1&&(i(0,"p",12),p(1),r(2,"translate"),n()),a&2&&(t(),c(s(2,1,"reset.bridges.desc")))}function Pi(a,m){if(a&1){let e=y();i(0,"ul",14)(1,"li",19)(2,"span",20),p(3),r(4,"translate"),d(5,"br"),i(6,"small",77),p(7),r(8,"translate"),n()(),i(9,"button",21),r(10,"translate"),x("click",function(){S(e);let l=g();return k(l.unpairAccessory())}),d(11,"i",22),n()(),i(12,"li",19)(13,"span",20),p(14),r(15,"translate"),r(16,"titlecase"),d(17,"br"),i(18,"small",77),p(19),r(20,"translate"),n()(),i(21,"button",21),r(22,"translate"),x("click",function(){S(e);let l=g();return k(l.resetHomebridgeState())}),d(23,"i",22),n()()()}a&2&&(t(3),_(" ",s(4,6,"reset.bridge_ind.title")),t(4),c(s(8,8,"reset.bridge_ind.desc")),t(2),f("aria-label",s(10,10,"reset.bridge_ind.title")),t(5),_(" ",s(16,14,s(15,12,"reset.bridge_all.title"))),t(5),c(s(20,16,"reset.bridge_all.desc")),t(2),f("aria-label",s(22,18,"reset.bridge_all.title")))}var Pa=(()=>{class a{$api=C(A);$modal=C(O);$plugin=C(ze);$settings=C(Q);$toastr=C(M);$translate=C(F);originalServiceForm={HOMEBRIDGE_DEBUG:!1,HOMEBRIDGE_KEEP_ORPHANS:!1,HOMEBRIDGE_INSECURE:!0,ENV_DEBUG:"",ENV_NODE_OPTIONS:""};originalUiSettingsForm={port:0};originalMdnsSetting="";originalBridgeNetworkAdapters=[];originalHbPort=0;originalHbName="";originalSslKey="";originalSslCert="";originalSslPfx="";originalSslPassphrase="";showPfxPassphrase=!1;hasChangedService=!1;hasChangedUiSettings=!1;hasChangedMdns=!1;hasChangedBridgeNetworkAdapters=!1;hasChangedHbPort=!1;hasChangedHbName=!1;isInvalidHbPort=!1;isInvalidHbName=!1;isInvalidHbUiPort=!1;isInvalidUiSessionTimeout=!1;isInvalidUiLogMaxSize=!1;isInvalidUiLogTruncateSize=!1;serviceForm=new pe({HOMEBRIDGE_DEBUG:new B(!1),HOMEBRIDGE_KEEP_ORPHANS:new B(!1),HOMEBRIDGE_INSECURE:new B(!0),ENV_DEBUG:new B(""),ENV_NODE_OPTIONS:new B("")});uiSettingsForm=new pe({port:new B(0)});legacyMdnsFormControl=new de(!1);showAvahiMdnsOption=!1;showResolvedMdnsOption=!1;availableNetworkAdapters=[];bridgeNetworkAdapters=[];hbPortFormControl=new B(0);hbNameFormControl=new B("");uiAuthFormControl=new de(!0);uiSessionTimeoutFormControl=new B(28800);uiLogMaxSizeFormControl=new B;uiLogTruncateSizeFormControl=new B;dummyEnableHttps=!1;uiSslKeyFormControl=new B("");uiSslCertFormControl=new B("");uiSslPfxFormControl=new B("");uiSslPassphraseFormControl=new B("");isHbV2=!1;showFields={general:!0,display:!0,startup:!0,network:!0,security:!0,reset:!0,cache:!0};linkDebug='<a href="https://github.com/homebridge/homebridge-config-ui-x/wiki/Debug-Common-Values" target="_blank"><i class="fa fa-fw fa-external-link-alt primary-text"></i></a>';constructor(){}ngOnInit(){this.isHbV2=this.$settings.env.homebridgeVersion.startsWith("2"),this.hbNameFormControl.patchValue(this.$settings.env.homebridgeInstanceName),this.hbNameFormControl.valueChanges.subscribe(e=>this.setHomebridgeName(e)),this.originalHbName=this.$settings.env.homebridgeInstanceName,this.uiAuthFormControl.patchValue(this.$settings.formAuth),this.uiAuthFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("auth",e)),this.uiSessionTimeoutFormControl.patchValue(this.$settings.sessionTimeout),this.uiSessionTimeoutFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("sessionTimeout",e)),this.uiLogMaxSizeFormControl.patchValue(this.$settings.env.log?.maxSize),this.uiLogMaxSizeFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("log.maxSize",e)),this.uiLogTruncateSizeFormControl.patchValue(this.$settings.env.log?.truncateSize),this.uiLogTruncateSizeFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("log.truncateSize",e)),this.originalSslKey=this.$settings.env.ssl?.key||"",this.originalSslCert=this.$settings.env.ssl?.cert||"",this.originalSslPfx=this.$settings.env.ssl?.pfx||"",this.originalSslPassphrase=this.$settings.env.ssl?.passphrase||"",this.uiSslKeyFormControl.patchValue(this.$settings.env.ssl?.key||""),this.uiSslKeyFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("ssl.key",e)),this.uiSslCertFormControl.patchValue(this.$settings.env.ssl?.cert||""),this.uiSslCertFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("ssl.cert",e)),this.uiSslPfxFormControl.patchValue(this.$settings.env.ssl?.pfx||""),this.uiSslPfxFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("ssl.pfx",e)),this.uiSslPassphraseFormControl.patchValue(this.$settings.env.ssl?.passphrase||""),this.uiSslPassphraseFormControl.valueChanges.subscribe(e=>this.saveUiSettingChange("ssl.passphrase",e)),this.dummyEnableHttps=!!this.uiSslKeyFormControl.value||!!this.uiSslCertFormControl.value||!!this.uiSslPfxFormControl.value||!!this.uiSslPassphraseFormControl.value,this.initUiSettingsForm(),this.initNetworkingOptions(),this.initStartupSettingsForm()}initUiSettingsForm(){this.originalUiSettingsForm={port:this.$settings.env.port},this.uiSettingsForm.patchValue({port:this.$settings.env.port}),this.uiSettingsForm.valueChanges.pipe(j(500)).subscribe(e=>{let o=!1;Object.keys(e).forEach(l=>{this.originalUiSettingsForm[l]!==e[l]&&(this.saveUiSettingChange(l,e[l]),o=!0)}),this.hasChangedUiSettings=o})}initStartupSettingsForm(){this.$api.get("/platform-tools/hb-service/homebridge-startup-settings").subscribe({next:e=>{Object.keys(e).forEach(o=>{this.originalServiceForm[o]=e[o]}),this.serviceForm.patchValue(e),this.serviceForm.valueChanges.pipe(j(500)).subscribe(this.saveStartupSettingsSettings.bind(this))},error:e=>{console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error"))}})}saveUiSettingChange(e,o){switch(e){case"lang":this.$settings.setLang(o);break;case"lightingMode":this.$settings.setLightingMode(o,"user");break;case"menuMode":this.$settings.setMenuMode(o),window.location.reload();break;case"theme":this.$settings.setTheme(o);break;case"tempUnits":this.$settings.setEnvItem("temperatureUnits",o);break;case"port":if(!o||typeof o!="number"||o<1025||o>65533||Number.isInteger(o)===!1||o===this.hbPortFormControl.value){this.isInvalidHbUiPort=!0;return}this.$settings.setEnvItem("port",o),this.isInvalidHbUiPort=!1;break;case"auth":this.$settings.setItem("formAuth",o),o=o?"form":"none";break;case"sessionTimeout":if(o&&(typeof o!="number"||o<600||o>864e5||Number.isInteger(o)===!1)){this.isInvalidUiSessionTimeout=!0;return}this.$settings.setItem("sessionTimeout",o),this.isInvalidUiSessionTimeout=!1;break;case"log.maxSize":if(o&&(typeof o!="number"||o<-1||Number.isInteger(o)===!1)){this.isInvalidUiLogMaxSize=!0;return}this.$settings.setEnvItem("log.maxSize",o),this.isInvalidUiLogMaxSize=!1,(!o||o===-1)&&(this.saveUiSettingChange("log.truncateSize",null),this.isInvalidUiLogMaxSize=!1);break;case"log.truncateSize":if(o&&(typeof o!="number"||o<0||Number.isInteger(o)===!1)){this.isInvalidUiLogTruncateSize=!0;return}this.$settings.setEnvItem("log.truncateSize",o),this.isInvalidUiLogTruncateSize=!1;break;case"ssl.key":case"ssl.cert":case"ssl.pfx":case"ssl.passphrase":this.$settings.setEnvItem(e,o);break}N(this.$api.put("/config-editor/ui",{key:e,value:o})).catch(l=>{console.error(l),this.$toastr.error(l.message,this.$translate.instant("toast.title_error"))})}openUiSettings(){this.$plugin.settings({name:"homebridge-config-ui-x",displayName:"Homebridge UI",settingsSchema:!0,links:{}})}openBackupModal(){this.$modal.open(se,{size:"lg",backdrop:"static"})}openWallpaperModal(){this.$modal.open(Qe,{size:"lg",backdrop:"static"})}saveStartupSettingsSettings(e=this.serviceForm.value){this.$api.put("/platform-tools/hb-service/homebridge-startup-settings",e).subscribe({next:()=>{this.hasChangedService=JSON.stringify(e)!==JSON.stringify(this.originalServiceForm)},error:o=>{console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}})}resetHomebridgeState(){this.$modal.open(Ge,{size:"lg",backdrop:"static"})}unpairAccessory(){this.$modal.open(qe,{size:"lg",backdrop:"static"})}removeAllCachedAccessories(){this.$modal.open(We,{size:"lg",backdrop:"static"})}removeSingleCachedAccessories(){this.$modal.open(De,{size:"lg",backdrop:"static"})}removeBridgeAccessories(){this.$modal.open(je,{size:"lg",backdrop:"static"})}initNetworkingOptions(){return w(this,null,function*(){try{this.getNetworkSettings(),(this.$settings.env.runningInLinux||this.$settings.env.runningInDocker||this.$settings.env.runningInSynologyPackage||this.$settings.env.runningInPackageMode)&&(this.showAvahiMdnsOption=!0,this.showResolvedMdnsOption=!0)}catch{}})}getNetworkSettings(){return w(this,null,function*(){return Promise.all([N(this.$api.get("/server/network-interfaces/system")),N(this.$api.get("/server/network-interfaces/bridge")),N(this.$api.get("/server/mdns-advertiser")),N(this.$api.get("/server/port"))]).then(([e,o,l,v])=>{this.availableNetworkAdapters=e,this.buildBridgeNetworkAdapterList(o),this.legacyMdnsFormControl.patchValue(l.advertiser),this.originalMdnsSetting=l.advertiser,this.originalBridgeNetworkAdapters=this.bridgeNetworkAdapters.map(U=>U.iface),this.legacyMdnsFormControl.valueChanges.subscribe(U=>{this.setHomebridgeMdnsSetting(U)}),this.hbPortFormControl.patchValue(v.port),this.hbPortFormControl.valueChanges.subscribe(U=>this.setHomebridgePort(U)),this.originalHbPort=v.port})})}setHomebridgeMdnsSetting(e){return w(this,null,function*(){this.$api.put("/server/mdns-advertiser",{advertiser:e}).subscribe({next:()=>{this.hasChangedMdns=e!==this.originalMdnsSetting},error:o=>{console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}})})}setNetworkInterfaces(e){return w(this,null,function*(){this.$api.put("/server/network-interfaces/bridge",{adapters:e}).subscribe({next:()=>{this.hasChangedBridgeNetworkAdapters=this.originalBridgeNetworkAdapters.join(",")!==e.join(",")},error:o=>{console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}})})}setHomebridgeName(e){return w(this,null,function*(){if(!e||!/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u.test(e)){this.isInvalidHbName=!0;return}this.$api.put("/server/name",{name:e}).subscribe({next:()=>{this.hasChangedHbName=this.originalHbName!==e,this.$settings.setEnvItem("homebridgeInstanceName",e),this.isInvalidHbName=!1},error:()=>{this.isInvalidHbName=!0}})})}setHomebridgePort(e){return w(this,null,function*(){if(e===this.uiSettingsForm.get("port").value){this.isInvalidHbPort=!0;return}this.$api.put("/server/port",{port:e}).subscribe({next:()=>{this.hasChangedHbPort=this.originalHbPort!==e,this.isInvalidHbPort=!1},error:()=>{this.isInvalidHbPort=!0}})})}buildBridgeNetworkAdapterList(e){if(!e.length){this.bridgeNetworkAdapters=[];return}this.bridgeNetworkAdapters=e.map(o=>{let l=this.availableNetworkAdapters.find(v=>v.iface===o);return l?(l.selected=!0,l.missing=!1,l):{iface:o,missing:!0}})}selectNetworkInterfaces(){let e=this.$modal.open(Je,{size:"lg",backdrop:"static"});e.componentInstance.availableNetworkAdapters=this.availableNetworkAdapters,e.componentInstance.bridgeNetworkAdapters=this.bridgeNetworkAdapters,e.result.then(o=>{this.buildBridgeNetworkAdapterList(o),this.setNetworkInterfaces(o)}).catch(()=>{})}toggleSection(e){this.showFields[e]=!this.showFields[e]}onToggleHttps(){console.error(this.dummyEnableHttps),this.dummyEnableHttps||(this.uiSslKeyFormControl.setValue(""),this.uiSslCertFormControl.setValue(""),this.uiSslPfxFormControl.setValue(""),this.uiSslPassphraseFormControl.setValue(""))}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=E({type:a,selectors:[["ng-component"]],decls:55,vars:56,consts:[[1,"primary-text","m-0"],[1,"my-4"],["role","button","tabindex","0",1,"mt-3","hover-pointer",3,"click"],[1,"primary-text"],[1,"fa","fa-fw",3,"ngClass"],["id","fieldsGeneral",1,"list-group","list-group-box","mt-2","mx-0"],["id","fieldsDisplay",1,"list-group","list-group-box","mt-2","mx-0"],["novalidate","",1,"my-4",3,"formGroup"],["id","fieldsStartup",1,"list-group","list-group-box","mb-4","mx-0"],["id","fieldsNetwork",1,"list-group","list-group-box","mt-2","mx-0"],["novalidate","",1,"my-4"],["id","fieldsSecurity",1,"list-group","list-group-box","mt-2","mx-0"],[1,"small","grey-text","mb-2","mx-0"],["id","fieldsCache",1,"list-group","list-group-box","mb-4","mx-0"],["id","fieldsReset",1,"list-group","list-group-box","mt-2","mx-0"],[1,"pb-3"],[1,"list-group-item","d-block","d-md-flex","justify-content-between","align-items-center"],[1,"my-3","my-md-0","pl-0","pl-md-5","w-auto"],["type","text",1,"form-control","custom-input","resp-input",3,"formControl","ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"pe-2"],[1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["routerLink","/users",1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px"],[1,"list-group-item","d-flex","flex-column","align-items-center"],[1,"grey-text","my-2"],["routerLink","/restart",1,"btn","btn-primary","waves-effect","my-2"],[1,"my-3","my-md-0","ps-0","ps-md-5","w-auto"],[1,"custom-select","resp-select",3,"ngModelChange","ngModel"],["value","auto"],["value","bg"],["value","ca"],["value","zh-CN"],["value","zh-TW"],["value","cs"],["value","nl"],["value","en"],["value","fi"],["value","fr"],["value","de"],["value","he"],["value","hu"],["value","id"],["value","it"],["value","ja"],["value","ko"],["value","mk"],["value","no"],["value","pl"],["value","pt-BR"],["value","pt"],["value","ru"],["value","sl"],["value","es"],["value","sv"],["value","th"],["value","tr"],["value","uk"],["value","orange"],["value","red"],["value","pink"],["value","purple"],["value","deep-purple"],["value","indigo"],["value","blue"],["value","blue-grey"],["value","cyan"],["value","green"],["value","teal"],["value","grey"],["value","brown"],["value","light"],["value","dark"],["value","default"],["value","freeze"],["value","c"],["value","f"],[1,"grey-text","pe-2"],["type","checkbox","id","homebridgeDebugMode","formControlName","HOMEBRIDGE_DEBUG",1,"rendux-input"],["for","homebridgeDebugMode",1,"rendux-label","ms-3",2,"min-width","50px"],["type","checkbox","id","homebridgeInsecureMode","formControlName","HOMEBRIDGE_INSECURE",1,"rendux-input"],["for","homebridgeInsecureMode",1,"rendux-label","ms-3",2,"min-width","50px"],["type","checkbox","id","homebridgeKeepOrphans","formControlName","HOMEBRIDGE_KEEP_ORPHANS",1,"rendux-input"],["for","homebridgeKeepOrphans",1,"rendux-label","ms-3",2,"min-width","50px"],[1,"font-monospace"],[1,"grey-text","pe-2",3,"innerHTML"],["formControlName","ENV_DEBUG","type","text","placeholder","HAP-NodeJS:Advertiser,HAP-NodeJS:Service",1,"form-control","custom-input","resp-input"],["formControlName","ENV_NODE_OPTIONS","type","text","placeholder","--max-old-space-size=512 --max-http-header-size=8192",1,"form-control","custom-input","resp-input"],["type","number","min","-1","placeholder","1000000",1,"form-control","custom-input","resp-input",3,"formControl","ngClass"],["routerLink","/platform-tools/docker/startup-script",1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px"],["type","number","min","0","placeholder","200000",1,"form-control","custom-input","resp-input",3,"formControl","ngClass"],[1,"small","grey-text","pe-2"],[1,"badge","badge-primary","me-1",3,"ngClass"],[1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px",3,"click","disabled"],[1,"fas","fa-fw","fa-arrow-right",3,"ngClass"],[1,"custom-select","resp-select",3,"formControl"],["value","avahi"],["value","ciao"],["value","bonjour-hap"],["value","resolved"],["type","number","min","1025","max","65533",1,"form-control","custom-input","resp-input",3,"formControl","ngClass"],["type","number","min","1025","max","65533","placeholder","8581","formControlName","port",1,"form-control","custom-input","resp-input",3,"ngClass"],[1,"fas","fa-fw","fa-exclamation-triangle"],[1,"fw-normal"],["type","checkbox","id","uiAuthForm",1,"rendux-input",3,"formControl"],["for","uiAuthForm",1,"rendux-label","ms-3",2,"min-width","50px"],["type","checkbox","id","uiEnableHttps",1,"rendux-input",3,"ngModelChange","change","ngModel","ngModelOptions"],["for","uiEnableHttps",1,"rendux-label","ms-3",2,"min-width","50px"],["type","number","min","600","max","86400000","placeholder","28800",1,"form-control","custom-input","resp-input",3,"formControl","ngClass"],["type","text","placeholder","/Users/.../certs/server.key",1,"form-control","custom-input","resp-input",3,"formControl"],["type","text","placeholder","/Users/.../certs/server.crt",1,"form-control","custom-input","resp-input",3,"formControl"],["type","text","placeholder","/Users/.../certs/server.pfx",1,"form-control","custom-input","resp-input",3,"formControl"],["placeholder","mypassphrase",1,"form-control","custom-input","resp-input",3,"focus","blur","type","formControl"]],template:function(o,l){o&1&&(i(0,"h3",0),p(1),r(2,"translate"),n(),i(3,"div",1)(4,"div",2),x("click",function(){return l.toggleSection("general")}),i(5,"h5",3),d(6,"i",4),p(7),r(8,"translate"),n()(),b(9,fi,29,26,"ul",5),n(),i(10,"div",1)(11,"div",2),x("click",function(){return l.toggleSection("display")}),i(12,"h5",3),d(13,"i",4),p(14),r(15,"translate"),n()(),b(16,xi,152,89,"ul",6),n(),i(17,"form",7)(18,"div",2),x("click",function(){return l.toggleSection("startup")}),i(19,"h5",3),d(20,"i",4),p(21),r(22,"translate"),n()(),b(23,ki,73,52,"ul",8),n(),i(24,"form",7)(25,"div",2),x("click",function(){return l.toggleSection("network")}),i(26,"h5",3),d(27,"i",4),p(28),r(29,"translate"),n()(),b(30,$i,55,54,"ul",9),n(),i(31,"form",10)(32,"div",2),x("click",function(){return l.toggleSection("security")}),i(33,"h5",3),d(34,"i",4),p(35),r(36,"translate"),n()(),b(37,Ai,26,25,"ul",11),n(),i(38,"div",1)(39,"div",2),x("click",function(){return l.toggleSection("cache")}),i(40,"h5",3),d(41,"i",4),p(42),r(43,"translate"),n()(),b(44,Vi,3,3,"p",12),b(45,Ni,34,27,"ul",13),n(),i(46,"div",1)(47,"div",2),x("click",function(){return l.toggleSection("reset")}),i(48,"h5",3),d(49,"i",4),p(50),r(51,"translate"),n()(),b(52,Ri,3,3,"p",12),b(53,Pi,24,20,"ul",14),n(),d(54,"div",15)),o&2&&(t(),c(s(2,40,"menu.settings.title")),t(3),f("aria-expanded",l.showFields.general?"true":"false")("aria-controls","fieldsGeneral"),t(2),u("ngClass",l.showFields.general?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(8,42,"settings.general.title_general")," "),t(2),h(l.showFields.general?9:-1),t(2),f("aria-expanded",l.showFields.display?"true":"false")("aria-controls","fieldsDisplay"),t(2),u("ngClass",l.showFields.display?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(15,44,"settings.general.title_display")," "),t(2),h(l.showFields.display?16:-1),t(),u("formGroup",l.serviceForm),t(),f("aria-expanded",l.showFields.startup?"true":"false")("aria-controls","fieldsStartup"),t(2),u("ngClass",l.showFields.startup?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(22,46,"settings.title_startup_options")," "),t(2),h(l.showFields.startup?23:-1),t(),u("formGroup",l.uiSettingsForm),t(),f("aria-expanded",l.showFields.network?"true":"false")("aria-controls","fieldsNetwork"),t(2),u("ngClass",l.showFields.network?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(29,48,"settings.network.title_network")," "),t(2),h(l.showFields.network?30:-1),t(2),f("aria-expanded",l.showFields.security?"true":"false")("aria-controls","fieldsSecurity"),t(2),u("ngClass",l.showFields.security?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(36,50,"settings.network.title_security")," "),t(2),h(l.showFields.security?37:-1),t(2),f("aria-expanded",l.showFields.cache?"true":"false")("aria-controls","fieldsCache"),t(2),u("ngClass",l.showFields.cache?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(43,52,"settings.cache.title")," "),t(2),h(l.showFields.cache?44:-1),t(),h(l.showFields.cache?45:-1),t(2),f("aria-expanded",l.showFields.reset?"true":"false")("aria-controls","fieldsReset"),t(2),u("ngClass",l.showFields.reset?"fa-chevron-down":"fa-chevron-right"),t(),_(" ",s(51,54,"reset.bridges.title")," "),t(2),h(l.showFields.reset?52:-1),t(),h(l.showFields.reset?53:-1))},dependencies:[L,Ne,re,we,Te,Fe,ie,Be,K,$e,q,ke,Ae,Me,ne,ye,J,ae,Ee,Ie,te,I],encapsulation:2})}return a})();export{se as a,We as b,Ge as c,Je as d,Qe as e,Pa as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as pe}from"./chunk-7AZ4UU6X.js";import{j as le}from"./chunk-VJBLBCZM.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-QSPBB6EE.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={};constructor(){}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{c as pe}from"./chunk-4EPSNG66.js";import{j as le}from"./chunk-ARI67CJA.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-QSPBB6EE.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={};constructor(){}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};
|