@camera.ui/browser 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +1 -1
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +3 -1
- package/dist/types/packages/client/browser/src/types.d.ts +2 -0
- package/dist/types/server/src/camera/controller.d.ts +2 -1
- package/dist/types/server/src/camera/index.d.ts +9 -9
- package/dist/types/server/src/camera/polygon.d.ts +2 -0
- package/package.json +5 -3
package/dist/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t={275:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,s="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",h="[object Map]",l="[object Number]",f="[object Object]",d="[object Promise]",p="[object RegExp]",b="[object Set]",y="[object String]",g="[object Symbol]",v="[object WeakMap]",m="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",O="[object Int16Array]",k="[object Int32Array]",x="[object Uint8Array]",T="[object Uint8ClampedArray]",A="[object Uint16Array]",j="[object Uint32Array]",R=/\w*$/,C=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[s]=D["[object Array]"]=D[m]=D[w]=D[o]=D[a]=D[S]=D[_]=D[E]=D[O]=D[k]=D[h]=D[l]=D[f]=D[p]=D[b]=D[y]=D[g]=D[x]=D[T]=D[A]=D[j]=!0,D["[object Error]"]=D[c]=D[v]=!1;var P="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,B="object"==typeof self&&self&&self.Object===Object&&self,F=P||B||Function("return this")(),z=e&&!e.nodeType&&e,N=z&&t&&!t.nodeType&&t,I=N&&N.exports===z;function U(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function q(t,e,r,n){var i=-1,s=t?t.length:0;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function H(t,e){return function(r){return t(e(r))}}function $(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var G,J=Array.prototype,K=Function.prototype,Y=Object.prototype,X=F["__core-js_shared__"],Q=(G=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Z=K.toString,tt=Y.hasOwnProperty,et=Y.toString,rt=RegExp("^"+Z.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=I?F.Buffer:void 0,it=F.Symbol,st=F.Uint8Array,ot=H(Object.getPrototypeOf,Object),at=Object.create,ct=Y.propertyIsEnumerable,ut=J.splice,ht=Object.getOwnPropertySymbols,lt=nt?nt.isBuffer:void 0,ft=H(Object.keys,Object),dt=Ft(F,"DataView"),pt=Ft(F,"Map"),bt=Ft(F,"Promise"),yt=Ft(F,"Set"),gt=Ft(F,"WeakMap"),vt=Ft(Object,"create"),mt=Mt(dt),wt=Mt(pt),St=Mt(bt),_t=Mt(yt),Et=Mt(gt),Ot=it?it.prototype:void 0,kt=Ot?Ot.valueOf:void 0;function xt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jt(t){this.__data__=new Tt(t)}function Rt(t,e,r){var n=t[e];tt.call(t,e)&&qt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Ct(t,e){for(var r=t.length;r--;)if(qt(t[r][0],e))return r;return-1}function Lt(t,e,r,n,i,d,v){var C;if(n&&(C=d?n(t,i,d,v):n(t)),void 0!==C)return C;if(!Gt(t))return t;var L=Vt(t);if(L){if(C=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,C)}else{var P=Nt(t),B=P==c||P==u;if(Ht(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(P==f||P==s||B&&!d){if(V(t))return d?t:{};if(C=function(t){return"function"!=typeof t.constructor||Ut(t)?{}:Gt(e=ot(t))?at(e):{};var e}(B?{}:t),!e)return function(t,e){return Pt(t,zt(t),e)}(t,function(t,e){return t&&Pt(e,Jt(e),t)}(C,t))}else{if(!D[P])return d?t:{};C=function(t,e,r,n){var i,s=t.constructor;switch(e){case m:return Dt(t);case o:case a:return new s(+t);case w:return function(t,e){var r=e?Dt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case S:case _:case E:case O:case k:case x:case T:case A:case j:return function(t,e){var r=e?Dt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case h:return function(t,e,r){return q(e?r(W(t),!0):W(t),U,new t.constructor)}(t,n,r);case l:case y:return new s(t);case p:return function(t){var e=new t.constructor(t.source,R.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return function(t,e,r){return q(e?r($(t),!0):$(t),M,new t.constructor)}(t,n,r);case g:return i=t,kt?Object(kt.call(i)):{}}}(t,P,Lt,e)}}v||(v=new jt);var F=v.get(t);if(F)return F;if(v.set(t,C),!L)var z=r?function(t){return function(t,e,r){var n=e(t);return Vt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Jt,zt)}(t):Jt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(z||t,(function(i,s){z&&(i=t[s=i]),Rt(C,s,Lt(i,e,r,n,s,t,v))})),C}function Dt(t){var e=new t.constructor(t.byteLength);return new st(e).set(new st(t)),e}function Pt(t,e,r,n){r||(r={});for(var i=-1,s=e.length;++i<s;){var o=e[i],a=n?n(r[o],t[o],o,r,t):void 0;Rt(r,o,void 0===a?t[o]:a)}return r}function Bt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Ft(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Gt(t)||(e=t,Q&&Q in e))&&($t(t)||V(t)?rt:C).test(Mt(t));var e}(r)?r:void 0}xt.prototype.clear=function(){this.__data__=vt?vt(null):{}},xt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},xt.prototype.get=function(t){var e=this.__data__;if(vt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},xt.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:tt.call(e,t)},xt.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?n:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,r=Ct(e,t);return!(r<0||(r==e.length-1?e.pop():ut.call(e,r,1),0))},Tt.prototype.get=function(t){var e=this.__data__,r=Ct(e,t);return r<0?void 0:e[r][1]},Tt.prototype.has=function(t){return Ct(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=Ct(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},At.prototype.clear=function(){this.__data__={hash:new xt,map:new(pt||Tt),string:new xt}},At.prototype.delete=function(t){return Bt(this,t).delete(t)},At.prototype.get=function(t){return Bt(this,t).get(t)},At.prototype.has=function(t){return Bt(this,t).has(t)},At.prototype.set=function(t,e){return Bt(this,t).set(t,e),this},jt.prototype.clear=function(){this.__data__=new Tt},jt.prototype.delete=function(t){return this.__data__.delete(t)},jt.prototype.get=function(t){return this.__data__.get(t)},jt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new At(n)}return r.set(t,e),this};var zt=ht?H(ht,Object):function(){return[]},Nt=function(t){return et.call(t)};function It(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||L.test(t))&&t>-1&&t%1==0&&t<e}function Ut(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Y)}function Mt(t){if(null!=t){try{return Z.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function qt(t,e){return t===e||t!=t&&e!=e}(dt&&Nt(new dt(new ArrayBuffer(1)))!=w||pt&&Nt(new pt)!=h||bt&&Nt(bt.resolve())!=d||yt&&Nt(new yt)!=b||gt&&Nt(new gt)!=v)&&(Nt=function(t){var e=et.call(t),r=e==f?t.constructor:void 0,n=r?Mt(r):void 0;if(n)switch(n){case mt:return w;case wt:return h;case St:return d;case _t:return b;case Et:return v}return e});var Vt=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!$t(t)}var Ht=lt||function(){return!1};function $t(t){var e=Gt(t)?et.call(t):"";return e==c||e==u}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?function(t,e){var r=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&tt.call(t,"callee")&&(!ct.call(t,"callee")||et.call(t)==s)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var o in t)!e&&!tt.call(t,o)||i&&("length"==o||It(o,n))||r.push(o);return r}(t):function(t){if(!Ut(t))return ft(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Lt(t,!0,!0)}},512:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",h="[object Boolean]",l="[object Date]",f="[object Error]",d="[object Function]",p="[object GeneratorFunction]",b="[object Map]",y="[object Number]",g="[object Null]",v="[object Object]",m="[object Promise]",w="[object Proxy]",S="[object RegExp]",_="[object Set]",E="[object String]",O="[object Undefined]",k="[object WeakMap]",x="[object ArrayBuffer]",T="[object DataView]",A=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,R={};R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R[a]=R[c]=R[x]=R[h]=R[T]=R[l]=R[f]=R[d]=R[b]=R[y]=R[v]=R[S]=R[_]=R[E]=R[k]=!1;var C="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,L="object"==typeof self&&self&&self.Object===Object&&self,D=C||L||Function("return this")(),P=e&&!e.nodeType&&e,B=P&&t&&!t.nodeType&&t,F=B&&B.exports===P,z=F&&C.process,N=function(){try{return z&&z.binding&&z.binding("util")}catch(t){}}(),I=N&&N.isTypedArray;function U(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function M(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function q(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var V,W,H,$=Array.prototype,G=Function.prototype,J=Object.prototype,K=D["__core-js_shared__"],Y=G.toString,X=J.hasOwnProperty,Q=(V=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Z=J.toString,tt=RegExp("^"+Y.call(X).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),et=F?D.Buffer:void 0,rt=D.Symbol,nt=D.Uint8Array,it=J.propertyIsEnumerable,st=$.splice,ot=rt?rt.toStringTag:void 0,at=Object.getOwnPropertySymbols,ct=et?et.isBuffer:void 0,ut=(W=Object.keys,H=Object,function(t){return W(H(t))}),ht=Bt(D,"DataView"),lt=Bt(D,"Map"),ft=Bt(D,"Promise"),dt=Bt(D,"Set"),pt=Bt(D,"WeakMap"),bt=Bt(Object,"create"),yt=It(ht),gt=It(lt),vt=It(ft),mt=It(dt),wt=It(pt),St=rt?rt.prototype:void 0,_t=St?St.valueOf:void 0;function Et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new kt;++e<r;)this.add(t[e])}function Tt(t){var e=this.__data__=new Ot(t);this.size=e.size}function At(t,e){for(var r=t.length;r--;)if(Ut(t[r][0],e))return r;return-1}function jt(t){return null==t?void 0===t?O:g:ot&&ot in Object(t)?function(t){var e=X.call(t,ot),r=t[ot];try{t[ot]=void 0;var n=!0}catch(t){}var i=Z.call(t);return n&&(e?t[ot]=r:delete t[ot]),i}(t):function(t){return Z.call(t)}(t)}function Rt(t){return Gt(t)&&jt(t)==a}function Ct(t,e,r,n,o){return t===e||(null==t||null==e||!Gt(t)&&!Gt(e)?t!=t&&e!=e:function(t,e,r,n,o,u){var d=qt(t),p=qt(e),g=d?c:zt(t),m=p?c:zt(e),w=(g=g==a?v:g)==v,O=(m=m==a?v:m)==v,k=g==m;if(k&&Vt(t)){if(!Vt(e))return!1;d=!0,w=!1}if(k&&!w)return u||(u=new Tt),d||Jt(t)?Lt(t,e,r,n,o,u):function(t,e,r,n,o,a,c){switch(r){case T:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!a(new nt(t),new nt(e)));case h:case l:case y:return Ut(+t,+e);case f:return t.name==e.name&&t.message==e.message;case S:case E:return t==e+"";case b:var u=M;case _:var d=n&i;if(u||(u=q),t.size!=e.size&&!d)return!1;var p=c.get(t);if(p)return p==e;n|=s,c.set(t,e);var g=Lt(u(t),u(e),n,o,a,c);return c.delete(t),g;case"[object Symbol]":if(_t)return _t.call(t)==_t.call(e)}return!1}(t,e,g,r,n,o,u);if(!(r&i)){var A=w&&X.call(t,"__wrapped__"),j=O&&X.call(e,"__wrapped__");if(A||j){var R=A?t.value():t,C=j?e.value():e;return u||(u=new Tt),o(R,C,r,n,u)}}return!!k&&(u||(u=new Tt),function(t,e,r,n,s,o){var a=r&i,c=Dt(t),u=c.length;if(u!=Dt(e).length&&!a)return!1;for(var h=u;h--;){var l=c[h];if(!(a?l in e:X.call(e,l)))return!1}var f=o.get(t);if(f&&o.get(e))return f==e;var d=!0;o.set(t,e),o.set(e,t);for(var p=a;++h<u;){var b=t[l=c[h]],y=e[l];if(n)var g=a?n(y,b,l,e,t,o):n(b,y,l,t,e,o);if(!(void 0===g?b===y||s(b,y,r,n,o):g)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var v=t.constructor,m=e.constructor;v==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof m&&m instanceof m||(d=!1)}return o.delete(t),o.delete(e),d}(t,e,r,n,o,u))}(t,e,r,n,Ct,o))}function Lt(t,e,r,n,o,a){var c=r&i,u=t.length,h=e.length;if(u!=h&&!(c&&h>u))return!1;var l=a.get(t);if(l&&a.get(e))return l==e;var f=-1,d=!0,p=r&s?new xt:void 0;for(a.set(t,e),a.set(e,t);++f<u;){var b=t[f],y=e[f];if(n)var g=c?n(y,b,f,e,t,a):n(b,y,f,t,e,a);if(void 0!==g){if(g)continue;d=!1;break}if(p){if(!U(e,(function(t,e){if(i=e,!p.has(i)&&(b===t||o(b,t,r,n,a)))return p.push(e);var i}))){d=!1;break}}else if(b!==y&&!o(b,y,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d}function Dt(t){return function(t,e,r){var n=e(t);return qt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Kt,Ft)}function Pt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Bt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!$t(t)||function(t){return!!Q&&Q in t}(t))&&(Wt(t)?tt:A).test(It(t))}(r)?r:void 0}Et.prototype.clear=function(){this.__data__=bt?bt(null):{},this.size=0},Et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Et.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return X.call(e,t)?e[t]:void 0},Et.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:X.call(e,t)},Et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=bt&&void 0===e?n:e,this},Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(t){var e=this.__data__,r=At(e,t);return!(r<0||(r==e.length-1?e.pop():st.call(e,r,1),--this.size,0))},Ot.prototype.get=function(t){var e=this.__data__,r=At(e,t);return r<0?void 0:e[r][1]},Ot.prototype.has=function(t){return At(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var r=this.__data__,n=At(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},kt.prototype.clear=function(){this.size=0,this.__data__={hash:new Et,map:new(lt||Ot),string:new Et}},kt.prototype.delete=function(t){var e=Pt(this,t).delete(t);return this.size-=e?1:0,e},kt.prototype.get=function(t){return Pt(this,t).get(t)},kt.prototype.has=function(t){return Pt(this,t).has(t)},kt.prototype.set=function(t,e){var r=Pt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},xt.prototype.add=xt.prototype.push=function(t){return this.__data__.set(t,n),this},xt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.clear=function(){this.__data__=new Ot,this.size=0},Tt.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ot){var n=r.__data__;if(!lt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new kt(n)}return r.set(t,e),this.size=r.size,this};var Ft=at?function(t){return null==t?[]:(t=Object(t),function(e,r){for(var n=-1,i=null==e?0:e.length,s=0,o=[];++n<i;){var a=e[n];c=a,it.call(t,c)&&(o[s++]=a)}var c;return o}(at(t)))}:function(){return[]},zt=jt;function Nt(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||j.test(t))&&t>-1&&t%1==0&&t<e}function It(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ut(t,e){return t===e||t!=t&&e!=e}(ht&&zt(new ht(new ArrayBuffer(1)))!=T||lt&&zt(new lt)!=b||ft&&zt(ft.resolve())!=m||dt&&zt(new dt)!=_||pt&&zt(new pt)!=k)&&(zt=function(t){var e=jt(t),r=e==v?t.constructor:void 0,n=r?It(r):"";if(n)switch(n){case yt:return T;case gt:return b;case vt:return m;case mt:return _;case wt:return k}return e});var Mt=Rt(function(){return arguments}())?Rt:function(t){return Gt(t)&&X.call(t,"callee")&&!it.call(t,"callee")},qt=Array.isArray,Vt=ct||function(){return!1};function Wt(t){if(!$t(t))return!1;var e=jt(t);return e==d||e==p||e==u||e==w}function Ht(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}function $t(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Gt(t){return null!=t&&"object"==typeof t}var Jt=I?function(t){return function(e){return t(e)}}(I):function(t){return Gt(t)&&Ht(t.length)&&!!R[jt(t)]};function Kt(t){return null!=(e=t)&&Ht(e.length)&&!Wt(e)?function(t,e){var r=qt(t),n=!r&&Mt(t),i=!r&&!n&&Vt(t),s=!r&&!n&&!i&&Jt(t),o=r||n||i||s,a=o?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var u in t)!e&&!X.call(t,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Nt(u,c))||a.push(u);return a}(t):function(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||J))return ut(t);var e,r,n=[];for(var i in Object(t))X.call(t,i)&&"constructor"!=i&&n.push(i);return n}(t);var e}t.exports=function(t,e){return Ct(t,e)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={id:n,loaded:!1,exports:{}};return t[n](s,s.exports,r),s.loaded=!0,s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{r.d(n,{j:()=>Is});var t={};r.r(t),r.d(t,{hasBrowserEnv:()=>ot,hasStandardBrowserEnv:()=>at,hasStandardBrowserWebWorkerEnv:()=>ut,origin:()=>ht});var e={};function i(t,e){return function(){return t.apply(e,arguments)}}r.r(e),r.d(e,{Decoder:()=>js,Encoder:()=>Ts,PacketType:()=>xs,protocol:()=>ks});const{toString:s}=Object.prototype,{getPrototypeOf:o}=Object,a=(t=>e=>{const r=s.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),c=t=>(t=t.toLowerCase(),e=>a(e)===t),u=t=>e=>typeof e===t,{isArray:h}=Array,l=u("undefined"),f=c("ArrayBuffer"),d=u("string"),p=u("function"),b=u("number"),y=t=>null!==t&&"object"==typeof t,g=t=>{if("object"!==a(t))return!1;const e=o(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},v=c("Date"),m=c("File"),w=c("Blob"),S=c("FileList"),_=c("URLSearchParams"),[E,O,k,x]=["ReadableStream","Request","Response","Headers"].map(c);function T(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),h(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{const i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length;let o;for(n=0;n<s;n++)o=i[n],e.call(null,t[o],o,t)}}function A(t,e){e=e.toLowerCase();const r=Object.keys(t);let n,i=r.length;for(;i-- >0;)if(n=r[i],e===n.toLowerCase())return n;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,R=t=>!l(t)&&t!==j,C=(L="undefined"!=typeof Uint8Array&&o(Uint8Array),t=>L&&t instanceof L);var L;const D=c("HTMLFormElement"),P=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),B=c("RegExp"),F=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};T(r,((r,i)=>{let s;!1!==(s=e(r,i,t))&&(n[i]=s||r)})),Object.defineProperties(t,n)},z="abcdefghijklmnopqrstuvwxyz",N="0123456789",I={DIGIT:N,ALPHA:z,ALPHA_DIGIT:z+z.toUpperCase()+N},U=c("AsyncFunction"),M={isArray:h,isArrayBuffer:f,isBuffer:function(t){return null!==t&&!l(t)&&null!==t.constructor&&!l(t.constructor)&&p(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||p(t.append)&&("formdata"===(e=a(t))||"object"===e&&p(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&f(t.buffer),e},isString:d,isNumber:b,isBoolean:t=>!0===t||!1===t,isObject:y,isPlainObject:g,isReadableStream:E,isRequest:O,isResponse:k,isHeaders:x,isUndefined:l,isDate:v,isFile:m,isBlob:w,isRegExp:B,isFunction:p,isStream:t=>y(t)&&p(t.pipe),isURLSearchParams:_,isTypedArray:C,isFileList:S,forEach:T,merge:function t(){const{caseless:e}=R(this)&&this||{},r={},n=(n,i)=>{const s=e&&A(r,i)||i;g(r[s])&&g(n)?r[s]=t(r[s],n):g(n)?r[s]=t({},n):h(n)?r[s]=n.slice():r[s]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&T(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(T(e,((e,n)=>{r&&p(e)?t[n]=i(e,r):t[n]=e}),{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let i,s,a;const c={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],n&&!n(a,t,e)||c[a]||(e[a]=t[a],c[a]=!0);t=!1!==r&&o(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:a,kindOfTest:c,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(h(t))return t;let e=t.length;if(!b(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:D,hasOwnProperty:P,hasOwnProp:P,reduceDescriptors:F,freezeMethods:t=>{F(t,((e,r)=>{if(p(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];p(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach((t=>{r[t]=!0}))};return h(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:A,global:j,isContextDefined:R,ALPHABET:I,generateString:(t=16,e=I.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r},isSpecCompliantForm:function(t){return!!(t&&p(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(y(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[n]=t;const i=h(t)?[]:{};return T(t,((t,e)=>{const s=r(t,n+1);!l(s)&&(i[e]=s)})),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:U,isThenable:t=>t&&(y(t)||p(t))&&p(t.then)&&p(t.catch)};function q(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}M.inherits(q,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const V=q.prototype,W={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{W[t]={value:t}})),Object.defineProperties(q,W),Object.defineProperty(V,"isAxiosError",{value:!0}),q.from=(t,e,r,n,i,s)=>{const o=Object.create(V);return M.toFlatObject(t,o,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),q.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const H=q;function $(t){return M.isPlainObject(t)||M.isArray(t)}function G(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function J(t,e,r){return t?t.concat(e).map((function(t,e){return t=G(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const K=M.toFlatObject(M,{},null,(function(t){return/^is[A-Z]/.test(t)})),Y=function(t,e,r){if(!M.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=M.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!M.isUndefined(e[t])}))).metaTokens,i=r.visitor||u,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(M.isDate(t))return t.toISOString();if(!a&&M.isBlob(t))throw new H("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(t)||M.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,r,i){let a=t;if(t&&!i&&"object"==typeof t)if(M.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(M.isArray(t)&&function(t){return M.isArray(t)&&!t.some($)}(t)||(M.isFileList(t)||M.endsWith(r,"[]"))&&(a=M.toArray(t)))return r=G(r),a.forEach((function(t,n){!M.isUndefined(t)&&null!==t&&e.append(!0===o?J([r],n,s):null===o?r:r+"[]",c(t))})),!1;return!!$(t)||(e.append(J(i,r,s),c(t)),!1)}const h=[],l=Object.assign(K,{defaultVisitor:u,convertValue:c,isVisitable:$});if(!M.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!M.isUndefined(r)){if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),M.forEach(r,(function(r,s){!0===(!(M.isUndefined(r)||null===r)&&i.call(e,r,M.isString(s)?s.trim():s,n,l))&&t(r,n?n.concat(s):[s])})),h.pop()}}(t),e};function X(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function Q(t,e){this._pairs=[],t&&Y(t,this,e)}const Z=Q.prototype;Z.append=function(t,e){this._pairs.push([t,e])},Z.toString=function(t){const e=t?function(e){return t.call(this,e,X)}:X;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const tt=Q;function et(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rt(t,e,r){if(!e)return t;const n=r&&r.encode||et,i=r&&r.serialize;let s;if(s=i?i(e,r):M.isURLSearchParams(e)?e.toString():new tt(e,r).toString(n),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const nt=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){M.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},it={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},st={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ot="undefined"!=typeof window&&"undefined"!=typeof document,at=(ct="undefined"!=typeof navigator&&navigator.product,ot&&["ReactNative","NativeScript","NS"].indexOf(ct)<0);var ct;const ut="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ht=ot&&window.location.href||"http://localhost",lt={...t,...st},ft=function(t){function e(t,r,n,i){let s=t[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=t.length;return s=!s&&M.isArray(n)?n.length:s,a?(M.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o):(n[s]&&M.isObject(n[s])||(n[s]=[]),e(t,r,n[s],i)&&M.isArray(n[s])&&(n[s]=function(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],e[s]=t[s];return e}(n[s])),!o)}if(M.isFormData(t)&&M.isFunction(t.entries)){const r={};return M.forEachEntry(t,((t,n)=>{e(function(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),n,r,0)})),r}return null},dt={transitional:it,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=M.isObject(t);if(i&&M.isHTMLForm(t)&&(t=new FormData(t)),M.isFormData(t))return n?JSON.stringify(ft(t)):t;if(M.isArrayBuffer(t)||M.isBuffer(t)||M.isStream(t)||M.isFile(t)||M.isBlob(t)||M.isReadableStream(t))return t;if(M.isArrayBufferView(t))return t.buffer;if(M.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Y(t,new lt.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,n){return lt.isNode&&M.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((s=M.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Y(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t,e,r){if(M.isString(t))try{return(0,JSON.parse)(t),M.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||dt.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(M.isResponse(t)||M.isReadableStream(t))return t;if(t&&M.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw H.from(t,H.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lt.classes.FormData,Blob:lt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],(t=>{dt.headers[t]={}}));const pt=dt,bt=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),yt=Symbol("internals");function gt(t){return t&&String(t).trim().toLowerCase()}function vt(t){return!1===t||null==t?t:M.isArray(t)?t.map(vt):String(t)}function mt(t,e,r,n,i){return M.isFunction(n)?n.call(this,e,r):(i&&(e=r),M.isString(e)?M.isString(n)?-1!==e.indexOf(n):M.isRegExp(n)?n.test(e):void 0:void 0)}class wt{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=gt(e);if(!i)throw new Error("header name must be a non-empty string");const s=M.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||e]=vt(t))}const s=(t,e)=>M.forEach(t,((t,r)=>i(t,r,e)));if(M.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(M.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))s((t=>{const e={};let r,n,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),r=t.substring(0,i).trim().toLowerCase(),n=t.substring(i+1).trim(),!r||e[r]&&bt[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)})),e})(t),e);else if(M.isHeaders(t))for(const[e,n]of t.entries())i(n,e,r);else null!=t&&i(e,t,r);return this}get(t,e){if(t=gt(t)){const r=M.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if(M.isFunction(e))return e.call(this,t,r);if(M.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=gt(t)){const r=M.findKey(this,t);return!(!r||void 0===this[r]||e&&!mt(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=gt(t)){const i=M.findKey(r,t);!i||e&&!mt(0,r[i],i,e)||(delete r[i],n=!0)}}return M.isArray(t)?t.forEach(i):i(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const i=e[r];t&&!mt(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return M.forEach(this,((n,i)=>{const s=M.findKey(r,i);if(s)return e[s]=vt(n),void delete e[i];const o=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete e[i],e[o]=vt(n),r[o]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return M.forEach(this,((r,n)=>{null!=r&&!1!==r&&(e[n]=t&&M.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[yt]=this[yt]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=gt(t);e[n]||(function(t,e){const r=M.toCamelCase(" "+e);["get","set","has"].forEach((n=>{Object.defineProperty(t,n+r,{value:function(t,r,i){return this[n].call(this,e,t,r,i)},configurable:!0})}))}(r,t),e[n]=!0)}return M.isArray(t)?t.forEach(n):n(t),this}}wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),M.reduceDescriptors(wt.prototype,(({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}})),M.freezeMethods(wt);const St=wt;function _t(t,e){const r=this||pt,n=e||r,i=St.from(n.headers);let s=n.data;return M.forEach(t,(function(t){s=t.call(r,s,i.normalize(),e?e.status:void 0)})),i.normalize(),s}function Et(t){return!(!t||!t.__CANCEL__)}function Ot(t,e,r){H.call(this,null==t?"canceled":t,H.ERR_CANCELED,e,r),this.name="CanceledError"}M.inherits(Ot,H,{__CANCEL__:!0});const kt=Ot;function xt(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new H("Request failed with status code "+r.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}const Tt=(t,e,r=3)=>{let n=0;const i=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i,s=0,o=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),u=n[o];i||(i=c),r[s]=a,n[s]=c;let h=o,l=0;for(;h!==s;)l+=r[h++],h%=t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),c-i<e)return;const f=u&&c-u;return f?Math.round(1e3*l/f):void 0}}(50,250);return function(t,e){let r=0;const n=1e3/e;let i=null;return function(){const e=!0===this,s=Date.now();if(e||s-r>n)return i&&(clearTimeout(i),i=null),r=s,t.apply(null,arguments);i||(i=setTimeout((()=>(i=null,r=Date.now(),t.apply(null,arguments))),n-(s-r)))}}((r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,c=i(a);n=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r,lengthComputable:null!=o};u[e?"download":"upload"]=!0,t(u)}),r)},At=lt.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let r;function n(r){let n=r;return t&&(e.setAttribute("href",n),n=e.href),e.setAttribute("href",n),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=n(window.location.href),function(t){const e=M.isString(t)?n(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0},jt=lt.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];M.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),M.isString(n)&&o.push("path="+n),M.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Rt(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Ct=t=>t instanceof St?{...t}:t;function Lt(t,e){e=e||{};const r={};function n(t,e,r){return M.isPlainObject(t)&&M.isPlainObject(e)?M.merge.call({caseless:r},t,e):M.isPlainObject(e)?M.merge({},e):M.isArray(e)?e.slice():e}function i(t,e,r){return M.isUndefined(e)?M.isUndefined(t)?void 0:n(void 0,t,r):n(t,e,r)}function s(t,e){if(!M.isUndefined(e))return n(void 0,e)}function o(t,e){return M.isUndefined(e)?M.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function a(r,i,s){return s in e?n(r,i):s in t?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(t,e)=>i(Ct(t),Ct(e),!0)};return M.forEach(Object.keys(Object.assign({},t,e)),(function(n){const s=c[n]||i,o=s(t[n],e[n],n);M.isUndefined(o)&&s!==a||(r[n]=o)})),r}const Dt=t=>{const e=Lt({},t);let r,{data:n,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=e;if(e.headers=a=St.from(a),e.url=rt(Rt(e.baseURL,e.url),t.params,t.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),M.isFormData(n))if(lt.hasStandardBrowserEnv||lt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[t,...e]=r?r.split(";").map((t=>t.trim())).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(lt.hasStandardBrowserEnv&&(i&&M.isFunction(i)&&(i=i(e)),i||!1!==i&&At(e.url))){const t=s&&o&&jt.read(o);t&&a.set(s,t)}return e},Pt="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){const n=Dt(t);let i=n.data;const s=St.from(n.headers).normalize();let o,{responseType:a}=n;function c(){n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let u=new XMLHttpRequest;function h(){if(!u)return;const n=St.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());xt((function(t){e(t),c()}),(function(t){r(t),c()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u}),u=null}u.open(n.method.toUpperCase(),n.url,!0),u.timeout=n.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(r(new H("Request aborted",H.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new H("Network Error",H.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const e=n.transitional||it;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new H(t,e.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,n,u)),u=null},void 0===i&&s.setContentType(null),"setRequestHeader"in u&&M.forEach(s.toJSON(),(function(t,e){u.setRequestHeader(e,t)})),M.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),a&&"json"!==a&&(u.responseType=n.responseType),"function"==typeof n.onDownloadProgress&&u.addEventListener("progress",Tt(n.onDownloadProgress,!0)),"function"==typeof n.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Tt(n.onUploadProgress)),(n.cancelToken||n.signal)&&(o=e=>{u&&(r(!e||e.type?new kt(null,t,u):e),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const l=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(n.url);l&&-1===lt.protocols.indexOf(l)?r(new H("Unsupported protocol "+l+":",H.ERR_BAD_REQUEST,t)):u.send(i||null)}))},Bt=(t,e)=>{let r,n=new AbortController;const i=function(t){if(!r){r=!0,o();const e=t instanceof Error?t:this.reason;n.abort(e instanceof H?e:new kt(e instanceof Error?e.message:e))}};let s=e&&setTimeout((()=>{i(new H(`timeout ${e} of ms exceeded`,H.ETIMEDOUT))}),e);const o=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach((t=>{t&&(t.removeEventListener?t.removeEventListener("abort",i):t.unsubscribe(i))})),t=null)};t.forEach((t=>t&&t.addEventListener&&t.addEventListener("abort",i)));const{signal:a}=n;return a.unsubscribe=o,[a,()=>{s&&clearTimeout(s),s=null}]},Ft=function*(t,e){let r=t.byteLength;if(!e||r<e)return void(yield t);let n,i=0;for(;i<r;)n=i+e,yield t.slice(i,n),i=n},zt=(t,e,r,n,i)=>{const s=async function*(t,e,r){for await(const n of t)yield*Ft(ArrayBuffer.isView(n)?n:await r(String(n)),e)}(t,e,i);let o=0;return new ReadableStream({type:"bytes",async pull(t){const{done:e,value:i}=await s.next();if(e)return t.close(),void n();let a=i.byteLength;r&&r(o+=a),t.enqueue(new Uint8Array(i))},cancel:t=>(n(t),s.return())},{highWaterMark:2})},Nt=(t,e)=>{const r=null!=t;return n=>setTimeout((()=>e({lengthComputable:r,total:t,loaded:n})))},It="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ut=It&&"function"==typeof ReadableStream,Mt=It&&("function"==typeof TextEncoder?(qt=new TextEncoder,t=>qt.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var qt;const Vt=Ut&&(()=>{let t=!1;const e=new Request(lt.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})(),Wt=Ut&&!!(()=>{try{return M.isReadableStream(new Response("").body)}catch(t){}})(),Ht={stream:Wt&&(t=>t.body)};var $t;It&&($t=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!Ht[t]&&(Ht[t]=M.isFunction($t[t])?e=>e[t]():(e,r)=>{throw new H(`Response type '${t}' is not supported`,H.ERR_NOT_SUPPORT,r)})})));const Gt=It&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:h,withCredentials:l="same-origin",fetchOptions:f}=Dt(t);u=u?(u+"").toLowerCase():"text";let d,p,[b,y]=i||s||o?Bt([i,s],o):[];const g=()=>{!d&&setTimeout((()=>{b&&b.unsubscribe()})),d=!0};let v;try{if(c&&Vt&&"get"!==r&&"head"!==r&&0!==(v=await(async(t,e)=>{const r=M.toFiniteNumber(t.getContentLength());return null==r?(async t=>null==t?0:M.isBlob(t)?t.size:M.isSpecCompliantForm(t)?(await new Request(t).arrayBuffer()).byteLength:M.isArrayBufferView(t)?t.byteLength:(M.isURLSearchParams(t)&&(t+=""),M.isString(t)?(await Mt(t)).byteLength:void 0))(e):r})(h,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});M.isFormData(n)&&(t=r.headers.get("content-type"))&&h.setContentType(t),r.body&&(n=zt(r.body,65536,Nt(v,Tt(c)),null,Mt))}M.isString(l)||(l=l?"cors":"omit"),p=new Request(e,{...f,signal:b,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",withCredentials:l});let i=await fetch(p);const s=Wt&&("stream"===u||"response"===u);if(Wt&&(a||s)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=i[e]}));const e=M.toFiniteNumber(i.headers.get("content-length"));i=new Response(zt(i.body,65536,a&&Nt(e,Tt(a,!0)),s&&g,Mt),t)}u=u||"text";let o=await Ht[M.findKey(Ht,u)||"text"](i,t);return!s&&g(),y&&y(),await new Promise(((e,r)=>{xt(e,r,{data:o,headers:St.from(i.headers),status:i.status,statusText:i.statusText,config:t,request:p})}))}catch(e){if(g(),e&&"TypeError"===e.name&&/fetch/i.test(e.message))throw Object.assign(new H("Network Error",H.ERR_NETWORK,t,p),{cause:e.cause||e});throw H.from(e,e&&e.code,t,p)}}),Jt={http:null,xhr:Pt,fetch:Gt};M.forEach(Jt,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const Kt=t=>`- ${t}`,Yt=t=>M.isFunction(t)||null===t||!1===t,Xt=t=>{t=M.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s<e;s++){let e;if(r=t[s],n=r,!Yt(r)&&(n=Jt[(e=String(r)).toLowerCase()],void 0===n))throw new H(`Unknown adapter '${e}'`);if(n)break;i[e||"#"+s]=n}if(!n){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let r=e?t.length>1?"since :\n"+t.map(Kt).join("\n"):" "+Kt(t[0]):"as no adapter specified";throw new H("There is no suitable adapter to dispatch the request "+r,"ERR_NOT_SUPPORT")}return n};function Qt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kt(null,t)}function Zt(t){return Qt(t),t.headers=St.from(t.headers),t.data=_t.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Xt(t.adapter||pt.adapter)(t).then((function(e){return Qt(t),e.data=_t.call(t,t.transformResponse,e),e.headers=St.from(e.headers),e}),(function(e){return Et(e)||(Qt(t),e&&e.response&&(e.response.data=_t.call(t,t.transformResponse,e.response),e.response.headers=St.from(e.response.headers))),Promise.reject(e)}))}const te={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{te[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const ee={};te.transitional=function(t,e,r){function n(t,e){return"[Axios v1.7.2] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,s)=>{if(!1===t)throw new H(n(i," has been removed"+(e?" in "+e:"")),H.ERR_DEPRECATED);return e&&!ee[i]&&(ee[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,s)}};const re={assertOptions:function(t,e,r){if("object"!=typeof t)throw new H("options must be an object",H.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const e=t[s],r=void 0===e||o(e,s,t);if(!0!==r)throw new H("option "+s+" must be "+r,H.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new H("Unknown option "+s,H.ERR_BAD_OPTION)}},validators:te},ne=re.validators;class ie{constructor(t){this.defaults=t,this.interceptors={request:new nt,response:new nt}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Lt(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&re.assertOptions(r,{silentJSONParsing:ne.transitional(ne.boolean),forcedJSONParsing:ne.transitional(ne.boolean),clarifyTimeoutError:ne.transitional(ne.boolean)},!1),null!=n&&(M.isFunction(n)?e.paramsSerializer={serialize:n}:re.assertOptions(n,{encode:ne.function,serialize:ne.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=i&&M.merge(i.common,i[e.method]);i&&M.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=St.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,o.unshift(t.fulfilled,t.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let h,l=0;if(!a){const t=[Zt.bind(this),void 0];for(t.unshift.apply(t,o),t.push.apply(t,c),h=t.length,u=Promise.resolve(e);l<h;)u=u.then(t[l++],t[l++]);return u}h=o.length;let f=e;for(l=0;l<h;){const t=o[l++],e=o[l++];try{f=t(f)}catch(t){e.call(this,t);break}}try{u=Zt.call(this,f)}catch(t){return Promise.reject(t)}for(l=0,h=c.length;l<h;)u=u.then(c[l++],c[l++]);return u}getUri(t){return rt(Rt((t=Lt(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}M.forEach(["delete","get","head","options"],(function(t){ie.prototype[t]=function(e,r){return this.request(Lt(r||{},{method:t,url:e,data:(r||{}).data}))}})),M.forEach(["post","put","patch"],(function(t){function e(e){return function(r,n,i){return this.request(Lt(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ie.prototype[t]=e(),ie.prototype[t+"Form"]=e(!0)}));const se=ie;class oe{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const n=new Promise((t=>{r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t,n,i){r.reason||(r.reason=new kt(t,n,i),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;return{token:new oe((function(e){t=e})),cancel:t}}}const ae=oe,ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ce).forEach((([t,e])=>{ce[e]=t}));const ue=ce,he=function t(e){const r=new se(e),n=i(se.prototype.request,r);return M.extend(n,se.prototype,r,{allOwnKeys:!0}),M.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Lt(e,r))},n}(pt);he.Axios=se,he.CanceledError=kt,he.CancelToken=ae,he.isCancel=Et,he.VERSION="1.7.2",he.toFormData=Y,he.AxiosError=H,he.Cancel=he.CanceledError,he.all=function(t){return Promise.all(t)},he.spread=function(t){return function(e){return t.apply(null,e)}},he.isAxiosError=function(t){return M.isObject(t)&&!0===t.isAxiosError},he.mergeConfig=Lt,he.AxiosHeaders=St,he.formToJSON=t=>ft(M.isHTMLForm(t)?new FormData(t):t),he.getAdapter=Xt,he.HttpStatusCode=ue,he.default=he;const le=he;class fe{interceptor;constructor(t){this.interceptor=le.create({baseURL:`${t}/api`}),this.interceptor.interceptors.request.use((t=>{const e=le.CancelToken.source();return t.cancelToken=e.token,setTimeout((()=>{e.cancel("Timeout: request took more than 15 seconds")}),15e3),t}),(t=>Promise.reject(t)))}}var de=r(275),pe=r.n(de),be=r(512),ye=r.n(be);const ge="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ve=new Set,me="object"==typeof process&&process?process:{},we=(t,e,r,n)=>{"function"==typeof me.emitWarning?me.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)};let Se=globalThis.AbortController,_e=globalThis.AbortSignal;if(void 0===Se){_e=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},Se=class{constructor(){e()}signal=new _e;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=!0;for(const e of this.signal._onabort)e(t);this.signal.onabort?.(t)}}};let t="1"!==me.env?.LRU_CACHE_IGNORE_AC_WARNING;const e=()=>{t&&(t=!1,we("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}Symbol("type");const Ee=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Oe=t=>Ee(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ke:null:null;class ke extends Array{constructor(t){super(t),this.fill(0)}}class xe{heap;length;static#t=!1;static create(t){const e=Oe(t);if(!e)return[];xe.#t=!0;const r=new xe(t,e);return xe.#t=!1,r}constructor(t,e){if(!xe.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class Te{#e;#r;#n;#i;#s;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#a;#c;#u;#h;#l;#f;#d;#p;#b;#y;#g;#v;#m;#w;#S;#_;static unsafeExposeInternals(t){return{starts:t.#v,ttls:t.#m,sizes:t.#g,keyMap:t.#c,keyList:t.#u,valList:t.#h,next:t.#l,prev:t.#f,get head(){return t.#d},get tail(){return t.#p},free:t.#b,isBackgroundFetch:e=>t.#E(e),backgroundFetch:(e,r,n,i)=>t.#O(e,r,n,i),moveToTail:e=>t.#k(e),indexes:e=>t.#x(e),rindexes:e=>t.#T(e),isStale:e=>t.#A(e)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#a}get size(){return this.#o}get fetchMethod(){return this.#s}get dispose(){return this.#n}get disposeAfter(){return this.#i}constructor(t){const{max:e=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:a,dispose:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:l,maxSize:f=0,maxEntrySize:d=0,sizeCalculation:p,fetchMethod:b,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:g,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:m,ignoreFetchAbort:w}=t;if(0!==e&&!Ee(e))throw new TypeError("max option must be a nonnegative integer");const S=e?Oe(e):Array;if(!S)throw new Error("invalid max value: "+e);if(this.#e=e,this.#r=f,this.maxEntrySize=d||this.#r,this.sizeCalculation=p,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==b&&"function"!=typeof b)throw new TypeError("fetchMethod must be a function if specified");if(this.#s=b,this.#S=!!b,this.#c=new Map,this.#u=new Array(e).fill(void 0),this.#h=new Array(e).fill(void 0),this.#l=new S(e),this.#f=new S(e),this.#d=0,this.#p=0,this.#b=xe.create(e),this.#o=0,this.#a=0,"function"==typeof c&&(this.#n=c),"function"==typeof u?(this.#i=u,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#w=!!this.#n,this.#_=!!this.#i,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!l,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!m,this.ignoreFetchAbort=!!w,0!==this.maxEntrySize){if(0!==this.#r&&!Ee(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ee(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#j()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!g,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ee(n)||0===n?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!Ee(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(0===this.#e&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){const t="LRU_CACHE_UNBOUNDED";(t=>!ve.has(t))(t)&&(ve.add(t),we("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,Te))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#R(){const t=new ke(this.#e),e=new ke(this.#e);this.#m=t,this.#v=e,this.#C=(r,n,i=ge.now())=>{if(e[r]=0!==n?i:0,t[r]=n,0!==n&&this.ttlAutopurge){const t=setTimeout((()=>{this.#A(r)&&this.delete(this.#u[r])}),n+1);t.unref&&t.unref()}},this.#L=r=>{e[r]=0!==t[r]?ge.now():0},this.#D=(i,s)=>{if(t[s]){const o=t[s],a=e[s];if(!o||!a)return;i.ttl=o,i.start=a,i.now=r||n();const c=i.now-a;i.remainingTTL=o-c}};let r=0;const n=()=>{const t=ge.now();if(this.ttlResolution>0){r=t;const e=setTimeout((()=>r=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{const s=this.#c.get(i);if(void 0===s)return 0;const o=t[s],a=e[s];return o&&a?o-((r||n())-a):1/0},this.#A=i=>{const s=e[i],o=t[i];return!!o&&!!s&&(r||n())-s>o}}#L=()=>{};#D=()=>{};#C=()=>{};#A=()=>!1;#j(){const t=new ke(this.#e);this.#a=0,this.#g=t,this.#P=e=>{this.#a-=t[e],t[e]=0},this.#B=(t,e,r,n)=>{if(this.#E(e))return 0;if(!Ee(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(e,t),!Ee(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#F=(e,r,n)=>{if(t[e]=r,this.#r){const r=this.#r-t[e];for(;this.#a>r;)this.#z(!0)}this.#a+=t[e],n&&(n.entrySize=r,n.totalCalculatedSize=this.#a)}}#P=t=>{};#F=(t,e,r)=>{};#B=(t,e,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:t=this.allowStale}={}){if(this.#o)for(let e=this.#p;this.#N(e)&&(!t&&this.#A(e)||(yield e),e!==this.#d);)e=this.#f[e]}*#T({allowStale:t=this.allowStale}={}){if(this.#o)for(let e=this.#d;this.#N(e)&&(!t&&this.#A(e)||(yield e),e!==this.#p);)e=this.#l[e]}#N(t){return void 0!==t&&this.#c.get(this.#u[t])===t}*entries(){for(const t of this.#x())void 0===this.#h[t]||void 0===this.#u[t]||this.#E(this.#h[t])||(yield[this.#u[t],this.#h[t]])}*rentries(){for(const t of this.#T())void 0===this.#h[t]||void 0===this.#u[t]||this.#E(this.#h[t])||(yield[this.#u[t],this.#h[t]])}*keys(){for(const t of this.#x()){const e=this.#u[t];void 0===e||this.#E(this.#h[t])||(yield e)}}*rkeys(){for(const t of this.#T()){const e=this.#u[t];void 0===e||this.#E(this.#h[t])||(yield e)}}*values(){for(const t of this.#x())void 0===this.#h[t]||this.#E(this.#h[t])||(yield this.#h[t])}*rvalues(){for(const t of this.#T())void 0===this.#h[t]||this.#E(this.#h[t])||(yield this.#h[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const r of this.#x()){const n=this.#h[r],i=this.#E(n)?n.__staleWhileFetching:n;if(void 0!==i&&t(i,this.#u[r],this))return this.get(this.#u[r],e)}}forEach(t,e=this){for(const r of this.#x()){const n=this.#h[r],i=this.#E(n)?n.__staleWhileFetching:n;void 0!==i&&t.call(e,i,this.#u[r],this)}}rforEach(t,e=this){for(const r of this.#T()){const n=this.#h[r],i=this.#E(n)?n.__staleWhileFetching:n;void 0!==i&&t.call(e,i,this.#u[r],this)}}purgeStale(){let t=!1;for(const e of this.#T({allowStale:!0}))this.#A(e)&&(this.delete(this.#u[e]),t=!0);return t}info(t){const e=this.#c.get(t);if(void 0===e)return;const r=this.#h[e],n=this.#E(r)?r.__staleWhileFetching:r;if(void 0===n)return;const i={value:n};if(this.#m&&this.#v){const t=this.#m[e],r=this.#v[e];if(t&&r){const e=t-(ge.now()-r);i.ttl=e,i.start=Date.now()}}return this.#g&&(i.size=this.#g[e]),i}dump(){const t=[];for(const e of this.#x({allowStale:!0})){const r=this.#u[e],n=this.#h[e],i=this.#E(n)?n.__staleWhileFetching:n;if(void 0===i||void 0===r)continue;const s={value:i};if(this.#m&&this.#v){s.ttl=this.#m[e];const t=ge.now()-this.#v[e];s.start=Math.floor(Date.now()-t)}this.#g&&(s.size=this.#g[e]),t.unshift([r,s])}return t}load(t){this.clear();for(const[e,r]of t){if(r.start){const t=Date.now()-r.start;r.start=ge.now()-t}this.set(e,r.value,r)}}set(t,e,r={}){if(void 0===e)return this.delete(t),this;const{ttl:n=this.ttl,start:i,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const u=this.#B(t,e,r.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.delete(t),this;let h=0===this.#o?void 0:this.#c.get(t);if(void 0===h)h=0===this.#o?this.#p:0!==this.#b.length?this.#b.pop():this.#o===this.#e?this.#z(!1):this.#o,this.#u[h]=t,this.#h[h]=e,this.#c.set(t,h),this.#l[this.#p]=h,this.#f[h]=this.#p,this.#p=h,this.#o++,this.#F(h,u,a),a&&(a.set="add"),c=!1;else{this.#k(h);const r=this.#h[h];if(e!==r){if(this.#S&&this.#E(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=r;void 0===e||s||(this.#w&&this.#n?.(e,t,"set"),this.#_&&this.#y?.push([e,t,"set"]))}else s||(this.#w&&this.#n?.(r,t,"set"),this.#_&&this.#y?.push([r,t,"set"]));if(this.#P(h),this.#F(h,u,a),this.#h[h]=e,a){a.set="replace";const t=r&&this.#E(r)?r.__staleWhileFetching:r;void 0!==t&&(a.oldValue=t)}}else a&&(a.set="update")}if(0===n||this.#m||this.#R(),this.#m&&(c||this.#C(h,n,i),a&&this.#D(a,h)),!s&&this.#_&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}return this}pop(){try{for(;this.#o;){const t=this.#h[this.#d];if(this.#z(!0),this.#E(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#_&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}}}#z(t){const e=this.#d,r=this.#u[e],n=this.#h[e];return this.#S&&this.#E(n)?n.__abortController.abort(new Error("evicted")):(this.#w||this.#_)&&(this.#w&&this.#n?.(n,r,"evict"),this.#_&&this.#y?.push([n,r,"evict"])),this.#P(e),t&&(this.#u[e]=void 0,this.#h[e]=void 0,this.#b.push(e)),1===this.#o?(this.#d=this.#p=0,this.#b.length=0):this.#d=this.#l[e],this.#c.delete(r),this.#o--,e}has(t,e={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=e,i=this.#c.get(t);if(void 0!==i){const t=this.#h[i];if(this.#E(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#A(i))return r&&this.#L(i),n&&(n.has="hit",this.#D(n,i)),!0;n&&(n.has="stale",this.#D(n,i))}else n&&(n.has="miss");return!1}peek(t,e={}){const{allowStale:r=this.allowStale}=e,n=this.#c.get(t);if(void 0===n||!r&&this.#A(n))return;const i=this.#h[n];return this.#E(i)?i.__staleWhileFetching:i}#O(t,e,r,n){const i=void 0===e?void 0:this.#h[e];if(this.#E(i))return i;const s=new Se,{signal:o}=r;o?.addEventListener("abort",(()=>s.abort(o.reason)),{signal:s.signal});const a={signal:s.signal,options:r,context:n},c=(n,i=!1)=>{const{aborted:o}=s.signal,c=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!i?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,c&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!c&&!i)return u(s.signal.reason);const l=h;return this.#h[e]===h&&(void 0===n?l.__staleWhileFetching?this.#h[e]=l.__staleWhileFetching:this.delete(t):(r.status&&(r.status.fetchUpdated=!0),this.set(t,n,a.options))),n},u=n=>{const{aborted:i}=s.signal,o=i&&r.allowStaleOnFetchAbort,a=o||r.allowStaleOnFetchRejection,c=a||r.noDeleteOnFetchRejection,u=h;if(this.#h[e]===h&&(c&&void 0!==u.__staleWhileFetching?o||(this.#h[e]=u.__staleWhileFetching):this.delete(t)),a)return r.status&&void 0!==u.__staleWhileFetching&&(r.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw n};r.status&&(r.status.fetchDispatched=!0);const h=new Promise(((e,n)=>{const o=this.#s?.(t,i,a);o&&o instanceof Promise&&o.then((t=>e(void 0===t?void 0:t)),n),s.signal.addEventListener("abort",(()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(e(void 0),r.allowStaleOnFetchAbort&&(e=t=>c(t,!0)))}))})).then(c,(t=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=t),u(t)))),l=Object.assign(h,{__abortController:s,__staleWhileFetching:i,__returned:void 0});return void 0===e?(this.set(t,l,{...a.options,status:void 0}),e=this.#c.get(t)):this.#h[e]=l,l}#E(t){if(!this.#S)return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Se}async fetch(t,e={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:l=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:p,forceRefresh:b=!1,status:y,signal:g}=e;if(!this.#S)return y&&(y.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:y});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:s,noDisposeOnSet:o,size:a,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:l,allowStaleOnFetchAbort:d,ignoreFetchAbort:f,status:y,signal:g};let m=this.#c.get(t);if(void 0===m){y&&(y.fetch="miss");const e=this.#O(t,m,v,p);return e.__returned=e}{const e=this.#h[m];if(this.#E(e)){const t=r&&void 0!==e.__staleWhileFetching;return y&&(y.fetch="inflight",t&&(y.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}const i=this.#A(m);if(!b&&!i)return y&&(y.fetch="hit"),this.#k(m),n&&this.#L(m),y&&this.#D(y,m),e;const s=this.#O(t,m,v,p),o=void 0!==s.__staleWhileFetching&&r;return y&&(y.fetch=i?"stale":"refresh",o&&i&&(y.returnedStale=!0)),o?s.__staleWhileFetching:s.__returned=s}}get(t,e={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:s}=e,o=this.#c.get(t);if(void 0!==o){const e=this.#h[o],a=this.#E(e);return s&&this.#D(s,o),this.#A(o)?(s&&(s.get="stale"),a?(s&&r&&void 0!==e.__staleWhileFetching&&(s.returnedStale=!0),r?e.__staleWhileFetching:void 0):(i||this.delete(t),s&&r&&(s.returnedStale=!0),r?e:void 0)):(s&&(s.get="hit"),a?e.__staleWhileFetching:(this.#k(o),n&&this.#L(o),e))}s&&(s.get="miss")}#I(t,e){this.#f[e]=t,this.#l[t]=e}#k(t){t!==this.#p&&(t===this.#d?this.#d=this.#l[t]:this.#I(this.#f[t],this.#l[t]),this.#I(this.#p,t),this.#p=t)}delete(t){let e=!1;if(0!==this.#o){const r=this.#c.get(t);if(void 0!==r)if(e=!0,1===this.#o)this.clear();else{this.#P(r);const e=this.#h[r];if(this.#E(e)?e.__abortController.abort(new Error("deleted")):(this.#w||this.#_)&&(this.#w&&this.#n?.(e,t,"delete"),this.#_&&this.#y?.push([e,t,"delete"])),this.#c.delete(t),this.#u[r]=void 0,this.#h[r]=void 0,r===this.#p)this.#p=this.#f[r];else if(r===this.#d)this.#d=this.#l[r];else{const t=this.#f[r];this.#l[t]=this.#l[r];const e=this.#l[r];this.#f[e]=this.#f[r]}this.#o--,this.#b.push(r)}}if(this.#_&&this.#y?.length){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}return e}clear(){for(const t of this.#T({allowStale:!0})){const e=this.#h[t];if(this.#E(e))e.__abortController.abort(new Error("deleted"));else{const r=this.#u[t];this.#w&&this.#n?.(e,r,"delete"),this.#_&&this.#y?.push([e,r,"delete"])}}if(this.#c.clear(),this.#h.fill(void 0),this.#u.fill(void 0),this.#m&&this.#v&&(this.#m.fill(0),this.#v.fill(0)),this.#g&&this.#g.fill(0),this.#d=0,this.#p=0,this.#b.length=0,this.#a=0,this.#o=0,this.#_&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}}}var Ae=function(t,e){return Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ae(t,e)};function je(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ae(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Re(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Ce(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Le(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function De(t,e,r){if(r||2===arguments.length)for(var n,i=0,s=e.length;i<s;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function Pe(t){return this instanceof Pe?(this.v=t,this):new Pe(t)}function Be(t){return"function"==typeof t}function Fe(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var ze=Fe((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function Ne(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Ie=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=Ce(s),a=o.next();!a.done;a=o.next())a.value.remove(this)}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if(Be(c))try{c()}catch(t){i=t instanceof ze?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=Ce(u),l=h.next();!l.done;l=h.next()){var f=l.value;try{qe(f)}catch(t){i=null!=i?i:[],t instanceof ze?i=De(De([],Le(i)),Le(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(i)throw new ze(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)qe(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Ne(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&Ne(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Ue=Ie.EMPTY;function Me(t){return t instanceof Ie||t&&"closed"in t&&Be(t.remove)&&Be(t.add)&&Be(t.unsubscribe)}function qe(t){Be(t)?t():t.unsubscribe()}var Ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},We={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=We.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,De([t,e],Le(r))):setTimeout.apply(void 0,De([t,e],Le(r)))},clearTimeout:function(t){var e=We.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function He(t){We.setTimeout((function(){var e=Ve.onUnhandledError;if(!e)throw t;e(t)}))}function $e(){}var Ge=Je("C",void 0,void 0);function Je(t,e,r){return{kind:t,value:e,error:r}}var Ke=null;function Ye(t){if(Ve.useDeprecatedSynchronousErrorHandling){var e=!Ke;if(e&&(Ke={errorThrown:!1,error:null}),t(),e){var r=Ke,n=r.errorThrown,i=r.error;if(Ke=null,n)throw i}}else t()}var Xe=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,Me(e)&&e.add(r)):r.destination=ir,r}return je(e,t),e.create=function(t,e,r){return new er(t,e,r)},e.prototype.next=function(t){this.isStopped?nr(function(t){return Je("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?nr(Je("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?nr(Ge,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Ie),Qe=Function.prototype.bind;function Ze(t,e){return Qe.call(t,e)}var tr=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){rr(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){rr(t)}else rr(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){rr(t)}},t}(),er=function(t){function e(e,r,n){var i,s,o=t.call(this)||this;return Be(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:o&&Ve.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return o.unsubscribe()},i={next:e.next&&Ze(e.next,s),error:e.error&&Ze(e.error,s),complete:e.complete&&Ze(e.complete,s)}):i=e,o.destination=new tr(i),o}return je(e,t),e}(Xe);function rr(t){var e;Ve.useDeprecatedSynchronousErrorHandling?(e=t,Ve.useDeprecatedSynchronousErrorHandling&&Ke&&(Ke.errorThrown=!0,Ke.error=e)):He(t)}function nr(t,e){var r=Ve.onStoppedNotification;r&&We.setTimeout((function(){return r(t,e)}))}var ir={closed:!0,next:$e,error:function(t){throw t},complete:$e},sr="function"==typeof Symbol&&Symbol.observable||"@@observable";function or(t){return t}var ar=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this,i=function(t){return t&&t instanceof Xe||function(t){return t&&Be(t.next)&&Be(t.error)&&Be(t.complete)}(t)&&Me(t)}(t)?t:new er(t,e,r);return Ye((function(){var t=n,e=t.operator,r=t.source;i.add(e?e.call(i,r):r?n._subscribe(i):n._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=cr(e))((function(e,n){var i=new er({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[sr]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(r=t).length?or:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=cr(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function cr(t){var e;return null!==(e=null!=t?t:Ve.Promise)&&void 0!==e?e:Promise}var ur=Fe((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),hr=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return je(e,t),e.prototype.lift=function(t){var e=new lr(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new ur},e.prototype.next=function(t){var e=this;Ye((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=Ce(e.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(t)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;Ye((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;Ye((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,s=r.observers;return n||i?Ue:(this.currentObservers=null,s.push(t),new Ie((function(){e.currentObservers=null,Ne(s,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new ar;return t.source=this,t},e.create=function(t,e){return new lr(t,e)},e}(ar),lr=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return je(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:Ue},e}(hr),fr=function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}return je(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(hr),dr={now:function(){return(dr.delegate||Date).now()},delegate:void 0},pr=function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=dr);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}return je(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,o=r._timestampProvider,a=r._windowTime;n||(i.push(e),!s&&i.push(o.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,s=(i?1:2)*e;if(e<1/0&&s<n.length&&n.splice(0,n.length-s),!i){for(var o=r.now(),a=0,c=1;c<n.length&&n[c]<=o;c+=2)a=c;a&&n.splice(0,a+1)}},e}(hr);function br(t){return function(e){if(function(t){return Be(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function yr(t,e,r,n,i){return new gr(t,e,r,n,i)}var gr=function(t){function e(e,r,n,i,s,o){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return je(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(Xe);function vr(){return br((function(t,e){var r,n=!1;t.subscribe(yr(e,(function(t){var i=r;r=t,n&&e.next([i,t]),n=!0})))}))}function mr(t,e){return br((function(r,n){var i=0;r.subscribe(yr(n,(function(r){return t.call(e,r,i++)&&n.next(r)})))}))}function wr(t,e){return br((function(r,n){var i=0;r.subscribe(yr(n,(function(r){n.next(t.call(e,r,i++))})))}))}var Sr=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t},_r="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Er(t){if(t instanceof ar)return t;if(null!=t){if(function(t){return Be(t[sr])}(t))return i=t,new ar((function(t){var e=i[sr]();if(Be(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Sr(t))return n=t,new ar((function(t){for(var e=0;e<n.length&&!t.closed;e++)t.next(n[e]);t.complete()}));if(function(t){return Be(null==t?void 0:t.then)}(t))return r=t,new ar((function(t){r.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,He)}));if(function(t){return Symbol.asyncIterator&&Be(null==t?void 0:t[Symbol.asyncIterator])}(t))return Or(t);if(function(t){return Be(null==t?void 0:t[_r])}(t))return e=t,new ar((function(t){var r,n;try{for(var i=Ce(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()}));if(function(t){return Be(null==t?void 0:t.getReader)}(t))return Or(function(t){return function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(t,e||[]),s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(t){i[t]&&(n[t]=function(e){return new Promise((function(r,n){s.push([t,e,r,n])>1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof Pe?Promise.resolve(r.value.v).then(c,u):h(s[0][2],r)}catch(t){h(s[0][3],t)}var r}function c(t){a("next",t)}function u(t){a("throw",t)}function h(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}}(this,arguments,(function(){var e,r,n;return Re(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Pe(e.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,Pe(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Pe(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}(t))}var e,r,n,i;throw function(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(t)}function Or(t){return new ar((function(e){(function(t,e){var r,n,i,s,o,a,c,u;return o=this,a=void 0,u=function(){var o,a;return Re(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=Ce(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){!function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)}(n,i,(e=t[r](e)).done,e.value)}))}}}(t),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((c=void 0)||(c=Promise))((function(t,e){function r(t){try{i(u.next(t))}catch(t){e(t)}}function n(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):function(t){return t instanceof c?t:new c((function(e){e(t)}))}(e.value).then(r,n)}i((u=u.apply(o,a||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function kr(t){void 0===t&&(t={});var e=t.connector,r=void 0===e?function(){return new hr}:e,n=t.resetOnError,i=void 0===n||n,s=t.resetOnComplete,o=void 0===s||s,a=t.resetOnRefCountZero,c=void 0===a||a;return function(t){var e,n,s,a=0,u=!1,h=!1,l=function(){null==n||n.unsubscribe(),n=void 0},f=function(){l(),e=s=void 0,u=h=!1},d=function(){var t=e;f(),null==t||t.unsubscribe()};return br((function(t,p){a++,h||u||l();var b=s=null!=s?s:r();p.add((function(){0!=--a||h||u||(n=xr(d,c))})),b.subscribe(p),!e&&a>0&&(e=new er({next:function(t){return b.next(t)},error:function(t){h=!0,l(),n=xr(f,i,t),b.error(t)},complete:function(){u=!0,l(),n=xr(f,o),b.complete()}}),Er(t).subscribe(e))}))(t)}}function xr(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==e){if(!1!==e){var i=new er({next:function(){i.unsubscribe(),t()}});return Er(e.apply(void 0,De([],Le(r)))).subscribe(i)}}else t()}function Tr(t,e){return void 0===e&&(e=or),t=null!=t?t:Ar,br((function(r,n){var i,s=!0;r.subscribe(yr(n,(function(r){var o=e(r);!s&&t(i,o)||(s=!1,i=o,n.next(r))})))}))}function Ar(t,e){return t===e}const jr=(t,e)=>{const{origWidth:r,origHeight:n}=e,i=t.points.map((([t,e])=>[t*r/100,e*n/100]));return{...t,points:i}},Rr=t=>{const{origWidth:e,origHeight:r,inputWidth:n,inputHeight:i}=t,[s,o,a,c]=t.boundingBox,u=s*e/n,h=o*r/i,l=a*e/n,f=c*r/i;return{...t,boundingBox:[u,h,l,f]}},Cr=(t,e)=>{const[r,n,i,s]=t.boundingBox,o={xmin:r,ymin:n,xmax:i,ymax:s};let a=!1;for(const r of e){const e=jr(r,t);if(e.isPrivacyMask){if(Dr(o,e.points)){a=!1;break}}else"include"===e.filter?"contain"===e.type?Dr(o,e.points)&&(a=!0):"intersect"===e.type&&(Lr(o,e.points)||Dr(o,e.points))&&(a=!0):"exclude"===e.filter&&("contain"===e.type?Dr(o,e.points)||(a=!0):"intersect"===e.type&&(Lr(o,e.points)||Dr(o,e.points)||(a=!0)))}return a},Lr=(t,e)=>{const r=Pr(t);for(const t of r)for(let r=0;r<e.length;r++){const n=[e[r],e[(r+1)%e.length]];if(Br(t,n))return!0}return!1},Dr=(t,e)=>[[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax],[t.xmin,t.ymax]].every((t=>Fr(t,e))),Pr=t=>{const{xmin:e,ymin:r,xmax:n,ymax:i}=t;return[[[e,r],[n,r]],[[n,r],[n,i]],[[n,i],[e,i]],[[e,i],[e,r]]]},Br=(t,e)=>{const r=(t,e,r)=>(r[1]-t[1])*(e[0]-t[0])>(e[1]-t[1])*(r[0]-t[0]);return n=t[0],i=t[1],r(n,s=e[0],o=e[1])!==r(i,s,o)&&r(n,i,s)!==r(n,i,o);var n,i,s,o},Fr=(t,e)=>{const[r,n]=t;let i=!1,[s,o]=e[e.length-1];for(const[t,a]of e)a>n!=o>n&&r<(s-t)*(n-a)/(o-a)+t&&(i=!i),[s,o]=[t,a];return i};class zr{subscriptions=[];additionalSubscriptions=[];addSubscriptions(...t){this.subscriptions.push(...t)}addAdditionalSubscriptions(...t){this.additionalSubscriptions.push(...t)}unsubscribe(){this.subscriptions.forEach((t=>t.unsubscribe()))}unsubscribeAdditional(){this.additionalSubscriptions.forEach((t=>t.unsubscribe()))}}class Nr extends zr{logger;snapshotCache=new Te({max:100,ttl:3e5});cameraSubject;cameraState=new fr(!1);lightState=new fr({state:!1,timestamp:"0"});motionState=new fr({timestamp:"0",detections:[]});audioState=new fr({state:!1,timestamp:"0"});objectState=new fr({timestamp:"0",detections:[]});doorbellState=new fr({state:!1,timestamp:"0"});sirenState=new fr({state:!1,timestamp:"0"});batteryState=new fr({level:100,timestamp:"0"});prebufferStateSubjects={};onConnected=this.createStateObservable(this.cameraState,void 0);onLightSwitched=this.createStateObservable(this.lightState,"light");onMotionDetected=this.createStateObservable(this.motionState,"motion");onAudioDetected=this.createStateObservable(this.audioState,"audio");onObjectDetected=this.createStateObservable(this.objectState,"object");onDoorbellPressed=this.createStateObservable(this.doorbellState,"doorbell");onSirenDetected=this.createStateObservable(this.sirenState,"siren");onBatteryChanged=this.createStateObservable(this.batteryState,"battery");get id(){return this.cameraSubject.getValue()._id}get nativeId(){return this.cameraSubject.getValue().nativeId}get pluginId(){return this.cameraSubject.getValue().pluginId}get connected(){return this.cameraState.getValue()}get disabled(){return this.cameraSubject.getValue().disabled}get name(){return this.cameraSubject.getValue().name}get type(){return this.cameraSubject.getValue().type}get info(){return pe()(this.cameraSubject.getValue().info)}get isCloud(){return this.cameraSubject.getValue().isCloud}get hasLight(){return this.cameraSubject.getValue().hasLight}get hasSiren(){return this.cameraSubject.getValue().hasSiren}get hasBinarySensor(){return this.cameraSubject.getValue().hasBinarySensor}get hasBattery(){return this.cameraSubject.getValue().hasBattery}get hasMotionDetector(){return this.cameraSubject.getValue().hasMotionDetector}get hasAudioDetector(){return this.cameraSubject.getValue().hasAudioDetector}get hasObjectDetector(){return this.cameraSubject.getValue().hasObjectDetector}get hasPtz(){return this.cameraSubject.getValue().hasPtz}get hasPrebuffer(){return this.cameraSubject.getValue().hasPrebuffer}get hasIntercom(){return this.cameraSubject.getValue().hasIntercom}get activityZones(){return pe()(this.cameraSubject.getValue().activityZones)}get activitySettings(){return pe()(this.cameraSubject.getValue().activitySettings)}get sources(){return pe()(this.cameraSubject.getValue().sources).map((t=>({...t,updatePrebufferingState:async(e,r)=>this.updatePrebuffer(t._id,e,r),getPrebufferingState:e=>this.cameraSourcePrebufferState(t._id,e),onPrebuffering:e=>this.createPrebufferStateObservable(t._id,e),getStreamInfo:async()=>{}})))}get streamSource(){return this.sources.find((t=>t.roles.includes("stream")))||this.sources[0]}get snapshotSource(){return this.sources.find((t=>t.roles.includes("snapshot")))||this.streamSource}get recordingSource(){return this.sources.find((t=>t.roles.includes("record")))||this.streamSource}get detectionSource(){return this.sources.find((t=>t.roles.includes("detect")))||this.streamSource}constructor(t,e){super(),this.logger=e,this.cameraSubject=new fr(t),"native"===t.pluginId&&this.cameraState.next(!0)}getValue(t){switch(t){case"light":return pe()(this.lightState.getValue());case"motion":return pe()(this.motionState.getValue());case"audio":return pe()(this.audioState.getValue());case"object":return pe()(this.objectState.getValue());case"doorbell":return pe()(this.doorbellState.getValue());case"siren":return pe()(this.sirenState.getValue());case"battery":return pe()(this.batteryState.getValue());default:throw new Error(`Unknown state: ${t}`)}}async updateState(t,e){switch(t){case"light":this.lightState.next(this.getLightState(e));break;case"motion":this.motionState.next(this.getMotionState(e));break;case"audio":this.audioState.next(this.getAudioState(e));break;case"object":this.objectState.next(this.getObjectState(e));break;case"doorbell":this.doorbellState.next(this.getDoorbellState(e));break;case"siren":this.sirenState.next(this.getSirenState(e));break;case"battery":this.batteryState.next(this.getBatteryState(e));break;default:throw new Error(`Unknown state: ${t}`)}}async updateStateInternal(t,e,r,n){let i,s=!1;if(r)s=!0,i=e;else{const r=this.checkStateInternal(t,e);s=r.changed,i=r.event}s&&this.updateState(t,i,n)}onStateChange(t){return this[`${t}State`].pipe(vr(),mr((([e,r])=>"boolean"==typeof e||"boolean"==typeof r?e!==r:!1===this.stateChanged(e,r,t))),wr((([t,e])=>({oldState:t,newState:e}))),kr({connector:()=>new pr(1)}))}onPropertyChange(t){return this.cameraSubject.pipe(vr(),mr((([e,r])=>!ye()(e[t],r[t]))),wr((([e,r])=>({oldData:e[t],newData:r[t]}))),kr({connector:()=>new pr(1)}))}removeAllListeners(){this.lightState.complete(),this.motionState.complete(),this.audioState.complete(),this.objectState.complete(),this.doorbellState.complete(),this.sirenState.complete(),this.batteryState.complete(),this.cameraSubject.complete(),this.cameraState.complete()}checkStateInternal(t,e){let r,n=!1;switch(t){case"audio":const i=e;r=this.getAudioState(i),n=this.stateChanged(this.audioState.getValue(),r,"audio");break;case"light":const s=e;r=this.getLightState(s),n=this.stateChanged(this.lightState.getValue(),r,"light");break;case"motion":const o=e;r=this.getMotionState(o),"boolean"==typeof o.state&&(o.detections=[]),o.detections.length&&(o.detections=((t,e)=>{if(0===e.length)return[];const r=[];for(let n of t)n=Rr(n),Cr(n,e)&&r.push(n);return r})(o.detections,this.activityZones)),n=this.stateChanged(this.motionState.getValue(),r,"motion");break;case"object":const a=e;r=this.getObjectState(a),a.detections.length&&(a.detections=((t,e)=>{if(0===e.length)return[];const r=[];for(let n of t)n=Rr(n),Cr(n,e)&&r.push(n);return r.filter((t=>e.some((e=>!e.classes.length||e.classes.includes(t.label)))))})(a.detections,this.activityZones)),n=this.stateChanged(this.objectState.getValue(),r,"object");break;case"doorbell":const c=e;r=this.getDoorbellState(c),n=this.stateChanged(this.doorbellState.getValue(),r,"doorbell");break;case"siren":const u=e;r=this.getSirenState(u),n=this.stateChanged(this.sirenState.getValue(),r,"siren");break;case"battery":const h=e;r=this.getBatteryState(h),n=this.stateChanged(this.batteryState.getValue(),r,"battery");break;default:throw new Error(`Unknown state: ${t}`)}return{changed:n,event:r}}getAudioState(t){const e=this.getValue("audio");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,db:t.db||e.db,lastEvent:e.state?e:n.state?n:void 0}}return r}getMotionState(t){const e=this.getValue("motion");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.detections.length?e:n.detections.length?n:void 0}}return r}getObjectState(t){const e=this.getValue("object");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.detections.length?e:n.detections.length?n:void 0}}return r}getDoorbellState(t){const e=this.getValue("doorbell");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.state?e:n.state?n:void 0}}return r}getLightState(t){const e=this.getValue("light");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.state?e:n.state?n:void 0}}return r}getSirenState(t){const e=this.getValue("siren");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.state?e:n.state?n:void 0}}return r}getBatteryState(t){const e=this.getValue("battery"),r=this.stateChanged(e,t,"battery");let n;if(delete e.lastEvent,this.isStateEvent(t))n=t;else{const i={...t,timestamp:Date.now().toString()};n={...i,charging:t.charging||e.charging,lowBattery:t.lowBattery||e.lowBattery,lastEvent:r?e:i}}return n}updateCamera(t){this.cameraSubject.next(t),this.updateCameraSourcesState()}async updatePrebuffer(t,e,r){this.prebufferStateSubjects[t]&&this.prebufferStateSubjects[t][e]&&this.prebufferStateSubjects[t][e].next({state:r.state,url:r.url||void 0,maxDuration:r.maxDuration,availableDuration:r.availableDuration})}updateCameraSourcesState(){const t=this.cameraSubject.getValue().sources;for(const e in this.prebufferStateSubjects)if(!t.some((t=>t._id===e))){for(const t in this.prebufferStateSubjects[e])this.prebufferStateSubjects[e][t].complete();delete this.prebufferStateSubjects[e]}}updateCameraState(t){this.cameraState.next(t)}cameraSourcePrebufferState(t,e){let r={state:!1,maxDuration:0,availableDuration:0};return this.prebufferStateSubjects[t]&&this.prebufferStateSubjects[t][e]&&(r=this.prebufferStateSubjects[t][e].getValue()),r}createStateObservable(t,e){return t.pipe(Tr(((t,r)=>"boolean"==typeof t||"boolean"==typeof r?t===r:!1===this.stateChanged(t,r,e))),kr({connector:()=>new pr(1)}))}createPrebufferStateObservable(t,e){return this.prebufferStateSubjects[t]||(this.prebufferStateSubjects[t]={}),this.prebufferStateSubjects[t][e]||(this.prebufferStateSubjects[t][e]=new fr({state:!1,maxDuration:0,availableDuration:0})),this.prebufferStateSubjects[t][e].pipe(Tr(((t,e)=>t.state===e.state&&t.url===e.url)),kr({connector:()=>new pr(1)}))}stateChanged(t,e,r){if(!t||!e||!r)return!1;if("audio"==r){if(!this.hasAudioDetector)return!1;const r=t,n=e;return r.state!==n.state||r.db!==n.db}if("motion"==r){if(!this.hasMotionDetector)return!1;const r=t,n=e;return"state"in t&&"state"in e?r.state!==n.state:!ye()(r.detections,n.detections)}if("object"==r){if(!this.hasObjectDetector)return!1;const r=t,n=e;return!ye()(r.detections,n.detections)}if("siren"==r){if(!this.hasSiren)return!1;const r=t,n=e;return r.state!==n.state||r.level!==n.level}if("battery"==r){if(!this.hasBattery)return!1;const r=t,n=e;return r.level!==n.level||r.lowBattery!==n.lowBattery||r.charging!==n.charging}if("doorbell"==r){if(!this.hasBinarySensor)return!1;const r=e;return t.state!==r.state}if("light"==r){if(!this.hasLight)return!1;const r=e;return t.state!==r.state}return!1}isStateEvent(t){return"timestamp"in t}}var Ir=function(t,e){return Ir=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ir(t,e)};function Ur(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ir(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Mr(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function qr(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vr(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function Wr(t,e,r){if(r||2===arguments.length)for(var n,i=0,s=e.length;i<s;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function Hr(t){return this instanceof Hr?(this.v=t,this):new Hr(t)}function $r(t){return"function"==typeof t}function Gr(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var Jr=Gr((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function Kr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Yr=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=qr(s),a=o.next();!a.done;a=o.next())a.value.remove(this)}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if($r(c))try{c()}catch(t){i=t instanceof Jr?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=qr(u),l=h.next();!l.done;l=h.next()){var f=l.value;try{Zr(f)}catch(t){i=null!=i?i:[],t instanceof Jr?i=Wr(Wr([],Vr(i)),Vr(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(i)throw new Jr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Zr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Kr(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&Kr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Xr=Yr.EMPTY;function Qr(t){return t instanceof Yr||t&&"closed"in t&&$r(t.remove)&&$r(t.add)&&$r(t.unsubscribe)}function Zr(t){$r(t)?t():t.unsubscribe()}var tn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},en={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=en.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,Wr([t,e],Vr(r))):setTimeout.apply(void 0,Wr([t,e],Vr(r)))},clearTimeout:function(t){var e=en.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function rn(t){en.setTimeout((function(){var e=tn.onUnhandledError;if(!e)throw t;e(t)}))}function nn(){}var sn=on("C",void 0,void 0);function on(t,e,r){return{kind:t,value:e,error:r}}var an=null;function cn(t){if(tn.useDeprecatedSynchronousErrorHandling){var e=!an;if(e&&(an={errorThrown:!1,error:null}),t(),e){var r=an,n=r.errorThrown,i=r.error;if(an=null,n)throw i}}else t()}var un=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,Qr(e)&&e.add(r)):r.destination=yn,r}return Ur(e,t),e.create=function(t,e,r){return new dn(t,e,r)},e.prototype.next=function(t){this.isStopped?bn(function(t){return on("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?bn(on("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?bn(sn,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Yr),hn=Function.prototype.bind;function ln(t,e){return hn.call(t,e)}var fn=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){pn(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){pn(t)}else pn(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){pn(t)}},t}(),dn=function(t){function e(e,r,n){var i,s,o=t.call(this)||this;return $r(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:o&&tn.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return o.unsubscribe()},i={next:e.next&&ln(e.next,s),error:e.error&&ln(e.error,s),complete:e.complete&&ln(e.complete,s)}):i=e,o.destination=new fn(i),o}return Ur(e,t),e}(un);function pn(t){var e;tn.useDeprecatedSynchronousErrorHandling?(e=t,tn.useDeprecatedSynchronousErrorHandling&&an&&(an.errorThrown=!0,an.error=e)):rn(t)}function bn(t,e){var r=tn.onStoppedNotification;r&&en.setTimeout((function(){return r(t,e)}))}var yn={closed:!0,next:nn,error:function(t){throw t},complete:nn},gn="function"==typeof Symbol&&Symbol.observable||"@@observable";function vn(t){return t}var mn=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this,i=function(t){return t&&t instanceof un||function(t){return t&&$r(t.next)&&$r(t.error)&&$r(t.complete)}(t)&&Qr(t)}(t)?t:new dn(t,e,r);return cn((function(){var t=n,e=t.operator,r=t.source;i.add(e?e.call(i,r):r?n._subscribe(i):n._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=wn(e))((function(e,n){var i=new dn({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[gn]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(r=t).length?vn:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=wn(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function wn(t){var e;return null!==(e=null!=t?t:tn.Promise)&&void 0!==e?e:Promise}var Sn=Gr((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),_n=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return Ur(e,t),e.prototype.lift=function(t){var e=new En(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Sn},e.prototype.next=function(t){var e=this;cn((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=qr(e.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(t)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;cn((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;cn((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,s=r.observers;return n||i?Xr:(this.currentObservers=null,s.push(t),new Yr((function(){e.currentObservers=null,Kr(s,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new mn;return t.source=this,t},e.create=function(t,e){return new En(t,e)},e}(mn),En=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return Ur(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:Xr},e}(_n),On={now:function(){return(On.delegate||Date).now()},delegate:void 0},kn=function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=On);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}return Ur(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,o=r._timestampProvider,a=r._windowTime;n||(i.push(e),!s&&i.push(o.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,s=(i?1:2)*e;if(e<1/0&&s<n.length&&n.splice(0,n.length-s),!i){for(var o=r.now(),a=0,c=1;c<n.length&&n[c]<=o;c+=2)a=c;a&&n.splice(0,a+1)}},e}(_n),xn=function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}return Ur(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(_n),Tn=Gr((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}}));function An(t){return function(e){if(function(t){return $r(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}var jn=Array.isArray;function Rn(t,e,r,n,i){return new Cn(t,e,r,n,i)}var Cn=function(t){function e(e,r,n,i,s,o){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return Ur(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(un);function Ln(t,e){return An((function(r,n){var i=0;r.subscribe(Rn(n,(function(r){n.next(t.call(e,r,i++))})))}))}var Dn=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Pn(t){return $r(null==t?void 0:t.then)}function Bn(t){return $r(t[gn])}function Fn(t){return Symbol.asyncIterator&&$r(null==t?void 0:t[Symbol.asyncIterator])}function zn(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Nn,In,Un,Mn="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function qn(t){return $r(null==t?void 0:t[Mn])}function Vn(t){return function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(t,e||[]),s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(t){i[t]&&(n[t]=function(e){return new Promise((function(r,n){s.push([t,e,r,n])>1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof Hr?Promise.resolve(r.value.v).then(c,u):h(s[0][2],r)}catch(t){h(s[0][3],t)}var r}function c(t){a("next",t)}function u(t){a("throw",t)}function h(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}}(this,arguments,(function(){var e,r,n;return Mr(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Hr(e.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,Hr(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Hr(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function Wn(t){return $r(null==t?void 0:t.getReader)}function Hn(t){if(t instanceof mn)return t;if(null!=t){if(Bn(t))return i=t,new mn((function(t){var e=i[gn]();if($r(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Dn(t))return n=t,new mn((function(t){for(var e=0;e<n.length&&!t.closed;e++)t.next(n[e]);t.complete()}));if(Pn(t))return r=t,new mn((function(t){r.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,rn)}));if(Fn(t))return $n(t);if(qn(t))return e=t,new mn((function(t){var r,n;try{for(var i=qr(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()}));if(Wn(t))return $n(Vn(t))}var e,r,n,i;throw zn(t)}function $n(t){return new mn((function(e){(function(t,e){var r,n,i,s,o,a,c,u;return o=this,a=void 0,u=function(){var o,a;return Mr(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=qr(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){!function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)}(n,i,(e=t[r](e)).done,e.value)}))}}}(t),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((c=void 0)||(c=Promise))((function(t,e){function r(t){try{i(u.next(t))}catch(t){e(t)}}function n(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):function(t){return t instanceof c?t:new c((function(e){e(t)}))}(e.value).then(r,n)}i((u=u.apply(o,a||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function Gn(t,e,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var s=e.schedule((function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()}),n);if(t.add(s),!i)return s}function Jn(t,e,r){return void 0===r&&(r=1/0),$r(e)?Jn((function(r,n){return Ln((function(t,i){return e(r,t,n,i)}))(Hn(t(r,n)))}),r):("number"==typeof e&&(r=e),An((function(e,n){return function(t,e,r,n,i,s,o,a){var c=[],u=0,h=0,l=!1,f=function(){!l||c.length||u||e.complete()},d=function(t){return u<n?p(t):c.push(t)},p=function(t){u++;var i=!1;Hn(r(t,h++)).subscribe(Rn(e,(function(t){e.next(t)}),(function(){i=!0}),void 0,(function(){if(i)try{u--;for(;c.length&&u<n;)t=void 0,t=c.shift(),p(t);f()}catch(t){e.error(t)}var t})))};return t.subscribe(Rn(e,d,(function(){l=!0,f()}))),function(){}}(e,n,t,r)})))}function Kn(t){return t[t.length-1]}function Yn(t,e){return void 0===e&&(e=0),An((function(r,n){r.subscribe(Rn(n,(function(r){return Gn(n,t,(function(){return n.next(r)}),e)}),(function(){return Gn(n,t,(function(){return n.complete()}),e)}),(function(r){return Gn(n,t,(function(){return n.error(r)}),e)})))}))}function Xn(t,e){return void 0===e&&(e=0),An((function(r,n){n.add(t.schedule((function(){return r.subscribe(n)}),e))}))}function Qn(t,e){if(!t)throw new Error("Iterable cannot be null");return new mn((function(r){Gn(r,e,(function(){var n=t[Symbol.asyncIterator]();Gn(r,e,(function(){n.next().then((function(t){t.done?r.complete():r.next(t.value)}))}),0,!0)}))}))}function Zn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=function(t){return function(t){return t&&$r(t.schedule)}(Kn(t))?t.pop():void 0}(t),n=function(t,e){return"number"==typeof Kn(t)?t.pop():1/0}(t);return t=function(t){return 1===t.length&&jn(t[0])?t[0]:t}(t),An((function(e,i){(function(t){return void 0===t&&(t=1/0),Jn(vn,t)})(n)(function(t,e){return e?function(t,e){if(null!=t){if(Bn(t))return function(t,e){return Hn(t).pipe(Xn(e),Yn(e))}(t,e);if(Dn(t))return function(t,e){return new mn((function(r){var n=0;return e.schedule((function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())}))}))}(t,e);if(Pn(t))return function(t,e){return Hn(t).pipe(Xn(e),Yn(e))}(t,e);if(Fn(t))return Qn(t,e);if(qn(t))return function(t,e){return new mn((function(r){var n;return Gn(r,e,(function(){n=t[Mn](),Gn(r,e,(function(){var t,e,i;try{e=(t=n.next()).value,i=t.done}catch(t){return void r.error(t)}i?r.complete():r.next(e)}),0,!0)})),function(){return $r(null==n?void 0:n.return)&&n.return()}}))}(t,e);if(Wn(t))return function(t,e){return Qn(Vn(t),e)}(t,e)}throw zn(t)}(t,e):Hn(t)}(Wr([e],Vr(t)),r)).subscribe(i)}))}function ti(t,e){return t===e}function ei(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==e){if(!1!==e){var i=new dn({next:function(){i.unsubscribe(),t()}});return Hn(e.apply(void 0,Wr([],Vr(r)))).subscribe(i)}}else t()}!function(t){t.READY="ready",t.STARTING="starting",t.STARTED="started",t.STOPPED="stopped",t.ERROR="error",t.UNKNOWN="unknown",t.DISABLED="disabled"}(Nn||(Nn={})),function(t){t.START="start",t.STOP="stop"}(In||(In={})),function(t){t.READY="ready",t.RESTARTING="restarting",t.STARTING="starting",t.STARTED="started",t.STOPPED="stopped",t.ERROR="error",t.UNKNOWN="unknown"}(Un||(Un={}));class ri{subscriptions=[];additionalSubscriptions=[];addSubscriptions(...t){this.subscriptions.push(...t)}addAdditionalSubscriptions(...t){this.additionalSubscriptions.push(...t)}unsubscribe(){this.subscriptions.forEach((t=>t.unsubscribe()))}unsubscribeAdditional(){this.additionalSubscriptions.forEach((t=>t.unsubscribe()))}}class ni extends ri{onCallAnswered=new kn(1);onCallEnded=new kn(1);onUsingOpus=new kn(1);micState=new xn(!1);hasEnded=!1;cameraDevice;connection;logger;onMicrophoneEnabled=this.createStateObservable(this.micState);get isUsingOpus(){return t=this.onUsingOpus.pipe(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Zn.apply(void 0,Wr([],Vr(t)))}(this.connection.onError.pipe(Ln((t=>{throw t}))))),new Promise((function(e,r){var n=new dn({next:function(t){e(t),n.unsubscribe()},error:r,complete:function(){r(new Tn)}});t.subscribe(n)}));var t}constructor(t,e,r){super(),this.cameraDevice=t,this.logger=e,this.connection=r,this.bindToConnection(r)}enableMicrophone(t){this.hasEnded||(this.connection.pc.enableMicrophone(t),this.micState.next(!0))}disableMicrophone(){this.hasEnded||(this.connection.pc.disableMicrophone(),this.micState.next(!1))}stop(){this.callEnded()}createStateObservable(t){return t.pipe((e=(t,e)=>t===e,void 0===r&&(r=vn),e=null!=e?e:ti,An((function(t,n){var i,s=!0;t.subscribe(Rn(n,(function(t){var o=r(t);!s&&e(i,o)||(s=!1,i=o,n.next(t))})))}))),function(t){void 0===t&&(t={});var e=t.connector,r=void 0===e?function(){return new _n}:e,n=t.resetOnError,i=void 0===n||n,s=t.resetOnComplete,o=void 0===s||s,a=t.resetOnRefCountZero,c=void 0===a||a;return function(t){var e,n,s,a=0,u=!1,h=!1,l=function(){null==n||n.unsubscribe(),n=void 0},f=function(){l(),e=s=void 0,u=h=!1},d=function(){var t=e;f(),null==t||t.unsubscribe()};return An((function(t,p){a++,h||u||l();var b=s=null!=s?s:r();p.add((function(){0!=--a||h||u||(n=ei(d,c))})),b.subscribe(p),!e&&a>0&&(e=new dn({next:function(t){return b.next(t)},error:function(t){h=!0,l(),n=ei(f,i,t),b.error(t)},complete:function(){u=!0,l(),n=ei(f,o),b.complete()}}),Hn(t).subscribe(e))}))(t)}}({connector:()=>new kn(1)}));var e,r}bindToConnection(t){this.addSubscriptions(t.onCallAnswered.subscribe((t=>{this.onUsingOpus.next(t.toLocaleLowerCase().includes(" opus/"))})),t.onCallEnded.subscribe((()=>this.callEnded())))}callEnded(){this.hasEnded||(this.hasEnded=!0,this.unsubscribe(),this.onCallEnded.next(),this.connection.stop())}}var ii=Array.isArray;var si=["addListener","removeListener"],oi=["addEventListener","removeEventListener"],ai=["on","off"];function ci(t,e,r,n){if($r(r)&&(n=r,r=void 0),n)return ci(t,e,r).pipe((i=n,Ln((function(t){return function(t,e){return ii(e)?t.apply(void 0,Wr([],Vr(e))):t(e)}(i,t)}))));var i,s=Vr(function(t){return $r(t.addEventListener)&&$r(t.removeEventListener)}(t)?oi.map((function(n){return function(i){return t[n](e,i,r)}})):function(t){return $r(t.addListener)&&$r(t.removeListener)}(t)?si.map(ui(t,e)):function(t){return $r(t.on)&&$r(t.off)}(t)?ai.map(ui(t,e)):[],2),o=s[0],a=s[1];if(!o&&Dn(t))return Jn((function(t){return ci(t,e,r)}))(Hn(t));if(!o)throw new TypeError("Invalid event target");return new mn((function(t){var e=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.next(1<e.length?e:e[0])};return o(e),function(){return a(e)}}))}function ui(t,e){return function(r){return function(n){return t[r](e,n)}}}function hi(t){const e=[];return t.forEach((t=>{t.urls.forEach((r=>{e.push({urls:r,username:t.username,credential:t.credential})}))})),e}class li extends ri{onIceCandidate=new _n;onConnectionState=new kn(1);videoTransceiver;audioTransceiver;cameraDevice;logger;pc;videoElement;constructor(t,e,r,n){super(),this.cameraDevice=t,this.logger=n,this.videoElement=e,this.pc=new RTCPeerConnection({iceServers:hi(r)}),this.audioTransceiver=this.pc.addTransceiver("audio",{direction:"sendrecv"}),this.videoTransceiver=this.pc.addTransceiver("video",{direction:"recvonly"}),this.pc.onconnectionstatechange=()=>{this.logger.debug(this.cameraDevice.name,"connectionStateChange:",this.pc.connectionState),this.onConnectionState.next(this.pc.connectionState)},this.pc.oniceconnectionstatechange=()=>{this.logger.debug(this.cameraDevice.name,"iceconnectionstatechange:",this.pc.iceConnectionState)},this.pc.onicegatheringstatechange=()=>{this.logger.debug(this.cameraDevice.name,"icegatheringstatechange:",this.pc.iceGatheringState)},this.pc.onicecandidate=t=>{t.candidate&&this.onIceCandidate.next(t.candidate)},this.pc.ontrack=t=>{this.logger.debug(this.cameraDevice.name,"ontrack:",t.track),e.srcObject?e.srcObject.addTrack(t.track):e.srcObject=new MediaStream([t.track])}}enableMicrophone(t){this.audioTransceiver.sender.replaceTrack(t)}disableMicrophone(){this.audioTransceiver.sender.replaceTrack(null)}async createOffer(){const t=await this.pc.createOffer();return await this.pc.setLocalDescription(t),t}async acceptAnswer(t){await this.pc.setRemoteDescription(t)}addIceCandidate(t){return this.pc.addIceCandidate(t)}close(){this.videoElement.srcObject=null,this.pc.close(),this.unsubscribe()}}class fi extends ri{onCallAnswered=new kn(1);onCallEnded=new kn(1);onError=new kn(1);onMessage=new kn;onWsOpen;pc;ws;onOfferSent=new kn(1);hasEnded=!1;cameraDevice;logger;constructor(t,e,r,n,i){super(),this.cameraDevice=t,this.logger=i;const s=t.sources.find((t=>t.name===e));if(!s)throw new Error(`Invalid source name ${e}`);this.ws=new WebSocket(s.urls.ws.webrtc),this.pc=new li(t,r,n,i),this.onWsOpen=ci(this.ws,"open");const o=ci(this.ws,"message"),a=ci(this.ws,"error"),c=ci(this.ws,"close");var u,h;this.addSubscriptions(o.pipe((u=t=>{const e=JSON.parse(t.data);return this.onMessage.next(e),this.handleMessage(e).catch((t=>{throw this.onError.next(t),t}))},$r(h)?Jn(u,h,1):Jn(u,1))).subscribe(),a.subscribe((t=>{this.logger.error(this.cameraDevice.name,t),this.callEnded()})),c.subscribe((()=>{this.callEnded()})),this.cameraDevice.onConnected.subscribe((t=>{t||this.callEnded()})),this.onError.subscribe((t=>{this.logger.error(this.cameraDevice.name,t),this.callEnded()})),this.onWsOpen.subscribe((()=>{this.initiateCall().catch((t=>{this.logger.error(this.cameraDevice.name,t),this.callEnded()}))})),this.pc.onConnectionState.subscribe((t=>{"failed"===t&&(this.logger.error(this.cameraDevice.name,"Stream connection failed"),this.callEnded()),"closed"===t&&(this.logger.debug(this.cameraDevice.name,"Stream connection closed"),this.callEnded())})),this.pc.onIceCandidate.subscribe((async t=>{this.sendMessage({type:"webrtc/candidate",value:t.toJSON().candidate||""})})))}stop(){this.callEnded()}async initiateCall(){const{sdp:t}=await this.pc.createOffer();this.sendMessage({type:"webrtc/offer",value:t||""}),this.onOfferSent.next()}async handleMessage(t){switch(t.type){case"webrtc/answer":const e=t.value;return await this.pc.acceptAnswer({type:"answer",sdp:e}),void this.onCallAnswered.next(e);case"webrtc/candidate":return void await this.pc.addIceCandidate({candidate:t.value,sdpMid:"0"});case"error":throw new Error(t.value);default:throw new Error(t)}}sendMessage(t){this.hasEnded||this.ws.send(JSON.stringify(t))}callEnded(){this.hasEnded||(this.hasEnded=!0,this.unsubscribe(),this.onCallEnded.next(),this.pc.close(),this.ws.close())}}class di extends Nr{socketService;socket;started=!1;get sources(){return super.sources.map((t=>({...t,updatePrebufferingState:(e,r)=>this.socketService.sendRequest({name:"cameraDevice",method:"updateState",args:[{cameraId:this.id,sourceId:t._id,container:e,state:r,pluginId:"@camera.ui/client"}]},this.socket),getPrebufferingState:e=>super.cameraSourcePrebufferState(t._id,e),onPrebuffering:e=>super.createPrebufferStateObservable(t._id,e),getStreamInfo:async()=>this.socketService.sendRequest({name:"cameraDevice",method:"getStreamInfo",args:[{sourceName:t.name,pluginId:"@camera.ui/client"}]},this.socket)})))}constructor(t,e,r){super(t,r),this.socketService=e;const{socket:n}=this.socketService.createManager();this.socket=n}start(){this.started||(this.listenToMessages(),this.socket.emit("joinRoom",this.id),this.started=!0)}stop(){this.cleanup()}connect(){return this.socketService.sendRequest({name:"cameraDevice",method:"connect",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}disconnect(){return this.socketService.sendRequest({name:"cameraDevice",method:"disconnect",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}reboot(){return this.socketService.sendRequest({name:"cameraDevice",method:"reboot",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}getIceServers(){return this.socketService.sendRequest({name:"cameraDevice",method:"getIceServers",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}async snapshot(t=!1){const e=this.snapshotSource.urls.www.jpegSnapshot,r=this.snapshotCache.get(this.snapshotSource._id);if(!t&&r)return r;const n=await fetch(e);if(!n.ok)throw new Error("Status Code: "+n.status);const i=await n.arrayBuffer();return i.byteLength>0&&this.snapshotCache.set(this.snapshotSource._id,i),i}async createSession(t,e){const r=await this.getIceServers(),n=new fi(this,t,e,r,this.logger);return new ni(this,this.logger,n)}async updateState(t,e){const{changed:r,event:n}=super.checkStateInternal(t,e);if(r)return super.updateState(t,n),this.socketService.sendRequest({name:"cameraDevice",method:"updateState",args:[{cameraId:this.id,stateName:t,eventData:n,pluginId:"@camera.ui/client"}]},this.socket)}async refreshStates(){const t=await this.socketService.sendRequest({name:"cameraDevice",method:"refreshStates",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket);super.updateCamera(t.camera),super.updateCameraState(t.cameraState);for(const[e,r]of Object.entries(t.states))super.updateStateInternal(e,r)}async cleanup(){this.removeAllListeners(),this.unsubscribe(),this.socket.disconnect(),this.started=!1}listenToMessages(){this.socket.on("updateState",(t=>{t.cameraId===this.id&&super.updateStateInternal(t.stateName,t.data.newEvent)})),this.socket.on("updateDevice",(t=>{if(t.cameraId===this.id)switch(t.type){case"removed":this.cleanup();break;case"updated":super.updateCamera(t.data);break;case"cameraState":super.updateCameraState(t.data);break;case"prebufferState":super.updatePrebuffer(t.data.sourceId,t.data.container,t.data.state)}}))}}class pi{socketService;logger;constructor(t,e){this.socketService=t,this.logger=e}async getCameraById(t){const e=await this.socketService.sendRequest({name:"deviceManager",method:"getCameraById",args:[{id:t,pluginId:"@camera.ui/client"}]});if(e){const t=new di(e,this.socketService,this.logger);return await t.refreshStates(),t}}async getCameraByName(t){const e=await this.socketService.sendRequest({name:"deviceManager",method:"getCameraByName",args:[{name:t,pluginId:"@camera.ui/client"}]});if(e){const t=new di(e,this.socketService,this.logger);return await t.refreshStates(),t}}}class bi{socketService;logger;constructor(t,e){this.socketService=t,this.logger=e}}class yi{socketService;logger;constructor(t,e){this.socketService=t,this.logger=e}}const gi=Object.create(null);gi.open="0",gi.close="1",gi.ping="2",gi.pong="3",gi.message="4",gi.upgrade="5",gi.noop="6";const vi=Object.create(null);Object.keys(gi).forEach((t=>{vi[gi[t]]=t}));const mi={type:"error",data:"parser error"},wi="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Si="function"==typeof ArrayBuffer,_i=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ei=({type:t,data:e},r,n)=>wi&&e instanceof Blob?r?n(e):Oi(e,n):Si&&(e instanceof ArrayBuffer||_i(e))?r?n(e):Oi(new Blob([e]),n):n(gi[t]+(e||"")),Oi=(t,e)=>{const r=new FileReader;return r.onload=function(){const t=r.result.split(",")[1];e("b"+(t||""))},r.readAsDataURL(t)};function ki(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let xi;const Ti="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<64;t++)Ti["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(t)]=t;const Ai="function"==typeof ArrayBuffer,ji=(t,e)=>{if("string"!=typeof t)return{type:"message",data:Ci(t,e)};const r=t.charAt(0);return"b"===r?{type:"message",data:Ri(t.substring(1),e)}:vi[r]?t.length>1?{type:vi[r],data:t.substring(1)}:{type:vi[r]}:mi},Ri=(t,e)=>{if(Ai){const r=(t=>{let e,r,n,i,s,o=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);const u=new ArrayBuffer(o),h=new Uint8Array(u);for(e=0;e<a;e+=4)r=Ti[t.charCodeAt(e)],n=Ti[t.charCodeAt(e+1)],i=Ti[t.charCodeAt(e+2)],s=Ti[t.charCodeAt(e+3)],h[c++]=r<<2|n>>4,h[c++]=(15&n)<<4|i>>2,h[c++]=(3&i)<<6|63&s;return u})(t);return Ci(r,e)}return{base64:!0,data:t}},Ci=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,Li=String.fromCharCode(30);let Di;function Pi(t){return t.reduce(((t,e)=>t+e.length),0)}function Bi(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let n=0;for(let i=0;i<e;i++)r[i]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),r}function Fi(t){if(t)return function(t){for(var e in Fi.prototype)t[e]=Fi.prototype[e];return t}(t)}Fi.prototype.on=Fi.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Fi.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},Fi.prototype.off=Fi.prototype.removeListener=Fi.prototype.removeAllListeners=Fi.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<n.length;i++)if((r=n[i])===e||r.fn===e){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},Fi.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,e)}return this},Fi.prototype.emitReserved=Fi.prototype.emit,Fi.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Fi.prototype.hasListeners=function(t){return!!this.listeners(t).length};const zi="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Ni(t,...e){return e.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{})}const Ii=zi.setTimeout,Ui=zi.clearTimeout;function Mi(t,e){e.useNativeTimers?(t.setTimeoutFn=Ii.bind(zi),t.clearTimeoutFn=Ui.bind(zi)):(t.setTimeoutFn=zi.setTimeout.bind(zi),t.clearTimeoutFn=zi.clearTimeout.bind(zi))}class qi extends Error{constructor(t,e,r){super(t),this.description=e,this.context=r,this.type="TransportError"}}class Vi extends Fi{constructor(t){super(),this.writable=!1,Mi(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,r){return super.emitReserved("error",new qi(t,e,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=ji(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){const e=function(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}(t);return e.length?"?"+e:""}}const Wi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Hi=64,$i={};let Gi,Ji=0,Ki=0;function Yi(t){let e="";do{e=Wi[t%Hi]+e,t=Math.floor(t/Hi)}while(t>0);return e}function Xi(){const t=Yi(+new Date);return t!==Gi?(Ji=0,Gi=t):t+"."+Yi(Ji++)}for(;Ki<Hi;Ki++)$i[Wi[Ki]]=Ki;let Qi=!1;try{Qi="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const Zi=Qi;function ts(t){const e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||Zi))return new XMLHttpRequest}catch(t){}if(!e)try{return new(zi[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function es(){}const rs=null!=new ts({xdomain:!1}).responseType;class ns extends Fi{constructor(t,e){super(),Mi(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.data=void 0!==e.data?e.data:null,this.create()}create(){var t;const e=Ni(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd;const r=this.xhr=new ts(e);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&r.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var t;3===r.readyState&&(null===(t=this.opts.cookieJar)||void 0===t||t.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=ns.requestsCount++,ns.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=es,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete ns.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function is(){for(let t in ns.requests)ns.requests.hasOwnProperty(t)&&ns.requests[t].abort()}ns.requestsCount=0,ns.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",is):"function"==typeof addEventListener&&addEventListener("onpagehide"in zi?"pagehide":"unload",is,!1));const ss="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),os=zi.WebSocket||zi.MozWebSocket,as="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),cs={websocket:class extends Vi{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,r=as?{}:Ni(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=as?new os(t,e,r):e?new os(t,e):new os(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],n=e===t.length-1;Ei(r,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}n&&ss((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Xi()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}check(){return!!os}},webtransport:class extends Vi{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((t=>{this.onError("webtransport error",t)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((t=>{const e=function(t,e){Di||(Di=new TextDecoder);const r=[];let n=0,i=-1,s=!1;return new TransformStream({transform(o,a){for(r.push(o);;){if(0===n){if(Pi(r)<1)break;const t=Bi(r,1);s=!(128&~t[0]),i=127&t[0],n=i<126?3:126===i?1:2}else if(1===n){if(Pi(r)<2)break;const t=Bi(r,2);i=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),n=3}else if(2===n){if(Pi(r)<8)break;const t=Bi(r,8),e=new DataView(t.buffer,t.byteOffset,t.length),s=e.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(mi);break}i=s*Math.pow(2,32)+e.getUint32(4),n=3}else{if(Pi(r)<i)break;const t=Bi(r,i);a.enqueue(ji(s?t:Di.decode(t),e)),n=0}if(0===i||i>t){a.enqueue(mi);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(e).getReader(),n=new TransformStream({transform(t,e){!function(t,e){wi&&t.data instanceof Blob?t.data.arrayBuffer().then(ki).then(e):Si&&(t.data instanceof ArrayBuffer||_i(t.data))?e(ki(t.data)):Ei(t,!1,(t=>{xi||(xi=new TextEncoder),e(xi.encode(t))}))}(t,(r=>{const n=r.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const t=new DataView(i.buffer);t.setUint8(0,126),t.setUint16(1,n)}else{i=new Uint8Array(9);const t=new DataView(i.buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(n))}t.data&&"string"!=typeof t.data&&(i[0]|=128),e.enqueue(i),e.enqueue(r)}))}});n.readable.pipeTo(t.writable),this.writer=n.writable.getWriter();const i=()=>{r.read().then((({done:t,value:e})=>{t||(this.onPacket(e),i())})).catch((t=>{}))};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then((()=>this.onOpen()))}))})))}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],n=e===t.length-1;this.writer.write(r).then((()=>{n&&ss((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var t;null===(t=this.transport)||void 0===t||t.close()}},polling:class extends Vi{constructor(t){if(super(t),this.polling=!1,"undefined"!=typeof location){const e="https:"===location.protocol;let r=location.port;r||(r=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||r!==t.port}const e=t&&t.forceBase64;this.supportsBinary=rs&&!e,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const r=t.split(Li),n=[];for(let t=0;t<r.length;t++){const i=ji(r[t],e);if(n.push(i),"error"===i.type)break}return n})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const r=t.length,n=new Array(r);let i=0;t.forEach(((t,s)=>{Ei(t,!1,(t=>{n[s]=t,++i===r&&e(n.join(Li))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=Xi()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ns(this.uri(),t)}doWrite(t,e){const r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",((t,e)=>{this.onError("xhr post error",t,e)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",((t,e)=>{this.onError("xhr poll error",t,e)})),this.pollXhr=t}}},us=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,hs=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ls(t){if(t.length>2e3)throw"URI too long";const e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let i=us.exec(t||""),s={},o=14;for(;o--;)s[hs[o]]=i[o]||"";return-1!=r&&-1!=n&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(t,e){const r=e.replace(/\/{2,9}/g,"/").split("/");return"/"!=e.slice(0,1)&&0!==e.length||r.splice(0,1),"/"==e.slice(-1)&&r.splice(r.length-1,1),r}(0,s.path),s.queryKey=function(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,n){e&&(r[e]=n)})),r}(0,s.query),s}class fs extends Fi{constructor(t,e={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],t&&"object"==typeof t&&(e=t,t=null),t?(t=ls(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=ls(e.host).host),Mi(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,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},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},r=t.split("&");for(let t=0,n=r.length;t<n;t++){let n=r[t].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const r=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new cs[t](r)}open(){let t;if(this.opts.rememberUpgrade&&fs.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}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",(t=>this.onClose("transport close",t)))}probe(t){let e=this.createTransport(t),r=!1;fs.priorWebsocketSuccess=!1;const n=()=>{r||(e.send([{type:"ping",data:"probe"}]),e.once("packet",(t=>{if(!r)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;fs.priorWebsocketSuccess="websocket"===e.name,this.transport.pause((()=>{r||"closed"!==this.readyState&&(u(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}})))};function i(){r||(r=!0,u(),e.close(),e=null)}const s=t=>{const r=new Error("probe error: "+t);r.transport=e.name,i(),this.emitReserved("upgradeError",r)};function o(){s("transport closed")}function a(){s("socket closed")}function c(t){e&&t.name!==e.name&&i()}const u=()=>{e.removeListener("open",n),e.removeListener("error",s),e.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};e.once("open",n),e.once("error",s),e.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((()=>{r||e.open()}),200):e.open()}onOpen(){if(this.readyState="open",fs.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const n=this.writeBuffer[r].data;if(n&&(t+="string"==typeof(e=n)?function(t){let e=0,r=0;for(let n=0,i=t.length;n<i;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}var e;return this.writeBuffer}write(t,e,r){return this.sendPacket("message",t,e,r),this}send(t,e,r){return this.sendPacket("message",t,e,r),this}sendPacket(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:t,data:e,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():t()})):this.upgrading?r():t()),this}onError(t){fs.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let r=0;const n=t.length;for(;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}}fs.protocol=4,fs.protocol;const ds="function"==typeof ArrayBuffer,ps=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,bs=Object.prototype.toString,ys="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===bs.call(Blob),gs="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===bs.call(File);function vs(t){return ds&&(t instanceof ArrayBuffer||ps(t))||ys&&t instanceof Blob||gs&&t instanceof File}function ms(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,r=t.length;e<r;e++)if(ms(t[e]))return!0;return!1}if(vs(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return ms(t.toJSON(),!0);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&ms(t[e]))return!0;return!1}function ws(t){const e=[],r=t.data,n=t;return n.data=Ss(r,e),n.attachments=e.length,{packet:n,buffers:e}}function Ss(t,e){if(!t)return t;if(vs(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=Ss(t[n],e);return r}if("object"==typeof t&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=Ss(t[n],e));return r}return t}function _s(t,e){return t.data=Es(t.data,e),delete t.attachments,t}function Es(t,e){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=Es(t[r],e);else if("object"==typeof t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=Es(t[r],e));return t}const Os=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ks=5;var xs;!function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(xs||(xs={}));class Ts{constructor(t){this.replacer=t}encode(t){return t.type!==xs.EVENT&&t.type!==xs.ACK||!ms(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===xs.EVENT?xs.BINARY_EVENT:xs.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==xs.BINARY_EVENT&&t.type!==xs.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=ws(t),r=this.encodeAsString(e.packet),n=e.buffers;return n.unshift(r),n}}function As(t){return"[object Object]"===Object.prototype.toString.call(t)}class js extends Fi{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const r=e.type===xs.BINARY_EVENT;r||e.type===xs.BINARY_ACK?(e.type=r?xs.EVENT:xs.ACK,this.reconstructor=new Rs(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!vs(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const r={type:Number(t.charAt(0))};if(void 0===xs[r.type])throw new Error("unknown packet type "+r.type);if(r.type===xs.BINARY_EVENT||r.type===xs.BINARY_ACK){const n=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);const i=t.substring(n,e);if(i!=Number(i)||"-"!==t.charAt(e))throw new Error("Illegal attachments");r.attachments=Number(i)}if("/"===t.charAt(e+1)){const n=e+1;for(;++e&&","!==t.charAt(e)&&e!==t.length;);r.nsp=t.substring(n,e)}else r.nsp="/";const n=t.charAt(e+1);if(""!==n&&Number(n)==n){const n=e+1;for(;++e;){const r=t.charAt(e);if(null==r||Number(r)!=r){--e;break}if(e===t.length)break}r.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){const n=this.tryParse(t.substr(e));if(!js.isPayloadValid(r.type,n))throw new Error("invalid payload");r.data=n}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case xs.CONNECT:return As(e);case xs.DISCONNECT:return void 0===e;case xs.CONNECT_ERROR:return"string"==typeof e||As(e);case xs.EVENT:case xs.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===Os.indexOf(e[0]));case xs.ACK:case xs.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Rs{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=_s(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Cs(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const Ls=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ds extends Fi{constructor(t,e,r){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=t,this.nsp=e,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Cs(t,"open",this.onopen.bind(this)),Cs(t,"packet",this.onpacket.bind(this)),Cs(t,"error",this.onerror.bind(this)),Cs(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(Ls.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:xs.EVENT,data:e,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,n=e.pop();this._registerAckCallback(t,n),r.id=t}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var r;const n=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===n)return void(this.acks[t]=e);const i=this.io.setTimeoutFn((()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,new Error("operation has timed out"))}),n),s=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...e){return new Promise(((r,n)=>{const i=(t,e)=>t?n(t):r(e);i.withError=!0,e.push(i),this.emit(t,...e)}))}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push(((t,...n)=>{if(r===this._queue[0])return null!==t?r.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...n)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth((t=>{this._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:xs.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((t=>{if(!this.sendBuffer.some((e=>String(e.id)===t))){const e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}}))}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case xs.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 xs.EVENT:case xs.BINARY_EVENT:this.onevent(t);break;case xs.ACK:case xs.BINARY_ACK:this.onack(t);break;case xs.DISCONNECT:this.ondisconnect();break;case xs.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const r of e)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let r=!1;return function(...n){r||(r=!0,e.packet({type:xs.ACK,id:t,data:n}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((t=>this.emitEvent(t))),this.receiveBuffer=[],this.sendBuffer.forEach((t=>{this.notifyOutgoingListeners(t),this.packet(t)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((t=>t())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:xs.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const r of e)r.apply(this,t.data)}}}function Ps(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Ps.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+r:t-r}return 0|Math.min(t,this.max)},Ps.prototype.reset=function(){this.attempts=0},Ps.prototype.setMin=function(t){this.ms=t},Ps.prototype.setMax=function(t){this.max=t},Ps.prototype.setJitter=function(t){this.jitter=t};class Bs extends Fi{constructor(t,r){var n;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(r=t,t=void 0),(r=r||{}).path=r.path||"/socket.io",this.opts=r,Mi(this,r),this.reconnection(!1!==r.reconnection),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=r.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Ps({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==r.timeout?2e4:r.timeout),this._readyState="closed",this.uri=t;const i=r.parser||e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==r.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new fs(this.uri,this.opts);const e=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=Cs(e,"open",(function(){r.onopen(),t&&t()})),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},s=Cs(e,"error",i);if(!1!==this._timeout){const t=this._timeout,r=this.setTimeoutFn((()=>{n(),i(new Error("timeout")),e.close()}),t);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}return this.subs.push(n),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Cs(t,"ping",this.onping.bind(this)),Cs(t,"data",this.ondata.bind(this)),Cs(t,"error",this.onerror.bind(this)),Cs(t,"close",this.onclose.bind(this)),Cs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){ss((()=>{this.emitReserved("packet",t)}),this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Ds(this,t,e),this.nsps[t]=r),r}_destroy(t){const e=Object.keys(this.nsps);for(const t of e)if(this.nsps[t].active)return;this._close()}_packet(t){const e=this.encoder.encode(t);for(let r=0;r<e.length;r++)this.engine.write(e[r],t.options)}cleanup(){this.subs.forEach((t=>t())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()})))}),e);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Fs={};function zs(t,e){"object"==typeof t&&(e=t,t=void 0);const r=function(t,e="",r){let n=t;r=r||"undefined"!=typeof location&&location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==r?r.protocol+"//"+t:"https://"+t),n=ls(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+e,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}(t,(e=e||{}).path||"/socket.io"),n=r.source,i=r.id,s=r.path,o=Fs[i]&&s in Fs[i].nsps;let a;return e.forceNew||e["force new connection"]||!1===e.multiplex||o?a=new Bs(n,e):(Fs[i]||(Fs[i]=new Bs(n,e)),a=Fs[i]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(zs,{Manager:Bs,Socket:Ds,io:zs,connect:zs});class Ns{manager;token;endpoint;get socket(){return this.manager.socket("/proxy",{auth:{token:`Bearer ${this.token}`}})}constructor(t,e){this.endpoint=t.replace("https://","wss://").replace("http://","ws://"),this.token=e,this.manager=new Bs(this.endpoint,{reconnection:!1,rejectUnauthorized:!1,autoConnect:!0,transports:["websocket"]})}createManager(){const t=new Bs(this.endpoint,{reconnection:!1,rejectUnauthorized:!1,autoConnect:!0,transports:["websocket"],forceNew:!0}),e=t.socket("/proxy",{auth:{token:`Bearer ${this.token}`}});return{manager:t,socket:e}}sendRequest(t,e){return e=e||this.socket,new Promise(((r,n)=>{e.emit("request",t,(t=>{t.success?r(t.data):n(t.error)}))}))}close(){this.socket.emit("end"),this.socket.removeAllListeners(),this.socket.disconnect()}}class Is{api;socketService;config;logger;token;deviceManager;pluginsManager;systemManager;constructor(t){this.config=t,this.logger=t.logger||{...console,attention:console.warn},this.api=new fe(t.endpoint)}async connect(){return this.deviceManager&&this.pluginsManager&&this.systemManager||(this.cleanUpClient(),await this.login(),this.token=this.token||this.config.token,this.socketService=new Ns(this.config.endpoint,this.token),this.deviceManager=new pi(this.socketService,this.logger),this.pluginsManager=new bi(this.socketService,this.logger),this.systemManager=new yi(this.socketService,this.logger),this.checkSession()),{deviceManager:this.deviceManager,pluginsManager:this.pluginsManager,systemManager:this.systemManager}}async disconnect(){this.socketService?.close(),this.cleanUpClient(),this.config.username&&this.config.password&&await this.api.interceptor.post("/auth/logout",void 0,{headers:{Authorization:`Bearer ${this.token}`}})}async updateCredentials(t){this.config={...this.config,...t},this.socketService&&await this.disconnect(),await this.connect()}async login(){if(this.config.username&&this.config.password)try{const t=await this.api.interceptor.post("/auth/login",{username:this.config.username,password:this.config.password});this.token=t.data.access_token}catch(t){throw 401===t.response?.status?new Error("Invalid credentials"):new Error(`Failed to get token: ${t.message}`)}else if(this.config.token&&!this.config.skipCheck)try{await this.api.interceptor.get("/auth/check",{headers:{Authorization:`Bearer ${this.config.token}`}})}catch(t){throw new Error(`Invalid token: ${t.message}`)}this.token=this.token||this.config.token}getDeviceManager(){return this.deviceManager}getPluginsManager(){return this.pluginsManager}getSystemManager(){return this.systemManager}checkSession(){this.socketService?.socket.removeListener("invalidToken"),this.socketService?.socket.on("invalidToken",(async t=>{t===this.token&&await this.disconnect()}))}cleanUpClient(){this.deviceManager=void 0,this.pluginsManager=void 0,this.systemManager=void 0}}})();var i=n.j;export{i as CameraUiClient};
|
|
1
|
+
var t={275:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,s="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",h="[object Map]",l="[object Number]",f="[object Object]",d="[object Promise]",p="[object RegExp]",b="[object Set]",y="[object String]",g="[object Symbol]",v="[object WeakMap]",m="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",O="[object Int16Array]",k="[object Int32Array]",x="[object Uint8Array]",T="[object Uint8ClampedArray]",A="[object Uint16Array]",j="[object Uint32Array]",R=/\w*$/,C=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[s]=D["[object Array]"]=D[m]=D[w]=D[o]=D[a]=D[S]=D[_]=D[E]=D[O]=D[k]=D[h]=D[l]=D[f]=D[p]=D[b]=D[y]=D[g]=D[x]=D[T]=D[A]=D[j]=!0,D["[object Error]"]=D[c]=D[v]=!1;var P="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,B="object"==typeof self&&self&&self.Object===Object&&self,F=P||B||Function("return this")(),z=e&&!e.nodeType&&e,N=z&&t&&!t.nodeType&&t,I=N&&N.exports===z;function U(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function q(t,e,r,n){var i=-1,s=t?t.length:0;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function H(t,e){return function(r){return t(e(r))}}function $(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var G,J=Array.prototype,K=Function.prototype,Y=Object.prototype,X=F["__core-js_shared__"],Q=(G=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Z=K.toString,tt=Y.hasOwnProperty,et=Y.toString,rt=RegExp("^"+Z.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=I?F.Buffer:void 0,it=F.Symbol,st=F.Uint8Array,ot=H(Object.getPrototypeOf,Object),at=Object.create,ct=Y.propertyIsEnumerable,ut=J.splice,ht=Object.getOwnPropertySymbols,lt=nt?nt.isBuffer:void 0,ft=H(Object.keys,Object),dt=Ft(F,"DataView"),pt=Ft(F,"Map"),bt=Ft(F,"Promise"),yt=Ft(F,"Set"),gt=Ft(F,"WeakMap"),vt=Ft(Object,"create"),mt=Mt(dt),wt=Mt(pt),St=Mt(bt),_t=Mt(yt),Et=Mt(gt),Ot=it?it.prototype:void 0,kt=Ot?Ot.valueOf:void 0;function xt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jt(t){this.__data__=new Tt(t)}function Rt(t,e,r){var n=t[e];tt.call(t,e)&&qt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Ct(t,e){for(var r=t.length;r--;)if(qt(t[r][0],e))return r;return-1}function Lt(t,e,r,n,i,d,v){var C;if(n&&(C=d?n(t,i,d,v):n(t)),void 0!==C)return C;if(!Gt(t))return t;var L=Vt(t);if(L){if(C=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,C)}else{var P=Nt(t),B=P==c||P==u;if(Ht(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(P==f||P==s||B&&!d){if(V(t))return d?t:{};if(C=function(t){return"function"!=typeof t.constructor||Ut(t)?{}:Gt(e=ot(t))?at(e):{};var e}(B?{}:t),!e)return function(t,e){return Pt(t,zt(t),e)}(t,function(t,e){return t&&Pt(e,Jt(e),t)}(C,t))}else{if(!D[P])return d?t:{};C=function(t,e,r,n){var i,s=t.constructor;switch(e){case m:return Dt(t);case o:case a:return new s(+t);case w:return function(t,e){var r=e?Dt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case S:case _:case E:case O:case k:case x:case T:case A:case j:return function(t,e){var r=e?Dt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case h:return function(t,e,r){return q(e?r(W(t),!0):W(t),U,new t.constructor)}(t,n,r);case l:case y:return new s(t);case p:return function(t){var e=new t.constructor(t.source,R.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return function(t,e,r){return q(e?r($(t),!0):$(t),M,new t.constructor)}(t,n,r);case g:return i=t,kt?Object(kt.call(i)):{}}}(t,P,Lt,e)}}v||(v=new jt);var F=v.get(t);if(F)return F;if(v.set(t,C),!L)var z=r?function(t){return function(t,e,r){var n=e(t);return Vt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Jt,zt)}(t):Jt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(z||t,(function(i,s){z&&(i=t[s=i]),Rt(C,s,Lt(i,e,r,n,s,t,v))})),C}function Dt(t){var e=new t.constructor(t.byteLength);return new st(e).set(new st(t)),e}function Pt(t,e,r,n){r||(r={});for(var i=-1,s=e.length;++i<s;){var o=e[i],a=n?n(r[o],t[o],o,r,t):void 0;Rt(r,o,void 0===a?t[o]:a)}return r}function Bt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Ft(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Gt(t)||(e=t,Q&&Q in e))&&($t(t)||V(t)?rt:C).test(Mt(t));var e}(r)?r:void 0}xt.prototype.clear=function(){this.__data__=vt?vt(null):{}},xt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},xt.prototype.get=function(t){var e=this.__data__;if(vt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},xt.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:tt.call(e,t)},xt.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?n:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,r=Ct(e,t);return!(r<0||(r==e.length-1?e.pop():ut.call(e,r,1),0))},Tt.prototype.get=function(t){var e=this.__data__,r=Ct(e,t);return r<0?void 0:e[r][1]},Tt.prototype.has=function(t){return Ct(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=Ct(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},At.prototype.clear=function(){this.__data__={hash:new xt,map:new(pt||Tt),string:new xt}},At.prototype.delete=function(t){return Bt(this,t).delete(t)},At.prototype.get=function(t){return Bt(this,t).get(t)},At.prototype.has=function(t){return Bt(this,t).has(t)},At.prototype.set=function(t,e){return Bt(this,t).set(t,e),this},jt.prototype.clear=function(){this.__data__=new Tt},jt.prototype.delete=function(t){return this.__data__.delete(t)},jt.prototype.get=function(t){return this.__data__.get(t)},jt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new At(n)}return r.set(t,e),this};var zt=ht?H(ht,Object):function(){return[]},Nt=function(t){return et.call(t)};function It(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||L.test(t))&&t>-1&&t%1==0&&t<e}function Ut(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Y)}function Mt(t){if(null!=t){try{return Z.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function qt(t,e){return t===e||t!=t&&e!=e}(dt&&Nt(new dt(new ArrayBuffer(1)))!=w||pt&&Nt(new pt)!=h||bt&&Nt(bt.resolve())!=d||yt&&Nt(new yt)!=b||gt&&Nt(new gt)!=v)&&(Nt=function(t){var e=et.call(t),r=e==f?t.constructor:void 0,n=r?Mt(r):void 0;if(n)switch(n){case mt:return w;case wt:return h;case St:return d;case _t:return b;case Et:return v}return e});var Vt=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!$t(t)}var Ht=lt||function(){return!1};function $t(t){var e=Gt(t)?et.call(t):"";return e==c||e==u}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?function(t,e){var r=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&tt.call(t,"callee")&&(!ct.call(t,"callee")||et.call(t)==s)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var o in t)!e&&!tt.call(t,o)||i&&("length"==o||It(o,n))||r.push(o);return r}(t):function(t){if(!Ut(t))return ft(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Lt(t,!0,!0)}},512:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",h="[object Boolean]",l="[object Date]",f="[object Error]",d="[object Function]",p="[object GeneratorFunction]",b="[object Map]",y="[object Number]",g="[object Null]",v="[object Object]",m="[object Promise]",w="[object Proxy]",S="[object RegExp]",_="[object Set]",E="[object String]",O="[object Undefined]",k="[object WeakMap]",x="[object ArrayBuffer]",T="[object DataView]",A=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,R={};R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R[a]=R[c]=R[x]=R[h]=R[T]=R[l]=R[f]=R[d]=R[b]=R[y]=R[v]=R[S]=R[_]=R[E]=R[k]=!1;var C="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,L="object"==typeof self&&self&&self.Object===Object&&self,D=C||L||Function("return this")(),P=e&&!e.nodeType&&e,B=P&&t&&!t.nodeType&&t,F=B&&B.exports===P,z=F&&C.process,N=function(){try{return z&&z.binding&&z.binding("util")}catch(t){}}(),I=N&&N.isTypedArray;function U(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function M(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function q(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var V,W,H,$=Array.prototype,G=Function.prototype,J=Object.prototype,K=D["__core-js_shared__"],Y=G.toString,X=J.hasOwnProperty,Q=(V=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Z=J.toString,tt=RegExp("^"+Y.call(X).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),et=F?D.Buffer:void 0,rt=D.Symbol,nt=D.Uint8Array,it=J.propertyIsEnumerable,st=$.splice,ot=rt?rt.toStringTag:void 0,at=Object.getOwnPropertySymbols,ct=et?et.isBuffer:void 0,ut=(W=Object.keys,H=Object,function(t){return W(H(t))}),ht=Bt(D,"DataView"),lt=Bt(D,"Map"),ft=Bt(D,"Promise"),dt=Bt(D,"Set"),pt=Bt(D,"WeakMap"),bt=Bt(Object,"create"),yt=It(ht),gt=It(lt),vt=It(ft),mt=It(dt),wt=It(pt),St=rt?rt.prototype:void 0,_t=St?St.valueOf:void 0;function Et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new kt;++e<r;)this.add(t[e])}function Tt(t){var e=this.__data__=new Ot(t);this.size=e.size}function At(t,e){for(var r=t.length;r--;)if(Ut(t[r][0],e))return r;return-1}function jt(t){return null==t?void 0===t?O:g:ot&&ot in Object(t)?function(t){var e=X.call(t,ot),r=t[ot];try{t[ot]=void 0;var n=!0}catch(t){}var i=Z.call(t);return n&&(e?t[ot]=r:delete t[ot]),i}(t):function(t){return Z.call(t)}(t)}function Rt(t){return Gt(t)&&jt(t)==a}function Ct(t,e,r,n,o){return t===e||(null==t||null==e||!Gt(t)&&!Gt(e)?t!=t&&e!=e:function(t,e,r,n,o,u){var d=qt(t),p=qt(e),g=d?c:zt(t),m=p?c:zt(e),w=(g=g==a?v:g)==v,O=(m=m==a?v:m)==v,k=g==m;if(k&&Vt(t)){if(!Vt(e))return!1;d=!0,w=!1}if(k&&!w)return u||(u=new Tt),d||Jt(t)?Lt(t,e,r,n,o,u):function(t,e,r,n,o,a,c){switch(r){case T:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!a(new nt(t),new nt(e)));case h:case l:case y:return Ut(+t,+e);case f:return t.name==e.name&&t.message==e.message;case S:case E:return t==e+"";case b:var u=M;case _:var d=n&i;if(u||(u=q),t.size!=e.size&&!d)return!1;var p=c.get(t);if(p)return p==e;n|=s,c.set(t,e);var g=Lt(u(t),u(e),n,o,a,c);return c.delete(t),g;case"[object Symbol]":if(_t)return _t.call(t)==_t.call(e)}return!1}(t,e,g,r,n,o,u);if(!(r&i)){var A=w&&X.call(t,"__wrapped__"),j=O&&X.call(e,"__wrapped__");if(A||j){var R=A?t.value():t,C=j?e.value():e;return u||(u=new Tt),o(R,C,r,n,u)}}return!!k&&(u||(u=new Tt),function(t,e,r,n,s,o){var a=r&i,c=Dt(t),u=c.length;if(u!=Dt(e).length&&!a)return!1;for(var h=u;h--;){var l=c[h];if(!(a?l in e:X.call(e,l)))return!1}var f=o.get(t);if(f&&o.get(e))return f==e;var d=!0;o.set(t,e),o.set(e,t);for(var p=a;++h<u;){var b=t[l=c[h]],y=e[l];if(n)var g=a?n(y,b,l,e,t,o):n(b,y,l,t,e,o);if(!(void 0===g?b===y||s(b,y,r,n,o):g)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var v=t.constructor,m=e.constructor;v==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof m&&m instanceof m||(d=!1)}return o.delete(t),o.delete(e),d}(t,e,r,n,o,u))}(t,e,r,n,Ct,o))}function Lt(t,e,r,n,o,a){var c=r&i,u=t.length,h=e.length;if(u!=h&&!(c&&h>u))return!1;var l=a.get(t);if(l&&a.get(e))return l==e;var f=-1,d=!0,p=r&s?new xt:void 0;for(a.set(t,e),a.set(e,t);++f<u;){var b=t[f],y=e[f];if(n)var g=c?n(y,b,f,e,t,a):n(b,y,f,t,e,a);if(void 0!==g){if(g)continue;d=!1;break}if(p){if(!U(e,(function(t,e){if(i=e,!p.has(i)&&(b===t||o(b,t,r,n,a)))return p.push(e);var i}))){d=!1;break}}else if(b!==y&&!o(b,y,r,n,a)){d=!1;break}}return a.delete(t),a.delete(e),d}function Dt(t){return function(t,e,r){var n=e(t);return qt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Kt,Ft)}function Pt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Bt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!$t(t)||function(t){return!!Q&&Q in t}(t))&&(Wt(t)?tt:A).test(It(t))}(r)?r:void 0}Et.prototype.clear=function(){this.__data__=bt?bt(null):{},this.size=0},Et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Et.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return X.call(e,t)?e[t]:void 0},Et.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:X.call(e,t)},Et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=bt&&void 0===e?n:e,this},Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(t){var e=this.__data__,r=At(e,t);return!(r<0||(r==e.length-1?e.pop():st.call(e,r,1),--this.size,0))},Ot.prototype.get=function(t){var e=this.__data__,r=At(e,t);return r<0?void 0:e[r][1]},Ot.prototype.has=function(t){return At(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var r=this.__data__,n=At(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},kt.prototype.clear=function(){this.size=0,this.__data__={hash:new Et,map:new(lt||Ot),string:new Et}},kt.prototype.delete=function(t){var e=Pt(this,t).delete(t);return this.size-=e?1:0,e},kt.prototype.get=function(t){return Pt(this,t).get(t)},kt.prototype.has=function(t){return Pt(this,t).has(t)},kt.prototype.set=function(t,e){var r=Pt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},xt.prototype.add=xt.prototype.push=function(t){return this.__data__.set(t,n),this},xt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.clear=function(){this.__data__=new Ot,this.size=0},Tt.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ot){var n=r.__data__;if(!lt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new kt(n)}return r.set(t,e),this.size=r.size,this};var Ft=at?function(t){return null==t?[]:(t=Object(t),function(e,r){for(var n=-1,i=null==e?0:e.length,s=0,o=[];++n<i;){var a=e[n];c=a,it.call(t,c)&&(o[s++]=a)}var c;return o}(at(t)))}:function(){return[]},zt=jt;function Nt(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||j.test(t))&&t>-1&&t%1==0&&t<e}function It(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ut(t,e){return t===e||t!=t&&e!=e}(ht&&zt(new ht(new ArrayBuffer(1)))!=T||lt&&zt(new lt)!=b||ft&&zt(ft.resolve())!=m||dt&&zt(new dt)!=_||pt&&zt(new pt)!=k)&&(zt=function(t){var e=jt(t),r=e==v?t.constructor:void 0,n=r?It(r):"";if(n)switch(n){case yt:return T;case gt:return b;case vt:return m;case mt:return _;case wt:return k}return e});var Mt=Rt(function(){return arguments}())?Rt:function(t){return Gt(t)&&X.call(t,"callee")&&!it.call(t,"callee")},qt=Array.isArray,Vt=ct||function(){return!1};function Wt(t){if(!$t(t))return!1;var e=jt(t);return e==d||e==p||e==u||e==w}function Ht(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}function $t(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Gt(t){return null!=t&&"object"==typeof t}var Jt=I?function(t){return function(e){return t(e)}}(I):function(t){return Gt(t)&&Ht(t.length)&&!!R[jt(t)]};function Kt(t){return null!=(e=t)&&Ht(e.length)&&!Wt(e)?function(t,e){var r=qt(t),n=!r&&Mt(t),i=!r&&!n&&Vt(t),s=!r&&!n&&!i&&Jt(t),o=r||n||i||s,a=o?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var u in t)!e&&!X.call(t,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Nt(u,c))||a.push(u);return a}(t):function(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||J))return ut(t);var e,r,n=[];for(var i in Object(t))X.call(t,i)&&"constructor"!=i&&n.push(i);return n}(t);var e}t.exports=function(t,e){return Ct(t,e)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={id:n,loaded:!1,exports:{}};return t[n](s,s.exports,r),s.loaded=!0,s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{r.d(n,{j:()=>Ns});var t={};r.r(t),r.d(t,{hasBrowserEnv:()=>ot,hasStandardBrowserEnv:()=>at,hasStandardBrowserWebWorkerEnv:()=>ut,origin:()=>ht});var e={};function i(t,e){return function(){return t.apply(e,arguments)}}r.r(e),r.d(e,{Decoder:()=>As,Encoder:()=>xs,PacketType:()=>ks,protocol:()=>Os});const{toString:s}=Object.prototype,{getPrototypeOf:o}=Object,a=(t=>e=>{const r=s.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),c=t=>(t=t.toLowerCase(),e=>a(e)===t),u=t=>e=>typeof e===t,{isArray:h}=Array,l=u("undefined"),f=c("ArrayBuffer"),d=u("string"),p=u("function"),b=u("number"),y=t=>null!==t&&"object"==typeof t,g=t=>{if("object"!==a(t))return!1;const e=o(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},v=c("Date"),m=c("File"),w=c("Blob"),S=c("FileList"),_=c("URLSearchParams"),[E,O,k,x]=["ReadableStream","Request","Response","Headers"].map(c);function T(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),h(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{const i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length;let o;for(n=0;n<s;n++)o=i[n],e.call(null,t[o],o,t)}}function A(t,e){e=e.toLowerCase();const r=Object.keys(t);let n,i=r.length;for(;i-- >0;)if(n=r[i],e===n.toLowerCase())return n;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,R=t=>!l(t)&&t!==j,C=(L="undefined"!=typeof Uint8Array&&o(Uint8Array),t=>L&&t instanceof L);var L;const D=c("HTMLFormElement"),P=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),B=c("RegExp"),F=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};T(r,((r,i)=>{let s;!1!==(s=e(r,i,t))&&(n[i]=s||r)})),Object.defineProperties(t,n)},z="abcdefghijklmnopqrstuvwxyz",N="0123456789",I={DIGIT:N,ALPHA:z,ALPHA_DIGIT:z+z.toUpperCase()+N},U=c("AsyncFunction"),M={isArray:h,isArrayBuffer:f,isBuffer:function(t){return null!==t&&!l(t)&&null!==t.constructor&&!l(t.constructor)&&p(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||p(t.append)&&("formdata"===(e=a(t))||"object"===e&&p(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&f(t.buffer),e},isString:d,isNumber:b,isBoolean:t=>!0===t||!1===t,isObject:y,isPlainObject:g,isReadableStream:E,isRequest:O,isResponse:k,isHeaders:x,isUndefined:l,isDate:v,isFile:m,isBlob:w,isRegExp:B,isFunction:p,isStream:t=>y(t)&&p(t.pipe),isURLSearchParams:_,isTypedArray:C,isFileList:S,forEach:T,merge:function t(){const{caseless:e}=R(this)&&this||{},r={},n=(n,i)=>{const s=e&&A(r,i)||i;g(r[s])&&g(n)?r[s]=t(r[s],n):g(n)?r[s]=t({},n):h(n)?r[s]=n.slice():r[s]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&T(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(T(e,((e,n)=>{r&&p(e)?t[n]=i(e,r):t[n]=e}),{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let i,s,a;const c={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],n&&!n(a,t,e)||c[a]||(e[a]=t[a],c[a]=!0);t=!1!==r&&o(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:a,kindOfTest:c,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(h(t))return t;let e=t.length;if(!b(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:D,hasOwnProperty:P,hasOwnProp:P,reduceDescriptors:F,freezeMethods:t=>{F(t,((e,r)=>{if(p(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];p(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach((t=>{r[t]=!0}))};return h(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:A,global:j,isContextDefined:R,ALPHABET:I,generateString:(t=16,e=I.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r},isSpecCompliantForm:function(t){return!!(t&&p(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(y(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[n]=t;const i=h(t)?[]:{};return T(t,((t,e)=>{const s=r(t,n+1);!l(s)&&(i[e]=s)})),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:U,isThenable:t=>t&&(y(t)||p(t))&&p(t.then)&&p(t.catch)};function q(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}M.inherits(q,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const V=q.prototype,W={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{W[t]={value:t}})),Object.defineProperties(q,W),Object.defineProperty(V,"isAxiosError",{value:!0}),q.from=(t,e,r,n,i,s)=>{const o=Object.create(V);return M.toFlatObject(t,o,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),q.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const H=q;function $(t){return M.isPlainObject(t)||M.isArray(t)}function G(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function J(t,e,r){return t?t.concat(e).map((function(t,e){return t=G(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const K=M.toFlatObject(M,{},null,(function(t){return/^is[A-Z]/.test(t)})),Y=function(t,e,r){if(!M.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=M.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!M.isUndefined(e[t])}))).metaTokens,i=r.visitor||u,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(M.isDate(t))return t.toISOString();if(!a&&M.isBlob(t))throw new H("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(t)||M.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,r,i){let a=t;if(t&&!i&&"object"==typeof t)if(M.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(M.isArray(t)&&function(t){return M.isArray(t)&&!t.some($)}(t)||(M.isFileList(t)||M.endsWith(r,"[]"))&&(a=M.toArray(t)))return r=G(r),a.forEach((function(t,n){!M.isUndefined(t)&&null!==t&&e.append(!0===o?J([r],n,s):null===o?r:r+"[]",c(t))})),!1;return!!$(t)||(e.append(J(i,r,s),c(t)),!1)}const h=[],l=Object.assign(K,{defaultVisitor:u,convertValue:c,isVisitable:$});if(!M.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!M.isUndefined(r)){if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),M.forEach(r,(function(r,s){!0===(!(M.isUndefined(r)||null===r)&&i.call(e,r,M.isString(s)?s.trim():s,n,l))&&t(r,n?n.concat(s):[s])})),h.pop()}}(t),e};function X(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function Q(t,e){this._pairs=[],t&&Y(t,this,e)}const Z=Q.prototype;Z.append=function(t,e){this._pairs.push([t,e])},Z.toString=function(t){const e=t?function(e){return t.call(this,e,X)}:X;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const tt=Q;function et(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rt(t,e,r){if(!e)return t;const n=r&&r.encode||et,i=r&&r.serialize;let s;if(s=i?i(e,r):M.isURLSearchParams(e)?e.toString():new tt(e,r).toString(n),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const nt=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){M.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},it={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},st={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ot="undefined"!=typeof window&&"undefined"!=typeof document,at=(ct="undefined"!=typeof navigator&&navigator.product,ot&&["ReactNative","NativeScript","NS"].indexOf(ct)<0);var ct;const ut="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ht=ot&&window.location.href||"http://localhost",lt={...t,...st},ft=function(t){function e(t,r,n,i){let s=t[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=t.length;return s=!s&&M.isArray(n)?n.length:s,a?(M.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o):(n[s]&&M.isObject(n[s])||(n[s]=[]),e(t,r,n[s],i)&&M.isArray(n[s])&&(n[s]=function(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],e[s]=t[s];return e}(n[s])),!o)}if(M.isFormData(t)&&M.isFunction(t.entries)){const r={};return M.forEachEntry(t,((t,n)=>{e(function(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),n,r,0)})),r}return null},dt={transitional:it,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=M.isObject(t);if(i&&M.isHTMLForm(t)&&(t=new FormData(t)),M.isFormData(t))return n?JSON.stringify(ft(t)):t;if(M.isArrayBuffer(t)||M.isBuffer(t)||M.isStream(t)||M.isFile(t)||M.isBlob(t)||M.isReadableStream(t))return t;if(M.isArrayBufferView(t))return t.buffer;if(M.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Y(t,new lt.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,n){return lt.isNode&&M.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((s=M.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Y(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t,e,r){if(M.isString(t))try{return(0,JSON.parse)(t),M.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||dt.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(M.isResponse(t)||M.isReadableStream(t))return t;if(t&&M.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw H.from(t,H.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lt.classes.FormData,Blob:lt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],(t=>{dt.headers[t]={}}));const pt=dt,bt=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),yt=Symbol("internals");function gt(t){return t&&String(t).trim().toLowerCase()}function vt(t){return!1===t||null==t?t:M.isArray(t)?t.map(vt):String(t)}function mt(t,e,r,n,i){return M.isFunction(n)?n.call(this,e,r):(i&&(e=r),M.isString(e)?M.isString(n)?-1!==e.indexOf(n):M.isRegExp(n)?n.test(e):void 0:void 0)}class wt{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=gt(e);if(!i)throw new Error("header name must be a non-empty string");const s=M.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||e]=vt(t))}const s=(t,e)=>M.forEach(t,((t,r)=>i(t,r,e)));if(M.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(M.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))s((t=>{const e={};let r,n,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),r=t.substring(0,i).trim().toLowerCase(),n=t.substring(i+1).trim(),!r||e[r]&&bt[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)})),e})(t),e);else if(M.isHeaders(t))for(const[e,n]of t.entries())i(n,e,r);else null!=t&&i(e,t,r);return this}get(t,e){if(t=gt(t)){const r=M.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if(M.isFunction(e))return e.call(this,t,r);if(M.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=gt(t)){const r=M.findKey(this,t);return!(!r||void 0===this[r]||e&&!mt(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=gt(t)){const i=M.findKey(r,t);!i||e&&!mt(0,r[i],i,e)||(delete r[i],n=!0)}}return M.isArray(t)?t.forEach(i):i(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const i=e[r];t&&!mt(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return M.forEach(this,((n,i)=>{const s=M.findKey(r,i);if(s)return e[s]=vt(n),void delete e[i];const o=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete e[i],e[o]=vt(n),r[o]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return M.forEach(this,((r,n)=>{null!=r&&!1!==r&&(e[n]=t&&M.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[yt]=this[yt]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=gt(t);e[n]||(function(t,e){const r=M.toCamelCase(" "+e);["get","set","has"].forEach((n=>{Object.defineProperty(t,n+r,{value:function(t,r,i){return this[n].call(this,e,t,r,i)},configurable:!0})}))}(r,t),e[n]=!0)}return M.isArray(t)?t.forEach(n):n(t),this}}wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),M.reduceDescriptors(wt.prototype,(({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}})),M.freezeMethods(wt);const St=wt;function _t(t,e){const r=this||pt,n=e||r,i=St.from(n.headers);let s=n.data;return M.forEach(t,(function(t){s=t.call(r,s,i.normalize(),e?e.status:void 0)})),i.normalize(),s}function Et(t){return!(!t||!t.__CANCEL__)}function Ot(t,e,r){H.call(this,null==t?"canceled":t,H.ERR_CANCELED,e,r),this.name="CanceledError"}M.inherits(Ot,H,{__CANCEL__:!0});const kt=Ot;function xt(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new H("Request failed with status code "+r.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}const Tt=(t,e,r=3)=>{let n=0;const i=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i,s=0,o=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),u=n[o];i||(i=c),r[s]=a,n[s]=c;let h=o,l=0;for(;h!==s;)l+=r[h++],h%=t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),c-i<e)return;const f=u&&c-u;return f?Math.round(1e3*l/f):void 0}}(50,250);return function(t,e){let r=0;const n=1e3/e;let i=null;return function(){const e=!0===this,s=Date.now();if(e||s-r>n)return i&&(clearTimeout(i),i=null),r=s,t.apply(null,arguments);i||(i=setTimeout((()=>(i=null,r=Date.now(),t.apply(null,arguments))),n-(s-r)))}}((r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,c=i(a);n=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r,lengthComputable:null!=o};u[e?"download":"upload"]=!0,t(u)}),r)},At=lt.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let r;function n(r){let n=r;return t&&(e.setAttribute("href",n),n=e.href),e.setAttribute("href",n),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=n(window.location.href),function(t){const e=M.isString(t)?n(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0},jt=lt.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];M.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),M.isString(n)&&o.push("path="+n),M.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Rt(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Ct=t=>t instanceof St?{...t}:t;function Lt(t,e){e=e||{};const r={};function n(t,e,r){return M.isPlainObject(t)&&M.isPlainObject(e)?M.merge.call({caseless:r},t,e):M.isPlainObject(e)?M.merge({},e):M.isArray(e)?e.slice():e}function i(t,e,r){return M.isUndefined(e)?M.isUndefined(t)?void 0:n(void 0,t,r):n(t,e,r)}function s(t,e){if(!M.isUndefined(e))return n(void 0,e)}function o(t,e){return M.isUndefined(e)?M.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function a(r,i,s){return s in e?n(r,i):s in t?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(t,e)=>i(Ct(t),Ct(e),!0)};return M.forEach(Object.keys(Object.assign({},t,e)),(function(n){const s=c[n]||i,o=s(t[n],e[n],n);M.isUndefined(o)&&s!==a||(r[n]=o)})),r}const Dt=t=>{const e=Lt({},t);let r,{data:n,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=e;if(e.headers=a=St.from(a),e.url=rt(Rt(e.baseURL,e.url),t.params,t.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),M.isFormData(n))if(lt.hasStandardBrowserEnv||lt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[t,...e]=r?r.split(";").map((t=>t.trim())).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(lt.hasStandardBrowserEnv&&(i&&M.isFunction(i)&&(i=i(e)),i||!1!==i&&At(e.url))){const t=s&&o&&jt.read(o);t&&a.set(s,t)}return e},Pt="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){const n=Dt(t);let i=n.data;const s=St.from(n.headers).normalize();let o,{responseType:a}=n;function c(){n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let u=new XMLHttpRequest;function h(){if(!u)return;const n=St.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());xt((function(t){e(t),c()}),(function(t){r(t),c()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:t,request:u}),u=null}u.open(n.method.toUpperCase(),n.url,!0),u.timeout=n.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(r(new H("Request aborted",H.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new H("Network Error",H.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const e=n.transitional||it;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new H(t,e.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,n,u)),u=null},void 0===i&&s.setContentType(null),"setRequestHeader"in u&&M.forEach(s.toJSON(),(function(t,e){u.setRequestHeader(e,t)})),M.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),a&&"json"!==a&&(u.responseType=n.responseType),"function"==typeof n.onDownloadProgress&&u.addEventListener("progress",Tt(n.onDownloadProgress,!0)),"function"==typeof n.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Tt(n.onUploadProgress)),(n.cancelToken||n.signal)&&(o=e=>{u&&(r(!e||e.type?new kt(null,t,u):e),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const l=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(n.url);l&&-1===lt.protocols.indexOf(l)?r(new H("Unsupported protocol "+l+":",H.ERR_BAD_REQUEST,t)):u.send(i||null)}))},Bt=(t,e)=>{let r,n=new AbortController;const i=function(t){if(!r){r=!0,o();const e=t instanceof Error?t:this.reason;n.abort(e instanceof H?e:new kt(e instanceof Error?e.message:e))}};let s=e&&setTimeout((()=>{i(new H(`timeout ${e} of ms exceeded`,H.ETIMEDOUT))}),e);const o=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach((t=>{t&&(t.removeEventListener?t.removeEventListener("abort",i):t.unsubscribe(i))})),t=null)};t.forEach((t=>t&&t.addEventListener&&t.addEventListener("abort",i)));const{signal:a}=n;return a.unsubscribe=o,[a,()=>{s&&clearTimeout(s),s=null}]},Ft=function*(t,e){let r=t.byteLength;if(!e||r<e)return void(yield t);let n,i=0;for(;i<r;)n=i+e,yield t.slice(i,n),i=n},zt=(t,e,r,n,i)=>{const s=async function*(t,e,r){for await(const n of t)yield*Ft(ArrayBuffer.isView(n)?n:await r(String(n)),e)}(t,e,i);let o=0;return new ReadableStream({type:"bytes",async pull(t){const{done:e,value:i}=await s.next();if(e)return t.close(),void n();let a=i.byteLength;r&&r(o+=a),t.enqueue(new Uint8Array(i))},cancel:t=>(n(t),s.return())},{highWaterMark:2})},Nt=(t,e)=>{const r=null!=t;return n=>setTimeout((()=>e({lengthComputable:r,total:t,loaded:n})))},It="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ut=It&&"function"==typeof ReadableStream,Mt=It&&("function"==typeof TextEncoder?(qt=new TextEncoder,t=>qt.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var qt;const Vt=Ut&&(()=>{let t=!1;const e=new Request(lt.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})(),Wt=Ut&&!!(()=>{try{return M.isReadableStream(new Response("").body)}catch(t){}})(),Ht={stream:Wt&&(t=>t.body)};var $t;It&&($t=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!Ht[t]&&(Ht[t]=M.isFunction($t[t])?e=>e[t]():(e,r)=>{throw new H(`Response type '${t}' is not supported`,H.ERR_NOT_SUPPORT,r)})})));const Gt=It&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:h,withCredentials:l="same-origin",fetchOptions:f}=Dt(t);u=u?(u+"").toLowerCase():"text";let d,p,[b,y]=i||s||o?Bt([i,s],o):[];const g=()=>{!d&&setTimeout((()=>{b&&b.unsubscribe()})),d=!0};let v;try{if(c&&Vt&&"get"!==r&&"head"!==r&&0!==(v=await(async(t,e)=>{const r=M.toFiniteNumber(t.getContentLength());return null==r?(async t=>null==t?0:M.isBlob(t)?t.size:M.isSpecCompliantForm(t)?(await new Request(t).arrayBuffer()).byteLength:M.isArrayBufferView(t)?t.byteLength:(M.isURLSearchParams(t)&&(t+=""),M.isString(t)?(await Mt(t)).byteLength:void 0))(e):r})(h,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});M.isFormData(n)&&(t=r.headers.get("content-type"))&&h.setContentType(t),r.body&&(n=zt(r.body,65536,Nt(v,Tt(c)),null,Mt))}M.isString(l)||(l=l?"cors":"omit"),p=new Request(e,{...f,signal:b,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",withCredentials:l});let i=await fetch(p);const s=Wt&&("stream"===u||"response"===u);if(Wt&&(a||s)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=i[e]}));const e=M.toFiniteNumber(i.headers.get("content-length"));i=new Response(zt(i.body,65536,a&&Nt(e,Tt(a,!0)),s&&g,Mt),t)}u=u||"text";let o=await Ht[M.findKey(Ht,u)||"text"](i,t);return!s&&g(),y&&y(),await new Promise(((e,r)=>{xt(e,r,{data:o,headers:St.from(i.headers),status:i.status,statusText:i.statusText,config:t,request:p})}))}catch(e){if(g(),e&&"TypeError"===e.name&&/fetch/i.test(e.message))throw Object.assign(new H("Network Error",H.ERR_NETWORK,t,p),{cause:e.cause||e});throw H.from(e,e&&e.code,t,p)}}),Jt={http:null,xhr:Pt,fetch:Gt};M.forEach(Jt,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const Kt=t=>`- ${t}`,Yt=t=>M.isFunction(t)||null===t||!1===t,Xt=t=>{t=M.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s<e;s++){let e;if(r=t[s],n=r,!Yt(r)&&(n=Jt[(e=String(r)).toLowerCase()],void 0===n))throw new H(`Unknown adapter '${e}'`);if(n)break;i[e||"#"+s]=n}if(!n){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let r=e?t.length>1?"since :\n"+t.map(Kt).join("\n"):" "+Kt(t[0]):"as no adapter specified";throw new H("There is no suitable adapter to dispatch the request "+r,"ERR_NOT_SUPPORT")}return n};function Qt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kt(null,t)}function Zt(t){return Qt(t),t.headers=St.from(t.headers),t.data=_t.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Xt(t.adapter||pt.adapter)(t).then((function(e){return Qt(t),e.data=_t.call(t,t.transformResponse,e),e.headers=St.from(e.headers),e}),(function(e){return Et(e)||(Qt(t),e&&e.response&&(e.response.data=_t.call(t,t.transformResponse,e.response),e.response.headers=St.from(e.response.headers))),Promise.reject(e)}))}const te={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{te[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const ee={};te.transitional=function(t,e,r){function n(t,e){return"[Axios v1.7.2] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,s)=>{if(!1===t)throw new H(n(i," has been removed"+(e?" in "+e:"")),H.ERR_DEPRECATED);return e&&!ee[i]&&(ee[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,s)}};const re={assertOptions:function(t,e,r){if("object"!=typeof t)throw new H("options must be an object",H.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const e=t[s],r=void 0===e||o(e,s,t);if(!0!==r)throw new H("option "+s+" must be "+r,H.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new H("Unknown option "+s,H.ERR_BAD_OPTION)}},validators:te},ne=re.validators;class ie{constructor(t){this.defaults=t,this.interceptors={request:new nt,response:new nt}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Lt(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&re.assertOptions(r,{silentJSONParsing:ne.transitional(ne.boolean),forcedJSONParsing:ne.transitional(ne.boolean),clarifyTimeoutError:ne.transitional(ne.boolean)},!1),null!=n&&(M.isFunction(n)?e.paramsSerializer={serialize:n}:re.assertOptions(n,{encode:ne.function,serialize:ne.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=i&&M.merge(i.common,i[e.method]);i&&M.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=St.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,o.unshift(t.fulfilled,t.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let h,l=0;if(!a){const t=[Zt.bind(this),void 0];for(t.unshift.apply(t,o),t.push.apply(t,c),h=t.length,u=Promise.resolve(e);l<h;)u=u.then(t[l++],t[l++]);return u}h=o.length;let f=e;for(l=0;l<h;){const t=o[l++],e=o[l++];try{f=t(f)}catch(t){e.call(this,t);break}}try{u=Zt.call(this,f)}catch(t){return Promise.reject(t)}for(l=0,h=c.length;l<h;)u=u.then(c[l++],c[l++]);return u}getUri(t){return rt(Rt((t=Lt(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}M.forEach(["delete","get","head","options"],(function(t){ie.prototype[t]=function(e,r){return this.request(Lt(r||{},{method:t,url:e,data:(r||{}).data}))}})),M.forEach(["post","put","patch"],(function(t){function e(e){return function(r,n,i){return this.request(Lt(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ie.prototype[t]=e(),ie.prototype[t+"Form"]=e(!0)}));const se=ie;class oe{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const n=new Promise((t=>{r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t,n,i){r.reason||(r.reason=new kt(t,n,i),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;return{token:new oe((function(e){t=e})),cancel:t}}}const ae=oe,ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ce).forEach((([t,e])=>{ce[e]=t}));const ue=ce,he=function t(e){const r=new se(e),n=i(se.prototype.request,r);return M.extend(n,se.prototype,r,{allOwnKeys:!0}),M.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Lt(e,r))},n}(pt);he.Axios=se,he.CanceledError=kt,he.CancelToken=ae,he.isCancel=Et,he.VERSION="1.7.2",he.toFormData=Y,he.AxiosError=H,he.Cancel=he.CanceledError,he.all=function(t){return Promise.all(t)},he.spread=function(t){return function(e){return t.apply(null,e)}},he.isAxiosError=function(t){return M.isObject(t)&&!0===t.isAxiosError},he.mergeConfig=Lt,he.AxiosHeaders=St,he.formToJSON=t=>ft(M.isHTMLForm(t)?new FormData(t):t),he.getAdapter=Xt,he.HttpStatusCode=ue,he.default=he;const le=he;class fe{interceptor;constructor(t){this.interceptor=le.create({baseURL:`${t}/api`}),this.interceptor.interceptors.request.use((t=>{const e=le.CancelToken.source();return t.cancelToken=e.token,setTimeout((()=>{e.cancel("Timeout: request took more than 15 seconds")}),15e3),t}),(t=>Promise.reject(t)))}}var de=r(275),pe=r.n(de),be=r(512),ye=r.n(be);const ge="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ve=new Set,me="object"==typeof process&&process?process:{},we=(t,e,r,n)=>{"function"==typeof me.emitWarning?me.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)};let Se=globalThis.AbortController,_e=globalThis.AbortSignal;if(void 0===Se){_e=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},Se=class{constructor(){e()}signal=new _e;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=!0;for(const e of this.signal._onabort)e(t);this.signal.onabort?.(t)}}};let t="1"!==me.env?.LRU_CACHE_IGNORE_AC_WARNING;const e=()=>{t&&(t=!1,we("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}Symbol("type");const Ee=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Oe=t=>Ee(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ke:null:null;class ke extends Array{constructor(t){super(t),this.fill(0)}}class xe{heap;length;static#t=!1;static create(t){const e=Oe(t);if(!e)return[];xe.#t=!0;const r=new xe(t,e);return xe.#t=!1,r}constructor(t,e){if(!xe.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class Te{#e;#r;#n;#i;#s;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#a;#c;#u;#h;#l;#f;#d;#p;#b;#y;#g;#v;#m;#w;#S;#_;static unsafeExposeInternals(t){return{starts:t.#v,ttls:t.#m,sizes:t.#g,keyMap:t.#c,keyList:t.#u,valList:t.#h,next:t.#l,prev:t.#f,get head(){return t.#d},get tail(){return t.#p},free:t.#b,isBackgroundFetch:e=>t.#E(e),backgroundFetch:(e,r,n,i)=>t.#O(e,r,n,i),moveToTail:e=>t.#k(e),indexes:e=>t.#x(e),rindexes:e=>t.#T(e),isStale:e=>t.#A(e)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#a}get size(){return this.#o}get fetchMethod(){return this.#s}get dispose(){return this.#n}get disposeAfter(){return this.#i}constructor(t){const{max:e=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:a,dispose:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:l,maxSize:f=0,maxEntrySize:d=0,sizeCalculation:p,fetchMethod:b,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:g,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:m,ignoreFetchAbort:w}=t;if(0!==e&&!Ee(e))throw new TypeError("max option must be a nonnegative integer");const S=e?Oe(e):Array;if(!S)throw new Error("invalid max value: "+e);if(this.#e=e,this.#r=f,this.maxEntrySize=d||this.#r,this.sizeCalculation=p,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==b&&"function"!=typeof b)throw new TypeError("fetchMethod must be a function if specified");if(this.#s=b,this.#S=!!b,this.#c=new Map,this.#u=new Array(e).fill(void 0),this.#h=new Array(e).fill(void 0),this.#l=new S(e),this.#f=new S(e),this.#d=0,this.#p=0,this.#b=xe.create(e),this.#o=0,this.#a=0,"function"==typeof c&&(this.#n=c),"function"==typeof u?(this.#i=u,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#w=!!this.#n,this.#_=!!this.#i,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!l,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!m,this.ignoreFetchAbort=!!w,0!==this.maxEntrySize){if(0!==this.#r&&!Ee(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ee(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#j()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!g,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ee(n)||0===n?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!Ee(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(0===this.#e&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){const t="LRU_CACHE_UNBOUNDED";(t=>!ve.has(t))(t)&&(ve.add(t),we("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,Te))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#R(){const t=new ke(this.#e),e=new ke(this.#e);this.#m=t,this.#v=e,this.#C=(r,n,i=ge.now())=>{if(e[r]=0!==n?i:0,t[r]=n,0!==n&&this.ttlAutopurge){const t=setTimeout((()=>{this.#A(r)&&this.delete(this.#u[r])}),n+1);t.unref&&t.unref()}},this.#L=r=>{e[r]=0!==t[r]?ge.now():0},this.#D=(i,s)=>{if(t[s]){const o=t[s],a=e[s];if(!o||!a)return;i.ttl=o,i.start=a,i.now=r||n();const c=i.now-a;i.remainingTTL=o-c}};let r=0;const n=()=>{const t=ge.now();if(this.ttlResolution>0){r=t;const e=setTimeout((()=>r=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{const s=this.#c.get(i);if(void 0===s)return 0;const o=t[s],a=e[s];return o&&a?o-((r||n())-a):1/0},this.#A=i=>{const s=e[i],o=t[i];return!!o&&!!s&&(r||n())-s>o}}#L=()=>{};#D=()=>{};#C=()=>{};#A=()=>!1;#j(){const t=new ke(this.#e);this.#a=0,this.#g=t,this.#P=e=>{this.#a-=t[e],t[e]=0},this.#B=(t,e,r,n)=>{if(this.#E(e))return 0;if(!Ee(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(e,t),!Ee(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#F=(e,r,n)=>{if(t[e]=r,this.#r){const r=this.#r-t[e];for(;this.#a>r;)this.#z(!0)}this.#a+=t[e],n&&(n.entrySize=r,n.totalCalculatedSize=this.#a)}}#P=t=>{};#F=(t,e,r)=>{};#B=(t,e,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:t=this.allowStale}={}){if(this.#o)for(let e=this.#p;this.#N(e)&&(!t&&this.#A(e)||(yield e),e!==this.#d);)e=this.#f[e]}*#T({allowStale:t=this.allowStale}={}){if(this.#o)for(let e=this.#d;this.#N(e)&&(!t&&this.#A(e)||(yield e),e!==this.#p);)e=this.#l[e]}#N(t){return void 0!==t&&this.#c.get(this.#u[t])===t}*entries(){for(const t of this.#x())void 0===this.#h[t]||void 0===this.#u[t]||this.#E(this.#h[t])||(yield[this.#u[t],this.#h[t]])}*rentries(){for(const t of this.#T())void 0===this.#h[t]||void 0===this.#u[t]||this.#E(this.#h[t])||(yield[this.#u[t],this.#h[t]])}*keys(){for(const t of this.#x()){const e=this.#u[t];void 0===e||this.#E(this.#h[t])||(yield e)}}*rkeys(){for(const t of this.#T()){const e=this.#u[t];void 0===e||this.#E(this.#h[t])||(yield e)}}*values(){for(const t of this.#x())void 0===this.#h[t]||this.#E(this.#h[t])||(yield this.#h[t])}*rvalues(){for(const t of this.#T())void 0===this.#h[t]||this.#E(this.#h[t])||(yield this.#h[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const r of this.#x()){const n=this.#h[r],i=this.#E(n)?n.__staleWhileFetching:n;if(void 0!==i&&t(i,this.#u[r],this))return this.get(this.#u[r],e)}}forEach(t,e=this){for(const r of this.#x()){const n=this.#h[r],i=this.#E(n)?n.__staleWhileFetching:n;void 0!==i&&t.call(e,i,this.#u[r],this)}}rforEach(t,e=this){for(const r of this.#T()){const n=this.#h[r],i=this.#E(n)?n.__staleWhileFetching:n;void 0!==i&&t.call(e,i,this.#u[r],this)}}purgeStale(){let t=!1;for(const e of this.#T({allowStale:!0}))this.#A(e)&&(this.delete(this.#u[e]),t=!0);return t}info(t){const e=this.#c.get(t);if(void 0===e)return;const r=this.#h[e],n=this.#E(r)?r.__staleWhileFetching:r;if(void 0===n)return;const i={value:n};if(this.#m&&this.#v){const t=this.#m[e],r=this.#v[e];if(t&&r){const e=t-(ge.now()-r);i.ttl=e,i.start=Date.now()}}return this.#g&&(i.size=this.#g[e]),i}dump(){const t=[];for(const e of this.#x({allowStale:!0})){const r=this.#u[e],n=this.#h[e],i=this.#E(n)?n.__staleWhileFetching:n;if(void 0===i||void 0===r)continue;const s={value:i};if(this.#m&&this.#v){s.ttl=this.#m[e];const t=ge.now()-this.#v[e];s.start=Math.floor(Date.now()-t)}this.#g&&(s.size=this.#g[e]),t.unshift([r,s])}return t}load(t){this.clear();for(const[e,r]of t){if(r.start){const t=Date.now()-r.start;r.start=ge.now()-t}this.set(e,r.value,r)}}set(t,e,r={}){if(void 0===e)return this.delete(t),this;const{ttl:n=this.ttl,start:i,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const u=this.#B(t,e,r.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.delete(t),this;let h=0===this.#o?void 0:this.#c.get(t);if(void 0===h)h=0===this.#o?this.#p:0!==this.#b.length?this.#b.pop():this.#o===this.#e?this.#z(!1):this.#o,this.#u[h]=t,this.#h[h]=e,this.#c.set(t,h),this.#l[this.#p]=h,this.#f[h]=this.#p,this.#p=h,this.#o++,this.#F(h,u,a),a&&(a.set="add"),c=!1;else{this.#k(h);const r=this.#h[h];if(e!==r){if(this.#S&&this.#E(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=r;void 0===e||s||(this.#w&&this.#n?.(e,t,"set"),this.#_&&this.#y?.push([e,t,"set"]))}else s||(this.#w&&this.#n?.(r,t,"set"),this.#_&&this.#y?.push([r,t,"set"]));if(this.#P(h),this.#F(h,u,a),this.#h[h]=e,a){a.set="replace";const t=r&&this.#E(r)?r.__staleWhileFetching:r;void 0!==t&&(a.oldValue=t)}}else a&&(a.set="update")}if(0===n||this.#m||this.#R(),this.#m&&(c||this.#C(h,n,i),a&&this.#D(a,h)),!s&&this.#_&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}return this}pop(){try{for(;this.#o;){const t=this.#h[this.#d];if(this.#z(!0),this.#E(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#_&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}}}#z(t){const e=this.#d,r=this.#u[e],n=this.#h[e];return this.#S&&this.#E(n)?n.__abortController.abort(new Error("evicted")):(this.#w||this.#_)&&(this.#w&&this.#n?.(n,r,"evict"),this.#_&&this.#y?.push([n,r,"evict"])),this.#P(e),t&&(this.#u[e]=void 0,this.#h[e]=void 0,this.#b.push(e)),1===this.#o?(this.#d=this.#p=0,this.#b.length=0):this.#d=this.#l[e],this.#c.delete(r),this.#o--,e}has(t,e={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=e,i=this.#c.get(t);if(void 0!==i){const t=this.#h[i];if(this.#E(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#A(i))return r&&this.#L(i),n&&(n.has="hit",this.#D(n,i)),!0;n&&(n.has="stale",this.#D(n,i))}else n&&(n.has="miss");return!1}peek(t,e={}){const{allowStale:r=this.allowStale}=e,n=this.#c.get(t);if(void 0===n||!r&&this.#A(n))return;const i=this.#h[n];return this.#E(i)?i.__staleWhileFetching:i}#O(t,e,r,n){const i=void 0===e?void 0:this.#h[e];if(this.#E(i))return i;const s=new Se,{signal:o}=r;o?.addEventListener("abort",(()=>s.abort(o.reason)),{signal:s.signal});const a={signal:s.signal,options:r,context:n},c=(n,i=!1)=>{const{aborted:o}=s.signal,c=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!i?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,c&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!c&&!i)return u(s.signal.reason);const l=h;return this.#h[e]===h&&(void 0===n?l.__staleWhileFetching?this.#h[e]=l.__staleWhileFetching:this.delete(t):(r.status&&(r.status.fetchUpdated=!0),this.set(t,n,a.options))),n},u=n=>{const{aborted:i}=s.signal,o=i&&r.allowStaleOnFetchAbort,a=o||r.allowStaleOnFetchRejection,c=a||r.noDeleteOnFetchRejection,u=h;if(this.#h[e]===h&&(c&&void 0!==u.__staleWhileFetching?o||(this.#h[e]=u.__staleWhileFetching):this.delete(t)),a)return r.status&&void 0!==u.__staleWhileFetching&&(r.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw n};r.status&&(r.status.fetchDispatched=!0);const h=new Promise(((e,n)=>{const o=this.#s?.(t,i,a);o&&o instanceof Promise&&o.then((t=>e(void 0===t?void 0:t)),n),s.signal.addEventListener("abort",(()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(e(void 0),r.allowStaleOnFetchAbort&&(e=t=>c(t,!0)))}))})).then(c,(t=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=t),u(t)))),l=Object.assign(h,{__abortController:s,__staleWhileFetching:i,__returned:void 0});return void 0===e?(this.set(t,l,{...a.options,status:void 0}),e=this.#c.get(t)):this.#h[e]=l,l}#E(t){if(!this.#S)return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Se}async fetch(t,e={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:l=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:p,forceRefresh:b=!1,status:y,signal:g}=e;if(!this.#S)return y&&(y.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:y});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:s,noDisposeOnSet:o,size:a,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:l,allowStaleOnFetchAbort:d,ignoreFetchAbort:f,status:y,signal:g};let m=this.#c.get(t);if(void 0===m){y&&(y.fetch="miss");const e=this.#O(t,m,v,p);return e.__returned=e}{const e=this.#h[m];if(this.#E(e)){const t=r&&void 0!==e.__staleWhileFetching;return y&&(y.fetch="inflight",t&&(y.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}const i=this.#A(m);if(!b&&!i)return y&&(y.fetch="hit"),this.#k(m),n&&this.#L(m),y&&this.#D(y,m),e;const s=this.#O(t,m,v,p),o=void 0!==s.__staleWhileFetching&&r;return y&&(y.fetch=i?"stale":"refresh",o&&i&&(y.returnedStale=!0)),o?s.__staleWhileFetching:s.__returned=s}}get(t,e={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:s}=e,o=this.#c.get(t);if(void 0!==o){const e=this.#h[o],a=this.#E(e);return s&&this.#D(s,o),this.#A(o)?(s&&(s.get="stale"),a?(s&&r&&void 0!==e.__staleWhileFetching&&(s.returnedStale=!0),r?e.__staleWhileFetching:void 0):(i||this.delete(t),s&&r&&(s.returnedStale=!0),r?e:void 0)):(s&&(s.get="hit"),a?e.__staleWhileFetching:(this.#k(o),n&&this.#L(o),e))}s&&(s.get="miss")}#I(t,e){this.#f[e]=t,this.#l[t]=e}#k(t){t!==this.#p&&(t===this.#d?this.#d=this.#l[t]:this.#I(this.#f[t],this.#l[t]),this.#I(this.#p,t),this.#p=t)}delete(t){let e=!1;if(0!==this.#o){const r=this.#c.get(t);if(void 0!==r)if(e=!0,1===this.#o)this.clear();else{this.#P(r);const e=this.#h[r];if(this.#E(e)?e.__abortController.abort(new Error("deleted")):(this.#w||this.#_)&&(this.#w&&this.#n?.(e,t,"delete"),this.#_&&this.#y?.push([e,t,"delete"])),this.#c.delete(t),this.#u[r]=void 0,this.#h[r]=void 0,r===this.#p)this.#p=this.#f[r];else if(r===this.#d)this.#d=this.#l[r];else{const t=this.#f[r];this.#l[t]=this.#l[r];const e=this.#l[r];this.#f[e]=this.#f[r]}this.#o--,this.#b.push(r)}}if(this.#_&&this.#y?.length){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}return e}clear(){for(const t of this.#T({allowStale:!0})){const e=this.#h[t];if(this.#E(e))e.__abortController.abort(new Error("deleted"));else{const r=this.#u[t];this.#w&&this.#n?.(e,r,"delete"),this.#_&&this.#y?.push([e,r,"delete"])}}if(this.#c.clear(),this.#h.fill(void 0),this.#u.fill(void 0),this.#m&&this.#v&&(this.#m.fill(0),this.#v.fill(0)),this.#g&&this.#g.fill(0),this.#d=0,this.#p=0,this.#b.length=0,this.#a=0,this.#o=0,this.#_&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#i?.(...e)}}}var Ae=function(t,e){return Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ae(t,e)};function je(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ae(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Re(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Ce(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Le(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function De(t,e,r){if(r||2===arguments.length)for(var n,i=0,s=e.length;i<s;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function Pe(t){return this instanceof Pe?(this.v=t,this):new Pe(t)}function Be(t){return"function"==typeof t}function Fe(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var ze=Fe((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function Ne(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Ie=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=Ce(s),a=o.next();!a.done;a=o.next())a.value.remove(this)}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if(Be(c))try{c()}catch(t){i=t instanceof ze?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=Ce(u),l=h.next();!l.done;l=h.next()){var f=l.value;try{qe(f)}catch(t){i=null!=i?i:[],t instanceof ze?i=De(De([],Le(i)),Le(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(i)throw new ze(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)qe(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Ne(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&Ne(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Ue=Ie.EMPTY;function Me(t){return t instanceof Ie||t&&"closed"in t&&Be(t.remove)&&Be(t.add)&&Be(t.unsubscribe)}function qe(t){Be(t)?t():t.unsubscribe()}var Ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},We={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=We.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,De([t,e],Le(r))):setTimeout.apply(void 0,De([t,e],Le(r)))},clearTimeout:function(t){var e=We.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function He(t){We.setTimeout((function(){var e=Ve.onUnhandledError;if(!e)throw t;e(t)}))}function $e(){}var Ge=Je("C",void 0,void 0);function Je(t,e,r){return{kind:t,value:e,error:r}}var Ke=null;function Ye(t){if(Ve.useDeprecatedSynchronousErrorHandling){var e=!Ke;if(e&&(Ke={errorThrown:!1,error:null}),t(),e){var r=Ke,n=r.errorThrown,i=r.error;if(Ke=null,n)throw i}}else t()}var Xe=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,Me(e)&&e.add(r)):r.destination=ir,r}return je(e,t),e.create=function(t,e,r){return new er(t,e,r)},e.prototype.next=function(t){this.isStopped?nr(function(t){return Je("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?nr(Je("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?nr(Ge,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Ie),Qe=Function.prototype.bind;function Ze(t,e){return Qe.call(t,e)}var tr=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){rr(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){rr(t)}else rr(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){rr(t)}},t}(),er=function(t){function e(e,r,n){var i,s,o=t.call(this)||this;return Be(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:o&&Ve.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return o.unsubscribe()},i={next:e.next&&Ze(e.next,s),error:e.error&&Ze(e.error,s),complete:e.complete&&Ze(e.complete,s)}):i=e,o.destination=new tr(i),o}return je(e,t),e}(Xe);function rr(t){var e;Ve.useDeprecatedSynchronousErrorHandling?(e=t,Ve.useDeprecatedSynchronousErrorHandling&&Ke&&(Ke.errorThrown=!0,Ke.error=e)):He(t)}function nr(t,e){var r=Ve.onStoppedNotification;r&&We.setTimeout((function(){return r(t,e)}))}var ir={closed:!0,next:$e,error:function(t){throw t},complete:$e},sr="function"==typeof Symbol&&Symbol.observable||"@@observable";function or(t){return t}var ar=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this,i=function(t){return t&&t instanceof Xe||function(t){return t&&Be(t.next)&&Be(t.error)&&Be(t.complete)}(t)&&Me(t)}(t)?t:new er(t,e,r);return Ye((function(){var t=n,e=t.operator,r=t.source;i.add(e?e.call(i,r):r?n._subscribe(i):n._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=cr(e))((function(e,n){var i=new er({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[sr]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(r=t).length?or:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=cr(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function cr(t){var e;return null!==(e=null!=t?t:Ve.Promise)&&void 0!==e?e:Promise}var ur=Fe((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),hr=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return je(e,t),e.prototype.lift=function(t){var e=new lr(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new ur},e.prototype.next=function(t){var e=this;Ye((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=Ce(e.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(t)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;Ye((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;Ye((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,s=r.observers;return n||i?Ue:(this.currentObservers=null,s.push(t),new Ie((function(){e.currentObservers=null,Ne(s,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new ar;return t.source=this,t},e.create=function(t,e){return new lr(t,e)},e}(ar),lr=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return je(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:Ue},e}(hr),fr=function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}return je(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(hr),dr={now:function(){return(dr.delegate||Date).now()},delegate:void 0},pr=function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=dr);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}return je(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,o=r._timestampProvider,a=r._windowTime;n||(i.push(e),!s&&i.push(o.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,s=(i?1:2)*e;if(e<1/0&&s<n.length&&n.splice(0,n.length-s),!i){for(var o=r.now(),a=0,c=1;c<n.length&&n[c]<=o;c+=2)a=c;a&&n.splice(0,a+1)}},e}(hr);function br(t){return function(e){if(function(t){return Be(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function yr(t,e,r,n,i){return new gr(t,e,r,n,i)}var gr=function(t){function e(e,r,n,i,s,o){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return je(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(Xe);function vr(){return br((function(t,e){var r,n=!1;t.subscribe(yr(e,(function(t){var i=r;r=t,n&&e.next([i,t]),n=!0})))}))}function mr(t,e){return br((function(r,n){var i=0;r.subscribe(yr(n,(function(r){return t.call(e,r,i++)&&n.next(r)})))}))}function wr(t,e){return br((function(r,n){var i=0;r.subscribe(yr(n,(function(r){n.next(t.call(e,r,i++))})))}))}var Sr=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t},_r="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Er(t){if(t instanceof ar)return t;if(null!=t){if(function(t){return Be(t[sr])}(t))return i=t,new ar((function(t){var e=i[sr]();if(Be(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Sr(t))return n=t,new ar((function(t){for(var e=0;e<n.length&&!t.closed;e++)t.next(n[e]);t.complete()}));if(function(t){return Be(null==t?void 0:t.then)}(t))return r=t,new ar((function(t){r.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,He)}));if(function(t){return Symbol.asyncIterator&&Be(null==t?void 0:t[Symbol.asyncIterator])}(t))return Or(t);if(function(t){return Be(null==t?void 0:t[_r])}(t))return e=t,new ar((function(t){var r,n;try{for(var i=Ce(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()}));if(function(t){return Be(null==t?void 0:t.getReader)}(t))return Or(function(t){return function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(t,e||[]),s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(t){i[t]&&(n[t]=function(e){return new Promise((function(r,n){s.push([t,e,r,n])>1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof Pe?Promise.resolve(r.value.v).then(c,u):h(s[0][2],r)}catch(t){h(s[0][3],t)}var r}function c(t){a("next",t)}function u(t){a("throw",t)}function h(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}}(this,arguments,(function(){var e,r,n;return Re(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Pe(e.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,Pe(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Pe(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}(t))}var e,r,n,i;throw function(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(t)}function Or(t){return new ar((function(e){(function(t,e){var r,n,i,s,o,a,c,u;return o=this,a=void 0,u=function(){var o,a;return Re(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=Ce(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){!function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)}(n,i,(e=t[r](e)).done,e.value)}))}}}(t),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((c=void 0)||(c=Promise))((function(t,e){function r(t){try{i(u.next(t))}catch(t){e(t)}}function n(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):function(t){return t instanceof c?t:new c((function(e){e(t)}))}(e.value).then(r,n)}i((u=u.apply(o,a||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function kr(t){void 0===t&&(t={});var e=t.connector,r=void 0===e?function(){return new hr}:e,n=t.resetOnError,i=void 0===n||n,s=t.resetOnComplete,o=void 0===s||s,a=t.resetOnRefCountZero,c=void 0===a||a;return function(t){var e,n,s,a=0,u=!1,h=!1,l=function(){null==n||n.unsubscribe(),n=void 0},f=function(){l(),e=s=void 0,u=h=!1},d=function(){var t=e;f(),null==t||t.unsubscribe()};return br((function(t,p){a++,h||u||l();var b=s=null!=s?s:r();p.add((function(){0!=--a||h||u||(n=xr(d,c))})),b.subscribe(p),!e&&a>0&&(e=new er({next:function(t){return b.next(t)},error:function(t){h=!0,l(),n=xr(f,i,t),b.error(t)},complete:function(){u=!0,l(),n=xr(f,o),b.complete()}}),Er(t).subscribe(e))}))(t)}}function xr(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==e){if(!1!==e){var i=new er({next:function(){i.unsubscribe(),t()}});return Er(e.apply(void 0,De([],Le(r)))).subscribe(i)}}else t()}function Tr(t,e){return t===e}const Ar=(t,e)=>{const{origWidth:r,origHeight:n}=e,i=t.points.map((([t,e])=>[t*r/100,e*n/100]));return{...t,points:i}},jr=t=>{const{origWidth:e,origHeight:r,inputWidth:n,inputHeight:i}=t,[s,o,a,c]=t.boundingBox,u=s*e/n,h=o*r/i,l=a*e/n,f=c*r/i;return{...t,boundingBox:[u,h,l,f]}},Rr=(t,e)=>{const[r,n,i,s]=t.boundingBox,o={xmin:r,ymin:n,xmax:i,ymax:s};let a=!1;for(const r of e){const e=Ar(r,t);if(e.isPrivacyMask){if(Lr(o,e.points)){a=!1;break}}else"include"===e.filter?"contain"===e.type?Lr(o,e.points)&&(a=!0):"intersect"===e.type&&(Cr(o,e.points)||Lr(o,e.points))&&(a=!0):"exclude"===e.filter&&("contain"===e.type?Lr(o,e.points)||(a=!0):"intersect"===e.type&&(Cr(o,e.points)||Lr(o,e.points)||(a=!0)))}return a},Cr=(t,e)=>{const r=Dr(t);for(const t of r)for(let r=0;r<e.length;r++){const n=[e[r],e[(r+1)%e.length]];if(Pr(t,n))return!0}return!1},Lr=(t,e)=>[[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax],[t.xmin,t.ymax]].every((t=>Br(t,e))),Dr=t=>{const{xmin:e,ymin:r,xmax:n,ymax:i}=t;return[[[e,r],[n,r]],[[n,r],[n,i]],[[n,i],[e,i]],[[e,i],[e,r]]]},Pr=(t,e)=>{const r=(t,e,r)=>(r[1]-t[1])*(e[0]-t[0])>(e[1]-t[1])*(r[0]-t[0]);return n=t[0],i=t[1],r(n,s=e[0],o=e[1])!==r(i,s,o)&&r(n,i,s)!==r(n,i,o);var n,i,s,o},Br=(t,e)=>{const[r,n]=t;let i=!1,[s,o]=e[e.length-1];for(const[t,a]of e)a>n!=o>n&&r<(s-t)*(n-a)/(o-a)+t&&(i=!i),[s,o]=[t,a];return i};class Fr{subscriptions=[];additionalSubscriptions=[];addSubscriptions(...t){this.subscriptions.push(...t)}addAdditionalSubscriptions(...t){this.additionalSubscriptions.push(...t)}unsubscribe(){this.subscriptions.forEach((t=>t.unsubscribe()))}unsubscribeAdditional(){this.additionalSubscriptions.forEach((t=>t.unsubscribe()))}}class zr extends Fr{logger;snapshotCache=new Te({max:100,ttl:3e5});cameraSubject;cameraState=new fr(!1);lightState=new fr({state:!1,timestamp:"0"});motionState=new fr({timestamp:"0",detections:[]});audioState=new fr({state:!1,timestamp:"0"});objectState=new fr({timestamp:"0",detections:[]});doorbellState=new fr({state:!1,timestamp:"0"});sirenState=new fr({state:!1,timestamp:"0"});batteryState=new fr({level:100,timestamp:"0"});prebufferStateSubjects={};onConnected=this.createStateObservable(this.cameraState);onLightSwitched=this.createStateObservable(this.lightState);onMotionDetected=this.createStateObservable(this.motionState);onAudioDetected=this.createStateObservable(this.audioState);onObjectDetected=this.createStateObservable(this.objectState);onDoorbellPressed=this.createStateObservable(this.doorbellState);onSirenDetected=this.createStateObservable(this.sirenState);onBatteryChanged=this.createStateObservable(this.batteryState);get id(){return this.cameraSubject.getValue()._id}get nativeId(){return this.cameraSubject.getValue().nativeId}get pluginId(){return this.cameraSubject.getValue().pluginId}get connected(){return this.cameraState.getValue()}get disabled(){return this.cameraSubject.getValue().disabled}get name(){return this.cameraSubject.getValue().name}get type(){return this.cameraSubject.getValue().type}get info(){return pe()(this.cameraSubject.getValue().info)}get isCloud(){return this.cameraSubject.getValue().isCloud}get hasLight(){return this.cameraSubject.getValue().hasLight}get hasSiren(){return this.cameraSubject.getValue().hasSiren}get hasBinarySensor(){return this.cameraSubject.getValue().hasBinarySensor}get hasBattery(){return this.cameraSubject.getValue().hasBattery}get hasMotionDetector(){return this.cameraSubject.getValue().hasMotionDetector}get hasAudioDetector(){return this.cameraSubject.getValue().hasAudioDetector}get hasObjectDetector(){return this.cameraSubject.getValue().hasObjectDetector}get hasPtz(){return this.cameraSubject.getValue().hasPtz}get hasPrebuffer(){return this.cameraSubject.getValue().hasPrebuffer}get hasIntercom(){return this.cameraSubject.getValue().hasIntercom}get activityZones(){return pe()(this.cameraSubject.getValue().activityZones)}get activitySettings(){return pe()(this.cameraSubject.getValue().activitySettings)}get sources(){return pe()(this.cameraSubject.getValue().sources).map((t=>({...t,updatePrebufferingState:async(e,r)=>this.updatePrebuffer(t._id,e,r),getPrebufferingState:e=>this.cameraSourcePrebufferState(t._id,e),onPrebuffering:e=>this.createPrebufferStateObservable(t._id,e),getStreamInfo:async()=>{}})))}get streamSource(){return this.sources.find((t=>t.roles.includes("stream")))||this.sources[0]}get snapshotSource(){return this.sources.find((t=>t.roles.includes("snapshot")))||this.streamSource}get recordingSource(){return this.sources.find((t=>t.roles.includes("record")))||this.streamSource}get detectionSource(){return this.sources.find((t=>t.roles.includes("detect")))||this.streamSource}constructor(t,e){super(),this.logger=e,this.cameraSubject=new fr(t),"native"===t.pluginId&&this.cameraState.next(!0)}getValue(t){switch(t){case"light":return pe()(this.lightState.getValue());case"motion":return pe()(this.motionState.getValue());case"audio":return pe()(this.audioState.getValue());case"object":return pe()(this.objectState.getValue());case"doorbell":return pe()(this.doorbellState.getValue());case"siren":return pe()(this.sirenState.getValue());case"battery":return pe()(this.batteryState.getValue());default:throw new Error(`Unknown state: ${t}`)}}updateStateInternal(t,e,r){let n,i=!1;if(r)i=!0,n=e;else{const r=this.checkStateInternal(t,e);i=r.changed,n=r.event}if(i)switch(t){case"light":this.lightState.next(this.getLightState(n));break;case"motion":this.motionState.next(this.getMotionState(n));break;case"audio":this.audioState.next(this.getAudioState(n));break;case"object":this.objectState.next(this.getObjectState(n));break;case"doorbell":this.doorbellState.next(this.getDoorbellState(n));break;case"siren":this.sirenState.next(this.getSirenState(n));break;case"battery":this.batteryState.next(this.getBatteryState(n));break;default:throw new Error(`Unknown state: ${t}`)}}onStateChange(t){return this[`${t}State`].pipe(vr(),mr((([e,r])=>"boolean"==typeof e||"boolean"==typeof r?e!==r:this.stateChanged(e,r,t))),wr((([t,e])=>({oldState:t,newState:e}))),kr({connector:()=>new pr(1)}))}onPropertyChange(t){return this.cameraSubject.pipe(vr(),mr((([e,r])=>!ye()(e[t],r[t]))),wr((([e,r])=>({oldData:e[t],newData:r[t]}))),kr({connector:()=>new pr(1)}))}removeAllListeners(){this.lightState.complete(),this.motionState.complete(),this.audioState.complete(),this.objectState.complete(),this.doorbellState.complete(),this.sirenState.complete(),this.batteryState.complete(),this.cameraSubject.complete(),this.cameraState.complete()}checkStateInternal(t,e){let r,n=!1;switch(t){case"audio":const i=e;r=this.getAudioState(i),n=this.stateChanged(this.audioState.getValue(),r,"audio");break;case"light":const s=e;r=this.getLightState(s),n=this.stateChanged(this.lightState.getValue(),r,"light");break;case"motion":const o=e;r=this.getMotionState(o),"boolean"==typeof r.state&&(r.detections=[]),r.detections=((t,e)=>{if(0===e.length)return[];const r=[];for(const n of t)Rr(jr(n),e)&&r.push(n);return r})(r.detections,this.activityZones),n=this.stateChanged(this.motionState.getValue(),r,"motion");break;case"object":const a=e;r=this.getObjectState(a),r.detections=((t,e)=>{if(0===e.length)return[];const r=[];for(const n of t)Rr(jr(n),e)&&r.push(n);return r.filter((t=>e.some((e=>!e.classes.length||e.classes.includes(t.label)))))})(r.detections,this.activityZones),n=this.stateChanged(this.objectState.getValue(),r,"object");break;case"doorbell":const c=e;r=this.getDoorbellState(c),n=this.stateChanged(this.doorbellState.getValue(),r,"doorbell");break;case"siren":const u=e;r=this.getSirenState(u),n=this.stateChanged(this.sirenState.getValue(),r,"siren");break;case"battery":const h=e;r=this.getBatteryState(h),n=this.stateChanged(this.batteryState.getValue(),r,"battery");break;default:throw new Error(`Unknown state: ${t}`)}return{changed:n,event:r}}getAudioState(t){const e=this.getValue("audio");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,db:t.db||e.db,lastEvent:e.state?e:n.state?n:void 0}}return r}getMotionState(t){const e=this.getValue("motion");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.detections.length?e:n.detections.length?n:void 0}}return r}getObjectState(t){const e=this.getValue("object");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.detections.length?e:n.detections.length?n:void 0}}return r}getDoorbellState(t){const e=this.getValue("doorbell");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.state?e:n.state?n:void 0}}return r}getLightState(t){const e=this.getValue("light");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.state?e:n.state?n:void 0}}return r}getSirenState(t){const e=this.getValue("siren");let r;if(delete e.lastEvent,this.isStateEvent(t))r=t;else{const n={...t,timestamp:Date.now().toString()};r={...n,lastEvent:e.state?e:n.state?n:void 0}}return r}getBatteryState(t){const e=this.getValue("battery"),r=this.stateChanged(e,t,"battery");let n;if(delete e.lastEvent,this.isStateEvent(t))n=t;else{const i={...t,timestamp:Date.now().toString()};n={...i,charging:t.charging||e.charging,lowBattery:t.lowBattery||e.lowBattery,lastEvent:r?e:i}}return n}updateCamera(t){this.cameraSubject.next(t),this.updateCameraSourcesState()}async updatePrebuffer(t,e,r){this.prebufferStateSubjects[t]&&this.prebufferStateSubjects[t][e]&&this.prebufferStateSubjects[t][e].next({state:r.state,url:r.url||void 0,maxDuration:r.maxDuration,availableDuration:r.availableDuration})}updateCameraSourcesState(){const t=this.cameraSubject.getValue().sources;for(const e in this.prebufferStateSubjects)if(!t.some((t=>t._id===e))){for(const t in this.prebufferStateSubjects[e])this.prebufferStateSubjects[e][t].complete();delete this.prebufferStateSubjects[e]}}updateCameraState(t){this.cameraState.next(t)}cameraSourcePrebufferState(t,e){let r={state:!1,maxDuration:0,availableDuration:0};return this.prebufferStateSubjects[t]&&this.prebufferStateSubjects[t][e]&&(r=this.prebufferStateSubjects[t][e].getValue()),r}createStateObservable(t){return t.pipe(kr({connector:()=>new pr(1)}))}createPrebufferStateObservable(t,e){return this.prebufferStateSubjects[t]||(this.prebufferStateSubjects[t]={}),this.prebufferStateSubjects[t][e]||(this.prebufferStateSubjects[t][e]=new fr({state:!1,maxDuration:0,availableDuration:0})),this.prebufferStateSubjects[t][e].pipe((void 0===n&&(n=or),r=null!=(r=(t,e)=>t.state===e.state&&t.url===e.url)?r:Tr,br((function(t,e){var i,s=!0;t.subscribe(yr(e,(function(t){var o=n(t);!s&&r(i,o)||(s=!1,i=o,e.next(t))})))}))),kr({connector:()=>new pr(1)}));var r,n}stateChanged(t,e,r){if(!t||!e||!r)return!1;if("audio"==r){if(!this.hasAudioDetector)return!1;const r=t,n=e;return r.state!==n.state||r.db!==n.db}if("motion"==r){if(!this.hasMotionDetector)return!1;const r=t,n=e;return"state"in t&&"state"in e?r.state!==n.state:!ye()(r.detections,n.detections)}if("object"==r){if(!this.hasObjectDetector)return!1;const r=t,n=e;return!ye()(r.detections,n.detections)}if("siren"==r){if(!this.hasSiren)return!1;const r=t,n=e;return r.state!==n.state||r.level!==n.level}if("battery"==r){if(!this.hasBattery)return!1;const r=t,n=e;return r.level!==n.level||r.lowBattery!==n.lowBattery||r.charging!==n.charging}if("doorbell"==r){if(!this.hasBinarySensor)return!1;const r=e;return t.state!==r.state}if("light"==r){if(!this.hasLight)return!1;const r=e;return t.state!==r.state}return!1}isStateEvent(t){return"timestamp"in t}}var Nr=function(t,e){return Nr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Nr(t,e)};function Ir(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Nr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Ur(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Mr(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function qr(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function Vr(t,e,r){if(r||2===arguments.length)for(var n,i=0,s=e.length;i<s;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}function Wr(t){return this instanceof Wr?(this.v=t,this):new Wr(t)}function Hr(t){return"function"==typeof t}function $r(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var Gr=$r((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function Jr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Kr=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=Mr(s),a=o.next();!a.done;a=o.next())a.value.remove(this)}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if(Hr(c))try{c()}catch(t){i=t instanceof Gr?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=Mr(u),l=h.next();!l.done;l=h.next()){var f=l.value;try{Qr(f)}catch(t){i=null!=i?i:[],t instanceof Gr?i=Vr(Vr([],qr(i)),qr(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(i)throw new Gr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Qr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Jr(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&Jr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Yr=Kr.EMPTY;function Xr(t){return t instanceof Kr||t&&"closed"in t&&Hr(t.remove)&&Hr(t.add)&&Hr(t.unsubscribe)}function Qr(t){Hr(t)?t():t.unsubscribe()}var Zr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},tn={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=tn.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,Vr([t,e],qr(r))):setTimeout.apply(void 0,Vr([t,e],qr(r)))},clearTimeout:function(t){var e=tn.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function en(t){tn.setTimeout((function(){var e=Zr.onUnhandledError;if(!e)throw t;e(t)}))}function rn(){}var nn=sn("C",void 0,void 0);function sn(t,e,r){return{kind:t,value:e,error:r}}var on=null;function an(t){if(Zr.useDeprecatedSynchronousErrorHandling){var e=!on;if(e&&(on={errorThrown:!1,error:null}),t(),e){var r=on,n=r.errorThrown,i=r.error;if(on=null,n)throw i}}else t()}var cn=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,Xr(e)&&e.add(r)):r.destination=bn,r}return Ir(e,t),e.create=function(t,e,r){return new fn(t,e,r)},e.prototype.next=function(t){this.isStopped?pn(function(t){return sn("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?pn(sn("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?pn(nn,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Kr),un=Function.prototype.bind;function hn(t,e){return un.call(t,e)}var ln=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){dn(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){dn(t)}else dn(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){dn(t)}},t}(),fn=function(t){function e(e,r,n){var i,s,o=t.call(this)||this;return Hr(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:o&&Zr.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return o.unsubscribe()},i={next:e.next&&hn(e.next,s),error:e.error&&hn(e.error,s),complete:e.complete&&hn(e.complete,s)}):i=e,o.destination=new ln(i),o}return Ir(e,t),e}(cn);function dn(t){var e;Zr.useDeprecatedSynchronousErrorHandling?(e=t,Zr.useDeprecatedSynchronousErrorHandling&&on&&(on.errorThrown=!0,on.error=e)):en(t)}function pn(t,e){var r=Zr.onStoppedNotification;r&&tn.setTimeout((function(){return r(t,e)}))}var bn={closed:!0,next:rn,error:function(t){throw t},complete:rn},yn="function"==typeof Symbol&&Symbol.observable||"@@observable";function gn(t){return t}var vn=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this,i=function(t){return t&&t instanceof cn||function(t){return t&&Hr(t.next)&&Hr(t.error)&&Hr(t.complete)}(t)&&Xr(t)}(t)?t:new fn(t,e,r);return an((function(){var t=n,e=t.operator,r=t.source;i.add(e?e.call(i,r):r?n._subscribe(i):n._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=mn(e))((function(e,n){var i=new fn({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[yn]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(r=t).length?gn:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=mn(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function mn(t){var e;return null!==(e=null!=t?t:Zr.Promise)&&void 0!==e?e:Promise}var wn=$r((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Sn=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return Ir(e,t),e.prototype.lift=function(t){var e=new _n(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new wn},e.prototype.next=function(t){var e=this;an((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=Mr(e.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(t)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;an((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;an((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,s=r.observers;return n||i?Yr:(this.currentObservers=null,s.push(t),new Kr((function(){e.currentObservers=null,Jr(s,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new vn;return t.source=this,t},e.create=function(t,e){return new _n(t,e)},e}(vn),_n=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return Ir(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:Yr},e}(Sn),En={now:function(){return(En.delegate||Date).now()},delegate:void 0},On=function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=En);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}return Ir(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,o=r._timestampProvider,a=r._windowTime;n||(i.push(e),!s&&i.push(o.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,s=(i?1:2)*e;if(e<1/0&&s<n.length&&n.splice(0,n.length-s),!i){for(var o=r.now(),a=0,c=1;c<n.length&&n[c]<=o;c+=2)a=c;a&&n.splice(0,a+1)}},e}(Sn),kn=function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}return Ir(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(Sn),xn=$r((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Tn(t){return function(e){if(function(t){return Hr(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}var An=Array.isArray;function jn(t,e,r,n,i){return new Rn(t,e,r,n,i)}var Rn=function(t){function e(e,r,n,i,s,o){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return Ir(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(cn);function Cn(t,e){return Tn((function(r,n){var i=0;r.subscribe(jn(n,(function(r){n.next(t.call(e,r,i++))})))}))}var Ln=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Dn(t){return Hr(null==t?void 0:t.then)}function Pn(t){return Hr(t[yn])}function Bn(t){return Symbol.asyncIterator&&Hr(null==t?void 0:t[Symbol.asyncIterator])}function Fn(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var zn,Nn,In,Un="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Mn(t){return Hr(null==t?void 0:t[Un])}function qn(t){return function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(t,e||[]),s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(t){i[t]&&(n[t]=function(e){return new Promise((function(r,n){s.push([t,e,r,n])>1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof Wr?Promise.resolve(r.value.v).then(c,u):h(s[0][2],r)}catch(t){h(s[0][3],t)}var r}function c(t){a("next",t)}function u(t){a("throw",t)}function h(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}}(this,arguments,(function(){var e,r,n;return Ur(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Wr(e.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,Wr(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Wr(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function Vn(t){return Hr(null==t?void 0:t.getReader)}function Wn(t){if(t instanceof vn)return t;if(null!=t){if(Pn(t))return i=t,new vn((function(t){var e=i[yn]();if(Hr(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ln(t))return n=t,new vn((function(t){for(var e=0;e<n.length&&!t.closed;e++)t.next(n[e]);t.complete()}));if(Dn(t))return r=t,new vn((function(t){r.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,en)}));if(Bn(t))return Hn(t);if(Mn(t))return e=t,new vn((function(t){var r,n;try{for(var i=Mr(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()}));if(Vn(t))return Hn(qn(t))}var e,r,n,i;throw Fn(t)}function Hn(t){return new vn((function(e){(function(t,e){var r,n,i,s,o,a,c,u;return o=this,a=void 0,u=function(){var o,a;return Ur(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=Mr(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){!function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)}(n,i,(e=t[r](e)).done,e.value)}))}}}(t),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((c=void 0)||(c=Promise))((function(t,e){function r(t){try{i(u.next(t))}catch(t){e(t)}}function n(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):function(t){return t instanceof c?t:new c((function(e){e(t)}))}(e.value).then(r,n)}i((u=u.apply(o,a||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function $n(t,e,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var s=e.schedule((function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()}),n);if(t.add(s),!i)return s}function Gn(t,e,r){return void 0===r&&(r=1/0),Hr(e)?Gn((function(r,n){return Cn((function(t,i){return e(r,t,n,i)}))(Wn(t(r,n)))}),r):("number"==typeof e&&(r=e),Tn((function(e,n){return function(t,e,r,n,i,s,o,a){var c=[],u=0,h=0,l=!1,f=function(){!l||c.length||u||e.complete()},d=function(t){return u<n?p(t):c.push(t)},p=function(t){u++;var i=!1;Wn(r(t,h++)).subscribe(jn(e,(function(t){e.next(t)}),(function(){i=!0}),void 0,(function(){if(i)try{u--;for(;c.length&&u<n;)t=void 0,t=c.shift(),p(t);f()}catch(t){e.error(t)}var t})))};return t.subscribe(jn(e,d,(function(){l=!0,f()}))),function(){}}(e,n,t,r)})))}function Jn(t){return t[t.length-1]}function Kn(t,e){return void 0===e&&(e=0),Tn((function(r,n){r.subscribe(jn(n,(function(r){return $n(n,t,(function(){return n.next(r)}),e)}),(function(){return $n(n,t,(function(){return n.complete()}),e)}),(function(r){return $n(n,t,(function(){return n.error(r)}),e)})))}))}function Yn(t,e){return void 0===e&&(e=0),Tn((function(r,n){n.add(t.schedule((function(){return r.subscribe(n)}),e))}))}function Xn(t,e){if(!t)throw new Error("Iterable cannot be null");return new vn((function(r){$n(r,e,(function(){var n=t[Symbol.asyncIterator]();$n(r,e,(function(){n.next().then((function(t){t.done?r.complete():r.next(t.value)}))}),0,!0)}))}))}function Qn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=function(t){return function(t){return t&&Hr(t.schedule)}(Jn(t))?t.pop():void 0}(t),n=function(t,e){return"number"==typeof Jn(t)?t.pop():1/0}(t);return t=function(t){return 1===t.length&&An(t[0])?t[0]:t}(t),Tn((function(e,i){(function(t){return void 0===t&&(t=1/0),Gn(gn,t)})(n)(function(t,e){return e?function(t,e){if(null!=t){if(Pn(t))return function(t,e){return Wn(t).pipe(Yn(e),Kn(e))}(t,e);if(Ln(t))return function(t,e){return new vn((function(r){var n=0;return e.schedule((function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())}))}))}(t,e);if(Dn(t))return function(t,e){return Wn(t).pipe(Yn(e),Kn(e))}(t,e);if(Bn(t))return Xn(t,e);if(Mn(t))return function(t,e){return new vn((function(r){var n;return $n(r,e,(function(){n=t[Un](),$n(r,e,(function(){var t,e,i;try{e=(t=n.next()).value,i=t.done}catch(t){return void r.error(t)}i?r.complete():r.next(e)}),0,!0)})),function(){return Hr(null==n?void 0:n.return)&&n.return()}}))}(t,e);if(Vn(t))return function(t,e){return Xn(qn(t),e)}(t,e)}throw Fn(t)}(t,e):Wn(t)}(Vr([e],qr(t)),r)).subscribe(i)}))}function Zn(t,e){return t===e}function ti(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==e){if(!1!==e){var i=new fn({next:function(){i.unsubscribe(),t()}});return Wn(e.apply(void 0,Vr([],qr(r)))).subscribe(i)}}else t()}!function(t){t.READY="ready",t.STARTING="starting",t.STARTED="started",t.STOPPED="stopped",t.ERROR="error",t.UNKNOWN="unknown",t.DISABLED="disabled"}(zn||(zn={})),function(t){t.START="start",t.STOP="stop"}(Nn||(Nn={})),function(t){t.READY="ready",t.RESTARTING="restarting",t.STARTING="starting",t.STARTED="started",t.STOPPED="stopped",t.ERROR="error",t.UNKNOWN="unknown"}(In||(In={}));class ei{subscriptions=[];additionalSubscriptions=[];addSubscriptions(...t){this.subscriptions.push(...t)}addAdditionalSubscriptions(...t){this.additionalSubscriptions.push(...t)}unsubscribe(){this.subscriptions.forEach((t=>t.unsubscribe()))}unsubscribeAdditional(){this.additionalSubscriptions.forEach((t=>t.unsubscribe()))}}class ri extends ei{onCallAnswered=new On(1);onCallEnded=new On(1);onUsingOpus=new On(1);micState=new kn(!1);hasEnded=!1;cameraDevice;connection;logger;onMicrophoneEnabled=this.createStateObservable(this.micState);get isUsingOpus(){return t=this.onUsingOpus.pipe(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Qn.apply(void 0,Vr([],qr(t)))}(this.connection.onError.pipe(Cn((t=>{throw t}))))),new Promise((function(e,r){var n=new fn({next:function(t){e(t),n.unsubscribe()},error:r,complete:function(){r(new xn)}});t.subscribe(n)}));var t}constructor(t,e,r){super(),this.cameraDevice=t,this.logger=e,this.connection=r,this.bindToConnection(r)}enableMicrophone(t){this.hasEnded||(this.connection.pc.enableMicrophone(t),this.micState.next(!0))}disableMicrophone(){this.hasEnded||(this.connection.pc.disableMicrophone(),this.micState.next(!1))}stop(){this.callEnded()}createStateObservable(t){return t.pipe((e=(t,e)=>t===e,void 0===r&&(r=gn),e=null!=e?e:Zn,Tn((function(t,n){var i,s=!0;t.subscribe(jn(n,(function(t){var o=r(t);!s&&e(i,o)||(s=!1,i=o,n.next(t))})))}))),function(t){void 0===t&&(t={});var e=t.connector,r=void 0===e?function(){return new Sn}:e,n=t.resetOnError,i=void 0===n||n,s=t.resetOnComplete,o=void 0===s||s,a=t.resetOnRefCountZero,c=void 0===a||a;return function(t){var e,n,s,a=0,u=!1,h=!1,l=function(){null==n||n.unsubscribe(),n=void 0},f=function(){l(),e=s=void 0,u=h=!1},d=function(){var t=e;f(),null==t||t.unsubscribe()};return Tn((function(t,p){a++,h||u||l();var b=s=null!=s?s:r();p.add((function(){0!=--a||h||u||(n=ti(d,c))})),b.subscribe(p),!e&&a>0&&(e=new fn({next:function(t){return b.next(t)},error:function(t){h=!0,l(),n=ti(f,i,t),b.error(t)},complete:function(){u=!0,l(),n=ti(f,o),b.complete()}}),Wn(t).subscribe(e))}))(t)}}({connector:()=>new On(1)}));var e,r}bindToConnection(t){this.addSubscriptions(t.onCallAnswered.subscribe((t=>{this.onUsingOpus.next(t.toLocaleLowerCase().includes(" opus/"))})),t.onCallEnded.subscribe((()=>this.callEnded())))}callEnded(){this.hasEnded||(this.hasEnded=!0,this.unsubscribe(),this.onCallEnded.next(),this.connection.stop())}}var ni=Array.isArray;var ii=["addListener","removeListener"],si=["addEventListener","removeEventListener"],oi=["on","off"];function ai(t,e,r,n){if(Hr(r)&&(n=r,r=void 0),n)return ai(t,e,r).pipe((i=n,Cn((function(t){return function(t,e){return ni(e)?t.apply(void 0,Vr([],qr(e))):t(e)}(i,t)}))));var i,s=qr(function(t){return Hr(t.addEventListener)&&Hr(t.removeEventListener)}(t)?si.map((function(n){return function(i){return t[n](e,i,r)}})):function(t){return Hr(t.addListener)&&Hr(t.removeListener)}(t)?ii.map(ci(t,e)):function(t){return Hr(t.on)&&Hr(t.off)}(t)?oi.map(ci(t,e)):[],2),o=s[0],a=s[1];if(!o&&Ln(t))return Gn((function(t){return ai(t,e,r)}))(Wn(t));if(!o)throw new TypeError("Invalid event target");return new vn((function(t){var e=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.next(1<e.length?e:e[0])};return o(e),function(){return a(e)}}))}function ci(t,e){return function(r){return function(n){return t[r](e,n)}}}function ui(t){const e=[];return t.forEach((t=>{t.urls.forEach((r=>{e.push({urls:r,username:t.username,credential:t.credential})}))})),e}class hi extends ei{onIceCandidate=new Sn;onConnectionState=new On(1);videoTransceiver;audioTransceiver;cameraDevice;logger;pc;videoElement;constructor(t,e,r,n){super(),this.cameraDevice=t,this.logger=n,this.videoElement=e,this.pc=new RTCPeerConnection({iceServers:ui(r)}),this.audioTransceiver=this.pc.addTransceiver("audio",{direction:"sendrecv"}),this.videoTransceiver=this.pc.addTransceiver("video",{direction:"recvonly"}),this.pc.onconnectionstatechange=()=>{this.logger.debug(this.cameraDevice.name,"connectionStateChange:",this.pc.connectionState),this.onConnectionState.next(this.pc.connectionState)},this.pc.oniceconnectionstatechange=()=>{this.logger.debug(this.cameraDevice.name,"iceconnectionstatechange:",this.pc.iceConnectionState)},this.pc.onicegatheringstatechange=()=>{this.logger.debug(this.cameraDevice.name,"icegatheringstatechange:",this.pc.iceGatheringState)},this.pc.onicecandidate=t=>{t.candidate&&this.onIceCandidate.next(t.candidate)},this.pc.ontrack=t=>{this.logger.debug(this.cameraDevice.name,"ontrack:",t.track),e.srcObject?e.srcObject.addTrack(t.track):e.srcObject=new MediaStream([t.track])}}enableMicrophone(t){this.audioTransceiver.sender.replaceTrack(t)}disableMicrophone(){this.audioTransceiver.sender.replaceTrack(null)}async createOffer(){const t=await this.pc.createOffer();return await this.pc.setLocalDescription(t),t}async acceptAnswer(t){await this.pc.setRemoteDescription(t)}addIceCandidate(t){return this.pc.addIceCandidate(t)}close(){this.videoElement.srcObject=null,this.pc.close(),this.unsubscribe()}}class li extends ei{onCallAnswered=new On(1);onCallEnded=new On(1);onError=new On(1);onMessage=new On;onWsOpen;pc;ws;onOfferSent=new On(1);hasEnded=!1;cameraDevice;logger;constructor(t,e,r,n,i){super(),this.cameraDevice=t,this.logger=i;const s=t.sources.find((t=>t.name===e));if(!s)throw new Error(`Invalid source name ${e}`);this.ws=new WebSocket(s.urls.ws.webrtc),this.pc=new hi(t,r,n,i),this.onWsOpen=ai(this.ws,"open");const o=ai(this.ws,"message"),a=ai(this.ws,"error"),c=ai(this.ws,"close");var u,h;this.addSubscriptions(o.pipe((u=t=>{const e=JSON.parse(t.data);return this.onMessage.next(e),this.handleMessage(e).catch((t=>{throw this.onError.next(t),t}))},Hr(h)?Gn(u,h,1):Gn(u,1))).subscribe(),a.subscribe((t=>{this.logger.error(this.cameraDevice.name,t),this.callEnded()})),c.subscribe((()=>{this.callEnded()})),this.cameraDevice.onConnected.subscribe((t=>{t||this.callEnded()})),this.onError.subscribe((t=>{this.logger.error(this.cameraDevice.name,t),this.callEnded()})),this.onWsOpen.subscribe((()=>{this.initiateCall().catch((t=>{this.logger.error(this.cameraDevice.name,t),this.callEnded()}))})),this.pc.onConnectionState.subscribe((t=>{"failed"===t&&(this.logger.error(this.cameraDevice.name,"Stream connection failed"),this.callEnded()),"closed"===t&&(this.logger.debug(this.cameraDevice.name,"Stream connection closed"),this.callEnded())})),this.pc.onIceCandidate.subscribe((async t=>{this.sendMessage({type:"webrtc/candidate",value:t.toJSON().candidate||""})})))}stop(){this.callEnded()}async initiateCall(){const{sdp:t}=await this.pc.createOffer();this.sendMessage({type:"webrtc/offer",value:t||""}),this.onOfferSent.next()}async handleMessage(t){switch(t.type){case"webrtc/answer":const e=t.value;return await this.pc.acceptAnswer({type:"answer",sdp:e}),void this.onCallAnswered.next(e);case"webrtc/candidate":return void await this.pc.addIceCandidate({candidate:t.value,sdpMid:"0"});case"error":throw new Error(t.value);default:throw new Error(t)}}sendMessage(t){this.hasEnded||this.ws.send(JSON.stringify(t))}callEnded(){this.hasEnded||(this.hasEnded=!0,this.unsubscribe(),this.onCallEnded.next(),this.pc.close(),this.ws.close())}}class fi extends zr{socketService;socket;_started=!1;get started(){return this._started}get sources(){return super.sources.map((t=>({...t,updatePrebufferingState:(e,r)=>this.socketService.sendRequest({name:"cameraDevice",method:"updatePrebufferState",args:[{cameraId:this.id,sourceId:t._id,container:e,state:r,pluginId:"@camera.ui/client"}]},this.socket),getPrebufferingState:e=>super.cameraSourcePrebufferState(t._id,e),onPrebuffering:e=>super.createPrebufferStateObservable(t._id,e),getStreamInfo:async()=>this.socketService.sendRequest({name:"cameraDevice",method:"getStreamInfo",args:[{sourceName:t.name,pluginId:"@camera.ui/client"}]},this.socket)})))}constructor(t,e,r){super(t,r),this.socketService=e;const{socket:n}=this.socketService.createManager();this.socket=n,this.listenToMessages()}start(){this._started||(this._started=!0,this.socket.emit("joinRoomStates",this.id))}stop(){this._started=!1,this.socket.emit("leaveRoomStates",this.id)}close(){this.cleanup()}connect(){return this.socketService.sendRequest({name:"cameraDevice",method:"connect",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}disconnect(){return this.socketService.sendRequest({name:"cameraDevice",method:"disconnect",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}reboot(){return this.socketService.sendRequest({name:"cameraDevice",method:"reboot",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}getIceServers(){return this.socketService.sendRequest({name:"cameraDevice",method:"getIceServers",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket)}async snapshot(t=!1){const e=this.snapshotSource.urls.www.jpegSnapshot,r=this.snapshotCache.get(this.snapshotSource._id);if(!t&&r)return r;const n=await fetch(e);if(!n.ok)throw new Error("Status Code: "+n.status);const i=await n.arrayBuffer();return i.byteLength>0&&this.snapshotCache.set(this.snapshotSource._id,i),i}async createSession(t,e){const r=await this.getIceServers(),n=new li(this,t,e,r,this.logger);return new ri(this,this.logger,n)}async updateState(t,e){const{changed:r,event:n}=super.checkStateInternal(t,e);if(r)return super.updateStateInternal(t,n,!0),this.socketService.sendRequest({name:"cameraDevice",method:"updateState",args:[{cameraId:this.id,stateName:t,eventData:n,pluginId:"@camera.ui/client"}]},this.socket)}async refreshStates(){const t=await this.socketService.sendRequest({name:"cameraDevice",method:"refreshStates",args:[{cameraId:this.id,pluginId:"@camera.ui/client"}]},this.socket);super.updateCamera(t.camera),super.updateCameraState(t.cameraState);for(const[e,r]of Object.entries(t.states))super.updateStateInternal(e,r)}async cleanup(){this._started=!1,this.removeAllListeners(),this.unsubscribe(),this.socket.disconnect()}listenToMessages(){this.socket.emit("joinRoomDevice",this.id),this.socket.on("updateState",(t=>{t.cameraId===this.id&&super.updateStateInternal(t.stateName,t.data.newEvent)})),this.socket.on("updateDevice",(t=>{if(t.cameraId===this.id)switch(t.type){case"removed":this.cleanup();break;case"updated":super.updateCamera(t.data);break;case"cameraState":super.updateCameraState(t.data);break;case"prebufferState":super.updatePrebuffer(t.data.sourceId,t.data.container,t.data.state)}}))}}class di{socketService;logger;constructor(t,e){this.socketService=t,this.logger=e}async getCameraById(t){const e=await this.socketService.sendRequest({name:"deviceManager",method:"getCameraById",args:[{id:t,pluginId:"@camera.ui/client"}]});if(e){const t=new fi(e,this.socketService,this.logger);return await t.refreshStates(),t}}async getCameraByName(t){const e=await this.socketService.sendRequest({name:"deviceManager",method:"getCameraByName",args:[{name:t,pluginId:"@camera.ui/client"}]});if(e){const t=new fi(e,this.socketService,this.logger);return await t.refreshStates(),t}}}class pi{socketService;logger;constructor(t,e){this.socketService=t,this.logger=e}}class bi{socketService;logger;constructor(t,e){this.socketService=t,this.logger=e}}const yi=Object.create(null);yi.open="0",yi.close="1",yi.ping="2",yi.pong="3",yi.message="4",yi.upgrade="5",yi.noop="6";const gi=Object.create(null);Object.keys(yi).forEach((t=>{gi[yi[t]]=t}));const vi={type:"error",data:"parser error"},mi="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),wi="function"==typeof ArrayBuffer,Si=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,_i=({type:t,data:e},r,n)=>mi&&e instanceof Blob?r?n(e):Ei(e,n):wi&&(e instanceof ArrayBuffer||Si(e))?r?n(e):Ei(new Blob([e]),n):n(yi[t]+(e||"")),Ei=(t,e)=>{const r=new FileReader;return r.onload=function(){const t=r.result.split(",")[1];e("b"+(t||""))},r.readAsDataURL(t)};function Oi(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let ki;const xi="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<64;t++)xi["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(t)]=t;const Ti="function"==typeof ArrayBuffer,Ai=(t,e)=>{if("string"!=typeof t)return{type:"message",data:Ri(t,e)};const r=t.charAt(0);return"b"===r?{type:"message",data:ji(t.substring(1),e)}:gi[r]?t.length>1?{type:gi[r],data:t.substring(1)}:{type:gi[r]}:vi},ji=(t,e)=>{if(Ti){const r=(t=>{let e,r,n,i,s,o=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);const u=new ArrayBuffer(o),h=new Uint8Array(u);for(e=0;e<a;e+=4)r=xi[t.charCodeAt(e)],n=xi[t.charCodeAt(e+1)],i=xi[t.charCodeAt(e+2)],s=xi[t.charCodeAt(e+3)],h[c++]=r<<2|n>>4,h[c++]=(15&n)<<4|i>>2,h[c++]=(3&i)<<6|63&s;return u})(t);return Ri(r,e)}return{base64:!0,data:t}},Ri=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,Ci=String.fromCharCode(30);let Li;function Di(t){return t.reduce(((t,e)=>t+e.length),0)}function Pi(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let n=0;for(let i=0;i<e;i++)r[i]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),r}function Bi(t){if(t)return function(t){for(var e in Bi.prototype)t[e]=Bi.prototype[e];return t}(t)}Bi.prototype.on=Bi.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Bi.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},Bi.prototype.off=Bi.prototype.removeListener=Bi.prototype.removeAllListeners=Bi.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<n.length;i++)if((r=n[i])===e||r.fn===e){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},Bi.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,e)}return this},Bi.prototype.emitReserved=Bi.prototype.emit,Bi.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Bi.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Fi="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function zi(t,...e){return e.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{})}const Ni=Fi.setTimeout,Ii=Fi.clearTimeout;function Ui(t,e){e.useNativeTimers?(t.setTimeoutFn=Ni.bind(Fi),t.clearTimeoutFn=Ii.bind(Fi)):(t.setTimeoutFn=Fi.setTimeout.bind(Fi),t.clearTimeoutFn=Fi.clearTimeout.bind(Fi))}class Mi extends Error{constructor(t,e,r){super(t),this.description=e,this.context=r,this.type="TransportError"}}class qi extends Bi{constructor(t){super(),this.writable=!1,Ui(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,r){return super.emitReserved("error",new Mi(t,e,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=Ai(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){const e=function(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}(t);return e.length?"?"+e:""}}const Vi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Wi=64,Hi={};let $i,Gi=0,Ji=0;function Ki(t){let e="";do{e=Vi[t%Wi]+e,t=Math.floor(t/Wi)}while(t>0);return e}function Yi(){const t=Ki(+new Date);return t!==$i?(Gi=0,$i=t):t+"."+Ki(Gi++)}for(;Ji<Wi;Ji++)Hi[Vi[Ji]]=Ji;let Xi=!1;try{Xi="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const Qi=Xi;function Zi(t){const e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||Qi))return new XMLHttpRequest}catch(t){}if(!e)try{return new(Fi[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function ts(){}const es=null!=new Zi({xdomain:!1}).responseType;class rs extends Bi{constructor(t,e){super(),Ui(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.data=void 0!==e.data?e.data:null,this.create()}create(){var t;const e=zi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd;const r=this.xhr=new Zi(e);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&r.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var t;3===r.readyState&&(null===(t=this.opts.cookieJar)||void 0===t||t.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=rs.requestsCount++,rs.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=ts,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete rs.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function ns(){for(let t in rs.requests)rs.requests.hasOwnProperty(t)&&rs.requests[t].abort()}rs.requestsCount=0,rs.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",ns):"function"==typeof addEventListener&&addEventListener("onpagehide"in Fi?"pagehide":"unload",ns,!1));const is="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),ss=Fi.WebSocket||Fi.MozWebSocket,os="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),as={websocket:class extends qi{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,r=os?{}:zi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=os?new ss(t,e,r):e?new ss(t,e):new ss(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],n=e===t.length-1;_i(r,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}n&&is((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Yi()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}check(){return!!ss}},webtransport:class extends qi{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((t=>{this.onError("webtransport error",t)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((t=>{const e=function(t,e){Li||(Li=new TextDecoder);const r=[];let n=0,i=-1,s=!1;return new TransformStream({transform(o,a){for(r.push(o);;){if(0===n){if(Di(r)<1)break;const t=Pi(r,1);s=!(128&~t[0]),i=127&t[0],n=i<126?3:126===i?1:2}else if(1===n){if(Di(r)<2)break;const t=Pi(r,2);i=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),n=3}else if(2===n){if(Di(r)<8)break;const t=Pi(r,8),e=new DataView(t.buffer,t.byteOffset,t.length),s=e.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(vi);break}i=s*Math.pow(2,32)+e.getUint32(4),n=3}else{if(Di(r)<i)break;const t=Pi(r,i);a.enqueue(Ai(s?t:Li.decode(t),e)),n=0}if(0===i||i>t){a.enqueue(vi);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(e).getReader(),n=new TransformStream({transform(t,e){!function(t,e){mi&&t.data instanceof Blob?t.data.arrayBuffer().then(Oi).then(e):wi&&(t.data instanceof ArrayBuffer||Si(t.data))?e(Oi(t.data)):_i(t,!1,(t=>{ki||(ki=new TextEncoder),e(ki.encode(t))}))}(t,(r=>{const n=r.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const t=new DataView(i.buffer);t.setUint8(0,126),t.setUint16(1,n)}else{i=new Uint8Array(9);const t=new DataView(i.buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(n))}t.data&&"string"!=typeof t.data&&(i[0]|=128),e.enqueue(i),e.enqueue(r)}))}});n.readable.pipeTo(t.writable),this.writer=n.writable.getWriter();const i=()=>{r.read().then((({done:t,value:e})=>{t||(this.onPacket(e),i())})).catch((t=>{}))};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then((()=>this.onOpen()))}))})))}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],n=e===t.length-1;this.writer.write(r).then((()=>{n&&is((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var t;null===(t=this.transport)||void 0===t||t.close()}},polling:class extends qi{constructor(t){if(super(t),this.polling=!1,"undefined"!=typeof location){const e="https:"===location.protocol;let r=location.port;r||(r=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||r!==t.port}const e=t&&t.forceBase64;this.supportsBinary=es&&!e,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const r=t.split(Ci),n=[];for(let t=0;t<r.length;t++){const i=Ai(r[t],e);if(n.push(i),"error"===i.type)break}return n})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const r=t.length,n=new Array(r);let i=0;t.forEach(((t,s)=>{_i(t,!1,(t=>{n[s]=t,++i===r&&e(n.join(Ci))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=Yi()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new rs(this.uri(),t)}doWrite(t,e){const r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",((t,e)=>{this.onError("xhr post error",t,e)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",((t,e)=>{this.onError("xhr poll error",t,e)})),this.pollXhr=t}}},cs=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,us=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function hs(t){if(t.length>2e3)throw"URI too long";const e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let i=cs.exec(t||""),s={},o=14;for(;o--;)s[us[o]]=i[o]||"";return-1!=r&&-1!=n&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(t,e){const r=e.replace(/\/{2,9}/g,"/").split("/");return"/"!=e.slice(0,1)&&0!==e.length||r.splice(0,1),"/"==e.slice(-1)&&r.splice(r.length-1,1),r}(0,s.path),s.queryKey=function(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,n){e&&(r[e]=n)})),r}(0,s.query),s}class ls extends Bi{constructor(t,e={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],t&&"object"==typeof t&&(e=t,t=null),t?(t=hs(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=hs(e.host).host),Ui(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,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},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},r=t.split("&");for(let t=0,n=r.length;t<n;t++){let n=r[t].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const r=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new as[t](r)}open(){let t;if(this.opts.rememberUpgrade&&ls.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}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",(t=>this.onClose("transport close",t)))}probe(t){let e=this.createTransport(t),r=!1;ls.priorWebsocketSuccess=!1;const n=()=>{r||(e.send([{type:"ping",data:"probe"}]),e.once("packet",(t=>{if(!r)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;ls.priorWebsocketSuccess="websocket"===e.name,this.transport.pause((()=>{r||"closed"!==this.readyState&&(u(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}})))};function i(){r||(r=!0,u(),e.close(),e=null)}const s=t=>{const r=new Error("probe error: "+t);r.transport=e.name,i(),this.emitReserved("upgradeError",r)};function o(){s("transport closed")}function a(){s("socket closed")}function c(t){e&&t.name!==e.name&&i()}const u=()=>{e.removeListener("open",n),e.removeListener("error",s),e.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};e.once("open",n),e.once("error",s),e.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((()=>{r||e.open()}),200):e.open()}onOpen(){if(this.readyState="open",ls.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const n=this.writeBuffer[r].data;if(n&&(t+="string"==typeof(e=n)?function(t){let e=0,r=0;for(let n=0,i=t.length;n<i;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}var e;return this.writeBuffer}write(t,e,r){return this.sendPacket("message",t,e,r),this}send(t,e,r){return this.sendPacket("message",t,e,r),this}sendPacket(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:t,data:e,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():t()})):this.upgrading?r():t()),this}onError(t){ls.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let r=0;const n=t.length;for(;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}}ls.protocol=4,ls.protocol;const fs="function"==typeof ArrayBuffer,ds=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ps=Object.prototype.toString,bs="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ps.call(Blob),ys="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ps.call(File);function gs(t){return fs&&(t instanceof ArrayBuffer||ds(t))||bs&&t instanceof Blob||ys&&t instanceof File}function vs(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,r=t.length;e<r;e++)if(vs(t[e]))return!0;return!1}if(gs(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return vs(t.toJSON(),!0);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&vs(t[e]))return!0;return!1}function ms(t){const e=[],r=t.data,n=t;return n.data=ws(r,e),n.attachments=e.length,{packet:n,buffers:e}}function ws(t,e){if(!t)return t;if(gs(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=ws(t[n],e);return r}if("object"==typeof t&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=ws(t[n],e));return r}return t}function Ss(t,e){return t.data=_s(t.data,e),delete t.attachments,t}function _s(t,e){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=_s(t[r],e);else if("object"==typeof t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=_s(t[r],e));return t}const Es=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Os=5;var ks;!function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(ks||(ks={}));class xs{constructor(t){this.replacer=t}encode(t){return t.type!==ks.EVENT&&t.type!==ks.ACK||!vs(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===ks.EVENT?ks.BINARY_EVENT:ks.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==ks.BINARY_EVENT&&t.type!==ks.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=ms(t),r=this.encodeAsString(e.packet),n=e.buffers;return n.unshift(r),n}}function Ts(t){return"[object Object]"===Object.prototype.toString.call(t)}class As extends Bi{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const r=e.type===ks.BINARY_EVENT;r||e.type===ks.BINARY_ACK?(e.type=r?ks.EVENT:ks.ACK,this.reconstructor=new js(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!gs(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const r={type:Number(t.charAt(0))};if(void 0===ks[r.type])throw new Error("unknown packet type "+r.type);if(r.type===ks.BINARY_EVENT||r.type===ks.BINARY_ACK){const n=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);const i=t.substring(n,e);if(i!=Number(i)||"-"!==t.charAt(e))throw new Error("Illegal attachments");r.attachments=Number(i)}if("/"===t.charAt(e+1)){const n=e+1;for(;++e&&","!==t.charAt(e)&&e!==t.length;);r.nsp=t.substring(n,e)}else r.nsp="/";const n=t.charAt(e+1);if(""!==n&&Number(n)==n){const n=e+1;for(;++e;){const r=t.charAt(e);if(null==r||Number(r)!=r){--e;break}if(e===t.length)break}r.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){const n=this.tryParse(t.substr(e));if(!As.isPayloadValid(r.type,n))throw new Error("invalid payload");r.data=n}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case ks.CONNECT:return Ts(e);case ks.DISCONNECT:return void 0===e;case ks.CONNECT_ERROR:return"string"==typeof e||Ts(e);case ks.EVENT:case ks.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===Es.indexOf(e[0]));case ks.ACK:case ks.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class js{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=Ss(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Rs(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const Cs=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ls extends Bi{constructor(t,e,r){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=t,this.nsp=e,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Rs(t,"open",this.onopen.bind(this)),Rs(t,"packet",this.onpacket.bind(this)),Rs(t,"error",this.onerror.bind(this)),Rs(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(Cs.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:ks.EVENT,data:e,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,n=e.pop();this._registerAckCallback(t,n),r.id=t}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var r;const n=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===n)return void(this.acks[t]=e);const i=this.io.setTimeoutFn((()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,new Error("operation has timed out"))}),n),s=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...e){return new Promise(((r,n)=>{const i=(t,e)=>t?n(t):r(e);i.withError=!0,e.push(i),this.emit(t,...e)}))}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push(((t,...n)=>{if(r===this._queue[0])return null!==t?r.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...n)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth((t=>{this._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ks.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((t=>{if(!this.sendBuffer.some((e=>String(e.id)===t))){const e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}}))}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ks.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 ks.EVENT:case ks.BINARY_EVENT:this.onevent(t);break;case ks.ACK:case ks.BINARY_ACK:this.onack(t);break;case ks.DISCONNECT:this.ondisconnect();break;case ks.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const r of e)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let r=!1;return function(...n){r||(r=!0,e.packet({type:ks.ACK,id:t,data:n}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((t=>this.emitEvent(t))),this.receiveBuffer=[],this.sendBuffer.forEach((t=>{this.notifyOutgoingListeners(t),this.packet(t)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((t=>t())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ks.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const r of e)r.apply(this,t.data)}}}function Ds(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Ds.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+r:t-r}return 0|Math.min(t,this.max)},Ds.prototype.reset=function(){this.attempts=0},Ds.prototype.setMin=function(t){this.ms=t},Ds.prototype.setMax=function(t){this.max=t},Ds.prototype.setJitter=function(t){this.jitter=t};class Ps extends Bi{constructor(t,r){var n;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(r=t,t=void 0),(r=r||{}).path=r.path||"/socket.io",this.opts=r,Ui(this,r),this.reconnection(!1!==r.reconnection),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=r.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Ds({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==r.timeout?2e4:r.timeout),this._readyState="closed",this.uri=t;const i=r.parser||e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==r.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ls(this.uri,this.opts);const e=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=Rs(e,"open",(function(){r.onopen(),t&&t()})),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},s=Rs(e,"error",i);if(!1!==this._timeout){const t=this._timeout,r=this.setTimeoutFn((()=>{n(),i(new Error("timeout")),e.close()}),t);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}return this.subs.push(n),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Rs(t,"ping",this.onping.bind(this)),Rs(t,"data",this.ondata.bind(this)),Rs(t,"error",this.onerror.bind(this)),Rs(t,"close",this.onclose.bind(this)),Rs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){is((()=>{this.emitReserved("packet",t)}),this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Ls(this,t,e),this.nsps[t]=r),r}_destroy(t){const e=Object.keys(this.nsps);for(const t of e)if(this.nsps[t].active)return;this._close()}_packet(t){const e=this.encoder.encode(t);for(let r=0;r<e.length;r++)this.engine.write(e[r],t.options)}cleanup(){this.subs.forEach((t=>t())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()})))}),e);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Bs={};function Fs(t,e){"object"==typeof t&&(e=t,t=void 0);const r=function(t,e="",r){let n=t;r=r||"undefined"!=typeof location&&location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==r?r.protocol+"//"+t:"https://"+t),n=hs(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+e,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}(t,(e=e||{}).path||"/socket.io"),n=r.source,i=r.id,s=r.path,o=Bs[i]&&s in Bs[i].nsps;let a;return e.forceNew||e["force new connection"]||!1===e.multiplex||o?a=new Ps(n,e):(Bs[i]||(Bs[i]=new Ps(n,e)),a=Bs[i]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(Fs,{Manager:Ps,Socket:Ls,io:Fs,connect:Fs});class zs{manager;token;endpoint;get socket(){return this.manager.socket("/proxy",{auth:{token:`Bearer ${this.token}`}})}constructor(t,e){this.endpoint=t.replace("https://","wss://").replace("http://","ws://"),this.token=e,this.manager=new Ps(this.endpoint,{reconnection:!1,rejectUnauthorized:!1,autoConnect:!0,transports:["websocket"]})}createManager(){const t=new Ps(this.endpoint,{reconnection:!1,rejectUnauthorized:!1,autoConnect:!0,transports:["websocket"],forceNew:!0}),e=t.socket("/proxy",{auth:{token:`Bearer ${this.token}`}});return{manager:t,socket:e}}sendRequest(t,e){return e=e||this.socket,new Promise(((r,n)=>{e.emit("request",t,(t=>{t.success?r(t.data):n(t.error)}))}))}close(){this.socket.emit("end"),this.socket.removeAllListeners(),this.socket.disconnect()}}class Ns{api;socketService;config;logger;token;deviceManager;pluginsManager;systemManager;constructor(t){this.config=t,this.logger=t.logger||{...console,attention:console.warn},this.api=new fe(t.endpoint)}async connect(){return this.deviceManager&&this.pluginsManager&&this.systemManager||(this.cleanUpClient(),await this.login(),this.token=this.token||this.config.token,this.socketService=new zs(this.config.endpoint,this.token),this.deviceManager=new di(this.socketService,this.logger),this.pluginsManager=new pi(this.socketService,this.logger),this.systemManager=new bi(this.socketService,this.logger),this.checkSession()),{deviceManager:this.deviceManager,pluginsManager:this.pluginsManager,systemManager:this.systemManager}}async disconnect(){this.socketService?.close(),this.cleanUpClient(),this.config.username&&this.config.password&&await this.api.interceptor.post("/auth/logout",void 0,{headers:{Authorization:`Bearer ${this.token}`}})}async updateCredentials(t){this.config={...this.config,...t},this.socketService&&await this.disconnect(),await this.connect()}async login(){if(this.config.username&&this.config.password)try{const t=await this.api.interceptor.post("/auth/login",{username:this.config.username,password:this.config.password});this.token=t.data.access_token}catch(t){throw 401===t.response?.status?new Error("Invalid credentials"):new Error(`Failed to get token: ${t.message}`)}else if(this.config.token&&!this.config.skipCheck)try{await this.api.interceptor.get("/auth/check",{headers:{Authorization:`Bearer ${this.config.token}`}})}catch(t){throw new Error(`Invalid token: ${t.message}`)}this.token=this.token||this.config.token}getDeviceManager(){return this.deviceManager}getPluginsManager(){return this.pluginsManager}getSystemManager(){return this.systemManager}checkSession(){this.socketService?.socket.removeListener("invalidToken"),this.socketService?.socket.on("invalidToken",(async t=>{t===this.token&&await this.disconnect()}))}cleanUpClient(){this.deviceManager=void 0,this.pluginsManager=void 0,this.systemManager=void 0}}})();var i=n.j;export{i as CameraUiClient};
|
|
@@ -6,11 +6,13 @@ import type { CameraDevice } from '../types.js';
|
|
|
6
6
|
export declare class CameraDeviceProxy extends BaseCameraDevice implements CameraDevice {
|
|
7
7
|
private socketService;
|
|
8
8
|
private socket;
|
|
9
|
-
private
|
|
9
|
+
private _started;
|
|
10
|
+
get started(): boolean;
|
|
10
11
|
get sources(): CameraSource[];
|
|
11
12
|
constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
|
|
12
13
|
start(): void;
|
|
13
14
|
stop(): void;
|
|
15
|
+
close(): void;
|
|
14
16
|
connect(): Promise<void>;
|
|
15
17
|
disconnect(): Promise<void>;
|
|
16
18
|
reboot(): Promise<void>;
|
|
@@ -21,8 +21,10 @@ export interface BasicBrowserPeerConnection {
|
|
|
21
21
|
close(): void;
|
|
22
22
|
}
|
|
23
23
|
export interface CameraDevice extends BaseCameraDevice {
|
|
24
|
+
readonly started: boolean;
|
|
24
25
|
start(): void;
|
|
25
26
|
stop(): void;
|
|
27
|
+
close(): void;
|
|
26
28
|
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
27
29
|
createSession(sourceName: string, videoElement: HTMLVideoElement): Promise<StreamingSession>;
|
|
28
30
|
}
|
|
@@ -3,7 +3,7 @@ import type { Camera } from '../api/database/types.js';
|
|
|
3
3
|
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
4
4
|
import type { ProxyServer } from '../nats/index.js';
|
|
5
5
|
import type { IceServer } from '../services/config/types.js';
|
|
6
|
-
import type { BaseLogger, CameraSource } from './types.js';
|
|
6
|
+
import type { BaseLogger, CameraSource, SetValues } from './types.js';
|
|
7
7
|
export declare class CameraController extends CameraDevice {
|
|
8
8
|
private proxy;
|
|
9
9
|
private motionTimeout?;
|
|
@@ -20,6 +20,7 @@ export declare class CameraController extends CameraDevice {
|
|
|
20
20
|
getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
|
|
21
21
|
getFfmpegPath(): Promise<string>;
|
|
22
22
|
getIceServers(): Promise<IceServer[]>;
|
|
23
|
+
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
|
|
23
24
|
updateCamera(updatedCamera: Camera): void;
|
|
24
25
|
cleanup(): void;
|
|
25
26
|
private subscribeToCameraState;
|
|
@@ -72,14 +72,14 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
72
72
|
abstract getIceServers(): Promise<IceServer[]>;
|
|
73
73
|
protected abstract cleanup(): void;
|
|
74
74
|
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
75
|
-
updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
76
|
-
updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: Buffer): Promise<void>;
|
|
77
|
-
updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
78
|
-
updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
|
|
79
|
-
updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
80
|
-
updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
81
|
-
updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
82
|
-
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean
|
|
75
|
+
abstract updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
76
|
+
abstract updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: Buffer): Promise<void>;
|
|
77
|
+
abstract updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
78
|
+
abstract updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
|
|
79
|
+
abstract updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
80
|
+
abstract updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
81
|
+
abstract updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
82
|
+
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): void;
|
|
83
83
|
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
84
84
|
newState: StateValues[T];
|
|
85
85
|
oldState: StateValues[T];
|
|
@@ -102,7 +102,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
102
102
|
protected getBatteryState(event: BatterySetEvent): BatteryState;
|
|
103
103
|
protected updateCamera(updatedCamera: Camera): void;
|
|
104
104
|
protected updatePrebuffer(sourceId: string, container: Container, state: PrebufferState): Promise<void>;
|
|
105
|
-
|
|
105
|
+
private updateCameraSourcesState;
|
|
106
106
|
protected updateCameraState(state: boolean): void;
|
|
107
107
|
protected cameraSourcePrebufferState(sourceId: string, container: Container): PrebufferState;
|
|
108
108
|
private createStateObservable;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Detection, DetectionZone } from './types.js';
|
|
2
|
+
export declare const convertZonePointsToPixels: (zone: DetectionZone, detection: Detection) => DetectionZone;
|
|
3
|
+
export declare const convertBoundingBoxToPixels: (detection: Detection) => Detection;
|
|
2
4
|
export declare const areObjectDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
|
|
3
5
|
export declare const areMotionDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/seydx/camera.ui)",
|
|
6
6
|
"module": "./dist/bundle.js",
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@rushstack/eslint-patch": "^1.10.3",
|
|
35
35
|
"@swc/register": "^0.1.10",
|
|
36
|
+
"@types/lodash.clonedeep": "^4.5.9",
|
|
37
|
+
"@types/lodash.isequal": "^4.5.8",
|
|
36
38
|
"@types/webrtc": "^0.0.43",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
38
|
-
"@typescript-eslint/parser": "^7.
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
40
|
+
"@typescript-eslint/parser": "^7.12.0",
|
|
39
41
|
"bufferutil": "^4.0.8",
|
|
40
42
|
"eslint": "^8.57.0",
|
|
41
43
|
"eslint-config-prettier": "^9.1.0",
|