homebridge-config-ui-x 5.12.1-beta.4 → 5.12.1-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/package.json +9 -9
  2. package/public/{chunk-Q3NZLPIF.js → chunk-2DRLNNDM.js} +1 -1
  3. package/public/{chunk-W2KCSDQF.js → chunk-2K66PSKD.js} +1 -1
  4. package/public/{chunk-U5MVAF2Z.js → chunk-2QSUQ4VI.js} +1 -1
  5. package/public/{chunk-YPN7FV6O.js → chunk-3LY5FRVV.js} +1 -1
  6. package/public/{chunk-ALOGQFKU.js → chunk-3N3RJBS3.js} +1 -1
  7. package/public/{chunk-T4UELVH7.js → chunk-4OEYZBSF.js} +1 -1
  8. package/public/{chunk-SHUCVS7I.js → chunk-4P4VAV7I.js} +1 -1
  9. package/public/{chunk-KQSZ6SGH.js → chunk-5QHRLSAE.js} +1 -1
  10. package/public/{chunk-TKVKJ7BH.js → chunk-664C4LX2.js} +1 -1
  11. package/public/{chunk-AMSZTHK7.js → chunk-6U3YEWBO.js} +1 -1
  12. package/public/{chunk-QNOVJEHS.js → chunk-A5JF6PDD.js} +1 -1
  13. package/public/{chunk-EQBPB35I.js → chunk-ATJM3XYR.js} +1 -1
  14. package/public/{chunk-STRIQHMU.js → chunk-AY35X64S.js} +1 -1
  15. package/public/{chunk-5GOLEPOT.js → chunk-BRGXDZZE.js} +1 -1
  16. package/public/{chunk-UOW2U4BJ.js → chunk-BZLBFDQG.js} +1 -1
  17. package/public/{chunk-A7OA7EDC.js → chunk-C5CMRH2U.js} +1 -1
  18. package/public/{chunk-A7MBTNVM.js → chunk-CAY6MDP6.js} +1 -1
  19. package/public/{chunk-DW4GVDBD.js → chunk-CP2QJXVO.js} +1 -1
  20. package/public/{chunk-SH2LIQC2.js → chunk-FH62LNHX.js} +1 -1
  21. package/public/{chunk-M5HSZY2K.js → chunk-GDBXX4WT.js} +1 -1
  22. package/public/{chunk-7SWRANGJ.js → chunk-H2UKSDHZ.js} +1 -1
  23. package/public/{chunk-AJNVPC3P.js → chunk-JBILFYTL.js} +1 -1
  24. package/public/{chunk-UUTQE5VH.js → chunk-JPAZUSRO.js} +1 -1
  25. package/public/{chunk-D4MLVPZP.js → chunk-KIFEAONI.js} +1 -1
  26. package/public/{chunk-AUCDLTKK.js → chunk-M3DSUNBG.js} +1 -1
  27. package/public/{chunk-IL3A5BIS.js → chunk-MAJDTCMY.js} +1 -1
  28. package/public/{chunk-UP6OS2GK.js → chunk-MVT3BOGV.js} +1 -1
  29. package/public/{chunk-TTY6CFWI.js → chunk-NPMJGEDY.js} +1 -1
  30. package/public/{chunk-KCDMHC2Q.js → chunk-NYEZF6Y3.js} +1 -1
  31. package/public/{chunk-LF27VVUY.js → chunk-RMDVYT7X.js} +1 -1
  32. package/public/{chunk-V2JVDEX6.js → chunk-RWABUVQY.js} +1 -1
  33. package/public/{chunk-4G3SMV26.js → chunk-S2GJNEOI.js} +1 -1
  34. package/public/{chunk-EFYVUQZK.js → chunk-TV5ACJCB.js} +1 -1
  35. package/public/{chunk-CH4W3VJQ.js → chunk-UH3C2FAE.js} +1 -1
  36. package/public/{chunk-LMPJJK5P.js → chunk-VFMCVZHO.js} +1 -1
  37. package/public/{chunk-FHRZH5HG.js → chunk-VV4S6PBO.js} +1 -1
  38. package/public/{chunk-B23NNBW7.js → chunk-VWUZDCBZ.js} +1 -1
  39. package/public/{chunk-WE4CGPHP.js → chunk-WGTVNYII.js} +1 -1
  40. package/public/{chunk-Y7OC2MBV.js → chunk-XUP37AHQ.js} +1 -1
  41. package/public/{chunk-ASKLCERP.js → chunk-Y6B4ENQ3.js} +1 -1
  42. package/public/{chunk-RRPHHKF2.js → chunk-ZVU2KU6A.js} +1 -1
  43. package/public/index.html +1 -1
  44. package/public/{main-ZCE52DX6.js → main-QHHXZV7U.js} +1 -1
