@sawport/peers-caller 1.0.0-alpha.6 → 1.0.0-alpha.8

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.
@@ -1,15 +1,15 @@
1
- (function(){te.apply(null,ge)},0)}});typeof global=="undefined"&&(globalThis.global=globalThis);(function(te,ge){typeof exports=="object"&&typeof module!="undefined"?ge(exports,require("socket.io-client"),require("zustand"),require("react")):typeof define=="function"&&define.amd?define(["exports","socket.io-client","zustand","react"],ge):(te=typeof globalThis!="undefined"?globalThis:te||self,ge(te.PeersCaller={},te.io,te.zustand,te.React))})(this,function(te,ge,Ie,ue){"use strict";var El=Object.defineProperty,Cl=Object.defineProperties;var Rl=Object.getOwnPropertyDescriptors;var Ft=Object.getOwnPropertySymbols;var Ko=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var oe=Math.pow,Bn=(te,ge,Ie)=>ge in te?El(te,ge,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):te[ge]=Ie,St=(te,ge)=>{for(var Ie in ge||(ge={}))Ko.call(ge,Ie)&&Bn(te,Ie,ge[Ie]);if(Ft)for(var Ie of Ft(ge))Xo.call(ge,Ie)&&Bn(te,Ie,ge[Ie]);return te},kn=(te,ge)=>Cl(te,Rl(ge));var On=(te,ge)=>{var Ie={};for(var ue in te)Ko.call(te,ue)&&ge.indexOf(ue)<0&&(Ie[ue]=te[ue]);if(te!=null&&Ft)for(var ue of Ft(te))ge.indexOf(ue)<0&&Xo.call(te,ue)&&(Ie[ue]=te[ue]);return Ie};var ze=(te,ge,Ie)=>Bn(te,typeof ge!="symbol"?ge+"":ge,Ie);typeof process=="undefined"&&(globalThis.process={env:{},browser:!0,version:"v18.0.0",platform:"browser",nextTick:function(te){var ge=Array.prototype.slice.call(arguments,1);if(typeof MessageChannel!="undefined"){var Ie=new MessageChannel;Ie.port2.onmessage=function(){te.apply(null,ge)},Ie.port1.postMessage(null)}else setTimeoutfunction Zo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mn={exports:{}},Be=Mn.exports={},He,Je;function Ut(){throw new Error("setTimeout has not been defined")}function $t(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?He=setTimeout:He=Ut}catch(r){He=Ut}try{typeof clearTimeout=="function"?Je=clearTimeout:Je=$t}catch(r){Je=$t}})();function Ln(r){if(He===setTimeout)return setTimeout(r,0);if((He===Ut||!He)&&setTimeout)return He=setTimeout,setTimeout(r,0);try{return He(r,0)}catch(e){try{return He.call(null,r,0)}catch(t){return He.call(this,r,0)}}}function Qo(r){if(Je===clearTimeout)return clearTimeout(r);if((Je===$t||!Je)&&clearTimeout)return Je=clearTimeout,clearTimeout(r);try{return Je(r)}catch(e){try{return Je.call(null,r)}catch(t){return Je.call(this,r)}}}var Qe=[],st=!1,nt,_t=-1;function ea(){!st||!nt||(st=!1,nt.length?Qe=nt.concat(Qe):_t=-1,Qe.length&&Nn())}function Nn(){if(!st){var r=Ln(ea);st=!0;for(var e=Qe.length;e;){for(nt=Qe,Qe=[];++_t<e;)nt&&nt[_t].run();_t=-1,e=Qe.length}nt=null,st=!1,Qo(r)}}Be.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];Qe.push(new Dn(r,e)),Qe.length===1&&!st&&Ln(Nn)};function Dn(r,e){this.fun=r,this.array=e}Dn.prototype.run=function(){this.fun.apply(null,this.array)},Be.title="browser",Be.browser=!0,Be.env={},Be.argv=[],Be.version="",Be.versions={};function et(){}Be.on=et,Be.addListener=et,Be.once=et,Be.off=et,Be.removeListener=et,Be.removeAllListeners=et,Be.emit=et,Be.prependListener=et,Be.prependOnceListener=et,Be.listeners=function(r){return[]},Be.binding=function(r){throw new Error("process.binding is not supported")},Be.cwd=function(){return"/"},Be.chdir=function(r){throw new Error("process.chdir is not supported")},Be.umask=function(){return 0};var ta=Mn.exports;const ae=Zo(ta);var Fn={},Et={};Et.byteLength=ia,Et.toByteArray=aa,Et.fromByteArray=ca;for(var Ye=[],xe=[],ra=typeof Uint8Array!="undefined"?Uint8Array:Array,jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lt=0,na=jt.length;lt<na;++lt)Ye[lt]=jt[lt],xe[jt.charCodeAt(lt)]=lt;xe[45]=62,xe[95]=63;function Un(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var s=t===e?0:4-t%4;return[t,s]}function ia(r){var e=Un(r),t=e[0],s=e[1];return(t+s)*3/4-s}function oa(r,e,t){return(e+t)*3/4-t}function aa(r){var e,t=Un(r),s=t[0],u=t[1],l=new ra(oa(r,s,u)),g=0,f=u>0?s-4:s,c;for(c=0;c<f;c+=4)e=xe[r.charCodeAt(c)]<<18|xe[r.charCodeAt(c+1)]<<12|xe[r.charCodeAt(c+2)]<<6|xe[r.charCodeAt(c+3)],l[g++]=e>>16&255,l[g++]=e>>8&255,l[g++]=e&255;return u===2&&(e=xe[r.charCodeAt(c)]<<2|xe[r.charCodeAt(c+1)]>>4,l[g++]=e&255),u===1&&(e=xe[r.charCodeAt(c)]<<10|xe[r.charCodeAt(c+1)]<<4|xe[r.charCodeAt(c+2)]>>2,l[g++]=e>>8&255,l[g++]=e&255),l}function sa(r){return Ye[r>>18&63]+Ye[r>>12&63]+Ye[r>>6&63]+Ye[r&63]}function la(r,e,t){for(var s,u=[],l=e;l<t;l+=3)s=(r[l]<<16&16711680)+(r[l+1]<<8&65280)+(r[l+2]&255),u.push(sa(s));return u.join("")}function ca(r){for(var e,t=r.length,s=t%3,u=[],l=16383,g=0,f=t-s;g<f;g+=l)u.push(la(r,g,g+l>f?f:g+l));return s===1?(e=r[t-1],u.push(Ye[e>>2]+Ye[e<<4&63]+"==")):s===2&&(e=(r[t-2]<<8)+r[t-1],u.push(Ye[e>>10]+Ye[e>>4&63]+Ye[e<<2&63]+"=")),u.join("")}var qt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */qt.read=function(r,e,t,s,u){var l,g,f=u*8-s-1,c=(1<<f)-1,v=c>>1,h=-7,I=t?u-1:0,B=t?-1:1,x=r[e+I];for(I+=B,l=x&(1<<-h)-1,x>>=-h,h+=f;h>0;l=l*256+r[e+I],I+=B,h-=8);for(g=l&(1<<-h)-1,l>>=-h,h+=s;h>0;g=g*256+r[e+I],I+=B,h-=8);if(l===0)l=1-v;else{if(l===c)return g?NaN:(x?-1:1)*(1/0);g=g+Math.pow(2,s),l=l-v}return(x?-1:1)*g*Math.pow(2,l-s)},qt.write=function(r,e,t,s,u,l){var g,f,c,v=l*8-u-1,h=(1<<v)-1,I=h>>1,B=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=s?0:l-1,b=s?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,g=h):(g=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-g))<1&&(g--,c*=2),g+I>=1?e+=B/c:e+=B*Math.pow(2,1-I),e*c>=2&&(g++,c/=2),g+I>=h?(f=0,g=h):g+I>=1?(f=(e*c-1)*Math.pow(2,u),g=g+I):(f=e*Math.pow(2,I-1)*Math.pow(2,u),g=0));u>=8;r[t+x]=f&255,x+=b,f/=256,u-=8);for(g=g<<u|f,v+=u;v>0;r[t+x]=g&255,x+=b,g/=256,v-=8);r[t+x-b]|=N*128};/*!
1
+ (function(){te.apply(null,ge)},0)}});typeof global=="undefined"&&(globalThis.global=globalThis);(function(te,ge){typeof exports=="object"&&typeof module!="undefined"?ge(exports,require("socket.io-client"),require("zustand"),require("react")):typeof define=="function"&&define.amd?define(["exports","socket.io-client","zustand","react"],ge):(te=typeof globalThis!="undefined"?globalThis:te||self,ge(te.PeersCaller={},te.io,te.zustand,te.React))})(this,function(te,ge,Ie,ue){"use strict";var El=Object.defineProperty,Cl=Object.defineProperties;var Rl=Object.getOwnPropertyDescriptors;var Ft=Object.getOwnPropertySymbols;var Ko=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var oe=Math.pow,Bn=(te,ge,Ie)=>ge in te?El(te,ge,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):te[ge]=Ie,St=(te,ge)=>{for(var Ie in ge||(ge={}))Ko.call(ge,Ie)&&Bn(te,Ie,ge[Ie]);if(Ft)for(var Ie of Ft(ge))Xo.call(ge,Ie)&&Bn(te,Ie,ge[Ie]);return te},kn=(te,ge)=>Cl(te,Rl(ge));var On=(te,ge)=>{var Ie={};for(var ue in te)Ko.call(te,ue)&&ge.indexOf(ue)<0&&(Ie[ue]=te[ue]);if(te!=null&&Ft)for(var ue of Ft(te))ge.indexOf(ue)<0&&Xo.call(te,ue)&&(Ie[ue]=te[ue]);return Ie};var ze=(te,ge,Ie)=>Bn(te,typeof ge!="symbol"?ge+"":ge,Ie);typeof process=="undefined"&&(globalThis.process={env:{},browser:!0,version:"v18.0.0",platform:"browser",nextTick:function(te){var ge=Array.prototype.slice.call(arguments,1);if(typeof MessageChannel!="undefined"){var Ie=new MessageChannel;Ie.port2.onmessage=function(){te.apply(null,ge)},Ie.port1.postMessage(null)}else setTimeoutfunction Zo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mn={exports:{}},Be=Mn.exports={},He,Je;function Ut(){throw new Error("setTimeout has not been defined")}function $t(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?He=setTimeout:He=Ut}catch(r){He=Ut}try{typeof clearTimeout=="function"?Je=clearTimeout:Je=$t}catch(r){Je=$t}})();function Ln(r){if(He===setTimeout)return setTimeout(r,0);if((He===Ut||!He)&&setTimeout)return He=setTimeout,setTimeout(r,0);try{return He(r,0)}catch(e){try{return He.call(null,r,0)}catch(t){return He.call(this,r,0)}}}function Qo(r){if(Je===clearTimeout)return clearTimeout(r);if((Je===$t||!Je)&&clearTimeout)return Je=clearTimeout,clearTimeout(r);try{return Je(r)}catch(e){try{return Je.call(null,r)}catch(t){return Je.call(this,r)}}}var Qe=[],st=!1,nt,_t=-1;function ea(){!st||!nt||(st=!1,nt.length?Qe=nt.concat(Qe):_t=-1,Qe.length&&Nn())}function Nn(){if(!st){var r=Ln(ea);st=!0;for(var e=Qe.length;e;){for(nt=Qe,Qe=[];++_t<e;)nt&&nt[_t].run();_t=-1,e=Qe.length}nt=null,st=!1,Qo(r)}}Be.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];Qe.push(new Dn(r,e)),Qe.length===1&&!st&&Ln(Nn)};function Dn(r,e){this.fun=r,this.array=e}Dn.prototype.run=function(){this.fun.apply(null,this.array)},Be.title="browser",Be.browser=!0,Be.env={},Be.argv=[],Be.version="",Be.versions={};function et(){}Be.on=et,Be.addListener=et,Be.once=et,Be.off=et,Be.removeListener=et,Be.removeAllListeners=et,Be.emit=et,Be.prependListener=et,Be.prependOnceListener=et,Be.listeners=function(r){return[]},Be.binding=function(r){throw new Error("process.binding is not supported")},Be.cwd=function(){return"/"},Be.chdir=function(r){throw new Error("process.chdir is not supported")},Be.umask=function(){return 0};var ta=Mn.exports;const ae=Zo(ta);var Fn={},Et={};Et.byteLength=ia,Et.toByteArray=aa,Et.fromByteArray=ca;for(var Ye=[],xe=[],ra=typeof Uint8Array!="undefined"?Uint8Array:Array,jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lt=0,na=jt.length;lt<na;++lt)Ye[lt]=jt[lt],xe[jt.charCodeAt(lt)]=lt;xe[45]=62,xe[95]=63;function Un(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var s=t===e?0:4-t%4;return[t,s]}function ia(r){var e=Un(r),t=e[0],s=e[1];return(t+s)*3/4-s}function oa(r,e,t){return(e+t)*3/4-t}function aa(r){var e,t=Un(r),s=t[0],f=t[1],l=new ra(oa(r,s,f)),g=0,u=f>0?s-4:s,c;for(c=0;c<u;c+=4)e=xe[r.charCodeAt(c)]<<18|xe[r.charCodeAt(c+1)]<<12|xe[r.charCodeAt(c+2)]<<6|xe[r.charCodeAt(c+3)],l[g++]=e>>16&255,l[g++]=e>>8&255,l[g++]=e&255;return f===2&&(e=xe[r.charCodeAt(c)]<<2|xe[r.charCodeAt(c+1)]>>4,l[g++]=e&255),f===1&&(e=xe[r.charCodeAt(c)]<<10|xe[r.charCodeAt(c+1)]<<4|xe[r.charCodeAt(c+2)]>>2,l[g++]=e>>8&255,l[g++]=e&255),l}function sa(r){return Ye[r>>18&63]+Ye[r>>12&63]+Ye[r>>6&63]+Ye[r&63]}function la(r,e,t){for(var s,f=[],l=e;l<t;l+=3)s=(r[l]<<16&16711680)+(r[l+1]<<8&65280)+(r[l+2]&255),f.push(sa(s));return f.join("")}function ca(r){for(var e,t=r.length,s=t%3,f=[],l=16383,g=0,u=t-s;g<u;g+=l)f.push(la(r,g,g+l>u?u:g+l));return s===1?(e=r[t-1],f.push(Ye[e>>2]+Ye[e<<4&63]+"==")):s===2&&(e=(r[t-2]<<8)+r[t-1],f.push(Ye[e>>10]+Ye[e>>4&63]+Ye[e<<2&63]+"=")),f.join("")}var qt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */qt.read=function(r,e,t,s,f){var l,g,u=f*8-s-1,c=(1<<u)-1,v=c>>1,h=-7,I=t?f-1:0,B=t?-1:1,x=r[e+I];for(I+=B,l=x&(1<<-h)-1,x>>=-h,h+=u;h>0;l=l*256+r[e+I],I+=B,h-=8);for(g=l&(1<<-h)-1,l>>=-h,h+=s;h>0;g=g*256+r[e+I],I+=B,h-=8);if(l===0)l=1-v;else{if(l===c)return g?NaN:(x?-1:1)*(1/0);g=g+Math.pow(2,s),l=l-v}return(x?-1:1)*g*Math.pow(2,l-s)},qt.write=function(r,e,t,s,f,l){var g,u,c,v=l*8-f-1,h=(1<<v)-1,I=h>>1,B=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=s?0:l-1,b=s?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,g=h):(g=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-g))<1&&(g--,c*=2),g+I>=1?e+=B/c:e+=B*Math.pow(2,1-I),e*c>=2&&(g++,c/=2),g+I>=h?(u=0,g=h):g+I>=1?(u=(e*c-1)*Math.pow(2,f),g=g+I):(u=e*Math.pow(2,I-1)*Math.pow(2,f),g=0));f>=8;r[t+x]=u&255,x+=b,u/=256,f-=8);for(g=g<<f|u,v+=f;v>0;r[t+x]=g&255,x+=b,g/=256,v-=8);r[t+x-b]|=N*128};/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
5
5
  * @license MIT
6
- */(function(r){const e=Et,t=qt,s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=h,r.SlowBuffer=k,r.INSPECT_MAX_BYTES=50;const u=2147483647;r.kMaxLength=u;const{Uint8Array:l,ArrayBuffer:g,SharedArrayBuffer:f}=globalThis;h.TYPED_ARRAY_SUPPORT=c(),!h.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const d=new l(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,l.prototype),Object.setPrototypeOf(d,n),d.foo()===42}catch(d){return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}});function v(d){if(d>u)throw new RangeError('The value "'+d+'" is invalid for option "size"');const n=new l(d);return Object.setPrototypeOf(n,h.prototype),n}function h(d,n,o){if(typeof d=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(d)}return I(d,n,o)}h.poolSize=8192;function I(d,n,o){if(typeof d=="string")return N(d,n);if(g.isView(d))return m(d);if(d==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof d);if(Ne(d,g)||d&&Ne(d.buffer,g)||typeof f!="undefined"&&(Ne(d,f)||d&&Ne(d.buffer,f)))return R(d,n,o);if(typeof d=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const _=d.valueOf&&d.valueOf();if(_!=null&&_!==d)return h.from(_,n,o);const O=A(d);if(O)return O;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof d[Symbol.toPrimitive]=="function")return h.from(d[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof d)}h.from=function(d,n,o){return I(d,n,o)},Object.setPrototypeOf(h.prototype,l.prototype),Object.setPrototypeOf(h,l);function B(d){if(typeof d!="number")throw new TypeError('"size" argument must be of type number');if(d<0)throw new RangeError('The value "'+d+'" is invalid for option "size"')}function x(d,n,o){return B(d),d<=0?v(d):n!==void 0?typeof o=="string"?v(d).fill(n,o):v(d).fill(n):v(d)}h.alloc=function(d,n,o){return x(d,n,o)};function b(d){return B(d),v(d<0?0:P(d)|0)}h.allocUnsafe=function(d){return b(d)},h.allocUnsafeSlow=function(d){return b(d)};function N(d,n){if((typeof n!="string"||n==="")&&(n="utf8"),!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const o=S(d,n)|0;let _=v(o);const O=_.write(d,n);return O!==o&&(_=_.slice(0,O)),_}function T(d){const n=d.length<0?0:P(d.length)|0,o=v(n);for(let _=0;_<n;_+=1)o[_]=d[_]&255;return o}function m(d){if(Ne(d,l)){const n=new l(d);return R(n.buffer,n.byteOffset,n.byteLength)}return T(d)}function R(d,n,o){if(n<0||d.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(d.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let _;return n===void 0&&o===void 0?_=new l(d):o===void 0?_=new l(d,n):_=new l(d,n,o),Object.setPrototypeOf(_,h.prototype),_}function A(d){if(h.isBuffer(d)){const n=P(d.length)|0,o=v(n);return o.length===0||d.copy(o,0,0,n),o}if(d.length!==void 0)return typeof d.length!="number"||We(d.length)?v(0):T(d);if(d.type==="Buffer"&&Array.isArray(d.data))return T(d.data)}function P(d){if(d>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return d|0}function k(d){return+d!=d&&(d=0),h.alloc(+d)}h.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==h.prototype},h.compare=function(n,o){if(Ne(n,l)&&(n=h.from(n,n.offset,n.byteLength)),Ne(o,l)&&(o=h.from(o,o.offset,o.byteLength)),!h.isBuffer(n)||!h.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let _=n.length,O=o.length;for(let j=0,Y=Math.min(_,O);j<Y;++j)if(n[j]!==o[j]){_=n[j],O=o[j];break}return _<O?-1:O<_?1:0},h.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return h.alloc(0);let _;if(o===void 0)for(o=0,_=0;_<n.length;++_)o+=n[_].length;const O=h.allocUnsafe(o);let j=0;for(_=0;_<n.length;++_){let Y=n[_];if(Ne(Y,l))j+Y.length>O.length?(h.isBuffer(Y)||(Y=h.from(Y)),Y.copy(O,j)):l.prototype.set.call(O,Y,j);else if(h.isBuffer(Y))Y.copy(O,j);else throw new TypeError('"list" argument must be an Array of Buffers');j+=Y.length}return O};function S(d,n){if(h.isBuffer(d))return d.length;if(g.isView(d)||Ne(d,g))return d.byteLength;if(typeof d!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof d);const o=d.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&o===0)return 0;let O=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Fe(d).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return we(d).length;default:if(O)return _?-1:Fe(d).length;n=(""+n).toLowerCase(),O=!0}}h.byteLength=S;function C(d,n,o){let _=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(d||(d="utf8");;)switch(d){case"hex":return $(this,n,o);case"utf8":case"utf-8":return ke(this,n,o);case"ascii":return Oe(this,n,o);case"latin1":case"binary":return qe(this,n,o);case"base64":return Pe(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,n,o);default:if(_)throw new TypeError("Unknown encoding: "+d);d=(d+"").toLowerCase(),_=!0}}h.prototype._isBuffer=!0;function M(d,n,o){const _=d[n];d[n]=d[o],d[o]=_}h.prototype.swap16=function(){const n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<n;o+=2)M(this,o,o+1);return this},h.prototype.swap32=function(){const n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<n;o+=4)M(this,o,o+3),M(this,o+1,o+2);return this},h.prototype.swap64=function(){const n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<n;o+=8)M(this,o,o+7),M(this,o+1,o+6),M(this,o+2,o+5),M(this,o+3,o+4);return this},h.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?ke(this,0,n):C.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(n){if(!h.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:h.compare(this,n)===0},h.prototype.inspect=function(){let n="";const o=r.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},s&&(h.prototype[s]=h.prototype.inspect),h.prototype.compare=function(n,o,_,O,j){if(Ne(n,l)&&(n=h.from(n,n.offset,n.byteLength)),!h.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),_===void 0&&(_=n?n.length:0),O===void 0&&(O=0),j===void 0&&(j=this.length),o<0||_>n.length||O<0||j>this.length)throw new RangeError("out of range index");if(O>=j&&o>=_)return 0;if(O>=j)return-1;if(o>=_)return 1;if(o>>>=0,_>>>=0,O>>>=0,j>>>=0,this===n)return 0;let Y=j-O,ce=_-o;const be=Math.min(Y,ce),Se=this.slice(O,j),Ce=n.slice(o,_);for(let pe=0;pe<be;++pe)if(Se[pe]!==Ce[pe]){Y=Se[pe],ce=Ce[pe];break}return Y<ce?-1:ce<Y?1:0};function W(d,n,o,_,O){if(d.length===0)return-1;if(typeof o=="string"?(_=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,We(o)&&(o=O?0:d.length-1),o<0&&(o=d.length+o),o>=d.length){if(O)return-1;o=d.length-1}else if(o<0)if(O)o=0;else return-1;if(typeof n=="string"&&(n=h.from(n,_)),h.isBuffer(n))return n.length===0?-1:X(d,n,o,_,O);if(typeof n=="number")return n=n&255,typeof l.prototype.indexOf=="function"?O?l.prototype.indexOf.call(d,n,o):l.prototype.lastIndexOf.call(d,n,o):X(d,[n],o,_,O);throw new TypeError("val must be string, number or Buffer")}function X(d,n,o,_,O){let j=1,Y=d.length,ce=n.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(d.length<2||n.length<2)return-1;j=2,Y/=2,ce/=2,o/=2}function be(Ce,pe){return j===1?Ce[pe]:Ce.readUInt16BE(pe*j)}let Se;if(O){let Ce=-1;for(Se=o;Se<Y;Se++)if(be(d,Se)===be(n,Ce===-1?0:Se-Ce)){if(Ce===-1&&(Ce=Se),Se-Ce+1===ce)return Ce*j}else Ce!==-1&&(Se-=Se-Ce),Ce=-1}else for(o+ce>Y&&(o=Y-ce),Se=o;Se>=0;Se--){let Ce=!0;for(let pe=0;pe<ce;pe++)if(be(d,Se+pe)!==be(n,pe)){Ce=!1;break}if(Ce)return Se}return-1}h.prototype.includes=function(n,o,_){return this.indexOf(n,o,_)!==-1},h.prototype.indexOf=function(n,o,_){return W(this,n,o,_,!0)},h.prototype.lastIndexOf=function(n,o,_){return W(this,n,o,_,!1)};function re(d,n,o,_){o=Number(o)||0;const O=d.length-o;_?(_=Number(_),_>O&&(_=O)):_=O;const j=n.length;_>j/2&&(_=j/2);let Y;for(Y=0;Y<_;++Y){const ce=parseInt(n.substr(Y*2,2),16);if(We(ce))return Y;d[o+Y]=ce}return Y}function U(d,n,o,_){return $e(Fe(n,d.length-o),d,o,_)}function he(d,n,o,_){return $e(Ue(n),d,o,_)}function de(d,n,o,_){return $e(we(n),d,o,_)}function me(d,n,o,_){return $e(ye(n,d.length-o),d,o,_)}h.prototype.write=function(n,o,_,O){if(o===void 0)O="utf8",_=this.length,o=0;else if(_===void 0&&typeof o=="string")O=o,_=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(_)?(_=_>>>0,O===void 0&&(O="utf8")):(O=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const j=this.length-o;if((_===void 0||_>j)&&(_=j),n.length>0&&(_<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let Y=!1;for(;;)switch(O){case"hex":return re(this,n,o,_);case"utf8":case"utf-8":return U(this,n,o,_);case"ascii":case"latin1":case"binary":return he(this,n,o,_);case"base64":return de(this,n,o,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,n,o,_);default:if(Y)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),Y=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pe(d,n,o){return n===0&&o===d.length?e.fromByteArray(d):e.fromByteArray(d.slice(n,o))}function ke(d,n,o){o=Math.min(d.length,o);const _=[];let O=n;for(;O<o;){const j=d[O];let Y=null,ce=j>239?4:j>223?3:j>191?2:1;if(O+ce<=o){let be,Se,Ce,pe;switch(ce){case 1:j<128&&(Y=j);break;case 2:be=d[O+1],(be&192)===128&&(pe=(j&31)<<6|be&63,pe>127&&(Y=pe));break;case 3:be=d[O+1],Se=d[O+2],(be&192)===128&&(Se&192)===128&&(pe=(j&15)<<12|(be&63)<<6|Se&63,pe>2047&&(pe<55296||pe>57343)&&(Y=pe));break;case 4:be=d[O+1],Se=d[O+2],Ce=d[O+3],(be&192)===128&&(Se&192)===128&&(Ce&192)===128&&(pe=(j&15)<<18|(be&63)<<12|(Se&63)<<6|Ce&63,pe>65535&&pe<1114112&&(Y=pe))}}Y===null?(Y=65533,ce=1):Y>65535&&(Y-=65536,_.push(Y>>>10&1023|55296),Y=56320|Y&1023),_.push(Y),O+=ce}return _e(_)}const Ee=4096;function _e(d){const n=d.length;if(n<=Ee)return String.fromCharCode.apply(String,d);let o="",_=0;for(;_<n;)o+=String.fromCharCode.apply(String,d.slice(_,_+=Ee));return o}function Oe(d,n,o){let _="";o=Math.min(d.length,o);for(let O=n;O<o;++O)_+=String.fromCharCode(d[O]&127);return _}function qe(d,n,o){let _="";o=Math.min(d.length,o);for(let O=n;O<o;++O)_+=String.fromCharCode(d[O]);return _}function $(d,n,o){const _=d.length;(!n||n<0)&&(n=0),(!o||o<0||o>_)&&(o=_);let O="";for(let j=n;j<o;++j)O+=Ve[d[j]];return O}function V(d,n,o){const _=d.slice(n,o);let O="";for(let j=0;j<_.length-1;j+=2)O+=String.fromCharCode(_[j]+_[j+1]*256);return O}h.prototype.slice=function(n,o){const _=this.length;n=~~n,o=o===void 0?_:~~o,n<0?(n+=_,n<0&&(n=0)):n>_&&(n=_),o<0?(o+=_,o<0&&(o=0)):o>_&&(o=_),o<n&&(o=n);const O=this.subarray(n,o);return Object.setPrototypeOf(O,h.prototype),O};function J(d,n,o){if(d%1!==0||d<0)throw new RangeError("offset is not uint");if(d+n>o)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=this[n],j=1,Y=0;for(;++Y<o&&(j*=256);)O+=this[n+Y]*j;return O},h.prototype.readUintBE=h.prototype.readUIntBE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=this[n+--o],j=1;for(;o>0&&(j*=256);)O+=this[n+--o]*j;return O},h.prototype.readUint8=h.prototype.readUInt8=function(n,o){return n=n>>>0,o||J(n,1,this.length),this[n]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||J(n,2,this.length),this[n]|this[n+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||J(n,2,this.length),this[n]<<8|this[n+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||J(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||J(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},h.prototype.readBigUInt64LE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=o+this[++n]*oe(2,8)+this[++n]*oe(2,16)+this[++n]*oe(2,24),j=this[++n]+this[++n]*oe(2,8)+this[++n]*oe(2,16)+_*oe(2,24);return BigInt(O)+(BigInt(j)<<BigInt(32))}),h.prototype.readBigUInt64BE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=o*oe(2,24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+this[++n],j=this[++n]*oe(2,24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+_;return(BigInt(O)<<BigInt(32))+BigInt(j)}),h.prototype.readIntLE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=this[n],j=1,Y=0;for(;++Y<o&&(j*=256);)O+=this[n+Y]*j;return j*=128,O>=j&&(O-=Math.pow(2,8*o)),O},h.prototype.readIntBE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=o,j=1,Y=this[n+--O];for(;O>0&&(j*=256);)Y+=this[n+--O]*j;return j*=128,Y>=j&&(Y-=Math.pow(2,8*o)),Y},h.prototype.readInt8=function(n,o){return n=n>>>0,o||J(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},h.prototype.readInt16LE=function(n,o){n=n>>>0,o||J(n,2,this.length);const _=this[n]|this[n+1]<<8;return _&32768?_|4294901760:_},h.prototype.readInt16BE=function(n,o){n=n>>>0,o||J(n,2,this.length);const _=this[n+1]|this[n]<<8;return _&32768?_|4294901760:_},h.prototype.readInt32LE=function(n,o){return n=n>>>0,o||J(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},h.prototype.readInt32BE=function(n,o){return n=n>>>0,o||J(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},h.prototype.readBigInt64LE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=this[n+4]+this[n+5]*oe(2,8)+this[n+6]*oe(2,16)+(_<<24);return(BigInt(O)<<BigInt(32))+BigInt(o+this[++n]*oe(2,8)+this[++n]*oe(2,16)+this[++n]*oe(2,24))}),h.prototype.readBigInt64BE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=(o<<24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+this[++n];return(BigInt(O)<<BigInt(32))+BigInt(this[++n]*oe(2,24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+_)}),h.prototype.readFloatLE=function(n,o){return n=n>>>0,o||J(n,4,this.length),t.read(this,n,!0,23,4)},h.prototype.readFloatBE=function(n,o){return n=n>>>0,o||J(n,4,this.length),t.read(this,n,!1,23,4)},h.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||J(n,8,this.length),t.read(this,n,!0,52,8)},h.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||J(n,8,this.length),t.read(this,n,!1,52,8)};function ne(d,n,o,_,O,j){if(!h.isBuffer(d))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>O||n<j)throw new RangeError('"value" argument is out of bounds');if(o+_>d.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(n,o,_,O){if(n=+n,o=o>>>0,_=_>>>0,!O){const ce=Math.pow(2,8*_)-1;ne(this,n,o,_,ce,0)}let j=1,Y=0;for(this[o]=n&255;++Y<_&&(j*=256);)this[o+Y]=n/j&255;return o+_},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(n,o,_,O){if(n=+n,o=o>>>0,_=_>>>0,!O){const ce=Math.pow(2,8*_)-1;ne(this,n,o,_,ce,0)}let j=_-1,Y=1;for(this[o+j]=n&255;--j>=0&&(Y*=256);)this[o+j]=n/Y&255;return o+_},h.prototype.writeUint8=h.prototype.writeUInt8=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,1,255,0),this[o]=n&255,o+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function D(d,n,o,_,O){le(n,_,O,d,o,7);let j=Number(n&BigInt(4294967295));d[o++]=j,j=j>>8,d[o++]=j,j=j>>8,d[o++]=j,j=j>>8,d[o++]=j;let Y=Number(n>>BigInt(32)&BigInt(4294967295));return d[o++]=Y,Y=Y>>8,d[o++]=Y,Y=Y>>8,d[o++]=Y,Y=Y>>8,d[o++]=Y,o}function F(d,n,o,_,O){le(n,_,O,d,o,7);let j=Number(n&BigInt(4294967295));d[o+7]=j,j=j>>8,d[o+6]=j,j=j>>8,d[o+5]=j,j=j>>8,d[o+4]=j;let Y=Number(n>>BigInt(32)&BigInt(4294967295));return d[o+3]=Y,Y=Y>>8,d[o+2]=Y,Y=Y>>8,d[o+1]=Y,Y=Y>>8,d[o]=Y,o+8}h.prototype.writeBigUInt64LE=Me(function(n,o=0){return D(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=Me(function(n,o=0){return F(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(n,o,_,O){if(n=+n,o=o>>>0,!O){const be=Math.pow(2,8*_-1);ne(this,n,o,_,be-1,-be)}let j=0,Y=1,ce=0;for(this[o]=n&255;++j<_&&(Y*=256);)n<0&&ce===0&&this[o+j-1]!==0&&(ce=1),this[o+j]=(n/Y>>0)-ce&255;return o+_},h.prototype.writeIntBE=function(n,o,_,O){if(n=+n,o=o>>>0,!O){const be=Math.pow(2,8*_-1);ne(this,n,o,_,be-1,-be)}let j=_-1,Y=1,ce=0;for(this[o+j]=n&255;--j>=0&&(Y*=256);)n<0&&ce===0&&this[o+j+1]!==0&&(ce=1),this[o+j]=(n/Y>>0)-ce&255;return o+_},h.prototype.writeInt8=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},h.prototype.writeInt16LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},h.prototype.writeInt16BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},h.prototype.writeInt32LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},h.prototype.writeInt32BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},h.prototype.writeBigInt64LE=Me(function(n,o=0){return D(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=Me(function(n,o=0){return F(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function G(d,n,o,_,O,j){if(o+_>d.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Z(d,n,o,_,O){return n=+n,o=o>>>0,O||G(d,n,o,4),t.write(d,n,o,_,23,4),o+4}h.prototype.writeFloatLE=function(n,o,_){return Z(this,n,o,!0,_)},h.prototype.writeFloatBE=function(n,o,_){return Z(this,n,o,!1,_)};function Q(d,n,o,_,O){return n=+n,o=o>>>0,O||G(d,n,o,8),t.write(d,n,o,_,52,8),o+8}h.prototype.writeDoubleLE=function(n,o,_){return Q(this,n,o,!0,_)},h.prototype.writeDoubleBE=function(n,o,_){return Q(this,n,o,!1,_)},h.prototype.copy=function(n,o,_,O){if(!h.isBuffer(n))throw new TypeError("argument should be a Buffer");if(_||(_=0),!O&&O!==0&&(O=this.length),o>=n.length&&(o=n.length),o||(o=0),O>0&&O<_&&(O=_),O===_||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),n.length-o<O-_&&(O=n.length-o+_);const j=O-_;return this===n&&typeof l.prototype.copyWithin=="function"?this.copyWithin(o,_,O):l.prototype.set.call(n,this.subarray(_,O),o),j},h.prototype.fill=function(n,o,_,O){if(typeof n=="string"){if(typeof o=="string"?(O=o,o=0,_=this.length):typeof _=="string"&&(O=_,_=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!h.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(n.length===1){const Y=n.charCodeAt(0);(O==="utf8"&&Y<128||O==="latin1")&&(n=Y)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<_)throw new RangeError("Out of range index");if(_<=o)return this;o=o>>>0,_=_===void 0?this.length:_>>>0,n||(n=0);let j;if(typeof n=="number")for(j=o;j<_;++j)this[j]=n;else{const Y=h.isBuffer(n)?n:h.from(n,O),ce=Y.length;if(ce===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(j=0;j<_-o;++j)this[j+o]=Y[j%ce]}return this};const y={};function w(d,n,o){y[d]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${d}]`,this.stack,delete this.name}get code(){return d}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${d}]: ${this.message}`}}}w("ERR_BUFFER_OUT_OF_BOUNDS",function(d){return d?`${d} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),w("ERR_INVALID_ARG_TYPE",function(d,n){return`The "${d}" argument must be of type number. Received type ${typeof n}`},TypeError),w("ERR_OUT_OF_RANGE",function(d,n,o){let _=`The value of "${d}" is out of range.`,O=o;return Number.isInteger(o)&&Math.abs(o)>oe(2,32)?O=z(String(o)):typeof o=="bigint"&&(O=String(o),(o>oe(BigInt(2),BigInt(32))||o<-oe(BigInt(2),BigInt(32)))&&(O=z(O)),O+="n"),_+=` It must be ${n}. Received ${O}`,_},RangeError);function z(d){let n="",o=d.length;const _=d[0]==="-"?1:0;for(;o>=_+4;o-=3)n=`_${d.slice(o-3,o)}${n}`;return`${d.slice(0,o)}${n}`}function ee(d,n,o){ie(n,"offset"),(d[n]===void 0||d[n+o]===void 0)&&se(n,d.length-(o+1))}function le(d,n,o,_,O,j){if(d>o||d<n){const Y=typeof n=="bigint"?"n":"";let ce;throw n===0||n===BigInt(0)?ce=`>= 0${Y} and < 2${Y} ** ${(j+1)*8}${Y}`:ce=`>= -(2${Y} ** ${(j+1)*8-1}${Y}) and < 2 ** ${(j+1)*8-1}${Y}`,new y.ERR_OUT_OF_RANGE("value",ce,d)}ee(_,O,j)}function ie(d,n){if(typeof d!="number")throw new y.ERR_INVALID_ARG_TYPE(n,"number",d)}function se(d,n,o){throw Math.floor(d)!==d?(ie(d,o),new y.ERR_OUT_OF_RANGE("offset","an integer",d)):n<0?new y.ERR_BUFFER_OUT_OF_BOUNDS:new y.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${n}`,d)}const De=/[^+/0-9A-Za-z-_]/g;function H(d){if(d=d.split("=")[0],d=d.trim().replace(De,""),d.length<2)return"";for(;d.length%4!==0;)d=d+"=";return d}function Fe(d,n){n=n||1/0;let o;const _=d.length;let O=null;const j=[];for(let Y=0;Y<_;++Y){if(o=d.charCodeAt(Y),o>55295&&o<57344){if(!O){if(o>56319){(n-=3)>-1&&j.push(239,191,189);continue}else if(Y+1===_){(n-=3)>-1&&j.push(239,191,189);continue}O=o;continue}if(o<56320){(n-=3)>-1&&j.push(239,191,189),O=o;continue}o=(O-55296<<10|o-56320)+65536}else O&&(n-=3)>-1&&j.push(239,191,189);if(O=null,o<128){if((n-=1)<0)break;j.push(o)}else if(o<2048){if((n-=2)<0)break;j.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;j.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;j.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return j}function Ue(d){const n=[];for(let o=0;o<d.length;++o)n.push(d.charCodeAt(o)&255);return n}function ye(d,n){let o,_,O;const j=[];for(let Y=0;Y<d.length&&!((n-=2)<0);++Y)o=d.charCodeAt(Y),_=o>>8,O=o%256,j.push(O),j.push(_);return j}function we(d){return e.toByteArray(H(d))}function $e(d,n,o,_){let O;for(O=0;O<_&&!(O+o>=n.length||O>=d.length);++O)n[O+o]=d[O];return O}function Ne(d,n){return d instanceof n||d!=null&&d.constructor!=null&&d.constructor.name!=null&&d.constructor.name===n.name}function We(d){return d!==d}const Ve=function(){const d="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){const _=o*16;for(let O=0;O<16;++O)n[_+O]=d[o]+d[O]}return n}();function Me(d){return typeof BigInt=="undefined"?tt:d}function tt(){throw new Error("BigInt not supported")}})(Fn);const ua=Fn.Buffer;if(typeof ae=="undefined"?globalThis.process={env:{},browser:!0,version:"v18.0.0",platform:"browser",arch:"x64",versions:{node:"18.0.0"},nextTick:(r,...e)=>{if(typeof r!="function")throw new TypeError("nextTick callback must be a function");if(typeof MessageChannel!="undefined"){const t=new MessageChannel;t.port2.onmessage=()=>{try{r(...e)}catch(s){setTimeout(()=>{throw s},0)}},t.port1.postMessage(null)}else setTimeout(()=>{try{r(...e)}catch(t){setTimeout(()=>{throw t},0)}},0)},cwd:()=>"/",chdir:()=>{},umask:()=>0}:typeof ae.nextTick=="undefined"&&(ae.nextTick=(r,...e)=>{if(typeof r!="function")throw new TypeError("nextTick callback must be a function");if(typeof MessageChannel!="undefined"){const t=new MessageChannel;t.port2.onmessage=()=>{try{r(...e)}catch(s){setTimeout(()=>{throw s},0)}},t.port1.postMessage(null)}else setTimeout(()=>{try{r(...e)}catch(t){setTimeout(()=>{throw t},0)}},0)}),typeof globalThis=="undefined"&&(globalThis.global=globalThis),typeof ua=="undefined"){let r=null;try{typeof require!="undefined"&&(r=require("buffer").Buffer)}catch(e){}r?globalThis.Buffer=r:globalThis.Buffer={isBuffer:e=>!1,from:e=>new Uint8Array(e),alloc:e=>new Uint8Array(e),allocUnsafe:e=>new Uint8Array(e)}}typeof setImmediate=="undefined"&&(globalThis.setImmediate=(r,...e)=>setTimeout(()=>r(...e),0)),typeof clearImmediate=="undefined"&&(globalThis.clearImmediate=r=>{clearTimeout(r)});var fa=Object.defineProperty,ha=(r,e,t)=>e in r?fa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,it=(r,e,t)=>ha(r,typeof e!="symbol"?e+"":e,t),Ke=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});class $n{constructor(e,t,s="/apis/video-call"){it(this,"socket",null),it(this,"serverUrl"),it(this,"socketPath"),it(this,"token"),it(this,"connected",!1),it(this,"reconnectAttempts",0),it(this,"maxReconnectAttempts",5),this.serverUrl=e,this.token=t,this.socketPath=s}connect(){return Ke(this,null,function*(){return this.socket&&this.socket.connected?Promise.resolve():(this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.socket=null),new Promise((e,t)=>{try{this.socket=ge.io(this.serverUrl,{path:this.socketPath,transports:["websocket","polling"],timeout:1e4,forceNew:!0,auth:{token:this.token}}),this.socket.on("connect",()=>{this.connected=!0,this.reconnectAttempts=0,console.log("[CallSocket] Connected to signaling server"),e()}),this.socket.on("disconnect",s=>{this.connected=!1,console.log("[CallSocket] Disconnected:",s),this.handleDisconnection(s)}),this.socket.on("connect_error",s=>{console.error("[CallSocket] Connection error:",s),this.reconnectAttempts++,this.reconnectAttempts>=this.maxReconnectAttempts&&t(new Error(`Failed to connect after ${this.maxReconnectAttempts} attempts`))})}catch(s){t(s)}}))})}disconnect(){this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.socket=null,this.connected=!1)}isConnected(){var e;return this.connected&&((e=this.socket)==null?void 0:e.connected)===!0}emit(e,t){var s;if(!this.isConnected())throw new Error("Socket not connected");console.log(`[CallSocket] Emitting ${e}:`,t),(s=this.socket)==null||s.emit(e,t,u=>{u!=null&&u.error&&console.error(`[CallSocket] Error in ${e}:`,u.error)})}emitWithResponse(e,t,s=1e4){return Ke(this,null,function*(){if(!this.isConnected())throw new Error("Socket not connected");return console.log(`[CallSocket] Emitting ${e} with response:`,t),new Promise((u,l)=>{var g;const f=setTimeout(()=>{l(new Error(`Timeout waiting for response to ${e}`))},s);console.log(`[CallSocket] about to emit: ${e}...`),(g=this.socket)==null||g.emit(e,t,c=>{clearTimeout(f),c!=null&&c.error?(console.error(`[CallSocket] Error in ${e}:`,c.error),l(new Error(c.error))):(console.log(`[CallSocket] Response for ${e}:`,c),u(c))})})})}on(e,t){if(!this.socket)throw new Error("Socket not connected");this.socket.on(e,t)}off(e,t){this.socket&&(t?this.socket.off(e,t):this.socket.removeAllListeners(e))}startCall(e){return Ke(this,null,function*(){return this.emitWithResponse("call.start",{roomId:e})})}joinRoom(e){return Ke(this,null,function*(){return this.emitWithResponse("call.join",{roomId:e})})}leaveCall(e){return Ke(this,null,function*(){return this.emitWithResponse("call.leave",{roomId:e})})}sendOffer(e,t,s){this.emit("call.offer",{to:e,offer:t,roomId:s})}sendAnswer(e,t,s){this.emit("call.answer",{to:e,answer:t,roomId:s})}sendCandidate(e,t,s){this.emit("call.candidate",{to:e,candidate:t,roomId:s})}sendStateUpdate(e,t,s){this.emit("call.state",{to:e,state:t,roomId:s})}endCall(e,t,s){this.emit("call.end",{roomId:s,targetUserId:e})}endCallForAll(e){return Ke(this,null,function*(){this.emit("call.end",{roomId:e})})}startRecording(e,t){return Ke(this,null,function*(){return this.emitWithResponse("call.recording.start",{roomId:e,recordingId:t})})}sendRecordingChunk(e,t,s){this.emit("call.recording.chunk",{roomId:e,recordingId:t,chunk:s})}endRecording(e,t){return Ke(this,null,function*(){return this.emitWithResponse("call.recording.end",{roomId:e,recordingId:t})})}sendTranscript(e,t){this.emit("call.transcript",{roomId:e,transcript:t,timestamp:Date.now()})}checkCallStatus(e){return Ke(this,null,function*(){return this.emitWithResponse("call.status",{roomId:e})})}getIceServers(e){return Ke(this,null,function*(){return this.emitWithResponse("call.ice-servers",{roomId:e})})}handleDisconnection(e){["transport close","transport error","io server disconnect"].includes(e)&&this.reconnectAttempts<this.maxReconnectAttempts&&setTimeout(()=>{this.connected||(console.log(`[CallSocket] Attempting to reconnect... (${this.reconnectAttempts+1}/${this.maxReconnectAttempts})`),this.connect().catch(console.error))},Math.pow(2,this.reconnectAttempts)*1e3)}getConnectionInfo(){var e,t;return{connected:this.connected,socketId:(e=this.socket)==null?void 0:e.id,transport:(t=this.socket)==null?void 0:t.io.engine.transport.name,reconnectAttempts:this.reconnectAttempts}}}var da=Object.defineProperty,pa=(r,e,t)=>e in r?da(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gt=(r,e,t)=>pa(r,typeof e!="symbol"?e+"":e,t),Ct=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});class jn{constructor(e={video:!0,audio:!0}){gt(this,"cameraStream",null),gt(this,"screenStream",null),gt(this,"videoElement",null),gt(this,"constraints"),gt(this,"isScreenShare",!1),this.constraints=e}initialize(){return Ct(this,null,function*(){try{return console.log("[CallMediaStream] Initializing media stream with constraints:",this.constraints),this.cameraStream=yield navigator.mediaDevices.getUserMedia(this.constraints),console.log("[CallMediaStream] Media stream initialized successfully"),this.cameraStream}catch(e){throw console.error("[CallMediaStream] Failed to initialize media stream:",e),this.handleMediaError(e)}})}startScreenShare(){return Ct(this,arguments,function*(e={video:!0,audio:!1}){try{return console.log("[CallMediaStream] Starting screen share"),this.screenStream=yield navigator.mediaDevices.getDisplayMedia({video:e.video,audio:e.audio}),this.isScreenShare=!0,this.screenStream.getVideoTracks()[0].addEventListener("ended",()=>{console.log("[CallMediaStream] Screen share ended by user"),this.stopScreenShare()}),console.log("[CallMediaStream] Screen share started successfully"),this.screenStream}catch(t){throw console.error("[CallMediaStream] Failed to start screen share:",t),this.handleMediaError(t)}})}stopScreenShare(){return Ct(this,null,function*(){try{if(console.log("[CallMediaStream] Stopping screen share"),this.screenStream&&this.isScreenShare&&(this.screenStream.getTracks().forEach(e=>e.stop()),this.screenStream=null),!this.cameraStream)this.cameraStream=yield this.initialize();else{const e=this.cameraStream.getVideoTracks();(e.length===0||e[0].readyState==="ended")&&(console.log("[CallMediaStream] Camera stream is inactive, reinitializing"),this.cameraStream=yield this.initialize())}return this.isScreenShare=!1,console.log("[CallMediaStream] Reverted to camera stream"),this.cameraStream}catch(e){throw console.error("[CallMediaStream] Failed to stop screen share:",e),this.handleMediaError(e)}})}toggleAudio(e){const t=this.getCurrentStream();if(!t){console.warn("[CallMediaStream] No stream available for audio toggle");return}t.getAudioTracks().forEach(u=>{u.enabled=e}),console.log(`[CallMediaStream] Audio ${e?"enabled":"disabled"}`)}toggleVideo(e){const t=this.getCurrentStream();if(!t){console.warn("[CallMediaStream] No stream available for video toggle");return}t.getVideoTracks().forEach(u=>{u.enabled=e}),console.log(`[CallMediaStream] Video ${e?"enabled":"disabled"}`)}createVideoElement(){const e=document.createElement("video");e.autoplay=!0,e.playsInline=!0,e.muted=!0;const t=this.getCurrentStream();return t&&(e.srcObject=t),this.videoElement=e,e}attachToVideoElement(e){const t=this.getCurrentStream();t&&(e.srcObject=t,this.videoElement=e)}replaceStream(e){const t=this.getCurrentStream();t&&t.getTracks().forEach(s=>s.stop()),this.isScreenShare?this.screenStream=e:this.cameraStream=e,this.videoElement&&(this.videoElement.srcObject=e),console.log("[CallMediaStream] Stream replaced successfully")}getCurrentStream(){return this.isScreenShare?this.screenStream:this.cameraStream}getStream(){return this.getCurrentStream()}getCameraStream(){return this.cameraStream}getScreenStream(){return this.screenStream}getVideoElement(){return this.videoElement}getIsScreenShare(){return this.isScreenShare}isAudioEnabled(){const e=this.getCurrentStream();if(!e)return!1;const t=e.getAudioTracks();return t.length>0&&t[0].enabled}isVideoEnabled(){const e=this.getCurrentStream();if(!e)return!1;const t=e.getVideoTracks();return t.length>0&&t[0].enabled}getStreamInfo(){const e=this.getCurrentStream();if(!e)return null;const t=e.getVideoTracks(),s=e.getAudioTracks();return{id:e.id,videoTracks:t.length,audioTracks:s.length,isScreenShare:this.isScreenShare,videoEnabled:t.length>0?t[0].enabled:!1,audioEnabled:s.length>0?s[0].enabled:!1,videoConstraints:t.length>0?t[0].getSettings():null,audioConstraints:s.length>0?s[0].getSettings():null,hasCameraStream:!!this.cameraStream,hasScreenStream:!!this.screenStream}}getVideoTrack(){const e=this.getCurrentStream();if(!e)return null;const t=e.getVideoTracks();return t.length>0?t[0]:null}getAudioTrack(){const e=this.getCurrentStream();if(!e)return null;const t=e.getAudioTracks();return t.length>0?t[0]:null}getCameraVideoTrack(){if(!this.cameraStream)return null;const e=this.cameraStream.getVideoTracks();return e.length>0?e[0]:null}getScreenVideoTrack(){if(!this.screenStream)return null;const e=this.screenStream.getVideoTracks();return e.length>0?e[0]:null}cleanup(){console.log("[CallMediaStream] Cleaning up media stream"),this.cameraStream&&(this.cameraStream.getTracks().forEach(e=>{e.stop()}),this.cameraStream=null),this.screenStream&&(this.screenStream.getTracks().forEach(e=>{e.stop()}),this.screenStream=null),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement=null),this.isScreenShare=!1}handleMediaError(e){let t="Unknown media error";return e.name==="NotAllowedError"?t="Permission denied. Please allow camera and microphone access.":e.name==="NotFoundError"?t="No camera or microphone found. Please check your devices.":e.name==="NotReadableError"?t="Camera or microphone is already in use by another application.":e.name==="OverconstrainedError"?t="Camera or microphone does not support the requested constraints.":e.name==="SecurityError"?t="Media access blocked due to security restrictions.":e.name==="AbortError"&&(t="Media access was aborted."),new Error(`${t} (${e.name})`)}static getAvailableDevices(){return Ct(this,null,function*(){try{const e=yield navigator.mediaDevices.enumerateDevices();return{videoDevices:e.filter(t=>t.kind==="videoinput"),audioDevices:e.filter(t=>t.kind==="audioinput")}}catch(e){throw console.error("[CallMediaStream] Failed to get available devices:",e),e}})}static checkBrowserSupport(){return{getUserMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),getDisplayMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia),webRTC:!!window.RTCPeerConnection}}}function xt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Rt={exports:{}},Wt,qn;function ga(){if(qn)return Wt;qn=1;var r=1e3,e=r*60,t=e*60,s=t*24,u=s*7,l=s*365.25;Wt=function(h,I){I=I||{};var B=typeof h;if(B==="string"&&h.length>0)return g(h);if(B==="number"&&isFinite(h))return I.long?c(h):f(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function g(h){if(h=String(h),!(h.length>100)){var I=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(I){var B=parseFloat(I[1]),x=(I[2]||"ms").toLowerCase();switch(x){case"years":case"year":case"yrs":case"yr":case"y":return B*l;case"weeks":case"week":case"w":return B*u;case"days":case"day":case"d":return B*s;case"hours":case"hour":case"hrs":case"hr":case"h":return B*t;case"minutes":case"minute":case"mins":case"min":case"m":return B*e;case"seconds":case"second":case"secs":case"sec":case"s":return B*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return B;default:return}}}}function f(h){var I=Math.abs(h);return I>=s?Math.round(h/s)+"d":I>=t?Math.round(h/t)+"h":I>=e?Math.round(h/e)+"m":I>=r?Math.round(h/r)+"s":h+"ms"}function c(h){var I=Math.abs(h);return I>=s?v(h,I,s,"day"):I>=t?v(h,I,t,"hour"):I>=e?v(h,I,e,"minute"):I>=r?v(h,I,r,"second"):h+" ms"}function v(h,I,B,x){var b=I>=B*1.5;return Math.round(h/B)+" "+x+(b?"s":"")}return Wt}var Gt,xn;function ya(){if(xn)return Gt;xn=1;function r(e){s.debug=s,s.default=s,s.coerce=v,s.disable=f,s.enable=l,s.enabled=c,s.humanize=ga(),s.destroy=h,Object.keys(e).forEach(I=>{s[I]=e[I]}),s.names=[],s.skips=[],s.formatters={};function t(I){let B=0;for(let x=0;x<I.length;x++)B=(B<<5)-B+I.charCodeAt(x),B|=0;return s.colors[Math.abs(B)%s.colors.length]}s.selectColor=t;function s(I){let B,x=null,b,N;function T(...m){if(!T.enabled)return;const R=T,A=Number(new Date),P=A-(B||A);R.diff=P,R.prev=B,R.curr=A,B=A,m[0]=s.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let k=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(C,M)=>{if(C==="%%")return"%";k++;const W=s.formatters[M];if(typeof W=="function"){const X=m[k];C=W.call(R,X),m.splice(k,1),k--}return C}),s.formatArgs.call(R,m),(R.log||s.log).apply(R,m)}return T.namespace=I,T.useColors=s.useColors(),T.color=s.selectColor(I),T.extend=u,T.destroy=s.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(b!==s.namespaces&&(b=s.namespaces,N=s.enabled(I)),N),set:m=>{x=m}}),typeof s.init=="function"&&s.init(T),T}function u(I,B){const x=s(this.namespace+(typeof B=="undefined"?":":B)+I);return x.log=this.log,x}function l(I){s.save(I),s.namespaces=I,s.names=[],s.skips=[];const B=(typeof I=="string"?I:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const x of B)x[0]==="-"?s.skips.push(x.slice(1)):s.names.push(x)}function g(I,B){let x=0,b=0,N=-1,T=0;for(;x<I.length;)if(b<B.length&&(B[b]===I[x]||B[b]==="*"))B[b]==="*"?(N=b,T=x,b++):(x++,b++);else if(N!==-1)b=N+1,T++,x=T;else return!1;for(;b<B.length&&B[b]==="*";)b++;return b===B.length}function f(){const I=[...s.names,...s.skips.map(B=>"-"+B)].join(",");return s.enable(""),I}function c(I){for(const B of s.skips)if(g(I,B))return!1;for(const B of s.names)if(g(I,B))return!0;return!1}function v(I){return I instanceof Error?I.stack||I.message:I}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return s.enable(s.load()),s}return Gt=r,Gt}var Wn;function ma(){return Wn||(Wn=1,function(r,e){e.formatArgs=s,e.save=u,e.load=l,e.useColors=t,e.storage=g(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;const v="color: "+this.color;c.splice(1,0,v,"color: inherit");let h=0,I=0;c[0].replace(/%[a-zA-Z%]/g,B=>{B!=="%%"&&(h++,B==="%c"&&(I=h))}),c.splice(I,0,v)}e.log=console.debug||console.log||(()=>{});function u(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch(v){}}function l(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(v){}return!c&&typeof ae!="undefined"&&"env"in ae&&(c=ae.env.DEBUG),c}function g(){try{return localStorage}catch(c){}}r.exports=ya()(e);const{formatters:f}=r.exports;f.j=function(c){try{return JSON.stringify(c)}catch(v){return"[UnexpectedJSONParseError]: "+v.message}}}(Rt,Rt.exports)),Rt.exports}var Vt,Gn;function va(){return Gn||(Gn=1,Vt=function(){if(typeof globalThis=="undefined")return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}),Vt}var Pt={exports:{}},Tt={exports:{}},zt={},Vn;function yt(){return Vn||(Vn=1,function(r){Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e={},t={};t.byteLength=h,t.toByteArray=B,t.fromByteArray=N;for(var s=[],u=[],l=typeof Uint8Array!="undefined"?Uint8Array:Array,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,c=g.length;f<c;++f)s[f]=g[f],u[g.charCodeAt(f)]=f;u[45]=62,u[95]=63;function v(R){var A=R.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=R.indexOf("=");P===-1&&(P=A);var k=P===A?0:4-P%4;return[P,k]}function h(R){var A=v(R),P=A[0],k=A[1];return(P+k)*3/4-k}function I(R,A,P){return(A+P)*3/4-P}function B(R){var A,P=v(R),k=P[0],S=P[1],C=new l(I(R,k,S)),M=0,W=S>0?k-4:k,X;for(X=0;X<W;X+=4)A=u[R.charCodeAt(X)]<<18|u[R.charCodeAt(X+1)]<<12|u[R.charCodeAt(X+2)]<<6|u[R.charCodeAt(X+3)],C[M++]=A>>16&255,C[M++]=A>>8&255,C[M++]=A&255;return S===2&&(A=u[R.charCodeAt(X)]<<2|u[R.charCodeAt(X+1)]>>4,C[M++]=A&255),S===1&&(A=u[R.charCodeAt(X)]<<10|u[R.charCodeAt(X+1)]<<4|u[R.charCodeAt(X+2)]>>2,C[M++]=A>>8&255,C[M++]=A&255),C}function x(R){return s[R>>18&63]+s[R>>12&63]+s[R>>6&63]+s[R&63]}function b(R,A,P){for(var k,S=[],C=A;C<P;C+=3)k=(R[C]<<16&16711680)+(R[C+1]<<8&65280)+(R[C+2]&255),S.push(x(k));return S.join("")}function N(R){for(var A,P=R.length,k=P%3,S=[],C=16383,M=0,W=P-k;M<W;M+=C)S.push(b(R,M,M+C>W?W:M+C));return k===1?(A=R[P-1],S.push(s[A>>2]+s[A<<4&63]+"==")):k===2&&(A=(R[P-2]<<8)+R[P-1],S.push(s[A>>10]+s[A>>4&63]+s[A<<2&63]+"=")),S.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(R,A,P,k,S){var C,M,W=S*8-k-1,X=(1<<W)-1,re=X>>1,U=-7,he=P?S-1:0,de=P?-1:1,me=R[A+he];for(he+=de,C=me&(1<<-U)-1,me>>=-U,U+=W;U>0;C=C*256+R[A+he],he+=de,U-=8);for(M=C&(1<<-U)-1,C>>=-U,U+=k;U>0;M=M*256+R[A+he],he+=de,U-=8);if(C===0)C=1-re;else{if(C===X)return M?NaN:(me?-1:1)*(1/0);M=M+Math.pow(2,k),C=C-re}return(me?-1:1)*M*Math.pow(2,C-k)},T.write=function(R,A,P,k,S,C){var M,W,X,re=C*8-S-1,U=(1<<re)-1,he=U>>1,de=S===23?Math.pow(2,-24)-Math.pow(2,-77):0,me=k?0:C-1,Pe=k?1:-1,ke=A<0||A===0&&1/A<0?1:0;for(A=Math.abs(A),isNaN(A)||A===1/0?(W=isNaN(A)?1:0,M=U):(M=Math.floor(Math.log(A)/Math.LN2),A*(X=Math.pow(2,-M))<1&&(M--,X*=2),M+he>=1?A+=de/X:A+=de*Math.pow(2,1-he),A*X>=2&&(M++,X/=2),M+he>=U?(W=0,M=U):M+he>=1?(W=(A*X-1)*Math.pow(2,S),M=M+he):(W=A*Math.pow(2,he-1)*Math.pow(2,S),M=0));S>=8;R[P+me]=W&255,me+=Pe,W/=256,S-=8);for(M=M<<S|W,re+=S;re>0;R[P+me]=M&255,me+=Pe,M/=256,re-=8);R[P+me-Pe]|=ke*128};/*!
6
+ */(function(r){const e=Et,t=qt,s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=h,r.SlowBuffer=k,r.INSPECT_MAX_BYTES=50;const f=2147483647;r.kMaxLength=f;const{Uint8Array:l,ArrayBuffer:g,SharedArrayBuffer:u}=globalThis;h.TYPED_ARRAY_SUPPORT=c(),!h.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const d=new l(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,l.prototype),Object.setPrototypeOf(d,n),d.foo()===42}catch(d){return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}});function v(d){if(d>f)throw new RangeError('The value "'+d+'" is invalid for option "size"');const n=new l(d);return Object.setPrototypeOf(n,h.prototype),n}function h(d,n,o){if(typeof d=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(d)}return I(d,n,o)}h.poolSize=8192;function I(d,n,o){if(typeof d=="string")return N(d,n);if(g.isView(d))return m(d);if(d==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof d);if(Ne(d,g)||d&&Ne(d.buffer,g)||typeof u!="undefined"&&(Ne(d,u)||d&&Ne(d.buffer,u)))return R(d,n,o);if(typeof d=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const _=d.valueOf&&d.valueOf();if(_!=null&&_!==d)return h.from(_,n,o);const O=A(d);if(O)return O;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof d[Symbol.toPrimitive]=="function")return h.from(d[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof d)}h.from=function(d,n,o){return I(d,n,o)},Object.setPrototypeOf(h.prototype,l.prototype),Object.setPrototypeOf(h,l);function B(d){if(typeof d!="number")throw new TypeError('"size" argument must be of type number');if(d<0)throw new RangeError('The value "'+d+'" is invalid for option "size"')}function x(d,n,o){return B(d),d<=0?v(d):n!==void 0?typeof o=="string"?v(d).fill(n,o):v(d).fill(n):v(d)}h.alloc=function(d,n,o){return x(d,n,o)};function b(d){return B(d),v(d<0?0:P(d)|0)}h.allocUnsafe=function(d){return b(d)},h.allocUnsafeSlow=function(d){return b(d)};function N(d,n){if((typeof n!="string"||n==="")&&(n="utf8"),!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const o=S(d,n)|0;let _=v(o);const O=_.write(d,n);return O!==o&&(_=_.slice(0,O)),_}function T(d){const n=d.length<0?0:P(d.length)|0,o=v(n);for(let _=0;_<n;_+=1)o[_]=d[_]&255;return o}function m(d){if(Ne(d,l)){const n=new l(d);return R(n.buffer,n.byteOffset,n.byteLength)}return T(d)}function R(d,n,o){if(n<0||d.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(d.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let _;return n===void 0&&o===void 0?_=new l(d):o===void 0?_=new l(d,n):_=new l(d,n,o),Object.setPrototypeOf(_,h.prototype),_}function A(d){if(h.isBuffer(d)){const n=P(d.length)|0,o=v(n);return o.length===0||d.copy(o,0,0,n),o}if(d.length!==void 0)return typeof d.length!="number"||We(d.length)?v(0):T(d);if(d.type==="Buffer"&&Array.isArray(d.data))return T(d.data)}function P(d){if(d>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return d|0}function k(d){return+d!=d&&(d=0),h.alloc(+d)}h.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==h.prototype},h.compare=function(n,o){if(Ne(n,l)&&(n=h.from(n,n.offset,n.byteLength)),Ne(o,l)&&(o=h.from(o,o.offset,o.byteLength)),!h.isBuffer(n)||!h.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let _=n.length,O=o.length;for(let j=0,Y=Math.min(_,O);j<Y;++j)if(n[j]!==o[j]){_=n[j],O=o[j];break}return _<O?-1:O<_?1:0},h.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return h.alloc(0);let _;if(o===void 0)for(o=0,_=0;_<n.length;++_)o+=n[_].length;const O=h.allocUnsafe(o);let j=0;for(_=0;_<n.length;++_){let Y=n[_];if(Ne(Y,l))j+Y.length>O.length?(h.isBuffer(Y)||(Y=h.from(Y)),Y.copy(O,j)):l.prototype.set.call(O,Y,j);else if(h.isBuffer(Y))Y.copy(O,j);else throw new TypeError('"list" argument must be an Array of Buffers');j+=Y.length}return O};function S(d,n){if(h.isBuffer(d))return d.length;if(g.isView(d)||Ne(d,g))return d.byteLength;if(typeof d!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof d);const o=d.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&o===0)return 0;let O=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Fe(d).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return we(d).length;default:if(O)return _?-1:Fe(d).length;n=(""+n).toLowerCase(),O=!0}}h.byteLength=S;function C(d,n,o){let _=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(d||(d="utf8");;)switch(d){case"hex":return $(this,n,o);case"utf8":case"utf-8":return ke(this,n,o);case"ascii":return Oe(this,n,o);case"latin1":case"binary":return qe(this,n,o);case"base64":return Pe(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,n,o);default:if(_)throw new TypeError("Unknown encoding: "+d);d=(d+"").toLowerCase(),_=!0}}h.prototype._isBuffer=!0;function M(d,n,o){const _=d[n];d[n]=d[o],d[o]=_}h.prototype.swap16=function(){const n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<n;o+=2)M(this,o,o+1);return this},h.prototype.swap32=function(){const n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<n;o+=4)M(this,o,o+3),M(this,o+1,o+2);return this},h.prototype.swap64=function(){const n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<n;o+=8)M(this,o,o+7),M(this,o+1,o+6),M(this,o+2,o+5),M(this,o+3,o+4);return this},h.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?ke(this,0,n):C.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(n){if(!h.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:h.compare(this,n)===0},h.prototype.inspect=function(){let n="";const o=r.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},s&&(h.prototype[s]=h.prototype.inspect),h.prototype.compare=function(n,o,_,O,j){if(Ne(n,l)&&(n=h.from(n,n.offset,n.byteLength)),!h.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),_===void 0&&(_=n?n.length:0),O===void 0&&(O=0),j===void 0&&(j=this.length),o<0||_>n.length||O<0||j>this.length)throw new RangeError("out of range index");if(O>=j&&o>=_)return 0;if(O>=j)return-1;if(o>=_)return 1;if(o>>>=0,_>>>=0,O>>>=0,j>>>=0,this===n)return 0;let Y=j-O,ce=_-o;const be=Math.min(Y,ce),Se=this.slice(O,j),Ce=n.slice(o,_);for(let pe=0;pe<be;++pe)if(Se[pe]!==Ce[pe]){Y=Se[pe],ce=Ce[pe];break}return Y<ce?-1:ce<Y?1:0};function W(d,n,o,_,O){if(d.length===0)return-1;if(typeof o=="string"?(_=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,We(o)&&(o=O?0:d.length-1),o<0&&(o=d.length+o),o>=d.length){if(O)return-1;o=d.length-1}else if(o<0)if(O)o=0;else return-1;if(typeof n=="string"&&(n=h.from(n,_)),h.isBuffer(n))return n.length===0?-1:X(d,n,o,_,O);if(typeof n=="number")return n=n&255,typeof l.prototype.indexOf=="function"?O?l.prototype.indexOf.call(d,n,o):l.prototype.lastIndexOf.call(d,n,o):X(d,[n],o,_,O);throw new TypeError("val must be string, number or Buffer")}function X(d,n,o,_,O){let j=1,Y=d.length,ce=n.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(d.length<2||n.length<2)return-1;j=2,Y/=2,ce/=2,o/=2}function be(Ce,pe){return j===1?Ce[pe]:Ce.readUInt16BE(pe*j)}let Se;if(O){let Ce=-1;for(Se=o;Se<Y;Se++)if(be(d,Se)===be(n,Ce===-1?0:Se-Ce)){if(Ce===-1&&(Ce=Se),Se-Ce+1===ce)return Ce*j}else Ce!==-1&&(Se-=Se-Ce),Ce=-1}else for(o+ce>Y&&(o=Y-ce),Se=o;Se>=0;Se--){let Ce=!0;for(let pe=0;pe<ce;pe++)if(be(d,Se+pe)!==be(n,pe)){Ce=!1;break}if(Ce)return Se}return-1}h.prototype.includes=function(n,o,_){return this.indexOf(n,o,_)!==-1},h.prototype.indexOf=function(n,o,_){return W(this,n,o,_,!0)},h.prototype.lastIndexOf=function(n,o,_){return W(this,n,o,_,!1)};function re(d,n,o,_){o=Number(o)||0;const O=d.length-o;_?(_=Number(_),_>O&&(_=O)):_=O;const j=n.length;_>j/2&&(_=j/2);let Y;for(Y=0;Y<_;++Y){const ce=parseInt(n.substr(Y*2,2),16);if(We(ce))return Y;d[o+Y]=ce}return Y}function U(d,n,o,_){return $e(Fe(n,d.length-o),d,o,_)}function he(d,n,o,_){return $e(Ue(n),d,o,_)}function de(d,n,o,_){return $e(we(n),d,o,_)}function me(d,n,o,_){return $e(ye(n,d.length-o),d,o,_)}h.prototype.write=function(n,o,_,O){if(o===void 0)O="utf8",_=this.length,o=0;else if(_===void 0&&typeof o=="string")O=o,_=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(_)?(_=_>>>0,O===void 0&&(O="utf8")):(O=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const j=this.length-o;if((_===void 0||_>j)&&(_=j),n.length>0&&(_<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let Y=!1;for(;;)switch(O){case"hex":return re(this,n,o,_);case"utf8":case"utf-8":return U(this,n,o,_);case"ascii":case"latin1":case"binary":return he(this,n,o,_);case"base64":return de(this,n,o,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,n,o,_);default:if(Y)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),Y=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pe(d,n,o){return n===0&&o===d.length?e.fromByteArray(d):e.fromByteArray(d.slice(n,o))}function ke(d,n,o){o=Math.min(d.length,o);const _=[];let O=n;for(;O<o;){const j=d[O];let Y=null,ce=j>239?4:j>223?3:j>191?2:1;if(O+ce<=o){let be,Se,Ce,pe;switch(ce){case 1:j<128&&(Y=j);break;case 2:be=d[O+1],(be&192)===128&&(pe=(j&31)<<6|be&63,pe>127&&(Y=pe));break;case 3:be=d[O+1],Se=d[O+2],(be&192)===128&&(Se&192)===128&&(pe=(j&15)<<12|(be&63)<<6|Se&63,pe>2047&&(pe<55296||pe>57343)&&(Y=pe));break;case 4:be=d[O+1],Se=d[O+2],Ce=d[O+3],(be&192)===128&&(Se&192)===128&&(Ce&192)===128&&(pe=(j&15)<<18|(be&63)<<12|(Se&63)<<6|Ce&63,pe>65535&&pe<1114112&&(Y=pe))}}Y===null?(Y=65533,ce=1):Y>65535&&(Y-=65536,_.push(Y>>>10&1023|55296),Y=56320|Y&1023),_.push(Y),O+=ce}return _e(_)}const Ee=4096;function _e(d){const n=d.length;if(n<=Ee)return String.fromCharCode.apply(String,d);let o="",_=0;for(;_<n;)o+=String.fromCharCode.apply(String,d.slice(_,_+=Ee));return o}function Oe(d,n,o){let _="";o=Math.min(d.length,o);for(let O=n;O<o;++O)_+=String.fromCharCode(d[O]&127);return _}function qe(d,n,o){let _="";o=Math.min(d.length,o);for(let O=n;O<o;++O)_+=String.fromCharCode(d[O]);return _}function $(d,n,o){const _=d.length;(!n||n<0)&&(n=0),(!o||o<0||o>_)&&(o=_);let O="";for(let j=n;j<o;++j)O+=Ve[d[j]];return O}function V(d,n,o){const _=d.slice(n,o);let O="";for(let j=0;j<_.length-1;j+=2)O+=String.fromCharCode(_[j]+_[j+1]*256);return O}h.prototype.slice=function(n,o){const _=this.length;n=~~n,o=o===void 0?_:~~o,n<0?(n+=_,n<0&&(n=0)):n>_&&(n=_),o<0?(o+=_,o<0&&(o=0)):o>_&&(o=_),o<n&&(o=n);const O=this.subarray(n,o);return Object.setPrototypeOf(O,h.prototype),O};function J(d,n,o){if(d%1!==0||d<0)throw new RangeError("offset is not uint");if(d+n>o)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=this[n],j=1,Y=0;for(;++Y<o&&(j*=256);)O+=this[n+Y]*j;return O},h.prototype.readUintBE=h.prototype.readUIntBE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=this[n+--o],j=1;for(;o>0&&(j*=256);)O+=this[n+--o]*j;return O},h.prototype.readUint8=h.prototype.readUInt8=function(n,o){return n=n>>>0,o||J(n,1,this.length),this[n]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||J(n,2,this.length),this[n]|this[n+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||J(n,2,this.length),this[n]<<8|this[n+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||J(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||J(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},h.prototype.readBigUInt64LE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=o+this[++n]*oe(2,8)+this[++n]*oe(2,16)+this[++n]*oe(2,24),j=this[++n]+this[++n]*oe(2,8)+this[++n]*oe(2,16)+_*oe(2,24);return BigInt(O)+(BigInt(j)<<BigInt(32))}),h.prototype.readBigUInt64BE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=o*oe(2,24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+this[++n],j=this[++n]*oe(2,24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+_;return(BigInt(O)<<BigInt(32))+BigInt(j)}),h.prototype.readIntLE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=this[n],j=1,Y=0;for(;++Y<o&&(j*=256);)O+=this[n+Y]*j;return j*=128,O>=j&&(O-=Math.pow(2,8*o)),O},h.prototype.readIntBE=function(n,o,_){n=n>>>0,o=o>>>0,_||J(n,o,this.length);let O=o,j=1,Y=this[n+--O];for(;O>0&&(j*=256);)Y+=this[n+--O]*j;return j*=128,Y>=j&&(Y-=Math.pow(2,8*o)),Y},h.prototype.readInt8=function(n,o){return n=n>>>0,o||J(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},h.prototype.readInt16LE=function(n,o){n=n>>>0,o||J(n,2,this.length);const _=this[n]|this[n+1]<<8;return _&32768?_|4294901760:_},h.prototype.readInt16BE=function(n,o){n=n>>>0,o||J(n,2,this.length);const _=this[n+1]|this[n]<<8;return _&32768?_|4294901760:_},h.prototype.readInt32LE=function(n,o){return n=n>>>0,o||J(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},h.prototype.readInt32BE=function(n,o){return n=n>>>0,o||J(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},h.prototype.readBigInt64LE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=this[n+4]+this[n+5]*oe(2,8)+this[n+6]*oe(2,16)+(_<<24);return(BigInt(O)<<BigInt(32))+BigInt(o+this[++n]*oe(2,8)+this[++n]*oe(2,16)+this[++n]*oe(2,24))}),h.prototype.readBigInt64BE=Me(function(n){n=n>>>0,ie(n,"offset");const o=this[n],_=this[n+7];(o===void 0||_===void 0)&&se(n,this.length-8);const O=(o<<24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+this[++n];return(BigInt(O)<<BigInt(32))+BigInt(this[++n]*oe(2,24)+this[++n]*oe(2,16)+this[++n]*oe(2,8)+_)}),h.prototype.readFloatLE=function(n,o){return n=n>>>0,o||J(n,4,this.length),t.read(this,n,!0,23,4)},h.prototype.readFloatBE=function(n,o){return n=n>>>0,o||J(n,4,this.length),t.read(this,n,!1,23,4)},h.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||J(n,8,this.length),t.read(this,n,!0,52,8)},h.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||J(n,8,this.length),t.read(this,n,!1,52,8)};function ne(d,n,o,_,O,j){if(!h.isBuffer(d))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>O||n<j)throw new RangeError('"value" argument is out of bounds');if(o+_>d.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(n,o,_,O){if(n=+n,o=o>>>0,_=_>>>0,!O){const ce=Math.pow(2,8*_)-1;ne(this,n,o,_,ce,0)}let j=1,Y=0;for(this[o]=n&255;++Y<_&&(j*=256);)this[o+Y]=n/j&255;return o+_},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(n,o,_,O){if(n=+n,o=o>>>0,_=_>>>0,!O){const ce=Math.pow(2,8*_)-1;ne(this,n,o,_,ce,0)}let j=_-1,Y=1;for(this[o+j]=n&255;--j>=0&&(Y*=256);)this[o+j]=n/Y&255;return o+_},h.prototype.writeUint8=h.prototype.writeUInt8=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,1,255,0),this[o]=n&255,o+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function D(d,n,o,_,O){le(n,_,O,d,o,7);let j=Number(n&BigInt(4294967295));d[o++]=j,j=j>>8,d[o++]=j,j=j>>8,d[o++]=j,j=j>>8,d[o++]=j;let Y=Number(n>>BigInt(32)&BigInt(4294967295));return d[o++]=Y,Y=Y>>8,d[o++]=Y,Y=Y>>8,d[o++]=Y,Y=Y>>8,d[o++]=Y,o}function F(d,n,o,_,O){le(n,_,O,d,o,7);let j=Number(n&BigInt(4294967295));d[o+7]=j,j=j>>8,d[o+6]=j,j=j>>8,d[o+5]=j,j=j>>8,d[o+4]=j;let Y=Number(n>>BigInt(32)&BigInt(4294967295));return d[o+3]=Y,Y=Y>>8,d[o+2]=Y,Y=Y>>8,d[o+1]=Y,Y=Y>>8,d[o]=Y,o+8}h.prototype.writeBigUInt64LE=Me(function(n,o=0){return D(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=Me(function(n,o=0){return F(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(n,o,_,O){if(n=+n,o=o>>>0,!O){const be=Math.pow(2,8*_-1);ne(this,n,o,_,be-1,-be)}let j=0,Y=1,ce=0;for(this[o]=n&255;++j<_&&(Y*=256);)n<0&&ce===0&&this[o+j-1]!==0&&(ce=1),this[o+j]=(n/Y>>0)-ce&255;return o+_},h.prototype.writeIntBE=function(n,o,_,O){if(n=+n,o=o>>>0,!O){const be=Math.pow(2,8*_-1);ne(this,n,o,_,be-1,-be)}let j=_-1,Y=1,ce=0;for(this[o+j]=n&255;--j>=0&&(Y*=256);)n<0&&ce===0&&this[o+j+1]!==0&&(ce=1),this[o+j]=(n/Y>>0)-ce&255;return o+_},h.prototype.writeInt8=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},h.prototype.writeInt16LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},h.prototype.writeInt16BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},h.prototype.writeInt32LE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},h.prototype.writeInt32BE=function(n,o,_){return n=+n,o=o>>>0,_||ne(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},h.prototype.writeBigInt64LE=Me(function(n,o=0){return D(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=Me(function(n,o=0){return F(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function G(d,n,o,_,O,j){if(o+_>d.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Z(d,n,o,_,O){return n=+n,o=o>>>0,O||G(d,n,o,4),t.write(d,n,o,_,23,4),o+4}h.prototype.writeFloatLE=function(n,o,_){return Z(this,n,o,!0,_)},h.prototype.writeFloatBE=function(n,o,_){return Z(this,n,o,!1,_)};function Q(d,n,o,_,O){return n=+n,o=o>>>0,O||G(d,n,o,8),t.write(d,n,o,_,52,8),o+8}h.prototype.writeDoubleLE=function(n,o,_){return Q(this,n,o,!0,_)},h.prototype.writeDoubleBE=function(n,o,_){return Q(this,n,o,!1,_)},h.prototype.copy=function(n,o,_,O){if(!h.isBuffer(n))throw new TypeError("argument should be a Buffer");if(_||(_=0),!O&&O!==0&&(O=this.length),o>=n.length&&(o=n.length),o||(o=0),O>0&&O<_&&(O=_),O===_||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),n.length-o<O-_&&(O=n.length-o+_);const j=O-_;return this===n&&typeof l.prototype.copyWithin=="function"?this.copyWithin(o,_,O):l.prototype.set.call(n,this.subarray(_,O),o),j},h.prototype.fill=function(n,o,_,O){if(typeof n=="string"){if(typeof o=="string"?(O=o,o=0,_=this.length):typeof _=="string"&&(O=_,_=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!h.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(n.length===1){const Y=n.charCodeAt(0);(O==="utf8"&&Y<128||O==="latin1")&&(n=Y)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<_)throw new RangeError("Out of range index");if(_<=o)return this;o=o>>>0,_=_===void 0?this.length:_>>>0,n||(n=0);let j;if(typeof n=="number")for(j=o;j<_;++j)this[j]=n;else{const Y=h.isBuffer(n)?n:h.from(n,O),ce=Y.length;if(ce===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(j=0;j<_-o;++j)this[j+o]=Y[j%ce]}return this};const y={};function w(d,n,o){y[d]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${d}]`,this.stack,delete this.name}get code(){return d}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${d}]: ${this.message}`}}}w("ERR_BUFFER_OUT_OF_BOUNDS",function(d){return d?`${d} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),w("ERR_INVALID_ARG_TYPE",function(d,n){return`The "${d}" argument must be of type number. Received type ${typeof n}`},TypeError),w("ERR_OUT_OF_RANGE",function(d,n,o){let _=`The value of "${d}" is out of range.`,O=o;return Number.isInteger(o)&&Math.abs(o)>oe(2,32)?O=z(String(o)):typeof o=="bigint"&&(O=String(o),(o>oe(BigInt(2),BigInt(32))||o<-oe(BigInt(2),BigInt(32)))&&(O=z(O)),O+="n"),_+=` It must be ${n}. Received ${O}`,_},RangeError);function z(d){let n="",o=d.length;const _=d[0]==="-"?1:0;for(;o>=_+4;o-=3)n=`_${d.slice(o-3,o)}${n}`;return`${d.slice(0,o)}${n}`}function ee(d,n,o){ie(n,"offset"),(d[n]===void 0||d[n+o]===void 0)&&se(n,d.length-(o+1))}function le(d,n,o,_,O,j){if(d>o||d<n){const Y=typeof n=="bigint"?"n":"";let ce;throw n===0||n===BigInt(0)?ce=`>= 0${Y} and < 2${Y} ** ${(j+1)*8}${Y}`:ce=`>= -(2${Y} ** ${(j+1)*8-1}${Y}) and < 2 ** ${(j+1)*8-1}${Y}`,new y.ERR_OUT_OF_RANGE("value",ce,d)}ee(_,O,j)}function ie(d,n){if(typeof d!="number")throw new y.ERR_INVALID_ARG_TYPE(n,"number",d)}function se(d,n,o){throw Math.floor(d)!==d?(ie(d,o),new y.ERR_OUT_OF_RANGE("offset","an integer",d)):n<0?new y.ERR_BUFFER_OUT_OF_BOUNDS:new y.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${n}`,d)}const De=/[^+/0-9A-Za-z-_]/g;function H(d){if(d=d.split("=")[0],d=d.trim().replace(De,""),d.length<2)return"";for(;d.length%4!==0;)d=d+"=";return d}function Fe(d,n){n=n||1/0;let o;const _=d.length;let O=null;const j=[];for(let Y=0;Y<_;++Y){if(o=d.charCodeAt(Y),o>55295&&o<57344){if(!O){if(o>56319){(n-=3)>-1&&j.push(239,191,189);continue}else if(Y+1===_){(n-=3)>-1&&j.push(239,191,189);continue}O=o;continue}if(o<56320){(n-=3)>-1&&j.push(239,191,189),O=o;continue}o=(O-55296<<10|o-56320)+65536}else O&&(n-=3)>-1&&j.push(239,191,189);if(O=null,o<128){if((n-=1)<0)break;j.push(o)}else if(o<2048){if((n-=2)<0)break;j.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;j.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;j.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return j}function Ue(d){const n=[];for(let o=0;o<d.length;++o)n.push(d.charCodeAt(o)&255);return n}function ye(d,n){let o,_,O;const j=[];for(let Y=0;Y<d.length&&!((n-=2)<0);++Y)o=d.charCodeAt(Y),_=o>>8,O=o%256,j.push(O),j.push(_);return j}function we(d){return e.toByteArray(H(d))}function $e(d,n,o,_){let O;for(O=0;O<_&&!(O+o>=n.length||O>=d.length);++O)n[O+o]=d[O];return O}function Ne(d,n){return d instanceof n||d!=null&&d.constructor!=null&&d.constructor.name!=null&&d.constructor.name===n.name}function We(d){return d!==d}const Ve=function(){const d="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){const _=o*16;for(let O=0;O<16;++O)n[_+O]=d[o]+d[O]}return n}();function Me(d){return typeof BigInt=="undefined"?tt:d}function tt(){throw new Error("BigInt not supported")}})(Fn);const ua=Fn.Buffer;if(typeof ae=="undefined"?globalThis.process={env:{},browser:!0,version:"v18.0.0",platform:"browser",arch:"x64",versions:{node:"18.0.0"},nextTick:(r,...e)=>{if(typeof r!="function")throw new TypeError("nextTick callback must be a function");if(typeof MessageChannel!="undefined"){const t=new MessageChannel;t.port2.onmessage=()=>{try{r(...e)}catch(s){setTimeout(()=>{throw s},0)}},t.port1.postMessage(null)}else setTimeout(()=>{try{r(...e)}catch(t){setTimeout(()=>{throw t},0)}},0)},cwd:()=>"/",chdir:()=>{},umask:()=>0}:typeof ae.nextTick=="undefined"&&(ae.nextTick=(r,...e)=>{if(typeof r!="function")throw new TypeError("nextTick callback must be a function");if(typeof MessageChannel!="undefined"){const t=new MessageChannel;t.port2.onmessage=()=>{try{r(...e)}catch(s){setTimeout(()=>{throw s},0)}},t.port1.postMessage(null)}else setTimeout(()=>{try{r(...e)}catch(t){setTimeout(()=>{throw t},0)}},0)}),typeof globalThis=="undefined"&&(globalThis.global=globalThis),typeof ua=="undefined"){let r=null;try{typeof require!="undefined"&&(r=require("buffer").Buffer)}catch(e){}r?globalThis.Buffer=r:globalThis.Buffer={isBuffer:e=>!1,from:e=>new Uint8Array(e),alloc:e=>new Uint8Array(e),allocUnsafe:e=>new Uint8Array(e)}}typeof setImmediate=="undefined"&&(globalThis.setImmediate=(r,...e)=>setTimeout(()=>r(...e),0)),typeof clearImmediate=="undefined"&&(globalThis.clearImmediate=r=>{clearTimeout(r)});var fa=Object.defineProperty,ha=(r,e,t)=>e in r?fa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,it=(r,e,t)=>ha(r,typeof e!="symbol"?e+"":e,t),Ke=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});class $n{constructor(e,t,s="/apis/video-call"){it(this,"socket",null),it(this,"serverUrl"),it(this,"socketPath"),it(this,"token"),it(this,"connected",!1),it(this,"reconnectAttempts",0),it(this,"maxReconnectAttempts",5),this.serverUrl=e,this.token=t,this.socketPath=s}connect(){return Ke(this,null,function*(){return this.socket&&this.socket.connected?Promise.resolve():(this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.socket=null),new Promise((e,t)=>{try{this.socket=ge.io(this.serverUrl,{path:this.socketPath,transports:["websocket","polling"],timeout:1e4,forceNew:!0,auth:{token:this.token}}),this.socket.on("connect",()=>{this.connected=!0,this.reconnectAttempts=0,console.log("[CallSocket] Connected to signaling server"),e()}),this.socket.on("disconnect",s=>{this.connected=!1,console.log("[CallSocket] Disconnected:",s),this.handleDisconnection(s)}),this.socket.on("connect_error",s=>{console.error("[CallSocket] Connection error:",s),this.reconnectAttempts++,this.reconnectAttempts>=this.maxReconnectAttempts&&t(new Error(`Failed to connect after ${this.maxReconnectAttempts} attempts`))})}catch(s){t(s)}}))})}disconnect(){this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.socket=null,this.connected=!1)}isConnected(){var e;return this.connected&&((e=this.socket)==null?void 0:e.connected)===!0}emit(e,t){var s;if(!this.isConnected())throw new Error("Socket not connected");console.log(`[CallSocket] Emitting ${e}:`,t),(s=this.socket)==null||s.emit(e,t,f=>{f!=null&&f.error&&console.error(`[CallSocket] Error in ${e}:`,f.error)})}emitWithResponse(e,t,s=1e4){return Ke(this,null,function*(){if(!this.isConnected())throw new Error("Socket not connected");return console.log(`[CallSocket] Emitting ${e} with response:`,t),new Promise((f,l)=>{var g;const u=setTimeout(()=>{l(new Error(`Timeout waiting for response to ${e}`))},s);console.log(`[CallSocket] about to emit: ${e}...`),(g=this.socket)==null||g.emit(e,t,c=>{clearTimeout(u),c!=null&&c.error?(console.error(`[CallSocket] Error in ${e}:`,c.error),l(new Error(c.error))):(console.log(`[CallSocket] Response for ${e}:`,c),f(c))})})})}on(e,t){if(!this.socket)throw new Error("Socket not connected");this.socket.on(e,t)}off(e,t){this.socket&&(t?this.socket.off(e,t):this.socket.removeAllListeners(e))}startCall(e){return Ke(this,null,function*(){return this.emitWithResponse("call.start",{roomId:e})})}joinRoom(e){return Ke(this,null,function*(){return this.emitWithResponse("call.join",{roomId:e})})}leaveCall(e){return Ke(this,null,function*(){return this.emitWithResponse("call.leave",{roomId:e})})}sendOffer(e,t,s){this.emit("call.offer",{to:e,offer:t,roomId:s})}sendAnswer(e,t,s){this.emit("call.answer",{to:e,answer:t,roomId:s})}sendCandidate(e,t,s){this.emit("call.candidate",{to:e,candidate:t,roomId:s})}sendStateUpdate(e,t,s){this.emit("call.state",{to:e,state:t,roomId:s})}endCall(e,t,s){this.emit("call.end",{roomId:s,targetUserId:e})}endCallForAll(e){return Ke(this,null,function*(){this.emit("call.end",{roomId:e})})}startRecording(e,t){return Ke(this,null,function*(){return this.emitWithResponse("call.recording.start",{roomId:e,recordingId:t})})}sendRecordingChunk(e,t,s){this.emit("call.recording.chunk",{roomId:e,recordingId:t,chunk:s})}endRecording(e,t){return Ke(this,null,function*(){return this.emitWithResponse("call.recording.end",{roomId:e,recordingId:t})})}sendTranscript(e,t){this.emit("call.transcript",{roomId:e,transcript:t,timestamp:Date.now()})}checkCallStatus(e){return Ke(this,null,function*(){return this.emitWithResponse("call.status",{roomId:e})})}getIceServers(e){return Ke(this,null,function*(){return this.emitWithResponse("call.ice-servers",{roomId:e})})}handleDisconnection(e){["transport close","transport error","io server disconnect"].includes(e)&&this.reconnectAttempts<this.maxReconnectAttempts&&setTimeout(()=>{this.connected||(console.log(`[CallSocket] Attempting to reconnect... (${this.reconnectAttempts+1}/${this.maxReconnectAttempts})`),this.connect().catch(console.error))},Math.pow(2,this.reconnectAttempts)*1e3)}getConnectionInfo(){var e,t;return{connected:this.connected,socketId:(e=this.socket)==null?void 0:e.id,transport:(t=this.socket)==null?void 0:t.io.engine.transport.name,reconnectAttempts:this.reconnectAttempts}}}var da=Object.defineProperty,pa=(r,e,t)=>e in r?da(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gt=(r,e,t)=>pa(r,typeof e!="symbol"?e+"":e,t),Ct=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});class jn{constructor(e={video:!0,audio:!0}){gt(this,"cameraStream",null),gt(this,"screenStream",null),gt(this,"videoElement",null),gt(this,"constraints"),gt(this,"isScreenShare",!1),this.constraints=e}initialize(){return Ct(this,null,function*(){try{return console.log("[CallMediaStream] Initializing media stream with constraints:",this.constraints),this.cameraStream=yield navigator.mediaDevices.getUserMedia(this.constraints),console.log("[CallMediaStream] Media stream initialized successfully"),this.cameraStream}catch(e){throw console.error("[CallMediaStream] Failed to initialize media stream:",e),this.handleMediaError(e)}})}startScreenShare(){return Ct(this,arguments,function*(e={video:!0,audio:!1}){try{return console.log("[CallMediaStream] Starting screen share"),this.screenStream=yield navigator.mediaDevices.getDisplayMedia({video:e.video,audio:e.audio}),this.isScreenShare=!0,this.screenStream.getVideoTracks()[0].addEventListener("ended",()=>{console.log("[CallMediaStream] Screen share ended by user"),this.stopScreenShare()}),console.log("[CallMediaStream] Screen share started successfully"),this.screenStream}catch(t){throw console.error("[CallMediaStream] Failed to start screen share:",t),this.handleMediaError(t)}})}stopScreenShare(){return Ct(this,null,function*(){try{if(console.log("[CallMediaStream] Stopping screen share"),this.screenStream&&this.isScreenShare&&(this.screenStream.getTracks().forEach(e=>e.stop()),this.screenStream=null),!this.cameraStream)this.cameraStream=yield this.initialize();else{const e=this.cameraStream.getVideoTracks();(e.length===0||e[0].readyState==="ended")&&(console.log("[CallMediaStream] Camera stream is inactive, reinitializing"),this.cameraStream=yield this.initialize())}return this.isScreenShare=!1,console.log("[CallMediaStream] Reverted to camera stream"),this.cameraStream}catch(e){throw console.error("[CallMediaStream] Failed to stop screen share:",e),this.handleMediaError(e)}})}toggleAudio(e){const t=this.getCurrentStream();if(!t){console.warn("[CallMediaStream] No stream available for audio toggle");return}t.getAudioTracks().forEach(f=>{f.enabled=e}),console.log(`[CallMediaStream] Audio ${e?"enabled":"disabled"}`)}toggleVideo(e){const t=this.getCurrentStream();if(!t){console.warn("[CallMediaStream] No stream available for video toggle");return}t.getVideoTracks().forEach(f=>{f.enabled=e}),console.log(`[CallMediaStream] Video ${e?"enabled":"disabled"}`)}createVideoElement(){const e=document.createElement("video");e.autoplay=!0,e.playsInline=!0,e.muted=!0;const t=this.getCurrentStream();return t&&(e.srcObject=t),this.videoElement=e,e}attachToVideoElement(e){const t=this.getCurrentStream();t&&(e.srcObject=t,this.videoElement=e)}replaceStream(e){const t=this.getCurrentStream();t&&t.getTracks().forEach(s=>s.stop()),this.isScreenShare?this.screenStream=e:this.cameraStream=e,this.videoElement&&(this.videoElement.srcObject=e),console.log("[CallMediaStream] Stream replaced successfully")}getCurrentStream(){return this.isScreenShare?this.screenStream:this.cameraStream}getStream(){return this.getCurrentStream()}getCameraStream(){return this.cameraStream}getScreenStream(){return this.screenStream}getVideoElement(){return this.videoElement}getIsScreenShare(){return this.isScreenShare}isAudioEnabled(){const e=this.getCurrentStream();if(!e)return!1;const t=e.getAudioTracks();return t.length>0&&t[0].enabled}isVideoEnabled(){const e=this.getCurrentStream();if(!e)return!1;const t=e.getVideoTracks();return t.length>0&&t[0].enabled}getStreamInfo(){const e=this.getCurrentStream();if(!e)return null;const t=e.getVideoTracks(),s=e.getAudioTracks();return{id:e.id,videoTracks:t.length,audioTracks:s.length,isScreenShare:this.isScreenShare,videoEnabled:t.length>0?t[0].enabled:!1,audioEnabled:s.length>0?s[0].enabled:!1,videoConstraints:t.length>0?t[0].getSettings():null,audioConstraints:s.length>0?s[0].getSettings():null,hasCameraStream:!!this.cameraStream,hasScreenStream:!!this.screenStream}}getVideoTrack(){const e=this.getCurrentStream();if(!e)return null;const t=e.getVideoTracks();return t.length>0?t[0]:null}getAudioTrack(){const e=this.getCurrentStream();if(!e)return null;const t=e.getAudioTracks();return t.length>0?t[0]:null}getCameraVideoTrack(){if(!this.cameraStream)return null;const e=this.cameraStream.getVideoTracks();return e.length>0?e[0]:null}getScreenVideoTrack(){if(!this.screenStream)return null;const e=this.screenStream.getVideoTracks();return e.length>0?e[0]:null}cleanup(){console.log("[CallMediaStream] Cleaning up media stream"),this.cameraStream&&(this.cameraStream.getTracks().forEach(e=>{e.stop()}),this.cameraStream=null),this.screenStream&&(this.screenStream.getTracks().forEach(e=>{e.stop()}),this.screenStream=null),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement=null),this.isScreenShare=!1}handleMediaError(e){let t="Unknown media error";return e.name==="NotAllowedError"?t="Permission denied. Please allow camera and microphone access.":e.name==="NotFoundError"?t="No camera or microphone found. Please check your devices.":e.name==="NotReadableError"?t="Camera or microphone is already in use by another application.":e.name==="OverconstrainedError"?t="Camera or microphone does not support the requested constraints.":e.name==="SecurityError"?t="Media access blocked due to security restrictions.":e.name==="AbortError"&&(t="Media access was aborted."),new Error(`${t} (${e.name})`)}static getAvailableDevices(){return Ct(this,null,function*(){try{const e=yield navigator.mediaDevices.enumerateDevices();return{videoDevices:e.filter(t=>t.kind==="videoinput"),audioDevices:e.filter(t=>t.kind==="audioinput")}}catch(e){throw console.error("[CallMediaStream] Failed to get available devices:",e),e}})}static checkBrowserSupport(){return{getUserMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),getDisplayMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia),webRTC:!!window.RTCPeerConnection}}}function xt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Rt={exports:{}},Wt,qn;function ga(){if(qn)return Wt;qn=1;var r=1e3,e=r*60,t=e*60,s=t*24,f=s*7,l=s*365.25;Wt=function(h,I){I=I||{};var B=typeof h;if(B==="string"&&h.length>0)return g(h);if(B==="number"&&isFinite(h))return I.long?c(h):u(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function g(h){if(h=String(h),!(h.length>100)){var I=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(I){var B=parseFloat(I[1]),x=(I[2]||"ms").toLowerCase();switch(x){case"years":case"year":case"yrs":case"yr":case"y":return B*l;case"weeks":case"week":case"w":return B*f;case"days":case"day":case"d":return B*s;case"hours":case"hour":case"hrs":case"hr":case"h":return B*t;case"minutes":case"minute":case"mins":case"min":case"m":return B*e;case"seconds":case"second":case"secs":case"sec":case"s":return B*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return B;default:return}}}}function u(h){var I=Math.abs(h);return I>=s?Math.round(h/s)+"d":I>=t?Math.round(h/t)+"h":I>=e?Math.round(h/e)+"m":I>=r?Math.round(h/r)+"s":h+"ms"}function c(h){var I=Math.abs(h);return I>=s?v(h,I,s,"day"):I>=t?v(h,I,t,"hour"):I>=e?v(h,I,e,"minute"):I>=r?v(h,I,r,"second"):h+" ms"}function v(h,I,B,x){var b=I>=B*1.5;return Math.round(h/B)+" "+x+(b?"s":"")}return Wt}var Gt,xn;function ya(){if(xn)return Gt;xn=1;function r(e){s.debug=s,s.default=s,s.coerce=v,s.disable=u,s.enable=l,s.enabled=c,s.humanize=ga(),s.destroy=h,Object.keys(e).forEach(I=>{s[I]=e[I]}),s.names=[],s.skips=[],s.formatters={};function t(I){let B=0;for(let x=0;x<I.length;x++)B=(B<<5)-B+I.charCodeAt(x),B|=0;return s.colors[Math.abs(B)%s.colors.length]}s.selectColor=t;function s(I){let B,x=null,b,N;function T(...m){if(!T.enabled)return;const R=T,A=Number(new Date),P=A-(B||A);R.diff=P,R.prev=B,R.curr=A,B=A,m[0]=s.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let k=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(C,M)=>{if(C==="%%")return"%";k++;const W=s.formatters[M];if(typeof W=="function"){const X=m[k];C=W.call(R,X),m.splice(k,1),k--}return C}),s.formatArgs.call(R,m),(R.log||s.log).apply(R,m)}return T.namespace=I,T.useColors=s.useColors(),T.color=s.selectColor(I),T.extend=f,T.destroy=s.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(b!==s.namespaces&&(b=s.namespaces,N=s.enabled(I)),N),set:m=>{x=m}}),typeof s.init=="function"&&s.init(T),T}function f(I,B){const x=s(this.namespace+(typeof B=="undefined"?":":B)+I);return x.log=this.log,x}function l(I){s.save(I),s.namespaces=I,s.names=[],s.skips=[];const B=(typeof I=="string"?I:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const x of B)x[0]==="-"?s.skips.push(x.slice(1)):s.names.push(x)}function g(I,B){let x=0,b=0,N=-1,T=0;for(;x<I.length;)if(b<B.length&&(B[b]===I[x]||B[b]==="*"))B[b]==="*"?(N=b,T=x,b++):(x++,b++);else if(N!==-1)b=N+1,T++,x=T;else return!1;for(;b<B.length&&B[b]==="*";)b++;return b===B.length}function u(){const I=[...s.names,...s.skips.map(B=>"-"+B)].join(",");return s.enable(""),I}function c(I){for(const B of s.skips)if(g(I,B))return!1;for(const B of s.names)if(g(I,B))return!0;return!1}function v(I){return I instanceof Error?I.stack||I.message:I}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return s.enable(s.load()),s}return Gt=r,Gt}var Wn;function ma(){return Wn||(Wn=1,function(r,e){e.formatArgs=s,e.save=f,e.load=l,e.useColors=t,e.storage=g(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;const v="color: "+this.color;c.splice(1,0,v,"color: inherit");let h=0,I=0;c[0].replace(/%[a-zA-Z%]/g,B=>{B!=="%%"&&(h++,B==="%c"&&(I=h))}),c.splice(I,0,v)}e.log=console.debug||console.log||(()=>{});function f(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch(v){}}function l(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(v){}return!c&&typeof ae!="undefined"&&"env"in ae&&(c=ae.env.DEBUG),c}function g(){try{return localStorage}catch(c){}}r.exports=ya()(e);const{formatters:u}=r.exports;u.j=function(c){try{return JSON.stringify(c)}catch(v){return"[UnexpectedJSONParseError]: "+v.message}}}(Rt,Rt.exports)),Rt.exports}var Vt,Gn;function va(){return Gn||(Gn=1,Vt=function(){if(typeof globalThis=="undefined")return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}),Vt}var Pt={exports:{}},Tt={exports:{}},zt={},Vn;function yt(){return Vn||(Vn=1,function(r){Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e={},t={};t.byteLength=h,t.toByteArray=B,t.fromByteArray=N;for(var s=[],f=[],l=typeof Uint8Array!="undefined"?Uint8Array:Array,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,c=g.length;u<c;++u)s[u]=g[u],f[g.charCodeAt(u)]=u;f[45]=62,f[95]=63;function v(R){var A=R.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=R.indexOf("=");P===-1&&(P=A);var k=P===A?0:4-P%4;return[P,k]}function h(R){var A=v(R),P=A[0],k=A[1];return(P+k)*3/4-k}function I(R,A,P){return(A+P)*3/4-P}function B(R){var A,P=v(R),k=P[0],S=P[1],C=new l(I(R,k,S)),M=0,W=S>0?k-4:k,X;for(X=0;X<W;X+=4)A=f[R.charCodeAt(X)]<<18|f[R.charCodeAt(X+1)]<<12|f[R.charCodeAt(X+2)]<<6|f[R.charCodeAt(X+3)],C[M++]=A>>16&255,C[M++]=A>>8&255,C[M++]=A&255;return S===2&&(A=f[R.charCodeAt(X)]<<2|f[R.charCodeAt(X+1)]>>4,C[M++]=A&255),S===1&&(A=f[R.charCodeAt(X)]<<10|f[R.charCodeAt(X+1)]<<4|f[R.charCodeAt(X+2)]>>2,C[M++]=A>>8&255,C[M++]=A&255),C}function x(R){return s[R>>18&63]+s[R>>12&63]+s[R>>6&63]+s[R&63]}function b(R,A,P){for(var k,S=[],C=A;C<P;C+=3)k=(R[C]<<16&16711680)+(R[C+1]<<8&65280)+(R[C+2]&255),S.push(x(k));return S.join("")}function N(R){for(var A,P=R.length,k=P%3,S=[],C=16383,M=0,W=P-k;M<W;M+=C)S.push(b(R,M,M+C>W?W:M+C));return k===1?(A=R[P-1],S.push(s[A>>2]+s[A<<4&63]+"==")):k===2&&(A=(R[P-2]<<8)+R[P-1],S.push(s[A>>10]+s[A>>4&63]+s[A<<2&63]+"=")),S.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(R,A,P,k,S){var C,M,W=S*8-k-1,X=(1<<W)-1,re=X>>1,U=-7,he=P?S-1:0,de=P?-1:1,me=R[A+he];for(he+=de,C=me&(1<<-U)-1,me>>=-U,U+=W;U>0;C=C*256+R[A+he],he+=de,U-=8);for(M=C&(1<<-U)-1,C>>=-U,U+=k;U>0;M=M*256+R[A+he],he+=de,U-=8);if(C===0)C=1-re;else{if(C===X)return M?NaN:(me?-1:1)*(1/0);M=M+Math.pow(2,k),C=C-re}return(me?-1:1)*M*Math.pow(2,C-k)},T.write=function(R,A,P,k,S,C){var M,W,X,re=C*8-S-1,U=(1<<re)-1,he=U>>1,de=S===23?Math.pow(2,-24)-Math.pow(2,-77):0,me=k?0:C-1,Pe=k?1:-1,ke=A<0||A===0&&1/A<0?1:0;for(A=Math.abs(A),isNaN(A)||A===1/0?(W=isNaN(A)?1:0,M=U):(M=Math.floor(Math.log(A)/Math.LN2),A*(X=Math.pow(2,-M))<1&&(M--,X*=2),M+he>=1?A+=de/X:A+=de*Math.pow(2,1-he),A*X>=2&&(M++,X/=2),M+he>=U?(W=0,M=U):M+he>=1?(W=(A*X-1)*Math.pow(2,S),M=M+he):(W=A*Math.pow(2,he-1)*Math.pow(2,S),M=0));S>=8;R[P+me]=W&255,me+=Pe,W/=256,S-=8);for(M=M<<S|W,re+=S;re>0;R[P+me]=M&255,me+=Pe,M/=256,re-=8);R[P+me-Pe]|=ke*128};/*!
7
7
  * The buffer module from node.js, for the browser.
8
8
  *
9
9
  * @author Feross Aboukhadijeh <https://feross.org>
10
10
  * @license MIT
11
- */(function(R){const A=t,P=T,k=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=U,R.SlowBuffer=V,R.INSPECT_MAX_BYTES=50;const S=2147483647;R.kMaxLength=S;const{Uint8Array:C,ArrayBuffer:M,SharedArrayBuffer:W}=globalThis;U.TYPED_ARRAY_SUPPORT=X(),!U.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function X(){try{const p=new C(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,C.prototype),Object.setPrototypeOf(p,i),p.foo()===42}catch(p){return!1}}Object.defineProperty(U.prototype,"parent",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.buffer}}),Object.defineProperty(U.prototype,"offset",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.byteOffset}});function re(p){if(p>S)throw new RangeError('The value "'+p+'" is invalid for option "size"');const i=new C(p);return Object.setPrototypeOf(i,U.prototype),i}function U(p,i,a){if(typeof p=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Pe(p)}return he(p,i,a)}U.poolSize=8192;function he(p,i,a){if(typeof p=="string")return ke(p,i);if(M.isView(p))return _e(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Ze(p,M)||p&&Ze(p.buffer,M)||typeof W!="undefined"&&(Ze(p,W)||p&&Ze(p.buffer,W)))return Oe(p,i,a);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const E=p.valueOf&&p.valueOf();if(E!=null&&E!==p)return U.from(E,i,a);const L=qe(p);if(L)return L;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return U.from(p[Symbol.toPrimitive]("string"),i,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}U.from=function(p,i,a){return he(p,i,a)},Object.setPrototypeOf(U.prototype,C.prototype),Object.setPrototypeOf(U,C);function de(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function me(p,i,a){return de(p),p<=0?re(p):i!==void 0?typeof a=="string"?re(p).fill(i,a):re(p).fill(i):re(p)}U.alloc=function(p,i,a){return me(p,i,a)};function Pe(p){return de(p),re(p<0?0:$(p)|0)}U.allocUnsafe=function(p){return Pe(p)},U.allocUnsafeSlow=function(p){return Pe(p)};function ke(p,i){if((typeof i!="string"||i==="")&&(i="utf8"),!U.isEncoding(i))throw new TypeError("Unknown encoding: "+i);const a=J(p,i)|0;let E=re(a);const L=E.write(p,i);return L!==a&&(E=E.slice(0,L)),E}function Ee(p){const i=p.length<0?0:$(p.length)|0,a=re(i);for(let E=0;E<i;E+=1)a[E]=p[E]&255;return a}function _e(p){if(Ze(p,C)){const i=new C(p);return Oe(i.buffer,i.byteOffset,i.byteLength)}return Ee(p)}function Oe(p,i,a){if(i<0||p.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<i+(a||0))throw new RangeError('"length" is outside of buffer bounds');let E;return i===void 0&&a===void 0?E=new C(p):a===void 0?E=new C(p,i):E=new C(p,i,a),Object.setPrototypeOf(E,U.prototype),E}function qe(p){if(U.isBuffer(p)){const i=$(p.length)|0,a=re(i);return a.length===0||p.copy(a,0,0,i),a}if(p.length!==void 0)return typeof p.length!="number"||In(p.length)?re(0):Ee(p);if(p.type==="Buffer"&&Array.isArray(p.data))return Ee(p.data)}function $(p){if(p>=S)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S.toString(16)+" bytes");return p|0}function V(p){return+p!=p&&(p=0),U.alloc(+p)}U.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==U.prototype},U.compare=function(i,a){if(Ze(i,C)&&(i=U.from(i,i.offset,i.byteLength)),Ze(a,C)&&(a=U.from(a,a.offset,a.byteLength)),!U.isBuffer(i)||!U.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===a)return 0;let E=i.length,L=a.length;for(let q=0,K=Math.min(E,L);q<K;++q)if(i[q]!==a[q]){E=i[q],L=a[q];break}return E<L?-1:L<E?1:0},U.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},U.concat=function(i,a){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return U.alloc(0);let E;if(a===void 0)for(a=0,E=0;E<i.length;++E)a+=i[E].length;const L=U.allocUnsafe(a);let q=0;for(E=0;E<i.length;++E){let K=i[E];if(Ze(K,C))q+K.length>L.length?(U.isBuffer(K)||(K=U.from(K)),K.copy(L,q)):C.prototype.set.call(L,K,q);else if(U.isBuffer(K))K.copy(L,q);else throw new TypeError('"list" argument must be an Array of Buffers');q+=K.length}return L};function J(p,i){if(U.isBuffer(p))return p.length;if(M.isView(p)||Ze(p,M))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);const a=p.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&a===0)return 0;let L=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return be(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return pe(p).length;default:if(L)return E?-1:be(p).length;i=(""+i).toLowerCase(),L=!0}}U.byteLength=J;function ne(p,i,a){let E=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,i>>>=0,a<=i))return"";for(p||(p="utf8");;)switch(p){case"hex":return Fe(this,i,a);case"utf8":case"utf-8":return le(this,i,a);case"ascii":return De(this,i,a);case"latin1":case"binary":return H(this,i,a);case"base64":return ee(this,i,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ue(this,i,a);default:if(E)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),E=!0}}U.prototype._isBuffer=!0;function D(p,i,a){const E=p[i];p[i]=p[a],p[a]=E}U.prototype.swap16=function(){const i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;a<i;a+=2)D(this,a,a+1);return this},U.prototype.swap32=function(){const i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let a=0;a<i;a+=4)D(this,a,a+3),D(this,a+1,a+2);return this},U.prototype.swap64=function(){const i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let a=0;a<i;a+=8)D(this,a,a+7),D(this,a+1,a+6),D(this,a+2,a+5),D(this,a+3,a+4);return this},U.prototype.toString=function(){const i=this.length;return i===0?"":arguments.length===0?le(this,0,i):ne.apply(this,arguments)},U.prototype.toLocaleString=U.prototype.toString,U.prototype.equals=function(i){if(!U.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:U.compare(this,i)===0},U.prototype.inspect=function(){let i="";const a=R.INSPECT_MAX_BYTES;return i=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(i+=" ... "),"<Buffer "+i+">"},k&&(U.prototype[k]=U.prototype.inspect),U.prototype.compare=function(i,a,E,L,q){if(Ze(i,C)&&(i=U.from(i,i.offset,i.byteLength)),!U.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(a===void 0&&(a=0),E===void 0&&(E=i?i.length:0),L===void 0&&(L=0),q===void 0&&(q=this.length),a<0||E>i.length||L<0||q>this.length)throw new RangeError("out of range index");if(L>=q&&a>=E)return 0;if(L>=q)return-1;if(a>=E)return 1;if(a>>>=0,E>>>=0,L>>>=0,q>>>=0,this===i)return 0;let K=q-L,fe=E-a;const Te=Math.min(K,fe),Re=this.slice(L,q),Ae=i.slice(a,E);for(let ve=0;ve<Te;++ve)if(Re[ve]!==Ae[ve]){K=Re[ve],fe=Ae[ve];break}return K<fe?-1:fe<K?1:0};function F(p,i,a,E,L){if(p.length===0)return-1;if(typeof a=="string"?(E=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,In(a)&&(a=L?0:p.length-1),a<0&&(a=p.length+a),a>=p.length){if(L)return-1;a=p.length-1}else if(a<0)if(L)a=0;else return-1;if(typeof i=="string"&&(i=U.from(i,E)),U.isBuffer(i))return i.length===0?-1:G(p,i,a,E,L);if(typeof i=="number")return i=i&255,typeof C.prototype.indexOf=="function"?L?C.prototype.indexOf.call(p,i,a):C.prototype.lastIndexOf.call(p,i,a):G(p,[i],a,E,L);throw new TypeError("val must be string, number or Buffer")}function G(p,i,a,E,L){let q=1,K=p.length,fe=i.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(p.length<2||i.length<2)return-1;q=2,K/=2,fe/=2,a/=2}function Te(Ae,ve){return q===1?Ae[ve]:Ae.readUInt16BE(ve*q)}let Re;if(L){let Ae=-1;for(Re=a;Re<K;Re++)if(Te(p,Re)===Te(i,Ae===-1?0:Re-Ae)){if(Ae===-1&&(Ae=Re),Re-Ae+1===fe)return Ae*q}else Ae!==-1&&(Re-=Re-Ae),Ae=-1}else for(a+fe>K&&(a=K-fe),Re=a;Re>=0;Re--){let Ae=!0;for(let ve=0;ve<fe;ve++)if(Te(p,Re+ve)!==Te(i,ve)){Ae=!1;break}if(Ae)return Re}return-1}U.prototype.includes=function(i,a,E){return this.indexOf(i,a,E)!==-1},U.prototype.indexOf=function(i,a,E){return F(this,i,a,E,!0)},U.prototype.lastIndexOf=function(i,a,E){return F(this,i,a,E,!1)};function Z(p,i,a,E){a=Number(a)||0;const L=p.length-a;E?(E=Number(E),E>L&&(E=L)):E=L;const q=i.length;E>q/2&&(E=q/2);let K;for(K=0;K<E;++K){const fe=parseInt(i.substr(K*2,2),16);if(In(fe))return K;p[a+K]=fe}return K}function Q(p,i,a,E){return Dt(be(i,p.length-a),p,a,E)}function y(p,i,a,E){return Dt(Se(i),p,a,E)}function w(p,i,a,E){return Dt(pe(i),p,a,E)}function z(p,i,a,E){return Dt(Ce(i,p.length-a),p,a,E)}U.prototype.write=function(i,a,E,L){if(a===void 0)L="utf8",E=this.length,a=0;else if(E===void 0&&typeof a=="string")L=a,E=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(E)?(E=E>>>0,L===void 0&&(L="utf8")):(L=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const q=this.length-a;if((E===void 0||E>q)&&(E=q),i.length>0&&(E<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");let K=!1;for(;;)switch(L){case"hex":return Z(this,i,a,E);case"utf8":case"utf-8":return Q(this,i,a,E);case"ascii":case"latin1":case"binary":return y(this,i,a,E);case"base64":return w(this,i,a,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,i,a,E);default:if(K)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),K=!0}},U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ee(p,i,a){return i===0&&a===p.length?A.fromByteArray(p):A.fromByteArray(p.slice(i,a))}function le(p,i,a){a=Math.min(p.length,a);const E=[];let L=i;for(;L<a;){const q=p[L];let K=null,fe=q>239?4:q>223?3:q>191?2:1;if(L+fe<=a){let Te,Re,Ae,ve;switch(fe){case 1:q<128&&(K=q);break;case 2:Te=p[L+1],(Te&192)===128&&(ve=(q&31)<<6|Te&63,ve>127&&(K=ve));break;case 3:Te=p[L+1],Re=p[L+2],(Te&192)===128&&(Re&192)===128&&(ve=(q&15)<<12|(Te&63)<<6|Re&63,ve>2047&&(ve<55296||ve>57343)&&(K=ve));break;case 4:Te=p[L+1],Re=p[L+2],Ae=p[L+3],(Te&192)===128&&(Re&192)===128&&(Ae&192)===128&&(ve=(q&15)<<18|(Te&63)<<12|(Re&63)<<6|Ae&63,ve>65535&&ve<1114112&&(K=ve))}}K===null?(K=65533,fe=1):K>65535&&(K-=65536,E.push(K>>>10&1023|55296),K=56320|K&1023),E.push(K),L+=fe}return se(E)}const ie=4096;function se(p){const i=p.length;if(i<=ie)return String.fromCharCode.apply(String,p);let a="",E=0;for(;E<i;)a+=String.fromCharCode.apply(String,p.slice(E,E+=ie));return a}function De(p,i,a){let E="";a=Math.min(p.length,a);for(let L=i;L<a;++L)E+=String.fromCharCode(p[L]&127);return E}function H(p,i,a){let E="";a=Math.min(p.length,a);for(let L=i;L<a;++L)E+=String.fromCharCode(p[L]);return E}function Fe(p,i,a){const E=p.length;(!i||i<0)&&(i=0),(!a||a<0||a>E)&&(a=E);let L="";for(let q=i;q<a;++q)L+=Sl[p[q]];return L}function Ue(p,i,a){const E=p.slice(i,a);let L="";for(let q=0;q<E.length-1;q+=2)L+=String.fromCharCode(E[q]+E[q+1]*256);return L}U.prototype.slice=function(i,a){const E=this.length;i=~~i,a=a===void 0?E:~~a,i<0?(i+=E,i<0&&(i=0)):i>E&&(i=E),a<0?(a+=E,a<0&&(a=0)):a>E&&(a=E),a<i&&(a=i);const L=this.subarray(i,a);return Object.setPrototypeOf(L,U.prototype),L};function ye(p,i,a){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+i>a)throw new RangeError("Trying to access beyond buffer length")}U.prototype.readUintLE=U.prototype.readUIntLE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=this[i],q=1,K=0;for(;++K<a&&(q*=256);)L+=this[i+K]*q;return L},U.prototype.readUintBE=U.prototype.readUIntBE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=this[i+--a],q=1;for(;a>0&&(q*=256);)L+=this[i+--a]*q;return L},U.prototype.readUint8=U.prototype.readUInt8=function(i,a){return i=i>>>0,a||ye(i,1,this.length),this[i]},U.prototype.readUint16LE=U.prototype.readUInt16LE=function(i,a){return i=i>>>0,a||ye(i,2,this.length),this[i]|this[i+1]<<8},U.prototype.readUint16BE=U.prototype.readUInt16BE=function(i,a){return i=i>>>0,a||ye(i,2,this.length),this[i]<<8|this[i+1]},U.prototype.readUint32LE=U.prototype.readUInt32LE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},U.prototype.readUint32BE=U.prototype.readUInt32BE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},U.prototype.readBigUInt64LE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=a+this[++i]*oe(2,8)+this[++i]*oe(2,16)+this[++i]*oe(2,24),q=this[++i]+this[++i]*oe(2,8)+this[++i]*oe(2,16)+E*oe(2,24);return BigInt(L)+(BigInt(q)<<BigInt(32))}),U.prototype.readBigUInt64BE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=a*oe(2,24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+this[++i],q=this[++i]*oe(2,24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+E;return(BigInt(L)<<BigInt(32))+BigInt(q)}),U.prototype.readIntLE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=this[i],q=1,K=0;for(;++K<a&&(q*=256);)L+=this[i+K]*q;return q*=128,L>=q&&(L-=Math.pow(2,8*a)),L},U.prototype.readIntBE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=a,q=1,K=this[i+--L];for(;L>0&&(q*=256);)K+=this[i+--L]*q;return q*=128,K>=q&&(K-=Math.pow(2,8*a)),K},U.prototype.readInt8=function(i,a){return i=i>>>0,a||ye(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},U.prototype.readInt16LE=function(i,a){i=i>>>0,a||ye(i,2,this.length);const E=this[i]|this[i+1]<<8;return E&32768?E|4294901760:E},U.prototype.readInt16BE=function(i,a){i=i>>>0,a||ye(i,2,this.length);const E=this[i+1]|this[i]<<8;return E&32768?E|4294901760:E},U.prototype.readInt32LE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},U.prototype.readInt32BE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},U.prototype.readBigInt64LE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=this[i+4]+this[i+5]*oe(2,8)+this[i+6]*oe(2,16)+(E<<24);return(BigInt(L)<<BigInt(32))+BigInt(a+this[++i]*oe(2,8)+this[++i]*oe(2,16)+this[++i]*oe(2,24))}),U.prototype.readBigInt64BE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=(a<<24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+this[++i];return(BigInt(L)<<BigInt(32))+BigInt(this[++i]*oe(2,24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+E)}),U.prototype.readFloatLE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),P.read(this,i,!0,23,4)},U.prototype.readFloatBE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),P.read(this,i,!1,23,4)},U.prototype.readDoubleLE=function(i,a){return i=i>>>0,a||ye(i,8,this.length),P.read(this,i,!0,52,8)},U.prototype.readDoubleBE=function(i,a){return i=i>>>0,a||ye(i,8,this.length),P.read(this,i,!1,52,8)};function we(p,i,a,E,L,q){if(!U.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>L||i<q)throw new RangeError('"value" argument is out of bounds');if(a+E>p.length)throw new RangeError("Index out of range")}U.prototype.writeUintLE=U.prototype.writeUIntLE=function(i,a,E,L){if(i=+i,a=a>>>0,E=E>>>0,!L){const fe=Math.pow(2,8*E)-1;we(this,i,a,E,fe,0)}let q=1,K=0;for(this[a]=i&255;++K<E&&(q*=256);)this[a+K]=i/q&255;return a+E},U.prototype.writeUintBE=U.prototype.writeUIntBE=function(i,a,E,L){if(i=+i,a=a>>>0,E=E>>>0,!L){const fe=Math.pow(2,8*E)-1;we(this,i,a,E,fe,0)}let q=E-1,K=1;for(this[a+q]=i&255;--q>=0&&(K*=256);)this[a+q]=i/K&255;return a+E},U.prototype.writeUint8=U.prototype.writeUInt8=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,1,255,0),this[a]=i&255,a+1},U.prototype.writeUint16LE=U.prototype.writeUInt16LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,65535,0),this[a]=i&255,this[a+1]=i>>>8,a+2},U.prototype.writeUint16BE=U.prototype.writeUInt16BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,65535,0),this[a]=i>>>8,this[a+1]=i&255,a+2},U.prototype.writeUint32LE=U.prototype.writeUInt32LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,4294967295,0),this[a+3]=i>>>24,this[a+2]=i>>>16,this[a+1]=i>>>8,this[a]=i&255,a+4},U.prototype.writeUint32BE=U.prototype.writeUInt32BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,4294967295,0),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4};function $e(p,i,a,E,L){_(i,E,L,p,a,7);let q=Number(i&BigInt(4294967295));p[a++]=q,q=q>>8,p[a++]=q,q=q>>8,p[a++]=q,q=q>>8,p[a++]=q;let K=Number(i>>BigInt(32)&BigInt(4294967295));return p[a++]=K,K=K>>8,p[a++]=K,K=K>>8,p[a++]=K,K=K>>8,p[a++]=K,a}function Ne(p,i,a,E,L){_(i,E,L,p,a,7);let q=Number(i&BigInt(4294967295));p[a+7]=q,q=q>>8,p[a+6]=q,q=q>>8,p[a+5]=q,q=q>>8,p[a+4]=q;let K=Number(i>>BigInt(32)&BigInt(4294967295));return p[a+3]=K,K=K>>8,p[a+2]=K,K=K>>8,p[a+1]=K,K=K>>8,p[a]=K,a+8}U.prototype.writeBigUInt64LE=rt(function(i,a=0){return $e(this,i,a,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeBigUInt64BE=rt(function(i,a=0){return Ne(this,i,a,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeIntLE=function(i,a,E,L){if(i=+i,a=a>>>0,!L){const Te=Math.pow(2,8*E-1);we(this,i,a,E,Te-1,-Te)}let q=0,K=1,fe=0;for(this[a]=i&255;++q<E&&(K*=256);)i<0&&fe===0&&this[a+q-1]!==0&&(fe=1),this[a+q]=(i/K>>0)-fe&255;return a+E},U.prototype.writeIntBE=function(i,a,E,L){if(i=+i,a=a>>>0,!L){const Te=Math.pow(2,8*E-1);we(this,i,a,E,Te-1,-Te)}let q=E-1,K=1,fe=0;for(this[a+q]=i&255;--q>=0&&(K*=256);)i<0&&fe===0&&this[a+q+1]!==0&&(fe=1),this[a+q]=(i/K>>0)-fe&255;return a+E},U.prototype.writeInt8=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,1,127,-128),i<0&&(i=255+i+1),this[a]=i&255,a+1},U.prototype.writeInt16LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,32767,-32768),this[a]=i&255,this[a+1]=i>>>8,a+2},U.prototype.writeInt16BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,32767,-32768),this[a]=i>>>8,this[a+1]=i&255,a+2},U.prototype.writeInt32LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,2147483647,-2147483648),this[a]=i&255,this[a+1]=i>>>8,this[a+2]=i>>>16,this[a+3]=i>>>24,a+4},U.prototype.writeInt32BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4},U.prototype.writeBigInt64LE=rt(function(i,a=0){return $e(this,i,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),U.prototype.writeBigInt64BE=rt(function(i,a=0){return Ne(this,i,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function We(p,i,a,E,L,q){if(a+E>p.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function Ve(p,i,a,E,L){return i=+i,a=a>>>0,L||We(p,i,a,4),P.write(p,i,a,E,23,4),a+4}U.prototype.writeFloatLE=function(i,a,E){return Ve(this,i,a,!0,E)},U.prototype.writeFloatBE=function(i,a,E){return Ve(this,i,a,!1,E)};function Me(p,i,a,E,L){return i=+i,a=a>>>0,L||We(p,i,a,8),P.write(p,i,a,E,52,8),a+8}U.prototype.writeDoubleLE=function(i,a,E){return Me(this,i,a,!0,E)},U.prototype.writeDoubleBE=function(i,a,E){return Me(this,i,a,!1,E)},U.prototype.copy=function(i,a,E,L){if(!U.isBuffer(i))throw new TypeError("argument should be a Buffer");if(E||(E=0),!L&&L!==0&&(L=this.length),a>=i.length&&(a=i.length),a||(a=0),L>0&&L<E&&(L=E),L===E||i.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),i.length-a<L-E&&(L=i.length-a+E);const q=L-E;return this===i&&typeof C.prototype.copyWithin=="function"?this.copyWithin(a,E,L):C.prototype.set.call(i,this.subarray(E,L),a),q},U.prototype.fill=function(i,a,E,L){if(typeof i=="string"){if(typeof a=="string"?(L=a,a=0,E=this.length):typeof E=="string"&&(L=E,E=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!U.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(i.length===1){const K=i.charCodeAt(0);(L==="utf8"&&K<128||L==="latin1")&&(i=K)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(a<0||this.length<a||this.length<E)throw new RangeError("Out of range index");if(E<=a)return this;a=a>>>0,E=E===void 0?this.length:E>>>0,i||(i=0);let q;if(typeof i=="number")for(q=a;q<E;++q)this[q]=i;else{const K=U.isBuffer(i)?i:U.from(i,L),fe=K.length;if(fe===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(q=0;q<E-a;++q)this[q+a]=K[q%fe]}return this};const tt={};function d(p,i,a){tt[p]=class extends a{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name}get code(){return p}set code(L){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:L,writable:!0})}toString(){return`${this.name} [${p}]: ${this.message}`}}}d("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),d("ERR_INVALID_ARG_TYPE",function(p,i){return`The "${p}" argument must be of type number. Received type ${typeof i}`},TypeError),d("ERR_OUT_OF_RANGE",function(p,i,a){let E=`The value of "${p}" is out of range.`,L=a;return Number.isInteger(a)&&Math.abs(a)>oe(2,32)?L=n(String(a)):typeof a=="bigint"&&(L=String(a),(a>oe(BigInt(2),BigInt(32))||a<-oe(BigInt(2),BigInt(32)))&&(L=n(L)),L+="n"),E+=` It must be ${i}. Received ${L}`,E},RangeError);function n(p){let i="",a=p.length;const E=p[0]==="-"?1:0;for(;a>=E+4;a-=3)i=`_${p.slice(a-3,a)}${i}`;return`${p.slice(0,a)}${i}`}function o(p,i,a){O(i,"offset"),(p[i]===void 0||p[i+a]===void 0)&&j(i,p.length-(a+1))}function _(p,i,a,E,L,q){if(p>a||p<i){const K=typeof i=="bigint"?"n":"";let fe;throw i===0||i===BigInt(0)?fe=`>= 0${K} and < 2${K} ** ${(q+1)*8}${K}`:fe=`>= -(2${K} ** ${(q+1)*8-1}${K}) and < 2 ** ${(q+1)*8-1}${K}`,new tt.ERR_OUT_OF_RANGE("value",fe,p)}o(E,L,q)}function O(p,i){if(typeof p!="number")throw new tt.ERR_INVALID_ARG_TYPE(i,"number",p)}function j(p,i,a){throw Math.floor(p)!==p?(O(p,a),new tt.ERR_OUT_OF_RANGE("offset","an integer",p)):i<0?new tt.ERR_BUFFER_OUT_OF_BOUNDS:new tt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,p)}const Y=/[^+/0-9A-Za-z-_]/g;function ce(p){if(p=p.split("=")[0],p=p.trim().replace(Y,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function be(p,i){i=i||1/0;let a;const E=p.length;let L=null;const q=[];for(let K=0;K<E;++K){if(a=p.charCodeAt(K),a>55295&&a<57344){if(!L){if(a>56319){(i-=3)>-1&&q.push(239,191,189);continue}else if(K+1===E){(i-=3)>-1&&q.push(239,191,189);continue}L=a;continue}if(a<56320){(i-=3)>-1&&q.push(239,191,189),L=a;continue}a=(L-55296<<10|a-56320)+65536}else L&&(i-=3)>-1&&q.push(239,191,189);if(L=null,a<128){if((i-=1)<0)break;q.push(a)}else if(a<2048){if((i-=2)<0)break;q.push(a>>6|192,a&63|128)}else if(a<65536){if((i-=3)<0)break;q.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((i-=4)<0)break;q.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return q}function Se(p){const i=[];for(let a=0;a<p.length;++a)i.push(p.charCodeAt(a)&255);return i}function Ce(p,i){let a,E,L;const q=[];for(let K=0;K<p.length&&!((i-=2)<0);++K)a=p.charCodeAt(K),E=a>>8,L=a%256,q.push(L),q.push(E);return q}function pe(p){return A.toByteArray(ce(p))}function Dt(p,i,a,E){let L;for(L=0;L<E&&!(L+a>=i.length||L>=p.length);++L)i[L+a]=p[L];return L}function Ze(p,i){return p instanceof i||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===i.name}function In(p){return p!==p}const Sl=function(){const p="0123456789abcdef",i=new Array(256);for(let a=0;a<16;++a){const E=a*16;for(let L=0;L<16;++L)i[E+L]=p[a]+p[L]}return i}();function rt(p){return typeof BigInt=="undefined"?_l:p}function _l(){throw new Error("BigInt not supported")}})(e);const m=e.Buffer;r.Blob=e.Blob,r.BlobOptions=e.BlobOptions,r.Buffer=e.Buffer,r.File=e.File,r.FileOptions=e.FileOptions,r.INSPECT_MAX_BYTES=e.INSPECT_MAX_BYTES,r.SlowBuffer=e.SlowBuffer,r.TranscodeEncoding=e.TranscodeEncoding,r.atob=e.atob,r.btoa=e.btoa,r.constants=e.constants,r.default=m,r.isAscii=e.isAscii,r.isUtf8=e.isUtf8,r.kMaxLength=e.kMaxLength,r.kStringMaxLength=e.kStringMaxLength,r.resolveObjectURL=e.resolveObjectURL,r.transcode=e.transcode}(zt)),zt}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var zn;function Hn(){return zn||(zn=1,function(r,e){var t=yt(),s=t.Buffer;function u(g,f){for(var c in g)f[c]=g[c]}s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?r.exports=t:(u(t,e),e.Buffer=l);function l(g,f,c){return s(g,f,c)}l.prototype=Object.create(s.prototype),u(s,l),l.from=function(g,f,c){if(typeof g=="number")throw new TypeError("Argument must not be a number");return s(g,f,c)},l.alloc=function(g,f,c){if(typeof g!="number")throw new TypeError("Argument must be a number");var v=s(g);return f!==void 0?typeof c=="string"?v.fill(f,c):v.fill(f):v.fill(0),v},l.allocUnsafe=function(g){if(typeof g!="number")throw new TypeError("Argument must be a number");return s(g)},l.allocUnsafeSlow=function(g){if(typeof g!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(g)}}(Tt,Tt.exports)),Tt.exports}var Jn;function wa(){if(Jn)return Pt.exports;Jn=1;var r=65536,e=4294967295;function t(){throw new Error(`Secure random number generation is not supported by this browser.
12
- Use Chrome, Firefox or Internet Explorer 11`)}var s=Hn().Buffer,u=globalThis.crypto||globalThis.msCrypto;u&&u.getRandomValues?Pt.exports=l:Pt.exports=t;function l(g,f){if(g>e)throw new RangeError("requested too many random bytes");var c=s.allocUnsafe(g);if(g>0)if(g>r)for(var v=0;v<g;v+=r)u.getRandomValues(c.slice(v,v+r));else u.getRandomValues(c);return typeof f=="function"?ae.nextTick(function(){f(null,c)}):c}return Pt.exports}var At={exports:{}},It={exports:{}},Yn;function Ht(){if(Yn)return It.exports;Yn=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(k,S,C){return Function.prototype.apply.call(k,S,C)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:t=function(k){return Object.getOwnPropertyNames(k)};function s(P){console&&console.warn&&console.warn(P)}var u=Number.isNaN||function(k){return k!==k};function l(){l.init.call(this)}It.exports=l,It.exports.once=m,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var g=10;function f(P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return g},set:function(P){if(typeof P!="number"||P<0||u(P))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+P+".");g=P}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||u(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this};function c(P){return P._maxListeners===void 0?l.defaultMaxListeners:P._maxListeners}l.prototype.getMaxListeners=function(){return c(this)},l.prototype.emit=function(k){for(var S=[],C=1;C<arguments.length;C++)S.push(arguments[C]);var M=k==="error",W=this._events;if(W!==void 0)M=M&&W.error===void 0;else if(!M)return!1;if(M){var X;if(S.length>0&&(X=S[0]),X instanceof Error)throw X;var re=new Error("Unhandled error."+(X?" ("+X.message+")":""));throw re.context=X,re}var U=W[k];if(U===void 0)return!1;if(typeof U=="function")e(U,this,S);else for(var he=U.length,de=b(U,he),C=0;C<he;++C)e(de[C],this,S);return!0};function v(P,k,S,C){var M,W,X;if(f(S),W=P._events,W===void 0?(W=P._events=Object.create(null),P._eventsCount=0):(W.newListener!==void 0&&(P.emit("newListener",k,S.listener?S.listener:S),W=P._events),X=W[k]),X===void 0)X=W[k]=S,++P._eventsCount;else if(typeof X=="function"?X=W[k]=C?[S,X]:[X,S]:C?X.unshift(S):X.push(S),M=c(P),M>0&&X.length>M&&!X.warned){X.warned=!0;var re=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");re.name="MaxListenersExceededWarning",re.emitter=P,re.type=k,re.count=X.length,s(re)}return P}l.prototype.addListener=function(k,S){return v(this,k,S,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(k,S){return v(this,k,S,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function I(P,k,S){var C={fired:!1,wrapFn:void 0,target:P,type:k,listener:S},M=h.bind(C);return M.listener=S,C.wrapFn=M,M}l.prototype.once=function(k,S){return f(S),this.on(k,I(this,k,S)),this},l.prototype.prependOnceListener=function(k,S){return f(S),this.prependListener(k,I(this,k,S)),this},l.prototype.removeListener=function(k,S){var C,M,W,X,re;if(f(S),M=this._events,M===void 0)return this;if(C=M[k],C===void 0)return this;if(C===S||C.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete M[k],M.removeListener&&this.emit("removeListener",k,C.listener||S));else if(typeof C!="function"){for(W=-1,X=C.length-1;X>=0;X--)if(C[X]===S||C[X].listener===S){re=C[X].listener,W=X;break}if(W<0)return this;W===0?C.shift():N(C,W),C.length===1&&(M[k]=C[0]),M.removeListener!==void 0&&this.emit("removeListener",k,re||S)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(k){var S,C,M;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[k]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[k]),this;if(arguments.length===0){var W=Object.keys(C),X;for(M=0;M<W.length;++M)X=W[M],X!=="removeListener"&&this.removeAllListeners(X);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=C[k],typeof S=="function")this.removeListener(k,S);else if(S!==void 0)for(M=S.length-1;M>=0;M--)this.removeListener(k,S[M]);return this};function B(P,k,S){var C=P._events;if(C===void 0)return[];var M=C[k];return M===void 0?[]:typeof M=="function"?S?[M.listener||M]:[M]:S?T(M):b(M,M.length)}l.prototype.listeners=function(k){return B(this,k,!0)},l.prototype.rawListeners=function(k){return B(this,k,!1)},l.listenerCount=function(P,k){return typeof P.listenerCount=="function"?P.listenerCount(k):x.call(P,k)},l.prototype.listenerCount=x;function x(P){var k=this._events;if(k!==void 0){var S=k[P];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(P,k){for(var S=new Array(k),C=0;C<k;++C)S[C]=P[C];return S}function N(P,k){for(;k+1<P.length;k++)P[k]=P[k+1];P.pop()}function T(P){for(var k=new Array(P.length),S=0;S<k.length;++S)k[S]=P[S].listener||P[S];return k}function m(P,k){return new Promise(function(S,C){function M(X){P.removeListener(k,W),C(X)}function W(){typeof P.removeListener=="function"&&P.removeListener("error",M),S([].slice.call(arguments))}A(P,k,W,{once:!0}),k!=="error"&&R(P,M,{once:!0})})}function R(P,k,S){typeof P.on=="function"&&A(P,"error",k,S)}function A(P,k,S,C){if(typeof P.on=="function")C.once?P.once(k,S):P.on(k,S);else if(typeof P.addEventListener=="function")P.addEventListener(k,function M(W){C.once&&P.removeEventListener(k,M),S(W)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof P)}return It.exports}var Jt,Kn;function Xn(){return Kn||(Kn=1,Jt=Ht().EventEmitter),Jt}var Yt={},Kt={},Xt,Zn;function Qn(){return Zn||(Zn=1,Xt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),s=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var u=42;e[t]=u;for(var l in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var g=Object.getOwnPropertySymbols(e);if(g.length!==1||g[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,t);if(f.value!==u||f.enumerable!==!0)return!1}return!0}),Xt}var Zt,ei;function Bt(){if(ei)return Zt;ei=1;var r=Qn();return Zt=function(){return r()&&!!Symbol.toStringTag},Zt}var Qt,ti;function ri(){return ti||(ti=1,Qt=Object),Qt}var er,ni;function ba(){return ni||(ni=1,er=Error),er}var tr,ii;function Sa(){return ii||(ii=1,tr=EvalError),tr}var rr,oi;function _a(){return oi||(oi=1,rr=RangeError),rr}var nr,ai;function Ea(){return ai||(ai=1,nr=ReferenceError),nr}var ir,si;function li(){return si||(si=1,ir=SyntaxError),ir}var or,ci;function mt(){return ci||(ci=1,or=TypeError),or}var ar,ui;function Ca(){return ui||(ui=1,ar=URIError),ar}var sr,fi;function Ra(){return fi||(fi=1,sr=Math.abs),sr}var lr,hi;function Pa(){return hi||(hi=1,lr=Math.floor),lr}var cr,di;function Ta(){return di||(di=1,cr=Math.max),cr}var ur,pi;function Aa(){return pi||(pi=1,ur=Math.min),ur}var fr,gi;function Ia(){return gi||(gi=1,fr=Math.pow),fr}var hr,yi;function Ba(){return yi||(yi=1,hr=Math.round),hr}var dr,mi;function ka(){return mi||(mi=1,dr=Number.isNaN||function(e){return e!==e}),dr}var pr,vi;function Oa(){if(vi)return pr;vi=1;var r=ka();return pr=function(t){return r(t)||t===0?t:t<0?-1:1},pr}var gr,wi;function Ma(){return wi||(wi=1,gr=Object.getOwnPropertyDescriptor),gr}var yr,bi;function ct(){if(bi)return yr;bi=1;var r=Ma();if(r)try{r([],"length")}catch(e){r=null}return yr=r,yr}var mr,Si;function kt(){if(Si)return mr;Si=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch(e){r=!1}return mr=r,mr}var vr,_i;function La(){if(_i)return vr;_i=1;var r=typeof Symbol!="undefined"&&Symbol,e=Qn();return vr=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},vr}var wr,Ei;function Ci(){return Ei||(Ei=1,wr=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null),wr}var br,Ri;function Pi(){if(Ri)return br;Ri=1;var r=ri();return br=r.getPrototypeOf||null,br}var Sr,Ti;function Na(){if(Ti)return Sr;Ti=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,s="[object Function]",u=function(c,v){for(var h=[],I=0;I<c.length;I+=1)h[I]=c[I];for(var B=0;B<v.length;B+=1)h[B+c.length]=v[B];return h},l=function(c,v){for(var h=[],I=v,B=0;I<c.length;I+=1,B+=1)h[B]=c[I];return h},g=function(f,c){for(var v="",h=0;h<f.length;h+=1)v+=f[h],h+1<f.length&&(v+=c);return v};return Sr=function(c){var v=this;if(typeof v!="function"||e.apply(v)!==s)throw new TypeError(r+v);for(var h=l(arguments,1),I,B=function(){if(this instanceof I){var m=v.apply(this,u(h,arguments));return Object(m)===m?m:this}return v.apply(c,u(h,arguments))},x=t(0,v.length-h.length),b=[],N=0;N<x;N++)b[N]="$"+N;if(I=Function("binder","return function ("+g(b,",")+"){ return binder.apply(this,arguments); }")(B),v.prototype){var T=function(){};T.prototype=v.prototype,I.prototype=new T,T.prototype=null}return I},Sr}var _r,Ai;function vt(){if(Ai)return _r;Ai=1;var r=Na();return _r=Function.prototype.bind||r,_r}var Er,Ii;function Cr(){return Ii||(Ii=1,Er=Function.prototype.call),Er}var Rr,Bi;function Pr(){return Bi||(Bi=1,Rr=Function.prototype.apply),Rr}var Tr,ki;function Da(){return ki||(ki=1,Tr=typeof Reflect!="undefined"&&Reflect&&Reflect.apply),Tr}var Ar,Oi;function Mi(){if(Oi)return Ar;Oi=1;var r=vt(),e=Pr(),t=Cr(),s=Da();return Ar=s||r.call(t,e),Ar}var Ir,Li;function Br(){if(Li)return Ir;Li=1;var r=vt(),e=mt(),t=Cr(),s=Mi();return Ir=function(l){if(l.length<1||typeof l[0]!="function")throw new e("a function is required");return s(r,t,l)},Ir}var kr,Ni;function Fa(){if(Ni)return kr;Ni=1;var r=Br(),e=ct(),t;try{t=[].__proto__===Array.prototype}catch(g){if(!g||typeof g!="object"||!("code"in g)||g.code!=="ERR_PROTO_ACCESS")throw g}var s=!!t&&e&&e(Object.prototype,"__proto__"),u=Object,l=u.getPrototypeOf;return kr=s&&typeof s.get=="function"?r([s.get]):typeof l=="function"?function(f){return l(f==null?f:u(f))}:!1,kr}var Or,Di;function Mr(){if(Di)return Or;Di=1;var r=Ci(),e=Pi(),t=Fa();return Or=r?function(u){return r(u)}:e?function(u){if(!u||typeof u!="object"&&typeof u!="function")throw new TypeError("getProto: not an object");return e(u)}:t?function(u){return t(u)}:null,Or}var Lr,Fi;function Ui(){if(Fi)return Lr;Fi=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=vt();return Lr=t.call(r,e),Lr}var Nr,$i;function ji(){if($i)return Nr;$i=1;var r,e=ri(),t=ba(),s=Sa(),u=_a(),l=Ea(),g=li(),f=mt(),c=Ca(),v=Ra(),h=Pa(),I=Ta(),B=Aa(),x=Ia(),b=Ba(),N=Oa(),T=Function,m=function(Z){try{return T('"use strict"; return ('+Z+").constructor;")()}catch(Q){}},R=ct(),A=kt(),P=function(){throw new f},k=R?function(){try{return arguments.callee,P}catch(Z){try{return R(arguments,"callee").get}catch(Q){return P}}}():P,S=La()(),C=Mr(),M=Pi(),W=Ci(),X=Pr(),re=Cr(),U={},he=typeof Uint8Array=="undefined"||!C?r:C(Uint8Array),de={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?r:ArrayBuffer,"%ArrayIteratorPrototype%":S&&C?C([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":U,"%AsyncGenerator%":U,"%AsyncGeneratorFunction%":U,"%AsyncIteratorPrototype%":U,"%Atomics%":typeof Atomics=="undefined"?r:Atomics,"%BigInt%":typeof BigInt=="undefined"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":s,"%Float16Array%":typeof Float16Array=="undefined"?r:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?r:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?r:FinalizationRegistry,"%Function%":T,"%GeneratorFunction%":U,"%Int8Array%":typeof Int8Array=="undefined"?r:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?r:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":S&&C?C(C([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map=="undefined"?r:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!S||!C?r:C(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":R,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?r:Promise,"%Proxy%":typeof Proxy=="undefined"?r:Proxy,"%RangeError%":u,"%ReferenceError%":l,"%Reflect%":typeof Reflect=="undefined"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?r:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!S||!C?r:C(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":S&&C?C(""[Symbol.iterator]()):r,"%Symbol%":S?Symbol:r,"%SyntaxError%":g,"%ThrowTypeError%":k,"%TypedArray%":he,"%TypeError%":f,"%Uint8Array%":typeof Uint8Array=="undefined"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?r:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap=="undefined"?r:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?r:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?r:WeakSet,"%Function.prototype.call%":re,"%Function.prototype.apply%":X,"%Object.defineProperty%":A,"%Object.getPrototypeOf%":M,"%Math.abs%":v,"%Math.floor%":h,"%Math.max%":I,"%Math.min%":B,"%Math.pow%":x,"%Math.round%":b,"%Math.sign%":N,"%Reflect.getPrototypeOf%":W};if(C)try{null.error}catch(Z){var me=C(C(Z));de["%Error.prototype%"]=me}var Pe=function Z(Q){var y;if(Q==="%AsyncFunction%")y=m("async function () {}");else if(Q==="%GeneratorFunction%")y=m("function* () {}");else if(Q==="%AsyncGeneratorFunction%")y=m("async function* () {}");else if(Q==="%AsyncGenerator%"){var w=Z("%AsyncGeneratorFunction%");w&&(y=w.prototype)}else if(Q==="%AsyncIteratorPrototype%"){var z=Z("%AsyncGenerator%");z&&C&&(y=C(z.prototype))}return de[Q]=y,y},ke={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ee=vt(),_e=Ui(),Oe=Ee.call(re,Array.prototype.concat),qe=Ee.call(X,Array.prototype.splice),$=Ee.call(re,String.prototype.replace),V=Ee.call(re,String.prototype.slice),J=Ee.call(re,RegExp.prototype.exec),ne=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,D=/\\(\\)?/g,F=function(Q){var y=V(Q,0,1),w=V(Q,-1);if(y==="%"&&w!=="%")throw new g("invalid intrinsic syntax, expected closing `%`");if(w==="%"&&y!=="%")throw new g("invalid intrinsic syntax, expected opening `%`");var z=[];return $(Q,ne,function(ee,le,ie,se){z[z.length]=ie?$(se,D,"$1"):le||ee}),z},G=function(Q,y){var w=Q,z;if(_e(ke,w)&&(z=ke[w],w="%"+z[0]+"%"),_e(de,w)){var ee=de[w];if(ee===U&&(ee=Pe(w)),typeof ee=="undefined"&&!y)throw new f("intrinsic "+Q+" exists, but is not available. Please file an issue!");return{alias:z,name:w,value:ee}}throw new g("intrinsic "+Q+" does not exist!")};return Nr=function(Q,y){if(typeof Q!="string"||Q.length===0)throw new f("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof y!="boolean")throw new f('"allowMissing" argument must be a boolean');if(J(/^%?[^%]*%?$/,Q)===null)throw new g("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var w=F(Q),z=w.length>0?w[0]:"",ee=G("%"+z+"%",y),le=ee.name,ie=ee.value,se=!1,De=ee.alias;De&&(z=De[0],qe(w,Oe([0,1],De)));for(var H=1,Fe=!0;H<w.length;H+=1){var Ue=w[H],ye=V(Ue,0,1),we=V(Ue,-1);if((ye==='"'||ye==="'"||ye==="`"||we==='"'||we==="'"||we==="`")&&ye!==we)throw new g("property names with quotes must have matching quotes");if((Ue==="constructor"||!Fe)&&(se=!0),z+="."+Ue,le="%"+z+"%",_e(de,le))ie=de[le];else if(ie!=null){if(!(Ue in ie)){if(!y)throw new f("base intrinsic for "+Q+" exists, but the property is not available.");return}if(R&&H+1>=w.length){var $e=R(ie,Ue);Fe=!!$e,Fe&&"get"in $e&&!("originalValue"in $e.get)?ie=$e.get:ie=ie[Ue]}else Fe=_e(ie,Ue),ie=ie[Ue];Fe&&!se&&(de[le]=ie)}}return ie},Nr}var Dr,qi;function wt(){if(qi)return Dr;qi=1;var r=ji(),e=Br(),t=e([r("%String.prototype.indexOf%")]);return Dr=function(u,l){var g=r(u,!!l);return typeof g=="function"&&t(u,".prototype.")>-1?e([g]):g},Dr}var Fr,xi;function Ua(){if(xi)return Fr;xi=1;var r=Bt()(),e=wt(),t=e("Object.prototype.toString"),s=function(f){return r&&f&&typeof f=="object"&&Symbol.toStringTag in f?!1:t(f)==="[object Arguments]"},u=function(f){return s(f)?!0:f!==null&&typeof f=="object"&&"length"in f&&typeof f.length=="number"&&f.length>=0&&t(f)!=="[object Array]"&&"callee"in f&&t(f.callee)==="[object Function]"},l=function(){return s(arguments)}();return s.isLegacyArguments=u,Fr=l?s:u,Fr}var Ur,Wi;function $a(){if(Wi)return Ur;Wi=1;var r=wt(),e=Bt()(),t=Ui(),s=ct(),u;if(e){var l=r("RegExp.prototype.exec"),g={},f=function(){throw g},c={toString:f,valueOf:f};typeof Symbol.toPrimitive=="symbol"&&(c[Symbol.toPrimitive]=f),u=function(B){if(!B||typeof B!="object")return!1;var x=s(B,"lastIndex"),b=x&&t(x,"value");if(!b)return!1;try{l(B,c)}catch(N){return N===g}}}else{var v=r("Object.prototype.toString"),h="[object RegExp]";u=function(B){return!B||typeof B!="object"&&typeof B!="function"?!1:v(B)===h}}return Ur=u,Ur}var $r,Gi;function ja(){if(Gi)return $r;Gi=1;var r=wt(),e=$a(),t=r("RegExp.prototype.exec"),s=mt();return $r=function(l){if(!e(l))throw new s("`regex` must be a RegExp");return function(f){return t(l,f)!==null}},$r}var jr,Vi;function qa(){if(Vi)return jr;Vi=1;var r=wt(),e=ja(),t=e(/^\s*(?:function)?\*/),s=Bt()(),u=Mr(),l=r("Object.prototype.toString"),g=r("Function.prototype.toString"),f=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(v){}},c;return jr=function(h){if(typeof h!="function")return!1;if(t(g(h)))return!0;if(!s){var I=l(h);return I==="[object GeneratorFunction]"}if(!u)return!1;if(typeof c=="undefined"){var B=f();c=B?u(B):!1}return u(h)===c},jr}var qr,zi;function xa(){if(zi)return qr;zi=1;var r=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,t,s;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{t=Object.defineProperty({},"length",{get:function(){throw s}}),s={},e(function(){throw 42},null,t)}catch(R){R!==s&&(e=null)}else e=null;var u=/^\s*class\b/,l=function(A){try{var P=r.call(A);return u.test(P)}catch(k){return!1}},g=function(A){try{return l(A)?!1:(r.call(A),!0)}catch(P){return!1}},f=Object.prototype.toString,c="[object Object]",v="[object Function]",h="[object GeneratorFunction]",I="[object HTMLAllCollection]",B="[object HTML document.all class]",x="[object HTMLCollection]",b=typeof Symbol=="function"&&!!Symbol.toStringTag,N=!(0 in[,]),T=function(){return!1};if(typeof document=="object"){var m=document.all;f.call(m)===f.call(document.all)&&(T=function(A){if((N||!A)&&(typeof A=="undefined"||typeof A=="object"))try{var P=f.call(A);return(P===I||P===B||P===x||P===c)&&A("")==null}catch(k){}return!1})}return qr=e?function(A){if(T(A))return!0;if(!A||typeof A!="function"&&typeof A!="object")return!1;try{e(A,null,t)}catch(P){if(P!==s)return!1}return!l(A)&&g(A)}:function(A){if(T(A))return!0;if(!A||typeof A!="function"&&typeof A!="object")return!1;if(b)return g(A);if(l(A))return!1;var P=f.call(A);return P!==v&&P!==h&&!/^\[object HTML/.test(P)?!1:g(A)},qr}var xr,Hi;function Wa(){if(Hi)return xr;Hi=1;var r=xa(),e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,s=function(c,v,h){for(var I=0,B=c.length;I<B;I++)t.call(c,I)&&(h==null?v(c[I],I,c):v.call(h,c[I],I,c))},u=function(c,v,h){for(var I=0,B=c.length;I<B;I++)h==null?v(c.charAt(I),I,c):v.call(h,c.charAt(I),I,c)},l=function(c,v,h){for(var I in c)t.call(c,I)&&(h==null?v(c[I],I,c):v.call(h,c[I],I,c))};function g(f){return e.call(f)==="[object Array]"}return xr=function(c,v,h){if(!r(v))throw new TypeError("iterator must be a function");var I;arguments.length>=3&&(I=h),g(c)?s(c,v,I):typeof c=="string"?u(c,v,I):l(c,v,I)},xr}var Wr,Ji;function Ga(){return Ji||(Ji=1,Wr=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Wr}var Gr,Yi;function Va(){if(Yi)return Gr;Yi=1;var r=Ga(),e=globalThis;return Gr=function(){for(var s=[],u=0;u<r.length;u++)typeof e[r[u]]=="function"&&(s[s.length]=r[u]);return s},Gr}var Vr={exports:{}},zr,Ki;function za(){if(Ki)return zr;Ki=1;var r=kt(),e=li(),t=mt(),s=ct();return zr=function(l,g,f){if(!l||typeof l!="object"&&typeof l!="function")throw new t("`obj` must be an object or a function`");if(typeof g!="string"&&typeof g!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,v=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,I=arguments.length>6?arguments[6]:!1,B=!!s&&s(l,g);if(r)r(l,g,{configurable:h===null&&B?B.configurable:!h,enumerable:c===null&&B?B.enumerable:!c,value:f,writable:v===null&&B?B.writable:!v});else if(I||!c&&!v&&!h)l[g]=f;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},zr}var Hr,Xi;function Ha(){if(Xi)return Hr;Xi=1;var r=kt(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch(s){return!0}},Hr=e,Hr}var Jr,Zi;function Ja(){if(Zi)return Jr;Zi=1;var r=ji(),e=za(),t=Ha()(),s=ct(),u=mt(),l=r("%Math.floor%");return Jr=function(f,c){if(typeof f!="function")throw new u("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||l(c)!==c)throw new u("`length` must be a positive 32-bit integer");var v=arguments.length>2&&!!arguments[2],h=!0,I=!0;if("length"in f&&s){var B=s(f,"length");B&&!B.configurable&&(h=!1),B&&!B.writable&&(I=!1)}return(h||I||!v)&&(t?e(f,"length",c,!0,!0):e(f,"length",c)),f},Jr}var Yr,Qi;function Ya(){if(Qi)return Yr;Qi=1;var r=vt(),e=Pr(),t=Mi();return Yr=function(){return t(r,e,arguments)},Yr}var eo;function Ka(){return eo||(eo=1,function(r){var e=Ja(),t=kt(),s=Br(),u=Ya();r.exports=function(g){var f=s(arguments),c=g.length-(arguments.length-1);return e(f,1+(c>0?c:0),!0)},t?t(r.exports,"apply",{value:u}):r.exports.apply=u}(Vr)),Vr.exports}var Kr,to;function ro(){if(to)return Kr;to=1;var r=Wa(),e=Va(),t=Ka(),s=wt(),u=ct(),l=Mr(),g=s("Object.prototype.toString"),f=Bt()(),c=globalThis,v=e(),h=s("String.prototype.slice"),I=s("Array.prototype.indexOf",!0)||function(T,m){for(var R=0;R<T.length;R+=1)if(T[R]===m)return R;return-1},B={__proto__:null};f&&u&&l?r(v,function(N){var T=new c[N];if(Symbol.toStringTag in T&&l){var m=l(T),R=u(m,Symbol.toStringTag);if(!R&&m){var A=l(m);R=u(A,Symbol.toStringTag)}B["$"+N]=t(R.get)}}):r(v,function(N){var T=new c[N],m=T.slice||T.set;m&&(B["$"+N]=t(m))});var x=function(T){var m=!1;return r(B,function(R,A){if(!m)try{"$"+R(T)===A&&(m=h(A,1))}catch(P){}}),m},b=function(T){var m=!1;return r(B,function(R,A){if(!m)try{R(T),m=h(A,1)}catch(P){}}),m};return Kr=function(T){if(!T||typeof T!="object")return!1;if(!f){var m=h(g(T),8,-1);return I(v,m)>-1?m:m!=="Object"?!1:b(T)}return u?x(T):null},Kr}var Xr,no;function Xa(){if(no)return Xr;no=1;var r=ro();return Xr=function(t){return!!r(t)},Xr}var io;function Za(){return io||(io=1,function(r){var e=Ua(),t=qa(),s=ro(),u=Xa();function l(H){return H.call.bind(H)}var g=typeof BigInt!="undefined",f=typeof Symbol!="undefined",c=l(Object.prototype.toString),v=l(Number.prototype.valueOf),h=l(String.prototype.valueOf),I=l(Boolean.prototype.valueOf);if(g)var B=l(BigInt.prototype.valueOf);if(f)var x=l(Symbol.prototype.valueOf);function b(H,Fe){if(typeof H!="object")return!1;try{return Fe(H),!0}catch(Ue){return!1}}r.isArgumentsObject=e,r.isGeneratorFunction=t,r.isTypedArray=u;function N(H){return typeof Promise!="undefined"&&H instanceof Promise||H!==null&&typeof H=="object"&&typeof H.then=="function"&&typeof H.catch=="function"}r.isPromise=N;function T(H){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?ArrayBuffer.isView(H):u(H)||V(H)}r.isArrayBufferView=T;function m(H){return s(H)==="Uint8Array"}r.isUint8Array=m;function R(H){return s(H)==="Uint8ClampedArray"}r.isUint8ClampedArray=R;function A(H){return s(H)==="Uint16Array"}r.isUint16Array=A;function P(H){return s(H)==="Uint32Array"}r.isUint32Array=P;function k(H){return s(H)==="Int8Array"}r.isInt8Array=k;function S(H){return s(H)==="Int16Array"}r.isInt16Array=S;function C(H){return s(H)==="Int32Array"}r.isInt32Array=C;function M(H){return s(H)==="Float32Array"}r.isFloat32Array=M;function W(H){return s(H)==="Float64Array"}r.isFloat64Array=W;function X(H){return s(H)==="BigInt64Array"}r.isBigInt64Array=X;function re(H){return s(H)==="BigUint64Array"}r.isBigUint64Array=re;function U(H){return c(H)==="[object Map]"}U.working=typeof Map!="undefined"&&U(new Map);function he(H){return typeof Map=="undefined"?!1:U.working?U(H):H instanceof Map}r.isMap=he;function de(H){return c(H)==="[object Set]"}de.working=typeof Set!="undefined"&&de(new Set);function me(H){return typeof Set=="undefined"?!1:de.working?de(H):H instanceof Set}r.isSet=me;function Pe(H){return c(H)==="[object WeakMap]"}Pe.working=typeof WeakMap!="undefined"&&Pe(new WeakMap);function ke(H){return typeof WeakMap=="undefined"?!1:Pe.working?Pe(H):H instanceof WeakMap}r.isWeakMap=ke;function Ee(H){return c(H)==="[object WeakSet]"}Ee.working=typeof WeakSet!="undefined"&&Ee(new WeakSet);function _e(H){return Ee(H)}r.isWeakSet=_e;function Oe(H){return c(H)==="[object ArrayBuffer]"}Oe.working=typeof ArrayBuffer!="undefined"&&Oe(new ArrayBuffer);function qe(H){return typeof ArrayBuffer=="undefined"?!1:Oe.working?Oe(H):H instanceof ArrayBuffer}r.isArrayBuffer=qe;function $(H){return c(H)==="[object DataView]"}$.working=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"&&$(new DataView(new ArrayBuffer(1),0,1));function V(H){return typeof DataView=="undefined"?!1:$.working?$(H):H instanceof DataView}r.isDataView=V;var J=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:void 0;function ne(H){return c(H)==="[object SharedArrayBuffer]"}function D(H){return typeof J=="undefined"?!1:(typeof ne.working=="undefined"&&(ne.working=ne(new J)),ne.working?ne(H):H instanceof J)}r.isSharedArrayBuffer=D;function F(H){return c(H)==="[object AsyncFunction]"}r.isAsyncFunction=F;function G(H){return c(H)==="[object Map Iterator]"}r.isMapIterator=G;function Z(H){return c(H)==="[object Set Iterator]"}r.isSetIterator=Z;function Q(H){return c(H)==="[object Generator]"}r.isGeneratorObject=Q;function y(H){return c(H)==="[object WebAssembly.Module]"}r.isWebAssemblyCompiledModule=y;function w(H){return b(H,v)}r.isNumberObject=w;function z(H){return b(H,h)}r.isStringObject=z;function ee(H){return b(H,I)}r.isBooleanObject=ee;function le(H){return g&&b(H,B)}r.isBigIntObject=le;function ie(H){return f&&b(H,x)}r.isSymbolObject=ie;function se(H){return w(H)||z(H)||ee(H)||le(H)||ie(H)}r.isBoxedPrimitive=se;function De(H){return typeof Uint8Array!="undefined"&&(qe(H)||D(H))}r.isAnyArrayBuffer=De,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(H){Object.defineProperty(r,H,{enumerable:!1,value:function(){throw new Error(H+" is not supported in userland")}})})}(Kt)),Kt}var Zr,oo;function Qa(){return oo||(oo=1,Zr=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Zr}var Ot={exports:{}},ao;function ut(){return ao||(ao=1,typeof Object.create=="function"?Ot.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ot.exports=function(e,t){if(t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}}),Ot.exports}var so;function lo(){return so||(so=1,function(r){var e=Object.getOwnPropertyDescriptors||function(V){for(var J=Object.keys(V),ne={},D=0;D<J.length;D++)ne[J[D]]=Object.getOwnPropertyDescriptor(V,J[D]);return ne},t=/%[sdj%]/g;r.format=function($){if(!k($)){for(var V=[],J=0;J<arguments.length;J++)V.push(g(arguments[J]));return V.join(" ")}for(var J=1,ne=arguments,D=ne.length,F=String($).replace(t,function(Z){if(Z==="%%")return"%";if(J>=D)return Z;switch(Z){case"%s":return String(ne[J++]);case"%d":return Number(ne[J++]);case"%j":try{return JSON.stringify(ne[J++])}catch(Q){return"[Circular]"}default:return Z}}),G=ne[J];J<D;G=ne[++J])R(G)||!W(G)?F+=" "+G:F+=" "+g(G);return F},r.deprecate=function($,V){if(typeof ae!="undefined"&&ae.noDeprecation===!0)return $;if(typeof ae=="undefined")return function(){return r.deprecate($,V).apply(this,arguments)};var J=!1;function ne(){if(!J){if(ae.throwDeprecation)throw new Error(V);ae.traceDeprecation?console.trace(V):console.error(V),J=!0}return $.apply(this,arguments)}return ne};var s={},u=/^$/;if(ae.env.NODE_DEBUG){var l=ae.env.NODE_DEBUG;l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u=new RegExp("^"+l+"$","i")}r.debuglog=function($){if($=$.toUpperCase(),!s[$])if(u.test($)){var V=ae.pid;s[$]=function(){var J=r.format.apply(r,arguments);console.error("%s %d: %s",$,V,J)}}else s[$]=function(){};return s[$]};function g($,V){var J={seen:[],stylize:c};return arguments.length>=3&&(J.depth=arguments[2]),arguments.length>=4&&(J.colors=arguments[3]),m(V)?J.showHidden=V:V&&r._extend(J,V),C(J.showHidden)&&(J.showHidden=!1),C(J.depth)&&(J.depth=2),C(J.colors)&&(J.colors=!1),C(J.customInspect)&&(J.customInspect=!0),J.colors&&(J.stylize=f),h(J,$,J.depth)}r.inspect=g,g.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},g.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function f($,V){var J=g.styles[V];return J?"\x1B["+g.colors[J][0]+"m"+$+"\x1B["+g.colors[J][1]+"m":$}function c($,V){return $}function v($){var V={};return $.forEach(function(J,ne){V[J]=!0}),V}function h($,V,J){if($.customInspect&&V&&U(V.inspect)&&V.inspect!==r.inspect&&!(V.constructor&&V.constructor.prototype===V)){var ne=V.inspect(J,$);return k(ne)||(ne=h($,ne,J)),ne}var D=I($,V);if(D)return D;var F=Object.keys(V),G=v(F);if($.showHidden&&(F=Object.getOwnPropertyNames(V)),re(V)&&(F.indexOf("message")>=0||F.indexOf("description")>=0))return B(V);if(F.length===0){if(U(V)){var Z=V.name?": "+V.name:"";return $.stylize("[Function"+Z+"]","special")}if(M(V))return $.stylize(RegExp.prototype.toString.call(V),"regexp");if(X(V))return $.stylize(Date.prototype.toString.call(V),"date");if(re(V))return B(V)}var Q="",y=!1,w=["{","}"];if(T(V)&&(y=!0,w=["[","]"]),U(V)){var z=V.name?": "+V.name:"";Q=" [Function"+z+"]"}if(M(V)&&(Q=" "+RegExp.prototype.toString.call(V)),X(V)&&(Q=" "+Date.prototype.toUTCString.call(V)),re(V)&&(Q=" "+B(V)),F.length===0&&(!y||V.length==0))return w[0]+Q+w[1];if(J<0)return M(V)?$.stylize(RegExp.prototype.toString.call(V),"regexp"):$.stylize("[Object]","special");$.seen.push(V);var ee;return y?ee=x($,V,J,G,F):ee=F.map(function(le){return b($,V,J,G,le,y)}),$.seen.pop(),N(ee,Q,w)}function I($,V){if(C(V))return $.stylize("undefined","undefined");if(k(V)){var J="'"+JSON.stringify(V).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(J,"string")}if(P(V))return $.stylize(""+V,"number");if(m(V))return $.stylize(""+V,"boolean");if(R(V))return $.stylize("null","null")}function B($){return"["+Error.prototype.toString.call($)+"]"}function x($,V,J,ne,D){for(var F=[],G=0,Z=V.length;G<Z;++G)Ee(V,String(G))?F.push(b($,V,J,ne,String(G),!0)):F.push("");return D.forEach(function(Q){Q.match(/^\d+$/)||F.push(b($,V,J,ne,Q,!0))}),F}function b($,V,J,ne,D,F){var G,Z,Q;if(Q=Object.getOwnPropertyDescriptor(V,D)||{value:V[D]},Q.get?Q.set?Z=$.stylize("[Getter/Setter]","special"):Z=$.stylize("[Getter]","special"):Q.set&&(Z=$.stylize("[Setter]","special")),Ee(ne,D)||(G="["+D+"]"),Z||($.seen.indexOf(Q.value)<0?(R(J)?Z=h($,Q.value,null):Z=h($,Q.value,J-1),Z.indexOf(`
11
+ */(function(R){const A=t,P=T,k=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=U,R.SlowBuffer=V,R.INSPECT_MAX_BYTES=50;const S=2147483647;R.kMaxLength=S;const{Uint8Array:C,ArrayBuffer:M,SharedArrayBuffer:W}=globalThis;U.TYPED_ARRAY_SUPPORT=X(),!U.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function X(){try{const p=new C(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,C.prototype),Object.setPrototypeOf(p,i),p.foo()===42}catch(p){return!1}}Object.defineProperty(U.prototype,"parent",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.buffer}}),Object.defineProperty(U.prototype,"offset",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.byteOffset}});function re(p){if(p>S)throw new RangeError('The value "'+p+'" is invalid for option "size"');const i=new C(p);return Object.setPrototypeOf(i,U.prototype),i}function U(p,i,a){if(typeof p=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Pe(p)}return he(p,i,a)}U.poolSize=8192;function he(p,i,a){if(typeof p=="string")return ke(p,i);if(M.isView(p))return _e(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Ze(p,M)||p&&Ze(p.buffer,M)||typeof W!="undefined"&&(Ze(p,W)||p&&Ze(p.buffer,W)))return Oe(p,i,a);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const E=p.valueOf&&p.valueOf();if(E!=null&&E!==p)return U.from(E,i,a);const L=qe(p);if(L)return L;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return U.from(p[Symbol.toPrimitive]("string"),i,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}U.from=function(p,i,a){return he(p,i,a)},Object.setPrototypeOf(U.prototype,C.prototype),Object.setPrototypeOf(U,C);function de(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function me(p,i,a){return de(p),p<=0?re(p):i!==void 0?typeof a=="string"?re(p).fill(i,a):re(p).fill(i):re(p)}U.alloc=function(p,i,a){return me(p,i,a)};function Pe(p){return de(p),re(p<0?0:$(p)|0)}U.allocUnsafe=function(p){return Pe(p)},U.allocUnsafeSlow=function(p){return Pe(p)};function ke(p,i){if((typeof i!="string"||i==="")&&(i="utf8"),!U.isEncoding(i))throw new TypeError("Unknown encoding: "+i);const a=J(p,i)|0;let E=re(a);const L=E.write(p,i);return L!==a&&(E=E.slice(0,L)),E}function Ee(p){const i=p.length<0?0:$(p.length)|0,a=re(i);for(let E=0;E<i;E+=1)a[E]=p[E]&255;return a}function _e(p){if(Ze(p,C)){const i=new C(p);return Oe(i.buffer,i.byteOffset,i.byteLength)}return Ee(p)}function Oe(p,i,a){if(i<0||p.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<i+(a||0))throw new RangeError('"length" is outside of buffer bounds');let E;return i===void 0&&a===void 0?E=new C(p):a===void 0?E=new C(p,i):E=new C(p,i,a),Object.setPrototypeOf(E,U.prototype),E}function qe(p){if(U.isBuffer(p)){const i=$(p.length)|0,a=re(i);return a.length===0||p.copy(a,0,0,i),a}if(p.length!==void 0)return typeof p.length!="number"||In(p.length)?re(0):Ee(p);if(p.type==="Buffer"&&Array.isArray(p.data))return Ee(p.data)}function $(p){if(p>=S)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S.toString(16)+" bytes");return p|0}function V(p){return+p!=p&&(p=0),U.alloc(+p)}U.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==U.prototype},U.compare=function(i,a){if(Ze(i,C)&&(i=U.from(i,i.offset,i.byteLength)),Ze(a,C)&&(a=U.from(a,a.offset,a.byteLength)),!U.isBuffer(i)||!U.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===a)return 0;let E=i.length,L=a.length;for(let q=0,K=Math.min(E,L);q<K;++q)if(i[q]!==a[q]){E=i[q],L=a[q];break}return E<L?-1:L<E?1:0},U.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},U.concat=function(i,a){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return U.alloc(0);let E;if(a===void 0)for(a=0,E=0;E<i.length;++E)a+=i[E].length;const L=U.allocUnsafe(a);let q=0;for(E=0;E<i.length;++E){let K=i[E];if(Ze(K,C))q+K.length>L.length?(U.isBuffer(K)||(K=U.from(K)),K.copy(L,q)):C.prototype.set.call(L,K,q);else if(U.isBuffer(K))K.copy(L,q);else throw new TypeError('"list" argument must be an Array of Buffers');q+=K.length}return L};function J(p,i){if(U.isBuffer(p))return p.length;if(M.isView(p)||Ze(p,M))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);const a=p.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&a===0)return 0;let L=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return be(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return pe(p).length;default:if(L)return E?-1:be(p).length;i=(""+i).toLowerCase(),L=!0}}U.byteLength=J;function ne(p,i,a){let E=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,i>>>=0,a<=i))return"";for(p||(p="utf8");;)switch(p){case"hex":return Fe(this,i,a);case"utf8":case"utf-8":return le(this,i,a);case"ascii":return De(this,i,a);case"latin1":case"binary":return H(this,i,a);case"base64":return ee(this,i,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ue(this,i,a);default:if(E)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),E=!0}}U.prototype._isBuffer=!0;function D(p,i,a){const E=p[i];p[i]=p[a],p[a]=E}U.prototype.swap16=function(){const i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;a<i;a+=2)D(this,a,a+1);return this},U.prototype.swap32=function(){const i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let a=0;a<i;a+=4)D(this,a,a+3),D(this,a+1,a+2);return this},U.prototype.swap64=function(){const i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let a=0;a<i;a+=8)D(this,a,a+7),D(this,a+1,a+6),D(this,a+2,a+5),D(this,a+3,a+4);return this},U.prototype.toString=function(){const i=this.length;return i===0?"":arguments.length===0?le(this,0,i):ne.apply(this,arguments)},U.prototype.toLocaleString=U.prototype.toString,U.prototype.equals=function(i){if(!U.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:U.compare(this,i)===0},U.prototype.inspect=function(){let i="";const a=R.INSPECT_MAX_BYTES;return i=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(i+=" ... "),"<Buffer "+i+">"},k&&(U.prototype[k]=U.prototype.inspect),U.prototype.compare=function(i,a,E,L,q){if(Ze(i,C)&&(i=U.from(i,i.offset,i.byteLength)),!U.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(a===void 0&&(a=0),E===void 0&&(E=i?i.length:0),L===void 0&&(L=0),q===void 0&&(q=this.length),a<0||E>i.length||L<0||q>this.length)throw new RangeError("out of range index");if(L>=q&&a>=E)return 0;if(L>=q)return-1;if(a>=E)return 1;if(a>>>=0,E>>>=0,L>>>=0,q>>>=0,this===i)return 0;let K=q-L,fe=E-a;const Te=Math.min(K,fe),Re=this.slice(L,q),Ae=i.slice(a,E);for(let ve=0;ve<Te;++ve)if(Re[ve]!==Ae[ve]){K=Re[ve],fe=Ae[ve];break}return K<fe?-1:fe<K?1:0};function F(p,i,a,E,L){if(p.length===0)return-1;if(typeof a=="string"?(E=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,In(a)&&(a=L?0:p.length-1),a<0&&(a=p.length+a),a>=p.length){if(L)return-1;a=p.length-1}else if(a<0)if(L)a=0;else return-1;if(typeof i=="string"&&(i=U.from(i,E)),U.isBuffer(i))return i.length===0?-1:G(p,i,a,E,L);if(typeof i=="number")return i=i&255,typeof C.prototype.indexOf=="function"?L?C.prototype.indexOf.call(p,i,a):C.prototype.lastIndexOf.call(p,i,a):G(p,[i],a,E,L);throw new TypeError("val must be string, number or Buffer")}function G(p,i,a,E,L){let q=1,K=p.length,fe=i.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(p.length<2||i.length<2)return-1;q=2,K/=2,fe/=2,a/=2}function Te(Ae,ve){return q===1?Ae[ve]:Ae.readUInt16BE(ve*q)}let Re;if(L){let Ae=-1;for(Re=a;Re<K;Re++)if(Te(p,Re)===Te(i,Ae===-1?0:Re-Ae)){if(Ae===-1&&(Ae=Re),Re-Ae+1===fe)return Ae*q}else Ae!==-1&&(Re-=Re-Ae),Ae=-1}else for(a+fe>K&&(a=K-fe),Re=a;Re>=0;Re--){let Ae=!0;for(let ve=0;ve<fe;ve++)if(Te(p,Re+ve)!==Te(i,ve)){Ae=!1;break}if(Ae)return Re}return-1}U.prototype.includes=function(i,a,E){return this.indexOf(i,a,E)!==-1},U.prototype.indexOf=function(i,a,E){return F(this,i,a,E,!0)},U.prototype.lastIndexOf=function(i,a,E){return F(this,i,a,E,!1)};function Z(p,i,a,E){a=Number(a)||0;const L=p.length-a;E?(E=Number(E),E>L&&(E=L)):E=L;const q=i.length;E>q/2&&(E=q/2);let K;for(K=0;K<E;++K){const fe=parseInt(i.substr(K*2,2),16);if(In(fe))return K;p[a+K]=fe}return K}function Q(p,i,a,E){return Dt(be(i,p.length-a),p,a,E)}function y(p,i,a,E){return Dt(Se(i),p,a,E)}function w(p,i,a,E){return Dt(pe(i),p,a,E)}function z(p,i,a,E){return Dt(Ce(i,p.length-a),p,a,E)}U.prototype.write=function(i,a,E,L){if(a===void 0)L="utf8",E=this.length,a=0;else if(E===void 0&&typeof a=="string")L=a,E=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(E)?(E=E>>>0,L===void 0&&(L="utf8")):(L=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const q=this.length-a;if((E===void 0||E>q)&&(E=q),i.length>0&&(E<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");let K=!1;for(;;)switch(L){case"hex":return Z(this,i,a,E);case"utf8":case"utf-8":return Q(this,i,a,E);case"ascii":case"latin1":case"binary":return y(this,i,a,E);case"base64":return w(this,i,a,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,i,a,E);default:if(K)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),K=!0}},U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ee(p,i,a){return i===0&&a===p.length?A.fromByteArray(p):A.fromByteArray(p.slice(i,a))}function le(p,i,a){a=Math.min(p.length,a);const E=[];let L=i;for(;L<a;){const q=p[L];let K=null,fe=q>239?4:q>223?3:q>191?2:1;if(L+fe<=a){let Te,Re,Ae,ve;switch(fe){case 1:q<128&&(K=q);break;case 2:Te=p[L+1],(Te&192)===128&&(ve=(q&31)<<6|Te&63,ve>127&&(K=ve));break;case 3:Te=p[L+1],Re=p[L+2],(Te&192)===128&&(Re&192)===128&&(ve=(q&15)<<12|(Te&63)<<6|Re&63,ve>2047&&(ve<55296||ve>57343)&&(K=ve));break;case 4:Te=p[L+1],Re=p[L+2],Ae=p[L+3],(Te&192)===128&&(Re&192)===128&&(Ae&192)===128&&(ve=(q&15)<<18|(Te&63)<<12|(Re&63)<<6|Ae&63,ve>65535&&ve<1114112&&(K=ve))}}K===null?(K=65533,fe=1):K>65535&&(K-=65536,E.push(K>>>10&1023|55296),K=56320|K&1023),E.push(K),L+=fe}return se(E)}const ie=4096;function se(p){const i=p.length;if(i<=ie)return String.fromCharCode.apply(String,p);let a="",E=0;for(;E<i;)a+=String.fromCharCode.apply(String,p.slice(E,E+=ie));return a}function De(p,i,a){let E="";a=Math.min(p.length,a);for(let L=i;L<a;++L)E+=String.fromCharCode(p[L]&127);return E}function H(p,i,a){let E="";a=Math.min(p.length,a);for(let L=i;L<a;++L)E+=String.fromCharCode(p[L]);return E}function Fe(p,i,a){const E=p.length;(!i||i<0)&&(i=0),(!a||a<0||a>E)&&(a=E);let L="";for(let q=i;q<a;++q)L+=Sl[p[q]];return L}function Ue(p,i,a){const E=p.slice(i,a);let L="";for(let q=0;q<E.length-1;q+=2)L+=String.fromCharCode(E[q]+E[q+1]*256);return L}U.prototype.slice=function(i,a){const E=this.length;i=~~i,a=a===void 0?E:~~a,i<0?(i+=E,i<0&&(i=0)):i>E&&(i=E),a<0?(a+=E,a<0&&(a=0)):a>E&&(a=E),a<i&&(a=i);const L=this.subarray(i,a);return Object.setPrototypeOf(L,U.prototype),L};function ye(p,i,a){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+i>a)throw new RangeError("Trying to access beyond buffer length")}U.prototype.readUintLE=U.prototype.readUIntLE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=this[i],q=1,K=0;for(;++K<a&&(q*=256);)L+=this[i+K]*q;return L},U.prototype.readUintBE=U.prototype.readUIntBE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=this[i+--a],q=1;for(;a>0&&(q*=256);)L+=this[i+--a]*q;return L},U.prototype.readUint8=U.prototype.readUInt8=function(i,a){return i=i>>>0,a||ye(i,1,this.length),this[i]},U.prototype.readUint16LE=U.prototype.readUInt16LE=function(i,a){return i=i>>>0,a||ye(i,2,this.length),this[i]|this[i+1]<<8},U.prototype.readUint16BE=U.prototype.readUInt16BE=function(i,a){return i=i>>>0,a||ye(i,2,this.length),this[i]<<8|this[i+1]},U.prototype.readUint32LE=U.prototype.readUInt32LE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},U.prototype.readUint32BE=U.prototype.readUInt32BE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},U.prototype.readBigUInt64LE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=a+this[++i]*oe(2,8)+this[++i]*oe(2,16)+this[++i]*oe(2,24),q=this[++i]+this[++i]*oe(2,8)+this[++i]*oe(2,16)+E*oe(2,24);return BigInt(L)+(BigInt(q)<<BigInt(32))}),U.prototype.readBigUInt64BE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=a*oe(2,24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+this[++i],q=this[++i]*oe(2,24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+E;return(BigInt(L)<<BigInt(32))+BigInt(q)}),U.prototype.readIntLE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=this[i],q=1,K=0;for(;++K<a&&(q*=256);)L+=this[i+K]*q;return q*=128,L>=q&&(L-=Math.pow(2,8*a)),L},U.prototype.readIntBE=function(i,a,E){i=i>>>0,a=a>>>0,E||ye(i,a,this.length);let L=a,q=1,K=this[i+--L];for(;L>0&&(q*=256);)K+=this[i+--L]*q;return q*=128,K>=q&&(K-=Math.pow(2,8*a)),K},U.prototype.readInt8=function(i,a){return i=i>>>0,a||ye(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},U.prototype.readInt16LE=function(i,a){i=i>>>0,a||ye(i,2,this.length);const E=this[i]|this[i+1]<<8;return E&32768?E|4294901760:E},U.prototype.readInt16BE=function(i,a){i=i>>>0,a||ye(i,2,this.length);const E=this[i+1]|this[i]<<8;return E&32768?E|4294901760:E},U.prototype.readInt32LE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},U.prototype.readInt32BE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},U.prototype.readBigInt64LE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=this[i+4]+this[i+5]*oe(2,8)+this[i+6]*oe(2,16)+(E<<24);return(BigInt(L)<<BigInt(32))+BigInt(a+this[++i]*oe(2,8)+this[++i]*oe(2,16)+this[++i]*oe(2,24))}),U.prototype.readBigInt64BE=rt(function(i){i=i>>>0,O(i,"offset");const a=this[i],E=this[i+7];(a===void 0||E===void 0)&&j(i,this.length-8);const L=(a<<24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+this[++i];return(BigInt(L)<<BigInt(32))+BigInt(this[++i]*oe(2,24)+this[++i]*oe(2,16)+this[++i]*oe(2,8)+E)}),U.prototype.readFloatLE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),P.read(this,i,!0,23,4)},U.prototype.readFloatBE=function(i,a){return i=i>>>0,a||ye(i,4,this.length),P.read(this,i,!1,23,4)},U.prototype.readDoubleLE=function(i,a){return i=i>>>0,a||ye(i,8,this.length),P.read(this,i,!0,52,8)},U.prototype.readDoubleBE=function(i,a){return i=i>>>0,a||ye(i,8,this.length),P.read(this,i,!1,52,8)};function we(p,i,a,E,L,q){if(!U.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>L||i<q)throw new RangeError('"value" argument is out of bounds');if(a+E>p.length)throw new RangeError("Index out of range")}U.prototype.writeUintLE=U.prototype.writeUIntLE=function(i,a,E,L){if(i=+i,a=a>>>0,E=E>>>0,!L){const fe=Math.pow(2,8*E)-1;we(this,i,a,E,fe,0)}let q=1,K=0;for(this[a]=i&255;++K<E&&(q*=256);)this[a+K]=i/q&255;return a+E},U.prototype.writeUintBE=U.prototype.writeUIntBE=function(i,a,E,L){if(i=+i,a=a>>>0,E=E>>>0,!L){const fe=Math.pow(2,8*E)-1;we(this,i,a,E,fe,0)}let q=E-1,K=1;for(this[a+q]=i&255;--q>=0&&(K*=256);)this[a+q]=i/K&255;return a+E},U.prototype.writeUint8=U.prototype.writeUInt8=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,1,255,0),this[a]=i&255,a+1},U.prototype.writeUint16LE=U.prototype.writeUInt16LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,65535,0),this[a]=i&255,this[a+1]=i>>>8,a+2},U.prototype.writeUint16BE=U.prototype.writeUInt16BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,65535,0),this[a]=i>>>8,this[a+1]=i&255,a+2},U.prototype.writeUint32LE=U.prototype.writeUInt32LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,4294967295,0),this[a+3]=i>>>24,this[a+2]=i>>>16,this[a+1]=i>>>8,this[a]=i&255,a+4},U.prototype.writeUint32BE=U.prototype.writeUInt32BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,4294967295,0),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4};function $e(p,i,a,E,L){_(i,E,L,p,a,7);let q=Number(i&BigInt(4294967295));p[a++]=q,q=q>>8,p[a++]=q,q=q>>8,p[a++]=q,q=q>>8,p[a++]=q;let K=Number(i>>BigInt(32)&BigInt(4294967295));return p[a++]=K,K=K>>8,p[a++]=K,K=K>>8,p[a++]=K,K=K>>8,p[a++]=K,a}function Ne(p,i,a,E,L){_(i,E,L,p,a,7);let q=Number(i&BigInt(4294967295));p[a+7]=q,q=q>>8,p[a+6]=q,q=q>>8,p[a+5]=q,q=q>>8,p[a+4]=q;let K=Number(i>>BigInt(32)&BigInt(4294967295));return p[a+3]=K,K=K>>8,p[a+2]=K,K=K>>8,p[a+1]=K,K=K>>8,p[a]=K,a+8}U.prototype.writeBigUInt64LE=rt(function(i,a=0){return $e(this,i,a,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeBigUInt64BE=rt(function(i,a=0){return Ne(this,i,a,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeIntLE=function(i,a,E,L){if(i=+i,a=a>>>0,!L){const Te=Math.pow(2,8*E-1);we(this,i,a,E,Te-1,-Te)}let q=0,K=1,fe=0;for(this[a]=i&255;++q<E&&(K*=256);)i<0&&fe===0&&this[a+q-1]!==0&&(fe=1),this[a+q]=(i/K>>0)-fe&255;return a+E},U.prototype.writeIntBE=function(i,a,E,L){if(i=+i,a=a>>>0,!L){const Te=Math.pow(2,8*E-1);we(this,i,a,E,Te-1,-Te)}let q=E-1,K=1,fe=0;for(this[a+q]=i&255;--q>=0&&(K*=256);)i<0&&fe===0&&this[a+q+1]!==0&&(fe=1),this[a+q]=(i/K>>0)-fe&255;return a+E},U.prototype.writeInt8=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,1,127,-128),i<0&&(i=255+i+1),this[a]=i&255,a+1},U.prototype.writeInt16LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,32767,-32768),this[a]=i&255,this[a+1]=i>>>8,a+2},U.prototype.writeInt16BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,2,32767,-32768),this[a]=i>>>8,this[a+1]=i&255,a+2},U.prototype.writeInt32LE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,2147483647,-2147483648),this[a]=i&255,this[a+1]=i>>>8,this[a+2]=i>>>16,this[a+3]=i>>>24,a+4},U.prototype.writeInt32BE=function(i,a,E){return i=+i,a=a>>>0,E||we(this,i,a,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4},U.prototype.writeBigInt64LE=rt(function(i,a=0){return $e(this,i,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),U.prototype.writeBigInt64BE=rt(function(i,a=0){return Ne(this,i,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function We(p,i,a,E,L,q){if(a+E>p.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function Ve(p,i,a,E,L){return i=+i,a=a>>>0,L||We(p,i,a,4),P.write(p,i,a,E,23,4),a+4}U.prototype.writeFloatLE=function(i,a,E){return Ve(this,i,a,!0,E)},U.prototype.writeFloatBE=function(i,a,E){return Ve(this,i,a,!1,E)};function Me(p,i,a,E,L){return i=+i,a=a>>>0,L||We(p,i,a,8),P.write(p,i,a,E,52,8),a+8}U.prototype.writeDoubleLE=function(i,a,E){return Me(this,i,a,!0,E)},U.prototype.writeDoubleBE=function(i,a,E){return Me(this,i,a,!1,E)},U.prototype.copy=function(i,a,E,L){if(!U.isBuffer(i))throw new TypeError("argument should be a Buffer");if(E||(E=0),!L&&L!==0&&(L=this.length),a>=i.length&&(a=i.length),a||(a=0),L>0&&L<E&&(L=E),L===E||i.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),i.length-a<L-E&&(L=i.length-a+E);const q=L-E;return this===i&&typeof C.prototype.copyWithin=="function"?this.copyWithin(a,E,L):C.prototype.set.call(i,this.subarray(E,L),a),q},U.prototype.fill=function(i,a,E,L){if(typeof i=="string"){if(typeof a=="string"?(L=a,a=0,E=this.length):typeof E=="string"&&(L=E,E=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!U.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(i.length===1){const K=i.charCodeAt(0);(L==="utf8"&&K<128||L==="latin1")&&(i=K)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(a<0||this.length<a||this.length<E)throw new RangeError("Out of range index");if(E<=a)return this;a=a>>>0,E=E===void 0?this.length:E>>>0,i||(i=0);let q;if(typeof i=="number")for(q=a;q<E;++q)this[q]=i;else{const K=U.isBuffer(i)?i:U.from(i,L),fe=K.length;if(fe===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(q=0;q<E-a;++q)this[q+a]=K[q%fe]}return this};const tt={};function d(p,i,a){tt[p]=class extends a{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name}get code(){return p}set code(L){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:L,writable:!0})}toString(){return`${this.name} [${p}]: ${this.message}`}}}d("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),d("ERR_INVALID_ARG_TYPE",function(p,i){return`The "${p}" argument must be of type number. Received type ${typeof i}`},TypeError),d("ERR_OUT_OF_RANGE",function(p,i,a){let E=`The value of "${p}" is out of range.`,L=a;return Number.isInteger(a)&&Math.abs(a)>oe(2,32)?L=n(String(a)):typeof a=="bigint"&&(L=String(a),(a>oe(BigInt(2),BigInt(32))||a<-oe(BigInt(2),BigInt(32)))&&(L=n(L)),L+="n"),E+=` It must be ${i}. Received ${L}`,E},RangeError);function n(p){let i="",a=p.length;const E=p[0]==="-"?1:0;for(;a>=E+4;a-=3)i=`_${p.slice(a-3,a)}${i}`;return`${p.slice(0,a)}${i}`}function o(p,i,a){O(i,"offset"),(p[i]===void 0||p[i+a]===void 0)&&j(i,p.length-(a+1))}function _(p,i,a,E,L,q){if(p>a||p<i){const K=typeof i=="bigint"?"n":"";let fe;throw i===0||i===BigInt(0)?fe=`>= 0${K} and < 2${K} ** ${(q+1)*8}${K}`:fe=`>= -(2${K} ** ${(q+1)*8-1}${K}) and < 2 ** ${(q+1)*8-1}${K}`,new tt.ERR_OUT_OF_RANGE("value",fe,p)}o(E,L,q)}function O(p,i){if(typeof p!="number")throw new tt.ERR_INVALID_ARG_TYPE(i,"number",p)}function j(p,i,a){throw Math.floor(p)!==p?(O(p,a),new tt.ERR_OUT_OF_RANGE("offset","an integer",p)):i<0?new tt.ERR_BUFFER_OUT_OF_BOUNDS:new tt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,p)}const Y=/[^+/0-9A-Za-z-_]/g;function ce(p){if(p=p.split("=")[0],p=p.trim().replace(Y,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function be(p,i){i=i||1/0;let a;const E=p.length;let L=null;const q=[];for(let K=0;K<E;++K){if(a=p.charCodeAt(K),a>55295&&a<57344){if(!L){if(a>56319){(i-=3)>-1&&q.push(239,191,189);continue}else if(K+1===E){(i-=3)>-1&&q.push(239,191,189);continue}L=a;continue}if(a<56320){(i-=3)>-1&&q.push(239,191,189),L=a;continue}a=(L-55296<<10|a-56320)+65536}else L&&(i-=3)>-1&&q.push(239,191,189);if(L=null,a<128){if((i-=1)<0)break;q.push(a)}else if(a<2048){if((i-=2)<0)break;q.push(a>>6|192,a&63|128)}else if(a<65536){if((i-=3)<0)break;q.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((i-=4)<0)break;q.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return q}function Se(p){const i=[];for(let a=0;a<p.length;++a)i.push(p.charCodeAt(a)&255);return i}function Ce(p,i){let a,E,L;const q=[];for(let K=0;K<p.length&&!((i-=2)<0);++K)a=p.charCodeAt(K),E=a>>8,L=a%256,q.push(L),q.push(E);return q}function pe(p){return A.toByteArray(ce(p))}function Dt(p,i,a,E){let L;for(L=0;L<E&&!(L+a>=i.length||L>=p.length);++L)i[L+a]=p[L];return L}function Ze(p,i){return p instanceof i||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===i.name}function In(p){return p!==p}const Sl=function(){const p="0123456789abcdef",i=new Array(256);for(let a=0;a<16;++a){const E=a*16;for(let L=0;L<16;++L)i[E+L]=p[a]+p[L]}return i}();function rt(p){return typeof BigInt=="undefined"?_l:p}function _l(){throw new Error("BigInt not supported")}})(e);const m=e.Buffer;r.Blob=e.Blob,r.BlobOptions=e.BlobOptions,r.Buffer=e.Buffer,r.File=e.File,r.FileOptions=e.FileOptions,r.INSPECT_MAX_BYTES=e.INSPECT_MAX_BYTES,r.SlowBuffer=e.SlowBuffer,r.TranscodeEncoding=e.TranscodeEncoding,r.atob=e.atob,r.btoa=e.btoa,r.constants=e.constants,r.default=m,r.isAscii=e.isAscii,r.isUtf8=e.isUtf8,r.kMaxLength=e.kMaxLength,r.kStringMaxLength=e.kStringMaxLength,r.resolveObjectURL=e.resolveObjectURL,r.transcode=e.transcode}(zt)),zt}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var zn;function Hn(){return zn||(zn=1,function(r,e){var t=yt(),s=t.Buffer;function f(g,u){for(var c in g)u[c]=g[c]}s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?r.exports=t:(f(t,e),e.Buffer=l);function l(g,u,c){return s(g,u,c)}l.prototype=Object.create(s.prototype),f(s,l),l.from=function(g,u,c){if(typeof g=="number")throw new TypeError("Argument must not be a number");return s(g,u,c)},l.alloc=function(g,u,c){if(typeof g!="number")throw new TypeError("Argument must be a number");var v=s(g);return u!==void 0?typeof c=="string"?v.fill(u,c):v.fill(u):v.fill(0),v},l.allocUnsafe=function(g){if(typeof g!="number")throw new TypeError("Argument must be a number");return s(g)},l.allocUnsafeSlow=function(g){if(typeof g!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(g)}}(Tt,Tt.exports)),Tt.exports}var Jn;function wa(){if(Jn)return Pt.exports;Jn=1;var r=65536,e=4294967295;function t(){throw new Error(`Secure random number generation is not supported by this browser.
12
+ Use Chrome, Firefox or Internet Explorer 11`)}var s=Hn().Buffer,f=globalThis.crypto||globalThis.msCrypto;f&&f.getRandomValues?Pt.exports=l:Pt.exports=t;function l(g,u){if(g>e)throw new RangeError("requested too many random bytes");var c=s.allocUnsafe(g);if(g>0)if(g>r)for(var v=0;v<g;v+=r)f.getRandomValues(c.slice(v,v+r));else f.getRandomValues(c);return typeof u=="function"?ae.nextTick(function(){u(null,c)}):c}return Pt.exports}var At={exports:{}},It={exports:{}},Yn;function Ht(){if(Yn)return It.exports;Yn=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(k,S,C){return Function.prototype.apply.call(k,S,C)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:t=function(k){return Object.getOwnPropertyNames(k)};function s(P){console&&console.warn&&console.warn(P)}var f=Number.isNaN||function(k){return k!==k};function l(){l.init.call(this)}It.exports=l,It.exports.once=m,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var g=10;function u(P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return g},set:function(P){if(typeof P!="number"||P<0||f(P))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+P+".");g=P}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||f(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this};function c(P){return P._maxListeners===void 0?l.defaultMaxListeners:P._maxListeners}l.prototype.getMaxListeners=function(){return c(this)},l.prototype.emit=function(k){for(var S=[],C=1;C<arguments.length;C++)S.push(arguments[C]);var M=k==="error",W=this._events;if(W!==void 0)M=M&&W.error===void 0;else if(!M)return!1;if(M){var X;if(S.length>0&&(X=S[0]),X instanceof Error)throw X;var re=new Error("Unhandled error."+(X?" ("+X.message+")":""));throw re.context=X,re}var U=W[k];if(U===void 0)return!1;if(typeof U=="function")e(U,this,S);else for(var he=U.length,de=b(U,he),C=0;C<he;++C)e(de[C],this,S);return!0};function v(P,k,S,C){var M,W,X;if(u(S),W=P._events,W===void 0?(W=P._events=Object.create(null),P._eventsCount=0):(W.newListener!==void 0&&(P.emit("newListener",k,S.listener?S.listener:S),W=P._events),X=W[k]),X===void 0)X=W[k]=S,++P._eventsCount;else if(typeof X=="function"?X=W[k]=C?[S,X]:[X,S]:C?X.unshift(S):X.push(S),M=c(P),M>0&&X.length>M&&!X.warned){X.warned=!0;var re=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");re.name="MaxListenersExceededWarning",re.emitter=P,re.type=k,re.count=X.length,s(re)}return P}l.prototype.addListener=function(k,S){return v(this,k,S,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(k,S){return v(this,k,S,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function I(P,k,S){var C={fired:!1,wrapFn:void 0,target:P,type:k,listener:S},M=h.bind(C);return M.listener=S,C.wrapFn=M,M}l.prototype.once=function(k,S){return u(S),this.on(k,I(this,k,S)),this},l.prototype.prependOnceListener=function(k,S){return u(S),this.prependListener(k,I(this,k,S)),this},l.prototype.removeListener=function(k,S){var C,M,W,X,re;if(u(S),M=this._events,M===void 0)return this;if(C=M[k],C===void 0)return this;if(C===S||C.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete M[k],M.removeListener&&this.emit("removeListener",k,C.listener||S));else if(typeof C!="function"){for(W=-1,X=C.length-1;X>=0;X--)if(C[X]===S||C[X].listener===S){re=C[X].listener,W=X;break}if(W<0)return this;W===0?C.shift():N(C,W),C.length===1&&(M[k]=C[0]),M.removeListener!==void 0&&this.emit("removeListener",k,re||S)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(k){var S,C,M;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[k]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[k]),this;if(arguments.length===0){var W=Object.keys(C),X;for(M=0;M<W.length;++M)X=W[M],X!=="removeListener"&&this.removeAllListeners(X);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=C[k],typeof S=="function")this.removeListener(k,S);else if(S!==void 0)for(M=S.length-1;M>=0;M--)this.removeListener(k,S[M]);return this};function B(P,k,S){var C=P._events;if(C===void 0)return[];var M=C[k];return M===void 0?[]:typeof M=="function"?S?[M.listener||M]:[M]:S?T(M):b(M,M.length)}l.prototype.listeners=function(k){return B(this,k,!0)},l.prototype.rawListeners=function(k){return B(this,k,!1)},l.listenerCount=function(P,k){return typeof P.listenerCount=="function"?P.listenerCount(k):x.call(P,k)},l.prototype.listenerCount=x;function x(P){var k=this._events;if(k!==void 0){var S=k[P];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(P,k){for(var S=new Array(k),C=0;C<k;++C)S[C]=P[C];return S}function N(P,k){for(;k+1<P.length;k++)P[k]=P[k+1];P.pop()}function T(P){for(var k=new Array(P.length),S=0;S<k.length;++S)k[S]=P[S].listener||P[S];return k}function m(P,k){return new Promise(function(S,C){function M(X){P.removeListener(k,W),C(X)}function W(){typeof P.removeListener=="function"&&P.removeListener("error",M),S([].slice.call(arguments))}A(P,k,W,{once:!0}),k!=="error"&&R(P,M,{once:!0})})}function R(P,k,S){typeof P.on=="function"&&A(P,"error",k,S)}function A(P,k,S,C){if(typeof P.on=="function")C.once?P.once(k,S):P.on(k,S);else if(typeof P.addEventListener=="function")P.addEventListener(k,function M(W){C.once&&P.removeEventListener(k,M),S(W)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof P)}return It.exports}var Jt,Kn;function Xn(){return Kn||(Kn=1,Jt=Ht().EventEmitter),Jt}var Yt={},Kt={},Xt,Zn;function Qn(){return Zn||(Zn=1,Xt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),s=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var f=42;e[t]=f;for(var l in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var g=Object.getOwnPropertySymbols(e);if(g.length!==1||g[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==f||u.enumerable!==!0)return!1}return!0}),Xt}var Zt,ei;function Bt(){if(ei)return Zt;ei=1;var r=Qn();return Zt=function(){return r()&&!!Symbol.toStringTag},Zt}var Qt,ti;function ri(){return ti||(ti=1,Qt=Object),Qt}var er,ni;function ba(){return ni||(ni=1,er=Error),er}var tr,ii;function Sa(){return ii||(ii=1,tr=EvalError),tr}var rr,oi;function _a(){return oi||(oi=1,rr=RangeError),rr}var nr,ai;function Ea(){return ai||(ai=1,nr=ReferenceError),nr}var ir,si;function li(){return si||(si=1,ir=SyntaxError),ir}var or,ci;function mt(){return ci||(ci=1,or=TypeError),or}var ar,ui;function Ca(){return ui||(ui=1,ar=URIError),ar}var sr,fi;function Ra(){return fi||(fi=1,sr=Math.abs),sr}var lr,hi;function Pa(){return hi||(hi=1,lr=Math.floor),lr}var cr,di;function Ta(){return di||(di=1,cr=Math.max),cr}var ur,pi;function Aa(){return pi||(pi=1,ur=Math.min),ur}var fr,gi;function Ia(){return gi||(gi=1,fr=Math.pow),fr}var hr,yi;function Ba(){return yi||(yi=1,hr=Math.round),hr}var dr,mi;function ka(){return mi||(mi=1,dr=Number.isNaN||function(e){return e!==e}),dr}var pr,vi;function Oa(){if(vi)return pr;vi=1;var r=ka();return pr=function(t){return r(t)||t===0?t:t<0?-1:1},pr}var gr,wi;function Ma(){return wi||(wi=1,gr=Object.getOwnPropertyDescriptor),gr}var yr,bi;function ct(){if(bi)return yr;bi=1;var r=Ma();if(r)try{r([],"length")}catch(e){r=null}return yr=r,yr}var mr,Si;function kt(){if(Si)return mr;Si=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch(e){r=!1}return mr=r,mr}var vr,_i;function La(){if(_i)return vr;_i=1;var r=typeof Symbol!="undefined"&&Symbol,e=Qn();return vr=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},vr}var wr,Ei;function Ci(){return Ei||(Ei=1,wr=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null),wr}var br,Ri;function Pi(){if(Ri)return br;Ri=1;var r=ri();return br=r.getPrototypeOf||null,br}var Sr,Ti;function Na(){if(Ti)return Sr;Ti=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,s="[object Function]",f=function(c,v){for(var h=[],I=0;I<c.length;I+=1)h[I]=c[I];for(var B=0;B<v.length;B+=1)h[B+c.length]=v[B];return h},l=function(c,v){for(var h=[],I=v,B=0;I<c.length;I+=1,B+=1)h[B]=c[I];return h},g=function(u,c){for(var v="",h=0;h<u.length;h+=1)v+=u[h],h+1<u.length&&(v+=c);return v};return Sr=function(c){var v=this;if(typeof v!="function"||e.apply(v)!==s)throw new TypeError(r+v);for(var h=l(arguments,1),I,B=function(){if(this instanceof I){var m=v.apply(this,f(h,arguments));return Object(m)===m?m:this}return v.apply(c,f(h,arguments))},x=t(0,v.length-h.length),b=[],N=0;N<x;N++)b[N]="$"+N;if(I=Function("binder","return function ("+g(b,",")+"){ return binder.apply(this,arguments); }")(B),v.prototype){var T=function(){};T.prototype=v.prototype,I.prototype=new T,T.prototype=null}return I},Sr}var _r,Ai;function vt(){if(Ai)return _r;Ai=1;var r=Na();return _r=Function.prototype.bind||r,_r}var Er,Ii;function Cr(){return Ii||(Ii=1,Er=Function.prototype.call),Er}var Rr,Bi;function Pr(){return Bi||(Bi=1,Rr=Function.prototype.apply),Rr}var Tr,ki;function Da(){return ki||(ki=1,Tr=typeof Reflect!="undefined"&&Reflect&&Reflect.apply),Tr}var Ar,Oi;function Mi(){if(Oi)return Ar;Oi=1;var r=vt(),e=Pr(),t=Cr(),s=Da();return Ar=s||r.call(t,e),Ar}var Ir,Li;function Br(){if(Li)return Ir;Li=1;var r=vt(),e=mt(),t=Cr(),s=Mi();return Ir=function(l){if(l.length<1||typeof l[0]!="function")throw new e("a function is required");return s(r,t,l)},Ir}var kr,Ni;function Fa(){if(Ni)return kr;Ni=1;var r=Br(),e=ct(),t;try{t=[].__proto__===Array.prototype}catch(g){if(!g||typeof g!="object"||!("code"in g)||g.code!=="ERR_PROTO_ACCESS")throw g}var s=!!t&&e&&e(Object.prototype,"__proto__"),f=Object,l=f.getPrototypeOf;return kr=s&&typeof s.get=="function"?r([s.get]):typeof l=="function"?function(u){return l(u==null?u:f(u))}:!1,kr}var Or,Di;function Mr(){if(Di)return Or;Di=1;var r=Ci(),e=Pi(),t=Fa();return Or=r?function(f){return r(f)}:e?function(f){if(!f||typeof f!="object"&&typeof f!="function")throw new TypeError("getProto: not an object");return e(f)}:t?function(f){return t(f)}:null,Or}var Lr,Fi;function Ui(){if(Fi)return Lr;Fi=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=vt();return Lr=t.call(r,e),Lr}var Nr,$i;function ji(){if($i)return Nr;$i=1;var r,e=ri(),t=ba(),s=Sa(),f=_a(),l=Ea(),g=li(),u=mt(),c=Ca(),v=Ra(),h=Pa(),I=Ta(),B=Aa(),x=Ia(),b=Ba(),N=Oa(),T=Function,m=function(Z){try{return T('"use strict"; return ('+Z+").constructor;")()}catch(Q){}},R=ct(),A=kt(),P=function(){throw new u},k=R?function(){try{return arguments.callee,P}catch(Z){try{return R(arguments,"callee").get}catch(Q){return P}}}():P,S=La()(),C=Mr(),M=Pi(),W=Ci(),X=Pr(),re=Cr(),U={},he=typeof Uint8Array=="undefined"||!C?r:C(Uint8Array),de={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?r:ArrayBuffer,"%ArrayIteratorPrototype%":S&&C?C([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":U,"%AsyncGenerator%":U,"%AsyncGeneratorFunction%":U,"%AsyncIteratorPrototype%":U,"%Atomics%":typeof Atomics=="undefined"?r:Atomics,"%BigInt%":typeof BigInt=="undefined"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":s,"%Float16Array%":typeof Float16Array=="undefined"?r:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?r:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?r:FinalizationRegistry,"%Function%":T,"%GeneratorFunction%":U,"%Int8Array%":typeof Int8Array=="undefined"?r:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?r:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":S&&C?C(C([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map=="undefined"?r:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!S||!C?r:C(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":R,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?r:Promise,"%Proxy%":typeof Proxy=="undefined"?r:Proxy,"%RangeError%":f,"%ReferenceError%":l,"%Reflect%":typeof Reflect=="undefined"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?r:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!S||!C?r:C(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":S&&C?C(""[Symbol.iterator]()):r,"%Symbol%":S?Symbol:r,"%SyntaxError%":g,"%ThrowTypeError%":k,"%TypedArray%":he,"%TypeError%":u,"%Uint8Array%":typeof Uint8Array=="undefined"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?r:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap=="undefined"?r:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?r:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?r:WeakSet,"%Function.prototype.call%":re,"%Function.prototype.apply%":X,"%Object.defineProperty%":A,"%Object.getPrototypeOf%":M,"%Math.abs%":v,"%Math.floor%":h,"%Math.max%":I,"%Math.min%":B,"%Math.pow%":x,"%Math.round%":b,"%Math.sign%":N,"%Reflect.getPrototypeOf%":W};if(C)try{null.error}catch(Z){var me=C(C(Z));de["%Error.prototype%"]=me}var Pe=function Z(Q){var y;if(Q==="%AsyncFunction%")y=m("async function () {}");else if(Q==="%GeneratorFunction%")y=m("function* () {}");else if(Q==="%AsyncGeneratorFunction%")y=m("async function* () {}");else if(Q==="%AsyncGenerator%"){var w=Z("%AsyncGeneratorFunction%");w&&(y=w.prototype)}else if(Q==="%AsyncIteratorPrototype%"){var z=Z("%AsyncGenerator%");z&&C&&(y=C(z.prototype))}return de[Q]=y,y},ke={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ee=vt(),_e=Ui(),Oe=Ee.call(re,Array.prototype.concat),qe=Ee.call(X,Array.prototype.splice),$=Ee.call(re,String.prototype.replace),V=Ee.call(re,String.prototype.slice),J=Ee.call(re,RegExp.prototype.exec),ne=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,D=/\\(\\)?/g,F=function(Q){var y=V(Q,0,1),w=V(Q,-1);if(y==="%"&&w!=="%")throw new g("invalid intrinsic syntax, expected closing `%`");if(w==="%"&&y!=="%")throw new g("invalid intrinsic syntax, expected opening `%`");var z=[];return $(Q,ne,function(ee,le,ie,se){z[z.length]=ie?$(se,D,"$1"):le||ee}),z},G=function(Q,y){var w=Q,z;if(_e(ke,w)&&(z=ke[w],w="%"+z[0]+"%"),_e(de,w)){var ee=de[w];if(ee===U&&(ee=Pe(w)),typeof ee=="undefined"&&!y)throw new u("intrinsic "+Q+" exists, but is not available. Please file an issue!");return{alias:z,name:w,value:ee}}throw new g("intrinsic "+Q+" does not exist!")};return Nr=function(Q,y){if(typeof Q!="string"||Q.length===0)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof y!="boolean")throw new u('"allowMissing" argument must be a boolean');if(J(/^%?[^%]*%?$/,Q)===null)throw new g("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var w=F(Q),z=w.length>0?w[0]:"",ee=G("%"+z+"%",y),le=ee.name,ie=ee.value,se=!1,De=ee.alias;De&&(z=De[0],qe(w,Oe([0,1],De)));for(var H=1,Fe=!0;H<w.length;H+=1){var Ue=w[H],ye=V(Ue,0,1),we=V(Ue,-1);if((ye==='"'||ye==="'"||ye==="`"||we==='"'||we==="'"||we==="`")&&ye!==we)throw new g("property names with quotes must have matching quotes");if((Ue==="constructor"||!Fe)&&(se=!0),z+="."+Ue,le="%"+z+"%",_e(de,le))ie=de[le];else if(ie!=null){if(!(Ue in ie)){if(!y)throw new u("base intrinsic for "+Q+" exists, but the property is not available.");return}if(R&&H+1>=w.length){var $e=R(ie,Ue);Fe=!!$e,Fe&&"get"in $e&&!("originalValue"in $e.get)?ie=$e.get:ie=ie[Ue]}else Fe=_e(ie,Ue),ie=ie[Ue];Fe&&!se&&(de[le]=ie)}}return ie},Nr}var Dr,qi;function wt(){if(qi)return Dr;qi=1;var r=ji(),e=Br(),t=e([r("%String.prototype.indexOf%")]);return Dr=function(f,l){var g=r(f,!!l);return typeof g=="function"&&t(f,".prototype.")>-1?e([g]):g},Dr}var Fr,xi;function Ua(){if(xi)return Fr;xi=1;var r=Bt()(),e=wt(),t=e("Object.prototype.toString"),s=function(u){return r&&u&&typeof u=="object"&&Symbol.toStringTag in u?!1:t(u)==="[object Arguments]"},f=function(u){return s(u)?!0:u!==null&&typeof u=="object"&&"length"in u&&typeof u.length=="number"&&u.length>=0&&t(u)!=="[object Array]"&&"callee"in u&&t(u.callee)==="[object Function]"},l=function(){return s(arguments)}();return s.isLegacyArguments=f,Fr=l?s:f,Fr}var Ur,Wi;function $a(){if(Wi)return Ur;Wi=1;var r=wt(),e=Bt()(),t=Ui(),s=ct(),f;if(e){var l=r("RegExp.prototype.exec"),g={},u=function(){throw g},c={toString:u,valueOf:u};typeof Symbol.toPrimitive=="symbol"&&(c[Symbol.toPrimitive]=u),f=function(B){if(!B||typeof B!="object")return!1;var x=s(B,"lastIndex"),b=x&&t(x,"value");if(!b)return!1;try{l(B,c)}catch(N){return N===g}}}else{var v=r("Object.prototype.toString"),h="[object RegExp]";f=function(B){return!B||typeof B!="object"&&typeof B!="function"?!1:v(B)===h}}return Ur=f,Ur}var $r,Gi;function ja(){if(Gi)return $r;Gi=1;var r=wt(),e=$a(),t=r("RegExp.prototype.exec"),s=mt();return $r=function(l){if(!e(l))throw new s("`regex` must be a RegExp");return function(u){return t(l,u)!==null}},$r}var jr,Vi;function qa(){if(Vi)return jr;Vi=1;var r=wt(),e=ja(),t=e(/^\s*(?:function)?\*/),s=Bt()(),f=Mr(),l=r("Object.prototype.toString"),g=r("Function.prototype.toString"),u=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(v){}},c;return jr=function(h){if(typeof h!="function")return!1;if(t(g(h)))return!0;if(!s){var I=l(h);return I==="[object GeneratorFunction]"}if(!f)return!1;if(typeof c=="undefined"){var B=u();c=B?f(B):!1}return f(h)===c},jr}var qr,zi;function xa(){if(zi)return qr;zi=1;var r=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,t,s;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{t=Object.defineProperty({},"length",{get:function(){throw s}}),s={},e(function(){throw 42},null,t)}catch(R){R!==s&&(e=null)}else e=null;var f=/^\s*class\b/,l=function(A){try{var P=r.call(A);return f.test(P)}catch(k){return!1}},g=function(A){try{return l(A)?!1:(r.call(A),!0)}catch(P){return!1}},u=Object.prototype.toString,c="[object Object]",v="[object Function]",h="[object GeneratorFunction]",I="[object HTMLAllCollection]",B="[object HTML document.all class]",x="[object HTMLCollection]",b=typeof Symbol=="function"&&!!Symbol.toStringTag,N=!(0 in[,]),T=function(){return!1};if(typeof document=="object"){var m=document.all;u.call(m)===u.call(document.all)&&(T=function(A){if((N||!A)&&(typeof A=="undefined"||typeof A=="object"))try{var P=u.call(A);return(P===I||P===B||P===x||P===c)&&A("")==null}catch(k){}return!1})}return qr=e?function(A){if(T(A))return!0;if(!A||typeof A!="function"&&typeof A!="object")return!1;try{e(A,null,t)}catch(P){if(P!==s)return!1}return!l(A)&&g(A)}:function(A){if(T(A))return!0;if(!A||typeof A!="function"&&typeof A!="object")return!1;if(b)return g(A);if(l(A))return!1;var P=u.call(A);return P!==v&&P!==h&&!/^\[object HTML/.test(P)?!1:g(A)},qr}var xr,Hi;function Wa(){if(Hi)return xr;Hi=1;var r=xa(),e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,s=function(c,v,h){for(var I=0,B=c.length;I<B;I++)t.call(c,I)&&(h==null?v(c[I],I,c):v.call(h,c[I],I,c))},f=function(c,v,h){for(var I=0,B=c.length;I<B;I++)h==null?v(c.charAt(I),I,c):v.call(h,c.charAt(I),I,c)},l=function(c,v,h){for(var I in c)t.call(c,I)&&(h==null?v(c[I],I,c):v.call(h,c[I],I,c))};function g(u){return e.call(u)==="[object Array]"}return xr=function(c,v,h){if(!r(v))throw new TypeError("iterator must be a function");var I;arguments.length>=3&&(I=h),g(c)?s(c,v,I):typeof c=="string"?f(c,v,I):l(c,v,I)},xr}var Wr,Ji;function Ga(){return Ji||(Ji=1,Wr=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Wr}var Gr,Yi;function Va(){if(Yi)return Gr;Yi=1;var r=Ga(),e=globalThis;return Gr=function(){for(var s=[],f=0;f<r.length;f++)typeof e[r[f]]=="function"&&(s[s.length]=r[f]);return s},Gr}var Vr={exports:{}},zr,Ki;function za(){if(Ki)return zr;Ki=1;var r=kt(),e=li(),t=mt(),s=ct();return zr=function(l,g,u){if(!l||typeof l!="object"&&typeof l!="function")throw new t("`obj` must be an object or a function`");if(typeof g!="string"&&typeof g!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,v=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,I=arguments.length>6?arguments[6]:!1,B=!!s&&s(l,g);if(r)r(l,g,{configurable:h===null&&B?B.configurable:!h,enumerable:c===null&&B?B.enumerable:!c,value:u,writable:v===null&&B?B.writable:!v});else if(I||!c&&!v&&!h)l[g]=u;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},zr}var Hr,Xi;function Ha(){if(Xi)return Hr;Xi=1;var r=kt(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch(s){return!0}},Hr=e,Hr}var Jr,Zi;function Ja(){if(Zi)return Jr;Zi=1;var r=ji(),e=za(),t=Ha()(),s=ct(),f=mt(),l=r("%Math.floor%");return Jr=function(u,c){if(typeof u!="function")throw new f("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||l(c)!==c)throw new f("`length` must be a positive 32-bit integer");var v=arguments.length>2&&!!arguments[2],h=!0,I=!0;if("length"in u&&s){var B=s(u,"length");B&&!B.configurable&&(h=!1),B&&!B.writable&&(I=!1)}return(h||I||!v)&&(t?e(u,"length",c,!0,!0):e(u,"length",c)),u},Jr}var Yr,Qi;function Ya(){if(Qi)return Yr;Qi=1;var r=vt(),e=Pr(),t=Mi();return Yr=function(){return t(r,e,arguments)},Yr}var eo;function Ka(){return eo||(eo=1,function(r){var e=Ja(),t=kt(),s=Br(),f=Ya();r.exports=function(g){var u=s(arguments),c=g.length-(arguments.length-1);return e(u,1+(c>0?c:0),!0)},t?t(r.exports,"apply",{value:f}):r.exports.apply=f}(Vr)),Vr.exports}var Kr,to;function ro(){if(to)return Kr;to=1;var r=Wa(),e=Va(),t=Ka(),s=wt(),f=ct(),l=Mr(),g=s("Object.prototype.toString"),u=Bt()(),c=globalThis,v=e(),h=s("String.prototype.slice"),I=s("Array.prototype.indexOf",!0)||function(T,m){for(var R=0;R<T.length;R+=1)if(T[R]===m)return R;return-1},B={__proto__:null};u&&f&&l?r(v,function(N){var T=new c[N];if(Symbol.toStringTag in T&&l){var m=l(T),R=f(m,Symbol.toStringTag);if(!R&&m){var A=l(m);R=f(A,Symbol.toStringTag)}B["$"+N]=t(R.get)}}):r(v,function(N){var T=new c[N],m=T.slice||T.set;m&&(B["$"+N]=t(m))});var x=function(T){var m=!1;return r(B,function(R,A){if(!m)try{"$"+R(T)===A&&(m=h(A,1))}catch(P){}}),m},b=function(T){var m=!1;return r(B,function(R,A){if(!m)try{R(T),m=h(A,1)}catch(P){}}),m};return Kr=function(T){if(!T||typeof T!="object")return!1;if(!u){var m=h(g(T),8,-1);return I(v,m)>-1?m:m!=="Object"?!1:b(T)}return f?x(T):null},Kr}var Xr,no;function Xa(){if(no)return Xr;no=1;var r=ro();return Xr=function(t){return!!r(t)},Xr}var io;function Za(){return io||(io=1,function(r){var e=Ua(),t=qa(),s=ro(),f=Xa();function l(H){return H.call.bind(H)}var g=typeof BigInt!="undefined",u=typeof Symbol!="undefined",c=l(Object.prototype.toString),v=l(Number.prototype.valueOf),h=l(String.prototype.valueOf),I=l(Boolean.prototype.valueOf);if(g)var B=l(BigInt.prototype.valueOf);if(u)var x=l(Symbol.prototype.valueOf);function b(H,Fe){if(typeof H!="object")return!1;try{return Fe(H),!0}catch(Ue){return!1}}r.isArgumentsObject=e,r.isGeneratorFunction=t,r.isTypedArray=f;function N(H){return typeof Promise!="undefined"&&H instanceof Promise||H!==null&&typeof H=="object"&&typeof H.then=="function"&&typeof H.catch=="function"}r.isPromise=N;function T(H){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?ArrayBuffer.isView(H):f(H)||V(H)}r.isArrayBufferView=T;function m(H){return s(H)==="Uint8Array"}r.isUint8Array=m;function R(H){return s(H)==="Uint8ClampedArray"}r.isUint8ClampedArray=R;function A(H){return s(H)==="Uint16Array"}r.isUint16Array=A;function P(H){return s(H)==="Uint32Array"}r.isUint32Array=P;function k(H){return s(H)==="Int8Array"}r.isInt8Array=k;function S(H){return s(H)==="Int16Array"}r.isInt16Array=S;function C(H){return s(H)==="Int32Array"}r.isInt32Array=C;function M(H){return s(H)==="Float32Array"}r.isFloat32Array=M;function W(H){return s(H)==="Float64Array"}r.isFloat64Array=W;function X(H){return s(H)==="BigInt64Array"}r.isBigInt64Array=X;function re(H){return s(H)==="BigUint64Array"}r.isBigUint64Array=re;function U(H){return c(H)==="[object Map]"}U.working=typeof Map!="undefined"&&U(new Map);function he(H){return typeof Map=="undefined"?!1:U.working?U(H):H instanceof Map}r.isMap=he;function de(H){return c(H)==="[object Set]"}de.working=typeof Set!="undefined"&&de(new Set);function me(H){return typeof Set=="undefined"?!1:de.working?de(H):H instanceof Set}r.isSet=me;function Pe(H){return c(H)==="[object WeakMap]"}Pe.working=typeof WeakMap!="undefined"&&Pe(new WeakMap);function ke(H){return typeof WeakMap=="undefined"?!1:Pe.working?Pe(H):H instanceof WeakMap}r.isWeakMap=ke;function Ee(H){return c(H)==="[object WeakSet]"}Ee.working=typeof WeakSet!="undefined"&&Ee(new WeakSet);function _e(H){return Ee(H)}r.isWeakSet=_e;function Oe(H){return c(H)==="[object ArrayBuffer]"}Oe.working=typeof ArrayBuffer!="undefined"&&Oe(new ArrayBuffer);function qe(H){return typeof ArrayBuffer=="undefined"?!1:Oe.working?Oe(H):H instanceof ArrayBuffer}r.isArrayBuffer=qe;function $(H){return c(H)==="[object DataView]"}$.working=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"&&$(new DataView(new ArrayBuffer(1),0,1));function V(H){return typeof DataView=="undefined"?!1:$.working?$(H):H instanceof DataView}r.isDataView=V;var J=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:void 0;function ne(H){return c(H)==="[object SharedArrayBuffer]"}function D(H){return typeof J=="undefined"?!1:(typeof ne.working=="undefined"&&(ne.working=ne(new J)),ne.working?ne(H):H instanceof J)}r.isSharedArrayBuffer=D;function F(H){return c(H)==="[object AsyncFunction]"}r.isAsyncFunction=F;function G(H){return c(H)==="[object Map Iterator]"}r.isMapIterator=G;function Z(H){return c(H)==="[object Set Iterator]"}r.isSetIterator=Z;function Q(H){return c(H)==="[object Generator]"}r.isGeneratorObject=Q;function y(H){return c(H)==="[object WebAssembly.Module]"}r.isWebAssemblyCompiledModule=y;function w(H){return b(H,v)}r.isNumberObject=w;function z(H){return b(H,h)}r.isStringObject=z;function ee(H){return b(H,I)}r.isBooleanObject=ee;function le(H){return g&&b(H,B)}r.isBigIntObject=le;function ie(H){return u&&b(H,x)}r.isSymbolObject=ie;function se(H){return w(H)||z(H)||ee(H)||le(H)||ie(H)}r.isBoxedPrimitive=se;function De(H){return typeof Uint8Array!="undefined"&&(qe(H)||D(H))}r.isAnyArrayBuffer=De,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(H){Object.defineProperty(r,H,{enumerable:!1,value:function(){throw new Error(H+" is not supported in userland")}})})}(Kt)),Kt}var Zr,oo;function Qa(){return oo||(oo=1,Zr=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Zr}var Ot={exports:{}},ao;function ut(){return ao||(ao=1,typeof Object.create=="function"?Ot.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ot.exports=function(e,t){if(t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}}),Ot.exports}var so;function lo(){return so||(so=1,function(r){var e=Object.getOwnPropertyDescriptors||function(V){for(var J=Object.keys(V),ne={},D=0;D<J.length;D++)ne[J[D]]=Object.getOwnPropertyDescriptor(V,J[D]);return ne},t=/%[sdj%]/g;r.format=function($){if(!k($)){for(var V=[],J=0;J<arguments.length;J++)V.push(g(arguments[J]));return V.join(" ")}for(var J=1,ne=arguments,D=ne.length,F=String($).replace(t,function(Z){if(Z==="%%")return"%";if(J>=D)return Z;switch(Z){case"%s":return String(ne[J++]);case"%d":return Number(ne[J++]);case"%j":try{return JSON.stringify(ne[J++])}catch(Q){return"[Circular]"}default:return Z}}),G=ne[J];J<D;G=ne[++J])R(G)||!W(G)?F+=" "+G:F+=" "+g(G);return F},r.deprecate=function($,V){if(typeof ae!="undefined"&&ae.noDeprecation===!0)return $;if(typeof ae=="undefined")return function(){return r.deprecate($,V).apply(this,arguments)};var J=!1;function ne(){if(!J){if(ae.throwDeprecation)throw new Error(V);ae.traceDeprecation?console.trace(V):console.error(V),J=!0}return $.apply(this,arguments)}return ne};var s={},f=/^$/;if(ae.env.NODE_DEBUG){var l=ae.env.NODE_DEBUG;l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),f=new RegExp("^"+l+"$","i")}r.debuglog=function($){if($=$.toUpperCase(),!s[$])if(f.test($)){var V=ae.pid;s[$]=function(){var J=r.format.apply(r,arguments);console.error("%s %d: %s",$,V,J)}}else s[$]=function(){};return s[$]};function g($,V){var J={seen:[],stylize:c};return arguments.length>=3&&(J.depth=arguments[2]),arguments.length>=4&&(J.colors=arguments[3]),m(V)?J.showHidden=V:V&&r._extend(J,V),C(J.showHidden)&&(J.showHidden=!1),C(J.depth)&&(J.depth=2),C(J.colors)&&(J.colors=!1),C(J.customInspect)&&(J.customInspect=!0),J.colors&&(J.stylize=u),h(J,$,J.depth)}r.inspect=g,g.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},g.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function u($,V){var J=g.styles[V];return J?"\x1B["+g.colors[J][0]+"m"+$+"\x1B["+g.colors[J][1]+"m":$}function c($,V){return $}function v($){var V={};return $.forEach(function(J,ne){V[J]=!0}),V}function h($,V,J){if($.customInspect&&V&&U(V.inspect)&&V.inspect!==r.inspect&&!(V.constructor&&V.constructor.prototype===V)){var ne=V.inspect(J,$);return k(ne)||(ne=h($,ne,J)),ne}var D=I($,V);if(D)return D;var F=Object.keys(V),G=v(F);if($.showHidden&&(F=Object.getOwnPropertyNames(V)),re(V)&&(F.indexOf("message")>=0||F.indexOf("description")>=0))return B(V);if(F.length===0){if(U(V)){var Z=V.name?": "+V.name:"";return $.stylize("[Function"+Z+"]","special")}if(M(V))return $.stylize(RegExp.prototype.toString.call(V),"regexp");if(X(V))return $.stylize(Date.prototype.toString.call(V),"date");if(re(V))return B(V)}var Q="",y=!1,w=["{","}"];if(T(V)&&(y=!0,w=["[","]"]),U(V)){var z=V.name?": "+V.name:"";Q=" [Function"+z+"]"}if(M(V)&&(Q=" "+RegExp.prototype.toString.call(V)),X(V)&&(Q=" "+Date.prototype.toUTCString.call(V)),re(V)&&(Q=" "+B(V)),F.length===0&&(!y||V.length==0))return w[0]+Q+w[1];if(J<0)return M(V)?$.stylize(RegExp.prototype.toString.call(V),"regexp"):$.stylize("[Object]","special");$.seen.push(V);var ee;return y?ee=x($,V,J,G,F):ee=F.map(function(le){return b($,V,J,G,le,y)}),$.seen.pop(),N(ee,Q,w)}function I($,V){if(C(V))return $.stylize("undefined","undefined");if(k(V)){var J="'"+JSON.stringify(V).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(J,"string")}if(P(V))return $.stylize(""+V,"number");if(m(V))return $.stylize(""+V,"boolean");if(R(V))return $.stylize("null","null")}function B($){return"["+Error.prototype.toString.call($)+"]"}function x($,V,J,ne,D){for(var F=[],G=0,Z=V.length;G<Z;++G)Ee(V,String(G))?F.push(b($,V,J,ne,String(G),!0)):F.push("");return D.forEach(function(Q){Q.match(/^\d+$/)||F.push(b($,V,J,ne,Q,!0))}),F}function b($,V,J,ne,D,F){var G,Z,Q;if(Q=Object.getOwnPropertyDescriptor(V,D)||{value:V[D]},Q.get?Q.set?Z=$.stylize("[Getter/Setter]","special"):Z=$.stylize("[Getter]","special"):Q.set&&(Z=$.stylize("[Setter]","special")),Ee(ne,D)||(G="["+D+"]"),Z||($.seen.indexOf(Q.value)<0?(R(J)?Z=h($,Q.value,null):Z=h($,Q.value,J-1),Z.indexOf(`
13
13
  `)>-1&&(F?Z=Z.split(`
14
14
  `).map(function(y){return" "+y}).join(`
15
15
  `).slice(2):Z=`
@@ -18,10 +18,10 @@ Use Chrome, Firefox or Internet Explorer 11`)}var s=Hn().Buffer,u=globalThis.cry
18
18
  `))):Z=$.stylize("[Circular]","special")),C(G)){if(F&&D.match(/^\d+$/))return Z;G=JSON.stringify(""+D),G.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(G=G.slice(1,-1),G=$.stylize(G,"name")):(G=G.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),G=$.stylize(G,"string"))}return G+": "+Z}function N($,V,J){var ne=$.reduce(function(D,F){return F.indexOf(`
19
19
  `)>=0,D+F.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ne>60?J[0]+(V===""?"":V+`
20
20
  `)+" "+$.join(`,
21
- `)+" "+J[1]:J[0]+V+" "+$.join(", ")+" "+J[1]}r.types=Za();function T($){return Array.isArray($)}r.isArray=T;function m($){return typeof $=="boolean"}r.isBoolean=m;function R($){return $===null}r.isNull=R;function A($){return $==null}r.isNullOrUndefined=A;function P($){return typeof $=="number"}r.isNumber=P;function k($){return typeof $=="string"}r.isString=k;function S($){return typeof $=="symbol"}r.isSymbol=S;function C($){return $===void 0}r.isUndefined=C;function M($){return W($)&&de($)==="[object RegExp]"}r.isRegExp=M,r.types.isRegExp=M;function W($){return typeof $=="object"&&$!==null}r.isObject=W;function X($){return W($)&&de($)==="[object Date]"}r.isDate=X,r.types.isDate=X;function re($){return W($)&&(de($)==="[object Error]"||$ instanceof Error)}r.isError=re,r.types.isNativeError=re;function U($){return typeof $=="function"}r.isFunction=U;function he($){return $===null||typeof $=="boolean"||typeof $=="number"||typeof $=="string"||typeof $=="symbol"||typeof $=="undefined"}r.isPrimitive=he,r.isBuffer=Qa();function de($){return Object.prototype.toString.call($)}function me($){return $<10?"0"+$.toString(10):$.toString(10)}var Pe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ke(){var $=new Date,V=[me($.getHours()),me($.getMinutes()),me($.getSeconds())].join(":");return[$.getDate(),Pe[$.getMonth()],V].join(" ")}r.log=function(){console.log("%s - %s",ke(),r.format.apply(r,arguments))},r.inherits=ut(),r._extend=function($,V){if(!V||!W(V))return $;for(var J=Object.keys(V),ne=J.length;ne--;)$[J[ne]]=V[J[ne]];return $};function Ee($,V){return Object.prototype.hasOwnProperty.call($,V)}var _e=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;r.promisify=function(V){if(typeof V!="function")throw new TypeError('The "original" argument must be of type Function');if(_e&&V[_e]){var J=V[_e];if(typeof J!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(J,_e,{value:J,enumerable:!1,writable:!1,configurable:!0}),J}function J(){for(var ne,D,F=new Promise(function(Q,y){ne=Q,D=y}),G=[],Z=0;Z<arguments.length;Z++)G.push(arguments[Z]);G.push(function(Q,y){Q?D(Q):ne(y)});try{V.apply(this,G)}catch(Q){D(Q)}return F}return Object.setPrototypeOf(J,Object.getPrototypeOf(V)),_e&&Object.defineProperty(J,_e,{value:J,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(J,e(V))},r.promisify.custom=_e;function Oe($,V){if(!$){var J=new Error("Promise was rejected with a falsy value");J.reason=$,$=J}return V($)}function qe($){if(typeof $!="function")throw new TypeError('The "original" argument must be of type Function');function V(){for(var J=[],ne=0;ne<arguments.length;ne++)J.push(arguments[ne]);var D=J.pop();if(typeof D!="function")throw new TypeError("The last argument must be of type Function");var F=this,G=function(){return D.apply(F,arguments)};$.apply(this,J).then(function(Z){ae.nextTick(G.bind(null,null,Z))},function(Z){ae.nextTick(Oe.bind(null,Z,G))})}return Object.setPrototypeOf(V,Object.getPrototypeOf($)),Object.defineProperties(V,e($)),V}r.callbackify=qe}(Yt)),Yt}var Qr,co;function es(){if(co)return Qr;co=1;function r(b,N){var T=Object.keys(b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(b);N&&(m=m.filter(function(R){return Object.getOwnPropertyDescriptor(b,R).enumerable})),T.push.apply(T,m)}return T}function e(b){for(var N=1;N<arguments.length;N++){var T=arguments[N]!=null?arguments[N]:{};N%2?r(Object(T),!0).forEach(function(m){t(b,m,T[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(T)):r(Object(T)).forEach(function(m){Object.defineProperty(b,m,Object.getOwnPropertyDescriptor(T,m))})}return b}function t(b,N,T){return N=g(N),N in b?Object.defineProperty(b,N,{value:T,enumerable:!0,configurable:!0,writable:!0}):b[N]=T,b}function s(b,N){if(!(b instanceof N))throw new TypeError("Cannot call a class as a function")}function u(b,N){for(var T=0;T<N.length;T++){var m=N[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(b,g(m.key),m)}}function l(b,N,T){return N&&u(b.prototype,N),Object.defineProperty(b,"prototype",{writable:!1}),b}function g(b){var N=f(b,"string");return typeof N=="symbol"?N:String(N)}function f(b,N){if(typeof b!="object"||b===null)return b;var T=b[Symbol.toPrimitive];if(T!==void 0){var m=T.call(b,N);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(b)}var c=yt(),v=c.Buffer,h=lo(),I=h.inspect,B=I&&I.custom||"inspect";function x(b,N,T){v.prototype.copy.call(b,N,T)}return Qr=function(){function b(){s(this,b),this.head=null,this.tail=null,this.length=0}return l(b,[{key:"push",value:function(T){var m={data:T,next:null};this.length>0?this.tail.next=m:this.head=m,this.tail=m,++this.length}},{key:"unshift",value:function(T){var m={data:T,next:this.head};this.length===0&&(this.tail=m),this.head=m,++this.length}},{key:"shift",value:function(){if(this.length!==0){var T=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,T}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(T){if(this.length===0)return"";for(var m=this.head,R=""+m.data;m=m.next;)R+=T+m.data;return R}},{key:"concat",value:function(T){if(this.length===0)return v.alloc(0);for(var m=v.allocUnsafe(T>>>0),R=this.head,A=0;R;)x(R.data,m,A),A+=R.data.length,R=R.next;return m}},{key:"consume",value:function(T,m){var R;return T<this.head.data.length?(R=this.head.data.slice(0,T),this.head.data=this.head.data.slice(T)):T===this.head.data.length?R=this.shift():R=m?this._getString(T):this._getBuffer(T),R}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(T){var m=this.head,R=1,A=m.data;for(T-=A.length;m=m.next;){var P=m.data,k=T>P.length?P.length:T;if(k===P.length?A+=P:A+=P.slice(0,T),T-=k,T===0){k===P.length?(++R,m.next?this.head=m.next:this.head=this.tail=null):(this.head=m,m.data=P.slice(k));break}++R}return this.length-=R,A}},{key:"_getBuffer",value:function(T){var m=v.allocUnsafe(T),R=this.head,A=1;for(R.data.copy(m),T-=R.data.length;R=R.next;){var P=R.data,k=T>P.length?P.length:T;if(P.copy(m,m.length-T,0,k),T-=k,T===0){k===P.length?(++A,R.next?this.head=R.next:this.head=this.tail=null):(this.head=R,R.data=P.slice(k));break}++A}return this.length-=A,m}},{key:B,value:function(T,m){return I(this,e(e({},m),{},{depth:0,customInspect:!1}))}}]),b}(),Qr}var en,uo;function fo(){if(uo)return en;uo=1;function r(g,f){var c=this,v=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return v||h?(f?f(g):g&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ae.nextTick(u,this,g)):ae.nextTick(u,this,g)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(g||null,function(I){!f&&I?c._writableState?c._writableState.errorEmitted?ae.nextTick(t,c):(c._writableState.errorEmitted=!0,ae.nextTick(e,c,I)):ae.nextTick(e,c,I):f?(ae.nextTick(t,c),f(I)):ae.nextTick(t,c)}),this)}function e(g,f){u(g,f),t(g)}function t(g){g._writableState&&!g._writableState.emitClose||g._readableState&&!g._readableState.emitClose||g.emit("close")}function s(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function u(g,f){g.emit("error",f)}function l(g,f){var c=g._readableState,v=g._writableState;c&&c.autoDestroy||v&&v.autoDestroy?g.destroy(f):g.emit("error",f)}return en={destroy:r,undestroy:s,errorOrDestroy:l},en}var tn={},ho;function ft(){if(ho)return tn;ho=1;function r(f,c){f.prototype=Object.create(c.prototype),f.prototype.constructor=f,f.__proto__=c}var e={};function t(f,c,v){v||(v=Error);function h(B,x,b){return typeof c=="string"?c:c(B,x,b)}var I=function(B){r(x,B);function x(b,N,T){return B.call(this,h(b,N,T))||this}return x}(v);I.prototype.name=v.name,I.prototype.code=f,e[f]=I}function s(f,c){if(Array.isArray(f)){var v=f.length;return f=f.map(function(h){return String(h)}),v>2?"one of ".concat(c," ").concat(f.slice(0,v-1).join(", "),", or ")+f[v-1]:v===2?"one of ".concat(c," ").concat(f[0]," or ").concat(f[1]):"of ".concat(c," ").concat(f[0])}else return"of ".concat(c," ").concat(String(f))}function u(f,c,v){return f.substr(0,c.length)===c}function l(f,c,v){return(v===void 0||v>f.length)&&(v=f.length),f.substring(v-c.length,v)===c}function g(f,c,v){return typeof v!="number"&&(v=0),v+c.length>f.length?!1:f.indexOf(c,v)!==-1}return t("ERR_INVALID_OPT_VALUE",function(f,c){return'The value "'+c+'" is invalid for option "'+f+'"'},TypeError),t("ERR_INVALID_ARG_TYPE",function(f,c,v){var h;typeof c=="string"&&u(c,"not ")?(h="must not be",c=c.replace(/^not /,"")):h="must be";var I;if(l(f," argument"))I="The ".concat(f," ").concat(h," ").concat(s(c,"type"));else{var B=g(f,".")?"property":"argument";I='The "'.concat(f,'" ').concat(B," ").concat(h," ").concat(s(c,"type"))}return I+=". Received type ".concat(typeof v),I},TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",function(f){return"The "+f+" method is not implemented"}),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",function(f){return"Cannot call "+f+" after a stream was destroyed"}),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",function(f){return"Unknown encoding: "+f},TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),tn.codes=e,tn}var rn,po;function go(){if(po)return rn;po=1;var r=ft().codes.ERR_INVALID_OPT_VALUE;function e(s,u,l){return s.highWaterMark!=null?s.highWaterMark:u?s[l]:null}function t(s,u,l,g){var f=e(u,g,l);if(f!=null){if(!(isFinite(f)&&Math.floor(f)===f)||f<0){var c=g?l:"highWaterMark";throw new r(c,f)}return Math.floor(f)}return s.objectMode?16:16*1024}return rn={getHighWaterMark:t},rn}var nn,yo;function ts(){if(yo)return nn;yo=1,nn=r;function r(t,s){if(e("noDeprecation"))return t;var u=!1;function l(){if(!u){if(e("throwDeprecation"))throw new Error(s);e("traceDeprecation")?console.trace(s):console.warn(s),u=!0}return t.apply(this,arguments)}return l}function e(t){try{if(!globalThis.localStorage)return!1}catch(u){return!1}var s=globalThis.localStorage[t];return s==null?!1:String(s).toLowerCase()==="true"}return nn}var on,mo;function vo(){if(mo)return on;mo=1,on=M;function r(D){var F=this;this.next=null,this.entry=null,this.finish=function(){ne(F,D)}}var e;M.WritableState=S;var t={deprecate:ts()},s=Xn(),u=yt().Buffer,l=(typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function g(D){return u.from(D)}function f(D){return u.isBuffer(D)||D instanceof l}var c=fo(),v=go(),h=v.getHighWaterMark,I=ft().codes,B=I.ERR_INVALID_ARG_TYPE,x=I.ERR_METHOD_NOT_IMPLEMENTED,b=I.ERR_MULTIPLE_CALLBACK,N=I.ERR_STREAM_CANNOT_PIPE,T=I.ERR_STREAM_DESTROYED,m=I.ERR_STREAM_NULL_VALUES,R=I.ERR_STREAM_WRITE_AFTER_END,A=I.ERR_UNKNOWN_ENCODING,P=c.errorOrDestroy;ut()(M,s);function k(){}function S(D,F,G){e=e||ht(),D=D||{},typeof G!="boolean"&&(G=F instanceof e),this.objectMode=!!D.objectMode,G&&(this.objectMode=this.objectMode||!!D.writableObjectMode),this.highWaterMark=h(this,D,"writableHighWaterMark",G),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Z=D.decodeStrings===!1;this.decodeStrings=!Z,this.defaultEncoding=D.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Q){Pe(F,Q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=D.emitClose!==!1,this.autoDestroy=!!D.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}S.prototype.getBuffer=function(){for(var F=this.bufferedRequest,G=[];F;)G.push(F),F=F.next;return G},function(){try{Object.defineProperty(S.prototype,"buffer",{get:t.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(D){}}();var C;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(C=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(F){return C.call(this,F)?!0:this!==M?!1:F&&F._writableState instanceof S}})):C=function(F){return F instanceof this};function M(D){e=e||ht();var F=this instanceof e;if(!F&&!C.call(M,this))return new M(D);this._writableState=new S(D,this,F),this.writable=!0,D&&(typeof D.write=="function"&&(this._write=D.write),typeof D.writev=="function"&&(this._writev=D.writev),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.final=="function"&&(this._final=D.final)),s.call(this)}M.prototype.pipe=function(){P(this,new N)};function W(D,F){var G=new R;P(D,G),ae.nextTick(F,G)}function X(D,F,G,Z){var Q;return G===null?Q=new m:typeof G!="string"&&!F.objectMode&&(Q=new B("chunk",["string","Buffer"],G)),Q?(P(D,Q),ae.nextTick(Z,Q),!1):!0}M.prototype.write=function(D,F,G){var Z=this._writableState,Q=!1,y=!Z.objectMode&&f(D);return y&&!u.isBuffer(D)&&(D=g(D)),typeof F=="function"&&(G=F,F=null),y?F="buffer":F||(F=Z.defaultEncoding),typeof G!="function"&&(G=k),Z.ending?W(this,G):(y||X(this,Z,D,G))&&(Z.pendingcb++,Q=U(this,Z,y,D,F,G)),Q},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var D=this._writableState;D.corked&&(D.corked--,!D.writing&&!D.corked&&!D.bufferProcessing&&D.bufferedRequest&&_e(this,D))},M.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())>-1))throw new A(F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function re(D,F,G){return!D.objectMode&&D.decodeStrings!==!1&&typeof F=="string"&&(F=u.from(F,G)),F}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function U(D,F,G,Z,Q,y){if(!G){var w=re(F,Z,Q);Z!==w&&(G=!0,Q="buffer",Z=w)}var z=F.objectMode?1:Z.length;F.length+=z;var ee=F.length<F.highWaterMark;if(ee||(F.needDrain=!0),F.writing||F.corked){var le=F.lastBufferedRequest;F.lastBufferedRequest={chunk:Z,encoding:Q,isBuf:G,callback:y,next:null},le?le.next=F.lastBufferedRequest:F.bufferedRequest=F.lastBufferedRequest,F.bufferedRequestCount+=1}else he(D,F,!1,z,Z,Q,y);return ee}function he(D,F,G,Z,Q,y,w){F.writelen=Z,F.writecb=w,F.writing=!0,F.sync=!0,F.destroyed?F.onwrite(new T("write")):G?D._writev(Q,F.onwrite):D._write(Q,y,F.onwrite),F.sync=!1}function de(D,F,G,Z,Q){--F.pendingcb,G?(ae.nextTick(Q,Z),ae.nextTick(V,D,F),D._writableState.errorEmitted=!0,P(D,Z)):(Q(Z),D._writableState.errorEmitted=!0,P(D,Z),V(D,F))}function me(D){D.writing=!1,D.writecb=null,D.length-=D.writelen,D.writelen=0}function Pe(D,F){var G=D._writableState,Z=G.sync,Q=G.writecb;if(typeof Q!="function")throw new b;if(me(G),F)de(D,G,Z,F,Q);else{var y=Oe(G)||D.destroyed;!y&&!G.corked&&!G.bufferProcessing&&G.bufferedRequest&&_e(D,G),Z?ae.nextTick(ke,D,G,y,Q):ke(D,G,y,Q)}}function ke(D,F,G,Z){G||Ee(D,F),F.pendingcb--,Z(),V(D,F)}function Ee(D,F){F.length===0&&F.needDrain&&(F.needDrain=!1,D.emit("drain"))}function _e(D,F){F.bufferProcessing=!0;var G=F.bufferedRequest;if(D._writev&&G&&G.next){var Z=F.bufferedRequestCount,Q=new Array(Z),y=F.corkedRequestsFree;y.entry=G;for(var w=0,z=!0;G;)Q[w]=G,G.isBuf||(z=!1),G=G.next,w+=1;Q.allBuffers=z,he(D,F,!0,F.length,Q,"",y.finish),F.pendingcb++,F.lastBufferedRequest=null,y.next?(F.corkedRequestsFree=y.next,y.next=null):F.corkedRequestsFree=new r(F),F.bufferedRequestCount=0}else{for(;G;){var ee=G.chunk,le=G.encoding,ie=G.callback,se=F.objectMode?1:ee.length;if(he(D,F,!1,se,ee,le,ie),G=G.next,F.bufferedRequestCount--,F.writing)break}G===null&&(F.lastBufferedRequest=null)}F.bufferedRequest=G,F.bufferProcessing=!1}M.prototype._write=function(D,F,G){G(new x("_write()"))},M.prototype._writev=null,M.prototype.end=function(D,F,G){var Z=this._writableState;return typeof D=="function"?(G=D,D=null,F=null):typeof F=="function"&&(G=F,F=null),D!=null&&this.write(D,F),Z.corked&&(Z.corked=1,this.uncork()),Z.ending||J(this,Z,G),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Oe(D){return D.ending&&D.length===0&&D.bufferedRequest===null&&!D.finished&&!D.writing}function qe(D,F){D._final(function(G){F.pendingcb--,G&&P(D,G),F.prefinished=!0,D.emit("prefinish"),V(D,F)})}function $(D,F){!F.prefinished&&!F.finalCalled&&(typeof D._final=="function"&&!F.destroyed?(F.pendingcb++,F.finalCalled=!0,ae.nextTick(qe,D,F)):(F.prefinished=!0,D.emit("prefinish")))}function V(D,F){var G=Oe(F);if(G&&($(D,F),F.pendingcb===0&&(F.finished=!0,D.emit("finish"),F.autoDestroy))){var Z=D._readableState;(!Z||Z.autoDestroy&&Z.endEmitted)&&D.destroy()}return G}function J(D,F,G){F.ending=!0,V(D,F),G&&(F.finished?ae.nextTick(G):D.once("finish",G)),F.ended=!0,D.writable=!1}function ne(D,F,G){var Z=D.entry;for(D.entry=null;Z;){var Q=Z.callback;F.pendingcb--,Q(G),Z=Z.next}F.corkedRequestsFree.next=D}return Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),M.prototype.destroy=c.destroy,M.prototype._undestroy=c.undestroy,M.prototype._destroy=function(D,F){F(D)},on}var an,wo;function ht(){if(wo)return an;wo=1;var r=Object.keys||function(v){var h=[];for(var I in v)h.push(I);return h};an=g;var e=Po(),t=vo();ut()(g,e);for(var s=r(t.prototype),u=0;u<s.length;u++){var l=s[u];g.prototype[l]||(g.prototype[l]=t.prototype[l])}function g(v){if(!(this instanceof g))return new g(v);e.call(this,v),t.call(this,v),this.allowHalfOpen=!0,v&&(v.readable===!1&&(this.readable=!1),v.writable===!1&&(this.writable=!1),v.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",f)))}Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(g.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(g.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function f(){this._writableState.ended||ae.nextTick(c,this)}function c(v){v.end()}return Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(h){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=h,this._writableState.destroyed=h)}}),an}var sn={},bo;function So(){if(bo)return sn;bo=1;var r=Hn().Buffer,e=r.isEncoding||function(m){switch(m=""+m,m&&m.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function t(m){if(!m)return"utf8";for(var R;;)switch(m){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return m;default:if(R)return;m=(""+m).toLowerCase(),R=!0}}function s(m){var R=t(m);if(typeof R!="string"&&(r.isEncoding===e||!e(m)))throw new Error("Unknown encoding: "+m);return R||m}sn.StringDecoder=u;function u(m){this.encoding=s(m);var R;switch(this.encoding){case"utf16le":this.text=I,this.end=B,R=4;break;case"utf8":this.fillLast=c,R=4;break;case"base64":this.text=x,this.end=b,R=3;break;default:this.write=N,this.end=T;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(R)}u.prototype.write=function(m){if(m.length===0)return"";var R,A;if(this.lastNeed){if(R=this.fillLast(m),R===void 0)return"";A=this.lastNeed,this.lastNeed=0}else A=0;return A<m.length?R?R+this.text(m,A):this.text(m,A):R||""},u.prototype.end=h,u.prototype.text=v,u.prototype.fillLast=function(m){if(this.lastNeed<=m.length)return m.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);m.copy(this.lastChar,this.lastTotal-this.lastNeed,0,m.length),this.lastNeed-=m.length};function l(m){return m<=127?0:m>>5===6?2:m>>4===14?3:m>>3===30?4:m>>6===2?-1:-2}function g(m,R,A){var P=R.length-1;if(P<A)return 0;var k=l(R[P]);return k>=0?(k>0&&(m.lastNeed=k-1),k):--P<A||k===-2?0:(k=l(R[P]),k>=0?(k>0&&(m.lastNeed=k-2),k):--P<A||k===-2?0:(k=l(R[P]),k>=0?(k>0&&(k===2?k=0:m.lastNeed=k-3),k):0))}function f(m,R,A){if((R[0]&192)!==128)return m.lastNeed=0,"�";if(m.lastNeed>1&&R.length>1){if((R[1]&192)!==128)return m.lastNeed=1,"�";if(m.lastNeed>2&&R.length>2&&(R[2]&192)!==128)return m.lastNeed=2,"�"}}function c(m){var R=this.lastTotal-this.lastNeed,A=f(this,m);if(A!==void 0)return A;if(this.lastNeed<=m.length)return m.copy(this.lastChar,R,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);m.copy(this.lastChar,R,0,m.length),this.lastNeed-=m.length}function v(m,R){var A=g(this,m,R);if(!this.lastNeed)return m.toString("utf8",R);this.lastTotal=A;var P=m.length-(A-this.lastNeed);return m.copy(this.lastChar,0,P),m.toString("utf8",R,P)}function h(m){var R=m&&m.length?this.write(m):"";return this.lastNeed?R+"�":R}function I(m,R){if((m.length-R)%2===0){var A=m.toString("utf16le",R);if(A){var P=A.charCodeAt(A.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=m[m.length-2],this.lastChar[1]=m[m.length-1],A.slice(0,-1)}return A}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=m[m.length-1],m.toString("utf16le",R,m.length-1)}function B(m){var R=m&&m.length?this.write(m):"";if(this.lastNeed){var A=this.lastTotal-this.lastNeed;return R+this.lastChar.toString("utf16le",0,A)}return R}function x(m,R){var A=(m.length-R)%3;return A===0?m.toString("base64",R):(this.lastNeed=3-A,this.lastTotal=3,A===1?this.lastChar[0]=m[m.length-1]:(this.lastChar[0]=m[m.length-2],this.lastChar[1]=m[m.length-1]),m.toString("base64",R,m.length-A))}function b(m){var R=m&&m.length?this.write(m):"";return this.lastNeed?R+this.lastChar.toString("base64",0,3-this.lastNeed):R}function N(m){return m.toString(this.encoding)}function T(m){return m&&m.length?this.write(m):""}return sn}var ln,_o;function cn(){if(_o)return ln;_o=1;var r=ft().codes.ERR_STREAM_PREMATURE_CLOSE;function e(l){var g=!1;return function(){if(!g){g=!0;for(var f=arguments.length,c=new Array(f),v=0;v<f;v++)c[v]=arguments[v];l.apply(this,c)}}}function t(){}function s(l){return l.setHeader&&typeof l.abort=="function"}function u(l,g,f){if(typeof g=="function")return u(l,null,g);g||(g={}),f=e(f||t);var c=g.readable||g.readable!==!1&&l.readable,v=g.writable||g.writable!==!1&&l.writable,h=function(){l.writable||B()},I=l._writableState&&l._writableState.finished,B=function(){v=!1,I=!0,c||f.call(l)},x=l._readableState&&l._readableState.endEmitted,b=function(){c=!1,x=!0,v||f.call(l)},N=function(A){f.call(l,A)},T=function(){var A;if(c&&!x)return(!l._readableState||!l._readableState.ended)&&(A=new r),f.call(l,A);if(v&&!I)return(!l._writableState||!l._writableState.ended)&&(A=new r),f.call(l,A)},m=function(){l.req.on("finish",B)};return s(l)?(l.on("complete",B),l.on("abort",T),l.req?m():l.on("request",m)):v&&!l._writableState&&(l.on("end",h),l.on("close",h)),l.on("end",b),l.on("finish",B),g.error!==!1&&l.on("error",N),l.on("close",T),function(){l.removeListener("complete",B),l.removeListener("abort",T),l.removeListener("request",m),l.req&&l.req.removeListener("finish",B),l.removeListener("end",h),l.removeListener("close",h),l.removeListener("finish",B),l.removeListener("end",b),l.removeListener("error",N),l.removeListener("close",T)}}return ln=u,ln}var un,Eo;function rs(){if(Eo)return un;Eo=1;var r;function e(A,P,k){return P=t(P),P in A?Object.defineProperty(A,P,{value:k,enumerable:!0,configurable:!0,writable:!0}):A[P]=k,A}function t(A){var P=s(A,"string");return typeof P=="symbol"?P:String(P)}function s(A,P){if(typeof A!="object"||A===null)return A;var k=A[Symbol.toPrimitive];if(k!==void 0){var S=k.call(A,P);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(A)}var u=cn(),l=Symbol("lastResolve"),g=Symbol("lastReject"),f=Symbol("error"),c=Symbol("ended"),v=Symbol("lastPromise"),h=Symbol("handlePromise"),I=Symbol("stream");function B(A,P){return{value:A,done:P}}function x(A){var P=A[l];if(P!==null){var k=A[I].read();k!==null&&(A[v]=null,A[l]=null,A[g]=null,P(B(k,!1)))}}function b(A){ae.nextTick(x,A)}function N(A,P){return function(k,S){A.then(function(){if(P[c]){k(B(void 0,!0));return}P[h](k,S)},S)}}var T=Object.getPrototypeOf(function(){}),m=Object.setPrototypeOf((r={get stream(){return this[I]},next:function(){var P=this,k=this[f];if(k!==null)return Promise.reject(k);if(this[c])return Promise.resolve(B(void 0,!0));if(this[I].destroyed)return new Promise(function(W,X){ae.nextTick(function(){P[f]?X(P[f]):W(B(void 0,!0))})});var S=this[v],C;if(S)C=new Promise(N(S,this));else{var M=this[I].read();if(M!==null)return Promise.resolve(B(M,!1));C=new Promise(this[h])}return this[v]=C,C}},e(r,Symbol.asyncIterator,function(){return this}),e(r,"return",function(){var P=this;return new Promise(function(k,S){P[I].destroy(null,function(C){if(C){S(C);return}k(B(void 0,!0))})})}),r),T),R=function(P){var k,S=Object.create(m,(k={},e(k,I,{value:P,writable:!0}),e(k,l,{value:null,writable:!0}),e(k,g,{value:null,writable:!0}),e(k,f,{value:null,writable:!0}),e(k,c,{value:P._readableState.endEmitted,writable:!0}),e(k,h,{value:function(M,W){var X=S[I].read();X?(S[v]=null,S[l]=null,S[g]=null,M(B(X,!1))):(S[l]=M,S[g]=W)},writable:!0}),k));return S[v]=null,u(P,function(C){if(C&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"){var M=S[g];M!==null&&(S[v]=null,S[l]=null,S[g]=null,M(C)),S[f]=C;return}var W=S[l];W!==null&&(S[v]=null,S[l]=null,S[g]=null,W(B(void 0,!0))),S[c]=!0}),P.on("readable",b.bind(null,S)),S};return un=R,un}var fn,Co;function ns(){return Co||(Co=1,fn=function(){throw new Error("Readable.from is not available in the browser")}),fn}var hn,Ro;function Po(){if(Ro)return hn;Ro=1,hn=W;var r;W.ReadableState=M,Ht().EventEmitter;var e=function(w,z){return w.listeners(z).length},t=Xn(),s=yt().Buffer,u=(typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function l(y){return s.from(y)}function g(y){return s.isBuffer(y)||y instanceof u}var f=lo(),c;f&&f.debuglog?c=f.debuglog("stream"):c=function(){};var v=es(),h=fo(),I=go(),B=I.getHighWaterMark,x=ft().codes,b=x.ERR_INVALID_ARG_TYPE,N=x.ERR_STREAM_PUSH_AFTER_EOF,T=x.ERR_METHOD_NOT_IMPLEMENTED,m=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,R,A,P;ut()(W,t);var k=h.errorOrDestroy,S=["error","close","destroy","pause","resume"];function C(y,w,z){if(typeof y.prependListener=="function")return y.prependListener(w,z);!y._events||!y._events[w]?y.on(w,z):Array.isArray(y._events[w])?y._events[w].unshift(z):y._events[w]=[z,y._events[w]]}function M(y,w,z){r=r||ht(),y=y||{},typeof z!="boolean"&&(z=w instanceof r),this.objectMode=!!y.objectMode,z&&(this.objectMode=this.objectMode||!!y.readableObjectMode),this.highWaterMark=B(this,y,"readableHighWaterMark",z),this.buffer=new v,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=y.emitClose!==!1,this.autoDestroy=!!y.autoDestroy,this.destroyed=!1,this.defaultEncoding=y.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,y.encoding&&(R||(R=So().StringDecoder),this.decoder=new R(y.encoding),this.encoding=y.encoding)}function W(y){if(r=r||ht(),!(this instanceof W))return new W(y);var w=this instanceof r;this._readableState=new M(y,this,w),this.readable=!0,y&&(typeof y.read=="function"&&(this._read=y.read),typeof y.destroy=="function"&&(this._destroy=y.destroy)),t.call(this)}Object.defineProperty(W.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(w){this._readableState&&(this._readableState.destroyed=w)}}),W.prototype.destroy=h.destroy,W.prototype._undestroy=h.undestroy,W.prototype._destroy=function(y,w){w(y)},W.prototype.push=function(y,w){var z=this._readableState,ee;return z.objectMode?ee=!0:typeof y=="string"&&(w=w||z.defaultEncoding,w!==z.encoding&&(y=s.from(y,w),w=""),ee=!0),X(this,y,w,!1,ee)},W.prototype.unshift=function(y){return X(this,y,null,!0,!1)};function X(y,w,z,ee,le){c("readableAddChunk",w);var ie=y._readableState;if(w===null)ie.reading=!1,Pe(y,ie);else{var se;if(le||(se=U(ie,w)),se)k(y,se);else if(ie.objectMode||w&&w.length>0)if(typeof w!="string"&&!ie.objectMode&&Object.getPrototypeOf(w)!==s.prototype&&(w=l(w)),ee)ie.endEmitted?k(y,new m):re(y,ie,w,!0);else if(ie.ended)k(y,new N);else{if(ie.destroyed)return!1;ie.reading=!1,ie.decoder&&!z?(w=ie.decoder.write(w),ie.objectMode||w.length!==0?re(y,ie,w,!1):_e(y,ie)):re(y,ie,w,!1)}else ee||(ie.reading=!1,_e(y,ie))}return!ie.ended&&(ie.length<ie.highWaterMark||ie.length===0)}function re(y,w,z,ee){w.flowing&&w.length===0&&!w.sync?(w.awaitDrain=0,y.emit("data",z)):(w.length+=w.objectMode?1:z.length,ee?w.buffer.unshift(z):w.buffer.push(z),w.needReadable&&ke(y)),_e(y,w)}function U(y,w){var z;return!g(w)&&typeof w!="string"&&w!==void 0&&!y.objectMode&&(z=new b("chunk",["string","Buffer","Uint8Array"],w)),z}W.prototype.isPaused=function(){return this._readableState.flowing===!1},W.prototype.setEncoding=function(y){R||(R=So().StringDecoder);var w=new R(y);this._readableState.decoder=w,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,ee="";z!==null;)ee+=w.write(z.data),z=z.next;return this._readableState.buffer.clear(),ee!==""&&this._readableState.buffer.push(ee),this._readableState.length=ee.length,this};var he=1073741824;function de(y){return y>=he?y=he:(y--,y|=y>>>1,y|=y>>>2,y|=y>>>4,y|=y>>>8,y|=y>>>16,y++),y}function me(y,w){return y<=0||w.length===0&&w.ended?0:w.objectMode?1:y!==y?w.flowing&&w.length?w.buffer.head.data.length:w.length:(y>w.highWaterMark&&(w.highWaterMark=de(y)),y<=w.length?y:w.ended?w.length:(w.needReadable=!0,0))}W.prototype.read=function(y){c("read",y),y=parseInt(y,10);var w=this._readableState,z=y;if(y!==0&&(w.emittedReadable=!1),y===0&&w.needReadable&&((w.highWaterMark!==0?w.length>=w.highWaterMark:w.length>0)||w.ended))return c("read: emitReadable",w.length,w.ended),w.length===0&&w.ended?G(this):ke(this),null;if(y=me(y,w),y===0&&w.ended)return w.length===0&&G(this),null;var ee=w.needReadable;c("need readable",ee),(w.length===0||w.length-y<w.highWaterMark)&&(ee=!0,c("length less than watermark",ee)),w.ended||w.reading?(ee=!1,c("reading or ended",ee)):ee&&(c("do read"),w.reading=!0,w.sync=!0,w.length===0&&(w.needReadable=!0),this._read(w.highWaterMark),w.sync=!1,w.reading||(y=me(z,w)));var le;return y>0?le=F(y,w):le=null,le===null?(w.needReadable=w.length<=w.highWaterMark,y=0):(w.length-=y,w.awaitDrain=0),w.length===0&&(w.ended||(w.needReadable=!0),z!==y&&w.ended&&G(this)),le!==null&&this.emit("data",le),le};function Pe(y,w){if(c("onEofChunk"),!w.ended){if(w.decoder){var z=w.decoder.end();z&&z.length&&(w.buffer.push(z),w.length+=w.objectMode?1:z.length)}w.ended=!0,w.sync?ke(y):(w.needReadable=!1,w.emittedReadable||(w.emittedReadable=!0,Ee(y)))}}function ke(y){var w=y._readableState;c("emitReadable",w.needReadable,w.emittedReadable),w.needReadable=!1,w.emittedReadable||(c("emitReadable",w.flowing),w.emittedReadable=!0,ae.nextTick(Ee,y))}function Ee(y){var w=y._readableState;c("emitReadable_",w.destroyed,w.length,w.ended),!w.destroyed&&(w.length||w.ended)&&(y.emit("readable"),w.emittedReadable=!1),w.needReadable=!w.flowing&&!w.ended&&w.length<=w.highWaterMark,D(y)}function _e(y,w){w.readingMore||(w.readingMore=!0,ae.nextTick(Oe,y,w))}function Oe(y,w){for(;!w.reading&&!w.ended&&(w.length<w.highWaterMark||w.flowing&&w.length===0);){var z=w.length;if(c("maybeReadMore read 0"),y.read(0),z===w.length)break}w.readingMore=!1}W.prototype._read=function(y){k(this,new T("_read()"))},W.prototype.pipe=function(y,w){var z=this,ee=this._readableState;switch(ee.pipesCount){case 0:ee.pipes=y;break;case 1:ee.pipes=[ee.pipes,y];break;default:ee.pipes.push(y);break}ee.pipesCount+=1,c("pipe count=%d opts=%j",ee.pipesCount,w);var le=(!w||w.end!==!1)&&y!==ae.stdout&&y!==ae.stderr,ie=le?De:We;ee.endEmitted?ae.nextTick(ie):z.once("end",ie),y.on("unpipe",se);function se(Ve,Me){c("onunpipe"),Ve===z&&Me&&Me.hasUnpiped===!1&&(Me.hasUnpiped=!0,Ue())}function De(){c("onend"),y.end()}var H=qe(z);y.on("drain",H);var Fe=!1;function Ue(){c("cleanup"),y.removeListener("close",$e),y.removeListener("finish",Ne),y.removeListener("drain",H),y.removeListener("error",we),y.removeListener("unpipe",se),z.removeListener("end",De),z.removeListener("end",We),z.removeListener("data",ye),Fe=!0,ee.awaitDrain&&(!y._writableState||y._writableState.needDrain)&&H()}z.on("data",ye);function ye(Ve){c("ondata");var Me=y.write(Ve);c("dest.write",Me),Me===!1&&((ee.pipesCount===1&&ee.pipes===y||ee.pipesCount>1&&Q(ee.pipes,y)!==-1)&&!Fe&&(c("false write response, pause",ee.awaitDrain),ee.awaitDrain++),z.pause())}function we(Ve){c("onerror",Ve),We(),y.removeListener("error",we),e(y,"error")===0&&k(y,Ve)}C(y,"error",we);function $e(){y.removeListener("finish",Ne),We()}y.once("close",$e);function Ne(){c("onfinish"),y.removeListener("close",$e),We()}y.once("finish",Ne);function We(){c("unpipe"),z.unpipe(y)}return y.emit("pipe",z),ee.flowing||(c("pipe resume"),z.resume()),y};function qe(y){return function(){var z=y._readableState;c("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&e(y,"data")&&(z.flowing=!0,D(y))}}W.prototype.unpipe=function(y){var w=this._readableState,z={hasUnpiped:!1};if(w.pipesCount===0)return this;if(w.pipesCount===1)return y&&y!==w.pipes?this:(y||(y=w.pipes),w.pipes=null,w.pipesCount=0,w.flowing=!1,y&&y.emit("unpipe",this,z),this);if(!y){var ee=w.pipes,le=w.pipesCount;w.pipes=null,w.pipesCount=0,w.flowing=!1;for(var ie=0;ie<le;ie++)ee[ie].emit("unpipe",this,{hasUnpiped:!1});return this}var se=Q(w.pipes,y);return se===-1?this:(w.pipes.splice(se,1),w.pipesCount-=1,w.pipesCount===1&&(w.pipes=w.pipes[0]),y.emit("unpipe",this,z),this)},W.prototype.on=function(y,w){var z=t.prototype.on.call(this,y,w),ee=this._readableState;return y==="data"?(ee.readableListening=this.listenerCount("readable")>0,ee.flowing!==!1&&this.resume()):y==="readable"&&!ee.endEmitted&&!ee.readableListening&&(ee.readableListening=ee.needReadable=!0,ee.flowing=!1,ee.emittedReadable=!1,c("on readable",ee.length,ee.reading),ee.length?ke(this):ee.reading||ae.nextTick(V,this)),z},W.prototype.addListener=W.prototype.on,W.prototype.removeListener=function(y,w){var z=t.prototype.removeListener.call(this,y,w);return y==="readable"&&ae.nextTick($,this),z},W.prototype.removeAllListeners=function(y){var w=t.prototype.removeAllListeners.apply(this,arguments);return(y==="readable"||y===void 0)&&ae.nextTick($,this),w};function $(y){var w=y._readableState;w.readableListening=y.listenerCount("readable")>0,w.resumeScheduled&&!w.paused?w.flowing=!0:y.listenerCount("data")>0&&y.resume()}function V(y){c("readable nexttick read 0"),y.read(0)}W.prototype.resume=function(){var y=this._readableState;return y.flowing||(c("resume"),y.flowing=!y.readableListening,J(this,y)),y.paused=!1,this};function J(y,w){w.resumeScheduled||(w.resumeScheduled=!0,ae.nextTick(ne,y,w))}function ne(y,w){c("resume",w.reading),w.reading||y.read(0),w.resumeScheduled=!1,y.emit("resume"),D(y),w.flowing&&!w.reading&&y.read(0)}W.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function D(y){var w=y._readableState;for(c("flow",w.flowing);w.flowing&&y.read()!==null;);}W.prototype.wrap=function(y){var w=this,z=this._readableState,ee=!1;y.on("end",function(){if(c("wrapped end"),z.decoder&&!z.ended){var se=z.decoder.end();se&&se.length&&w.push(se)}w.push(null)}),y.on("data",function(se){if(c("wrapped data"),z.decoder&&(se=z.decoder.write(se)),!(z.objectMode&&se==null)&&!(!z.objectMode&&(!se||!se.length))){var De=w.push(se);De||(ee=!0,y.pause())}});for(var le in y)this[le]===void 0&&typeof y[le]=="function"&&(this[le]=function(De){return function(){return y[De].apply(y,arguments)}}(le));for(var ie=0;ie<S.length;ie++)y.on(S[ie],this.emit.bind(this,S[ie]));return this._read=function(se){c("wrapped _read",se),ee&&(ee=!1,y.resume())},this},typeof Symbol=="function"&&(W.prototype[Symbol.asyncIterator]=function(){return A===void 0&&(A=rs()),A(this)}),Object.defineProperty(W.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(W.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(W.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(w){this._readableState&&(this._readableState.flowing=w)}}),W._fromList=F,Object.defineProperty(W.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function F(y,w){if(w.length===0)return null;var z;return w.objectMode?z=w.buffer.shift():!y||y>=w.length?(w.decoder?z=w.buffer.join(""):w.buffer.length===1?z=w.buffer.first():z=w.buffer.concat(w.length),w.buffer.clear()):z=w.buffer.consume(y,w.decoder),z}function G(y){var w=y._readableState;c("endReadable",w.endEmitted),w.endEmitted||(w.ended=!0,ae.nextTick(Z,w,y))}function Z(y,w){if(c("endReadableNT",y.endEmitted,y.length),!y.endEmitted&&y.length===0&&(y.endEmitted=!0,w.readable=!1,w.emit("end"),y.autoDestroy)){var z=w._writableState;(!z||z.autoDestroy&&z.finished)&&w.destroy()}}typeof Symbol=="function"&&(W.from=function(y,w){return P===void 0&&(P=ns()),P(W,y,w)});function Q(y,w){for(var z=0,ee=y.length;z<ee;z++)if(y[z]===w)return z;return-1}return hn}var dn,To;function Ao(){if(To)return dn;To=1,dn=f;var r=ft().codes,e=r.ERR_METHOD_NOT_IMPLEMENTED,t=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,u=r.ERR_TRANSFORM_WITH_LENGTH_0,l=ht();ut()(f,l);function g(h,I){var B=this._transformState;B.transforming=!1;var x=B.writecb;if(x===null)return this.emit("error",new t);B.writechunk=null,B.writecb=null,I!=null&&this.push(I),x(h);var b=this._readableState;b.reading=!1,(b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}function f(h){if(!(this instanceof f))return new f(h);l.call(this,h),this._transformState={afterTransform:g.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,h&&(typeof h.transform=="function"&&(this._transform=h.transform),typeof h.flush=="function"&&(this._flush=h.flush)),this.on("prefinish",c)}function c(){var h=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(I,B){v(h,I,B)}):v(this,null,null)}f.prototype.push=function(h,I){return this._transformState.needTransform=!1,l.prototype.push.call(this,h,I)},f.prototype._transform=function(h,I,B){B(new e("_transform()"))},f.prototype._write=function(h,I,B){var x=this._transformState;if(x.writecb=B,x.writechunk=h,x.writeencoding=I,!x.transforming){var b=this._readableState;(x.needTransform||b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}},f.prototype._read=function(h){var I=this._transformState;I.writechunk!==null&&!I.transforming?(I.transforming=!0,this._transform(I.writechunk,I.writeencoding,I.afterTransform)):I.needTransform=!0},f.prototype._destroy=function(h,I){l.prototype._destroy.call(this,h,function(B){I(B)})};function v(h,I,B){if(I)return h.emit("error",I);if(B!=null&&h.push(B),h._writableState.length)throw new u;if(h._transformState.transforming)throw new s;return h.push(null)}return dn}var pn,Io;function is(){if(Io)return pn;Io=1,pn=e;var r=Ao();ut()(e,r);function e(t){if(!(this instanceof e))return new e(t);r.call(this,t)}return e.prototype._transform=function(t,s,u){u(null,t)},pn}var gn,Bo;function os(){if(Bo)return gn;Bo=1;var r;function e(B){var x=!1;return function(){x||(x=!0,B.apply(void 0,arguments))}}var t=ft().codes,s=t.ERR_MISSING_ARGS,u=t.ERR_STREAM_DESTROYED;function l(B){if(B)throw B}function g(B){return B.setHeader&&typeof B.abort=="function"}function f(B,x,b,N){N=e(N);var T=!1;B.on("close",function(){T=!0}),r===void 0&&(r=cn()),r(B,{readable:x,writable:b},function(R){if(R)return N(R);T=!0,N()});var m=!1;return function(R){if(!T&&!m){if(m=!0,g(B))return B.abort();if(typeof B.destroy=="function")return B.destroy();N(R||new u("pipe"))}}}function c(B){B()}function v(B,x){return B.pipe(x)}function h(B){return!B.length||typeof B[B.length-1]!="function"?l:B.pop()}function I(){for(var B=arguments.length,x=new Array(B),b=0;b<B;b++)x[b]=arguments[b];var N=h(x);if(Array.isArray(x[0])&&(x=x[0]),x.length<2)throw new s("streams");var T,m=x.map(function(R,A){var P=A<x.length-1,k=A>0;return f(R,P,k,function(S){T||(T=S),S&&m.forEach(c),!P&&(m.forEach(c),N(T))})});return x.reduce(v)}return gn=I,gn}var ko;function as(){return ko||(ko=1,function(r,e){e=r.exports=Po(),e.Stream=e,e.Readable=e,e.Writable=vo(),e.Duplex=ht(),e.Transform=Ao(),e.PassThrough=is(),e.finished=cn(),e.pipeline=os()}(At,At.exports)),At.exports}/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var yn,Oo;function ss(){if(Oo)return yn;Oo=1;let r;return yn=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window!="undefined"?window:globalThis):e=>(r||(r=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0)),yn}var mn,Mo;function ls(){if(Mo)return mn;Mo=1;function r(t,s){for(const u in s)Object.defineProperty(t,u,{value:s[u],enumerable:!0,configurable:!0});return t}function e(t,s,u){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");u||(u={}),typeof s=="object"&&(u=s,s=""),s&&(u.code=s);try{return r(t,u)}catch(l){u.message=t.message,u.stack=t.stack;const g=function(){};return g.prototype=Object.create(Object.getPrototypeOf(t)),r(new g,u)}}return mn=e,mn}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var vn,Lo;function cs(){if(Lo)return vn;Lo=1;const r=ma()("simple-peer"),e=va(),t=wa(),s=as(),u=ss(),l=ls(),{Buffer:g}=yt(),f=64*1024,c=5*1e3,v=5*1e3;function h(x){return x.replace(/a=ice-options:trickle\s\n/g,"")}function I(x){console.warn(x)}class B extends s.Duplex{constructor(b){if(b=Object.assign({allowHalfOpen:!1},b),super(b),this._id=t(4).toString("hex").slice(0,7),this._debug("new peer %o",b),this.channelName=b.initiator?b.channelName||t(20).toString("hex"):null,this.initiator=b.initiator||!1,this.channelConfig=b.channelConfig||B.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},B.config,b.config),this.offerOptions=b.offerOptions||{},this.answerOptions=b.answerOptions||{},this.sdpTransform=b.sdpTransform||(N=>N),this.streams=b.streams||(b.stream?[b.stream]:[]),this.trickle=b.trickle!==void 0?b.trickle:!0,this.allowHalfTrickle=b.allowHalfTrickle!==void 0?b.allowHalfTrickle:!1,this.iceCompleteTimeout=b.iceCompleteTimeout||c,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=b.wrtc&&typeof b.wrtc=="object"?b.wrtc:e(),!this._wrtc)throw l(typeof window=="undefined"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(N){this.destroy(l(N,"ERR_PC_CONSTRUCTOR"));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=N=>{this._onIceCandidate(N)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(N=>{this.destroy(l(N,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=N=>{this._setupData(N)},this.streams&&this.streams.forEach(N=>{this.addStream(N)}),this._pc.ontrack=N=>{this._onTrack(N)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof b=="string")try{b=JSON.parse(b)}catch(N){b={}}this._debug("signal()"),b.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),b.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(b.transceiverRequest.kind,b.transceiverRequest.init)),b.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(b.candidate):this._pendingCandidates.push(b.candidate)),b.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(b)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(N=>{this._addIceCandidate(N)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(N=>{this.destroy(l(N,"ERR_SET_REMOTE_DESCRIPTION"))}),!b.sdp&&!b.candidate&&!b.renegotiate&&!b.transceiverRequest&&this.destroy(l(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(b){const N=new this._wrtc.RTCIceCandidate(b);this._pc.addIceCandidate(N).catch(T=>{!N.address||N.address.endsWith(".local")?I("Ignoring unsupported ICE candidate."):this.destroy(l(T,"ERR_ADD_ICE_CANDIDATE"))})}send(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(b)}}addTransceiver(b,N){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(b,N),this._needsNegotiation()}catch(T){this.destroy(l(T,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:b,init:N}})}}addStream(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),b.getTracks().forEach(N=>{this.addTrack(N,b)})}}addTrack(b,N){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const T=this._senderMap.get(b)||new Map;let m=T.get(N);if(!m)m=this._pc.addTrack(b,N),T.set(N,m),this._senderMap.set(b,T),this._needsNegotiation();else throw m.removed?l(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):l(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(b,N,T){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const m=this._senderMap.get(b),R=m?m.get(T):null;if(!R)throw l(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");N&&this._senderMap.set(N,m),R.replaceTrack!=null?R.replaceTrack(N):this.destroy(l(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(b,N){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const T=this._senderMap.get(b),m=T?T.get(N):null;if(!m)throw l(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{m.removed=!0,this._pc.removeTrack(m)}catch(R){R.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(m):this.destroy(l(R,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),b.getTracks().forEach(N=>{this.removeTrack(N,b)})}}_needsNegotiation(){this._debug("_needsNegotiation"),!this._batchedNegotiation&&(this._batchedNegotiation=!0,u(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(b){this._destroy(b,()=>{})}_destroy(b,N){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",b&&(b.message||b)),u(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",b&&(b.message||b)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(T){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(T){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,b&&this.emit("error",b),this.emit("close"),N()}))}_setupData(b){if(!b.channel)return this.destroy(l(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=b.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=f),this.channelName=this._channel.label,this._channel.onmessage=T=>{this._onChannelMessage(T)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=T=>{const m=T.error instanceof Error?T.error:new Error(`Datachannel error: ${T.message} ${T.filename}:${T.lineno}:${T.colno}`);this.destroy(l(m,"ERR_DATA_CHANNEL"))};let N=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(N&&this._onChannelClose(),N=!0):N=!1},v)}_read(){}_write(b,N,T){if(this.destroyed)return T(l(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(b)}catch(m){return this.destroy(l(m,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>f?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=T):T(null)}else this._debug("write before connect"),this._chunk=b,this._cb=T}_onFinish(){if(this.destroyed)return;const b=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?b():this.once("connect",b)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(b=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(b.sdp=h(b.sdp)),b.sdp=this.sdpTransform(b.sdp);const N=()=>{if(this.destroyed)return;const R=this._pc.localDescription||b;this._debug("signal"),this.emit("signal",{type:R.type,sdp:R.sdp})},T=()=>{this._debug("createOffer success"),!this.destroyed&&(this.trickle||this._iceComplete?N():this.once("_iceComplete",N))},m=R=>{this.destroy(l(R,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(b).then(T).catch(m)}).catch(b=>{this.destroy(l(b,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(b=>{!b.mid&&b.sender.track&&!b.requested&&(b.requested=!0,this.addTransceiver(b.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(b=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(b.sdp=h(b.sdp)),b.sdp=this.sdpTransform(b.sdp);const N=()=>{if(this.destroyed)return;const R=this._pc.localDescription||b;this._debug("signal"),this.emit("signal",{type:R.type,sdp:R.sdp}),this.initiator||this._requestMissingTransceivers()},T=()=>{this.destroyed||(this.trickle||this._iceComplete?N():this.once("_iceComplete",N))},m=R=>{this.destroy(l(R,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(b).then(T).catch(m)}).catch(b=>{this.destroy(l(b,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(l(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const b=this._pc.iceConnectionState,N=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",b,N),this.emit("iceStateChange",b,N),(b==="connected"||b==="completed")&&(this._pcReady=!0,this._maybeReady()),b==="failed"&&this.destroy(l(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),b==="closed"&&this.destroy(l(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(b){const N=T=>(Object.prototype.toString.call(T.values)==="[object Array]"&&T.values.forEach(m=>{Object.assign(T,m)}),T);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(T=>{const m=[];T.forEach(R=>{m.push(N(R))}),b(null,m)},T=>b(T)):this._pc.getStats.length>0?this._pc.getStats(T=>{if(this.destroyed)return;const m=[];T.result().forEach(R=>{const A={};R.names().forEach(P=>{A[P]=R.stat(P)}),A.id=R.id,A.type=R.type,A.timestamp=R.timestamp,m.push(N(A))}),b(null,m)},T=>b(T)):b(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const b=()=>{this.destroyed||this.getStats((N,T)=>{if(this.destroyed)return;N&&(T=[]);const m={},R={},A={};let P=!1;T.forEach(S=>{(S.type==="remotecandidate"||S.type==="remote-candidate")&&(m[S.id]=S),(S.type==="localcandidate"||S.type==="local-candidate")&&(R[S.id]=S),(S.type==="candidatepair"||S.type==="candidate-pair")&&(A[S.id]=S)});const k=S=>{P=!0;let C=R[S.localCandidateId];C&&(C.ip||C.address)?(this.localAddress=C.ip||C.address,this.localPort=Number(C.port)):C&&C.ipAddress?(this.localAddress=C.ipAddress,this.localPort=Number(C.portNumber)):typeof S.googLocalAddress=="string"&&(C=S.googLocalAddress.split(":"),this.localAddress=C[0],this.localPort=Number(C[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let M=m[S.remoteCandidateId];M&&(M.ip||M.address)?(this.remoteAddress=M.ip||M.address,this.remotePort=Number(M.port)):M&&M.ipAddress?(this.remoteAddress=M.ipAddress,this.remotePort=Number(M.portNumber)):typeof S.googRemoteAddress=="string"&&(M=S.googRemoteAddress.split(":"),this.remoteAddress=M[0],this.remotePort=Number(M[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(T.forEach(S=>{S.type==="transport"&&S.selectedCandidatePairId&&k(A[S.selectedCandidatePairId]),(S.type==="googCandidatePair"&&S.googActiveConnection==="true"||(S.type==="candidatepair"||S.type==="candidate-pair")&&S.selected)&&k(S)}),!P&&(!Object.keys(A).length||Object.keys(R).length)){setTimeout(b,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(C){return this.destroy(l(C,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const S=this._cb;this._cb=null,S(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};b()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>f||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(b=>{this._pc.removeTrack(b),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(b){this.destroyed||(b.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:b.candidate.candidate,sdpMLineIndex:b.candidate.sdpMLineIndex,sdpMid:b.candidate.sdpMid}}):!b.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),b.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(b){if(this.destroyed)return;let N=b.data;N instanceof ArrayBuffer&&(N=g.from(N)),this.push(N)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const b=this._cb;this._cb=null,b(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(b){this.destroyed||b.streams.forEach(N=>{this._debug("on track"),this.emit("track",b.track,N),this._remoteTracks.push({track:b.track,stream:N}),!this._remoteStreams.some(T=>T.id===N.id)&&(this._remoteStreams.push(N),u(()=>{this._debug("on stream"),this.emit("stream",N)}))})}_debug(){const b=[].slice.call(arguments);b[0]="["+this._id+"] "+b[0],r.apply(null,b)}}return B.WEBRTC_SUPPORT=!!e(),B.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},B.channelConfig={},vn=B,vn}var us=cs();const fs=xt(us);var hs=Object.defineProperty,ds=(r,e,t)=>e in r?hs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ot=(r,e,t)=>ds(r,typeof e!="symbol"?e+"":e,t),wn=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});class No{constructor(e,t,s={}){ot(this,"peer",null),ot(this,"config"),ot(this,"events"),ot(this,"connectionState","new"),ot(this,"isInitiator"),ot(this,"remoteUserId"),ot(this,"localStream",null),this.remoteUserId=e,this.config=t,this.events=s,this.isInitiator=t.initiator||!1}createConnection(e){return wn(this,null,function*(){try{console.log(`[CallPeerConnection] Creating connection to ${this.remoteUserId}, initiator: ${this.isInitiator}`),this.localStream=e||null;const t={initiator:this.isInitiator,trickle:!0,stream:this.localStream||void 0,config:{iceServers:this.config.iceServers}};this.peer=new fs(t),this.setupPeerEventListeners(),console.log(`[CallPeerConnection] Peer connection created for ${this.remoteUserId}`)}catch(t){throw console.error(`[CallPeerConnection] Failed to create connection to ${this.remoteUserId}:`,t),t}})}signal(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot signal to ${this.remoteUserId}: peer not initialized`);return}try{console.log(`[CallPeerConnection] Signaling to ${this.remoteUserId}:`,e.type),this.peer.signal(e)}catch(u){console.error(`[CallPeerConnection] Failed to signal to ${this.remoteUserId}:`,u),(s=(t=this.events).onError)==null||s.call(t,u)}}addStream(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot add stream to ${this.remoteUserId}: peer not initialized`);return}try{this.localStream&&this.removeStream(this.localStream),this.localStream=e,this.peer.addStream(e),console.log(`[CallPeerConnection] Stream added to ${this.remoteUserId}`)}catch(u){console.error(`[CallPeerConnection] Failed to add stream to ${this.remoteUserId}:`,u),(s=(t=this.events).onError)==null||s.call(t,u)}}removeStream(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot remove stream from ${this.remoteUserId}: peer not initialized`);return}try{this.peer.removeStream(e),this.localStream===e&&(this.localStream=null),console.log(`[CallPeerConnection] Stream removed from ${this.remoteUserId}`)}catch(u){console.error(`[CallPeerConnection] Failed to remove stream from ${this.remoteUserId}:`,u),(s=(t=this.events).onError)==null||s.call(t,u)}}replaceTrack(e,t){var s,u;if(!this.peer){console.error(`[CallPeerConnection] Cannot replace track for ${this.remoteUserId}: peer not initialized`);return}if(!this.localStream){console.error(`[CallPeerConnection] Cannot replace track for ${this.remoteUserId}: no local stream`);return}if(e.kind!==t.kind){console.error(`[CallPeerConnection] Cannot replace track for ${this.remoteUserId}: track kinds don't match (${e.kind} vs ${t.kind})`);return}const g=this.localStream.getTracks().some(f=>f.id===e.id);g||console.warn(`[CallPeerConnection] Old track not found in local stream for ${this.remoteUserId}, attempting replacement anyway`);try{this.peer.replaceTrack(e,t,this.localStream),g&&this.localStream.removeTrack(e),this.localStream.addTrack(t),console.log(`[CallPeerConnection] ${t.kind} track replaced for ${this.remoteUserId} (${e.id} -> ${t.id})`)}catch(f){throw console.error(`[CallPeerConnection] Failed to replace track for ${this.remoteUserId}:`,f),(u=(s=this.events).onError)==null||u.call(s,f),f}}getVideoTrack(){if(!this.localStream)return null;const e=this.localStream.getVideoTracks();return e.length>0?e[0]:null}getAudioTrack(){if(!this.localStream)return null;const e=this.localStream.getAudioTracks();return e.length>0?e[0]:null}sendData(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot send data to ${this.remoteUserId}: peer not initialized`);return}if(!this.peer.connected){console.warn(`[CallPeerConnection] Cannot send data to ${this.remoteUserId}: not connected`);return}try{this.peer.send(JSON.stringify(e))}catch(u){console.error(`[CallPeerConnection] Failed to send data to ${this.remoteUserId}:`,u),(s=(t=this.events).onError)==null||s.call(t,u)}}setBandwidthLimit(e){return wn(this,null,function*(){if(!this.peer){console.warn(`[CallPeerConnection] Cannot set bandwidth for ${this.remoteUserId}: peer connection not available`);return}try{const t=this.peer._pc;if(!t)return;const s=t.getSenders();for(const u of s)if(u.track){const l=u.getParameters();l.encodings||(l.encodings=[{}]),l.encodings[0].maxBitrate=e*1e3,yield u.setParameters(l)}console.log(`[CallPeerConnection] Bandwidth limit set to ${e}kbps for ${this.remoteUserId}`)}catch(t){console.error(`[CallPeerConnection] Failed to set bandwidth limit for ${this.remoteUserId}:`,t)}})}getConnectionState(){return this.connectionState}isConnected(){var e;return((e=this.peer)==null?void 0:e.connected)===!0}getStats(){return wn(this,null,function*(){if(!this.peer)return null;try{const e=this.peer._pc;return e?yield e.getStats():null}catch(e){return console.error(`[CallPeerConnection] Failed to get stats for ${this.remoteUserId}:`,e),null}})}getRemoteUserId(){return this.remoteUserId}destroy(){if(console.log(`[CallPeerConnection] Destroying connection to ${this.remoteUserId}`),this.peer){try{this.peer.destroy()}catch(e){console.error(`[CallPeerConnection] Error destroying peer for ${this.remoteUserId}:`,e)}this.peer=null}this.localStream=null,this.connectionState="closed"}setupPeerEventListeners(){if(!this.peer)return;this.peer.on("signal",t=>{var s,u;console.log(`[CallPeerConnection] Signal from ${this.remoteUserId}:`,t.type),(u=(s=this.events).onSignal)==null||u.call(s,t)}),this.peer.on("connect",()=>{var t,s;console.log(`[CallPeerConnection] Connected to ${this.remoteUserId}`),this.connectionState="connected",(s=(t=this.events).onConnect)==null||s.call(t)}),this.peer.on("data",t=>{var s,u;try{const l=JSON.parse(t.toString());(u=(s=this.events).onData)==null||u.call(s,l)}catch(l){console.error(`[CallPeerConnection] Failed to parse data from ${this.remoteUserId}:`,l)}}),this.peer.on("stream",t=>{var s,u;console.log(`[CallPeerConnection] Stream received from ${this.remoteUserId}`),(u=(s=this.events).onStream)==null||u.call(s,t)}),this.peer.on("track",(t,s)=>{var u,l;console.log(`[CallPeerConnection] Track received from ${this.remoteUserId}:`,t.kind),(l=(u=this.events).onTrack)==null||l.call(u,t,s)}),this.peer.on("close",()=>{var t,s;console.log(`[CallPeerConnection] Connection closed with ${this.remoteUserId}`),this.connectionState="closed",(s=(t=this.events).onClose)==null||s.call(t)}),this.peer.on("error",t=>{var s,u;console.error(`[CallPeerConnection] Error with ${this.remoteUserId}:`,t),this.connectionState="failed",(u=(s=this.events).onError)==null||u.call(s,t)});const e=this.peer._pc;e&&e.addEventListener("connectionstatechange",()=>{if(this.peer){const t=this.peer._pc;t&&(this.connectionState=t.connectionState,console.log(`[CallPeerConnection] Connection state changed for ${this.remoteUserId}:`,this.connectionState))}})}getConnectionInfo(){return{remoteUserId:this.remoteUserId,isInitiator:this.isInitiator,connectionState:this.connectionState,connected:this.isConnected(),hasLocalStream:!!this.localStream,localStreamTracks:this.localStream?{video:this.localStream.getVideoTracks().length,audio:this.localStream.getAudioTracks().length}:null}}}const Do={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},bt=new Map,Mt=r=>{const e=bt.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,s])=>[t,s.getState()])):{}},ps=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const s=bt.get(t.name);if(s)return St({type:"tracked",store:r},s);const u={connection:e.connect(t),stores:{}};return bt.set(t.name,u),St({type:"tracked",store:r},u)},gs=(r,e)=>{if(e===void 0)return;const t=bt.get(r);t&&(delete t.stores[e],Object.keys(t.stores).length===0&&bt.delete(r))},ys=r=>{var e,t;if(!r)return;const s=r.split(`
22
- `),u=s.findIndex(g=>g.includes("api.setState"));if(u<0)return;const l=((e=s[u+1])==null?void 0:e.trim())||"";return(t=/.+ (.+) .+/.exec(l))==null?void 0:t[1]},ms=(r,e={})=>(t,s,u)=>{const N=e,{enabled:l,anonymousActionType:g,store:f}=N,c=On(N,["enabled","anonymousActionType","store"]);let v;try{v=(l!=null?l:(Do?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(m){}if(!v)return r(t,s,u);const T=ps(f,v,c),{connection:h}=T,I=On(T,["connection"]);let B=!0;u.setState=(m,R,A)=>{const P=t(m,R);if(!B)return P;const k=A===void 0?{type:g||ys(new Error().stack)||"anonymous"}:typeof A=="string"?{type:A}:A;return f===void 0?(h==null||h.send(k,s()),P):(h==null||h.send(kn(St({},k),{type:`${f}/${k.type}`}),kn(St({},Mt(c.name)),{[f]:u.getState()})),P)},u.devtools={cleanup:()=>{h&&typeof h.unsubscribe=="function"&&h.unsubscribe(),gs(c.name,f)}};const x=(...m)=>{const R=B;B=!1,t(...m),B=R},b=r(u.setState,s,u);if(I.type==="untracked"?h==null||h.init(b):(I.stores[I.store]=u,h==null||h.init(Object.fromEntries(Object.entries(I.stores).map(([m,R])=>[m,m===I.store?b:R.getState()])))),u.dispatchFromDevtools&&typeof u.dispatch=="function"){let m=!1;const R=u.dispatch;u.dispatch=(...A)=>{(Do?"production":void 0)!=="production"&&A[0].type==="__setState"&&!m&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),m=!0),R(...A)}}return h.subscribe(m=>{var R;switch(m.type){case"ACTION":if(typeof m.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return bn(m.payload,A=>{if(A.type==="__setState"){if(f===void 0){x(A.state);return}Object.keys(A.state).length!==1&&console.error(`
21
+ `)+" "+J[1]:J[0]+V+" "+$.join(", ")+" "+J[1]}r.types=Za();function T($){return Array.isArray($)}r.isArray=T;function m($){return typeof $=="boolean"}r.isBoolean=m;function R($){return $===null}r.isNull=R;function A($){return $==null}r.isNullOrUndefined=A;function P($){return typeof $=="number"}r.isNumber=P;function k($){return typeof $=="string"}r.isString=k;function S($){return typeof $=="symbol"}r.isSymbol=S;function C($){return $===void 0}r.isUndefined=C;function M($){return W($)&&de($)==="[object RegExp]"}r.isRegExp=M,r.types.isRegExp=M;function W($){return typeof $=="object"&&$!==null}r.isObject=W;function X($){return W($)&&de($)==="[object Date]"}r.isDate=X,r.types.isDate=X;function re($){return W($)&&(de($)==="[object Error]"||$ instanceof Error)}r.isError=re,r.types.isNativeError=re;function U($){return typeof $=="function"}r.isFunction=U;function he($){return $===null||typeof $=="boolean"||typeof $=="number"||typeof $=="string"||typeof $=="symbol"||typeof $=="undefined"}r.isPrimitive=he,r.isBuffer=Qa();function de($){return Object.prototype.toString.call($)}function me($){return $<10?"0"+$.toString(10):$.toString(10)}var Pe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ke(){var $=new Date,V=[me($.getHours()),me($.getMinutes()),me($.getSeconds())].join(":");return[$.getDate(),Pe[$.getMonth()],V].join(" ")}r.log=function(){console.log("%s - %s",ke(),r.format.apply(r,arguments))},r.inherits=ut(),r._extend=function($,V){if(!V||!W(V))return $;for(var J=Object.keys(V),ne=J.length;ne--;)$[J[ne]]=V[J[ne]];return $};function Ee($,V){return Object.prototype.hasOwnProperty.call($,V)}var _e=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;r.promisify=function(V){if(typeof V!="function")throw new TypeError('The "original" argument must be of type Function');if(_e&&V[_e]){var J=V[_e];if(typeof J!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(J,_e,{value:J,enumerable:!1,writable:!1,configurable:!0}),J}function J(){for(var ne,D,F=new Promise(function(Q,y){ne=Q,D=y}),G=[],Z=0;Z<arguments.length;Z++)G.push(arguments[Z]);G.push(function(Q,y){Q?D(Q):ne(y)});try{V.apply(this,G)}catch(Q){D(Q)}return F}return Object.setPrototypeOf(J,Object.getPrototypeOf(V)),_e&&Object.defineProperty(J,_e,{value:J,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(J,e(V))},r.promisify.custom=_e;function Oe($,V){if(!$){var J=new Error("Promise was rejected with a falsy value");J.reason=$,$=J}return V($)}function qe($){if(typeof $!="function")throw new TypeError('The "original" argument must be of type Function');function V(){for(var J=[],ne=0;ne<arguments.length;ne++)J.push(arguments[ne]);var D=J.pop();if(typeof D!="function")throw new TypeError("The last argument must be of type Function");var F=this,G=function(){return D.apply(F,arguments)};$.apply(this,J).then(function(Z){ae.nextTick(G.bind(null,null,Z))},function(Z){ae.nextTick(Oe.bind(null,Z,G))})}return Object.setPrototypeOf(V,Object.getPrototypeOf($)),Object.defineProperties(V,e($)),V}r.callbackify=qe}(Yt)),Yt}var Qr,co;function es(){if(co)return Qr;co=1;function r(b,N){var T=Object.keys(b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(b);N&&(m=m.filter(function(R){return Object.getOwnPropertyDescriptor(b,R).enumerable})),T.push.apply(T,m)}return T}function e(b){for(var N=1;N<arguments.length;N++){var T=arguments[N]!=null?arguments[N]:{};N%2?r(Object(T),!0).forEach(function(m){t(b,m,T[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(T)):r(Object(T)).forEach(function(m){Object.defineProperty(b,m,Object.getOwnPropertyDescriptor(T,m))})}return b}function t(b,N,T){return N=g(N),N in b?Object.defineProperty(b,N,{value:T,enumerable:!0,configurable:!0,writable:!0}):b[N]=T,b}function s(b,N){if(!(b instanceof N))throw new TypeError("Cannot call a class as a function")}function f(b,N){for(var T=0;T<N.length;T++){var m=N[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(b,g(m.key),m)}}function l(b,N,T){return N&&f(b.prototype,N),Object.defineProperty(b,"prototype",{writable:!1}),b}function g(b){var N=u(b,"string");return typeof N=="symbol"?N:String(N)}function u(b,N){if(typeof b!="object"||b===null)return b;var T=b[Symbol.toPrimitive];if(T!==void 0){var m=T.call(b,N);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(b)}var c=yt(),v=c.Buffer,h=lo(),I=h.inspect,B=I&&I.custom||"inspect";function x(b,N,T){v.prototype.copy.call(b,N,T)}return Qr=function(){function b(){s(this,b),this.head=null,this.tail=null,this.length=0}return l(b,[{key:"push",value:function(T){var m={data:T,next:null};this.length>0?this.tail.next=m:this.head=m,this.tail=m,++this.length}},{key:"unshift",value:function(T){var m={data:T,next:this.head};this.length===0&&(this.tail=m),this.head=m,++this.length}},{key:"shift",value:function(){if(this.length!==0){var T=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,T}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(T){if(this.length===0)return"";for(var m=this.head,R=""+m.data;m=m.next;)R+=T+m.data;return R}},{key:"concat",value:function(T){if(this.length===0)return v.alloc(0);for(var m=v.allocUnsafe(T>>>0),R=this.head,A=0;R;)x(R.data,m,A),A+=R.data.length,R=R.next;return m}},{key:"consume",value:function(T,m){var R;return T<this.head.data.length?(R=this.head.data.slice(0,T),this.head.data=this.head.data.slice(T)):T===this.head.data.length?R=this.shift():R=m?this._getString(T):this._getBuffer(T),R}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(T){var m=this.head,R=1,A=m.data;for(T-=A.length;m=m.next;){var P=m.data,k=T>P.length?P.length:T;if(k===P.length?A+=P:A+=P.slice(0,T),T-=k,T===0){k===P.length?(++R,m.next?this.head=m.next:this.head=this.tail=null):(this.head=m,m.data=P.slice(k));break}++R}return this.length-=R,A}},{key:"_getBuffer",value:function(T){var m=v.allocUnsafe(T),R=this.head,A=1;for(R.data.copy(m),T-=R.data.length;R=R.next;){var P=R.data,k=T>P.length?P.length:T;if(P.copy(m,m.length-T,0,k),T-=k,T===0){k===P.length?(++A,R.next?this.head=R.next:this.head=this.tail=null):(this.head=R,R.data=P.slice(k));break}++A}return this.length-=A,m}},{key:B,value:function(T,m){return I(this,e(e({},m),{},{depth:0,customInspect:!1}))}}]),b}(),Qr}var en,uo;function fo(){if(uo)return en;uo=1;function r(g,u){var c=this,v=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return v||h?(u?u(g):g&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ae.nextTick(f,this,g)):ae.nextTick(f,this,g)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(g||null,function(I){!u&&I?c._writableState?c._writableState.errorEmitted?ae.nextTick(t,c):(c._writableState.errorEmitted=!0,ae.nextTick(e,c,I)):ae.nextTick(e,c,I):u?(ae.nextTick(t,c),u(I)):ae.nextTick(t,c)}),this)}function e(g,u){f(g,u),t(g)}function t(g){g._writableState&&!g._writableState.emitClose||g._readableState&&!g._readableState.emitClose||g.emit("close")}function s(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function f(g,u){g.emit("error",u)}function l(g,u){var c=g._readableState,v=g._writableState;c&&c.autoDestroy||v&&v.autoDestroy?g.destroy(u):g.emit("error",u)}return en={destroy:r,undestroy:s,errorOrDestroy:l},en}var tn={},ho;function ft(){if(ho)return tn;ho=1;function r(u,c){u.prototype=Object.create(c.prototype),u.prototype.constructor=u,u.__proto__=c}var e={};function t(u,c,v){v||(v=Error);function h(B,x,b){return typeof c=="string"?c:c(B,x,b)}var I=function(B){r(x,B);function x(b,N,T){return B.call(this,h(b,N,T))||this}return x}(v);I.prototype.name=v.name,I.prototype.code=u,e[u]=I}function s(u,c){if(Array.isArray(u)){var v=u.length;return u=u.map(function(h){return String(h)}),v>2?"one of ".concat(c," ").concat(u.slice(0,v-1).join(", "),", or ")+u[v-1]:v===2?"one of ".concat(c," ").concat(u[0]," or ").concat(u[1]):"of ".concat(c," ").concat(u[0])}else return"of ".concat(c," ").concat(String(u))}function f(u,c,v){return u.substr(0,c.length)===c}function l(u,c,v){return(v===void 0||v>u.length)&&(v=u.length),u.substring(v-c.length,v)===c}function g(u,c,v){return typeof v!="number"&&(v=0),v+c.length>u.length?!1:u.indexOf(c,v)!==-1}return t("ERR_INVALID_OPT_VALUE",function(u,c){return'The value "'+c+'" is invalid for option "'+u+'"'},TypeError),t("ERR_INVALID_ARG_TYPE",function(u,c,v){var h;typeof c=="string"&&f(c,"not ")?(h="must not be",c=c.replace(/^not /,"")):h="must be";var I;if(l(u," argument"))I="The ".concat(u," ").concat(h," ").concat(s(c,"type"));else{var B=g(u,".")?"property":"argument";I='The "'.concat(u,'" ').concat(B," ").concat(h," ").concat(s(c,"type"))}return I+=". Received type ".concat(typeof v),I},TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",function(u){return"The "+u+" method is not implemented"}),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",function(u){return"Cannot call "+u+" after a stream was destroyed"}),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",function(u){return"Unknown encoding: "+u},TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),tn.codes=e,tn}var rn,po;function go(){if(po)return rn;po=1;var r=ft().codes.ERR_INVALID_OPT_VALUE;function e(s,f,l){return s.highWaterMark!=null?s.highWaterMark:f?s[l]:null}function t(s,f,l,g){var u=e(f,g,l);if(u!=null){if(!(isFinite(u)&&Math.floor(u)===u)||u<0){var c=g?l:"highWaterMark";throw new r(c,u)}return Math.floor(u)}return s.objectMode?16:16*1024}return rn={getHighWaterMark:t},rn}var nn,yo;function ts(){if(yo)return nn;yo=1,nn=r;function r(t,s){if(e("noDeprecation"))return t;var f=!1;function l(){if(!f){if(e("throwDeprecation"))throw new Error(s);e("traceDeprecation")?console.trace(s):console.warn(s),f=!0}return t.apply(this,arguments)}return l}function e(t){try{if(!globalThis.localStorage)return!1}catch(f){return!1}var s=globalThis.localStorage[t];return s==null?!1:String(s).toLowerCase()==="true"}return nn}var on,mo;function vo(){if(mo)return on;mo=1,on=M;function r(D){var F=this;this.next=null,this.entry=null,this.finish=function(){ne(F,D)}}var e;M.WritableState=S;var t={deprecate:ts()},s=Xn(),f=yt().Buffer,l=(typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function g(D){return f.from(D)}function u(D){return f.isBuffer(D)||D instanceof l}var c=fo(),v=go(),h=v.getHighWaterMark,I=ft().codes,B=I.ERR_INVALID_ARG_TYPE,x=I.ERR_METHOD_NOT_IMPLEMENTED,b=I.ERR_MULTIPLE_CALLBACK,N=I.ERR_STREAM_CANNOT_PIPE,T=I.ERR_STREAM_DESTROYED,m=I.ERR_STREAM_NULL_VALUES,R=I.ERR_STREAM_WRITE_AFTER_END,A=I.ERR_UNKNOWN_ENCODING,P=c.errorOrDestroy;ut()(M,s);function k(){}function S(D,F,G){e=e||ht(),D=D||{},typeof G!="boolean"&&(G=F instanceof e),this.objectMode=!!D.objectMode,G&&(this.objectMode=this.objectMode||!!D.writableObjectMode),this.highWaterMark=h(this,D,"writableHighWaterMark",G),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Z=D.decodeStrings===!1;this.decodeStrings=!Z,this.defaultEncoding=D.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Q){Pe(F,Q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=D.emitClose!==!1,this.autoDestroy=!!D.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}S.prototype.getBuffer=function(){for(var F=this.bufferedRequest,G=[];F;)G.push(F),F=F.next;return G},function(){try{Object.defineProperty(S.prototype,"buffer",{get:t.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(D){}}();var C;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(C=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(F){return C.call(this,F)?!0:this!==M?!1:F&&F._writableState instanceof S}})):C=function(F){return F instanceof this};function M(D){e=e||ht();var F=this instanceof e;if(!F&&!C.call(M,this))return new M(D);this._writableState=new S(D,this,F),this.writable=!0,D&&(typeof D.write=="function"&&(this._write=D.write),typeof D.writev=="function"&&(this._writev=D.writev),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.final=="function"&&(this._final=D.final)),s.call(this)}M.prototype.pipe=function(){P(this,new N)};function W(D,F){var G=new R;P(D,G),ae.nextTick(F,G)}function X(D,F,G,Z){var Q;return G===null?Q=new m:typeof G!="string"&&!F.objectMode&&(Q=new B("chunk",["string","Buffer"],G)),Q?(P(D,Q),ae.nextTick(Z,Q),!1):!0}M.prototype.write=function(D,F,G){var Z=this._writableState,Q=!1,y=!Z.objectMode&&u(D);return y&&!f.isBuffer(D)&&(D=g(D)),typeof F=="function"&&(G=F,F=null),y?F="buffer":F||(F=Z.defaultEncoding),typeof G!="function"&&(G=k),Z.ending?W(this,G):(y||X(this,Z,D,G))&&(Z.pendingcb++,Q=U(this,Z,y,D,F,G)),Q},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var D=this._writableState;D.corked&&(D.corked--,!D.writing&&!D.corked&&!D.bufferProcessing&&D.bufferedRequest&&_e(this,D))},M.prototype.setDefaultEncoding=function(F){if(typeof F=="string"&&(F=F.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((F+"").toLowerCase())>-1))throw new A(F);return this._writableState.defaultEncoding=F,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function re(D,F,G){return!D.objectMode&&D.decodeStrings!==!1&&typeof F=="string"&&(F=f.from(F,G)),F}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function U(D,F,G,Z,Q,y){if(!G){var w=re(F,Z,Q);Z!==w&&(G=!0,Q="buffer",Z=w)}var z=F.objectMode?1:Z.length;F.length+=z;var ee=F.length<F.highWaterMark;if(ee||(F.needDrain=!0),F.writing||F.corked){var le=F.lastBufferedRequest;F.lastBufferedRequest={chunk:Z,encoding:Q,isBuf:G,callback:y,next:null},le?le.next=F.lastBufferedRequest:F.bufferedRequest=F.lastBufferedRequest,F.bufferedRequestCount+=1}else he(D,F,!1,z,Z,Q,y);return ee}function he(D,F,G,Z,Q,y,w){F.writelen=Z,F.writecb=w,F.writing=!0,F.sync=!0,F.destroyed?F.onwrite(new T("write")):G?D._writev(Q,F.onwrite):D._write(Q,y,F.onwrite),F.sync=!1}function de(D,F,G,Z,Q){--F.pendingcb,G?(ae.nextTick(Q,Z),ae.nextTick(V,D,F),D._writableState.errorEmitted=!0,P(D,Z)):(Q(Z),D._writableState.errorEmitted=!0,P(D,Z),V(D,F))}function me(D){D.writing=!1,D.writecb=null,D.length-=D.writelen,D.writelen=0}function Pe(D,F){var G=D._writableState,Z=G.sync,Q=G.writecb;if(typeof Q!="function")throw new b;if(me(G),F)de(D,G,Z,F,Q);else{var y=Oe(G)||D.destroyed;!y&&!G.corked&&!G.bufferProcessing&&G.bufferedRequest&&_e(D,G),Z?ae.nextTick(ke,D,G,y,Q):ke(D,G,y,Q)}}function ke(D,F,G,Z){G||Ee(D,F),F.pendingcb--,Z(),V(D,F)}function Ee(D,F){F.length===0&&F.needDrain&&(F.needDrain=!1,D.emit("drain"))}function _e(D,F){F.bufferProcessing=!0;var G=F.bufferedRequest;if(D._writev&&G&&G.next){var Z=F.bufferedRequestCount,Q=new Array(Z),y=F.corkedRequestsFree;y.entry=G;for(var w=0,z=!0;G;)Q[w]=G,G.isBuf||(z=!1),G=G.next,w+=1;Q.allBuffers=z,he(D,F,!0,F.length,Q,"",y.finish),F.pendingcb++,F.lastBufferedRequest=null,y.next?(F.corkedRequestsFree=y.next,y.next=null):F.corkedRequestsFree=new r(F),F.bufferedRequestCount=0}else{for(;G;){var ee=G.chunk,le=G.encoding,ie=G.callback,se=F.objectMode?1:ee.length;if(he(D,F,!1,se,ee,le,ie),G=G.next,F.bufferedRequestCount--,F.writing)break}G===null&&(F.lastBufferedRequest=null)}F.bufferedRequest=G,F.bufferProcessing=!1}M.prototype._write=function(D,F,G){G(new x("_write()"))},M.prototype._writev=null,M.prototype.end=function(D,F,G){var Z=this._writableState;return typeof D=="function"?(G=D,D=null,F=null):typeof F=="function"&&(G=F,F=null),D!=null&&this.write(D,F),Z.corked&&(Z.corked=1,this.uncork()),Z.ending||J(this,Z,G),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Oe(D){return D.ending&&D.length===0&&D.bufferedRequest===null&&!D.finished&&!D.writing}function qe(D,F){D._final(function(G){F.pendingcb--,G&&P(D,G),F.prefinished=!0,D.emit("prefinish"),V(D,F)})}function $(D,F){!F.prefinished&&!F.finalCalled&&(typeof D._final=="function"&&!F.destroyed?(F.pendingcb++,F.finalCalled=!0,ae.nextTick(qe,D,F)):(F.prefinished=!0,D.emit("prefinish")))}function V(D,F){var G=Oe(F);if(G&&($(D,F),F.pendingcb===0&&(F.finished=!0,D.emit("finish"),F.autoDestroy))){var Z=D._readableState;(!Z||Z.autoDestroy&&Z.endEmitted)&&D.destroy()}return G}function J(D,F,G){F.ending=!0,V(D,F),G&&(F.finished?ae.nextTick(G):D.once("finish",G)),F.ended=!0,D.writable=!1}function ne(D,F,G){var Z=D.entry;for(D.entry=null;Z;){var Q=Z.callback;F.pendingcb--,Q(G),Z=Z.next}F.corkedRequestsFree.next=D}return Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(F){this._writableState&&(this._writableState.destroyed=F)}}),M.prototype.destroy=c.destroy,M.prototype._undestroy=c.undestroy,M.prototype._destroy=function(D,F){F(D)},on}var an,wo;function ht(){if(wo)return an;wo=1;var r=Object.keys||function(v){var h=[];for(var I in v)h.push(I);return h};an=g;var e=Po(),t=vo();ut()(g,e);for(var s=r(t.prototype),f=0;f<s.length;f++){var l=s[f];g.prototype[l]||(g.prototype[l]=t.prototype[l])}function g(v){if(!(this instanceof g))return new g(v);e.call(this,v),t.call(this,v),this.allowHalfOpen=!0,v&&(v.readable===!1&&(this.readable=!1),v.writable===!1&&(this.writable=!1),v.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(g.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(g.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||ae.nextTick(c,this)}function c(v){v.end()}return Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(h){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=h,this._writableState.destroyed=h)}}),an}var sn={},bo;function So(){if(bo)return sn;bo=1;var r=Hn().Buffer,e=r.isEncoding||function(m){switch(m=""+m,m&&m.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function t(m){if(!m)return"utf8";for(var R;;)switch(m){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return m;default:if(R)return;m=(""+m).toLowerCase(),R=!0}}function s(m){var R=t(m);if(typeof R!="string"&&(r.isEncoding===e||!e(m)))throw new Error("Unknown encoding: "+m);return R||m}sn.StringDecoder=f;function f(m){this.encoding=s(m);var R;switch(this.encoding){case"utf16le":this.text=I,this.end=B,R=4;break;case"utf8":this.fillLast=c,R=4;break;case"base64":this.text=x,this.end=b,R=3;break;default:this.write=N,this.end=T;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(R)}f.prototype.write=function(m){if(m.length===0)return"";var R,A;if(this.lastNeed){if(R=this.fillLast(m),R===void 0)return"";A=this.lastNeed,this.lastNeed=0}else A=0;return A<m.length?R?R+this.text(m,A):this.text(m,A):R||""},f.prototype.end=h,f.prototype.text=v,f.prototype.fillLast=function(m){if(this.lastNeed<=m.length)return m.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);m.copy(this.lastChar,this.lastTotal-this.lastNeed,0,m.length),this.lastNeed-=m.length};function l(m){return m<=127?0:m>>5===6?2:m>>4===14?3:m>>3===30?4:m>>6===2?-1:-2}function g(m,R,A){var P=R.length-1;if(P<A)return 0;var k=l(R[P]);return k>=0?(k>0&&(m.lastNeed=k-1),k):--P<A||k===-2?0:(k=l(R[P]),k>=0?(k>0&&(m.lastNeed=k-2),k):--P<A||k===-2?0:(k=l(R[P]),k>=0?(k>0&&(k===2?k=0:m.lastNeed=k-3),k):0))}function u(m,R,A){if((R[0]&192)!==128)return m.lastNeed=0,"�";if(m.lastNeed>1&&R.length>1){if((R[1]&192)!==128)return m.lastNeed=1,"�";if(m.lastNeed>2&&R.length>2&&(R[2]&192)!==128)return m.lastNeed=2,"�"}}function c(m){var R=this.lastTotal-this.lastNeed,A=u(this,m);if(A!==void 0)return A;if(this.lastNeed<=m.length)return m.copy(this.lastChar,R,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);m.copy(this.lastChar,R,0,m.length),this.lastNeed-=m.length}function v(m,R){var A=g(this,m,R);if(!this.lastNeed)return m.toString("utf8",R);this.lastTotal=A;var P=m.length-(A-this.lastNeed);return m.copy(this.lastChar,0,P),m.toString("utf8",R,P)}function h(m){var R=m&&m.length?this.write(m):"";return this.lastNeed?R+"�":R}function I(m,R){if((m.length-R)%2===0){var A=m.toString("utf16le",R);if(A){var P=A.charCodeAt(A.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=m[m.length-2],this.lastChar[1]=m[m.length-1],A.slice(0,-1)}return A}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=m[m.length-1],m.toString("utf16le",R,m.length-1)}function B(m){var R=m&&m.length?this.write(m):"";if(this.lastNeed){var A=this.lastTotal-this.lastNeed;return R+this.lastChar.toString("utf16le",0,A)}return R}function x(m,R){var A=(m.length-R)%3;return A===0?m.toString("base64",R):(this.lastNeed=3-A,this.lastTotal=3,A===1?this.lastChar[0]=m[m.length-1]:(this.lastChar[0]=m[m.length-2],this.lastChar[1]=m[m.length-1]),m.toString("base64",R,m.length-A))}function b(m){var R=m&&m.length?this.write(m):"";return this.lastNeed?R+this.lastChar.toString("base64",0,3-this.lastNeed):R}function N(m){return m.toString(this.encoding)}function T(m){return m&&m.length?this.write(m):""}return sn}var ln,_o;function cn(){if(_o)return ln;_o=1;var r=ft().codes.ERR_STREAM_PREMATURE_CLOSE;function e(l){var g=!1;return function(){if(!g){g=!0;for(var u=arguments.length,c=new Array(u),v=0;v<u;v++)c[v]=arguments[v];l.apply(this,c)}}}function t(){}function s(l){return l.setHeader&&typeof l.abort=="function"}function f(l,g,u){if(typeof g=="function")return f(l,null,g);g||(g={}),u=e(u||t);var c=g.readable||g.readable!==!1&&l.readable,v=g.writable||g.writable!==!1&&l.writable,h=function(){l.writable||B()},I=l._writableState&&l._writableState.finished,B=function(){v=!1,I=!0,c||u.call(l)},x=l._readableState&&l._readableState.endEmitted,b=function(){c=!1,x=!0,v||u.call(l)},N=function(A){u.call(l,A)},T=function(){var A;if(c&&!x)return(!l._readableState||!l._readableState.ended)&&(A=new r),u.call(l,A);if(v&&!I)return(!l._writableState||!l._writableState.ended)&&(A=new r),u.call(l,A)},m=function(){l.req.on("finish",B)};return s(l)?(l.on("complete",B),l.on("abort",T),l.req?m():l.on("request",m)):v&&!l._writableState&&(l.on("end",h),l.on("close",h)),l.on("end",b),l.on("finish",B),g.error!==!1&&l.on("error",N),l.on("close",T),function(){l.removeListener("complete",B),l.removeListener("abort",T),l.removeListener("request",m),l.req&&l.req.removeListener("finish",B),l.removeListener("end",h),l.removeListener("close",h),l.removeListener("finish",B),l.removeListener("end",b),l.removeListener("error",N),l.removeListener("close",T)}}return ln=f,ln}var un,Eo;function rs(){if(Eo)return un;Eo=1;var r;function e(A,P,k){return P=t(P),P in A?Object.defineProperty(A,P,{value:k,enumerable:!0,configurable:!0,writable:!0}):A[P]=k,A}function t(A){var P=s(A,"string");return typeof P=="symbol"?P:String(P)}function s(A,P){if(typeof A!="object"||A===null)return A;var k=A[Symbol.toPrimitive];if(k!==void 0){var S=k.call(A,P);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(A)}var f=cn(),l=Symbol("lastResolve"),g=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),v=Symbol("lastPromise"),h=Symbol("handlePromise"),I=Symbol("stream");function B(A,P){return{value:A,done:P}}function x(A){var P=A[l];if(P!==null){var k=A[I].read();k!==null&&(A[v]=null,A[l]=null,A[g]=null,P(B(k,!1)))}}function b(A){ae.nextTick(x,A)}function N(A,P){return function(k,S){A.then(function(){if(P[c]){k(B(void 0,!0));return}P[h](k,S)},S)}}var T=Object.getPrototypeOf(function(){}),m=Object.setPrototypeOf((r={get stream(){return this[I]},next:function(){var P=this,k=this[u];if(k!==null)return Promise.reject(k);if(this[c])return Promise.resolve(B(void 0,!0));if(this[I].destroyed)return new Promise(function(W,X){ae.nextTick(function(){P[u]?X(P[u]):W(B(void 0,!0))})});var S=this[v],C;if(S)C=new Promise(N(S,this));else{var M=this[I].read();if(M!==null)return Promise.resolve(B(M,!1));C=new Promise(this[h])}return this[v]=C,C}},e(r,Symbol.asyncIterator,function(){return this}),e(r,"return",function(){var P=this;return new Promise(function(k,S){P[I].destroy(null,function(C){if(C){S(C);return}k(B(void 0,!0))})})}),r),T),R=function(P){var k,S=Object.create(m,(k={},e(k,I,{value:P,writable:!0}),e(k,l,{value:null,writable:!0}),e(k,g,{value:null,writable:!0}),e(k,u,{value:null,writable:!0}),e(k,c,{value:P._readableState.endEmitted,writable:!0}),e(k,h,{value:function(M,W){var X=S[I].read();X?(S[v]=null,S[l]=null,S[g]=null,M(B(X,!1))):(S[l]=M,S[g]=W)},writable:!0}),k));return S[v]=null,f(P,function(C){if(C&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"){var M=S[g];M!==null&&(S[v]=null,S[l]=null,S[g]=null,M(C)),S[u]=C;return}var W=S[l];W!==null&&(S[v]=null,S[l]=null,S[g]=null,W(B(void 0,!0))),S[c]=!0}),P.on("readable",b.bind(null,S)),S};return un=R,un}var fn,Co;function ns(){return Co||(Co=1,fn=function(){throw new Error("Readable.from is not available in the browser")}),fn}var hn,Ro;function Po(){if(Ro)return hn;Ro=1,hn=W;var r;W.ReadableState=M,Ht().EventEmitter;var e=function(w,z){return w.listeners(z).length},t=Xn(),s=yt().Buffer,f=(typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function l(y){return s.from(y)}function g(y){return s.isBuffer(y)||y instanceof f}var u=lo(),c;u&&u.debuglog?c=u.debuglog("stream"):c=function(){};var v=es(),h=fo(),I=go(),B=I.getHighWaterMark,x=ft().codes,b=x.ERR_INVALID_ARG_TYPE,N=x.ERR_STREAM_PUSH_AFTER_EOF,T=x.ERR_METHOD_NOT_IMPLEMENTED,m=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,R,A,P;ut()(W,t);var k=h.errorOrDestroy,S=["error","close","destroy","pause","resume"];function C(y,w,z){if(typeof y.prependListener=="function")return y.prependListener(w,z);!y._events||!y._events[w]?y.on(w,z):Array.isArray(y._events[w])?y._events[w].unshift(z):y._events[w]=[z,y._events[w]]}function M(y,w,z){r=r||ht(),y=y||{},typeof z!="boolean"&&(z=w instanceof r),this.objectMode=!!y.objectMode,z&&(this.objectMode=this.objectMode||!!y.readableObjectMode),this.highWaterMark=B(this,y,"readableHighWaterMark",z),this.buffer=new v,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=y.emitClose!==!1,this.autoDestroy=!!y.autoDestroy,this.destroyed=!1,this.defaultEncoding=y.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,y.encoding&&(R||(R=So().StringDecoder),this.decoder=new R(y.encoding),this.encoding=y.encoding)}function W(y){if(r=r||ht(),!(this instanceof W))return new W(y);var w=this instanceof r;this._readableState=new M(y,this,w),this.readable=!0,y&&(typeof y.read=="function"&&(this._read=y.read),typeof y.destroy=="function"&&(this._destroy=y.destroy)),t.call(this)}Object.defineProperty(W.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(w){this._readableState&&(this._readableState.destroyed=w)}}),W.prototype.destroy=h.destroy,W.prototype._undestroy=h.undestroy,W.prototype._destroy=function(y,w){w(y)},W.prototype.push=function(y,w){var z=this._readableState,ee;return z.objectMode?ee=!0:typeof y=="string"&&(w=w||z.defaultEncoding,w!==z.encoding&&(y=s.from(y,w),w=""),ee=!0),X(this,y,w,!1,ee)},W.prototype.unshift=function(y){return X(this,y,null,!0,!1)};function X(y,w,z,ee,le){c("readableAddChunk",w);var ie=y._readableState;if(w===null)ie.reading=!1,Pe(y,ie);else{var se;if(le||(se=U(ie,w)),se)k(y,se);else if(ie.objectMode||w&&w.length>0)if(typeof w!="string"&&!ie.objectMode&&Object.getPrototypeOf(w)!==s.prototype&&(w=l(w)),ee)ie.endEmitted?k(y,new m):re(y,ie,w,!0);else if(ie.ended)k(y,new N);else{if(ie.destroyed)return!1;ie.reading=!1,ie.decoder&&!z?(w=ie.decoder.write(w),ie.objectMode||w.length!==0?re(y,ie,w,!1):_e(y,ie)):re(y,ie,w,!1)}else ee||(ie.reading=!1,_e(y,ie))}return!ie.ended&&(ie.length<ie.highWaterMark||ie.length===0)}function re(y,w,z,ee){w.flowing&&w.length===0&&!w.sync?(w.awaitDrain=0,y.emit("data",z)):(w.length+=w.objectMode?1:z.length,ee?w.buffer.unshift(z):w.buffer.push(z),w.needReadable&&ke(y)),_e(y,w)}function U(y,w){var z;return!g(w)&&typeof w!="string"&&w!==void 0&&!y.objectMode&&(z=new b("chunk",["string","Buffer","Uint8Array"],w)),z}W.prototype.isPaused=function(){return this._readableState.flowing===!1},W.prototype.setEncoding=function(y){R||(R=So().StringDecoder);var w=new R(y);this._readableState.decoder=w,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,ee="";z!==null;)ee+=w.write(z.data),z=z.next;return this._readableState.buffer.clear(),ee!==""&&this._readableState.buffer.push(ee),this._readableState.length=ee.length,this};var he=1073741824;function de(y){return y>=he?y=he:(y--,y|=y>>>1,y|=y>>>2,y|=y>>>4,y|=y>>>8,y|=y>>>16,y++),y}function me(y,w){return y<=0||w.length===0&&w.ended?0:w.objectMode?1:y!==y?w.flowing&&w.length?w.buffer.head.data.length:w.length:(y>w.highWaterMark&&(w.highWaterMark=de(y)),y<=w.length?y:w.ended?w.length:(w.needReadable=!0,0))}W.prototype.read=function(y){c("read",y),y=parseInt(y,10);var w=this._readableState,z=y;if(y!==0&&(w.emittedReadable=!1),y===0&&w.needReadable&&((w.highWaterMark!==0?w.length>=w.highWaterMark:w.length>0)||w.ended))return c("read: emitReadable",w.length,w.ended),w.length===0&&w.ended?G(this):ke(this),null;if(y=me(y,w),y===0&&w.ended)return w.length===0&&G(this),null;var ee=w.needReadable;c("need readable",ee),(w.length===0||w.length-y<w.highWaterMark)&&(ee=!0,c("length less than watermark",ee)),w.ended||w.reading?(ee=!1,c("reading or ended",ee)):ee&&(c("do read"),w.reading=!0,w.sync=!0,w.length===0&&(w.needReadable=!0),this._read(w.highWaterMark),w.sync=!1,w.reading||(y=me(z,w)));var le;return y>0?le=F(y,w):le=null,le===null?(w.needReadable=w.length<=w.highWaterMark,y=0):(w.length-=y,w.awaitDrain=0),w.length===0&&(w.ended||(w.needReadable=!0),z!==y&&w.ended&&G(this)),le!==null&&this.emit("data",le),le};function Pe(y,w){if(c("onEofChunk"),!w.ended){if(w.decoder){var z=w.decoder.end();z&&z.length&&(w.buffer.push(z),w.length+=w.objectMode?1:z.length)}w.ended=!0,w.sync?ke(y):(w.needReadable=!1,w.emittedReadable||(w.emittedReadable=!0,Ee(y)))}}function ke(y){var w=y._readableState;c("emitReadable",w.needReadable,w.emittedReadable),w.needReadable=!1,w.emittedReadable||(c("emitReadable",w.flowing),w.emittedReadable=!0,ae.nextTick(Ee,y))}function Ee(y){var w=y._readableState;c("emitReadable_",w.destroyed,w.length,w.ended),!w.destroyed&&(w.length||w.ended)&&(y.emit("readable"),w.emittedReadable=!1),w.needReadable=!w.flowing&&!w.ended&&w.length<=w.highWaterMark,D(y)}function _e(y,w){w.readingMore||(w.readingMore=!0,ae.nextTick(Oe,y,w))}function Oe(y,w){for(;!w.reading&&!w.ended&&(w.length<w.highWaterMark||w.flowing&&w.length===0);){var z=w.length;if(c("maybeReadMore read 0"),y.read(0),z===w.length)break}w.readingMore=!1}W.prototype._read=function(y){k(this,new T("_read()"))},W.prototype.pipe=function(y,w){var z=this,ee=this._readableState;switch(ee.pipesCount){case 0:ee.pipes=y;break;case 1:ee.pipes=[ee.pipes,y];break;default:ee.pipes.push(y);break}ee.pipesCount+=1,c("pipe count=%d opts=%j",ee.pipesCount,w);var le=(!w||w.end!==!1)&&y!==ae.stdout&&y!==ae.stderr,ie=le?De:We;ee.endEmitted?ae.nextTick(ie):z.once("end",ie),y.on("unpipe",se);function se(Ve,Me){c("onunpipe"),Ve===z&&Me&&Me.hasUnpiped===!1&&(Me.hasUnpiped=!0,Ue())}function De(){c("onend"),y.end()}var H=qe(z);y.on("drain",H);var Fe=!1;function Ue(){c("cleanup"),y.removeListener("close",$e),y.removeListener("finish",Ne),y.removeListener("drain",H),y.removeListener("error",we),y.removeListener("unpipe",se),z.removeListener("end",De),z.removeListener("end",We),z.removeListener("data",ye),Fe=!0,ee.awaitDrain&&(!y._writableState||y._writableState.needDrain)&&H()}z.on("data",ye);function ye(Ve){c("ondata");var Me=y.write(Ve);c("dest.write",Me),Me===!1&&((ee.pipesCount===1&&ee.pipes===y||ee.pipesCount>1&&Q(ee.pipes,y)!==-1)&&!Fe&&(c("false write response, pause",ee.awaitDrain),ee.awaitDrain++),z.pause())}function we(Ve){c("onerror",Ve),We(),y.removeListener("error",we),e(y,"error")===0&&k(y,Ve)}C(y,"error",we);function $e(){y.removeListener("finish",Ne),We()}y.once("close",$e);function Ne(){c("onfinish"),y.removeListener("close",$e),We()}y.once("finish",Ne);function We(){c("unpipe"),z.unpipe(y)}return y.emit("pipe",z),ee.flowing||(c("pipe resume"),z.resume()),y};function qe(y){return function(){var z=y._readableState;c("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&e(y,"data")&&(z.flowing=!0,D(y))}}W.prototype.unpipe=function(y){var w=this._readableState,z={hasUnpiped:!1};if(w.pipesCount===0)return this;if(w.pipesCount===1)return y&&y!==w.pipes?this:(y||(y=w.pipes),w.pipes=null,w.pipesCount=0,w.flowing=!1,y&&y.emit("unpipe",this,z),this);if(!y){var ee=w.pipes,le=w.pipesCount;w.pipes=null,w.pipesCount=0,w.flowing=!1;for(var ie=0;ie<le;ie++)ee[ie].emit("unpipe",this,{hasUnpiped:!1});return this}var se=Q(w.pipes,y);return se===-1?this:(w.pipes.splice(se,1),w.pipesCount-=1,w.pipesCount===1&&(w.pipes=w.pipes[0]),y.emit("unpipe",this,z),this)},W.prototype.on=function(y,w){var z=t.prototype.on.call(this,y,w),ee=this._readableState;return y==="data"?(ee.readableListening=this.listenerCount("readable")>0,ee.flowing!==!1&&this.resume()):y==="readable"&&!ee.endEmitted&&!ee.readableListening&&(ee.readableListening=ee.needReadable=!0,ee.flowing=!1,ee.emittedReadable=!1,c("on readable",ee.length,ee.reading),ee.length?ke(this):ee.reading||ae.nextTick(V,this)),z},W.prototype.addListener=W.prototype.on,W.prototype.removeListener=function(y,w){var z=t.prototype.removeListener.call(this,y,w);return y==="readable"&&ae.nextTick($,this),z},W.prototype.removeAllListeners=function(y){var w=t.prototype.removeAllListeners.apply(this,arguments);return(y==="readable"||y===void 0)&&ae.nextTick($,this),w};function $(y){var w=y._readableState;w.readableListening=y.listenerCount("readable")>0,w.resumeScheduled&&!w.paused?w.flowing=!0:y.listenerCount("data")>0&&y.resume()}function V(y){c("readable nexttick read 0"),y.read(0)}W.prototype.resume=function(){var y=this._readableState;return y.flowing||(c("resume"),y.flowing=!y.readableListening,J(this,y)),y.paused=!1,this};function J(y,w){w.resumeScheduled||(w.resumeScheduled=!0,ae.nextTick(ne,y,w))}function ne(y,w){c("resume",w.reading),w.reading||y.read(0),w.resumeScheduled=!1,y.emit("resume"),D(y),w.flowing&&!w.reading&&y.read(0)}W.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function D(y){var w=y._readableState;for(c("flow",w.flowing);w.flowing&&y.read()!==null;);}W.prototype.wrap=function(y){var w=this,z=this._readableState,ee=!1;y.on("end",function(){if(c("wrapped end"),z.decoder&&!z.ended){var se=z.decoder.end();se&&se.length&&w.push(se)}w.push(null)}),y.on("data",function(se){if(c("wrapped data"),z.decoder&&(se=z.decoder.write(se)),!(z.objectMode&&se==null)&&!(!z.objectMode&&(!se||!se.length))){var De=w.push(se);De||(ee=!0,y.pause())}});for(var le in y)this[le]===void 0&&typeof y[le]=="function"&&(this[le]=function(De){return function(){return y[De].apply(y,arguments)}}(le));for(var ie=0;ie<S.length;ie++)y.on(S[ie],this.emit.bind(this,S[ie]));return this._read=function(se){c("wrapped _read",se),ee&&(ee=!1,y.resume())},this},typeof Symbol=="function"&&(W.prototype[Symbol.asyncIterator]=function(){return A===void 0&&(A=rs()),A(this)}),Object.defineProperty(W.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(W.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(W.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(w){this._readableState&&(this._readableState.flowing=w)}}),W._fromList=F,Object.defineProperty(W.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function F(y,w){if(w.length===0)return null;var z;return w.objectMode?z=w.buffer.shift():!y||y>=w.length?(w.decoder?z=w.buffer.join(""):w.buffer.length===1?z=w.buffer.first():z=w.buffer.concat(w.length),w.buffer.clear()):z=w.buffer.consume(y,w.decoder),z}function G(y){var w=y._readableState;c("endReadable",w.endEmitted),w.endEmitted||(w.ended=!0,ae.nextTick(Z,w,y))}function Z(y,w){if(c("endReadableNT",y.endEmitted,y.length),!y.endEmitted&&y.length===0&&(y.endEmitted=!0,w.readable=!1,w.emit("end"),y.autoDestroy)){var z=w._writableState;(!z||z.autoDestroy&&z.finished)&&w.destroy()}}typeof Symbol=="function"&&(W.from=function(y,w){return P===void 0&&(P=ns()),P(W,y,w)});function Q(y,w){for(var z=0,ee=y.length;z<ee;z++)if(y[z]===w)return z;return-1}return hn}var dn,To;function Ao(){if(To)return dn;To=1,dn=u;var r=ft().codes,e=r.ERR_METHOD_NOT_IMPLEMENTED,t=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,f=r.ERR_TRANSFORM_WITH_LENGTH_0,l=ht();ut()(u,l);function g(h,I){var B=this._transformState;B.transforming=!1;var x=B.writecb;if(x===null)return this.emit("error",new t);B.writechunk=null,B.writecb=null,I!=null&&this.push(I),x(h);var b=this._readableState;b.reading=!1,(b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}function u(h){if(!(this instanceof u))return new u(h);l.call(this,h),this._transformState={afterTransform:g.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,h&&(typeof h.transform=="function"&&(this._transform=h.transform),typeof h.flush=="function"&&(this._flush=h.flush)),this.on("prefinish",c)}function c(){var h=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(I,B){v(h,I,B)}):v(this,null,null)}u.prototype.push=function(h,I){return this._transformState.needTransform=!1,l.prototype.push.call(this,h,I)},u.prototype._transform=function(h,I,B){B(new e("_transform()"))},u.prototype._write=function(h,I,B){var x=this._transformState;if(x.writecb=B,x.writechunk=h,x.writeencoding=I,!x.transforming){var b=this._readableState;(x.needTransform||b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}},u.prototype._read=function(h){var I=this._transformState;I.writechunk!==null&&!I.transforming?(I.transforming=!0,this._transform(I.writechunk,I.writeencoding,I.afterTransform)):I.needTransform=!0},u.prototype._destroy=function(h,I){l.prototype._destroy.call(this,h,function(B){I(B)})};function v(h,I,B){if(I)return h.emit("error",I);if(B!=null&&h.push(B),h._writableState.length)throw new f;if(h._transformState.transforming)throw new s;return h.push(null)}return dn}var pn,Io;function is(){if(Io)return pn;Io=1,pn=e;var r=Ao();ut()(e,r);function e(t){if(!(this instanceof e))return new e(t);r.call(this,t)}return e.prototype._transform=function(t,s,f){f(null,t)},pn}var gn,Bo;function os(){if(Bo)return gn;Bo=1;var r;function e(B){var x=!1;return function(){x||(x=!0,B.apply(void 0,arguments))}}var t=ft().codes,s=t.ERR_MISSING_ARGS,f=t.ERR_STREAM_DESTROYED;function l(B){if(B)throw B}function g(B){return B.setHeader&&typeof B.abort=="function"}function u(B,x,b,N){N=e(N);var T=!1;B.on("close",function(){T=!0}),r===void 0&&(r=cn()),r(B,{readable:x,writable:b},function(R){if(R)return N(R);T=!0,N()});var m=!1;return function(R){if(!T&&!m){if(m=!0,g(B))return B.abort();if(typeof B.destroy=="function")return B.destroy();N(R||new f("pipe"))}}}function c(B){B()}function v(B,x){return B.pipe(x)}function h(B){return!B.length||typeof B[B.length-1]!="function"?l:B.pop()}function I(){for(var B=arguments.length,x=new Array(B),b=0;b<B;b++)x[b]=arguments[b];var N=h(x);if(Array.isArray(x[0])&&(x=x[0]),x.length<2)throw new s("streams");var T,m=x.map(function(R,A){var P=A<x.length-1,k=A>0;return u(R,P,k,function(S){T||(T=S),S&&m.forEach(c),!P&&(m.forEach(c),N(T))})});return x.reduce(v)}return gn=I,gn}var ko;function as(){return ko||(ko=1,function(r,e){e=r.exports=Po(),e.Stream=e,e.Readable=e,e.Writable=vo(),e.Duplex=ht(),e.Transform=Ao(),e.PassThrough=is(),e.finished=cn(),e.pipeline=os()}(At,At.exports)),At.exports}/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var yn,Oo;function ss(){if(Oo)return yn;Oo=1;let r;return yn=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window!="undefined"?window:globalThis):e=>(r||(r=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0)),yn}var mn,Mo;function ls(){if(Mo)return mn;Mo=1;function r(t,s){for(const f in s)Object.defineProperty(t,f,{value:s[f],enumerable:!0,configurable:!0});return t}function e(t,s,f){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");f||(f={}),typeof s=="object"&&(f=s,s=""),s&&(f.code=s);try{return r(t,f)}catch(l){f.message=t.message,f.stack=t.stack;const g=function(){};return g.prototype=Object.create(Object.getPrototypeOf(t)),r(new g,f)}}return mn=e,mn}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var vn,Lo;function cs(){if(Lo)return vn;Lo=1;const r=ma()("simple-peer"),e=va(),t=wa(),s=as(),f=ss(),l=ls(),{Buffer:g}=yt(),u=64*1024,c=5*1e3,v=5*1e3;function h(x){return x.replace(/a=ice-options:trickle\s\n/g,"")}function I(x){console.warn(x)}class B extends s.Duplex{constructor(b){if(b=Object.assign({allowHalfOpen:!1},b),super(b),this._id=t(4).toString("hex").slice(0,7),this._debug("new peer %o",b),this.channelName=b.initiator?b.channelName||t(20).toString("hex"):null,this.initiator=b.initiator||!1,this.channelConfig=b.channelConfig||B.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},B.config,b.config),this.offerOptions=b.offerOptions||{},this.answerOptions=b.answerOptions||{},this.sdpTransform=b.sdpTransform||(N=>N),this.streams=b.streams||(b.stream?[b.stream]:[]),this.trickle=b.trickle!==void 0?b.trickle:!0,this.allowHalfTrickle=b.allowHalfTrickle!==void 0?b.allowHalfTrickle:!1,this.iceCompleteTimeout=b.iceCompleteTimeout||c,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=b.wrtc&&typeof b.wrtc=="object"?b.wrtc:e(),!this._wrtc)throw l(typeof window=="undefined"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(N){this.destroy(l(N,"ERR_PC_CONSTRUCTOR"));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=N=>{this._onIceCandidate(N)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(N=>{this.destroy(l(N,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=N=>{this._setupData(N)},this.streams&&this.streams.forEach(N=>{this.addStream(N)}),this._pc.ontrack=N=>{this._onTrack(N)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof b=="string")try{b=JSON.parse(b)}catch(N){b={}}this._debug("signal()"),b.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),b.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(b.transceiverRequest.kind,b.transceiverRequest.init)),b.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(b.candidate):this._pendingCandidates.push(b.candidate)),b.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(b)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(N=>{this._addIceCandidate(N)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(N=>{this.destroy(l(N,"ERR_SET_REMOTE_DESCRIPTION"))}),!b.sdp&&!b.candidate&&!b.renegotiate&&!b.transceiverRequest&&this.destroy(l(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(b){const N=new this._wrtc.RTCIceCandidate(b);this._pc.addIceCandidate(N).catch(T=>{!N.address||N.address.endsWith(".local")?I("Ignoring unsupported ICE candidate."):this.destroy(l(T,"ERR_ADD_ICE_CANDIDATE"))})}send(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(b)}}addTransceiver(b,N){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(b,N),this._needsNegotiation()}catch(T){this.destroy(l(T,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:b,init:N}})}}addStream(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),b.getTracks().forEach(N=>{this.addTrack(N,b)})}}addTrack(b,N){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const T=this._senderMap.get(b)||new Map;let m=T.get(N);if(!m)m=this._pc.addTrack(b,N),T.set(N,m),this._senderMap.set(b,T),this._needsNegotiation();else throw m.removed?l(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):l(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(b,N,T){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const m=this._senderMap.get(b),R=m?m.get(T):null;if(!R)throw l(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");N&&this._senderMap.set(N,m),R.replaceTrack!=null?R.replaceTrack(N):this.destroy(l(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(b,N){if(this.destroying)return;if(this.destroyed)throw l(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const T=this._senderMap.get(b),m=T?T.get(N):null;if(!m)throw l(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{m.removed=!0,this._pc.removeTrack(m)}catch(R){R.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(m):this.destroy(l(R,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(b){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),b.getTracks().forEach(N=>{this.removeTrack(N,b)})}}_needsNegotiation(){this._debug("_needsNegotiation"),!this._batchedNegotiation&&(this._batchedNegotiation=!0,f(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw l(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(b){this._destroy(b,()=>{})}_destroy(b,N){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",b&&(b.message||b)),f(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",b&&(b.message||b)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(T){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(T){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,b&&this.emit("error",b),this.emit("close"),N()}))}_setupData(b){if(!b.channel)return this.destroy(l(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=b.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=u),this.channelName=this._channel.label,this._channel.onmessage=T=>{this._onChannelMessage(T)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=T=>{const m=T.error instanceof Error?T.error:new Error(`Datachannel error: ${T.message} ${T.filename}:${T.lineno}:${T.colno}`);this.destroy(l(m,"ERR_DATA_CHANNEL"))};let N=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(N&&this._onChannelClose(),N=!0):N=!1},v)}_read(){}_write(b,N,T){if(this.destroyed)return T(l(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(b)}catch(m){return this.destroy(l(m,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=T):T(null)}else this._debug("write before connect"),this._chunk=b,this._cb=T}_onFinish(){if(this.destroyed)return;const b=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?b():this.once("connect",b)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(b=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(b.sdp=h(b.sdp)),b.sdp=this.sdpTransform(b.sdp);const N=()=>{if(this.destroyed)return;const R=this._pc.localDescription||b;this._debug("signal"),this.emit("signal",{type:R.type,sdp:R.sdp})},T=()=>{this._debug("createOffer success"),!this.destroyed&&(this.trickle||this._iceComplete?N():this.once("_iceComplete",N))},m=R=>{this.destroy(l(R,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(b).then(T).catch(m)}).catch(b=>{this.destroy(l(b,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(b=>{!b.mid&&b.sender.track&&!b.requested&&(b.requested=!0,this.addTransceiver(b.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(b=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(b.sdp=h(b.sdp)),b.sdp=this.sdpTransform(b.sdp);const N=()=>{if(this.destroyed)return;const R=this._pc.localDescription||b;this._debug("signal"),this.emit("signal",{type:R.type,sdp:R.sdp}),this.initiator||this._requestMissingTransceivers()},T=()=>{this.destroyed||(this.trickle||this._iceComplete?N():this.once("_iceComplete",N))},m=R=>{this.destroy(l(R,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(b).then(T).catch(m)}).catch(b=>{this.destroy(l(b,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(l(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const b=this._pc.iceConnectionState,N=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",b,N),this.emit("iceStateChange",b,N),(b==="connected"||b==="completed")&&(this._pcReady=!0,this._maybeReady()),b==="failed"&&this.destroy(l(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),b==="closed"&&this.destroy(l(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(b){const N=T=>(Object.prototype.toString.call(T.values)==="[object Array]"&&T.values.forEach(m=>{Object.assign(T,m)}),T);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(T=>{const m=[];T.forEach(R=>{m.push(N(R))}),b(null,m)},T=>b(T)):this._pc.getStats.length>0?this._pc.getStats(T=>{if(this.destroyed)return;const m=[];T.result().forEach(R=>{const A={};R.names().forEach(P=>{A[P]=R.stat(P)}),A.id=R.id,A.type=R.type,A.timestamp=R.timestamp,m.push(N(A))}),b(null,m)},T=>b(T)):b(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const b=()=>{this.destroyed||this.getStats((N,T)=>{if(this.destroyed)return;N&&(T=[]);const m={},R={},A={};let P=!1;T.forEach(S=>{(S.type==="remotecandidate"||S.type==="remote-candidate")&&(m[S.id]=S),(S.type==="localcandidate"||S.type==="local-candidate")&&(R[S.id]=S),(S.type==="candidatepair"||S.type==="candidate-pair")&&(A[S.id]=S)});const k=S=>{P=!0;let C=R[S.localCandidateId];C&&(C.ip||C.address)?(this.localAddress=C.ip||C.address,this.localPort=Number(C.port)):C&&C.ipAddress?(this.localAddress=C.ipAddress,this.localPort=Number(C.portNumber)):typeof S.googLocalAddress=="string"&&(C=S.googLocalAddress.split(":"),this.localAddress=C[0],this.localPort=Number(C[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let M=m[S.remoteCandidateId];M&&(M.ip||M.address)?(this.remoteAddress=M.ip||M.address,this.remotePort=Number(M.port)):M&&M.ipAddress?(this.remoteAddress=M.ipAddress,this.remotePort=Number(M.portNumber)):typeof S.googRemoteAddress=="string"&&(M=S.googRemoteAddress.split(":"),this.remoteAddress=M[0],this.remotePort=Number(M[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(T.forEach(S=>{S.type==="transport"&&S.selectedCandidatePairId&&k(A[S.selectedCandidatePairId]),(S.type==="googCandidatePair"&&S.googActiveConnection==="true"||(S.type==="candidatepair"||S.type==="candidate-pair")&&S.selected)&&k(S)}),!P&&(!Object.keys(A).length||Object.keys(R).length)){setTimeout(b,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(C){return this.destroy(l(C,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const S=this._cb;this._cb=null,S(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};b()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>u||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(b=>{this._pc.removeTrack(b),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(b){this.destroyed||(b.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:b.candidate.candidate,sdpMLineIndex:b.candidate.sdpMLineIndex,sdpMid:b.candidate.sdpMid}}):!b.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),b.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(b){if(this.destroyed)return;let N=b.data;N instanceof ArrayBuffer&&(N=g.from(N)),this.push(N)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const b=this._cb;this._cb=null,b(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(b){this.destroyed||b.streams.forEach(N=>{this._debug("on track"),this.emit("track",b.track,N),this._remoteTracks.push({track:b.track,stream:N}),!this._remoteStreams.some(T=>T.id===N.id)&&(this._remoteStreams.push(N),f(()=>{this._debug("on stream"),this.emit("stream",N)}))})}_debug(){const b=[].slice.call(arguments);b[0]="["+this._id+"] "+b[0],r.apply(null,b)}}return B.WEBRTC_SUPPORT=!!e(),B.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},B.channelConfig={},vn=B,vn}var us=cs();const fs=xt(us);var hs=Object.defineProperty,ds=(r,e,t)=>e in r?hs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ot=(r,e,t)=>ds(r,typeof e!="symbol"?e+"":e,t),wn=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});class No{constructor(e,t,s={}){ot(this,"peer",null),ot(this,"config"),ot(this,"events"),ot(this,"connectionState","new"),ot(this,"isInitiator"),ot(this,"remoteUserId"),ot(this,"localStream",null),this.remoteUserId=e,this.config=t,this.events=s,this.isInitiator=t.initiator||!1}createConnection(e){return wn(this,null,function*(){try{console.log(`[CallPeerConnection] Creating connection to ${this.remoteUserId}, initiator: ${this.isInitiator}`),this.localStream=e||null;const t={initiator:this.isInitiator,trickle:!0,stream:this.localStream||void 0,config:{iceServers:this.config.iceServers}};this.peer=new fs(t),this.setupPeerEventListeners(),console.log(`[CallPeerConnection] Peer connection created for ${this.remoteUserId}`)}catch(t){throw console.error(`[CallPeerConnection] Failed to create connection to ${this.remoteUserId}:`,t),t}})}signal(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot signal to ${this.remoteUserId}: peer not initialized`);return}try{console.log(`[CallPeerConnection] Signaling to ${this.remoteUserId}:`,e.type),this.peer.signal(e)}catch(f){console.error(`[CallPeerConnection] Failed to signal to ${this.remoteUserId}:`,f),(s=(t=this.events).onError)==null||s.call(t,f)}}addStream(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot add stream to ${this.remoteUserId}: peer not initialized`);return}try{this.localStream&&this.removeStream(this.localStream),this.localStream=e,this.peer.addStream(e),console.log(`[CallPeerConnection] Stream added to ${this.remoteUserId}`)}catch(f){console.error(`[CallPeerConnection] Failed to add stream to ${this.remoteUserId}:`,f),(s=(t=this.events).onError)==null||s.call(t,f)}}removeStream(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot remove stream from ${this.remoteUserId}: peer not initialized`);return}try{this.peer.removeStream(e),this.localStream===e&&(this.localStream=null),console.log(`[CallPeerConnection] Stream removed from ${this.remoteUserId}`)}catch(f){console.error(`[CallPeerConnection] Failed to remove stream from ${this.remoteUserId}:`,f),(s=(t=this.events).onError)==null||s.call(t,f)}}replaceTrack(e,t){var s,f;if(!this.peer){console.error(`[CallPeerConnection] Cannot replace track for ${this.remoteUserId}: peer not initialized`);return}if(!this.localStream){console.error(`[CallPeerConnection] Cannot replace track for ${this.remoteUserId}: no local stream`);return}if(e.kind!==t.kind){console.error(`[CallPeerConnection] Cannot replace track for ${this.remoteUserId}: track kinds don't match (${e.kind} vs ${t.kind})`);return}const g=this.localStream.getTracks().some(u=>u.id===e.id);g||console.warn(`[CallPeerConnection] Old track not found in local stream for ${this.remoteUserId}, attempting replacement anyway`);try{this.peer.replaceTrack(e,t,this.localStream),g&&this.localStream.removeTrack(e),this.localStream.addTrack(t),console.log(`[CallPeerConnection] ${t.kind} track replaced for ${this.remoteUserId} (${e.id} -> ${t.id})`)}catch(u){throw console.error(`[CallPeerConnection] Failed to replace track for ${this.remoteUserId}:`,u),(f=(s=this.events).onError)==null||f.call(s,u),u}}getVideoTrack(){if(!this.localStream)return null;const e=this.localStream.getVideoTracks();return e.length>0?e[0]:null}getAudioTrack(){if(!this.localStream)return null;const e=this.localStream.getAudioTracks();return e.length>0?e[0]:null}sendData(e){var t,s;if(!this.peer){console.error(`[CallPeerConnection] Cannot send data to ${this.remoteUserId}: peer not initialized`);return}if(!this.peer.connected){console.warn(`[CallPeerConnection] Cannot send data to ${this.remoteUserId}: not connected`);return}try{this.peer.send(JSON.stringify(e))}catch(f){console.error(`[CallPeerConnection] Failed to send data to ${this.remoteUserId}:`,f),(s=(t=this.events).onError)==null||s.call(t,f)}}setBandwidthLimit(e){return wn(this,null,function*(){if(!this.peer){console.warn(`[CallPeerConnection] Cannot set bandwidth for ${this.remoteUserId}: peer connection not available`);return}try{const t=this.peer._pc;if(!t)return;const s=t.getSenders();for(const f of s)if(f.track){const l=f.getParameters();l.encodings||(l.encodings=[{}]),l.encodings[0].maxBitrate=e*1e3,yield f.setParameters(l)}console.log(`[CallPeerConnection] Bandwidth limit set to ${e}kbps for ${this.remoteUserId}`)}catch(t){console.error(`[CallPeerConnection] Failed to set bandwidth limit for ${this.remoteUserId}:`,t)}})}getConnectionState(){return this.connectionState}isConnected(){var e;return((e=this.peer)==null?void 0:e.connected)===!0}getStats(){return wn(this,null,function*(){if(!this.peer)return null;try{const e=this.peer._pc;return e?yield e.getStats():null}catch(e){return console.error(`[CallPeerConnection] Failed to get stats for ${this.remoteUserId}:`,e),null}})}getRemoteUserId(){return this.remoteUserId}destroy(){if(console.log(`[CallPeerConnection] Destroying connection to ${this.remoteUserId}`),this.peer){try{this.peer.destroy()}catch(e){console.error(`[CallPeerConnection] Error destroying peer for ${this.remoteUserId}:`,e)}this.peer=null}this.localStream=null,this.connectionState="closed"}setupPeerEventListeners(){if(!this.peer)return;this.peer.on("signal",t=>{var s,f;console.log(`[CallPeerConnection] Signal from ${this.remoteUserId}:`,t.type),(f=(s=this.events).onSignal)==null||f.call(s,t)}),this.peer.on("connect",()=>{var t,s;console.log(`[CallPeerConnection] Connected to ${this.remoteUserId}`),this.connectionState="connected",(s=(t=this.events).onConnect)==null||s.call(t)}),this.peer.on("data",t=>{var s,f;try{const l=JSON.parse(t.toString());(f=(s=this.events).onData)==null||f.call(s,l)}catch(l){console.error(`[CallPeerConnection] Failed to parse data from ${this.remoteUserId}:`,l)}}),this.peer.on("stream",t=>{var s,f;console.log(`[CallPeerConnection] Stream received from ${this.remoteUserId}`),(f=(s=this.events).onStream)==null||f.call(s,t)}),this.peer.on("track",(t,s)=>{var f,l;console.log(`[CallPeerConnection] Track received from ${this.remoteUserId}:`,t.kind),(l=(f=this.events).onTrack)==null||l.call(f,t,s)}),this.peer.on("close",()=>{var t,s;console.log(`[CallPeerConnection] Connection closed with ${this.remoteUserId}`),this.connectionState="closed",(s=(t=this.events).onClose)==null||s.call(t)}),this.peer.on("error",t=>{var s,f;console.error(`[CallPeerConnection] Error with ${this.remoteUserId}:`,t),this.connectionState="failed",(f=(s=this.events).onError)==null||f.call(s,t)});const e=this.peer._pc;e&&e.addEventListener("connectionstatechange",()=>{if(this.peer){const t=this.peer._pc;t&&(this.connectionState=t.connectionState,console.log(`[CallPeerConnection] Connection state changed for ${this.remoteUserId}:`,this.connectionState))}})}getConnectionInfo(){return{remoteUserId:this.remoteUserId,isInitiator:this.isInitiator,connectionState:this.connectionState,connected:this.isConnected(),hasLocalStream:!!this.localStream,localStreamTracks:this.localStream?{video:this.localStream.getVideoTracks().length,audio:this.localStream.getAudioTracks().length}:null}}}const Do={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},bt=new Map,Mt=r=>{const e=bt.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,s])=>[t,s.getState()])):{}},ps=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const s=bt.get(t.name);if(s)return St({type:"tracked",store:r},s);const f={connection:e.connect(t),stores:{}};return bt.set(t.name,f),St({type:"tracked",store:r},f)},gs=(r,e)=>{if(e===void 0)return;const t=bt.get(r);t&&(delete t.stores[e],Object.keys(t.stores).length===0&&bt.delete(r))},ys=r=>{var e,t;if(!r)return;const s=r.split(`
22
+ `),f=s.findIndex(g=>g.includes("api.setState"));if(f<0)return;const l=((e=s[f+1])==null?void 0:e.trim())||"";return(t=/.+ (.+) .+/.exec(l))==null?void 0:t[1]},ms=(r,e={})=>(t,s,f)=>{const N=e,{enabled:l,anonymousActionType:g,store:u}=N,c=On(N,["enabled","anonymousActionType","store"]);let v;try{v=(l!=null?l:(Do?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(m){}if(!v)return r(t,s,f);const T=ps(u,v,c),{connection:h}=T,I=On(T,["connection"]);let B=!0;f.setState=(m,R,A)=>{const P=t(m,R);if(!B)return P;const k=A===void 0?{type:g||ys(new Error().stack)||"anonymous"}:typeof A=="string"?{type:A}:A;return u===void 0?(h==null||h.send(k,s()),P):(h==null||h.send(kn(St({},k),{type:`${u}/${k.type}`}),kn(St({},Mt(c.name)),{[u]:f.getState()})),P)},f.devtools={cleanup:()=>{h&&typeof h.unsubscribe=="function"&&h.unsubscribe(),gs(c.name,u)}};const x=(...m)=>{const R=B;B=!1,t(...m),B=R},b=r(f.setState,s,f);if(I.type==="untracked"?h==null||h.init(b):(I.stores[I.store]=f,h==null||h.init(Object.fromEntries(Object.entries(I.stores).map(([m,R])=>[m,m===I.store?b:R.getState()])))),f.dispatchFromDevtools&&typeof f.dispatch=="function"){let m=!1;const R=f.dispatch;f.dispatch=(...A)=>{(Do?"production":void 0)!=="production"&&A[0].type==="__setState"&&!m&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),m=!0),R(...A)}}return h.subscribe(m=>{var R;switch(m.type){case"ACTION":if(typeof m.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return bn(m.payload,A=>{if(A.type==="__setState"){if(u===void 0){x(A.state);return}Object.keys(A.state).length!==1&&console.error(`
23
23
  [zustand devtools middleware] Unsupported __setState action format.
24
24
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
25
25
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
26
- `);const P=A.state[f];if(P==null)return;JSON.stringify(u.getState())!==JSON.stringify(P)&&x(P);return}u.dispatchFromDevtools&&typeof u.dispatch=="function"&&u.dispatch(A)});case"DISPATCH":switch(m.payload.type){case"RESET":return x(b),f===void 0?h==null?void 0:h.init(u.getState()):h==null?void 0:h.init(Mt(c.name));case"COMMIT":if(f===void 0){h==null||h.init(u.getState());return}return h==null?void 0:h.init(Mt(c.name));case"ROLLBACK":return bn(m.state,A=>{if(f===void 0){x(A),h==null||h.init(u.getState());return}x(A[f]),h==null||h.init(Mt(c.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return bn(m.state,A=>{if(f===void 0){x(A);return}JSON.stringify(u.getState())!==JSON.stringify(A[f])&&x(A[f])});case"IMPORT_STATE":{const{nextLiftedState:A}=m.payload,P=(R=A.computedStates.slice(-1)[0])==null?void 0:R.state;if(!P)return;x(f===void 0?P:P[f]),h==null||h.send(null,A);return}case"PAUSE_RECORDING":return B=!B}return}}),b},bn=(r,e)=>{let t;try{t=JSON.parse(r)}catch(s){console.error("[zustand devtools middleware] Could not parse the received json",s)}t!==void 0&&e(t)};var vs=Object.defineProperty,ws=Object.defineProperties,bs=Object.getOwnPropertyDescriptors,Lt=Object.getOwnPropertySymbols,Fo=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,$o=(r,e,t)=>e in r?vs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,at=(r,e)=>{for(var t in e||(e={}))Fo.call(e,t)&&$o(r,t,e[t]);if(Lt)for(var t of Lt(e))Uo.call(e,t)&&$o(r,t,e[t]);return r},Sn=(r,e)=>ws(r,bs(e)),Ss=r=>typeof r=="symbol"?r:r+"",_s=(r,e)=>{var t={};for(var s in r)Fo.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&Lt)for(var s of Lt(r))e.indexOf(s)<0&&Uo.call(r,s)&&(t[s]=r[s]);return t};const jo={roomId:"",participants:{},localParticipant:null,isCalling:!1,isRecording:!1,recordLoading:!1,callStatus:"idle",error:null,callStatusInfo:null,callStatusLoading:!1,callStatusError:null},je=Ie.create()(ms(r=>Sn(at({},jo),{setRoomId:e=>r({roomId:e},!1,"setRoomId"),setLocalParticipant:e=>r({localParticipant:e},!1,"setLocalParticipant"),addParticipant:e=>r(t=>({participants:Sn(at({},t.participants),{[e.userId]:e})}),!1,"addParticipant"),removeParticipant:e=>r(t=>{const s=t.participants,{[e]:u}=s;return{participants:_s(s,[Ss(e)])}},!1,"removeParticipant"),updateParticipant:(e,t)=>r(s=>({participants:Sn(at({},s.participants),{[e]:s.participants[e]?at(at({},s.participants[e]),t):at({userId:e,videoOn:!0,audioOn:!0,screenSharing:!1},t)})}),!1,"updateParticipant"),clearParticipants:()=>r({participants:{}},!1,"clearParticipants"),setCallStatus:e=>r({callStatus:e},!1,"setCallStatus"),setIsCalling:e=>r({isCalling:e},!1,"setIsCalling"),setIsRecording:e=>r({isRecording:e},!1,"setIsRecording"),setRecordLoading:e=>r({recordLoading:e},!1,"setRecordLoading"),setError:(e,t)=>r({error:t||e},!1,"setError"),clearError:()=>r({error:null},!1,"clearError"),setCallStatusInfo:e=>r({callStatusInfo:e},!1,"setCallStatusInfo"),setCallStatusLoading:e=>r({callStatusLoading:e},!1,"setCallStatusLoading"),setCallStatusError:e=>r({callStatusError:e},!1,"setCallStatusError"),resetCall:()=>r(at({},jo),!1,"resetCall")}),{name:"peers-caller-store",enabled:ae.env.NODE_ENV==="development"})),Es=r=>r.participants,qo=r=>Object.keys(r.participants).length,Cs=r=>r.localParticipant,Rs=r=>r.callStatus,Ps=r=>r.callStatus==="connected",Ts=r=>r.error,As=r=>r.callStatusInfo,Is=r=>r.callStatusLoading,Bs=r=>r.callStatusError,ks=r=>{var e;return((e=r.callStatusInfo)==null?void 0:e.canJoin)||!1},Os=r=>{var e;return((e=r.callStatusInfo)==null?void 0:e.hasActiveCall)||!1},xo=r=>je.getState().participants[r],Ms=r=>{const e=xo(r);return!!(e!=null&&e.stream)},Ls=()=>{const r=je.getState();return Object.values(r.participants)},Ns=(r=4)=>qo(je.getState())<r;var Ds=Object.defineProperty,Fs=(r,e,t)=>e in r?Ds(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Us=(r,e,t)=>Fs(r,e+"",t);class Wo{constructor(e){if(Us(this,"store"),e&&typeof e.getState=="function")this.store=e;else{const t=e;this.store={getState:()=>t}}}get state(){return this.store.getState()}}var $s=Object.defineProperty,js=Object.defineProperties,qs=Object.getOwnPropertyDescriptors,Go=Object.getOwnPropertySymbols,xs=Object.prototype.hasOwnProperty,Ws=Object.prototype.propertyIsEnumerable,_n=(r,e,t)=>e in r?$s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,En=(r,e)=>{for(var t in e||(e={}))xs.call(e,t)&&_n(r,t,e[t]);if(Go)for(var t of Go(e))Ws.call(e,t)&&_n(r,t,e[t]);return r},Gs=(r,e)=>js(r,qs(e)),dt=(r,e,t)=>_n(r,typeof e!="symbol"?e+"":e,t),Nt=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});class Cn extends Wo{constructor(e,t={},s=!1){super(je),dt(this,"userId"),dt(this,"mediaStream",null),dt(this,"peerConnections",new Map),dt(this,"remoteStreams",new Map),dt(this,"isLocalParticipant",!1),dt(this,"callbacks"),this.userId=e,this.callbacks=t,this.isLocalParticipant=s;const u={userId:e,videoOn:!0,audioOn:!0,screenSharing:!1};this.isLocalParticipant&&this.state.setLocalParticipant(u),this.state.addParticipant(u)}initialize(e){return Nt(this,null,function*(){var t,s;try{console.log(`[CallParticipant] Initializing participant ${this.userId}`),this.mediaStream=new jn(e);const l={stream:yield this.mediaStream.initialize(),videoElement:this.mediaStream.createVideoElement()};this.updateState(l),console.log(`[CallParticipant] Participant ${this.userId} initialized successfully`)}catch(u){throw console.error(`[CallParticipant] Failed to initialize participant ${this.userId}:`,u),(s=(t=this.callbacks).onError)==null||s.call(t,u),u}})}createPeerConnection(e,t,s){return Nt(this,null,function*(){var u,l;try{if(console.log(`[CallParticipant] Creating peer connection from ${this.userId} to ${e}`),this.peerConnections.has(e)){console.warn(`[CallParticipant] Peer connection to ${e} already exists`);return}const g={onSignal:c=>{var v,h;console.log(`[CallParticipant] Signal from ${this.userId} to ${e}:`,c.type),(h=(v=this.callbacks).onSignal)==null||h.call(v,this.userId,e,c)},onConnect:()=>{var c,v;console.log(`[CallParticipant] ${this.userId} connected to ${e}`),(v=(c=this.callbacks).onPeerConnected)==null||v.call(c,e)},onStream:c=>{var v,h;console.log(`[CallParticipant] Stream received from ${e} by ${this.userId}`),this.remoteStreams.set(e,c),this.state.updateParticipant(e,{stream:c}),(h=(v=this.callbacks).onStreamReceived)==null||h.call(v,e,c)},onClose:()=>{var c,v;console.log(`[CallParticipant] Connection closed between ${this.userId} and ${e}`),this.remoteStreams.delete(e),this.state.updateParticipant(e,{stream:void 0}),(v=(c=this.callbacks).onPeerDisconnected)==null||v.call(c,e)},onError:c=>{var v,h;console.error(`[CallParticipant] Peer connection error between ${this.userId} and ${e}:`,c),(h=(v=this.callbacks).onError)==null||h.call(v,c)}},f=new No(e,Gs(En({},t),{initiator:s}),g);yield f.createConnection(this.getCurrentStream()),this.peerConnections.set(e,f)}catch(g){throw console.error(`[CallParticipant] Failed to create peer connection from ${this.userId} to ${e}:`,g),(l=(u=this.callbacks).onError)==null||l.call(u,g),g}})}getPeerConnection(e){return this.peerConnections.get(e)}signalToPeer(e,t){const s=this.peerConnections.get(e);s?s.signal(t):console.warn(`[CallParticipant] No peer connection found for ${e}`)}toggleAudio(e){this.mediaStream&&(this.mediaStream.toggleAudio(e),this.updateState({audioOn:e}))}toggleVideo(e){this.mediaStream&&(this.mediaStream.toggleVideo(e),this.updateState({videoOn:e}))}startScreenShare(){return Nt(this,null,function*(){var e,t;try{if(!this.mediaStream)throw new Error("Media stream not initialized");console.log(`[CallParticipant] Starting screen share for ${this.userId}`);const s=yield this.mediaStream.startScreenShare(),u=this.mediaStream.getScreenVideoTrack(),l=this.mediaStream.getCameraVideoTrack();if(!u)throw new Error("Failed to get screen video track");for(const[g,f]of this.peerConnections)l?(f.replaceTrack(l,u),console.log(`[CallParticipant] Screen video track replaced for connection with ${g}`)):console.warn(`[CallParticipant] No camera video track to replace for ${g}`);this.updateState({screenSharing:!0,stream:s}),console.log(`[CallParticipant] Screen sharing started for ${this.userId}`)}catch(s){throw console.error(`[CallParticipant] Failed to start screen share for ${this.userId}:`,s),(t=(e=this.callbacks).onError)==null||t.call(e,s),s}})}stopScreenShare(){return Nt(this,null,function*(){var e,t;try{if(!this.mediaStream)throw new Error("Media stream not initialized");console.log(`[CallParticipant] Stopping screen share for ${this.userId}`);const s=this.mediaStream.getScreenVideoTrack();console.log("[CallParticipant] Screen video track found:",!!s);const u=yield this.mediaStream.stopScreenShare(),l=this.mediaStream.getCameraVideoTrack();if(console.log("[CallParticipant] Camera stream:",!!u),console.log("[CallParticipant] Camera video track:",!!l),!l)throw new Error("Failed to get camera video track");for(const[g,f]of this.peerConnections)try{s&&l?(f.replaceTrack(s,l),console.log(`[CallParticipant] Camera video track restored for connection with ${g}`)):(console.log(`[CallParticipant] Updating entire stream for connection with ${g}`),f.addStream(u))}catch(c){console.warn(`[CallParticipant] Failed to replace track for ${g}, trying stream replacement:`,c)}if(this.updateState({screenSharing:!1,stream:u}),this.isLocalParticipant&&this.mediaStream){const g=this.mediaStream.getVideoElement();g&&(g.srcObject=u,console.log(`[CallParticipant] Updated local video element for ${this.userId}`))}console.log(`[CallParticipant] Screen sharing stopped for ${this.userId}`)}catch(s){throw console.error(`[CallParticipant] Failed to stop screen share for ${this.userId}:`,s),(t=(e=this.callbacks).onError)==null||t.call(e,s),s}})}getState(){const e=this.state;return this.isLocalParticipant?e.localParticipant||{userId:this.userId,videoOn:!0,audioOn:!0,screenSharing:!1}:e.participants[this.userId]||{userId:this.userId,videoOn:!0,audioOn:!0,screenSharing:!1}}getUserId(){return this.userId}getMediaStream(){return this.mediaStream}getCurrentStream(){return this.getState().stream}getVideoElement(){return this.getState().videoElement}getRemoteStream(e){return this.remoteStreams.get(e)}getAllRemoteStreams(){return new Map(this.remoteStreams)}getAllPeerConnections(){return new Map(this.peerConnections)}getConnectionStatus(){const e={};for(const[t,s]of this.peerConnections)e[t]=s.isConnected();return e}removePeerConnection(e){const t=this.peerConnections.get(e);t&&(t.destroy(),this.peerConnections.delete(e),this.remoteStreams.delete(e),this.state.updateParticipant(e,{stream:void 0}),console.log(`[CallParticipant] Removed peer connection from ${this.userId} to ${e}`))}updateState(e){var t,s;const u=this.getState();if(Object.keys(e).some(g=>u[g]!==e[g])){const g=En(En({},u),e);this.isLocalParticipant&&this.state.setLocalParticipant(g),this.state.updateParticipant(this.userId,e),(s=(t=this.callbacks).onStateChanged)==null||s.call(t,this.userId,e)}}getDebugInfo(){var e;return{userId:this.userId,state:this.getState(),peerConnections:Array.from(this.peerConnections.keys()),remoteStreams:Array.from(this.remoteStreams.keys()),connectionStatus:this.getConnectionStatus(),mediaStreamInfo:(e=this.mediaStream)==null?void 0:e.getStreamInfo()}}cleanup(){console.log(`[CallParticipant] Cleaning up participant ${this.userId}`),this.state.removeParticipant(this.userId);for(const e of this.peerConnections.values())e.destroy();this.peerConnections.clear(),this.remoteStreams.clear(),this.mediaStream&&(this.mediaStream.cleanup(),this.mediaStream=null),console.log(`[CallParticipant] Participant ${this.userId} cleanup completed`)}}var Rn={exports:{}},Vo;function Vs(){return Vo||(Vo=1,function(r){function e(t,s){var u="Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45";(function(S){typeof RecordRTC=="undefined"&&S&&typeof window=="undefined"&&typeof globalThis!="undefined"&&(globalThis.navigator={userAgent:u,getUserMedia:function(){}},globalThis.console||(globalThis.console={}),(typeof globalThis.console.log=="undefined"||typeof globalThis.console.error=="undefined")&&(globalThis.console.error=globalThis.console.log=globalThis.console.log||function(){console.log(arguments)}),typeof document=="undefined"&&(S.document={documentElement:{appendChild:function(){return""}}},document.createElement=document.captureStream=document.mozCaptureStream=function(){var C={getContext:function(){return C},play:function(){},pause:function(){},drawImage:function(){},toDataURL:function(){return""},style:{}};return C},S.HTMLVideoElement=function(){}),typeof location=="undefined"&&(S.location={protocol:"file:",href:"",hash:""}),typeof screen=="undefined"&&(S.screen={width:0,height:0}),typeof I=="undefined"&&(S.URL={createObjectURL:function(){return""},revokeObjectURL:function(){return""}}),S.window=globalThis)})(typeof globalThis!="undefined"?globalThis:null),s=s||"multi-streams-mixer";var l=[],g=!1,f=document.createElement("canvas"),c=f.getContext("2d");f.style.opacity=0,f.style.position="absolute",f.style.zIndex=-1,f.style.top="-1000em",f.style.left="-1000em",f.className=s,(document.body||document.documentElement).appendChild(f),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0;var v=this,h=window.AudioContext;typeof h=="undefined"&&(typeof webkitAudioContext!="undefined"&&(h=webkitAudioContext),typeof mozAudioContext!="undefined"&&(h=mozAudioContext));var I=window.URL;typeof I=="undefined"&&typeof webkitURL!="undefined"&&(I=webkitURL),typeof navigator!="undefined"&&typeof navigator.getUserMedia=="undefined"&&(typeof navigator.webkitGetUserMedia!="undefined"&&(navigator.getUserMedia=navigator.webkitGetUserMedia),typeof navigator.mozGetUserMedia!="undefined"&&(navigator.getUserMedia=navigator.mozGetUserMedia));var B=window.MediaStream;typeof B=="undefined"&&typeof webkitMediaStream!="undefined"&&(B=webkitMediaStream),typeof B!="undefined"&&typeof B.prototype.stop=="undefined"&&(B.prototype.stop=function(){this.getTracks().forEach(function(S){S.stop()})});var x={};typeof h!="undefined"?x.AudioContext=h:typeof webkitAudioContext!="undefined"&&(x.AudioContext=webkitAudioContext);function b(S,C){"srcObject"in C?C.srcObject=S:"mozSrcObject"in C?C.mozSrcObject=S:C.srcObject=S}this.startDrawingFrames=function(){N()};function N(){if(!g){var S=l.length,C=!1,M=[];if(l.forEach(function(X){X.stream||(X.stream={}),X.stream.fullcanvas?C=X:M.push(X)}),C)f.width=C.stream.width,f.height=C.stream.height;else if(M.length){f.width=S>1?M[0].width*2:M[0].width;var W=1;(S===3||S===4)&&(W=2),(S===5||S===6)&&(W=3),(S===7||S===8)&&(W=4),(S===9||S===10)&&(W=5),f.height=M[0].height*W}else f.width=v.width||360,f.height=v.height||240;C&&C instanceof HTMLVideoElement&&T(C),M.forEach(function(X,re){T(X,re)}),setTimeout(N,v.frameInterval)}}function T(S,C){if(!g){var M=0,W=0,X=S.width,re=S.height;C===1&&(M=S.width),C===2&&(W=S.height),C===3&&(M=S.width,W=S.height),C===4&&(W=S.height*2),C===5&&(M=S.width,W=S.height*2),C===6&&(W=S.height*3),C===7&&(M=S.width,W=S.height*3),typeof S.stream.left!="undefined"&&(M=S.stream.left),typeof S.stream.top!="undefined"&&(W=S.stream.top),typeof S.stream.width!="undefined"&&(X=S.stream.width),typeof S.stream.height!="undefined"&&(re=S.stream.height),c.drawImage(S,M,W,X,re),typeof S.stream.onRender=="function"&&S.stream.onRender(c,M,W,X,re,C)}}function m(){g=!1;var S=R(),C=A();return C&&C.getTracks().filter(function(M){return M.kind==="audio"}).forEach(function(M){S.addTrack(M)}),t.forEach(function(M){M.fullcanvas}),S}function R(){k();var S;"captureStream"in f?S=f.captureStream():"mozCaptureStream"in f?S=f.mozCaptureStream():v.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var C=new B;return S.getTracks().filter(function(M){return M.kind==="video"}).forEach(function(M){C.addTrack(M)}),f.stream=C,C}function A(){x.AudioContextConstructor||(x.AudioContextConstructor=new x.AudioContext),v.audioContext=x.AudioContextConstructor,v.audioSources=[],v.useGainNode===!0&&(v.gainNode=v.audioContext.createGain(),v.gainNode.connect(v.audioContext.destination),v.gainNode.gain.value=0);var S=0;if(t.forEach(function(C){if(C.getTracks().filter(function(W){return W.kind==="audio"}).length){S++;var M=v.audioContext.createMediaStreamSource(C);v.useGainNode===!0&&M.connect(v.gainNode),v.audioSources.push(M)}}),!!S)return v.audioDestination=v.audioContext.createMediaStreamDestination(),v.audioSources.forEach(function(C){C.connect(v.audioDestination)}),v.audioDestination.stream}function P(S){var C=document.createElement("video");return b(S,C),C.className=s,C.muted=!0,C.volume=0,C.width=S.width||v.width||360,C.height=S.height||v.height||240,C.play(),C}this.appendStreams=function(S){if(!S)throw"First parameter is required.";S instanceof Array||(S=[S]),S.forEach(function(C){var M=new B;if(C.getTracks().filter(function(re){return re.kind==="video"}).length){var W=P(C);W.stream=C,l.push(W),M.addTrack(C.getTracks().filter(function(re){return re.kind==="video"})[0])}if(C.getTracks().filter(function(re){return re.kind==="audio"}).length){var X=v.audioContext.createMediaStreamSource(C);v.audioDestination=v.audioContext.createMediaStreamDestination(),X.connect(v.audioDestination),M.addTrack(v.audioDestination.stream.getTracks().filter(function(re){return re.kind==="audio"})[0])}t.push(M)})},this.releaseStreams=function(){l=[],g=!0,v.gainNode&&(v.gainNode.disconnect(),v.gainNode=null),v.audioSources.length&&(v.audioSources.forEach(function(S){S.disconnect()}),v.audioSources=[]),v.audioDestination&&(v.audioDestination.disconnect(),v.audioDestination=null),v.audioContext&&v.audioContext.close(),v.audioContext=null,c.clearRect(0,0,f.width,f.height),f.stream&&(f.stream.stop(),f.stream=null)},this.resetVideoStreams=function(S){S&&!(S instanceof Array)&&(S=[S]),k(S)};function k(S){l=[],S=S||t,S.forEach(function(C){if(C.getTracks().filter(function(W){return W.kind==="video"}).length){var M=P(C);M.stream=C,l.push(M)}})}this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=m}typeof RecordRTC=="undefined"&&(r.exports=e)}(Rn)),Rn.exports}var zs=Vs();const Hs=xt(zs);var Js=Ht();const Ys=xt(Js);class Ks extends Ys{constructor(t,s=navigator.language){super();ze(this,"track",null);ze(this,"trackId",null);ze(this,"recognition",null);ze(this,"recognizing",!1);ze(this,"transcripts",[]);ze(this,"startTime",0);ze(this,"endTime",0);ze(this,"currentStamp",0);ze(this,"start",()=>(this.recognition.start(),this.recognition.stream=this.track,this.recognizing=!0,this.startTime=performance.now(),this));ze(this,"stop",()=>(this.recognition.stop(),this.recognizing=!1,this.endTime=performance.now(),this));("webkitSpeechRecognition"in window||"SpeechRecognition"in window)&&(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.lang=s,this.track=t,this.recognition.onstart=this.emit("start"),this.recognition.onend=()=>this.emit("end"),this.recognition.onresult=u=>{const{results:l,resultIndex:g}=u;let f="";if(l[g].isFinal&&l[g][0].transcript){const c={sentence:l[g][0].transcript,confidence:l[g][0].confidence,timeStamp:this.currentStamp,endTimeStamp:new Date().getTime()};this.transcripts.push(c),this.emit("sentence",c)}else this.currentStamp=new Date().getTime(),f+=l[g][0].transcript,this.emit("interim",{sentence:f,timeStamp:this.currentStamp});this.emit("result",u)})}}var Xs=Object.defineProperty,zo=Object.getOwnPropertySymbols,Zs=Object.prototype.hasOwnProperty,Qs=Object.prototype.propertyIsEnumerable,Pn=(r,e,t)=>e in r?Xs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,el=(r,e)=>{for(var t in e||(e={}))Zs.call(e,t)&&Pn(r,t,e[t]);if(zo)for(var t of zo(e))Qs.call(e,t)&&Pn(r,t,e[t]);return r},pt=(r,e,t)=>Pn(r,typeof e!="symbol"?e+"":e,t),Tn=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});class Ho{constructor(e={},t={}){pt(this,"mixer",null),pt(this,"recorder",null),pt(this,"localTranscriber",null),pt(this,"isRecording",!1),pt(this,"config"),pt(this,"callbacks"),this.config=el({mimeType:"video/webm;codecs=vp8,opus",videoBitsPerSecond:1e6,audioBitsPerSecond:128e3,interval:1e3},e),this.callbacks=t}startRecording(e,t){return Tn(this,null,function*(){var s,u,l,g;try{if(console.log("[CallRecorder] Starting recording with",e.length,"streams"),this.isRecording)throw new Error("Recording already in progress");if(!t)throw new Error("Recording data is required");this.mixer=new Hs(e),this.mixer.frameInterval=1,this.mixer.startDrawingFrames();const f=e[0];f&&f.getAudioTracks().length>0&&(this.localTranscriber=new Ks(f)),MediaRecorder.isTypeSupported(this.config.mimeType)||(console.warn("[CallRecorder] Preferred mime type not supported, falling back to default"),this.config.mimeType="video/webm");const c=this.mixer.getMixedStream();this.recorder=new MediaRecorder(c,{mimeType:this.config.mimeType,videoBitsPerSecond:this.config.videoBitsPerSecond,audioBitsPerSecond:this.config.audioBitsPerSecond}),this.setupRecorderEventHandlers(t),this.recorder.start(this.config.interval),this.isRecording=!0,this.localTranscriber&&this.localTranscriber.start(),(u=(s=this.callbacks).onRecordingStarted)==null||u.call(s,t),console.log("[CallRecorder] Recording started successfully")}catch(f){throw console.error("[CallRecorder] Failed to start recording:",f),(g=(l=this.callbacks).onError)==null||g.call(l,f),f}})}stopRecording(){return Tn(this,null,function*(){var e,t;try{if(console.log("[CallRecorder] Stopping recording"),!this.isRecording||!this.recorder)return console.warn("[CallRecorder] No active recording to stop"),[];this.recorder.stop(),this.isRecording=!1;let s=[];return this.localTranscriber&&(this.localTranscriber.stop(),s=this.localTranscriber.transcripts||[]),this.mixer&&this.mixer.releaseStreams(),console.log("[CallRecorder] Recording stopped successfully"),s}catch(s){return console.error("[CallRecorder] Failed to stop recording:",s),(t=(e=this.callbacks).onError)==null||t.call(e,s),[]}})}resetVideoStreams(e){this.mixer&&(this.mixer.resetVideoStreams(e),console.log("[CallRecorder] Video streams reset"))}setupRecorderEventHandlers(e){this.recorder&&(this.recorder.ondataavailable=t=>{var s,u;t.data&&t.data.size>0&&((u=(s=this.callbacks).onRecordingChunk)==null||u.call(s,t.data,e))},this.recorder.onstart=()=>{console.log("[CallRecorder] MediaRecorder started")},this.recorder.onstop=()=>{var t,s;console.log("[CallRecorder] MediaRecorder stopped"),(s=(t=this.callbacks).onRecordingStopped)==null||s.call(t,e)},this.recorder.onerror=t=>{var s,u;console.error("[CallRecorder] MediaRecorder error:",t),(u=(s=this.callbacks).onError)==null||u.call(s,new Error(`Recording error: ${t}`))})}getRecordingState(){var e,t;return{isRecording:this.isRecording,isTranscribing:this.localTranscriber!==null,transcriptCount:((t=(e=this.localTranscriber)==null?void 0:e.transcripts)==null?void 0:t.length)||0}}getTranscripts(){var e;return((e=this.localTranscriber)==null?void 0:e.transcripts)||[]}static isRecordingSupported(){return typeof MediaRecorder!="undefined"&&typeof MediaRecorder.isTypeSupported=="function"}static isTranscriptionSupported(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}static getSupportedMimeTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=h264,opus","video/webm","video/mp4;codecs=h264,aac","video/mp4"].filter(t=>MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported(t))}cleanup(){return Tn(this,null,function*(){console.log("[CallRecorder] Cleaning up recorder"),this.isRecording&&(yield this.stopRecording()),this.localTranscriber&&(this.localTranscriber.stop(),this.localTranscriber=null),this.mixer&&(this.mixer.releaseStreams(),this.mixer=null),this.recorder=null})}}var tl=Object.defineProperty,rl=Object.defineProperties,nl=Object.getOwnPropertyDescriptors,Jo=Object.getOwnPropertySymbols,il=Object.prototype.hasOwnProperty,ol=Object.prototype.propertyIsEnumerable,An=(r,e,t)=>e in r?tl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,al=(r,e)=>{for(var t in e||(e={}))il.call(e,t)&&An(r,t,e[t]);if(Jo)for(var t of Jo(e))ol.call(e,t)&&An(r,t,e[t]);return r},sl=(r,e)=>rl(r,nl(e)),Ge=(r,e,t)=>An(r,typeof e!="symbol"?e+"":e,t),Le=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});class Yo extends Wo{constructor(e,t={}){if(super(je),Ge(this,"config"),Ge(this,"callbacks"),Ge(this,"socket"),Ge(this,"localParticipant",null),Ge(this,"participants",new Map),Ge(this,"recorder",null),Ge(this,"iceServers",[]),Ge(this,"isInitialized",!1),Ge(this,"listenersSetup",!1),Ge(this,"roomId"),Ge(this,"eventListeners",new Map),this.roomId=e.roomId,!this.roomId)throw new Error("roomId must be provided in config");this.config=sl(al({maxParticipants:4,debug:!1,socketPath:"/apis/video-call",mediaConfig:{video:!0,audio:!0}},e),{roomId:this.roomId}),this.callbacks=t,this.socket=new $n(this.config.socketUrl,this.config.token,this.config.socketPath),this.iceServers=this.config.iceServers||[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}],this.state.setRoomId(this.roomId),console.log("[PeersCaller] Initialized with config:",{roomId:this.roomId,tokenLength:this.config.token.length,maxParticipants:this.config.maxParticipants})}initialize(){return Le(this,null,function*(){try{if(console.log("[PeersCaller] Initializing..."),this.isInitialized){console.warn("[PeersCaller] Already initialized");return}yield this.socket.connect(),yield this.fetchIceServers(),this.setupSocketListeners(),yield this.initializeLocalParticipant(),this.isInitialized=!0,this.state.setCallStatus("idle"),console.log("[PeersCaller] Initialization completed successfully (ready to start/join call)")}catch(e){throw console.error("[PeersCaller] Initialization failed:",e),this.handleError("NETWORK_ERROR",`Failed to initialize: ${e}`),e}})}startCall(){return Le(this,arguments,function*(e=this.config.mediaConfig){var t,s;try{if(console.log("[PeersCaller] Starting call..."),this.isInitialized||(yield this.initialize()),this.localParticipant&&!this.localParticipant.getCurrentStream()){const l={video:e!=null&&e.video&&typeof e.video=="boolean"?e.video:!0,audio:e!=null&&e.audio&&typeof e.audio=="boolean"?e.audio:!0};yield this.localParticipant.initialize(l)}this.state.setIsCalling(!0),this.state.setCallStatus("connecting"),console.log("[PeersCaller] Starting call for room:",this.config.roomId);const u=yield this.socket.startCall(this.config.roomId);if(console.log("[PeersCaller] Received call.start response:",u),u.success)this.state.setCallStatus("connected"),u.participants.forEach(l=>{l!==this.config.userId&&this.handleParticipantJoined(l)}),console.log("[PeersCaller] Call started successfully"),(s=(t=this.callbacks).onCallStarted)==null||s.call(t,u);else{this.state.setIsCalling(!1),this.state.setCallStatus("idle");const l="Failed to start call on server";throw this.handleError("SIGNALING_ERROR",l),console.error("[PeersCaller] Call start failed:",l),new Error(l)}}catch(u){throw console.error("[PeersCaller] Failed to start call:",u),this.handleError("MEDIA_ACCESS_DENIED",`Failed to start call: ${u}`),u}})}joinCall(){return Le(this,arguments,function*(e=this.config.mediaConfig){try{console.log("[PeersCaller] Joining call..."),this.isInitialized||(yield this.initialize());const t=yield this.checkCallStatus();if(!t.hasActiveCall)throw new Error("No active call found");if(!t.canJoin)throw new Error(`Cannot join call: ${t.status==="full"?"Call is full":"Unable to join"}`);if(this.state.setCallStatus("connecting"),this.localParticipant&&!this.localParticipant.getCurrentStream()){const u={video:typeof(e==null?void 0:e.video)=="boolean"?e.video:!0,audio:typeof(e==null?void 0:e.audio)=="boolean"?e.audio:!0};console.log("[PeersCaller] Initializing local media with config:",u),yield this.localParticipant.initialize(u)}console.log("[PeersCaller] Joining call for room:",this.config.roomId);const s=yield this.socket.joinRoom(this.config.roomId);console.log("[PeersCaller] Received call.join response:",s),this.state.setCallStatus("connected"),this.state.setIsCalling(!0),s.participants.forEach(u=>{u!==this.config.userId&&this.handleParticipantJoined(u)}),console.log("[PeersCaller] Joined call successfully")}catch(t){throw console.error("[PeersCaller] Failed to join call:",t),this.state.setCallStatus("idle"),this.handleError("INVALID_ROOM_ID",`Failed to join call: ${t}`),t}})}endCall(){return Le(this,null,function*(){try{console.log("[PeersCaller] Ending call..."),this.recorder&&this.state.isRecording&&(yield this.stopRecording());try{yield this.socket.endCallForAll(this.config.roomId),console.log("[PeersCaller] End call request sent to server")}catch(e){console.warn("[PeersCaller] Failed to notify server of call end:",e)}this.cleanupAllParticipants(),this.state.setIsCalling(!1),this.state.setCallStatus("idle"),this.state.clearParticipants(),console.log("[PeersCaller] Call ended successfully")}catch(e){console.error("[PeersCaller] Error ending call:",e)}})}leaveCall(){return Le(this,null,function*(){try{console.log("[PeersCaller] Leaving call..."),console.log("[PeersCaller] Leaving call for room:",this.config.roomId);const e=yield this.socket.leaveCall(this.config.roomId);if(console.log("[PeersCaller] Received call.leave response:",e),e.success)this.cleanupAllParticipants(),this.state.setIsCalling(!1),this.state.setCallStatus("idle"),this.state.clearParticipants(),console.log("[PeersCaller] Left call successfully");else{const t="Failed to leave call on server";throw this.handleError("SIGNALING_ERROR",t),console.error("[PeersCaller] Call leave failed:",t),new Error(t)}}catch(e){throw console.error("[PeersCaller] Failed to leave call:",e),this.handleError("SIGNALING_ERROR",`Failed to leave call: ${e}`),e}})}toggleAudio(e){this.localParticipant&&(this.localParticipant.toggleAudio(e),this.broadcastStateUpdate({audioOn:e}),console.log(`[PeersCaller] Audio ${e?"enabled":"disabled"}`))}toggleVideo(e){this.localParticipant&&(this.localParticipant.toggleVideo(e),this.broadcastStateUpdate({videoOn:e}),console.log(`[PeersCaller] Video ${e?"enabled":"disabled"}`))}startScreenShare(){return Le(this,null,function*(){try{if(!this.localParticipant)throw new Error("Local participant not initialized");yield this.localParticipant.startScreenShare(),this.broadcastStateUpdate({screenSharing:!0}),console.log("[PeersCaller] Screen sharing started")}catch(e){throw console.error("[PeersCaller] Failed to start screen share:",e),this.handleError("MEDIA_ACCESS_DENIED",`Failed to start screen share: ${e}`),e}})}stopScreenShare(){return Le(this,null,function*(){try{if(!this.localParticipant)throw new Error("Local participant not initialized");yield this.localParticipant.stopScreenShare(),this.broadcastStateUpdate({screenSharing:!1}),console.log("[PeersCaller] Screen sharing stopped")}catch(e){throw console.error("[PeersCaller] Failed to stop screen share:",e),e}})}startRecording(e,t){return Le(this,null,function*(){var s;try{if(console.log("[PeersCaller] Starting recording..."),this.state.isRecording){console.warn("[PeersCaller] Recording already in progress");return}const u=[],l=(s=this.localParticipant)==null?void 0:s.getCurrentStream();l&&u.push(l);for(const g of this.participants.values()){const f=g.getAllRemoteStreams();u.push(...f.values())}if(u.length===0)throw new Error("No streams available for recording");this.recorder=new Ho(t,{onRecordingStarted:g=>{this.socket.startRecording(this.config.roomId,g.id)},onRecordingChunk:(g,f)=>{this.socket.sendRecordingChunk(this.config.roomId,f.id,g)},onRecordingStopped:g=>{this.socket.endRecording(this.config.roomId,g.id)},onTranscriptReceived:g=>{this.socket.sendTranscript(this.config.roomId,g.text)},onError:g=>{this.handleError("RECORDING_FAILED",g.message)}}),yield this.recorder.startRecording(u,e),this.state.setIsRecording(!0),console.log("[PeersCaller] Recording started successfully")}catch(u){throw console.error("[PeersCaller] Failed to start recording:",u),this.handleError("RECORDING_FAILED",`Failed to start recording: ${u}`),u}})}stopRecording(){return Le(this,null,function*(){try{if(console.log("[PeersCaller] Stopping recording..."),!this.recorder||!this.state.isRecording){console.warn("[PeersCaller] No active recording to stop");return}yield this.recorder.stopRecording(),this.state.setIsRecording(!1),console.log("[PeersCaller] Recording stopped successfully")}catch(e){throw console.error("[PeersCaller] Failed to stop recording:",e),e}})}getCallState(){return this.state}getLocalParticipant(){return this.localParticipant}getParticipants(){return new Map(this.participants)}getParticipant(e){return this.participants.get(e)}getDebugInfo(){return{isInitialized:this.isInitialized,localParticipant:this.localParticipant?{userId:this.localParticipant.getUserId(),hasStream:!!this.localParticipant.getCurrentStream(),streamTracks:this.localParticipant.getCurrentStream()?{video:this.localParticipant.getCurrentStream().getVideoTracks().length,audio:this.localParticipant.getCurrentStream().getAudioTracks().length}:null,peerConnections:Array.from(this.localParticipant.getAllPeerConnections().keys()),connectionStatus:this.localParticipant.getConnectionStatus()}:null,remoteParticipants:Array.from(this.participants.keys()),storeState:this.state,socketConnected:this.socket.isConnected()}}cleanup(){console.log("[PeersCaller] Cleaning up..."),this.state.isCalling&&this.endCall(),this.cleanupSocketListeners(),this.cleanupAllParticipants(),this.recorder&&(this.recorder.cleanup(),this.recorder=null),this.socket.disconnect(),this.state.resetCall(),this.isInitialized=!1,console.log("[PeersCaller] Cleanup completed")}initializeLocalParticipant(){return Le(this,null,function*(){this.localParticipant=new Cn(this.config.userId,{onSignal:(e,t,s)=>{this.forwardSignalToServer(e,t,s)},onError:e=>this.handleError("UNKNOWN_ERROR",e.message)},!0),console.log("[PeersCaller] Local participant created (media not initialized yet)")})}setupSocketListeners(){if(this.listenersSetup){console.log("[PeersCaller] Socket listeners already set up, skipping...");return}this.cleanupSocketListeners(),console.log("[PeersCaller] Setting up socket listeners...");const e=T=>{this.handleParticipantJoined(T.userId)};this.socket.on("call.participant.joined",e),this.eventListeners.set("call.participant.joined",e);const t=T=>{this.handleParticipantLeft(T.userId)};this.socket.on("call.participant.left",t),this.eventListeners.set("call.participant.left",t);const s=T=>{T.participants.forEach(m=>{m!==this.config.userId&&this.handleParticipantJoined(m)})};this.socket.on("call.participants",s),this.eventListeners.set("call.participants",s);const u=()=>{this.state.setIsCalling(!1)};this.socket.on("call.left",u),this.eventListeners.set("call.left",u);const l=T=>{var m,R;console.error("[PeersCaller] Server error:",T),(R=(m=this.callbacks).onError)==null||R.call(m,T.error,T.message)};this.socket.on("call.error",l),this.eventListeners.set("call.error",l);const g=T=>{this.handleOffer(T.from,T.offer)};this.socket.on("call.offer",g),this.eventListeners.set("call.offer",g);const f=T=>{this.handleAnswer(T.from,T.answer)};this.socket.on("call.answer",f),this.eventListeners.set("call.answer",f);const c=T=>{this.handleCandidate(T.from,T.candidate)};this.socket.on("call.candidate",c),this.eventListeners.set("call.candidate",c);const v=T=>{this.handleParticipantStateUpdate(T.from,T.state)};this.socket.on("call.state",v),this.eventListeners.set("call.state",v);const h=T=>{this.handleCallEnded(T)};this.socket.on("call.ended",h),this.eventListeners.set("call.ended",h);const I=T=>{this.handleCallStatusChanged(T)};this.socket.on("call.status.changed",I),this.eventListeners.set("call.status.changed",I);const B=T=>{console.log("[PeersCaller] Recording started:",T.recordingId),this.state.setIsRecording(!0)};this.socket.on("call.recording.start",B),this.eventListeners.set("call.recording.start",B);const x=T=>{console.log("[PeersCaller] Recording chunk received:",T)};this.socket.on("call.recording.chunk.received",x),this.eventListeners.set("call.recording.chunk.received",x);const b=T=>{console.log("[PeersCaller] Recording ended:",T.recordingId),this.state.setIsRecording(!1)};this.socket.on("call.recording.end",b),this.eventListeners.set("call.recording.end",b);const N=T=>{console.log("[PeersCaller] Transcript received:",T)};this.socket.on("call.transcript",N),this.eventListeners.set("call.transcript",N),this.listenersSetup=!0,console.log("[PeersCaller] Socket listeners set up successfully")}cleanupSocketListeners(){if(!(!this.listenersSetup&&this.eventListeners.size===0)){console.log("[PeersCaller] Cleaning up socket listeners...");for(const[e,t]of this.eventListeners)this.socket.off(e,t);this.eventListeners.clear(),this.listenersSetup=!1,console.log("[PeersCaller] Socket listeners cleaned up successfully")}}handleParticipantJoined(e){return Le(this,null,function*(){var t,s;try{if(e===this.config.userId||this.participants.has(e))return;if(this.participants.size>=this.config.maxParticipants-1){console.warn("[PeersCaller] Maximum participants reached");return}console.log(`[PeersCaller] Participant ${e} joined`);const u=new Cn(e,{onStreamReceived:(f,c)=>{var v,h;(h=(v=this.callbacks).onStreamReceived)==null||h.call(v,f,c)},onPeerConnected:f=>{console.log(`[PeersCaller] Peer connection established with ${f}`)},onPeerDisconnected:f=>{this.handleParticipantLeft(f)},onSignal:(f,c,v)=>{this.forwardSignalToServer(f,c,v)},onError:f=>{this.handleError("PEER_CONNECTION_FAILED",f.message)}},!1);if(this.participants.set(e,u),!this.localParticipant){console.error("[PeersCaller] Cannot create peer connection - local participant not initialized");return}const l=this.config.userId<e,g={iceServers:this.iceServers,initiator:l};yield this.localParticipant.createPeerConnection(e,g,l),(s=(t=this.callbacks).onParticipantJoined)==null||s.call(t,{userId:e,videoOn:!0,audioOn:!0,screenSharing:!1})}catch(u){console.error(`[PeersCaller] Failed to handle participant ${e} joining:`,u)}})}checkCallStatus(){return Le(this,null,function*(){try{if(console.log("[PeersCaller] Checking call status..."),!this.socket.isConnected())throw new Error("Socket not connected");this.state.setCallStatusLoading(!0),this.state.setCallStatusError(null);const e=yield this.socket.checkCallStatus(this.config.roomId);return this.state.setCallStatusInfo(e),this.state.setCallStatusLoading(!1),console.log("[PeersCaller] Call status received:",e),e}catch(e){console.error("[PeersCaller] Failed to check call status:",e);const t=e instanceof Error?e.message:String(e);throw this.state.setCallStatusLoading(!1),this.state.setCallStatusError(t),this.handleError("NETWORK_ERROR",`Failed to check call status: ${t}`),e}})}handleOffer(e,t){return Le(this,null,function*(){try{if(!this.localParticipant){console.warn(`[PeersCaller] Received offer from ${e} but local participant not initialized`);return}const s=this.localParticipant.getPeerConnection(e);s?(console.log(`[PeersCaller] Processing offer from ${e}`),s.signal({type:"offer",sdp:t.sdp})):console.warn(`[PeersCaller] No peer connection found for offer from ${e}`)}catch(s){console.error(`[PeersCaller] Failed to handle offer from ${e}:`,s)}})}handleAnswer(e,t){return Le(this,null,function*(){try{if(!this.localParticipant){console.warn(`[PeersCaller] Received answer from ${e} but local participant not initialized`);return}const s=this.localParticipant.getPeerConnection(e);s?(console.log(`[PeersCaller] Processing answer from ${e}`),s.signal({type:"answer",sdp:t.sdp})):console.warn(`[PeersCaller] No peer connection found for answer from ${e}`)}catch(s){console.error(`[PeersCaller] Failed to handle answer from ${e}:`,s)}})}handleCandidate(e,t){return Le(this,null,function*(){try{if(!this.localParticipant){console.warn(`[PeersCaller] Received candidate from ${e} but local participant not initialized`);return}const s=this.localParticipant.getPeerConnection(e);s?(console.log(`[PeersCaller] Processing candidate from ${e}`),s.signal({type:"candidate",candidate:t})):console.warn(`[PeersCaller] No peer connection found for candidate from ${e}`)}catch(s){console.error(`[PeersCaller] Failed to handle candidate from ${e}:`,s)}})}handleParticipantStateUpdate(e,t){var s,u;this.state.updateParticipant(e,t),(u=(s=this.callbacks).onParticipantStateChanged)==null||u.call(s,e,t)}handleParticipantLeft(e){var t,s;console.log(`[PeersCaller] Participant ${e} left`);const u=this.participants.get(e);u&&(u.cleanup(),this.participants.delete(e)),this.state.removeParticipant(e),(s=(t=this.callbacks).onParticipantLeft)==null||s.call(t,e)}handleCallEnded(e){return Le(this,null,function*(){var t,s;console.log(`[PeersCaller] Call ended by ${e.endedBy}, reason: ${e.reason}`);try{this.recorder&&this.state.isRecording&&(yield this.stopRecording()),this.cleanupAllParticipants(),this.state.setIsCalling(!1),this.state.setCallStatus("idle"),this.state.clearParticipants(),(s=(t=this.callbacks).onCallEnded)==null||s.call(t,e),console.log("[PeersCaller] Call ended cleanup completed")}catch(u){console.error("[PeersCaller] Error handling call ended:",u)}})}broadcastStateUpdate(e){for(const t of this.participants.keys())this.socket.sendStateUpdate(t,e,this.config.roomId)}handleCallStatusChanged(e){var t,s;console.log("[PeersCaller] Call status changed:",e),this.state.setCallStatusInfo(e),(s=(t=this.callbacks).onCallStatusChanged)==null||s.call(t,e)}cleanupAllParticipants(){for(const e of this.participants.values())e.cleanup();this.participants.clear(),this.localParticipant&&(this.localParticipant.cleanup(),this.localParticipant=null)}handleError(e,t){var s,u;console.error(`[PeersCaller] ${e}: ${t}`),this.state.setError(e,t),(u=(s=this.callbacks).onError)==null||u.call(s,e,t)}fetchIceServers(){return Le(this,null,function*(){try{console.log("[PeersCaller] Fetching ICE servers from backend...");const e=yield this.socket.getIceServers(this.roomId);if(e.error){console.warn("[PeersCaller] Failed to fetch ICE servers from backend:",e.error),console.log("[PeersCaller] Using default ICE servers");return}e.iceServers&&e.iceServers.length>0?this.iceServers=e.iceServers:console.log("[PeersCaller] No ICE servers received from backend, using defaults")}catch(e){console.warn("[PeersCaller] Error fetching ICE servers:",e)}})}forwardSignalToServer(e,t,s){try{switch(console.log(`[PeersCaller] Forwarding signal from ${e} to ${t}:`,s.type),s.type){case"offer":this.socket.sendOffer(t,s,this.config.roomId);break;case"answer":this.socket.sendAnswer(t,s,this.config.roomId);break;case"candidate":this.socket.sendCandidate(t,s.candidate,this.config.roomId);break;case"renegotiate":console.log(`[PeersCaller] Renegotiation signal from ${e} to ${t} - handled locally`);break;default:console.warn(`[PeersCaller] Unknown signal type: ${s.type} - this may indicate a new signal type that needs handling`),this.config.debug&&console.log("[PeersCaller] Unknown signal data:",s);break}}catch(u){console.error(`[PeersCaller] Failed to forward signal from ${e} to ${t}:`,u),this.handleError("SIGNALING_ERROR",`Failed to forward signal: ${u}`)}}}var Xe=(r,e,t)=>new Promise((s,u)=>{var l=c=>{try{f(t.next(c))}catch(v){u(v)}},g=c=>{try{f(t.throw(c))}catch(v){u(v)}},f=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);f((t=t.apply(r,e)).next())});function ll(r){const[e,t]=ue.useState(null),[s,u]=ue.useState(!1),l=ue.useRef(!1),g=je(C=>C),f=Object.values(je(C=>C.participants)),c=je(C=>C.localParticipant),v=je(C=>C.callStatus==="connected"),h=je(C=>C.isRecording),I=je(C=>C.error),B=ue.useCallback(()=>Xe(null,null,function*(){if(!(l.current||e))try{l.current=!0;const C=new Yo(r,r.callbacks);yield C.initialize(),t(C),u(!0)}catch(C){throw console.error("[useVideoCall] Failed to initialize:",C),l.current=!1,C}}),[r,e]),x=ue.useCallback(C=>Xe(null,null,function*(){if(!e){yield B();return}return e.startCall(C)}),[e,B]),b=ue.useCallback(C=>Xe(null,null,function*(){if(!e){yield B();return}return e.joinCall(C)}),[e,B]),N=ue.useCallback(()=>{e==null||e.endCall()},[e]),T=ue.useCallback(C=>{e==null||e.toggleAudio(C)},[e]),m=ue.useCallback(C=>{e==null||e.toggleVideo(C)},[e]),R=ue.useCallback(()=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.startScreenShare()}),[e]),A=ue.useCallback(()=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.stopScreenShare()}),[e]),P=ue.useCallback(C=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.startRecording(C)}),[e]),k=ue.useCallback(()=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.stopRecording()}),[e]),S=ue.useCallback(()=>{e&&(e.cleanup(),t(null),u(!1),l.current=!1)},[e]);return ue.useEffect(()=>{r.autoInitialize&&!s&&!l.current&&B().catch(console.error)},[r.autoInitialize,s,B]),ue.useEffect(()=>()=>{S()},[S]),{initialize:B,startCall:x,joinCall:b,endCall:N,toggleAudio:T,toggleVideo:m,startScreenShare:R,stopScreenShare:A,startRecording:P,stopRecording:k,callState:g,participants:f,localParticipant:c,isConnected:v,isRecording:h,error:I,cleanup:S,peersCaller:e}}function cl(r){const[e,t]=ue.useState(null),[s,u]=ue.useState(null),l=je(g=>g.participants[r]);return ue.useEffect(()=>{var g;if(l!=null&&l.stream){if(u(l.stream),!e){const f=document.createElement("video");f.autoplay=!0,f.playsInline=!0,f.muted=r===((g=je.getState().localParticipant)==null?void 0:g.userId),t(f)}e&&(e.srcObject=l.stream)}},[l==null?void 0:l.stream,r,e]),ue.useEffect(()=>()=>{e&&(e.srcObject=null)},[e]),{videoElement:e,stream:s,participant:l}}function ul(){const r=je();return{roomId:r.roomId,participants:r.participants,localParticipant:r.localParticipant,isCalling:r.isCalling,isRecording:r.isRecording,recordLoading:r.recordLoading,callStatus:r.callStatus,error:r.error,participantCount:Object.keys(r.participants).length,isConnected:r.callStatus==="connected",hasError:!!r.error}}function fl(){const[r,e]=ue.useState({videoDevices:[],audioDevices:[]}),[t,s]=ue.useState({camera:null,microphone:null}),u=ue.useCallback(()=>Xe(null,null,function*(){try{const f=yield navigator.mediaDevices.enumerateDevices();e({videoDevices:f.filter(c=>c.kind==="videoinput"),audioDevices:f.filter(c=>c.kind==="audioinput")})}catch(f){console.error("[useMediaDevices] Failed to get devices:",f)}}),[]),l=ue.useCallback(()=>Xe(null,null,function*(){try{if("permissions"in navigator){const f=yield navigator.permissions.query({name:"camera"}),c=yield navigator.permissions.query({name:"microphone"});s({camera:f.state,microphone:c.state})}}catch(f){console.error("[useMediaDevices] Failed to check permissions:",f)}}),[]),g=ue.useCallback(()=>Xe(null,null,function*(){try{return(yield navigator.mediaDevices.getUserMedia({video:!0,audio:!0})).getTracks().forEach(c=>c.stop()),yield l(),yield u(),!0}catch(f){return console.error("[useMediaDevices] Failed to request permissions:",f),!1}}),[l,u]);return ue.useEffect(()=>{var f;u(),l();const c=()=>{u()};return(f=navigator.mediaDevices)==null||f.addEventListener("devicechange",c),()=>{var v;(v=navigator.mediaDevices)==null||v.removeEventListener("devicechange",c)}},[u,l]),{devices:r,permissions:t,getDevices:u,checkPermissions:l,requestPermissions:g}}function hl(){const[r,e]=ue.useState({webRTC:!1,getUserMedia:!1,getDisplayMedia:!1,mediaRecorder:!1,speechRecognition:!1});return ue.useEffect(()=>{e({webRTC:!!window.RTCPeerConnection,getUserMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),getDisplayMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia),mediaRecorder:typeof MediaRecorder!="undefined",speechRecognition:!!(window.SpeechRecognition||window.webkitSpeechRecognition)})},[]),{support:r,isSupported:Object.values(r).every(Boolean),unsupportedFeatures:Object.entries(r).filter(([,t])=>!t).map(([t])=>t)}}function dl(r=""){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return r?`${r}_${e}_${t}`:`${e}_${t}`}const pl=()=>`peer_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gl=r=>!r||typeof r!="string"?!1:/^peer_\d+_[a-z0-9]{1,9}$/.test(r),yl=r=>{var e,t;return{video:(e=r.video)!=null?e:!0,audio:(t=r.audio)!=null?t:!0}};function ml(r,e,t){const s=`[${r}] ${e}`,u=new Error(s);return t&&(u.details=t),u}function vl(){const r={getUserMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),getDisplayMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia),RTCPeerConnection:!!window.RTCPeerConnection,MediaRecorder:typeof MediaRecorder!="undefined",WebSocket:typeof WebSocket!="undefined"},e=Object.entries(r).filter(([,t])=>!t).map(([t])=>t);return{supported:e.length===0,features:r,missingFeatures:e}}const wl=()=>{try{return typeof window!="undefined"&&typeof window.RTCPeerConnection!="undefined"&&typeof navigator!="undefined"&&typeof navigator.mediaDevices!="undefined"&&typeof navigator.mediaDevices.getUserMedia!="undefined"}catch(r){return!1}};function bl(){return[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"},{urls:"stun:stun2.l.google.com:19302"},{urls:"stun:stun3.l.google.com:19302"}]}te.CallMediaStream=jn,te.CallParticipant=Cn,te.CallPeerConnection=No,te.CallRecorder=Ho,te.CallSocket=$n,te.PeersCaller=Yo,te.canAcceptMoreParticipants=Ns,te.checkWebRTCSupport=vl,te.formatError=ml,te.formatMediaConstraints=yl,te.generateId=dl,te.generatePeerId=pl,te.getDefaultIceServers=bl,te.getParticipant=xo,te.getParticipantList=Ls,te.isParticipantConnected=Ms,te.isValidPeerId=gl,te.isWebRTCSupported=wl,te.selectCallStatus=Rs,te.selectCallStatusError=Bs,te.selectCallStatusInfo=As,te.selectCallStatusLoading=Is,te.selectCanJoinCall=ks,te.selectError=Ts,te.selectIsCallActive=Os,te.selectIsConnected=Ps,te.selectLocalParticipant=Cs,te.selectParticipantCount=qo,te.selectParticipants=Es,te.useBrowserSupport=hl,te.useCallState=ul,te.useCallStore=je,te.useMediaDevices=fl,te.useParticipantVideo=cl,te.useVideoCall=ll,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})});
26
+ `);const P=A.state[u];if(P==null)return;JSON.stringify(f.getState())!==JSON.stringify(P)&&x(P);return}f.dispatchFromDevtools&&typeof f.dispatch=="function"&&f.dispatch(A)});case"DISPATCH":switch(m.payload.type){case"RESET":return x(b),u===void 0?h==null?void 0:h.init(f.getState()):h==null?void 0:h.init(Mt(c.name));case"COMMIT":if(u===void 0){h==null||h.init(f.getState());return}return h==null?void 0:h.init(Mt(c.name));case"ROLLBACK":return bn(m.state,A=>{if(u===void 0){x(A),h==null||h.init(f.getState());return}x(A[u]),h==null||h.init(Mt(c.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return bn(m.state,A=>{if(u===void 0){x(A);return}JSON.stringify(f.getState())!==JSON.stringify(A[u])&&x(A[u])});case"IMPORT_STATE":{const{nextLiftedState:A}=m.payload,P=(R=A.computedStates.slice(-1)[0])==null?void 0:R.state;if(!P)return;x(u===void 0?P:P[u]),h==null||h.send(null,A);return}case"PAUSE_RECORDING":return B=!B}return}}),b},bn=(r,e)=>{let t;try{t=JSON.parse(r)}catch(s){console.error("[zustand devtools middleware] Could not parse the received json",s)}t!==void 0&&e(t)};var vs=Object.defineProperty,ws=Object.defineProperties,bs=Object.getOwnPropertyDescriptors,Lt=Object.getOwnPropertySymbols,Fo=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,$o=(r,e,t)=>e in r?vs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,at=(r,e)=>{for(var t in e||(e={}))Fo.call(e,t)&&$o(r,t,e[t]);if(Lt)for(var t of Lt(e))Uo.call(e,t)&&$o(r,t,e[t]);return r},Sn=(r,e)=>ws(r,bs(e)),Ss=r=>typeof r=="symbol"?r:r+"",_s=(r,e)=>{var t={};for(var s in r)Fo.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&Lt)for(var s of Lt(r))e.indexOf(s)<0&&Uo.call(r,s)&&(t[s]=r[s]);return t};const jo={roomId:"",participants:{},localParticipant:null,isCalling:!1,isRecording:!1,recordLoading:!1,callStatus:"idle",error:null,callStatusInfo:null,callStatusLoading:!1,callStatusError:null},je=Ie.create()(ms(r=>Sn(at({},jo),{setRoomId:e=>r({roomId:e},!1,"setRoomId"),setLocalParticipant:e=>r({localParticipant:e},!1,"setLocalParticipant"),addParticipant:e=>r(t=>({participants:Sn(at({},t.participants),{[e.userId]:e})}),!1,"addParticipant"),removeParticipant:e=>r(t=>{const s=t.participants,{[e]:f}=s;return{participants:_s(s,[Ss(e)])}},!1,"removeParticipant"),updateParticipant:(e,t)=>r(s=>({participants:Sn(at({},s.participants),{[e]:s.participants[e]?at(at({},s.participants[e]),t):at({userId:e,videoOn:!0,audioOn:!0,screenSharing:!1},t)})}),!1,"updateParticipant"),clearParticipants:()=>r({participants:{}},!1,"clearParticipants"),setCallStatus:e=>r({callStatus:e},!1,"setCallStatus"),setIsCalling:e=>r({isCalling:e},!1,"setIsCalling"),setIsRecording:e=>r({isRecording:e},!1,"setIsRecording"),setRecordLoading:e=>r({recordLoading:e},!1,"setRecordLoading"),setError:(e,t)=>r({error:t||e},!1,"setError"),clearError:()=>r({error:null},!1,"clearError"),setCallStatusInfo:e=>r({callStatusInfo:e},!1,"setCallStatusInfo"),setCallStatusLoading:e=>r({callStatusLoading:e},!1,"setCallStatusLoading"),setCallStatusError:e=>r({callStatusError:e},!1,"setCallStatusError"),resetCall:()=>r(at({},jo),!1,"resetCall")}),{name:"peers-caller-store",enabled:ae.env.NODE_ENV==="development"})),Es=r=>r.participants,qo=r=>Object.keys(r.participants).length,Cs=r=>r.localParticipant,Rs=r=>r.callStatus,Ps=r=>r.callStatus==="connected",Ts=r=>r.error,As=r=>r.callStatusInfo,Is=r=>r.callStatusLoading,Bs=r=>r.callStatusError,ks=r=>{var e;return((e=r.callStatusInfo)==null?void 0:e.canJoin)||!1},Os=r=>{var e;return((e=r.callStatusInfo)==null?void 0:e.hasActiveCall)||!1},xo=r=>je.getState().participants[r],Ms=r=>{const e=xo(r);return!!(e!=null&&e.stream)},Ls=()=>{const r=je.getState();return Object.values(r.participants)},Ns=(r=4)=>qo(je.getState())<r;var Ds=Object.defineProperty,Fs=(r,e,t)=>e in r?Ds(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Us=(r,e,t)=>Fs(r,e+"",t);class Wo{constructor(e){if(Us(this,"store"),e&&typeof e.getState=="function")this.store=e;else{const t=e;this.store={getState:()=>t}}}get state(){return this.store.getState()}}var $s=Object.defineProperty,js=Object.defineProperties,qs=Object.getOwnPropertyDescriptors,Go=Object.getOwnPropertySymbols,xs=Object.prototype.hasOwnProperty,Ws=Object.prototype.propertyIsEnumerable,_n=(r,e,t)=>e in r?$s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,En=(r,e)=>{for(var t in e||(e={}))xs.call(e,t)&&_n(r,t,e[t]);if(Go)for(var t of Go(e))Ws.call(e,t)&&_n(r,t,e[t]);return r},Gs=(r,e)=>js(r,qs(e)),dt=(r,e,t)=>_n(r,typeof e!="symbol"?e+"":e,t),Nt=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});class Cn extends Wo{constructor(e,t={},s=!1){super(je),dt(this,"userId"),dt(this,"mediaStream",null),dt(this,"peerConnections",new Map),dt(this,"remoteStreams",new Map),dt(this,"isLocalParticipant",!1),dt(this,"callbacks"),this.userId=e,this.callbacks=t,this.isLocalParticipant=s;const f={userId:e,videoOn:!0,audioOn:!0,screenSharing:!1};this.isLocalParticipant&&this.state.setLocalParticipant(f),this.state.addParticipant(f)}initialize(e){return Nt(this,null,function*(){var t,s;try{console.log(`[CallParticipant] Initializing participant ${this.userId}`),this.mediaStream=new jn(e);const l={stream:yield this.mediaStream.initialize(),videoElement:this.mediaStream.createVideoElement()};this.updateState(l),console.log(`[CallParticipant] Participant ${this.userId} initialized successfully`)}catch(f){throw console.error(`[CallParticipant] Failed to initialize participant ${this.userId}:`,f),(s=(t=this.callbacks).onError)==null||s.call(t,f),f}})}createPeerConnection(e,t,s){return Nt(this,null,function*(){var f,l;try{if(console.log(`[CallParticipant] Creating peer connection from ${this.userId} to ${e}`),this.peerConnections.has(e)){console.warn(`[CallParticipant] Peer connection to ${e} already exists`);return}const g={onSignal:c=>{var v,h;console.log(`[CallParticipant] Signal from ${this.userId} to ${e}:`,c.type),(h=(v=this.callbacks).onSignal)==null||h.call(v,this.userId,e,c)},onConnect:()=>{var c,v;console.log(`[CallParticipant] ${this.userId} connected to ${e}`),(v=(c=this.callbacks).onPeerConnected)==null||v.call(c,e)},onStream:c=>{var v,h;console.log(`[CallParticipant] Stream received from ${e} by ${this.userId}`),this.remoteStreams.set(e,c),this.state.updateParticipant(e,{stream:c}),(h=(v=this.callbacks).onStreamReceived)==null||h.call(v,e,c)},onClose:()=>{var c,v;console.log(`[CallParticipant] Connection closed between ${this.userId} and ${e}`),this.remoteStreams.delete(e),this.state.updateParticipant(e,{stream:void 0}),(v=(c=this.callbacks).onPeerDisconnected)==null||v.call(c,e)},onError:c=>{var v,h;console.error(`[CallParticipant] Peer connection error between ${this.userId} and ${e}:`,c),(h=(v=this.callbacks).onError)==null||h.call(v,c)}},u=new No(e,Gs(En({},t),{initiator:s}),g);yield u.createConnection(this.getCurrentStream()),this.peerConnections.set(e,u)}catch(g){throw console.error(`[CallParticipant] Failed to create peer connection from ${this.userId} to ${e}:`,g),(l=(f=this.callbacks).onError)==null||l.call(f,g),g}})}getPeerConnection(e){return this.peerConnections.get(e)}signalToPeer(e,t){const s=this.peerConnections.get(e);s?s.signal(t):console.warn(`[CallParticipant] No peer connection found for ${e}`)}toggleAudio(e){this.mediaStream&&(this.mediaStream.toggleAudio(e),this.updateState({audioOn:e}))}toggleVideo(e){this.mediaStream&&(this.mediaStream.toggleVideo(e),this.updateState({videoOn:e}))}startScreenShare(){return Nt(this,null,function*(){var e,t;try{if(!this.mediaStream)throw new Error("Media stream not initialized");console.log(`[CallParticipant] Starting screen share for ${this.userId}`);const s=yield this.mediaStream.startScreenShare(),f=this.mediaStream.getScreenVideoTrack(),l=this.mediaStream.getCameraVideoTrack();if(!f)throw new Error("Failed to get screen video track");for(const[g,u]of this.peerConnections)l?(u.replaceTrack(l,f),console.log(`[CallParticipant] Screen video track replaced for connection with ${g}`)):console.warn(`[CallParticipant] No camera video track to replace for ${g}`);this.updateState({screenSharing:!0,stream:s}),console.log(`[CallParticipant] Screen sharing started for ${this.userId}`)}catch(s){throw console.error(`[CallParticipant] Failed to start screen share for ${this.userId}:`,s),(t=(e=this.callbacks).onError)==null||t.call(e,s),s}})}stopScreenShare(){return Nt(this,null,function*(){var e,t;try{if(!this.mediaStream)throw new Error("Media stream not initialized");console.log(`[CallParticipant] Stopping screen share for ${this.userId}`);const s=this.mediaStream.getScreenVideoTrack();console.log("[CallParticipant] Screen video track found:",!!s);const f=yield this.mediaStream.stopScreenShare(),l=this.mediaStream.getCameraVideoTrack();if(console.log("[CallParticipant] Camera stream:",!!f),console.log("[CallParticipant] Camera video track:",!!l),!l)throw new Error("Failed to get camera video track");for(const[g,u]of this.peerConnections)try{s&&l?(u.replaceTrack(s,l),console.log(`[CallParticipant] Camera video track restored for connection with ${g}`)):(console.log(`[CallParticipant] Updating entire stream for connection with ${g}`),u.addStream(f))}catch(c){console.warn(`[CallParticipant] Failed to replace track for ${g}, trying stream replacement:`,c)}if(this.updateState({screenSharing:!1,stream:f}),this.isLocalParticipant&&this.mediaStream){const g=this.mediaStream.getVideoElement();g&&(g.srcObject=f,console.log(`[CallParticipant] Updated local video element for ${this.userId}`))}console.log(`[CallParticipant] Screen sharing stopped for ${this.userId}`)}catch(s){throw console.error(`[CallParticipant] Failed to stop screen share for ${this.userId}:`,s),(t=(e=this.callbacks).onError)==null||t.call(e,s),s}})}getState(){const e=this.state;return this.isLocalParticipant?e.localParticipant||{userId:this.userId,videoOn:!0,audioOn:!0,screenSharing:!1}:e.participants[this.userId]||{userId:this.userId,videoOn:!0,audioOn:!0,screenSharing:!1}}getUserId(){return this.userId}getMediaStream(){return this.mediaStream}getCurrentStream(){return this.getState().stream}getVideoElement(){return this.getState().videoElement}getRemoteStream(e){return this.remoteStreams.get(e)}getAllRemoteStreams(){return new Map(this.remoteStreams)}getAllPeerConnections(){return new Map(this.peerConnections)}getConnectionStatus(){const e={};for(const[t,s]of this.peerConnections)e[t]=s.isConnected();return e}removePeerConnection(e){const t=this.peerConnections.get(e);t&&(t.destroy(),this.peerConnections.delete(e),this.remoteStreams.delete(e),this.state.updateParticipant(e,{stream:void 0}),console.log(`[CallParticipant] Removed peer connection from ${this.userId} to ${e}`))}updateState(e){var t,s;const f=this.getState();if(Object.keys(e).some(g=>f[g]!==e[g])){const g=En(En({},f),e);this.isLocalParticipant&&this.state.setLocalParticipant(g),this.state.updateParticipant(this.userId,e),(s=(t=this.callbacks).onStateChanged)==null||s.call(t,this.userId,e)}}getDebugInfo(){var e;return{userId:this.userId,state:this.getState(),peerConnections:Array.from(this.peerConnections.keys()),remoteStreams:Array.from(this.remoteStreams.keys()),connectionStatus:this.getConnectionStatus(),mediaStreamInfo:(e=this.mediaStream)==null?void 0:e.getStreamInfo()}}cleanup(){console.log(`[CallParticipant] Cleaning up participant ${this.userId}`),this.state.removeParticipant(this.userId);for(const e of this.peerConnections.values())e.destroy();this.peerConnections.clear(),this.remoteStreams.clear(),this.mediaStream&&(this.mediaStream.cleanup(),this.mediaStream=null),console.log(`[CallParticipant] Participant ${this.userId} cleanup completed`)}}var Rn={exports:{}},Vo;function Vs(){return Vo||(Vo=1,function(r){function e(t,s){var f="Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45";(function(S){typeof RecordRTC=="undefined"&&S&&typeof window=="undefined"&&typeof globalThis!="undefined"&&(globalThis.navigator={userAgent:f,getUserMedia:function(){}},globalThis.console||(globalThis.console={}),(typeof globalThis.console.log=="undefined"||typeof globalThis.console.error=="undefined")&&(globalThis.console.error=globalThis.console.log=globalThis.console.log||function(){console.log(arguments)}),typeof document=="undefined"&&(S.document={documentElement:{appendChild:function(){return""}}},document.createElement=document.captureStream=document.mozCaptureStream=function(){var C={getContext:function(){return C},play:function(){},pause:function(){},drawImage:function(){},toDataURL:function(){return""},style:{}};return C},S.HTMLVideoElement=function(){}),typeof location=="undefined"&&(S.location={protocol:"file:",href:"",hash:""}),typeof screen=="undefined"&&(S.screen={width:0,height:0}),typeof I=="undefined"&&(S.URL={createObjectURL:function(){return""},revokeObjectURL:function(){return""}}),S.window=globalThis)})(typeof globalThis!="undefined"?globalThis:null),s=s||"multi-streams-mixer";var l=[],g=!1,u=document.createElement("canvas"),c=u.getContext("2d");u.style.opacity=0,u.style.position="absolute",u.style.zIndex=-1,u.style.top="-1000em",u.style.left="-1000em",u.className=s,(document.body||document.documentElement).appendChild(u),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0;var v=this,h=window.AudioContext;typeof h=="undefined"&&(typeof webkitAudioContext!="undefined"&&(h=webkitAudioContext),typeof mozAudioContext!="undefined"&&(h=mozAudioContext));var I=window.URL;typeof I=="undefined"&&typeof webkitURL!="undefined"&&(I=webkitURL),typeof navigator!="undefined"&&typeof navigator.getUserMedia=="undefined"&&(typeof navigator.webkitGetUserMedia!="undefined"&&(navigator.getUserMedia=navigator.webkitGetUserMedia),typeof navigator.mozGetUserMedia!="undefined"&&(navigator.getUserMedia=navigator.mozGetUserMedia));var B=window.MediaStream;typeof B=="undefined"&&typeof webkitMediaStream!="undefined"&&(B=webkitMediaStream),typeof B!="undefined"&&typeof B.prototype.stop=="undefined"&&(B.prototype.stop=function(){this.getTracks().forEach(function(S){S.stop()})});var x={};typeof h!="undefined"?x.AudioContext=h:typeof webkitAudioContext!="undefined"&&(x.AudioContext=webkitAudioContext);function b(S,C){"srcObject"in C?C.srcObject=S:"mozSrcObject"in C?C.mozSrcObject=S:C.srcObject=S}this.startDrawingFrames=function(){N()};function N(){if(!g){var S=l.length,C=!1,M=[];if(l.forEach(function(X){X.stream||(X.stream={}),X.stream.fullcanvas?C=X:M.push(X)}),C)u.width=C.stream.width,u.height=C.stream.height;else if(M.length){u.width=S>1?M[0].width*2:M[0].width;var W=1;(S===3||S===4)&&(W=2),(S===5||S===6)&&(W=3),(S===7||S===8)&&(W=4),(S===9||S===10)&&(W=5),u.height=M[0].height*W}else u.width=v.width||360,u.height=v.height||240;C&&C instanceof HTMLVideoElement&&T(C),M.forEach(function(X,re){T(X,re)}),setTimeout(N,v.frameInterval)}}function T(S,C){if(!g){var M=0,W=0,X=S.width,re=S.height;C===1&&(M=S.width),C===2&&(W=S.height),C===3&&(M=S.width,W=S.height),C===4&&(W=S.height*2),C===5&&(M=S.width,W=S.height*2),C===6&&(W=S.height*3),C===7&&(M=S.width,W=S.height*3),typeof S.stream.left!="undefined"&&(M=S.stream.left),typeof S.stream.top!="undefined"&&(W=S.stream.top),typeof S.stream.width!="undefined"&&(X=S.stream.width),typeof S.stream.height!="undefined"&&(re=S.stream.height),c.drawImage(S,M,W,X,re),typeof S.stream.onRender=="function"&&S.stream.onRender(c,M,W,X,re,C)}}function m(){g=!1;var S=R(),C=A();return C&&C.getTracks().filter(function(M){return M.kind==="audio"}).forEach(function(M){S.addTrack(M)}),t.forEach(function(M){M.fullcanvas}),S}function R(){k();var S;"captureStream"in u?S=u.captureStream():"mozCaptureStream"in u?S=u.mozCaptureStream():v.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var C=new B;return S.getTracks().filter(function(M){return M.kind==="video"}).forEach(function(M){C.addTrack(M)}),u.stream=C,C}function A(){x.AudioContextConstructor||(x.AudioContextConstructor=new x.AudioContext),v.audioContext=x.AudioContextConstructor,v.audioSources=[],v.useGainNode===!0&&(v.gainNode=v.audioContext.createGain(),v.gainNode.connect(v.audioContext.destination),v.gainNode.gain.value=0);var S=0;if(t.forEach(function(C){if(C.getTracks().filter(function(W){return W.kind==="audio"}).length){S++;var M=v.audioContext.createMediaStreamSource(C);v.useGainNode===!0&&M.connect(v.gainNode),v.audioSources.push(M)}}),!!S)return v.audioDestination=v.audioContext.createMediaStreamDestination(),v.audioSources.forEach(function(C){C.connect(v.audioDestination)}),v.audioDestination.stream}function P(S){var C=document.createElement("video");return b(S,C),C.className=s,C.muted=!0,C.volume=0,C.width=S.width||v.width||360,C.height=S.height||v.height||240,C.play(),C}this.appendStreams=function(S){if(!S)throw"First parameter is required.";S instanceof Array||(S=[S]),S.forEach(function(C){var M=new B;if(C.getTracks().filter(function(re){return re.kind==="video"}).length){var W=P(C);W.stream=C,l.push(W),M.addTrack(C.getTracks().filter(function(re){return re.kind==="video"})[0])}if(C.getTracks().filter(function(re){return re.kind==="audio"}).length){var X=v.audioContext.createMediaStreamSource(C);v.audioDestination=v.audioContext.createMediaStreamDestination(),X.connect(v.audioDestination),M.addTrack(v.audioDestination.stream.getTracks().filter(function(re){return re.kind==="audio"})[0])}t.push(M)})},this.releaseStreams=function(){l=[],g=!0,v.gainNode&&(v.gainNode.disconnect(),v.gainNode=null),v.audioSources.length&&(v.audioSources.forEach(function(S){S.disconnect()}),v.audioSources=[]),v.audioDestination&&(v.audioDestination.disconnect(),v.audioDestination=null),v.audioContext&&v.audioContext.close(),v.audioContext=null,c.clearRect(0,0,u.width,u.height),u.stream&&(u.stream.stop(),u.stream=null)},this.resetVideoStreams=function(S){S&&!(S instanceof Array)&&(S=[S]),k(S)};function k(S){l=[],S=S||t,S.forEach(function(C){if(C.getTracks().filter(function(W){return W.kind==="video"}).length){var M=P(C);M.stream=C,l.push(M)}})}this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=m}typeof RecordRTC=="undefined"&&(r.exports=e)}(Rn)),Rn.exports}var zs=Vs();const Hs=xt(zs);var Js=Ht();const Ys=xt(Js);class Ks extends Ys{constructor(t,s=navigator.language){super();ze(this,"track",null);ze(this,"trackId",null);ze(this,"recognition",null);ze(this,"recognizing",!1);ze(this,"transcripts",[]);ze(this,"startTime",0);ze(this,"endTime",0);ze(this,"currentStamp",0);ze(this,"start",()=>(this.recognition.start(),this.recognition.stream=this.track,this.recognizing=!0,this.startTime=performance.now(),this));ze(this,"stop",()=>(this.recognition.stop(),this.recognizing=!1,this.endTime=performance.now(),this));("webkitSpeechRecognition"in window||"SpeechRecognition"in window)&&(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.lang=s,this.track=t,this.recognition.onstart=this.emit("start"),this.recognition.onend=()=>this.emit("end"),this.recognition.onresult=f=>{const{results:l,resultIndex:g}=f;let u="";if(l[g].isFinal&&l[g][0].transcript){const c={sentence:l[g][0].transcript,confidence:l[g][0].confidence,timeStamp:this.currentStamp,endTimeStamp:new Date().getTime()};this.transcripts.push(c),this.emit("sentence",c)}else this.currentStamp=new Date().getTime(),u+=l[g][0].transcript,this.emit("interim",{sentence:u,timeStamp:this.currentStamp});this.emit("result",f)})}}var Xs=Object.defineProperty,zo=Object.getOwnPropertySymbols,Zs=Object.prototype.hasOwnProperty,Qs=Object.prototype.propertyIsEnumerable,Pn=(r,e,t)=>e in r?Xs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,el=(r,e)=>{for(var t in e||(e={}))Zs.call(e,t)&&Pn(r,t,e[t]);if(zo)for(var t of zo(e))Qs.call(e,t)&&Pn(r,t,e[t]);return r},pt=(r,e,t)=>Pn(r,typeof e!="symbol"?e+"":e,t),Tn=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});class Ho{constructor(e={},t={}){pt(this,"mixer",null),pt(this,"recorder",null),pt(this,"localTranscriber",null),pt(this,"isRecording",!1),pt(this,"config"),pt(this,"callbacks"),this.config=el({mimeType:"video/webm;codecs=vp8,opus",videoBitsPerSecond:1e6,audioBitsPerSecond:128e3,interval:1e3},e),this.callbacks=t}startRecording(e,t){return Tn(this,null,function*(){var s,f,l,g;try{if(console.log("[CallRecorder] Starting recording with",e.length,"streams"),this.isRecording)throw new Error("Recording already in progress");if(!t)throw new Error("Recording data is required");this.mixer=new Hs(e),this.mixer.frameInterval=1,this.mixer.startDrawingFrames();const u=e[0];u&&u.getAudioTracks().length>0&&(this.localTranscriber=new Ks(u)),MediaRecorder.isTypeSupported(this.config.mimeType)||(console.warn("[CallRecorder] Preferred mime type not supported, falling back to default"),this.config.mimeType="video/webm");const c=this.mixer.getMixedStream();this.recorder=new MediaRecorder(c,{mimeType:this.config.mimeType,videoBitsPerSecond:this.config.videoBitsPerSecond,audioBitsPerSecond:this.config.audioBitsPerSecond}),this.setupRecorderEventHandlers(t),this.recorder.start(this.config.interval),this.isRecording=!0,this.localTranscriber&&this.localTranscriber.start(),(f=(s=this.callbacks).onRecordingStarted)==null||f.call(s,t),console.log("[CallRecorder] Recording started successfully")}catch(u){throw console.error("[CallRecorder] Failed to start recording:",u),(g=(l=this.callbacks).onError)==null||g.call(l,u),u}})}stopRecording(){return Tn(this,null,function*(){var e,t;try{if(console.log("[CallRecorder] Stopping recording"),!this.isRecording||!this.recorder)return console.warn("[CallRecorder] No active recording to stop"),[];this.recorder.stop(),this.isRecording=!1;let s=[];return this.localTranscriber&&(this.localTranscriber.stop(),s=this.localTranscriber.transcripts||[]),this.mixer&&this.mixer.releaseStreams(),console.log("[CallRecorder] Recording stopped successfully"),s}catch(s){return console.error("[CallRecorder] Failed to stop recording:",s),(t=(e=this.callbacks).onError)==null||t.call(e,s),[]}})}resetVideoStreams(e){this.mixer&&(this.mixer.resetVideoStreams(e),console.log("[CallRecorder] Video streams reset"))}setupRecorderEventHandlers(e){this.recorder&&(this.recorder.ondataavailable=t=>{var s,f;t.data&&t.data.size>0&&((f=(s=this.callbacks).onRecordingChunk)==null||f.call(s,t.data,e))},this.recorder.onstart=()=>{console.log("[CallRecorder] MediaRecorder started")},this.recorder.onstop=()=>{var t,s;console.log("[CallRecorder] MediaRecorder stopped"),(s=(t=this.callbacks).onRecordingStopped)==null||s.call(t,e)},this.recorder.onerror=t=>{var s,f;console.error("[CallRecorder] MediaRecorder error:",t),(f=(s=this.callbacks).onError)==null||f.call(s,new Error(`Recording error: ${t}`))})}getRecordingState(){var e,t;return{isRecording:this.isRecording,isTranscribing:this.localTranscriber!==null,transcriptCount:((t=(e=this.localTranscriber)==null?void 0:e.transcripts)==null?void 0:t.length)||0}}getTranscripts(){var e;return((e=this.localTranscriber)==null?void 0:e.transcripts)||[]}static isRecordingSupported(){return typeof MediaRecorder!="undefined"&&typeof MediaRecorder.isTypeSupported=="function"}static isTranscriptionSupported(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}static getSupportedMimeTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=h264,opus","video/webm","video/mp4;codecs=h264,aac","video/mp4"].filter(t=>MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported(t))}cleanup(){return Tn(this,null,function*(){console.log("[CallRecorder] Cleaning up recorder"),this.isRecording&&(yield this.stopRecording()),this.localTranscriber&&(this.localTranscriber.stop(),this.localTranscriber=null),this.mixer&&(this.mixer.releaseStreams(),this.mixer=null),this.recorder=null})}}var tl=Object.defineProperty,rl=Object.defineProperties,nl=Object.getOwnPropertyDescriptors,Jo=Object.getOwnPropertySymbols,il=Object.prototype.hasOwnProperty,ol=Object.prototype.propertyIsEnumerable,An=(r,e,t)=>e in r?tl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,al=(r,e)=>{for(var t in e||(e={}))il.call(e,t)&&An(r,t,e[t]);if(Jo)for(var t of Jo(e))ol.call(e,t)&&An(r,t,e[t]);return r},sl=(r,e)=>rl(r,nl(e)),Ge=(r,e,t)=>An(r,typeof e!="symbol"?e+"":e,t),Le=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});class Yo extends Wo{constructor(e,t={}){if(super(je),Ge(this,"config"),Ge(this,"callbacks"),Ge(this,"socket"),Ge(this,"localParticipant",null),Ge(this,"participants",new Map),Ge(this,"recorder",null),Ge(this,"iceServers",[]),Ge(this,"isInitialized",!1),Ge(this,"listenersSetup",!1),Ge(this,"roomId"),Ge(this,"eventListeners",new Map),this.roomId=e.roomId,!this.roomId)throw new Error("roomId must be provided in config");this.config=sl(al({maxParticipants:4,debug:!1,socketPath:"/apis/video-call",mediaConfig:{video:!0,audio:!0}},e),{roomId:this.roomId}),this.callbacks=t,this.socket=new $n(this.config.socketUrl,this.config.token,this.config.socketPath),this.iceServers=this.config.iceServers||[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}],this.state.setRoomId(this.roomId),console.log("[PeersCaller] Initialized with config:",{roomId:this.roomId,tokenLength:this.config.token.length,maxParticipants:this.config.maxParticipants})}initialize(){return Le(this,null,function*(){try{if(console.log("[PeersCaller] Initializing..."),this.isInitialized){console.warn("[PeersCaller] Already initialized");return}yield this.socket.connect(),yield this.fetchIceServers(),this.setupSocketListeners(),yield this.initializeLocalParticipant(),this.isInitialized=!0,this.state.setCallStatus("idle"),console.log("[PeersCaller] Initialization completed successfully (ready to start/join call)")}catch(e){throw console.error("[PeersCaller] Initialization failed:",e),this.handleError("NETWORK_ERROR",`Failed to initialize: ${e}`),e}})}startCall(){return Le(this,arguments,function*(e=this.config.mediaConfig){var t,s;try{if(console.log("[PeersCaller] Starting call..."),this.isInitialized||(yield this.initialize()),this.localParticipant&&!this.localParticipant.getCurrentStream()){const l={video:e!=null&&e.video&&typeof e.video=="boolean"?e.video:!0,audio:e!=null&&e.audio&&typeof e.audio=="boolean"?e.audio:!0};yield this.localParticipant.initialize(l)}this.state.setIsCalling(!0),this.state.setCallStatus("connecting"),console.log("[PeersCaller] Starting call for room:",this.config.roomId);const f=yield this.socket.startCall(this.config.roomId);if(console.log("[PeersCaller] Received call.start response:",f),f.success)this.state.setCallStatus("connected"),f.participants.forEach(l=>{l!==this.config.userId&&this.handleParticipantJoined(l)}),console.log("[PeersCaller] Call started successfully"),(s=(t=this.callbacks).onCallStarted)==null||s.call(t,f);else{this.state.setIsCalling(!1),this.state.setCallStatus("idle");const l="Failed to start call on server";throw this.handleError("SIGNALING_ERROR",l),console.error("[PeersCaller] Call start failed:",l),new Error(l)}}catch(f){throw console.error("[PeersCaller] Failed to start call:",f),this.handleError("MEDIA_ACCESS_DENIED",`Failed to start call: ${f}`),f}})}joinCall(){return Le(this,arguments,function*(e=this.config.mediaConfig){try{console.log("[PeersCaller] Joining call..."),this.isInitialized||(yield this.initialize());const t=yield this.checkCallStatus();if(!t.hasActiveCall)throw new Error("No active call found");if(!t.canJoin)throw new Error(`Cannot join call: ${t.status==="full"?"Call is full":"Unable to join"}`);if(this.state.setCallStatus("connecting"),this.localParticipant&&!this.localParticipant.getCurrentStream()){const f={video:typeof(e==null?void 0:e.video)=="boolean"?e.video:!0,audio:typeof(e==null?void 0:e.audio)=="boolean"?e.audio:!0};console.log("[PeersCaller] Initializing local media with config:",f),yield this.localParticipant.initialize(f)}console.log("[PeersCaller] Joining call for room:",this.config.roomId);const s=yield this.socket.joinRoom(this.config.roomId);console.log("[PeersCaller] Received call.join response:",s),this.state.setCallStatus("connected"),this.state.setIsCalling(!0),s.participants.forEach(f=>{f!==this.config.userId&&this.handleParticipantJoined(f)}),console.log("[PeersCaller] Joined call successfully")}catch(t){throw console.error("[PeersCaller] Failed to join call:",t),this.state.setCallStatus("idle"),this.handleError("INVALID_ROOM_ID",`Failed to join call: ${t}`),t}})}endCall(){return Le(this,null,function*(){try{console.log("[PeersCaller] Ending call..."),this.recorder&&this.state.isRecording&&(yield this.stopRecording());try{yield this.socket.endCallForAll(this.config.roomId),console.log("[PeersCaller] End call request sent to server")}catch(e){console.warn("[PeersCaller] Failed to notify server of call end:",e)}this.cleanupAllParticipants(),this.state.setIsCalling(!1),this.state.setCallStatus("idle"),this.state.clearParticipants(),console.log("[PeersCaller] Call ended successfully")}catch(e){console.error("[PeersCaller] Error ending call:",e)}})}leaveCall(){return Le(this,null,function*(){try{console.log("[PeersCaller] Leaving call..."),console.log("[PeersCaller] Leaving call for room:",this.config.roomId);const e=yield this.socket.leaveCall(this.config.roomId);if(console.log("[PeersCaller] Received call.leave response:",e),e.success)this.cleanupAllParticipants(),this.state.setIsCalling(!1),this.state.setCallStatus("idle"),this.state.clearParticipants(),console.log("[PeersCaller] Left call successfully");else{const t="Failed to leave call on server";throw this.handleError("SIGNALING_ERROR",t),console.error("[PeersCaller] Call leave failed:",t),new Error(t)}}catch(e){throw console.error("[PeersCaller] Failed to leave call:",e),this.handleError("SIGNALING_ERROR",`Failed to leave call: ${e}`),e}})}toggleAudio(e){this.localParticipant&&(this.localParticipant.toggleAudio(e),this.broadcastStateUpdate({audioOn:e}),console.log(`[PeersCaller] Audio ${e?"enabled":"disabled"}`))}toggleVideo(e){this.localParticipant&&(this.localParticipant.toggleVideo(e),this.broadcastStateUpdate({videoOn:e}),console.log(`[PeersCaller] Video ${e?"enabled":"disabled"}`))}startScreenShare(){return Le(this,null,function*(){try{if(!this.localParticipant)throw new Error("Local participant not initialized");yield this.localParticipant.startScreenShare(),this.broadcastStateUpdate({screenSharing:!0}),console.log("[PeersCaller] Screen sharing started")}catch(e){throw console.error("[PeersCaller] Failed to start screen share:",e),this.handleError("MEDIA_ACCESS_DENIED",`Failed to start screen share: ${e}`),e}})}stopScreenShare(){return Le(this,null,function*(){try{if(!this.localParticipant)throw new Error("Local participant not initialized");yield this.localParticipant.stopScreenShare(),this.broadcastStateUpdate({screenSharing:!1}),console.log("[PeersCaller] Screen sharing stopped")}catch(e){throw console.error("[PeersCaller] Failed to stop screen share:",e),e}})}startRecording(e,t){return Le(this,null,function*(){var s;try{if(console.log("[PeersCaller] Starting recording..."),this.state.isRecording){console.warn("[PeersCaller] Recording already in progress");return}const f=[],l=(s=this.localParticipant)==null?void 0:s.getCurrentStream();l&&f.push(l);for(const g of this.participants.values()){const u=g.getCurrentStream();u&&f.push(u)}if(f.length===0)throw new Error("No streams available for recording");this.recorder=new Ho(t,{onRecordingStarted:g=>{this.socket.startRecording(this.config.roomId,g.id)},onRecordingChunk:(g,u)=>{this.socket.sendRecordingChunk(this.config.roomId,u.id,g)},onRecordingStopped:g=>{this.socket.endRecording(this.config.roomId,g.id)},onTranscriptReceived:g=>{this.socket.sendTranscript(this.config.roomId,g.text)},onError:g=>{this.handleError("RECORDING_FAILED",g.message)}}),yield this.recorder.startRecording(f,e),this.state.setIsRecording(!0),console.log("[PeersCaller] Recording started successfully")}catch(f){throw console.error("[PeersCaller] Failed to start recording:",f),this.handleError("RECORDING_FAILED",`Failed to start recording: ${f}`),f}})}stopRecording(){return Le(this,null,function*(){try{if(console.log("[PeersCaller] Stopping recording..."),!this.recorder||!this.state.isRecording){console.warn("[PeersCaller] No active recording to stop");return}yield this.recorder.stopRecording(),this.state.setIsRecording(!1),console.log("[PeersCaller] Recording stopped successfully")}catch(e){throw console.error("[PeersCaller] Failed to stop recording:",e),e}})}getCallState(){return this.state}getLocalParticipant(){return this.localParticipant}getParticipants(){return new Map(this.participants)}getParticipant(e){return this.participants.get(e)}getDebugInfo(){return{isInitialized:this.isInitialized,localParticipant:this.localParticipant?{userId:this.localParticipant.getUserId(),hasStream:!!this.localParticipant.getCurrentStream(),streamTracks:this.localParticipant.getCurrentStream()?{video:this.localParticipant.getCurrentStream().getVideoTracks().length,audio:this.localParticipant.getCurrentStream().getAudioTracks().length}:null,peerConnections:Array.from(this.localParticipant.getAllPeerConnections().keys()),connectionStatus:this.localParticipant.getConnectionStatus()}:null,remoteParticipants:Array.from(this.participants.keys()),storeState:this.state,socketConnected:this.socket.isConnected()}}cleanup(){console.log("[PeersCaller] Cleaning up..."),this.state.isCalling&&this.endCall(),this.cleanupSocketListeners(),this.cleanupAllParticipants(),this.recorder&&(this.recorder.cleanup(),this.recorder=null),this.socket.disconnect(),this.state.resetCall(),this.isInitialized=!1,console.log("[PeersCaller] Cleanup completed")}initializeLocalParticipant(){return Le(this,null,function*(){this.localParticipant=new Cn(this.config.userId,{onSignal:(e,t,s)=>{this.forwardSignalToServer(e,t,s)},onError:e=>this.handleError("UNKNOWN_ERROR",e.message)},!0),console.log("[PeersCaller] Local participant created (media not initialized yet)")})}setupSocketListeners(){if(this.listenersSetup){console.log("[PeersCaller] Socket listeners already set up, skipping...");return}this.cleanupSocketListeners(),console.log("[PeersCaller] Setting up socket listeners...");const e=T=>{this.handleParticipantJoined(T.userId)};this.socket.on("call.participant.joined",e),this.eventListeners.set("call.participant.joined",e);const t=T=>{this.handleParticipantLeft(T.userId)};this.socket.on("call.participant.left",t),this.eventListeners.set("call.participant.left",t);const s=T=>{T.participants.forEach(m=>{m!==this.config.userId&&this.handleParticipantJoined(m)})};this.socket.on("call.participants",s),this.eventListeners.set("call.participants",s);const f=()=>{this.state.setIsCalling(!1)};this.socket.on("call.left",f),this.eventListeners.set("call.left",f);const l=T=>{var m,R;console.error("[PeersCaller] Server error:",T),(R=(m=this.callbacks).onError)==null||R.call(m,T.error,T.message)};this.socket.on("call.error",l),this.eventListeners.set("call.error",l);const g=T=>{this.handleOffer(T.from,T.offer)};this.socket.on("call.offer",g),this.eventListeners.set("call.offer",g);const u=T=>{this.handleAnswer(T.from,T.answer)};this.socket.on("call.answer",u),this.eventListeners.set("call.answer",u);const c=T=>{this.handleCandidate(T.from,T.candidate)};this.socket.on("call.candidate",c),this.eventListeners.set("call.candidate",c);const v=T=>{this.handleParticipantStateUpdate(T.from,T.state)};this.socket.on("call.state",v),this.eventListeners.set("call.state",v);const h=T=>{this.handleCallEnded(T)};this.socket.on("call.ended",h),this.eventListeners.set("call.ended",h);const I=T=>{this.handleCallStatusChanged(T)};this.socket.on("call.status.changed",I),this.eventListeners.set("call.status.changed",I);const B=T=>{console.log("[PeersCaller] Recording started:",T.recordingId),this.state.setIsRecording(!0)};this.socket.on("call.recording.start",B),this.eventListeners.set("call.recording.start",B);const x=T=>{console.log("[PeersCaller] Recording chunk received:",T)};this.socket.on("call.recording.chunk.received",x),this.eventListeners.set("call.recording.chunk.received",x);const b=T=>{console.log("[PeersCaller] Recording ended:",T.recordingId),this.state.setIsRecording(!1)};this.socket.on("call.recording.end",b),this.eventListeners.set("call.recording.end",b);const N=T=>{console.log("[PeersCaller] Transcript received:",T)};this.socket.on("call.transcript",N),this.eventListeners.set("call.transcript",N),this.listenersSetup=!0,console.log("[PeersCaller] Socket listeners set up successfully")}cleanupSocketListeners(){if(!(!this.listenersSetup&&this.eventListeners.size===0)){console.log("[PeersCaller] Cleaning up socket listeners...");for(const[e,t]of this.eventListeners)this.socket.off(e,t);this.eventListeners.clear(),this.listenersSetup=!1,console.log("[PeersCaller] Socket listeners cleaned up successfully")}}handleParticipantJoined(e){return Le(this,null,function*(){var t,s;try{if(e===this.config.userId||this.participants.has(e))return;if(this.participants.size>=this.config.maxParticipants-1){console.warn("[PeersCaller] Maximum participants reached");return}console.log(`[PeersCaller] Participant ${e} joined`);const f=new Cn(e,{onStreamReceived:(u,c)=>{var v,h;(h=(v=this.callbacks).onStreamReceived)==null||h.call(v,u,c)},onPeerConnected:u=>{console.log(`[PeersCaller] Peer connection established with ${u}`)},onPeerDisconnected:u=>{this.handleParticipantLeft(u)},onSignal:(u,c,v)=>{this.forwardSignalToServer(u,c,v)},onError:u=>{this.handleError("PEER_CONNECTION_FAILED",u.message)}},!1);if(this.participants.set(e,f),!this.localParticipant){console.error("[PeersCaller] Cannot create peer connection - local participant not initialized");return}const l=this.config.userId<e,g={iceServers:this.iceServers,initiator:l};yield this.localParticipant.createPeerConnection(e,g,l),(s=(t=this.callbacks).onParticipantJoined)==null||s.call(t,{userId:e,videoOn:!0,audioOn:!0,screenSharing:!1})}catch(f){console.error(`[PeersCaller] Failed to handle participant ${e} joining:`,f)}})}checkCallStatus(){return Le(this,null,function*(){try{if(console.log("[PeersCaller] Checking call status..."),!this.socket.isConnected())throw new Error("Socket not connected");this.state.setCallStatusLoading(!0),this.state.setCallStatusError(null);const e=yield this.socket.checkCallStatus(this.config.roomId);return this.state.setCallStatusInfo(e),this.state.setCallStatusLoading(!1),console.log("[PeersCaller] Call status received:",e),e}catch(e){console.error("[PeersCaller] Failed to check call status:",e);const t=e instanceof Error?e.message:String(e);throw this.state.setCallStatusLoading(!1),this.state.setCallStatusError(t),this.handleError("NETWORK_ERROR",`Failed to check call status: ${t}`),e}})}handleOffer(e,t){return Le(this,null,function*(){try{if(!this.localParticipant){console.warn(`[PeersCaller] Received offer from ${e} but local participant not initialized`);return}const s=this.localParticipant.getPeerConnection(e);s?(console.log(`[PeersCaller] Processing offer from ${e}`),s.signal({type:"offer",sdp:t.sdp})):console.warn(`[PeersCaller] No peer connection found for offer from ${e}`)}catch(s){console.error(`[PeersCaller] Failed to handle offer from ${e}:`,s)}})}handleAnswer(e,t){return Le(this,null,function*(){try{if(!this.localParticipant){console.warn(`[PeersCaller] Received answer from ${e} but local participant not initialized`);return}const s=this.localParticipant.getPeerConnection(e);s?(console.log(`[PeersCaller] Processing answer from ${e}`),s.signal({type:"answer",sdp:t.sdp})):console.warn(`[PeersCaller] No peer connection found for answer from ${e}`)}catch(s){console.error(`[PeersCaller] Failed to handle answer from ${e}:`,s)}})}handleCandidate(e,t){return Le(this,null,function*(){try{if(!this.localParticipant){console.warn(`[PeersCaller] Received candidate from ${e} but local participant not initialized`);return}const s=this.localParticipant.getPeerConnection(e);s?(console.log(`[PeersCaller] Processing candidate from ${e}`),s.signal({type:"candidate",candidate:t})):console.warn(`[PeersCaller] No peer connection found for candidate from ${e}`)}catch(s){console.error(`[PeersCaller] Failed to handle candidate from ${e}:`,s)}})}handleParticipantStateUpdate(e,t){var s,f;this.state.updateParticipant(e,t),(f=(s=this.callbacks).onParticipantStateChanged)==null||f.call(s,e,t)}handleParticipantLeft(e){var t,s;console.log(`[PeersCaller] Participant ${e} left`);const f=this.participants.get(e);f&&(f.cleanup(),this.participants.delete(e)),this.state.removeParticipant(e),(s=(t=this.callbacks).onParticipantLeft)==null||s.call(t,e)}handleCallEnded(e){return Le(this,null,function*(){var t,s;console.log(`[PeersCaller] Call ended by ${e.endedBy}, reason: ${e.reason}`);try{this.recorder&&this.state.isRecording&&(yield this.stopRecording()),this.cleanupAllParticipants(),this.state.setIsCalling(!1),this.state.setCallStatus("idle"),this.state.clearParticipants(),(s=(t=this.callbacks).onCallEnded)==null||s.call(t,e),console.log("[PeersCaller] Call ended cleanup completed")}catch(f){console.error("[PeersCaller] Error handling call ended:",f)}})}broadcastStateUpdate(e){for(const t of this.participants.keys())this.socket.sendStateUpdate(t,e,this.config.roomId)}handleCallStatusChanged(e){var t,s;console.log("[PeersCaller] Call status changed:",e),this.state.setCallStatusInfo(e),(s=(t=this.callbacks).onCallStatusChanged)==null||s.call(t,e)}cleanupAllParticipants(){for(const e of this.participants.values())e.cleanup();this.participants.clear(),this.localParticipant&&(this.localParticipant.cleanup(),this.localParticipant=null)}handleError(e,t){var s,f;console.error(`[PeersCaller] ${e}: ${t}`),this.state.setError(e,t),(f=(s=this.callbacks).onError)==null||f.call(s,e,t)}fetchIceServers(){return Le(this,null,function*(){try{console.log("[PeersCaller] Fetching ICE servers from backend...");const e=yield this.socket.getIceServers(this.roomId);if(e.error){console.warn("[PeersCaller] Failed to fetch ICE servers from backend:",e.error),console.log("[PeersCaller] Using default ICE servers");return}e.iceServers&&e.iceServers.length>0?this.iceServers=e.iceServers:console.log("[PeersCaller] No ICE servers received from backend, using defaults")}catch(e){console.warn("[PeersCaller] Error fetching ICE servers:",e)}})}forwardSignalToServer(e,t,s){try{switch(console.log(`[PeersCaller] Forwarding signal from ${e} to ${t}:`,s.type),s.type){case"offer":this.socket.sendOffer(t,s,this.config.roomId);break;case"answer":this.socket.sendAnswer(t,s,this.config.roomId);break;case"candidate":this.socket.sendCandidate(t,s.candidate,this.config.roomId);break;case"renegotiate":console.log(`[PeersCaller] Renegotiation signal from ${e} to ${t} - handled locally`);break;default:console.warn(`[PeersCaller] Unknown signal type: ${s.type} - this may indicate a new signal type that needs handling`),this.config.debug&&console.log("[PeersCaller] Unknown signal data:",s);break}}catch(f){console.error(`[PeersCaller] Failed to forward signal from ${e} to ${t}:`,f),this.handleError("SIGNALING_ERROR",`Failed to forward signal: ${f}`)}}}var Xe=(r,e,t)=>new Promise((s,f)=>{var l=c=>{try{u(t.next(c))}catch(v){f(v)}},g=c=>{try{u(t.throw(c))}catch(v){f(v)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,g);u((t=t.apply(r,e)).next())});function ll(r){const[e,t]=ue.useState(null),[s,f]=ue.useState(!1),l=ue.useRef(!1),g=je(C=>C),u=Object.values(je(C=>C.participants)),c=je(C=>C.localParticipant),v=je(C=>C.callStatus==="connected"),h=je(C=>C.isRecording),I=je(C=>C.error),B=ue.useCallback(()=>Xe(null,null,function*(){if(!(l.current||e))try{l.current=!0;const C=new Yo(r,r.callbacks);yield C.initialize(),t(C),f(!0)}catch(C){throw console.error("[useVideoCall] Failed to initialize:",C),l.current=!1,C}}),[r,e]),x=ue.useCallback(C=>Xe(null,null,function*(){if(!e){yield B();return}return e.startCall(C)}),[e,B]),b=ue.useCallback(C=>Xe(null,null,function*(){if(!e){yield B();return}return e.joinCall(C)}),[e,B]),N=ue.useCallback(()=>{e==null||e.endCall()},[e]),T=ue.useCallback(C=>{e==null||e.toggleAudio(C)},[e]),m=ue.useCallback(C=>{e==null||e.toggleVideo(C)},[e]),R=ue.useCallback(()=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.startScreenShare()}),[e]),A=ue.useCallback(()=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.stopScreenShare()}),[e]),P=ue.useCallback(C=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.startRecording(C)}),[e]),k=ue.useCallback(()=>Xe(null,null,function*(){if(!e)throw new Error("PeersCaller not initialized");return e.stopRecording()}),[e]),S=ue.useCallback(()=>{e&&(e.cleanup(),t(null),f(!1),l.current=!1)},[e]);return ue.useEffect(()=>{r.autoInitialize&&!s&&!l.current&&B().catch(console.error)},[r.autoInitialize,s,B]),ue.useEffect(()=>()=>{S()},[S]),{initialize:B,startCall:x,joinCall:b,endCall:N,toggleAudio:T,toggleVideo:m,startScreenShare:R,stopScreenShare:A,startRecording:P,stopRecording:k,callState:g,participants:u,localParticipant:c,isConnected:v,isRecording:h,error:I,cleanup:S,peersCaller:e}}function cl(r){const[e,t]=ue.useState(null),[s,f]=ue.useState(null),l=je(g=>g.participants[r]);return ue.useEffect(()=>{var g;if(l!=null&&l.stream){if(f(l.stream),!e){const u=document.createElement("video");u.autoplay=!0,u.playsInline=!0,u.muted=r===((g=je.getState().localParticipant)==null?void 0:g.userId),t(u)}e&&(e.srcObject=l.stream)}},[l==null?void 0:l.stream,r,e]),ue.useEffect(()=>()=>{e&&(e.srcObject=null)},[e]),{videoElement:e,stream:s,participant:l}}function ul(){const r=je();return{roomId:r.roomId,participants:r.participants,localParticipant:r.localParticipant,isCalling:r.isCalling,isRecording:r.isRecording,recordLoading:r.recordLoading,callStatus:r.callStatus,error:r.error,participantCount:Object.keys(r.participants).length,isConnected:r.callStatus==="connected",hasError:!!r.error}}function fl(){const[r,e]=ue.useState({videoDevices:[],audioDevices:[]}),[t,s]=ue.useState({camera:null,microphone:null}),f=ue.useCallback(()=>Xe(null,null,function*(){try{const u=yield navigator.mediaDevices.enumerateDevices();e({videoDevices:u.filter(c=>c.kind==="videoinput"),audioDevices:u.filter(c=>c.kind==="audioinput")})}catch(u){console.error("[useMediaDevices] Failed to get devices:",u)}}),[]),l=ue.useCallback(()=>Xe(null,null,function*(){try{if("permissions"in navigator){const u=yield navigator.permissions.query({name:"camera"}),c=yield navigator.permissions.query({name:"microphone"});s({camera:u.state,microphone:c.state})}}catch(u){console.error("[useMediaDevices] Failed to check permissions:",u)}}),[]),g=ue.useCallback(()=>Xe(null,null,function*(){try{return(yield navigator.mediaDevices.getUserMedia({video:!0,audio:!0})).getTracks().forEach(c=>c.stop()),yield l(),yield f(),!0}catch(u){return console.error("[useMediaDevices] Failed to request permissions:",u),!1}}),[l,f]);return ue.useEffect(()=>{var u;f(),l();const c=()=>{f()};return(u=navigator.mediaDevices)==null||u.addEventListener("devicechange",c),()=>{var v;(v=navigator.mediaDevices)==null||v.removeEventListener("devicechange",c)}},[f,l]),{devices:r,permissions:t,getDevices:f,checkPermissions:l,requestPermissions:g}}function hl(){const[r,e]=ue.useState({webRTC:!1,getUserMedia:!1,getDisplayMedia:!1,mediaRecorder:!1,speechRecognition:!1});return ue.useEffect(()=>{e({webRTC:!!window.RTCPeerConnection,getUserMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),getDisplayMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia),mediaRecorder:typeof MediaRecorder!="undefined",speechRecognition:!!(window.SpeechRecognition||window.webkitSpeechRecognition)})},[]),{support:r,isSupported:Object.values(r).every(Boolean),unsupportedFeatures:Object.entries(r).filter(([,t])=>!t).map(([t])=>t)}}function dl(r=""){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return r?`${r}_${e}_${t}`:`${e}_${t}`}const pl=()=>`peer_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gl=r=>!r||typeof r!="string"?!1:/^peer_\d+_[a-z0-9]{1,9}$/.test(r),yl=r=>{var e,t;return{video:(e=r.video)!=null?e:!0,audio:(t=r.audio)!=null?t:!0}};function ml(r,e,t){const s=`[${r}] ${e}`,f=new Error(s);return t&&(f.details=t),f}function vl(){const r={getUserMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),getDisplayMedia:!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia),RTCPeerConnection:!!window.RTCPeerConnection,MediaRecorder:typeof MediaRecorder!="undefined",WebSocket:typeof WebSocket!="undefined"},e=Object.entries(r).filter(([,t])=>!t).map(([t])=>t);return{supported:e.length===0,features:r,missingFeatures:e}}const wl=()=>{try{return typeof window!="undefined"&&typeof window.RTCPeerConnection!="undefined"&&typeof navigator!="undefined"&&typeof navigator.mediaDevices!="undefined"&&typeof navigator.mediaDevices.getUserMedia!="undefined"}catch(r){return!1}};function bl(){return[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"},{urls:"stun:stun2.l.google.com:19302"},{urls:"stun:stun3.l.google.com:19302"}]}te.CallMediaStream=jn,te.CallParticipant=Cn,te.CallPeerConnection=No,te.CallRecorder=Ho,te.CallSocket=$n,te.PeersCaller=Yo,te.canAcceptMoreParticipants=Ns,te.checkWebRTCSupport=vl,te.formatError=ml,te.formatMediaConstraints=yl,te.generateId=dl,te.generatePeerId=pl,te.getDefaultIceServers=bl,te.getParticipant=xo,te.getParticipantList=Ls,te.isParticipantConnected=Ms,te.isValidPeerId=gl,te.isWebRTCSupported=wl,te.selectCallStatus=Rs,te.selectCallStatusError=Bs,te.selectCallStatusInfo=As,te.selectCallStatusLoading=Is,te.selectCanJoinCall=ks,te.selectError=Ts,te.selectIsCallActive=Os,te.selectIsConnected=Ps,te.selectLocalParticipant=Cs,te.selectParticipantCount=qo,te.selectParticipants=Es,te.useBrowserSupport=hl,te.useCallState=ul,te.useCallStore=je,te.useMediaDevices=fl,te.useParticipantVideo=cl,te.useVideoCall=ll,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})});
27
27
  //# sourceMappingURL=peers-caller.umd.js.map