@@ -1,4 +1,4 @@
1
- import{a as yo,d as E0,e as $s,g as T0,j as Ns,l as $0}from"./chunk-RDHUW73W.js";import{a as go}from"./chunk-C64AHVUO.js";import{C as bf,D as wf,a as v0,b as b0,c as Ts,e as er,f as w0,h as C0,i as x0,k as I0,l as ru,m as S0,o as D0,p as O0,q as _o,t as P0,u as ou,v as vf,w as su}from"./chunk-UUTQE5VH.js";import{e as g0,k as Xi,m as _0,w as y0}from"./chunk-B23NNBW7.js";import{$ as Yl,$b as mf,Aa as xt,Ab as ne,C as sf,Ca as s0,Cb as It,Db as St,Ea as a0,Eb as Dt,Fb as W,G as n0,Gb as Y,Hb as Q,I as af,Ib as ae,Mc as Qn,Nc as B,O as i0,Oc as iu,P as co,Pc as p0,Q as lf,Qb as c0,R as Jn,Rb as bt,Rc as $t,S as r0,Sb as Yi,Ua as Re,Uc as Or,Vc as h0,W as uf,Wc as m0,X as je,Xb as Be,Y as Et,Za as L,Zb as F,_ as Zn,_b as hf,a as xr,aa as k,ac as Sr,bc as Dr,c as Ir,cc as on,d as ke,db as df,dc as sn,e as uo,ea as o0,eb as fo,ec as tu,f as of,fc as nu,ga as pt,gb as po,h as Zy,ha as ht,hb as eu,hc as kn,i as Qy,ib as Es,ic as Ze,jc as X,ka as Os,kb as Mn,kc as an,la as Ti,lc as ho,m as Yy,ma as Ps,mc as d0,nb as $e,o as Zl,oa as Ae,ob as Tt,pa as Rn,pb as mt,rb as l0,rc as gf,sa as fi,sb as ff,sc as _f,tb as u0,tc as yf,u as Xy,vc as mo,wc as Kt,x as e0,xa as jt,xb as pf,xc as f0,y as Ql,ya as Xl,yb as _e,z as t0,za as cf,zb as te}from"./chunk-F5MBSCH4.js";import{a as le,b as Je,e as v,g as rn,h as lo}from"./chunk-B4AJQJMI.js";var j0=v(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.formatNames=hi.fastFormats=hi.fullFormats=void 0;function pi(e,n){return{validate:e,compare:n}}hi.fullFormats={date:pi(k0,Sf),time:pi(xf(!0),Df),"date-time":pi(N0(!0),F0),"iso-time":pi(xf(),A0),"iso-date-time":pi(N0(),q0),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:n2,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:u2,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:i2,int32:{type:"number",validate:s2},int64:{type:"number",validate:a2},float:{type:"number",validate:M0},double:{type:"number",validate:M0},password:!0,binary:!0};hi.fastFormats=Je(le({},hi.fullFormats),{date:pi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Sf),time:pi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Df),"date-time":pi(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,F0),"iso-time":pi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A0),"iso-date-time":pi(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,q0),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i});hi.formatNames=Object.keys(hi.fullFormats);function QF(e){return e%4===0&&(e%100!==0||e%400===0)}var YF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,XF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function k0(e){let n=YF.exec(e);if(!n)return!1;let t=+n[1],i=+n[2],r=+n[3];return i>=1&&i<=12&&r>=1&&r<=(i===2&&QF(t)?29:XF[i])}function Sf(e,n){if(e&&n)return e>n?1:e<n?-1:0}var Cf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function xf(e){return function(t){let i=Cf.exec(t);if(!i)return!1;let r=+i[1],s=+i[2],l=+i[3],u=i[4],d=i[5]==="-"?-1:1,p=+(i[6]||0),m=+(i[7]||0);if(p>23||m>59||e&&!u)return!1;if(r<=23&&s<=59&&l<60)return!0;let _=s-m*d,w=r-p*d-(_<0?1:0);return(w===23||w===-1)&&(_===59||_===-1)&&l<61}}function Df(e,n){if(!(e&&n))return;let t=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+n).valueOf();if(t&&i)return t-i}function A0(e,n){if(!(e&&n))return;let t=Cf.exec(e),i=Cf.exec(n);if(t&&i)return e=t[1]+t[2]+t[3],n=i[1]+i[2]+i[3],e>n?1:e<n?-1:0}var If=/t|\s/i;function N0(e){let n=xf(e);return function(i){let r=i.split(If);return r.length===2&&k0(r[0])&&n(r[1])}}function F0(e,n){if(!(e&&n))return;let t=new Date(e).valueOf(),i=new Date(n).valueOf();if(t&&i)return t-i}function q0(e,n){if(!(e&&n))return;let[t,i]=e.split(If),[r,s]=n.split(If),l=Sf(t,r);if(l!==void 0)return l||Df(i,s)}var e2=/\/|:/,t2=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function n2(e){return e2.test(e)&&t2.test(e)}var R0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function i2(e){return R0.lastIndex=0,R0.test(e)}var r2=-(2**31),o2=2**31-1;function s2(e){return Number.isInteger(e)&&e<=o2&&e>=r2}function a2(e){return Number.isInteger(e)}function M0(){return!0}var l2=/[^\\]\\Z/;function u2(e){if(l2.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ks=v(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Rs=class{};Fe._CodeOrName=Rs;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Pr=class extends Rs{constructor(n){if(super(),!Fe.IDENTIFIER.test(n))throw new Error("CodeGen: name must be a valid identifier");this.str=n}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Pr;var An=class extends Rs{constructor(n){super(),this._items=typeof n=="string"?[n]:n}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let n=this._items[0];return n===""||n==='""'}get str(){var n;return(n=this._str)!==null&&n!==void 0?n:this._str=this._items.reduce((t,i)=>`${t}${i}`,"")}get names(){var n;return(n=this._names)!==null&&n!==void 0?n:this._names=this._items.reduce((t,i)=>(i instanceof Pr&&(t[i.str]=(t[i.str]||0)+1),t),{})}};Fe._Code=An;Fe.nil=new An("");function L0(e,...n){let t=[e[0]],i=0;for(;i<n.length;)Pf(t,n[i]),t.push(e[++i]);return new An(t)}Fe._=L0;var Of=new An("+");function V0(e,...n){let t=[Ms(e[0])],i=0;for(;i<n.length;)t.push(Of),Pf(t,n[i]),t.push(Of,Ms(e[++i]));return c2(t),new An(t)}Fe.str=V0;function Pf(e,n){n instanceof An?e.push(...n._items):n instanceof Pr?e.push(n):e.push(p2(n))}Fe.addCodeArg=Pf;function c2(e){let n=1;for(;n<e.length-1;){if(e[n]===Of){let t=d2(e[n-1],e[n+1]);if(t!==void 0){e.splice(n-1,3,t);continue}e[n++]="+"}n++}}function d2(e,n){if(n==='""')return e;if(e==='""')return n;if(typeof e=="string")return n instanceof Pr||e[e.length-1]!=='"'?void 0:typeof n!="string"?`${e.slice(0,-1)}${n}"`:n[0]==='"'?e.slice(0,-1)+n.slice(1):void 0;if(typeof n=="string"&&n[0]==='"'&&!(e instanceof Pr))return`"${e}${n.slice(1)}`}function f2(e,n){return n.emptyStr()?e:e.emptyStr()?n:V0`${e}${n}`}Fe.strConcat=f2;function p2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ms(Array.isArray(e)?e.join(","):e)}function h2(e){return new An(Ms(e))}Fe.stringify=h2;function Ms(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Fe.safeStringify=Ms;function m2(e){return typeof e=="string"&&Fe.IDENTIFIER.test(e)?new An(`.${e}`):L0`[${e}]`}Fe.getProperty=m2;function g2(e){if(typeof e=="string"&&Fe.IDENTIFIER.test(e))return new An(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Fe.getEsmExportName=g2;function _2(e){return new An(e.toString())}Fe.regexpCode=_2});var $f=v(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.ValueScope=un.ValueScopeName=un.Scope=un.varKinds=un.UsedValueState=void 0;var ln=ks(),Ef=class extends Error{constructor(n){super(`CodeGen: "code" for ${n} not defined`),this.value=n.value}},au=(function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e})(au||(un.UsedValueState=au={}));un.varKinds={const:new ln.Name("const"),let:new ln.Name("let"),var:new ln.Name("var")};var lu=class{constructor({prefixes:n,parent:t}={}){this._names={},this._prefixes=n,this._parent=t}toName(n){return n instanceof ln.Name?n:this.name(n)}name(n){return new ln.Name(this._newName(n))}_newName(n){let t=this._names[n]||this._nameGroup(n);return`${n}${t.index++}`}_nameGroup(n){var t,i;if(!((i=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||i===void 0)&&i.has(n)||this._prefixes&&!this._prefixes.has(n))throw new Error(`CodeGen: prefix "${n}" is not allowed in this scope`);return this._names[n]={prefix:n,index:0}}};un.Scope=lu;var uu=class extends ln.Name{constructor(n,t){super(t),this.prefix=n}setValue(n,{property:t,itemIndex:i}){this.value=n,this.scopePath=(0,ln._)`.${new ln.Name(t)}[${i}]`}};un.ValueScopeName=uu;var y2=(0,ln._)`\n`,Tf=class extends lu{constructor(n){super(n),this._values={},this._scope=n.scope,this.opts=Je(le({},n),{_n:n.lines?y2:ln.nil})}get(){return this._scope}name(n){return new uu(n,this._newName(n))}value(n,t){var i;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(n),{prefix:s}=r,l=(i=t.key)!==null&&i!==void 0?i:t.ref,u=this._values[s];if(u){let m=u.get(l);if(m)return m}else u=this._values[s]=new Map;u.set(l,r);let d=this._scope[s]||(this._scope[s]=[]),p=d.length;return d[p]=t.ref,r.setValue(t,{property:s,itemIndex:p}),r}getValue(n,t){let i=this._values[n];if(i)return i.get(t)}scopeRefs(n,t=this._values){return this._reduceValues(t,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,ln._)`${n}${i.scopePath}`})}scopeCode(n=this._values,t,i){return this._reduceValues(n,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,i)}_reduceValues(n,t,i={},r){let s=ln.nil;for(let l in n){let u=n[l];if(!u)continue;let d=i[l]=i[l]||new Map;u.forEach(p=>{if(d.has(p))return;d.set(p,au.Started);let m=t(p);if(m){let _=this.opts.es5?un.varKinds.var:un.varKinds.const;s=(0,ln._)`${s}${_} ${p} = ${m};${this.opts._n}`}else if(m=r?.(p))s=(0,ln._)`${s}${m}${this.opts._n}`;else throw new Ef(p);d.set(p,au.Completed)})}return s}};un.ValueScope=Tf});var ue=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.or=Se.and=Se.not=Se.CodeGen=Se.operators=Se.varKinds=Se.ValueScopeName=Se.ValueScope=Se.Scope=Se.Name=Se.regexpCode=Se.stringify=Se.getProperty=Se.nil=Se.strConcat=Se.str=Se._=void 0;var Ne=ks(),Yn=$f(),tr=ks();Object.defineProperty(Se,"_",{enumerable:!0,get:function(){return tr._}});Object.defineProperty(Se,"str",{enumerable:!0,get:function(){return tr.str}});Object.defineProperty(Se,"strConcat",{enumerable:!0,get:function(){return tr.strConcat}});Object.defineProperty(Se,"nil",{enumerable:!0,get:function(){return tr.nil}});Object.defineProperty(Se,"getProperty",{enumerable:!0,get:function(){return tr.getProperty}});Object.defineProperty(Se,"stringify",{enumerable:!0,get:function(){return tr.stringify}});Object.defineProperty(Se,"regexpCode",{enumerable:!0,get:function(){return tr.regexpCode}});Object.defineProperty(Se,"Name",{enumerable:!0,get:function(){return tr.Name}});var hu=$f();Object.defineProperty(Se,"Scope",{enumerable:!0,get:function(){return hu.Scope}});Object.defineProperty(Se,"ValueScope",{enumerable:!0,get:function(){return hu.ValueScope}});Object.defineProperty(Se,"ValueScopeName",{enumerable:!0,get:function(){return hu.ValueScopeName}});Object.defineProperty(Se,"varKinds",{enumerable:!0,get:function(){return hu.varKinds}});Se.operators={GT:new Ne._Code(">"),GTE:new Ne._Code(">="),LT:new Ne._Code("<"),LTE:new Ne._Code("<="),EQ:new Ne._Code("==="),NEQ:new Ne._Code("!=="),NOT:new Ne._Code("!"),OR:new Ne._Code("||"),AND:new Ne._Code("&&"),ADD:new Ne._Code("+")};var $i=class{optimizeNodes(){return this}optimizeNames(n,t){return this}},Nf=class extends $i{constructor(n,t,i){super(),this.varKind=n,this.name=t,this.rhs=i}render({es5:n,_n:t}){let i=n?Yn.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${r};`+t}optimizeNames(n,t){if(n[this.name.str])return this.rhs&&(this.rhs=vo(this.rhs,n,t)),this}get names(){return this.rhs instanceof Ne._CodeOrName?this.rhs.names:{}}},du=class extends $i{constructor(n,t,i){super(),this.lhs=n,this.rhs=t,this.sideEffects=i}render({_n:n}){return`${this.lhs} = ${this.rhs};`+n}optimizeNames(n,t){if(!(this.lhs instanceof Ne.Name&&!n[this.lhs.str]&&!this.sideEffects))return this.rhs=vo(this.rhs,n,t),this}get names(){let n=this.lhs instanceof Ne.Name?{}:le({},this.lhs.names);return pu(n,this.rhs)}},Rf=class extends du{constructor(n,t,i,r){super(n,i,r),this.op=t}render({_n:n}){return`${this.lhs} ${this.op}= ${this.rhs};`+n}},Mf=class extends $i{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`${this.label}:`+n}},kf=class extends $i{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`break${this.label?` ${this.label}`:""};`+n}},Af=class extends $i{constructor(n){super(),this.error=n}render({_n:n}){return`throw ${this.error};`+n}get names(){return this.error.names}},Ff=class extends $i{constructor(n){super(),this.code=n}render({_n:n}){return`${this.code};`+n}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(n,t){return this.code=vo(this.code,n,t),this}get names(){return this.code instanceof Ne._CodeOrName?this.code.names:{}}},As=class extends $i{constructor(n=[]){super(),this.nodes=n}render(n){return this.nodes.reduce((t,i)=>t+i.render(n),"")}optimizeNodes(){let{nodes:n}=this,t=n.length;for(;t--;){let i=n[t].optimizeNodes();Array.isArray(i)?n.splice(t,1,...i):i?n[t]=i:n.splice(t,1)}return n.length>0?this:void 0}optimizeNames(n,t){let{nodes:i}=this,r=i.length;for(;r--;){let s=i[r];s.optimizeNames(n,t)||(v2(n,s.names),i.splice(r,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((n,t)=>Er(n,t.names),{})}},Ni=class extends As{render(n){return"{"+n._n+super.render(n)+"}"+n._n}},qf=class extends As{},jf=(()=>{class e extends Ni{}return e.kind="else",e})(),cu=(()=>{class e extends Ni{constructor(t,i){super(i),this.condition=t}render(t){let i=`if(${this.condition})`+super.render(t);return this.else&&(i+="else "+this.else.render(t)),i}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let i=this.else;if(i){let r=i.optimizeNodes();i=this.else=Array.isArray(r)?new jf(r):r}if(i)return t===!1?i instanceof e?i:i.nodes:this.nodes.length?this:new e(W0(t),i instanceof e?[i]:i.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,i){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(t,i),!!(super.optimizeNames(t,i)||this.else))return this.condition=vo(this.condition,t,i),this}get names(){let t=super.names;return pu(t,this.condition),this.else&&Er(t,this.else.names),t}}return e.kind="if",e})(),mu=(()=>{class e extends Ni{}return e.kind="for",e})(),Lf=class extends mu{constructor(n){super(),this.iteration=n}render(n){return`for(${this.iteration})`+super.render(n)}optimizeNames(n,t){if(super.optimizeNames(n,t))return this.iteration=vo(this.iteration,n,t),this}get names(){return Er(super.names,this.iteration.names)}},Vf=class extends mu{constructor(n,t,i,r){super(),this.varKind=n,this.name=t,this.from=i,this.to=r}render(n){let t=n.es5?Yn.varKinds.var:this.varKind,{name:i,from:r,to:s}=this;return`for(${t} ${i}=${r}; ${i}<${s}; ${i}++)`+super.render(n)}get names(){let n=pu(super.names,this.from);return pu(n,this.to)}},fu=class extends mu{constructor(n,t,i,r){super(),this.loop=n,this.varKind=t,this.name=i,this.iterable=r}render(n){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(n)}optimizeNames(n,t){if(super.optimizeNames(n,t))return this.iterable=vo(this.iterable,n,t),this}get names(){return Er(super.names,this.iterable.names)}},z0=(()=>{class e extends Ni{constructor(t,i,r){super(),this.name=t,this.args=i,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),H0=(()=>{class e extends As{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),zf=class extends Ni{render(n){let t="try"+super.render(n);return this.catch&&(t+=this.catch.render(n)),this.finally&&(t+=this.finally.render(n)),t}optimizeNodes(){var n,t;return super.optimizeNodes(),(n=this.catch)===null||n===void 0||n.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(n,t){var i,r;return super.optimizeNames(n,t),(i=this.catch)===null||i===void 0||i.optimizeNames(n,t),(r=this.finally)===null||r===void 0||r.optimizeNames(n,t),this}get names(){let n=super.names;return this.catch&&Er(n,this.catch.names),this.finally&&Er(n,this.finally.names),n}},B0=(()=>{class e extends Ni{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),U0=(()=>{class e extends Ni{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),Hf=class{constructor(n,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=Je(le({},t),{_n:t.lines?`
1
+ import{a as yo,d as E0,e as $s,g as T0,j as Ns,l as $0}from"./chunk-RDHUW73W.js";import{a as go}from"./chunk-C64AHVUO.js";import{C as bf,D as wf,a as v0,b as b0,c as Ts,e as er,f as w0,h as C0,i as x0,k as I0,l as ru,m as S0,o as D0,p as O0,q as _o,t as P0,u as ou,v as vf,w as su}from"./chunk-JPAZUSRO.js";import{e as g0,k as Xi,m as _0,w as y0}from"./chunk-VWUZDCBZ.js";import{$ as Yl,$b as mf,Aa as xt,Ab as ne,C as sf,Ca as s0,Cb as It,Db as St,Ea as a0,Eb as Dt,Fb as W,G as n0,Gb as Y,Hb as Q,I as af,Ib as ae,Mc as Qn,Nc as B,O as i0,Oc as iu,P as co,Pc as p0,Q as lf,Qb as c0,R as Jn,Rb as bt,Rc as $t,S as r0,Sb as Yi,Ua as Re,Uc as Or,Vc as h0,W as uf,Wc as m0,X as je,Xb as Be,Y as Et,Za as L,Zb as F,_ as Zn,_b as hf,a as xr,aa as k,ac as Sr,bc as Dr,c as Ir,cc as on,d as ke,db as df,dc as sn,e as uo,ea as o0,eb as fo,ec as tu,f as of,fc as nu,ga as pt,gb as po,h as Zy,ha as ht,hb as eu,hc as kn,i as Qy,ib as Es,ic as Ze,jc as X,ka as Os,kb as Mn,kc as an,la as Ti,lc as ho,m as Yy,ma as Ps,mc as d0,nb as $e,o as Zl,oa as Ae,ob as Tt,pa as Rn,pb as mt,rb as l0,rc as gf,sa as fi,sb as ff,sc as _f,tb as u0,tc as yf,u as Xy,vc as mo,wc as Kt,x as e0,xa as jt,xb as pf,xc as f0,y as Ql,ya as Xl,yb as _e,z as t0,za as cf,zb as te}from"./chunk-F5MBSCH4.js";import{a as le,b as Je,e as v,g as rn,h as lo}from"./chunk-B4AJQJMI.js";var j0=v(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.formatNames=hi.fastFormats=hi.fullFormats=void 0;function pi(e,n){return{validate:e,compare:n}}hi.fullFormats={date:pi(k0,Sf),time:pi(xf(!0),Df),"date-time":pi(N0(!0),F0),"iso-time":pi(xf(),A0),"iso-date-time":pi(N0(),q0),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:n2,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:u2,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:i2,int32:{type:"number",validate:s2},int64:{type:"number",validate:a2},float:{type:"number",validate:M0},double:{type:"number",validate:M0},password:!0,binary:!0};hi.fastFormats=Je(le({},hi.fullFormats),{date:pi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Sf),time:pi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Df),"date-time":pi(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,F0),"iso-time":pi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A0),"iso-date-time":pi(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,q0),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i});hi.formatNames=Object.keys(hi.fullFormats);function QF(e){return e%4===0&&(e%100!==0||e%400===0)}var YF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,XF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function k0(e){let n=YF.exec(e);if(!n)return!1;let t=+n[1],i=+n[2],r=+n[3];return i>=1&&i<=12&&r>=1&&r<=(i===2&&QF(t)?29:XF[i])}function Sf(e,n){if(e&&n)return e>n?1:e<n?-1:0}var Cf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function xf(e){return function(t){let i=Cf.exec(t);if(!i)return!1;let r=+i[1],s=+i[2],l=+i[3],u=i[4],d=i[5]==="-"?-1:1,p=+(i[6]||0),m=+(i[7]||0);if(p>23||m>59||e&&!u)return!1;if(r<=23&&s<=59&&l<60)return!0;let _=s-m*d,w=r-p*d-(_<0?1:0);return(w===23||w===-1)&&(_===59||_===-1)&&l<61}}function Df(e,n){if(!(e&&n))return;let t=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+n).valueOf();if(t&&i)return t-i}function A0(e,n){if(!(e&&n))return;let t=Cf.exec(e),i=Cf.exec(n);if(t&&i)return e=t[1]+t[2]+t[3],n=i[1]+i[2]+i[3],e>n?1:e<n?-1:0}var If=/t|\s/i;function N0(e){let n=xf(e);return function(i){let r=i.split(If);return r.length===2&&k0(r[0])&&n(r[1])}}function F0(e,n){if(!(e&&n))return;let t=new Date(e).valueOf(),i=new Date(n).valueOf();if(t&&i)return t-i}function q0(e,n){if(!(e&&n))return;let[t,i]=e.split(If),[r,s]=n.split(If),l=Sf(t,r);if(l!==void 0)return l||Df(i,s)}var e2=/\/|:/,t2=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function n2(e){return e2.test(e)&&t2.test(e)}var R0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function i2(e){return R0.lastIndex=0,R0.test(e)}var r2=-(2**31),o2=2**31-1;function s2(e){return Number.isInteger(e)&&e<=o2&&e>=r2}function a2(e){return Number.isInteger(e)}function M0(){return!0}var l2=/[^\\]\\Z/;function u2(e){if(l2.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ks=v(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Rs=class{};Fe._CodeOrName=Rs;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Pr=class extends Rs{constructor(n){if(super(),!Fe.IDENTIFIER.test(n))throw new Error("CodeGen: name must be a valid identifier");this.str=n}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Fe.Name=Pr;var An=class extends Rs{constructor(n){super(),this._items=typeof n=="string"?[n]:n}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let n=this._items[0];return n===""||n==='""'}get str(){var n;return(n=this._str)!==null&&n!==void 0?n:this._str=this._items.reduce((t,i)=>`${t}${i}`,"")}get names(){var n;return(n=this._names)!==null&&n!==void 0?n:this._names=this._items.reduce((t,i)=>(i instanceof Pr&&(t[i.str]=(t[i.str]||0)+1),t),{})}};Fe._Code=An;Fe.nil=new An("");function L0(e,...n){let t=[e[0]],i=0;for(;i<n.length;)Pf(t,n[i]),t.push(e[++i]);return new An(t)}Fe._=L0;var Of=new An("+");function V0(e,...n){let t=[Ms(e[0])],i=0;for(;i<n.length;)t.push(Of),Pf(t,n[i]),t.push(Of,Ms(e[++i]));return c2(t),new An(t)}Fe.str=V0;function Pf(e,n){n instanceof An?e.push(...n._items):n instanceof Pr?e.push(n):e.push(p2(n))}Fe.addCodeArg=Pf;function c2(e){let n=1;for(;n<e.length-1;){if(e[n]===Of){let t=d2(e[n-1],e[n+1]);if(t!==void 0){e.splice(n-1,3,t);continue}e[n++]="+"}n++}}function d2(e,n){if(n==='""')return e;if(e==='""')return n;if(typeof e=="string")return n instanceof Pr||e[e.length-1]!=='"'?void 0:typeof n!="string"?`${e.slice(0,-1)}${n}"`:n[0]==='"'?e.slice(0,-1)+n.slice(1):void 0;if(typeof n=="string"&&n[0]==='"'&&!(e instanceof Pr))return`"${e}${n.slice(1)}`}function f2(e,n){return n.emptyStr()?e:e.emptyStr()?n:V0`${e}${n}`}Fe.strConcat=f2;function p2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ms(Array.isArray(e)?e.join(","):e)}function h2(e){return new An(Ms(e))}Fe.stringify=h2;function Ms(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Fe.safeStringify=Ms;function m2(e){return typeof e=="string"&&Fe.IDENTIFIER.test(e)?new An(`.${e}`):L0`[${e}]`}Fe.getProperty=m2;function g2(e){if(typeof e=="string"&&Fe.IDENTIFIER.test(e))return new An(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Fe.getEsmExportName=g2;function _2(e){return new An(e.toString())}Fe.regexpCode=_2});var $f=v(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.ValueScope=un.ValueScopeName=un.Scope=un.varKinds=un.UsedValueState=void 0;var ln=ks(),Ef=class extends Error{constructor(n){super(`CodeGen: "code" for ${n} not defined`),this.value=n.value}},au=(function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e})(au||(un.UsedValueState=au={}));un.varKinds={const:new ln.Name("const"),let:new ln.Name("let"),var:new ln.Name("var")};var lu=class{constructor({prefixes:n,parent:t}={}){this._names={},this._prefixes=n,this._parent=t}toName(n){return n instanceof ln.Name?n:this.name(n)}name(n){return new ln.Name(this._newName(n))}_newName(n){let t=this._names[n]||this._nameGroup(n);return`${n}${t.index++}`}_nameGroup(n){var t,i;if(!((i=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||i===void 0)&&i.has(n)||this._prefixes&&!this._prefixes.has(n))throw new Error(`CodeGen: prefix "${n}" is not allowed in this scope`);return this._names[n]={prefix:n,index:0}}};un.Scope=lu;var uu=class extends ln.Name{constructor(n,t){super(t),this.prefix=n}setValue(n,{property:t,itemIndex:i}){this.value=n,this.scopePath=(0,ln._)`.${new ln.Name(t)}[${i}]`}};un.ValueScopeName=uu;var y2=(0,ln._)`\n`,Tf=class extends lu{constructor(n){super(n),this._values={},this._scope=n.scope,this.opts=Je(le({},n),{_n:n.lines?y2:ln.nil})}get(){return this._scope}name(n){return new uu(n,this._newName(n))}value(n,t){var i;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(n),{prefix:s}=r,l=(i=t.key)!==null&&i!==void 0?i:t.ref,u=this._values[s];if(u){let m=u.get(l);if(m)return m}else u=this._values[s]=new Map;u.set(l,r);let d=this._scope[s]||(this._scope[s]=[]),p=d.length;return d[p]=t.ref,r.setValue(t,{property:s,itemIndex:p}),r}getValue(n,t){let i=this._values[n];if(i)return i.get(t)}scopeRefs(n,t=this._values){return this._reduceValues(t,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,ln._)`${n}${i.scopePath}`})}scopeCode(n=this._values,t,i){return this._reduceValues(n,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,i)}_reduceValues(n,t,i={},r){let s=ln.nil;for(let l in n){let u=n[l];if(!u)continue;let d=i[l]=i[l]||new Map;u.forEach(p=>{if(d.has(p))return;d.set(p,au.Started);let m=t(p);if(m){let _=this.opts.es5?un.varKinds.var:un.varKinds.const;s=(0,ln._)`${s}${_} ${p} = ${m};${this.opts._n}`}else if(m=r?.(p))s=(0,ln._)`${s}${m}${this.opts._n}`;else throw new Ef(p);d.set(p,au.Completed)})}return s}};un.ValueScope=Tf});var ue=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.or=Se.and=Se.not=Se.CodeGen=Se.operators=Se.varKinds=Se.ValueScopeName=Se.ValueScope=Se.Scope=Se.Name=Se.regexpCode=Se.stringify=Se.getProperty=Se.nil=Se.strConcat=Se.str=Se._=void 0;var Ne=ks(),Yn=$f(),tr=ks();Object.defineProperty(Se,"_",{enumerable:!0,get:function(){return tr._}});Object.defineProperty(Se,"str",{enumerable:!0,get:function(){return tr.str}});Object.defineProperty(Se,"strConcat",{enumerable:!0,get:function(){return tr.strConcat}});Object.defineProperty(Se,"nil",{enumerable:!0,get:function(){return tr.nil}});Object.defineProperty(Se,"getProperty",{enumerable:!0,get:function(){return tr.getProperty}});Object.defineProperty(Se,"stringify",{enumerable:!0,get:function(){return tr.stringify}});Object.defineProperty(Se,"regexpCode",{enumerable:!0,get:function(){return tr.regexpCode}});Object.defineProperty(Se,"Name",{enumerable:!0,get:function(){return tr.Name}});var hu=$f();Object.defineProperty(Se,"Scope",{enumerable:!0,get:function(){return hu.Scope}});Object.defineProperty(Se,"ValueScope",{enumerable:!0,get:function(){return hu.ValueScope}});Object.defineProperty(Se,"ValueScopeName",{enumerable:!0,get:function(){return hu.ValueScopeName}});Object.defineProperty(Se,"varKinds",{enumerable:!0,get:function(){return hu.varKinds}});Se.operators={GT:new Ne._Code(">"),GTE:new Ne._Code(">="),LT:new Ne._Code("<"),LTE:new Ne._Code("<="),EQ:new Ne._Code("==="),NEQ:new Ne._Code("!=="),NOT:new Ne._Code("!"),OR:new Ne._Code("||"),AND:new Ne._Code("&&"),ADD:new Ne._Code("+")};var $i=class{optimizeNodes(){return this}optimizeNames(n,t){return this}},Nf=class extends $i{constructor(n,t,i){super(),this.varKind=n,this.name=t,this.rhs=i}render({es5:n,_n:t}){let i=n?Yn.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${r};`+t}optimizeNames(n,t){if(n[this.name.str])return this.rhs&&(this.rhs=vo(this.rhs,n,t)),this}get names(){return this.rhs instanceof Ne._CodeOrName?this.rhs.names:{}}},du=class extends $i{constructor(n,t,i){super(),this.lhs=n,this.rhs=t,this.sideEffects=i}render({_n:n}){return`${this.lhs} = ${this.rhs};`+n}optimizeNames(n,t){if(!(this.lhs instanceof Ne.Name&&!n[this.lhs.str]&&!this.sideEffects))return this.rhs=vo(this.rhs,n,t),this}get names(){let n=this.lhs instanceof Ne.Name?{}:le({},this.lhs.names);return pu(n,this.rhs)}},Rf=class extends du{constructor(n,t,i,r){super(n,i,r),this.op=t}render({_n:n}){return`${this.lhs} ${this.op}= ${this.rhs};`+n}},Mf=class extends $i{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`${this.label}:`+n}},kf=class extends $i{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`break${this.label?` ${this.label}`:""};`+n}},Af=class extends $i{constructor(n){super(),this.error=n}render({_n:n}){return`throw ${this.error};`+n}get names(){return this.error.names}},Ff=class extends $i{constructor(n){super(),this.code=n}render({_n:n}){return`${this.code};`+n}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(n,t){return this.code=vo(this.code,n,t),this}get names(){return this.code instanceof Ne._CodeOrName?this.code.names:{}}},As=class extends $i{constructor(n=[]){super(),this.nodes=n}render(n){return this.nodes.reduce((t,i)=>t+i.render(n),"")}optimizeNodes(){let{nodes:n}=this,t=n.length;for(;t--;){let i=n[t].optimizeNodes();Array.isArray(i)?n.splice(t,1,...i):i?n[t]=i:n.splice(t,1)}return n.length>0?this:void 0}optimizeNames(n,t){let{nodes:i}=this,r=i.length;for(;r--;){let s=i[r];s.optimizeNames(n,t)||(v2(n,s.names),i.splice(r,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((n,t)=>Er(n,t.names),{})}},Ni=class extends As{render(n){return"{"+n._n+super.render(n)+"}"+n._n}},qf=class extends As{},jf=(()=>{class e extends Ni{}return e.kind="else",e})(),cu=(()=>{class e extends Ni{constructor(t,i){super(i),this.condition=t}render(t){let i=`if(${this.condition})`+super.render(t);return this.else&&(i+="else "+this.else.render(t)),i}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let i=this.else;if(i){let r=i.optimizeNodes();i=this.else=Array.isArray(r)?new jf(r):r}if(i)return t===!1?i instanceof e?i:i.nodes:this.nodes.length?this:new e(W0(t),i instanceof e?[i]:i.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,i){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(t,i),!!(super.optimizeNames(t,i)||this.else))return this.condition=vo(this.condition,t,i),this}get names(){let t=super.names;return pu(t,this.condition),this.else&&Er(t,this.else.names),t}}return e.kind="if",e})(),mu=(()=>{class e extends Ni{}return e.kind="for",e})(),Lf=class extends mu{constructor(n){super(),this.iteration=n}render(n){return`for(${this.iteration})`+super.render(n)}optimizeNames(n,t){if(super.optimizeNames(n,t))return this.iteration=vo(this.iteration,n,t),this}get names(){return Er(super.names,this.iteration.names)}},Vf=class extends mu{constructor(n,t,i,r){super(),this.varKind=n,this.name=t,this.from=i,this.to=r}render(n){let t=n.es5?Yn.varKinds.var:this.varKind,{name:i,from:r,to:s}=this;return`for(${t} ${i}=${r}; ${i}<${s}; ${i}++)`+super.render(n)}get names(){let n=pu(super.names,this.from);return pu(n,this.to)}},fu=class extends mu{constructor(n,t,i,r){super(),this.loop=n,this.varKind=t,this.name=i,this.iterable=r}render(n){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(n)}optimizeNames(n,t){if(super.optimizeNames(n,t))return this.iterable=vo(this.iterable,n,t),this}get names(){return Er(super.names,this.iterable.names)}},z0=(()=>{class e extends Ni{constructor(t,i,r){super(),this.name=t,this.args=i,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),H0=(()=>{class e extends As{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),zf=class extends Ni{render(n){let t="try"+super.render(n);return this.catch&&(t+=this.catch.render(n)),this.finally&&(t+=this.finally.render(n)),t}optimizeNodes(){var n,t;return super.optimizeNodes(),(n=this.catch)===null||n===void 0||n.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(n,t){var i,r;return super.optimizeNames(n,t),(i=this.catch)===null||i===void 0||i.optimizeNames(n,t),(r=this.finally)===null||r===void 0||r.optimizeNames(n,t),this}get names(){let n=super.names;return this.catch&&Er(n,this.catch.names),this.finally&&Er(n,this.finally.names),n}},B0=(()=>{class e extends Ni{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),U0=(()=>{class e extends Ni{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),Hf=class{constructor(n,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=Je(le({},t),{_n:t.lines?`
2
2
  `:""}),this._extScope=n,this._scope=new Yn.Scope({parent:n}),this._nodes=[new qf]}toString(){return this._root.render(this.opts)}name(n){return this._scope.name(n)}scopeName(n){return this._extScope.name(n)}scopeValue(n,t){let i=this._extScope.value(n,t);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(n,t){return this._extScope.getValue(n,t)}scopeRefs(n){return this._extScope.scopeRefs(n,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(n,t,i,r){let s=this._scope.toName(t);return i!==void 0&&r&&(this._constants[s.str]=i),this._leafNode(new Nf(n,s,i)),s}const(n,t,i){return this._def(Yn.varKinds.const,n,t,i)}let(n,t,i){return this._def(Yn.varKinds.let,n,t,i)}var(n,t,i){return this._def(Yn.varKinds.var,n,t,i)}assign(n,t,i){return this._leafNode(new du(n,t,i))}add(n,t){return this._leafNode(new Rf(n,Se.operators.ADD,t))}code(n){return typeof n=="function"?n():n!==Ne.nil&&this._leafNode(new Ff(n)),this}object(...n){let t=["{"];for(let[i,r]of n)t.length>1&&t.push(","),t.push(i),(i!==r||this.opts.es5)&&(t.push(":"),(0,Ne.addCodeArg)(t,r));return t.push("}"),new Ne._Code(t)}if(n,t,i){if(this._blockNode(new cu(n)),t&&i)this.code(t).else().code(i).endIf();else if(t)this.code(t).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(n){return this._elseNode(new cu(n))}else(){return this._elseNode(new jf)}endIf(){return this._endBlockNode(cu,jf)}_for(n,t){return this._blockNode(n),t&&this.code(t).endFor(),this}for(n,t){return this._for(new Lf(n),t)}forRange(n,t,i,r,s=this.opts.es5?Yn.varKinds.var:Yn.varKinds.let){let l=this._scope.toName(n);return this._for(new Vf(s,l,t,i),()=>r(l))}forOf(n,t,i,r=Yn.varKinds.const){let s=this._scope.toName(n);if(this.opts.es5){let l=t instanceof Ne.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,Ne._)`${l}.length`,u=>{this.var(s,(0,Ne._)`${l}[${u}]`),i(s)})}return this._for(new fu("of",r,s,t),()=>i(s))}forIn(n,t,i,r=this.opts.es5?Yn.varKinds.var:Yn.varKinds.const){if(this.opts.ownProperties)return this.forOf(n,(0,Ne._)`Object.keys(${t})`,i);let s=this._scope.toName(n);return this._for(new fu("in",r,s,t),()=>i(s))}endFor(){return this._endBlockNode(mu)}label(n){return this._leafNode(new Mf(n))}break(n){return this._leafNode(new kf(n))}return(n){let t=new H0;if(this._blockNode(t),this.code(n),t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(H0)}try(n,t,i){if(!t&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let r=new zf;if(this._blockNode(r),this.code(n),t){let s=this.name("e");this._currNode=r.catch=new B0(s),t(s)}return i&&(this._currNode=r.finally=new U0,this.code(i)),this._endBlockNode(B0,U0)}throw(n){return this._leafNode(new Af(n))}block(n,t){return this._blockStarts.push(this._nodes.length),n&&this.code(n).endBlock(t),this}endBlock(n){let t=this._blockStarts.pop();if(t===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-t;if(i<0||n!==void 0&&i!==n)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${n} expected`);return this._nodes.length=t,this}func(n,t=Ne.nil,i,r){return this._blockNode(new z0(n,t,i)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(z0)}optimize(n=1){for(;n-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(n){return this._currNode.nodes.push(n),this}_blockNode(n){this._currNode.nodes.push(n),this._nodes.push(n)}_endBlockNode(n,t){let i=this._currNode;if(i instanceof n||t&&i instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${n.kind}/${t.kind}`:n.kind}"`)}_elseNode(n){let t=this._currNode;if(!(t instanceof cu))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=n,this}get _root(){return this._nodes[0]}get _currNode(){let n=this._nodes;return n[n.length-1]}set _currNode(n){let t=this._nodes;t[t.length-1]=n}};Se.CodeGen=Hf;function Er(e,n){for(let t in n)e[t]=(e[t]||0)+(n[t]||0);return e}function pu(e,n){return n instanceof Ne._CodeOrName?Er(e,n.names):e}function vo(e,n,t){if(e instanceof Ne.Name)return i(e);if(!r(e))return e;return new Ne._Code(e._items.reduce((s,l)=>(l instanceof Ne.Name&&(l=i(l)),l instanceof Ne._Code?s.push(...l._items):s.push(l),s),[]));function i(s){let l=t[s.str];return l===void 0||n[s.str]!==1?s:(delete n[s.str],l)}function r(s){return s instanceof Ne._Code&&s._items.some(l=>l instanceof Ne.Name&&n[l.str]===1&&t[l.str]!==void 0)}}function v2(e,n){for(let t in n)e[t]=(e[t]||0)-(n[t]||0)}function W0(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Ne._)`!${Bf(e)}`}Se.not=W0;var b2=G0(Se.operators.AND);function w2(...e){return e.reduce(b2)}Se.and=w2;var C2=G0(Se.operators.OR);function x2(...e){return e.reduce(C2)}Se.or=x2;function G0(e){return(n,t)=>n===Ne.nil?t:t===Ne.nil?n:(0,Ne._)`${Bf(n)} ${e} ${Bf(t)}`}function Bf(e){return e instanceof Ne.Name?e:(0,Ne._)`(${e})`}});var Pe=v(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.checkStrictMode=De.getErrorPath=De.Type=De.useFunc=De.setEvaluated=De.evaluatedPropsToName=De.mergeEvaluated=De.eachItem=De.unescapeJsonPointer=De.escapeJsonPointer=De.escapeFragment=De.unescapeFragment=De.schemaRefOrVal=De.schemaHasRulesButRef=De.schemaHasRules=De.checkUnknownRules=De.alwaysValidSchema=De.toHash=void 0;var Qe=ue(),I2=ks();function S2(e){let n={};for(let t of e)n[t]=!0;return n}De.toHash=S2;function D2(e,n){return typeof n=="boolean"?n:Object.keys(n).length===0?!0:(Z0(e,n),!Q0(n,e.self.RULES.all))}De.alwaysValidSchema=D2;function Z0(e,n=e.schema){let{opts:t,self:i}=e;if(!t.strictSchema||typeof n=="boolean")return;let r=i.RULES.keywords;for(let s in n)r[s]||ev(e,`unknown keyword: "${s}"`)}De.checkUnknownRules=Z0;function Q0(e,n){if(typeof e=="boolean")return!e;for(let t in e)if(n[t])return!0;return!1}De.schemaHasRules=Q0;function O2(e,n){if(typeof e=="boolean")return!e;for(let t in e)if(t!=="$ref"&&n.all[t])return!0;return!1}De.schemaHasRulesButRef=O2;function P2({topSchemaRef:e,schemaPath:n},t,i,r){if(!r){if(typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="string")return(0,Qe._)`${t}`}return(0,Qe._)`${e}${n}${(0,Qe.getProperty)(i)}`}De.schemaRefOrVal=P2;function E2(e){return Y0(decodeURIComponent(e))}De.unescapeFragment=E2;function T2(e){return encodeURIComponent(Wf(e))}De.escapeFragment=T2;function Wf(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}De.escapeJsonPointer=Wf;function Y0(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}De.unescapeJsonPointer=Y0;function $2(e,n){if(Array.isArray(e))for(let t of e)n(t);else n(e)}De.eachItem=$2;function K0({mergeNames:e,mergeToName:n,mergeValues:t,resultToName:i}){return(r,s,l,u)=>{let d=l===void 0?s:l instanceof Qe.Name?(s instanceof Qe.Name?e(r,s,l):n(r,s,l),l):s instanceof Qe.Name?(n(r,l,s),s):t(s,l);return u===Qe.Name&&!(d instanceof Qe.Name)?i(r,d):d}}De.mergeEvaluated={props:K0({mergeNames:(e,n,t)=>e.if((0,Qe._)`${t} !== true && ${n} !== undefined`,()=>{e.if((0,Qe._)`${n} === true`,()=>e.assign(t,!0),()=>e.assign(t,(0,Qe._)`${t} || {}`).code((0,Qe._)`Object.assign(${t}, ${n})`))}),mergeToName:(e,n,t)=>e.if((0,Qe._)`${t} !== true`,()=>{n===!0?e.assign(t,!0):(e.assign(t,(0,Qe._)`${t} || {}`),Gf(e,t,n))}),mergeValues:(e,n)=>e===!0?!0:le(le({},e),n),resultToName:X0}),items:K0({mergeNames:(e,n,t)=>e.if((0,Qe._)`${t} !== true && ${n} !== undefined`,()=>e.assign(t,(0,Qe._)`${n} === true ? true : ${t} > ${n} ? ${t} : ${n}`)),mergeToName:(e,n,t)=>e.if((0,Qe._)`${t} !== true`,()=>e.assign(t,n===!0?!0:(0,Qe._)`${t} > ${n} ? ${t} : ${n}`)),mergeValues:(e,n)=>e===!0?!0:Math.max(e,n),resultToName:(e,n)=>e.var("items",n)})};function X0(e,n){if(n===!0)return e.var("props",!0);let t=e.var("props",(0,Qe._)`{}`);return n!==void 0&&Gf(e,t,n),t}De.evaluatedPropsToName=X0;function Gf(e,n,t){Object.keys(t).forEach(i=>e.assign((0,Qe._)`${n}${(0,Qe.getProperty)(i)}`,!0))}De.setEvaluated=Gf;var J0={};function N2(e,n){return e.scopeValue("func",{ref:n,code:J0[n.code]||(J0[n.code]=new I2._Code(n.code))})}De.useFunc=N2;var Uf=(function(e){return e[e.Num=0]="Num",e[e.Str=1]="Str",e})(Uf||(De.Type=Uf={}));function R2(e,n,t){if(e instanceof Qe.Name){let i=n===Uf.Num;return t?i?(0,Qe._)`"[" + ${e} + "]"`:(0,Qe._)`"['" + ${e} + "']"`:i?(0,Qe._)`"/" + ${e}`:(0,Qe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,Qe.getProperty)(e).toString():"/"+Wf(e)}De.getErrorPath=R2;function ev(e,n,t=e.opts.strictSchema){if(t){if(n=`strict mode: ${n}`,t===!0)throw new Error(n);e.self.logger.warn(n)}}De.checkStrictMode=ev});var Fn=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});var Lt=ue(),M2={data:new Lt.Name("data"),valCxt:new Lt.Name("valCxt"),instancePath:new Lt.Name("instancePath"),parentData:new Lt.Name("parentData"),parentDataProperty:new Lt.Name("parentDataProperty"),rootData:new Lt.Name("rootData"),dynamicAnchors:new Lt.Name("dynamicAnchors"),vErrors:new Lt.Name("vErrors"),errors:new Lt.Name("errors"),this:new Lt.Name("this"),self:new Lt.Name("self"),scope:new Lt.Name("scope"),json:new Lt.Name("json"),jsonPos:new Lt.Name("jsonPos"),jsonLen:new Lt.Name("jsonLen"),jsonPart:new Lt.Name("jsonPart")};Kf.default=M2});var Fs=v(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.extendErrors=Vt.resetErrorsCount=Vt.reportExtraError=Vt.reportError=Vt.keyword$DataError=Vt.keywordError=void 0;var Me=ue(),gu=Pe(),Jt=Fn();Vt.keywordError={message:({keyword:e})=>(0,Me.str)`must pass "${e}" keyword validation`};Vt.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,Me.str)`"${e}" keyword must be ${n} ($data)`:(0,Me.str)`"${e}" keyword is invalid ($data)`};function k2(e,n=Vt.keywordError,t,i){let{it:r}=e,{gen:s,compositeRule:l,allErrors:u}=r,d=iv(e,n,t);i??(l||u)?tv(s,d):nv(r,(0,Me._)`[${d}]`)}Vt.reportError=k2;function A2(e,n=Vt.keywordError,t){let{it:i}=e,{gen:r,compositeRule:s,allErrors:l}=i,u=iv(e,n,t);tv(r,u),s||l||nv(i,Jt.default.vErrors)}Vt.reportExtraError=A2;function F2(e,n){e.assign(Jt.default.errors,n),e.if((0,Me._)`${Jt.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,Me._)`${Jt.default.vErrors}.length`,n),()=>e.assign(Jt.default.vErrors,null)))}Vt.resetErrorsCount=F2;function q2({gen:e,keyword:n,schemaValue:t,data:i,errsCount:r,it:s}){if(r===void 0)throw new Error("ajv implementation error");let l=e.name("err");e.forRange("i",r,Jt.default.errors,u=>{e.const(l,(0,Me._)`${Jt.default.vErrors}[${u}]`),e.if((0,Me._)`${l}.instancePath === undefined`,()=>e.assign((0,Me._)`${l}.instancePath`,(0,Me.strConcat)(Jt.default.instancePath,s.errorPath))),e.assign((0,Me._)`${l}.schemaPath`,(0,Me.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,Me._)`${l}.schema`,t),e.assign((0,Me._)`${l}.data`,i))})}Vt.extendErrors=q2;function tv(e,n){let t=e.const("err",n);e.if((0,Me._)`${Jt.default.vErrors} === null`,()=>e.assign(Jt.default.vErrors,(0,Me._)`[${t}]`),(0,Me._)`${Jt.default.vErrors}.push(${t})`),e.code((0,Me._)`${Jt.default.errors}++`)}function nv(e,n){let{gen:t,validateName:i,schemaEnv:r}=e;r.$async?t.throw((0,Me._)`new ${e.ValidationError}(${n})`):(t.assign((0,Me._)`${i}.errors`,n),t.return(!1))}var Tr={keyword:new Me.Name("keyword"),schemaPath:new Me.Name("schemaPath"),params:new Me.Name("params"),propertyName:new Me.Name("propertyName"),message:new Me.Name("message"),schema:new Me.Name("schema"),parentSchema:new Me.Name("parentSchema")};function iv(e,n,t){let{createErrors:i}=e.it;return i===!1?(0,Me._)`{}`:j2(e,n,t)}function j2(e,n,t={}){let{gen:i,it:r}=e,s=[L2(r,t),V2(e,t)];return z2(e,n,s),i.object(...s)}function L2({errorPath:e},{instancePath:n}){let t=n?(0,Me.str)`${e}${(0,gu.getErrorPath)(n,gu.Type.Str)}`:e;return[Jt.default.instancePath,(0,Me.strConcat)(Jt.default.instancePath,t)]}function V2({keyword:e,it:{errSchemaPath:n}},{schemaPath:t,parentSchema:i}){let r=i?n:(0,Me.str)`${n}/${e}`;return t&&(r=(0,Me.str)`${r}${(0,gu.getErrorPath)(t,gu.Type.Str)}`),[Tr.schemaPath,r]}function z2(e,{params:n,message:t},i){let{keyword:r,data:s,schemaValue:l,it:u}=e,{opts:d,propertyName:p,topSchemaRef:m,schemaPath:_}=u;i.push([Tr.keyword,r],[Tr.params,typeof n=="function"?n(e):n||(0,Me._)`{}`]),d.messages&&i.push([Tr.message,typeof t=="function"?t(e):t]),d.verbose&&i.push([Tr.schema,l],[Tr.parentSchema,(0,Me._)`${m}${_}`],[Jt.default.data,s]),p&&i.push([Tr.propertyName,p])}});var ov=v(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.boolOrEmptySchema=bo.topBoolOrEmptySchema=void 0;var H2=Fs(),B2=ue(),U2=Fn(),W2={message:"boolean schema is false"};function G2(e){let{gen:n,schema:t,validateName:i}=e;t===!1?rv(e,!1):typeof t=="object"&&t.$async===!0?n.return(U2.default.data):(n.assign((0,B2._)`${i}.errors`,null),n.return(!0))}bo.topBoolOrEmptySchema=G2;function K2(e,n){let{gen:t,schema:i}=e;i===!1?(t.var(n,!1),rv(e)):t.var(n,!0)}bo.boolOrEmptySchema=K2;function rv(e,n){let{gen:t,data:i}=e,r={gen:t,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,H2.reportError)(r,W2,void 0,n)}});var Jf=v(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.getRules=wo.isJSONType=void 0;var J2=["string","number","integer","boolean","null","object","array"],Z2=new Set(J2);function Q2(e){return typeof e=="string"&&Z2.has(e)}wo.isJSONType=Q2;function Y2(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:Je(le({},e),{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}wo.getRules=Y2});var Zf=v(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function X2({schema:e,self:n},t){let i=n.RULES.types[t];return i&&i!==!0&&sv(e,i)}nr.schemaHasRulesForType=X2;function sv(e,n){return n.rules.some(t=>av(e,t))}nr.shouldUseGroup=sv;function av(e,n){var t;return e[n.keyword]!==void 0||((t=n.definition.implements)===null||t===void 0?void 0:t.some(i=>e[i]!==void 0))}nr.shouldUseRule=av});var qs=v(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.reportTypeError=zt.checkDataTypes=zt.checkDataType=zt.coerceAndCheckDataType=zt.getJSONTypes=zt.getSchemaTypes=zt.DataType=void 0;var eq=Jf(),tq=Zf(),nq=Fs(),we=ue(),lv=Pe(),Co=(function(e){return e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong",e})(Co||(zt.DataType=Co={}));function iq(e){let n=uv(e.type);if(n.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!n.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&n.push("null")}return n}zt.getSchemaTypes=iq;function uv(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(eq.isJSONType))return n;throw new Error("type must be JSONType or JSONType[]: "+n.join(","))}zt.getJSONTypes=uv;function rq(e,n){let{gen:t,data:i,opts:r}=e,s=oq(n,r.coerceTypes),l=n.length>0&&!(s.length===0&&n.length===1&&(0,tq.schemaHasRulesForType)(e,n[0]));if(l){let u=Yf(n,i,r.strictNumbers,Co.Wrong);t.if(u,()=>{s.length?sq(e,n,s):Xf(e)})}return l}zt.coerceAndCheckDataType=rq;var cv=new Set(["string","number","integer","boolean","null"]);function oq(e,n){return n?e.filter(t=>cv.has(t)||n==="array"&&t==="array"):[]}function sq(e,n,t){let{gen:i,data:r,opts:s}=e,l=i.let("dataType",(0,we._)`typeof ${r}`),u=i.let("coerced",(0,we._)`undefined`);s.coerceTypes==="array"&&i.if((0,we._)`${l} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>i.assign(r,(0,we._)`${r}[0]`).assign(l,(0,we._)`typeof ${r}`).if(Yf(n,r,s.strictNumbers),()=>i.assign(u,r))),i.if((0,we._)`${u} !== undefined`);for(let p of t)(cv.has(p)||p==="array"&&s.coerceTypes==="array")&&d(p);i.else(),Xf(e),i.endIf(),i.if((0,we._)`${u} !== undefined`,()=>{i.assign(r,u),aq(e,u)});function d(p){switch(p){case"string":i.elseIf((0,we._)`${l} == "number" || ${l} == "boolean"`).assign(u,(0,we._)`"" + ${r}`).elseIf((0,we._)`${r} === null`).assign(u,(0,we._)`""`);return;case"number":i.elseIf((0,we._)`${l} == "boolean" || ${r} === null
3
3
  || (${l} == "string" && ${r} && ${r} == +${r})`).assign(u,(0,we._)`+${r}`);return;case"integer":i.elseIf((0,we._)`${l} === "boolean" || ${r} === null
4
4
  || (${l} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(u,(0,we._)`+${r}`);return;case"boolean":i.elseIf((0,we._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(u,!1).elseIf((0,we._)`${r} === "true" || ${r} === 1`).assign(u,!0);return;case"null":i.elseIf((0,we._)`${r} === "" || ${r} === 0 || ${r} === false`),i.assign(u,null);return;case"array":i.elseIf((0,we._)`${l} === "string" || ${l} === "number"
@@ -1,3 +1,3 @@
1
- import{a as lt}from"./chunk-Y7OC2MBV.js";import"./chunk-BMOLDRJ3.js";import{a as k}from"./chunk-AMSZTHK7.js";import{a as ht}from"./chunk-H7F7H5MW.js";import{a as M}from"./chunk-HH2FDI7W.js";import"./chunk-7SWRANGJ.js";import{a as st}from"./chunk-OTMZDL7S.js";import{t as at}from"./chunk-RDHUW73W.js";import{a as G}from"./chunk-C64AHVUO.js";import{b as U}from"./chunk-TKVKJ7BH.js";import{D as rt,c as X,e as Y,f as Z,g as tt,j as et,m as ot,r as it,s as nt}from"./chunk-UUTQE5VH.js";import{b as K}from"./chunk-IL3A5BIS.js";import{C as H,D as Q,F as W,I as J}from"./chunk-B23NNBW7.js";import{Ab as v,Dc as a,Ec as s,F as I,Fb as f,Gb as m,Hb as c,I as V,Ib as p,Oc as E,Rb as y,Xb as h,Ya as F,Za as r,Zb as d,aa as l,d as P,ea as q,ec as N,fc as z,ga as u,ha as g,ic as B,jc as A,kc as T,lc as L,ma as D,mb as $,nb as j,sa as S,uc as R,yb as b,zb as w}from"./chunk-F5MBSCH4.js";import{g as pt,h as C}from"./chunk-B4AJQJMI.js";var O=pt(ht(),1);var ut=["logoutput"],gt=["searchInput"];function ft(n,x){if(n&1){let o=y();m(0,"div",5)(1,"button",9),a(2,"translate"),a(3,"translate"),h("click",function(){u(o);let t=d();return g(t.showSearch())}),p(4,"i"),c(),m(5,"button",9),a(6,"translate"),a(7,"translate"),h("click",function(){u(o);let t=d();return g(t.downloadLogFile())}),p(8,"i",10),c(),m(9,"button",11),a(10,"translate"),a(11,"translate"),h("click",function(){u(o);let t=d();return g(t.truncateLogFile())}),p(12,"i",12),c()()}if(n&2){let o=d();r(),f("openDelay",150)("ngbTooltip",s(2,12,"form.search")),b("aria-label",s(3,14,"form.search")),r(3),A(R("fas",o.showSearchBar()?" primary-text":""," fa-search")),r(),f("openDelay",150)("ngbTooltip",s(6,16,"form.button_download")),b("aria-label",s(7,18,"form.button_download")),r(4),f("openDelay",150)("ngbTooltip",s(10,20,"form.button_delete")),b("aria-label",s(11,22,"form.button_delete"))}}function bt(n,x){if(n&1){let o=y();m(0,"button",18),a(1,"translate"),h("click",function(){u(o);let t=d(2);return g(t.onClearSearch())}),p(2,"i",19),c()}n&2&&b("aria-label",s(1,1,"form.button_clear"))}function _t(n,x){n&1&&(m(0,"span",17),T(1),a(2,"translate"),c()),n&2&&(r(),L(s(2,1,"common.labels.beta")))}function wt(n,x){if(n&1){let o=y();m(0,"div",6)(1,"div",13)(2,"form",14),h("ngSubmit",function(){u(o);let t=d();return g(t.onSubmit(t.form.value))}),p(3,"input",15,1),a(5,"translate"),w(6,bt,3,3,"button",16)(7,_t,3,3,"span",17),c()()()}if(n&2){let o,e=d();r(2),f("formGroup",e.form),r(),B("is-invalid",e.searchInputInvalid),f("placeholder",s(5,5,"logs.placeholder_search_logs")),r(3),v((o=e.form.get("query"))!=null&&o.value?6:7)}}var Nt=(()=>{class n{destroyRef=l(D);injector=l(q);$api=l(J);$auth=l(U);$log=l(lt);$modal=l(at);$settings=l(K);$toastr=l(W);$translate=l(H);termTarget=E("logoutput");searchInput=E("searchInput");resizeEvent=new P;isAdmin=this.$auth.user.admin;showSearchBar=S(!1);showExitButton=S(!1);form=new tt({query:new et("")});get searchInputInvalid(){let o=(this.form.get("query")?.value||"").trim();return o.length>0&&o.length<3}onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){let o=this.$translate.instant("menu.linux.label_logs");if(this.$settings.setPageTitle(o),window.document.querySelector("body").classList.add("bg-black"),this.$settings.actualLightingMode==="light"){window.document.querySelector("body").classList.add("light-mode");let e=this.termTarget()?.nativeElement;e&&e.classList.add("light-mode")}this.$log.startTerminal(this.termTarget(),{allowProposedApi:!0},this.resizeEvent),this.form.get("query")?.valueChanges.pipe(I(500),V(),G(this.destroyRef)).subscribe(e=>{let t=e||"",i=t.trim();i!==t&&this.form.get("query")?.setValue(i,{emitEvent:!1}),i.length>=3?(this.showExitButton.set(!0),this.$log.setSearchFilter(i),this.$log.scrollToBottom()):i.length<3&&this.showExitButton()&&(this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom())})}showSearch(){if(this.showSearchBar())this.showSearchBar.set(!1),this.showExitButton.set(!1),this.form.setValue({query:""}),this.$log.clearSearchFilter();else{this.showSearchBar.set(!0);let o=this.searchInput();o&&setTimeout(()=>o.nativeElement.focus(),10)}setTimeout(()=>this.resizeEvent.next(void 0),10),this.$log.scrollToBottom()}onSubmit(o){let e=(o.query||"").trim();!e.length||e.length<3?(e.length||this.showSearchBar.set(!1),this.form.setValue({query:""}),this.showExitButton.set(!1),this.$log.clearSearchFilter()):(this.showExitButton.set(!0),this.$log.setSearchFilter(e)),this.$log.scrollToBottom()}onClearSearch(){this.form.setValue({query:""}),this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom()}canDeactivate(o){return this.$settings.actualLightingMode!=="light"?(window.document.querySelector("body").classList.remove("bg-black"),Promise.resolve(!0)):(this.showSearchBar()&&this.showSearchBar.set(!1),window.document.querySelector("body").classList.remove("light-mode"),new Promise(e=>{let t=o&&(o.includes("/platform-tools/terminal")||o.includes("/logs")),i=this.termTarget()?.nativeElement;i&&i.classList.add("fade-out"),t?setTimeout(()=>{e(!0)},250):(setTimeout(()=>{window.document.querySelector("body").classList.remove("bg-black")},250),setTimeout(()=>{e(!0)},500))}))}ngOnDestroy(){window.document.querySelector("body").classList.remove("light-mode"),this.resizeEvent.complete(),this.$log.destroyTerminal()}downloadLogFile(){return C(this,null,function*(){let o=$([{provide:M,useValue:{title:this.$translate.instant("logs.title_download_log_file"),message:this.$translate.instant("logs.download_warning"),confirmButtonLabel:this.$translate.instant("form.button_download"),faIconClass:"fas fa-user-secret primary-text"}}],this.injector),e=this.$modal.open(k,{size:"lg",backdrop:"static",injector:o});try{yield e.result;try{let t=yield this.$api.get("/platform-tools/hb-service/log/download",{observe:"response",responseType:"blob"}),i=this.$log.getSearchFilter();if(i){let ct=(yield t.body.text()).split(`
1
+ import{a as lt}from"./chunk-XUP37AHQ.js";import"./chunk-BMOLDRJ3.js";import{a as k}from"./chunk-6U3YEWBO.js";import{a as ht}from"./chunk-H7F7H5MW.js";import{a as M}from"./chunk-HH2FDI7W.js";import"./chunk-H2UKSDHZ.js";import{a as st}from"./chunk-OTMZDL7S.js";import{t as at}from"./chunk-RDHUW73W.js";import{a as G}from"./chunk-C64AHVUO.js";import{b as U}from"./chunk-664C4LX2.js";import{D as rt,c as X,e as Y,f as Z,g as tt,j as et,m as ot,r as it,s as nt}from"./chunk-JPAZUSRO.js";import{b as K}from"./chunk-MAJDTCMY.js";import{C as H,D as Q,F as W,I as J}from"./chunk-VWUZDCBZ.js";import{Ab as v,Dc as a,Ec as s,F as I,Fb as f,Gb as m,Hb as c,I as V,Ib as p,Oc as E,Rb as y,Xb as h,Ya as F,Za as r,Zb as d,aa as l,d as P,ea as q,ec as N,fc as z,ga as u,ha as g,ic as B,jc as A,kc as T,lc as L,ma as D,mb as $,nb as j,sa as S,uc as R,yb as b,zb as w}from"./chunk-F5MBSCH4.js";import{g as pt,h as C}from"./chunk-B4AJQJMI.js";var O=pt(ht(),1);var ut=["logoutput"],gt=["searchInput"];function ft(n,x){if(n&1){let o=y();m(0,"div",5)(1,"button",9),a(2,"translate"),a(3,"translate"),h("click",function(){u(o);let t=d();return g(t.showSearch())}),p(4,"i"),c(),m(5,"button",9),a(6,"translate"),a(7,"translate"),h("click",function(){u(o);let t=d();return g(t.downloadLogFile())}),p(8,"i",10),c(),m(9,"button",11),a(10,"translate"),a(11,"translate"),h("click",function(){u(o);let t=d();return g(t.truncateLogFile())}),p(12,"i",12),c()()}if(n&2){let o=d();r(),f("openDelay",150)("ngbTooltip",s(2,12,"form.search")),b("aria-label",s(3,14,"form.search")),r(3),A(R("fas",o.showSearchBar()?" primary-text":""," fa-search")),r(),f("openDelay",150)("ngbTooltip",s(6,16,"form.button_download")),b("aria-label",s(7,18,"form.button_download")),r(4),f("openDelay",150)("ngbTooltip",s(10,20,"form.button_delete")),b("aria-label",s(11,22,"form.button_delete"))}}function bt(n,x){if(n&1){let o=y();m(0,"button",18),a(1,"translate"),h("click",function(){u(o);let t=d(2);return g(t.onClearSearch())}),p(2,"i",19),c()}n&2&&b("aria-label",s(1,1,"form.button_clear"))}function _t(n,x){n&1&&(m(0,"span",17),T(1),a(2,"translate"),c()),n&2&&(r(),L(s(2,1,"common.labels.beta")))}function wt(n,x){if(n&1){let o=y();m(0,"div",6)(1,"div",13)(2,"form",14),h("ngSubmit",function(){u(o);let t=d();return g(t.onSubmit(t.form.value))}),p(3,"input",15,1),a(5,"translate"),w(6,bt,3,3,"button",16)(7,_t,3,3,"span",17),c()()()}if(n&2){let o,e=d();r(2),f("formGroup",e.form),r(),B("is-invalid",e.searchInputInvalid),f("placeholder",s(5,5,"logs.placeholder_search_logs")),r(3),v((o=e.form.get("query"))!=null&&o.value?6:7)}}var Nt=(()=>{class n{destroyRef=l(D);injector=l(q);$api=l(J);$auth=l(U);$log=l(lt);$modal=l(at);$settings=l(K);$toastr=l(W);$translate=l(H);termTarget=E("logoutput");searchInput=E("searchInput");resizeEvent=new P;isAdmin=this.$auth.user.admin;showSearchBar=S(!1);showExitButton=S(!1);form=new tt({query:new et("")});get searchInputInvalid(){let o=(this.form.get("query")?.value||"").trim();return o.length>0&&o.length<3}onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){let o=this.$translate.instant("menu.linux.label_logs");if(this.$settings.setPageTitle(o),window.document.querySelector("body").classList.add("bg-black"),this.$settings.actualLightingMode==="light"){window.document.querySelector("body").classList.add("light-mode");let e=this.termTarget()?.nativeElement;e&&e.classList.add("light-mode")}this.$log.startTerminal(this.termTarget(),{allowProposedApi:!0},this.resizeEvent),this.form.get("query")?.valueChanges.pipe(I(500),V(),G(this.destroyRef)).subscribe(e=>{let t=e||"",i=t.trim();i!==t&&this.form.get("query")?.setValue(i,{emitEvent:!1}),i.length>=3?(this.showExitButton.set(!0),this.$log.setSearchFilter(i),this.$log.scrollToBottom()):i.length<3&&this.showExitButton()&&(this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom())})}showSearch(){if(this.showSearchBar())this.showSearchBar.set(!1),this.showExitButton.set(!1),this.form.setValue({query:""}),this.$log.clearSearchFilter();else{this.showSearchBar.set(!0);let o=this.searchInput();o&&setTimeout(()=>o.nativeElement.focus(),10)}setTimeout(()=>this.resizeEvent.next(void 0),10),this.$log.scrollToBottom()}onSubmit(o){let e=(o.query||"").trim();!e.length||e.length<3?(e.length||this.showSearchBar.set(!1),this.form.setValue({query:""}),this.showExitButton.set(!1),this.$log.clearSearchFilter()):(this.showExitButton.set(!0),this.$log.setSearchFilter(e)),this.$log.scrollToBottom()}onClearSearch(){this.form.setValue({query:""}),this.showExitButton.set(!1),this.$log.clearSearchFilter(),this.$log.scrollToBottom()}canDeactivate(o){return this.$settings.actualLightingMode!=="light"?(window.document.querySelector("body").classList.remove("bg-black"),Promise.resolve(!0)):(this.showSearchBar()&&this.showSearchBar.set(!1),window.document.querySelector("body").classList.remove("light-mode"),new Promise(e=>{let t=o&&(o.includes("/platform-tools/terminal")||o.includes("/logs")),i=this.termTarget()?.nativeElement;i&&i.classList.add("fade-out"),t?setTimeout(()=>{e(!0)},250):(setTimeout(()=>{window.document.querySelector("body").classList.remove("bg-black")},250),setTimeout(()=>{e(!0)},500))}))}ngOnDestroy(){window.document.querySelector("body").classList.remove("light-mode"),this.resizeEvent.complete(),this.$log.destroyTerminal()}downloadLogFile(){return C(this,null,function*(){let o=$([{provide:M,useValue:{title:this.$translate.instant("logs.title_download_log_file"),message:this.$translate.instant("logs.download_warning"),confirmButtonLabel:this.$translate.instant("form.button_download"),faIconClass:"fas fa-user-secret primary-text"}}],this.injector),e=this.$modal.open(k,{size:"lg",backdrop:"static",injector:o});try{yield e.result;try{let t=yield this.$api.get("/platform-tools/hb-service/log/download",{observe:"response",responseType:"blob"}),i=this.$log.getSearchFilter();if(i){let ct=(yield t.body.text()).split(`
2
2
  `).filter(dt=>dt.replace(/\x1b\[[0-9;]*m/g,"").toLowerCase().includes(i.toLowerCase())),mt=new Blob([ct.join(`
3
3
  `)],{type:"text/plain"});(0,O.saveAs)(mt,"homebridge.log.txt")}else(0,O.saveAs)(t.body,"homebridge.log.txt")}catch(t){let i;try{if(t&&typeof t=="object"&&"error"in t){let _=yield t.error.text();i=JSON.parse(_).message}}catch(_){console.error(_)}this.$toastr.error(i||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error"))}}catch{}})}truncateLogFile(){return C(this,null,function*(){let o=$([{provide:M,useValue:{title:this.$translate.instant("logs.title_truncate_log_file"),message:this.$translate.instant("logs.truncate_log_warning"),confirmButtonLabel:this.$translate.instant("form.button_delete"),confirmButtonClass:"btn-danger",faIconClass:"fas fa-circle-exclamation primary-text"}}],this.injector),e=this.$modal.open(k,{size:"lg",backdrop:"static",injector:o});try{yield e.result;try{yield this.$api.put("/platform-tools/hb-service/log/truncate",{}),this.$toastr.success(this.$translate.instant("logs.log_file_truncated"),this.$translate.instant("toast.title_success")),this.$log.term.clear()}catch(t){console.error(t);let i=t&&typeof t=="object"&&"error"in t&&t.error&&typeof t.error=="object"&&"message"in t.error?String(t.error.message):this.$translate.instant("logs.truncate.error");this.$toastr.error(i,this.$translate.instant("toast.title_error"))}}catch{}})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=j({type:n,selectors:[["ng-component"]],viewQuery:function(e,t){e&1&&N(t.termTarget,ut,5)(t.searchInput,gt,5),e&2&&z(2)},hostBindings:function(e,t){e&1&&h("resize",function(){return t.onWindowResize()},F)},decls:10,vars:9,consts:[["logoutput",""],["searchInput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],[1,"row"],[1,"flex-column","d-flex","align-items-stretch"],["id","log-output",1,"align-self-end","w-100","h-100","mb-1"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","openDelay","ngbTooltip"],[1,"fas","fa-download"],["container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","my-0","me-0",3,"click","openDelay","ngbTooltip"],[1,"fas","fa-trash-alt"],[1,"col-md-12"],["novalidate","",3,"ngSubmit","formGroup"],["type","text","id","logs-search","formControlName","query",1,"search-bar",3,"placeholder"],["type","button",1,"search-bar-clear"],[1,"search-bar-badge","badge","badge-primary","badge-beta"],["type","button",1,"search-bar-clear",3,"click"],["aria-hidden","true",1,"fas","fa-square-xmark"]],template:function(e,t){e&1&&(m(0,"div",2)(1,"div",3)(2,"h3",4),T(3),a(4,"translate"),c()(),w(5,ft,13,24,"div",5),c(),w(6,wt,8,7,"div",6),m(7,"div",7),p(8,"div",8,0),c()),e&2&&(r(3),L(s(4,7,"menu.linux.label_logs")),r(2),v(t.isAdmin?5:-1),r(),v(t.showSearchBar()?6:-1),r(),B("adjust-for-mobile",!t.showSearchBar())("adjust-for-mobile-with-search",t.showSearchBar()))},dependencies:[st,rt,ot,X,Y,Z,nt,it,Q],styles:["body.light-mode{transition:background-color .25s ease-in-out}#log-output.light-mode[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_fadeIn .25s ease-in-out .25s forwards}#log-output.light-mode.fade-out[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeOut .25s ease-in-out forwards!important;opacity:1}@keyframes _ngcontent-%COMP%_fadeIn{to{opacity:1}}@keyframes _ngcontent-%COMP%_fadeOut{to{opacity:0}}.search-bar[_ngcontent-%COMP%]{background-color:#111!important;color:#999!important;border:0 #242424!important}@media(hover:hover){.search-bar[_ngcontent-%COMP%]:hover{border:1px solid #242424!important}}.search-bar[_ngcontent-%COMP%]:focus{border:1px solid #242424!important;box-shadow:inherit!important;color:#eee!important}.search-bar[_ngcontent-%COMP%]::placeholder{color:#636363!important;opacity:1!important}.search-bar.is-invalid[_ngcontent-%COMP%]{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}@media(hover:hover){.search-bar.is-invalid[_ngcontent-%COMP%]:hover{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}}.search-bar.is-invalid[_ngcontent-%COMP%]:focus{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}.search-bar-badge[_ngcontent-%COMP%]{position:absolute;right:10px;top:16px;font-size:.75rem;padding:.25em .5em}.adjust-for-mobile-with-search[_ngcontent-%COMP%]{height:calc(100% - 95px);width:calc(100% + 17px);overflow:hidden}@media(max-width:767px){.adjust-for-mobile-with-search[_ngcontent-%COMP%]{height:calc(100% - 125px)}}"]})}return n})();export{Nt as LogsComponent};
@@ -1 +1 @@
1
- import{b as pe}from"./chunk-TKVKJ7BH.js";import{H as le}from"./chunk-B23NNBW7.js";import{X as fe,aa as ue,c as he,d as X}from"./chunk-F5MBSCH4.js";import{f as We}from"./chunk-B4AJQJMI.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=(function(){let r=qe({xdomain:!1});return r&&r.responseType!==null})(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(this.opts.query)),se&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,s.socket.connected&&s.connected.next(void 0),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};
1
+ import{b as pe}from"./chunk-664C4LX2.js";import{H as le}from"./chunk-VWUZDCBZ.js";import{X as fe,aa as ue,c as he,d as X}from"./chunk-F5MBSCH4.js";import{f as We}from"./chunk-B4AJQJMI.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=(function(){let r=qe({xdomain:!1});return r&&r.responseType!==null})(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(this.opts.query)),se&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,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};